aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-04 17:24:27 -0700
committerNivesh Rajbhandari2012-04-04 17:24:27 -0700
commit01cf259da7aaa7d70789d9a7c32111d88b477463 (patch)
tree0bff3395ac681e5f685d2267f7dbc03a8e32bc4a /js/lib
parent331ea08655245e3532e48bf160d5f68a04d8723f (diff)
parent13368ca6ebbc13adeafccd898dfffd7ce37cb28a (diff)
downloadninja-01cf259da7aaa7d70789d9a7c32111d88b477463.tar.gz
Merge branch 'refs/heads/ToolFixes' into WebGLMaterials
Conflicts: js/document/templates/montage-html/default_html.css js/mediators/element-mediator.js js/panels/properties.reel/properties.js js/tools/BrushTool.js js/tools/LineTool.js js/tools/PenTool.js js/tools/SelectionTool.js js/tools/ShapeTool.js js/tools/TranslateObject3DTool.js Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/NJUtils.js4
-rwxr-xr-xjs/lib/drawing/world.js307
-rwxr-xr-xjs/lib/geom/brush-stroke.js636
-rwxr-xr-xjs/lib/geom/circle.js113
-rwxr-xr-xjs/lib/geom/geom-obj.js189
-rwxr-xr-xjs/lib/geom/line.js80
-rwxr-xr-xjs/lib/geom/rectangle.js125
-rw-r--r--js/lib/geom/shape-primitive.js4
-rwxr-xr-xjs/lib/geom/sub-path.js18
-rwxr-xr-xjs/lib/nj-base.js13
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js64
-rw-r--r--js/lib/rdge/materials/cloud-material.js377
-rw-r--r--js/lib/rdge/materials/deform-material.js88
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js141
-rw-r--r--js/lib/rdge/materials/fly-material.js9
-rw-r--r--js/lib/rdge/materials/julia-material.js8
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js8
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js426
-rw-r--r--js/lib/rdge/materials/mandel-material.js8
-rwxr-xr-xjs/lib/rdge/materials/material-parser.js81
-rwxr-xr-xjs/lib/rdge/materials/material.js15
-rw-r--r--js/lib/rdge/materials/plasma-material.js12
-rw-r--r--js/lib/rdge/materials/pulse-material.js68
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js414
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js438
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js132
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js133
-rw-r--r--js/lib/rdge/materials/star-material.js133
-rw-r--r--js/lib/rdge/materials/taper-material.js401
-rw-r--r--js/lib/rdge/materials/tunnel-material.js79
-rw-r--r--js/lib/rdge/materials/twist-material.js161
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js448
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js1560
-rw-r--r--js/lib/rdge/materials/water-material.js275
-rw-r--r--js/lib/rdge/materials/z-invert-material.js132
35 files changed, 3049 insertions, 4051 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index c01d865b..67bb59c4 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -139,7 +139,8 @@ exports.NJUtils = Object.create(Object.prototype, {
139 controller: { value: ControllerFactory.getController(controller)}, 139 controller: { value: ControllerFactory.getController(controller)},
140 pi: { value: pi}, 140 pi: { value: pi},
141 props3D: { value: p3d}, 141 props3D: { value: p3d},
142 shapeModel: { value: shapeProps} 142 shapeModel: { value: shapeProps},
143 isShape: { value: isShape}
143 }); 144 });
144 145
145 } 146 }
@@ -171,6 +172,7 @@ exports.NJUtils = Object.create(Object.prototype, {
171 // TODO - Need more info about the shape 172 // TODO - Need more info about the shape
172 selection = "canvas"; 173 selection = "canvas";
173 controller = "shape"; 174 controller = "shape";
175 isShape = true;
174 } 176 }
175 else 177 else
176 { 178 {
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index fec6a478..945c9883 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -144,45 +144,45 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
144 144
145 // post-load processing of the scene 145 // post-load processing of the scene
146 this.init = function() { 146 this.init = function() {
147 var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle), 147 var ctx1 = RDGE.globals.engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle),
148 ctx2 = g_Engine.getContext(); 148 ctx2 = RDGE.globals.engine.getContext();
149 if (ctx1 != ctx2) console.log( "***** different contexts *****" ); 149 if (ctx1 != ctx2) console.log( "***** different contexts *****" );
150 this.renderer = ctx1.renderer; 150 this.renderer = ctx1.renderer;
151 this.renderer._world = this; 151 this.renderer._world = this;
152 152
153 // create a camera, set its perspective, and then point it at the origin 153 // create a camera, set its perspective, and then point it at the origin
154 var cam = new camera(); 154 var cam = new RDGE.camera();
155 this._camera = cam; 155 this._camera = cam;
156 cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); 156 cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar());
157 cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], vec3.up()); 157 cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], RDGE.vec3.up());
158 158
159 // make this camera the active camera 159 // make this camera the active camera
160 this.renderer.cameraManager().setActiveCamera(cam); 160 this.renderer.cameraManager().setActiveCamera(cam);
161 161
162 // change clear color 162 // change clear color
163 //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); 163 //this.renderer.setClearFlags(RDGE.globals.engine.getContext().DEPTH_BUFFER_BIT);
164 this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]); 164 this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]);
165 //this.renderer.NinjaWorld = this; 165 //this.renderer.NinjaWorld = this;
166 166
167 // create an empty scene graph 167 // create an empty scene graph
168 this.myScene = new SceneGraph(); 168 this.myScene = new RDGE.SceneGraph();
169 169
170 // create some lights 170 // create some lights
171 // light 1 171 // light 1
172 this.light = createLightNode("myLight"); 172 this.light = RDGE.createLightNode("myLight");
173 this.light.setPosition([0,0,1.2]); 173 this.light.setPosition([0,0,1.2]);
174 this.light.setDiffuseColor([0.75,0.9,1.0,1.0]); 174 this.light.setDiffuseColor([0.75,0.9,1.0,1.0]);
175 175
176 // light 2 176 // light 2
177 this.light2 = createLightNode("myLight2"); 177 this.light2 = RDGE.createLightNode("myLight2");
178 this.light2.setPosition([-0.5,0,1.2]); 178 this.light2.setPosition([-0.5,0,1.2]);
179 this.light2.setDiffuseColor([1.0,0.9,0.75,1.0]); 179 this.light2.setDiffuseColor([1.0,0.9,0.75,1.0]);
180 180
181 // create a light transform 181 // create a light transform
182 var lightTr = createTransformNode("lightTr"); 182 var lightTr = RDGE.createTransformNode("lightTr");
183 183
184 // create and attach a material - materials hold the light data 184 // create and attach a material - materials hold the light data
185 lightTr.attachMaterial(createMaterialNode("lights")); 185 lightTr.attachMaterial(RDGE.createMaterialNode("lights"));
186 186
187 // enable light channels 1, 2 - channel 0 is used by the default shader 187 // enable light channels 1, 2 - channel 0 is used by the default shader
188 lightTr.materialNode.enableLightChannel(1, this.light); 188 lightTr.materialNode.enableLightChannel(1, this.light);
@@ -195,9 +195,9 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
195 this.myScene.addNode(lightTr); 195 this.myScene.addNode(lightTr);
196 196
197 // Add the scene to the engine - necessary if you want the engine to draw for you 197 // Add the scene to the engine - necessary if you want the engine to draw for you
198 //g_Engine.AddScene("myScene" + this._canvas.id, this.myScene); 198 //RDGE.globals.engine.AddScene("myScene" + this._canvas.id, this.myScene);
199 var name = this._canvas.getAttribute( "data-RDGE-id" ); 199 var name = this._canvas.getAttribute( "data-RDGE-id" );
200 g_Engine.AddScene("myScene" + name, this.myScene); 200 RDGE.globals.engine.AddScene("myScene" + name, this.myScene);
201 }; 201 };
202 202
203 // main code for handling user interaction and updating the scene 203 // main code for handling user interaction and updating the scene
@@ -209,7 +209,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
209 209
210 if (this._useWebGL) { 210 if (this._useWebGL) {
211 // changed the global position uniform of light 0, another way to change behavior of a light 211 // changed the global position uniform of light 0, another way to change behavior of a light
212 rdgeGlobalParameters.u_light0Pos.set( [5*Math.cos(this.elapsed), 5*Math.sin(this.elapsed), 20]); 212 RDGE.rdgeGlobalParameters.u_light0Pos.set([5 * Math.cos(this.elapsed), 5 * Math.sin(this.elapsed), 20]);
213 213
214 // orbit the light nodes around the boxes 214 // orbit the light nodes around the boxes
215 this.light.setPosition([1.2*Math.cos(this.elapsed*2.0), 1.2*Math.sin(this.elapsed*2.0), 1.2*Math.cos(this.elapsed*2.0)]); 215 this.light.setPosition([1.2*Math.cos(this.elapsed*2.0), 1.2*Math.sin(this.elapsed*2.0), 1.2*Math.cos(this.elapsed*2.0)]);
@@ -226,8 +226,8 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
226 // defining the draw function to control how the scene is rendered 226 // defining the draw function to control how the scene is rendered
227 this.draw = function() { 227 this.draw = function() {
228 if (this._useWebGL) { 228 if (this._useWebGL) {
229 g_Engine.setContext( this._canvas.rdgeid ); 229 RDGE.globals.engine.setContext( this._canvas.rdgeid );
230 var ctx = g_Engine.getContext(); 230 var ctx = RDGE.globals.engine.getContext();
231 var renderer = ctx.renderer; 231 var renderer = ctx.renderer;
232 if (renderer.unloadedTextureCount <= 0) { 232 if (renderer.unloadedTextureCount <= 0) {
233 renderer.disableCulling(); 233 renderer.disableCulling();
@@ -365,9 +365,9 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
365 if (this._useWebGL) { 365 if (this._useWebGL) {
366 rdgeStarted = true; 366 rdgeStarted = true;
367 this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" ); 367 this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" );
368 g_Engine.unregisterCanvas( this._canvas ) 368 RDGE.globals.engine.unregisterCanvas( this._canvas );
369 g_Engine.registerCanvas(this._canvas, this); 369 RDGE.globals.engine.registerCanvas(this._canvas, this);
370 RDGEStart( this._canvas ); 370 RDGE.RDGEStart( this._canvas );
371 this._canvas.task.stop() 371 this._canvas.task.stop()
372 } 372 }
373}; 373};
@@ -396,13 +396,13 @@ World.prototype.updateObject = function (obj) {
396 if (nPrims > 0) { 396 if (nPrims > 0) {
397 ctrTrNode = obj.getTransformNode(); 397 ctrTrNode = obj.getTransformNode();
398 if (ctrTrNode == null) { 398 if (ctrTrNode == null) {
399 ctrTrNode = createTransformNode("objRootNode_" + this._nodeCounter++); 399 ctrTrNode = RDGE.createTransformNode("objRootNode_" + this._nodeCounter++);
400 this._rootNode.insertAsChild( ctrTrNode ); 400 this._rootNode.insertAsChild( ctrTrNode );
401 obj.setTransformNode( ctrTrNode ); 401 obj.setTransformNode( ctrTrNode );
402 } 402 }
403