Skip to content

Commit

Permalink
Merge pull request #445 from jacquesc/plugin-updates
Browse files Browse the repository at this point in the history
update attribute accessors used in examples
  • Loading branch information
xeolabs committed Feb 22, 2016
2 parents 91b0ec3 + b502840 commit d40f1f4
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 113 deletions.
56 changes: 27 additions & 29 deletions examples/libs/gui/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,22 @@ SceneJS.GUI = function (scene, nodeIds) {
var self = this;

var update = function () {
material.set({
color:{
r:self["color.r"],
g:self["color.g"],
b:self["color.b"]
},
specularColor:{
r:self["specularColor.r"],
g:self["specularColor.g"],
b:self["specularColor.b"]
},
specular:self.specular,
shine:self.shine,
emit:self.emit,
alpha:self.alpha

material.setColor({
r: self["color.r"],
g: self["color.g"],
b: self["color.b"]
});
material.setSpecularColor({
r: self["specularColor.r"],
g: self["specularColor.g"],
b: self["specularColor.b"]
});
material.setSpecular(self.specular);
material.setShine(self.shine);
material.setEmit(self.emit);
material.setAlpha(self.alpha);

requestAnimationFrame(update);
};
update();
Expand Down Expand Up @@ -269,12 +269,12 @@ SceneJS.GUI = function (scene, nodeIds) {
this.angle = 0.0;
var self = this;
var update = function () {
rotate.set({
rotate.setXYZ({
x:self.x,
y:self.y,
z:self.z,
angle:self.angle
z:self.z
});
rotate.setAngle(self.angle);
requestAnimationFrame(update);
};
update();
Expand All @@ -295,7 +295,7 @@ SceneJS.GUI = function (scene, nodeIds) {
this.z = 0.0;
var self = this;
var update = function () {
scale.set({
scale.setXYZ({
x:self.x,
y:self.y,
z:self.z
Expand All @@ -319,7 +319,7 @@ SceneJS.GUI = function (scene, nodeIds) {
this.z = 0.0;
var self = this;
var update = function () {
translate.set({
translate.setXYZ({
x:self.x,
y:self.y,
z:self.z
Expand Down Expand Up @@ -349,15 +349,13 @@ SceneJS.GUI = function (scene, nodeIds) {

var self = this;
var update = function () {
flags.set({
picking:self.picking,
enabled:self.enabled,
transparent:self.transparent,
backfaces:self.backfaces,
frontface:self.frontface,
reflective: self.reflective,
solid: self.solid
});
flags.setPicking(self.picking);
flags.setEnabled(self.enabled);
flags.setTransparent(self.transparent);
flags.setBackfaces(self.backfaces);
flags.setFrontface(self.frontface);
flags.setReflective(self.reflective);
flags.setSolid(self.solid);
requestAnimationFrame(update);
};
update();
Expand Down
2 changes: 1 addition & 1 deletion examples/picking_rayPicking_triangles.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
markerContext.fill();

indicatorFlags.setEnabled(true);
worldPosIndicator.set({
worldPosIndicator.setXYZ({
x: worldPos[0],
y: worldPos[1],
z: worldPos[2]
Expand Down
4 changes: 2 additions & 2 deletions examples/stages_convolution.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/stages_custom_convolution.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/stages_scanlines.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/stages_threeStages.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 2);
teapotPitch.inc("angle", .5);
teapotYaw.incAngle(2);
teapotPitch.incAngle(.5);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/stages_twoStages.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/stages_withSharedShader.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 2);
teapotPitch.inc("angle", .5);
teapotYaw.incAngle(2);
teapotPitch.incAngle(.5);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/stages_withTransparencySort.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@
scene.getNode("yaw", function (yaw) {
scene.on("tick",
function () {
yaw.inc("angle", 1);
pitch.inc("angle", .3);
yaw.incAngle(1);
pitch.incAngle(.3);
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_color.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_depthAndColor.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});
});
Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_depthAndColor2.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_heightmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_manyTextures.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_shader.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_sharedTexture.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
4 changes: 2 additions & 2 deletions examples/texture_rtt_withVideo.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@

scene.on("tick",
function () {
teapotYaw.inc("angle", 1);
teapotPitch.inc("angle", .3);
teapotYaw.incAngle(1);
teapotPitch.incAngle(.3);

});

Expand Down
2 changes: 1 addition & 1 deletion examples/transforms_modelling_scale.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
xInc *= -1;
}
x += xInc;
myScale.set({ x:x, y:1, z:1 });
myScale.setXYZ({ x:x, y:1, z:1 });
});
});

Expand Down
2 changes: 1 addition & 1 deletion examples/transforms_modelling_scale_invert.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
xInc *= -1;
}
x += xInc;
myScale.set({ x:x, y:1, z:1 });
myScale.setXYZ({ x:x, y:1, z:1 });
});
});

Expand Down
2 changes: 1 addition & 1 deletion examples/transforms_modelling_translate.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
xInc *= -1;
}
x += xInc;
myTranslate.set({ x:x });
myTranslate.setX(x);
});
});

Expand Down
8 changes: 3 additions & 5 deletions src/plugins/node/cameras/orbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ SceneJS.Types.addType("cameras/orbit", {
var eye = params.eye || { x: 0, y: 0, z: 0 };
var look = params.look || { x: 0, y: 0, z: 0};

lookat.set({
eye: { x: eye.x, y: eye.y, z: -zoom },
look: { x: look.x, y: look.y, z: look.z },
up: { x: 0, y: 1, z: 0 }
});
lookat.setEye({ x: eye.x, y: eye.y, z: -zoom });
lookat.setLook({ x: look.x, y: look.y, z: look.z });
lookat.setUp({ x: 0, y: 1, z: 0 });

var spin = params.spin;

Expand Down
4 changes: 3 additions & 1 deletion src/plugins/node/cameras/pickFlyOrbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ require([
look: { x: look.x, y: look.y, z: look.z },
up: { x: 0, y: 1, z: 0 }
};
lookat.set(lookatArgs);
lookat.setEye(lookatArgs.eye);
lookat.setLook(lookatArgs.look);
lookat.setUp(lookatArgs.up);
this.publish("updated", lookatArgs);

var canvas = this.getScene().getCanvas();
Expand Down
24 changes: 10 additions & 14 deletions src/plugins/node/effects/anaglyph.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ SceneJS.Types.addType("effects/anaglyph", {
self._localLookat.setEye(rightEye);
self._localLookat.setLook(rightLook);

self._camera.set({
optics: {
left: -ratio * wd2 - 0.5 * self._eyeSep * ndfl,
right: ratio * wd2 - 0.5 * self._eyeSep * ndfl,
top: wd2,
bottom: -wd2
}
self._camera.setOptics({
left: -ratio * wd2 - 0.5 * self._eyeSep * ndfl,
right: ratio * wd2 - 0.5 * self._eyeSep * ndfl,
top: wd2,
bottom: -wd2
});

self._colorBuffer.setColorMask({
Expand All @@ -206,13 +204,11 @@ SceneJS.Types.addType("effects/anaglyph", {
self._localLookat.setEye(leftEye);
self._localLookat.setLook(leftLook);

self._camera.set({
optics: {
left: -ratio * wd2 + 0.5 * self._eyeSep * ndfl,
right: ratio * wd2 + 0.5 * self._eyeSep * ndfl,
top: wd2,
bottom: -wd2
}
self._camera.setOptics({
left: -ratio * wd2 + 0.5 * self._eyeSep * ndfl,
right: ratio * wd2 + 0.5 * self._eyeSep * ndfl,
top: wd2,
bottom: -wd2
});

self._colorBuffer.setColorMask({
Expand Down
Loading

0 comments on commit d40f1f4

Please sign in to comment.