aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/drawing/world.js58
-rwxr-xr-xjs/lib/geom/circle.js6
-rwxr-xr-xjs/lib/geom/line.js4
-rwxr-xr-xjs/lib/geom/rectangle.js8
-rw-r--r--js/lib/geom/shape-primitive.js4
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js6
-rw-r--r--js/lib/rdge/materials/deform-material.js4
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js4
-rw-r--r--js/lib/rdge/materials/fly-material.js4
-rw-r--r--js/lib/rdge/materials/julia-material.js6
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js6
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js4
-rw-r--r--js/lib/rdge/materials/mandel-material.js6
-rw-r--r--js/lib/rdge/materials/plasma-material.js4
-rw-r--r--js/lib/rdge/materials/pulse-material.js10
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js10
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js4
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js4
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js4
-rw-r--r--js/lib/rdge/materials/star-material.js4
-rw-r--r--js/lib/rdge/materials/taper-material.js4
-rw-r--r--js/lib/rdge/materials/tunnel-material.js4
-rw-r--r--js/lib/rdge/materials/twist-material.js6
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js6
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js16
-rw-r--r--js/lib/rdge/materials/water-material.js4
-rw-r--r--js/lib/rdge/materials/z-invert-material.js6
27 files changed, 103 insertions, 103 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 3d6c6fc4..7c5fb136 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -141,45 +141,45 @@ var World = function GLWorld( canvas, use3D ) {
141 141
142 // post-load processing of the scene 142 // post-load processing of the scene
143 this.init = function() { 143 this.init = function() {
144 var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle), 144 var ctx1 = RDGE.globals.engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle),
145 ctx2 = g_Engine.getContext(); 145 ctx2 = RDGE.globals.engine.getContext();
146 if (ctx1 != ctx2) console.log( "***** different contexts *****" ); 146 if (ctx1 != ctx2) console.log( "***** different contexts *****" );
147 this.renderer = ctx1.renderer; 147 this.renderer = ctx1.renderer;
148 this.renderer._world = this; 148 this.renderer._world = this;
149 149
150 // create a camera, set its perspective, and then point it at the origin 150 // create a camera, set its perspective, and then point it at the origin
151 var cam = new camera(); 151 var cam = new RDGE.camera();
152 this._camera = cam; 152 this._camera = cam;
153 cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); 153 cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar());
154 cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], vec3.up()); 154 cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], RDGE.vec3.up());
155 155
156 // make this camera the active camera 156 // make this camera the active camera
157 this.renderer.cameraManager().setActiveCamera(cam); 157 this.renderer.cameraManager().setActiveCamera(cam);
158 158
159 // change clear color 159 // change clear color
160 //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); 160 //this.renderer.setClearFlags(RDGE.globals.engine.getContext().DEPTH_BUFFER_BIT);
161 this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]); 161 this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]);
162 //this.renderer.NinjaWorld = this; 162 //this.renderer.NinjaWorld = this;
163 163
164 // create an empty scene graph 164 // create an empty scene graph
165 this.myScene = new SceneGraph(); 165 this.myScene = new RDGE.SceneGraph();
166 166
167 // create some lights 167 // create some lights
168 // light 1 168 // light 1
169 this.light = createLightNode("myLight"); 169 this.light = RDGE.createLightNode("myLight");
170 this.light.setPosition([0,0,1.2]); 170 this.light.setPosition([0,0,1.2]);
171 this.light.setDiffuseColor([0.75,0.9,1.0,1.0]); 171 this.light.setDiffuseColor([0.75,0.9,1.0,1.0]);
172 172
173 // light 2 173 // light 2
174 this.light2 = createLightNode("myLight2"); 174 this.light2 = RDGE.createLightNode("myLight2");
175 this.light2.setPosition([-0.5,0,1.2]); 175 this.light2.setPosition([-0.5,0,1.2]);
176 this.light2.setDiffuseColor([1.0,0.9,0.75,1.0]); 176 this.light2.setDiffuseColor([1.0,0.9,0.75,1.0]);
177 177
178 // create a light transform 178 // create a light transform
179 var lightTr = createTransformNode("lightTr"); 179 var lightTr = RDGE.createTransformNode("lightTr");
180 180
181 // create and attach a material - materials hold the light data 181 // create and attach a material - materials hold the light data
182 lightTr.attachMaterial(createMaterialNode("lights")); 182 lightTr.attachMaterial(RDGE.createMaterialNode("lights"));
183 183
184 // enable light channels 1, 2 - channel 0 is used by the default shader 184 // enable light channels 1, 2 - channel 0 is used by the default shader
185 lightTr.materialNode.enableLightChannel(1, this.light); 185 lightTr.materialNode.enableLightChannel(1, this.light);
@@ -192,9 +192,9 @@ var World = function GLWorld( canvas, use3D ) {
192 this.myScene.addNode(lightTr); 192 this.myScene.addNode(lightTr);
193 193
194 // Add the scene to the engine - necessary if you want the engine to draw for you 194 // Add the scene to the engine - necessary if you want the engine to draw for you
195 //g_Engine.AddScene("myScene" + this._canvas.id, this.myScene); 195 //RDGE.globals.engine.AddScene("myScene" + this._canvas.id, this.myScene);
196 var name = this._canvas.getAttribute( "data-RDGE-id" ); 196 var name = this._canvas.getAttribute( "data-RDGE-id" );
197 g_Engine.AddScene("myScene" + name, this.myScene); 197 RDGE.globals.engine.AddScene("myScene" + name, this.myScene);
198 }; 198 };
199 199
200 // main code for handling user interaction and updating the scene 200 // main code for handling user interaction and updating the scene
@@ -206,7 +206,7 @@ var World = function GLWorld( canvas, use3D ) {
206 206
207 if (this._useWebGL) { 207 if (this._useWebGL) {
208 // changed the global position uniform of light 0, another way to change behavior of a light 208 // changed the global position uniform of light 0, another way to change behavior of a light
209 rdgeGlobalParameters.u_light0Pos.set( [5*Math.cos(this.elapsed), 5*Math.sin(this.elapsed), 20]); 209 RDGE.rdgeGlobalParameters.u_light0Pos.set([5 * Math.cos(this.elapsed), 5 * Math.sin(this.elapsed), 20]);
210 210
211 // orbit the light nodes around the boxes 211 // orbit the light nodes around the boxes
212 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)]); 212 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)]);
@@ -223,8 +223,8 @@ var World = function GLWorld( canvas, use3D ) {
223 // defining the draw function to control how the scene is rendered 223 // defining the draw function to control how the scene is rendered
224 this.draw = function() { 224 this.draw = function() {
225 if (this._useWebGL) { 225 if (this._useWebGL) {
226 g_Engine.setContext( this._canvas.rdgeid ); 226 RDGE.globals.engine.setContext( this._canvas.rdgeid );
227 var ctx = g_Engine.getContext(); 227 var ctx = RDGE.globals.engine.getContext();
228 var renderer = ctx.renderer; 228 var renderer = ctx.renderer;
229 if (renderer.unloadedTextureCount <= 0) { 229 if (renderer.unloadedTextureCount <= 0) {
230 renderer.disableCulling(); 230 renderer.disableCulling();
@@ -361,8 +361,8 @@ var World = function GLWorld( canvas, use3D ) {
361 rdgeStarted = true; 361 rdgeStarted = true;
362 var id = this._canvas.getAttribute( "data-RDGE-id" ); 362 var id = this._canvas.getAttribute( "data-RDGE-id" );
363 this._canvas.rdgeid = id; 363 this._canvas.rdgeid = id;
364 g_Engine.registerCanvas(this._canvas, this); 364 RDGE.globals.engine.registerCanvas(this._canvas, this);
365 RDGEStart( this._canvas ); 365 RDGE.RDGEStart( this._canvas );
366 this._canvas.task.stop() 366 this._canvas.task.stop()
367 } 367 }
368}; 368};
@@ -391,13 +391,13 @@ World.prototype.updateObject = function (obj) {
391 if (nPrims > 0) { 391 if (nPrims > 0) {
392 ctrTrNode = obj.getTransformNode(); 392 ctrTrNode = obj.getTransformNode();
393 if (ctrTrNode == null) { 393 if (ctrTrNode == null) {
394 ctrTrNode = createTransformNode("objRootNode_" + nodeCounter++); 394 ctrTrNode = RDGE.createTransformNode("objRootNode_" + nodeCounter++);
395 this._rootNode.insertAsChild( ctrTrNode ); 395 this._rootNode.insertAsChild( ctrTrNode );
396 obj.setTransformNode( ctrTrNode ); 396 obj.setTransformNode( ctrTrNode );
397 } 397 }
398 398
399 ctrTrNode.meshes.forEach(function(thisMesh) { 399 ctrTrNode.meshes.forEach(function(thisMesh) {
400 g_meshMan.deleteMesh(thisMesh.mesh.name); 400 RDGE.globals.meshMan.deleteMesh(thisMesh.mesh.name);
401 }); 401 });
402 ctrTrNode.meshes = []; 402 ctrTrNode.meshes = [];
403 403
@@ -416,11 +416,11 @@ World.prototype.updateObject = function (obj) {
416 childTrNode = children[i-1].transformNode; 416 childTrNode = children[i-1].transformNode;
417 417
418 childTrNode.meshes.forEach(function(thisMesh) { 418 childTrNode.meshes.forEach(function(thisMesh) {
419 g_meshMan.deleteMesh(thisMesh.mesh.name); 419 RDGE.globals.meshMan.deleteMesh(thisMesh.mesh.name);
420 }); 420 });
421 childTrNode.meshes = []; 421 childTrNode.meshes = [];
422 } else { 422 } else {
423 childTrNode = createTransformNode("objNode_" + nodeCounter++); 423 childTrNode = RDGE.createTransformNode("objNode_" + nodeCounter++);
424 ctrTrNode.insertAsChild(childTrNode); 424 ctrTrNode.insertAsChild(childTrNode);
425 } 425 }
426 426
@@ -522,7 +522,7 @@ World.prototype.clearTree = function() {
522 if (this._useWebGL) { 522 if (this._useWebGL) {
523 var root = this._rootNode; 523 var root = this._rootNode;
524 root.children = new Array(); 524 root.children = new Array();
525 g_Engine.unregisterCanvas( this._canvas.rdgeid ) 525 RDGE.globals.engine.unregisterCanvas( this._canvas.rdgeid )
526 526
527 this.update( 0 ); 527 this.update( 0 );
528 this.draw(); 528 this.draw();
@@ -657,9 +657,9 @@ World.prototype.setMVMatrix = function() {
657 gl.uniformMatrix4fv(this._shaderProgram.mvMatrixUniform, false, new Float32Array(mvMatrix)); 657 gl.uniformMatrix4fv(this._shaderProgram.mvMatrixUniform, false, new Float32Array(mvMatrix));
658 658
659