From b50284014e44436f1f73fccd096b079acc5e33cc Mon Sep 17 00:00:00 2001 From: Jackie Chu Date: Sun, 21 Feb 2016 12:20:07 -0800 Subject: [PATCH] update attribute accessors used in examples --- examples/libs/gui/gui.js | 56 +++++++++---------- examples/picking_rayPicking_triangles.html | 2 +- examples/stages_convolution.html | 4 +- examples/stages_custom_convolution.html | 4 +- examples/stages_scanlines.html | 4 +- examples/stages_threeStages.html | 4 +- examples/stages_twoStages.html | 4 +- examples/stages_withSharedShader.html | 4 +- examples/stages_withTransparencySort.html | 4 +- examples/texture_rtt.html | 4 +- examples/texture_rtt_color.html | 4 +- examples/texture_rtt_depthAndColor.html | 4 +- examples/texture_rtt_depthAndColor2.html | 4 +- examples/texture_rtt_heightmap.html | 4 +- examples/texture_rtt_manyTextures.html | 4 +- examples/texture_rtt_shader.html | 4 +- examples/texture_rtt_sharedTexture.html | 4 +- examples/texture_rtt_withVideo.html | 4 +- examples/transforms_modelling_scale.html | 2 +- .../transforms_modelling_scale_invert.html | 2 +- examples/transforms_modelling_translate.html | 2 +- src/plugins/node/cameras/orbit.js | 8 +-- src/plugins/node/cameras/pickFlyOrbit.js | 4 +- src/plugins/node/effects/anaglyph.js | 24 ++++---- src/plugins/node/effects/oculusRift.js | 24 ++++---- src/plugins/node/effects/stereo.js | 24 ++++---- 26 files changed, 99 insertions(+), 113 deletions(-) diff --git a/examples/libs/gui/gui.js b/examples/libs/gui/gui.js index 53568aef..bcb1cb9c 100644 --- a/examples/libs/gui/gui.js +++ b/examples/libs/gui/gui.js @@ -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(); @@ -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(); @@ -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 @@ -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 @@ -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(); diff --git a/examples/picking_rayPicking_triangles.html b/examples/picking_rayPicking_triangles.html index 047a404b..1308a809 100644 --- a/examples/picking_rayPicking_triangles.html +++ b/examples/picking_rayPicking_triangles.html @@ -212,7 +212,7 @@ markerContext.fill(); indicatorFlags.setEnabled(true); - worldPosIndicator.set({ + worldPosIndicator.setXYZ({ x: worldPos[0], y: worldPos[1], z: worldPos[2] diff --git a/examples/stages_convolution.html b/examples/stages_convolution.html index 5991367f..af270555 100644 --- a/examples/stages_convolution.html +++ b/examples/stages_convolution.html @@ -141,8 +141,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/stages_custom_convolution.html b/examples/stages_custom_convolution.html index 3d9e7274..13cc184b 100644 --- a/examples/stages_custom_convolution.html +++ b/examples/stages_custom_convolution.html @@ -204,8 +204,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/stages_scanlines.html b/examples/stages_scanlines.html index df6b860c..26f35ab3 100644 --- a/examples/stages_scanlines.html +++ b/examples/stages_scanlines.html @@ -173,8 +173,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/stages_threeStages.html b/examples/stages_threeStages.html index 9f1d7b07..182d4fe1 100644 --- a/examples/stages_threeStages.html +++ b/examples/stages_threeStages.html @@ -229,8 +229,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 2); - teapotPitch.inc("angle", .5); + teapotYaw.incAngle(2); + teapotPitch.incAngle(.5); }); diff --git a/examples/stages_twoStages.html b/examples/stages_twoStages.html index abf0ec80..e10234b2 100644 --- a/examples/stages_twoStages.html +++ b/examples/stages_twoStages.html @@ -185,8 +185,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/stages_withSharedShader.html b/examples/stages_withSharedShader.html index 48a59a23..664d08a5 100644 --- a/examples/stages_withSharedShader.html +++ b/examples/stages_withSharedShader.html @@ -221,8 +221,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 2); - teapotPitch.inc("angle", .5); + teapotYaw.incAngle(2); + teapotPitch.incAngle(.5); }); diff --git a/examples/stages_withTransparencySort.html b/examples/stages_withTransparencySort.html index a169c91b..f76cf84a 100644 --- a/examples/stages_withTransparencySort.html +++ b/examples/stages_withTransparencySort.html @@ -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); }); }); }); diff --git a/examples/texture_rtt.html b/examples/texture_rtt.html index e91c07a8..3a01fa36 100644 --- a/examples/texture_rtt.html +++ b/examples/texture_rtt.html @@ -162,8 +162,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_color.html b/examples/texture_rtt_color.html index 0f7d05ec..a7b6f7d8 100644 --- a/examples/texture_rtt_color.html +++ b/examples/texture_rtt_color.html @@ -160,8 +160,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_depthAndColor.html b/examples/texture_rtt_depthAndColor.html index 811a4658..36ea1d73 100644 --- a/examples/texture_rtt_depthAndColor.html +++ b/examples/texture_rtt_depthAndColor.html @@ -227,8 +227,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); }); diff --git a/examples/texture_rtt_depthAndColor2.html b/examples/texture_rtt_depthAndColor2.html index 8690a4df..04246afc 100644 --- a/examples/texture_rtt_depthAndColor2.html +++ b/examples/texture_rtt_depthAndColor2.html @@ -236,8 +236,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_heightmap.html b/examples/texture_rtt_heightmap.html index 191cb860..9ad75907 100644 --- a/examples/texture_rtt_heightmap.html +++ b/examples/texture_rtt_heightmap.html @@ -181,8 +181,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_manyTextures.html b/examples/texture_rtt_manyTextures.html index 8937d82f..20882bd7 100644 --- a/examples/texture_rtt_manyTextures.html +++ b/examples/texture_rtt_manyTextures.html @@ -299,8 +299,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_shader.html b/examples/texture_rtt_shader.html index b1b2013c..70f3035d 100644 --- a/examples/texture_rtt_shader.html +++ b/examples/texture_rtt_shader.html @@ -191,8 +191,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_sharedTexture.html b/examples/texture_rtt_sharedTexture.html index 18458c46..a256fb0c 100644 --- a/examples/texture_rtt_sharedTexture.html +++ b/examples/texture_rtt_sharedTexture.html @@ -266,8 +266,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/texture_rtt_withVideo.html b/examples/texture_rtt_withVideo.html index 54d5903e..a3ca039a 100644 --- a/examples/texture_rtt_withVideo.html +++ b/examples/texture_rtt_withVideo.html @@ -170,8 +170,8 @@ scene.on("tick", function () { - teapotYaw.inc("angle", 1); - teapotPitch.inc("angle", .3); + teapotYaw.incAngle(1); + teapotPitch.incAngle(.3); }); diff --git a/examples/transforms_modelling_scale.html b/examples/transforms_modelling_scale.html index 920051a0..d300ae07 100644 --- a/examples/transforms_modelling_scale.html +++ b/examples/transforms_modelling_scale.html @@ -86,7 +86,7 @@ xInc *= -1; } x += xInc; - myScale.set({ x:x, y:1, z:1 }); + myScale.setXYZ({ x:x, y:1, z:1 }); }); }); diff --git a/examples/transforms_modelling_scale_invert.html b/examples/transforms_modelling_scale_invert.html index 920051a0..d300ae07 100644 --- a/examples/transforms_modelling_scale_invert.html +++ b/examples/transforms_modelling_scale_invert.html @@ -86,7 +86,7 @@ xInc *= -1; } x += xInc; - myScale.set({ x:x, y:1, z:1 }); + myScale.setXYZ({ x:x, y:1, z:1 }); }); }); diff --git a/examples/transforms_modelling_translate.html b/examples/transforms_modelling_translate.html index 33f6f726..caf3157b 100644 --- a/examples/transforms_modelling_translate.html +++ b/examples/transforms_modelling_translate.html @@ -85,7 +85,7 @@ xInc *= -1; } x += xInc; - myTranslate.set({ x:x }); + myTranslate.setX(x); }); }); diff --git a/src/plugins/node/cameras/orbit.js b/src/plugins/node/cameras/orbit.js index 40519ba7..fa9260ee 100644 --- a/src/plugins/node/cameras/orbit.js +++ b/src/plugins/node/cameras/orbit.js @@ -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; diff --git a/src/plugins/node/cameras/pickFlyOrbit.js b/src/plugins/node/cameras/pickFlyOrbit.js index 844342cf..c1957c77 100644 --- a/src/plugins/node/cameras/pickFlyOrbit.js +++ b/src/plugins/node/cameras/pickFlyOrbit.js @@ -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(); diff --git a/src/plugins/node/effects/anaglyph.js b/src/plugins/node/effects/anaglyph.js index 2234e67f..059c08ab 100644 --- a/src/plugins/node/effects/anaglyph.js +++ b/src/plugins/node/effects/anaglyph.js @@ -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({ @@ -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({ diff --git a/src/plugins/node/effects/oculusRift.js b/src/plugins/node/effects/oculusRift.js index fad13351..1f376cf3 100644 --- a/src/plugins/node/effects/oculusRift.js +++ b/src/plugins/node/effects/oculusRift.js @@ -314,13 +314,11 @@ SceneJS.Types.addType("effects/oculusRift", { self._localLookat.setEye(rightEye); self._localLookat.setLook(rightLook); - self._camera.set({ - optics: { - left: -self._aspect * wd2 - 0.5 * eyeSep * ndfl, - right: self._aspect * wd2 - 0.5 * eyeSep * ndfl, - top: wd2, - bottom: -wd2 - } + self._camera.setOptics({ + left: -self._aspect * wd2 - 0.5 * eyeSep * ndfl, + right: self._aspect * wd2 - 0.5 * eyeSep * ndfl, + top: wd2, + bottom: -wd2 }); self._shader.setParams({ @@ -343,13 +341,11 @@ SceneJS.Types.addType("effects/oculusRift", { self._localLookat.setEye(leftEye); self._localLookat.setLook(leftLook); - self._camera.set({ - optics: { - left: -self._aspect * wd2 + 0.5 * eyeSep * ndfl, - right: self._aspect * wd2 + 0.5 * eyeSep * ndfl, - top: wd2, - bottom: -wd2 - } + self._camera.setOptics({ + left: -self._aspect * wd2 + 0.5 * eyeSep * ndfl, + right: self._aspect * wd2 + 0.5 * eyeSep * ndfl, + top: wd2, + bottom: -wd2 }); self._shader.setParams({ diff --git a/src/plugins/node/effects/stereo.js b/src/plugins/node/effects/stereo.js index ecb3b98f..fea1796d 100644 --- a/src/plugins/node/effects/stereo.js +++ b/src/plugins/node/effects/stereo.js @@ -215,13 +215,11 @@ SceneJS.Types.addType("effects/stereo", { 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 }); // @@ -246,13 +244,11 @@ SceneJS.Types.addType("effects/stereo", { 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 }); //