aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/canvas-runtime.js529
-rw-r--r--assets/descriptor.json4
-rw-r--r--assets/images/paris.pngbin0 -> 4108 bytes
-rw-r--r--assets/images/powderblue.pngbin0 -> 176 bytes
-rw-r--r--assets/images/raiders.pngbin0 -> 5674 bytes
-rwxr-xr-xassets/rdge-compiled.js6
-rw-r--r--assets/shaders/Paris.frag.glsl68
-rwxr-xr-xjs/components/tools-properties/rect-properties.reel/rect-properties.css19
-rwxr-xr-xjs/components/tools-properties/rect-properties.reel/rect-properties.html16
-rwxr-xr-xjs/components/tools-properties/rect-properties.reel/rect-properties.js16
-rwxr-xr-xjs/controllers/selection-controller.js9
-rwxr-xr-xjs/document/html-document.js108
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js6
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js7
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/lib/drawing/world.js147
-rwxr-xr-xjs/lib/geom/circle.js54
-rwxr-xr-xjs/lib/geom/geom-obj.js154
-rwxr-xr-xjs/lib/geom/line.js44
-rwxr-xr-xjs/lib/geom/rectangle.js63
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js40
-rw-r--r--js/lib/rdge/materials/cloud-material.js300
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js21
-rw-r--r--js/lib/rdge/materials/julia-material.js6
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js53
-rw-r--r--js/lib/rdge/materials/mandel-material.js6
-rw-r--r--js/lib/rdge/materials/plasma-material.js18
-rw-r--r--js/lib/rdge/materials/pulse-material.js44
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js57
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js54
-rw-r--r--js/lib/rdge/materials/taper-material.js27
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js28
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js180
-rw-r--r--js/lib/rdge/materials/water-material.js103
-rwxr-xr-xjs/models/materials-model.js90
-rw-r--r--node_modules/components-data/feed-reader.json5
36 files changed, 1877 insertions, 407 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index fd823f35..dd909e26 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -37,17 +37,24 @@ function CanvasDataManager()
37 for (var i=0; i<nWorlds; i++) 37 for (var i=0; i<nWorlds; i++)
38 { 38 {
39 var importStr = value[i]; 39 var importStr = value[i];
40 var startIndex = importStr.indexOf( "id: " ); 40
41 if (startIndex >= 0) 41 // there should be some version information in
42 // the form of 'v0.0;' Pull that off. (the trailing ';' should
43 // be in the first 24 characters).
44 var index = importStr.indexOf( ';' );
45 if ((importStr[0] === 'v') && (index < 24))
42 { 46 {
43 var endIndex = importStr.indexOf( "\n", startIndex ); 47 // JSON format. pull off the version info
44 if (endIndex > 0) 48 importStr = importStr.substr( index+1 );
49
50 var jObj = JSON.parse( importStr );
51 var id = jObj.id;
52 if (id)
45 { 53 {
46 var id = importStr.substring( startIndex+4, endIndex );
47 var canvas = this.findCanvasWithID( id, root ); 54 var canvas = this.findCanvasWithID( id, root );
48 if (canvas) 55 if (canvas)
49 { 56 {
50 var rt = new GLRuntime( canvas, importStr, assetPath ); 57 new GLRuntime( canvas, jObj, assetPath );
51 } 58 }
52 } 59 }
53 } 60 }
@@ -95,14 +102,15 @@ function CanvasDataManager()
95// Class GLRuntime 102// Class GLRuntime
96// Manages runtime fora WebGL canvas 103// Manages runtime fora WebGL canvas
97/////////////////////////////////////////////////////////////////////// 104///////////////////////////////////////////////////////////////////////
98function GLRuntime( canvas, importStr, assetPath ) 105function GLRuntime( canvas, jObj, assetPath )
99{ 106{
100 /////////////////////////////////////////////////////////////////////// 107 ///////////////////////////////////////////////////////////////////////
101 // Instance variables 108 // Instance variables
102 /////////////////////////////////////////////////////////////////////// 109 ///////////////////////////////////////////////////////////////////////
103 this._canvas = canvas; 110 this._canvas = canvas;
104 this._context = null; 111 this._context = null;
105 this._importStr = importStr; 112 //this._importStr = importStr;
113 this._jObj = jObj;
106 114
107 this.renderer = null; 115 this.renderer = null;
108 this.myScene = null; 116 this.myScene = null;
@@ -157,21 +165,19 @@ function GLRuntime( canvas, importStr, assetPath )
157 /////////////////////////////////////////////////////////////////////// 165 ///////////////////////////////////////////////////////////////////////
158 this.loadScene = function() 166 this.loadScene = function()
159 { 167 {
168 var jObj = this._jObj;
169 if (!jObj.children || (jObj.children.length != 1))
170 throw new Error( "ill-formed JSON for runtime load: " + jObj );
171 var root = jObj.children[0];
172
160 // parse the data 173 // parse the data
161 // the GL runtime must start with a "sceneData: " 174 if (jObj.scenedata)
162 var index = importStr.indexOf( "scenedata: " );
163 if (index >= 0)
164 { 175 {
165 this._useWebGL = true; 176 this._useWebGL = true;
166 177
167 var rdgeStr = importStr.substr( index+11 ); 178 var rdgeStr = jObj.scenedata;
168 var endIndex = rdgeStr.indexOf( "endscene\n" );
169 if (endIndex < 0) throw new Error( "ill-formed WebGL data" );
170 var len = endIndex - index + 11;
171 rdgeStr = rdgeStr.substr( 0, endIndex );
172
173 this.myScene.importJSON( rdgeStr ); 179 this.myScene.importJSON( rdgeStr );
174 this.importObjects( importStr ); 180 this.importObjects( root );
175 this.linkMaterials( this._geomRoot ); 181 this.linkMaterials( this._geomRoot );
176 this.initMaterials(); 182 this.initMaterials();
177 this.linkLights(); 183 this.linkLights();
@@ -179,7 +185,7 @@ function GLRuntime( canvas, importStr, assetPath )
179 else 185 else
180 { 186 {
181 this._context = this._canvas.getContext( "2d" ); 187 this._context = this._canvas.getContext( "2d" );
182 this.importObjects( importStr ); 188 this.importObjects( root );
183 this.render(); 189 this.render();
184 } 190 }
185 } 191 }
@@ -277,58 +283,42 @@ function GLRuntime( canvas, importStr, assetPath )
277 } 283 }
278 } 284 }
279 285
280 this.importObjects = function( importStr, parent ) 286 this.importObjects = function( jObj, parent )
281 { 287 {
282 var index = importStr.indexOf( "OBJECT\n", 0 ); 288 // read the next object
283 while (index >= 0) 289 var gObj = this.importObject( jObj, parent );
284 {
285 // update the string to the current object
286 importStr = importStr.substr( index+7 );
287
288 // read the next object
289 var obj = this.importObject( importStr, parent );
290 290
291 // determine if we have children 291 // load the children
292 var endIndex = importStr.indexOf( "ENDOBJECT\n" ), 292 if (jObj.children)
293 childIndex = importStr.indexOf( "OBJECT\n" ); 293 {
294 if (endIndex < 0) throw new Error( "ill-formed object data" ); 294 var nKids = jObj.children.length;
295 if ((childIndex >= 0) && (childIndex < endIndex)) 295 for (var i=0; i<nKids; i++)
296 { 296 {
297 importStr = importStr.substr( childIndex + 7 ); 297 var child = jObj.children[i];
298 importStr = this.importObjects( importStr, obj ); 298 this.importObjects( child, gObj );
299 endIndex = importStr.indexOf( "ENDOBJECT\n" )
300 } 299 }
301
302 // remove the string for the object(s) just created
303 importStr = importStr.substr( endIndex );
304
305 // get the location of the next object
306 index = importStr.indexOf( "OBJECT\n", endIndex );
307 } 300 }
308
309 return importStr;
310 } 301 }
311 302
312 this.importObject = function( objStr, parent ) 303 this.importObject = function( jObj, parent )
313 { 304 {
314 var type = Number( getPropertyFromString( "type: ", objStr ) ); 305 var type = jObj.type
315
316 var obj; 306 var obj;
317 switch (type) 307 switch (type)
318 { 308 {
319 case 1: 309 case 1:
320 obj = new RuntimeRectangle(); 310 obj = new RuntimeRectangle();
321 obj.import(