projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New layouting classes
[platform/core/uifw/dali-toolkit.git]
/
node-addon
/
examples
/
texture-mesh.js
diff --git
a/node-addon/examples/texture-mesh.js
b/node-addon/examples/texture-mesh.js
index
bacde6b
..
27f7744
100644
(file)
--- a/
node-addon/examples/texture-mesh.js
+++ b/
node-addon/examples/texture-mesh.js
@@
-20,11
+20,14
@@
var imageDir = "./images/";
var imageDir = "./images/";
-// desktop
-//var dali = require('../build/Release/dali')( options );
-
-// target
-var dali = require('dali')( options );
+try {
+ // target
+ var dali = require('dali')( options );
+}
+catch(err) {
+ // desktop
+ var dali = require('../build/Release/dali')( options );
+}
var daliApp = {};
var daliApp = {};
@@
-64,13
+67,13
@@
daliApp.createMeshActor = function() {
var shader = new dali.Shader(shaderOptions);
var shader = new dali.Shader(shaderOptions);
- var
material = new dali.Material( shader )
;
+ var
textureSet = new dali.TextureSet
;
var image = new dali.ResourceImage( {url: imageDir + "image-1.jpg"} );
var image = new dali.ResourceImage( {url: imageDir + "image-1.jpg"} );
-
material.addTexture(image, "sTexture"
);
+
textureSet.setImage(0, image
);
- var
material2 = new dali.Material( shader )
;
+ var
textureSet2 = new dali.TextureSet
;
var image2 = new dali.ResourceImage( {url: imageDir + "image-2.jpg"} );
var image2 = new dali.ResourceImage( {url: imageDir + "image-2.jpg"} );
-
material2.addTexture(image2, "sTexture"
);
+
textureSet2.setImage(0, image2
);
// Create vertex buffer
var texturedQuadVertexFormat ={ "aPosition" : dali.PROPERTY_VECTOR2,
// Create vertex buffer
var texturedQuadVertexFormat ={ "aPosition" : dali.PROPERTY_VECTOR2,
@@
-93,15
+96,14
@@
daliApp.createMeshActor = function() {
var indexDataArray = new Uint32Array(indexData.length);
indexDataArray.set(indexData, 0);
var indexDataArray = new Uint32Array(indexData.length);
indexDataArray.set(indexData, 0);
- var indices = new dali.PropertyBuffer(indexFormat);
- indices.setData(indexDataArray, 6);
// Create geometry
var geometry = new dali.Geometry();
geometry.addVertexBuffer( texturedQuadVertices );
// Create geometry
var geometry = new dali.Geometry();
geometry.addVertexBuffer( texturedQuadVertices );
- geometry.setIndexBuffer( ind
ices
);
+ geometry.setIndexBuffer( ind
exDataArray, 6
);
- var renderer = new dali.Renderer(geometry, material);
+ var renderer = new dali.Renderer(geometry, shader);
+ renderer.setTextures(textureSet);
renderer.depthIndex = 0;
var meshActor = new dali.Actor();
renderer.depthIndex = 0;
var meshActor = new dali.Actor();
@@
-113,7
+115,8
@@
daliApp.createMeshActor = function() {
dali.stage.add( meshActor );
dali.stage.add( meshActor );
- var renderer2 = new dali.Renderer(geometry, material2);
+ var renderer2 = new dali.Renderer(geometry, shader);
+ renderer2.setTextures(textureSet2);
renderer2.depthIndex = 0;
var meshActor2 = new dali.Actor();
renderer2.depthIndex = 0;
var meshActor2 = new dali.Actor();