top

CAPH.WUI.ENGINE.RENDERING.TEXTURE

This document is to explain caph.wui.engine.rendering.Texture.


Methods

Texture

Description
The constructor of Texture component, in order to create Texture object. Return a factory to create a Texture component.
Parameters
■Void
Return■Object
  - a factory to create a Texture
Emulator SupportY
SDK Constraintnone
Example
var AccRendering = caph.wui.engine.rendering;

var basePage = new AccRendering.BasePage();

var geometry = new AccRendering.CubeGeometry().build(100, 100, 100);

var texture = new AccRendering.Texture().loadImage("../res/memorial.png", {repeatX: 3, repeatY: 2}, function () {
        renderer.render(basePage);
    });

var matrial = new AccRendering.BasicMaterial();
var object = new AccRendering.Mesh3d(geometry, material.build({map: texture}));

basePage.add(object);

var renderer = new AccRendering.WebglRenderer();
renderer.render(basePage);

loadImage

Description
Texture 'loadImage' method allows you to set image as texture. This method takes a url,an option and onLoadCB as arguments.
Parameters
■url
  - String
  - url of the image    
■option
  - Object   
  - "options for load image 
   * repeatX : (Number) image mapping along the width of the sides  
    - [default : 1]
   * repeatY : (Number) image mapping along the height of the sides 
    - [default : 1]    
  - onLoadCB   : callback function
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var AccRendering = caph.wui.engine.rendering;

var basePage = new AccRendering.BasePage();

var geometry = new AccRendering.CubeGeometry().build(100, 100, 100);

var texture = new AccRendering.Texture().loadImage("../res/memorial.png", {repeatX: 3, repeatY: 2}, function () {
        renderer.render(basePage);
    });

var matrial = new AccRendering.BasicMaterial();
var object = new AccRendering.Mesh3d(geometry, material.build({map: texture}));

basePage.add(object);

var renderer = new AccRendering.WebglRenderer();
renderer.render(basePage);