aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/helper-classes/RDGE/src/tools/compile-rdge-core.bat1
-rw-r--r--js/helper-classes/RDGE/src/tools/compile-rdge-core.sh1
-rwxr-xr-xjs/lib/drawing/world.js316
-rwxr-xr-xjs/lib/geom/geom-obj.js110
-rwxr-xr-xjs/lib/geom/rectangle.js83
-rw-r--r--js/lib/geom/shape-primitive.js130
-rwxr-xr-xjs/lib/math/matrix.js9
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js84
-rw-r--r--js/lib/rdge/materials/cloud-material.js427
-rw-r--r--js/lib/rdge/materials/deform-material.js5
-rw-r--r--js/lib/rdge/materials/flag-material.js148
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js2
-rw-r--r--js/lib/rdge/materials/fly-material.js5
-rw-r--r--js/lib/rdge/materials/julia-material.js5
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js5
-rw-r--r--js/lib/rdge/materials/mandel-material.js5
-rwxr-xr-xjs/lib/rdge/materials/material.js78
-rw-r--r--js/lib/rdge/materials/pulse-material.js55
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js7
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js5
-rw-r--r--js/lib/rdge/materials/star-material.js5
-rw-r--r--js/lib/rdge/materials/taper-material.js13
-rw-r--r--js/lib/rdge/materials/tunnel-material.js5
-rw-r--r--js/lib/rdge/materials/twist-material.js5
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js60
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js118
-rw-r--r--js/lib/rdge/materials/water-material.js4
-rw-r--r--js/lib/rdge/materials/z-invert-material.js5
-rw-r--r--js/lib/rdge/texture.js329
-rwxr-xr-xjs/models/materials-model.js14
30 files changed, 1695 insertions, 344 deletions
diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
deleted file mode 100644
index 50a9a460..00000000
--- a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
+++ /dev/null
@@ -1 +0,0 @@
1java -jar ./compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies --js ../core/script/math/vec2.js --js ../core/script/math/vec3.js --js ../core/script/math/vec4.js --js ../core/script/math/mat4.js --js ../core/script/math/quat.js --js ../core/script/objectManager.js --js ../core/script/precompiled.js --js ../core/script/renderer.js --js ../core/script/renderUtils.js --js ../core/script/jshader.js --js ../core/script/jpass.js --js ../core/script/RenderProcs.js --js ../core/script/RenderInitProcs.js --js ../core/script/MeshManager.js --js ../core/script/ShaderManager.js --js ../core/script/ScreenQuad.js --js ../core/script/box.js --js ../core/script/camera.js --js ../core/script/shadowLight.js --js ../core/script/utilities.js --js ../core/script/engine.js --js ../core/script/scenegraphNodes.js --js ../core/script/scenegraph.js --js ../core/script/lightmanager.js --js ../core/script/rendercontext.js --js ../core/script/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js_output_file ../../rdge-compiled.js
diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh b/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
deleted file mode 100644
index ed6d521a..00000000
--- a/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
+++ /dev/null
@@ -1 +0,0 @@
1java -jar ./compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies --js ../core/script/math/vec2.js --js ../core/script/math/vec3.js --js ../core/script/math/vec4.js --js ../core/script/math/mat4.js --js ../core/script/math/quat.js --js ../core/script/objectManager.js --js ../core/script/precompiled.js --js ../core/script/renderer.js --js ../core/script/renderUtils.js --js ../core/script/jshader.js --js ../core/script/jpass.js --js ../core/script/RenderProcs.js --js ../core/script/RenderInitProcs.js --js ../core/script/MeshManager.js --js ../core/script/ShaderManager.js --js ../core/script/ScreenQuad.js --js ../core/script/box.js --js ../core/script/camera.js --js ../core/script/shadowLight.js --js ../core/script/utilities.js --js ../core/script/engine.js --js ../core/script/scenegraphNodes.js --js ../core/script/scenegraph.js --js ../core/script/lightmanager.js --js ../core/script/rendercontext.js --js ../core/script/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js_output_file rdge-compiled.js
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 1a391338..50fa735a 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -29,13 +29,20 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
29 } 29 }
30 30
31 this._canvas = canvas; 31 this._canvas = canvas;
32 if (this._useWebGL) { 32 if (this._useWebGL)
33 if(preserveDrawingBuffer) { 33 {
34 preserveDrawingBuffer = true;
35 if(preserveDrawingBuffer)
36 {
34 this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true}); 37 this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true});
35 } else { 38 }
39 else
40 {
36 this._glContext = canvas.getContext("experimental-webgl"); 41 this._glContext = canvas.getContext("experimental-webgl");
37 } 42 }
38 } else { 43 }
44 else
45 {
39 this._2DContext = canvas.getContext( "2d" ); 46 this._2DContext = canvas.getContext( "2d" );
40 } 47 }
41 48
@@ -72,11 +79,15 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
72 this._firstRender = true; 79 this._firstRender = true;
73 80
74 this._worldCount = worldCounter; 81 this._worldCount = worldCounter;
82 console.log( "creating world " + this._worldCount );
75 worldCounter++; 83 worldCounter++;
76 84
77 // keep a counter for generating node names 85 // keep a counter for generating node names
78 this._nodeCounter = 0; 86 this._nodeCounter = 0;
79 87
88 // for sending notifications to listeners
89 this._notifier = new Notifier();
90
80 /////////////////////////////////////////////////////////////////////// 91 ///////////////////////////////////////////////////////////////////////
81 // Property accessors 92 // Property accessors
82 /////////////////////////////////////////////////////////////////////// 93 ///////////////////////////////////////////////////////////////////////
@@ -119,6 +130,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
119 130
120 // Flag to play/pause animation at authortime 131 // Flag to play/pause animation at authortime
121 this._previewAnimation = true; 132 this._previewAnimation = true;
133
122 //////////////////////////////////////////////////////////////////////////////////// 134 ////////////////////////////////////////////////////////////////////////////////////
123 // RDGE 135 // RDGE
124 // local variables 136 // local variables
@@ -143,7 +155,8 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
143 this.setCameraMat( camMat ); 155 this.setCameraMat( camMat );
144 156
145 // post-load processing of the scene 157 // post-load processing of the scene
146 this.init = function() { 158 this.init = function()
159 {
147 var ctx1 = RDGE.globals.engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle), 160 var ctx1 = RDGE.globals.engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle),
148 ctx2 = RDGE.globals.engine.getContext(); 161 ctx2 = RDGE.globals.engine.getContext();
149 if (ctx1 != ctx2) console.log( "***** different contexts *****" ); 162 if (ctx1 != ctx2) console.log( "***** different contexts *****" );
@@ -201,13 +214,15 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
201 }; 214 };
202 215
203 // main code for handling user interaction and updating the scene 216 // main code for handling user interaction and updating the scene
204 this.update = function(dt) { 217 this.update = function(dt)
218 {
205 if (!dt) dt = 0.2; 219 if (!dt) dt = 0.2;
206 220
207 dt = 0.01; // use our own internal throttle 221 dt = 0.01; // use our own internal throttle
208 this.elapsed += dt; 222 this.elapsed += dt;
209 223
210 if (this._useWebGL) { 224 if (this._useWebGL)
225 {
211 // changed the global position uniform of light 0, another way to change behavior of a light 226 // changed the global position uniform of light 0, another way to change behavior of a light
212 RDGE.rdgeGlobalParameters.u_light0Pos.set([5 * Math.cos(this.elapsed), 5 * Math.sin(this.elapsed), 20]); 227 RDGE.rdgeGlobalParameters.u_light0Pos.set([5 * Math.cos(this.elapsed), 5 * Math.sin(this.elapsed), 20]);
213 228
@@ -224,35 +239,48 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
224 }; 239 };
225 240
226 // defining the draw function to control how the scene is rendered 241 // defining the draw function to control how the scene is rendered
227 this.draw = function() { 242 this.draw = function()
228 if (this._useWebGL) { 243 {
244 if (this._useWebGL)
245 {
229 RDGE.globals.engine.setContext( this._canvas.rdgeid ); 246 RDGE.globals.engine.setContext( this._canvas.rdgeid );
230 var ctx = RDGE.globals.engine.getContext(); 247 var ctx = RDGE.globals.engine.getContext();
231 var renderer = ctx.renderer; 248 var renderer = ctx.renderer;
232 if (renderer.unloadedTextureCount <= 0) { 249 if (renderer.unloadedTextureCount <= 0)
250 {
233 renderer.disableCulling(); 251 renderer.disableCulling();
234 renderer._clear(); 252 renderer._clear();
235 this.myScene.render(); 253 this.myScene.render();
236 254
237 if (this._firstRender) { 255 if (this._firstRender)
238 if (this._canvas.task) { 256 {
257 this._notifier.sendNotification( this._notifier.FIRST_RENDER );
258 if (this._canvas.task)
259 {
239 this._firstRender = false; 260 this._firstRender = false;
240 261
241 if (!this.hasAnimatedMaterials() || !this._previewAnimation) { 262 if (!this.hasAnimatedMaterials() || !this._previewAnimation)
263 {
242 this._canvas.task.stop(); 264 this._canvas.task.stop();
243 //this._renderCount = 10; 265 //this._renderCount = 10;
244 } 266 }
245 } 267 }
246 } else if (this._renderCount >= 0) { 268 }
247 if (this._canvas.task) { 269 else if (this._renderCount >= 0)
270 {
271 if (this._canvas.task)
272 {
248 this._renderCount--; 273 this._renderCount--;
249 if (this._renderCount <= 0) { 274 if (this._renderCount <= 0)
275 {
250 this._canvas.task.stop(); 276 this._canvas.task.stop();
251 } 277 }
252 } 278 }
253 } 279 }
254 } 280 }
255 } else { 281 }
282 else
283 {
256 this.render(); 284 this.render();
257 } 285 }
258 }; 286 };
@@ -266,8 +294,10 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
266// console.log( "GLWorld.onLoadState" ); 294// console.log( "GLWorld.onLoadState" );
267 }; 295 };
268 296
269 this.textureToLoad = function( texture ) {