aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/html-document.js41
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js28
-rw-r--r--js/helper-classes/RDGE/runtime/CanvasDataManager.js98
-rw-r--r--js/helper-classes/RDGE/runtime/CanvasLoader.js72
-rw-r--r--js/helper-classes/RDGE/src/tools/rdge-compiled.js28
-rwxr-xr-xjs/preloader/Preloader.js3
6 files changed, 135 insertions, 135 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 9a7755e6..f5816f64 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -152,13 +152,13 @@ exports.HTMLDocument = Montage.create(TextDocument, {
152 glData: { 152 glData: {
153 get: function() 153 get: function()
154 { 154 {
155 var elt = this.iframe;
156 var elt = this.iframe.contentWindow.document.getElementById("UserContent"); 155 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
157 this._glData = null; 156 this._glData = null;
158 if (elt) 157 if (elt)
159 { 158 {
160 this._glData = new Array(); 159 var cdm = new CanvasDataManager();
161 this.collectGLData( elt, this._glData ); 160 this._glData = [];
161 cdm.collectGLData( elt, this._glData );
162 } 162 }
163 163
164 return this._glData 164 return this._glData
@@ -166,37 +166,12 @@ exports.HTMLDocument = Montage.create(TextDocument, {
166 166
167 set: function(value) 167 set: function(value)
168 { 168 {
169 var nWorlds = value.length; 169 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
170 for (var i=0; i<nWorlds; i++) 170 if (elt)
171 { 171 {
172 var importStr = value[i]; 172 console.log( "load canvas data: " + value );
173 var startIndex = importStr.indexOf( "id: " ); 173 var cdm = new CanvasDataManager();
174 if (startIndex >= 0) 174 cdm.loadGLData(elt, value);
175 {
176 var endIndex = importStr.indexOf( "\n", startIndex );
177 if (endIndex > 0)
178 {
179 var id = importStr.substring( startIndex+4, endIndex );
180 var canvas = this.iframe.contentWindow.document.getElementById( id );
181 if (canvas)
182 {
183 if (!canvas.elementModel)
184 {
185 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
186 }
187
188 if (canvas.elementModel)
189 {
190 if (canvas.elementModel.shapeModel.GLWorld)
191 canvas.elementModel.shapeModel.GLWorld.clearTree();
192
193 var world = new GLWorld( canvas );
194 canvas.elementModel.shapeModel.GLWorld = world;
195 world.import( importStr );
196 }
197 }
198 }
199 }
200 } 175 }
201 } 176 }
202 }, 177 },
diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js
index 4301200f..a211d17f 100755
--- a/js/helper-classes/RDGE/rdge-compiled.js
+++ b/js/helper-classes/RDGE/rdge-compiled.js
@@ -45,9 +45,8 @@ b.fillText(o.label,n+10,h+4);b.translate([-0.5,-0.5])};var o=this;setInterval(fu
45a;for(var f=0,g=-1E10,a=1E10,h=this.samples.length-1;h>=0;)f+=this.samples[h],g=Math.max(g,this.samples[h]),a=Math.min(a,this.samples[h]),h--;f=this.samples.length>0?f/this.samples.length:0;f=f>0?1E3/f:0;g=g>0?1E3/g:0;a=a>0?1E3/a:0;h=this.samples[this.samples.length-1];this.fpsRaw.value=(h>0?1E3/h:0).toFixed(2);this.fpsAvg.value=f.toFixed(2);this.fpsMin.value=g.toFixed(2);this.fpsMax.value=a.toFixed(2)}};objectManager=function(){this.guidCounter=0;this.objects=[];this.numObjects=0;this.freelist=[];this.reset=function(){this.objects=[];this.freelist=[];this.guidCounter=0};this.validHandle=function(a){return this.handleToIndex(a)!=-1};this.handleToIndex=function(a){var b=a>>16&65535;return this.objects[b]!=null&&a==this.objects[b].handle?b:-1};this.handleToObject=function(a){a=this.handleToIndex(a);return a!=-1?this.objects[a]:null};this.addObject=function(a){var b=this.objects.length;this.freelist.length> 45a;for(var f=0,g=-1E10,a=1E10,h=this.samples.length-1;h>=0;)f+=this.samples[h],g=Math.max(g,this.samples[h]),a=Math.min(a,this.samples[h]),h--;f=this.samples.length>0?f/this.samples.length:0;f=f>0?1E3/f:0;g=g>0?1E3/g:0;a=a>0?1E3/a:0;h=this.samples[this.samples.length-1];this.fpsRaw.value=(h>0?1E3/h:0).toFixed(2);this.fpsAvg.value=f.toFixed(2);this.fpsMin.value=g.toFixed(2);this.fpsMax.value=a.toFixed(2)}};objectManager=function(){this.guidCounter=0;this.objects=[];this.numObjects=0;this.freelist=[];this.reset=function(){this.objects=[];this.freelist=[];this.guidCounter=0};this.validHandle=function(a){return this.handleToIndex(a)!=-1};this.handleToIndex=function(a){var b=a>>16&65535;return this.objects[b]!=null&&a==this.objects[b].handle?b:-1};this.handleToObject=function(a){a=this.handleToIndex(a);return a!=-1?this.objects[a]:null};this.addObject=function(a){var b=this.objects.length;this.freelist.length>
460&&(b=this.freelist.pop());if(++this.guidCounter>=65535)this.guidCounter=1;a.handle=b<<16|++this.guidCounter;this.objects[b]=a;return a.handle};this.removeObject=function(a){a=this.handleToIndex(a);if(a!=-1){if(this.objects[a].onremove!=void 0)this.objects[a].onremove();this.objects[a]=null;this.freelist.push(a)}}};rdgeGlobalParameters={u_projMatrix:{type:"mat4",data:mat4.identity()},u_mvMatrix:{type:"mat4",data:mat4.identity()},u_invMvMatrix:{type:"mat4",data:mat4.identity()},u_normalMatrix:{type:"mat4",data:mat4.identity()},u_worldMatrix:{type:"mat4",data:mat4.identity()},u_viewMatrix:{type:"mat4",data:mat4.identity()},u_invViewMatrix:{type:"mat4",data:mat4.identity()},u_invWorldMatrix:{type:"mat4",data:mat4.identity()},u_inv_viewport_width:{type:"float",data:[1]},u_inv_viewport_height:{type:"float",data:[1]}, 460&&(b=this.freelist.pop());if(++this.guidCounter>=65535)this.guidCounter=1;a.handle=b<<16|++this.guidCounter;this.objects[b]=a;return a.handle};this.removeObject=function(a){a=this.handleToIndex(a);if(a!=-1){if(this.objects[a].onremove!=void 0)this.objects[a].onremove();this.objects[a]=null;this.freelist.push(a)}}};rdgeGlobalParameters={u_projMatrix:{type:"mat4",data:mat4.identity()},u_mvMatrix:{type:"mat4",data:mat4.identity()},u_invMvMatrix:{type:"mat4",data:mat4.identity()},u_normalMatrix:{type:"mat4",data:mat4.identity()},u_worldMatrix:{type:"mat4",data:mat4.identity()},u_viewMatrix:{type:"mat4",data:mat4.identity()},u_invViewMatrix:{type:"mat4",data:mat4.identity()},u_invWorldMatrix:{type:"mat4",data:mat4.identity()},u_inv_viewport_width:{type:"float",data:[1]},u_inv_viewport_height:{type:"float",data:[1]},
47u_lightPos:{type:"vec3",data:[-20,50,20]},u_lightDiff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_lightAmb:{type:"vec4",data:[1,1,1,1]},rdge_lights:{u_light0Pos:{type:"vec3",data:[-20,50,20]},u_light0Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light0Amb:{type:"vec4",data:[8.0E-4,8.0E-4,8.0E-4,1]},u_light0Spec:{type:"vec4",data:[1,1,1,1]},u_light1Pos:{type:"vec3",data:[0,0,0]},u_light1Diff:{type:"vec4",data:[0,0,0,0]},u_light1Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light1Spec:{type:"vec4",data:[1,1,1,1]}, 47u_lightPos:{type:"vec3",data:[-20,50,20]},u_lightDiff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_lightAmb:{type:"vec4",data:[1,1,1,1]},rdge_lights:{u_light0Pos:{type:"vec3",data:[-20,50,20]},u_light0Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light0Amb:{type:"vec4",data:[8.0E-4,8.0E-4,8.0E-4,1]},u_light0Spec:{type:"vec4",data:[1,1,1,1]},u_light1Pos:{type:"vec3",data:[0,0,0]},u_light1Diff:{type:"vec4",data:[0,0,0,0]},u_light1Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light1Spec:{type:"vec4",data:[1,1,1,1]},
48u_light2Pos:{type:"vec3",data:[0,0,0]},u_light2Diff:{type:"vec4",data:[0,0,0,1]},u_light2Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light2Spec:{type:"vec4",data:[1,1,1,1]},u_light3Pos:{type:"vec3",data:[0,0,0]},u_light3Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light3Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light3Spec:{type:"vec4",data:[1,1,1,1]}},colMap:{type:"tex2d",data:"assets/images/white.png"},envMap:{type:"tex2d",data:null},normalMap:{type:"tex2d",data:null},glowMap:{type:"tex2d",data:"assets/images/black.png"}, 48u_light2Pos:{type:"vec3",data:[0,0,0]},u_light2Diff:{type:"vec4",data:[0,0,0,1]},u_light2Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light2Spec:{type:"vec4",data:[1,1,1,1]},u_light3Pos:{type:"vec3",data:[0,0,0]},u_light3Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light3Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light3Spec:{type:"vec4",data:[1,1,1,1]}},colMap:{type:"tex2d",data:"assets/images/white.png"},u_matAmbient:{type:"vec4",data:[1,1,1,1]},u_matDiffuse:{type:"vec4",data:[1,1,1,1]},u_matSpecular:{type:"vec4",
49u_shadowDepthMap:{type:"tex2d",data:null},u_depthMap:{type:"tex2d",data:null},u_matAmbient:{type:"vec4",data:[1,1,1,1]},u_matDiffuse:{type:"vec4",data:[1,1,1,1]},u_matSpecular:{type:"vec4",data:[1,1,1,1]},u_matShininess:{type:"float",data:[128]},u_matEmission:{type:"float",data:[0,0,0,1]},u_frustumFarZ:{type:"float",data:[1E3]},u_shadowLightWorld:{type:"mat4",data:mat4.identity()},u_shadowBiasMatrix:{type:"mat4",data:mat4.identity()},u_vShadowLight:{type:"mat4",data:mat4.identity()},u_shadowBPV:{type:"mat4", 49data:[1,1,1,1]},u_matShininess:{type:"float",data:[128]},u_matEmission:{type:"float",data:[0,0,0,1]},u_frustumFarZ:{type:"float",data:[1E3]},u_shadowLightWorld:{type:"mat4",data:mat4.identity()},u_shadowBiasMatrix:{type:"mat4",data:mat4.identity()},u_vShadowLight:{type:"mat4",data:mat4.identity()},u_shadowBPV:{type:"mat4",data:mat4.identity()},u_farZ:{type:"float",data:[1E3]},u_shadowLightFarZ:{type:"float",data:[1E3]},u_cameraFTR:{type:"vec3",data:[0,0,0]}};g_renderStats={};g_renderStats.numDrawCalls=new stat("rendering","numDrawCalls",0,null,!1);g_renderStats.numTriangles=new stat("rendering","numTriangles",0,null,!1);g_renderStats.numVerts=new stat("rendering","numVerts",0,null,!1);g_renderStats.numPasses=new stat("rendering","numPasses",0,null,!1);g_renderStats.reset=function(){g_renderStats.numTriangles.value=0;g_renderStats.numDrawCalls.value=0;g_renderStats.numVerts.value=0;g_renderStats.numPasses.value=0};
50data:mat4.identity()},u_farZ:{type:"float",data:[1E3]},u_shadowLightFarZ:{type:"float",data:[1E3]},u_cameraFTR:{type:"vec3",data:[0,0,0]}};g_renderStats={};g_renderStats.numDrawCalls=new stat("rendering","numDrawCalls",0,null,!1);g_renderStats.numTriangles=new stat("rendering","numTriangles",0,null,!1);g_renderStats.numVerts=new stat("rendering","numVerts",0,null,!1);g_renderStats.numPasses=new stat("rendering","numPasses",0,null,!1);g_renderStats.reset=function(){g_renderStats.numTriangles.value=0;g_renderStats.numDrawCalls.value=0;g_renderStats.numVerts.value=0;g_renderStats.numPasses.value=0};
51rdgeConstants={colorBuffer:16384,depthBuffer:256,stencilBuffer:1024,BUFFER_STATIC:0,BUFFER_DYNAMIC:1,BUFFER_STREAM:2,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,VS_ELEMENT_FLOAT4:4,VS_ELEMENT_POS:3,VS_ELEMENT_NORM:3,VS_ELEMENT_FLOAT3:3,VS_ELEMENT_FLOAT2:2,VS_ELEMENT_UV:2,VS_ELEMENT_FLOAT:1,MAX_ELEM_TYPES:7,BUFFER_STATIC:35040,BUFFER_DYNAMIC:35044,BUFFER_STREAM:35048, 50rdgeConstants={colorBuffer:16384,depthBuffer:256,stencilBuffer:1024,BUFFER_STATIC:0,BUFFER_DYNAMIC:1,BUFFER_STREAM:2,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,VS_ELEMENT_FLOAT4:4,VS_ELEMENT_POS:3,VS_ELEMENT_NORM:3,VS_ELEMENT_FLOAT3:3,VS_ELEMENT_FLOAT2:2,VS_ELEMENT_UV:2,VS_ELEMENT_FLOAT:1,MAX_ELEM_TYPES:7,BUFFER_STATIC:35040,BUFFER_DYNAMIC:35044,BUFFER_STREAM:35048,
52MAX_MATERIAL_LIGHTS:4,categoryEnumeration:{BACKGROUND:0,OPAQUE:1,TRANSPARENT:2,ADDITIVE:3,TRANSLUCENT:4,FOREGROUND:5,MAX_CAT:6},nodeType:{TRNODE:0,MESHNODE:1,MATNODE:2,LIGHTNODE:3}};rdgeId=0;function getBufferID(){return rdgeId++} 51MAX_MATERIAL_LIGHTS:4,categoryEnumeration:{BACKGROUND:0,OPAQUE:1,TRANSPARENT:2,ADDITIVE:3,TRANSLUCENT:4,FOREGROUND:5,MAX_CAT:6},nodeType:{TRNODE:0,MESHNODE:1,MATNODE:2,LIGHTNODE:3}};rdgeId=0;function getBufferID(){return rdgeId++}
53_renderer=function(a){try{this.ctx=a.getContext("experimental-webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webkit-3d",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("moz-webgl",{preserveDrawingBuffer:!0})}catch(b){}if(!this.ctx)return window.console.log("Could not create GL context"),null;this.ctx.viewport(0,0,a.width,a.height);this.console="console"in window?window.console:{log:function(){}}; 52_renderer=function(a){try{this.ctx=a.getContext("experimental-webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webkit-3d",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("moz-webgl",{preserveDrawingBuffer:!0})}catch(b){}if(!this.ctx)return window.console.log("Could not create GL context"),null;this.ctx.viewport(0,0,a.width,a.height);this.console="console"in window?window.console:{log:function(){}};
@@ -251,11 +250,10 @@ function verifyLightNode(a){if(a.lightNodeTemplate==void 0)a.lightNodeTemplate=n
251transformNodeTemplate=function(a){if(!a.children)a.children=[];if(!a.local)a.local=mat4.identity();if(!a.world)a.world=mat4.identity();if(!a.id)a.id=nodeIdGen.getId();if(!a.name)a.name="xfrmNode"+a.id;if(!a.parent)a.parent=null;if(!a.meshes)a.meshes=[];if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.TRNODE;a.attachMaterial=function(a){verifyMaterialNode(a);this.materialNode=a};a.attachMeshNode=function(b,f){typeof b=="string"&&(b=createMeshNode(b,f));if(a.materialNode==void 0)a.materialNode=createMaterialNode(a.name+ 250transformNodeTemplate=function(a){if(!a.children)a.children=[];if(!a.local)a.local=mat4.identity();if(!a.world)a.world=mat4.identity();if(!a.id)a.id=nodeIdGen.getId();if(!a.name)a.name="xfrmNode"+a.id;if(!a.parent)a.parent=null;if(!a.meshes)a.meshes=[];if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.TRNODE;a.attachMaterial=function(a){verifyMaterialNode(a);this.materialNode=a};a.attachMeshNode=function(b,f){typeof b=="string"&&(b=createMeshNode(b,f));if(a.materialNode==void 0)a.materialNode=createMaterialNode(a.name+
252"|defMaterial");a.meshes.push({mesh:{name:b.mesh.attribs.name,id:b.mesh.attribs.id}})};a.insertAsChild=function(a){if(this!=a)verifyTransformNode(a),a.parent=this,this.children.push({transformNode:a})};a.insertAsParent=function(a){if(this!=a){verifyTransformNode(a);if(this.parent){for(var f=this.parent.children.length,g=0;g<f;++g)if(this.parent.children[g].transformNode!=void 0&&(tr=this.parent.children[g].transformNode,tr.id==this.id)){this.parent.children.splice(g,1);break}a.parent=this.parent; 251"|defMaterial");a.meshes.push({mesh:{name:b.mesh.attribs.name,id:b.mesh.attribs.id}})};a.insertAsChild=function(a){if(this!=a)verifyTransformNode(a),a.parent=this,this.children.push({transformNode:a})};a.insertAsParent=function(a){if(this!=a){verifyTransformNode(a);if(this.parent){for(var f=this.parent.children.length,g=0;g<f;++g)if(this.parent.children[g].transformNode!=void 0&&(tr=this.parent.children[g].transformNode,tr.id==this.id)){this.parent.children.splice(g,1);break}a.parent=this.parent;
253this.parent.children.push({transformNode:a});this.parent=a}a.children.push({transformNode:this})}}}; 252this.parent.children.push({transformNode:a});this.parent=a}a.children.push({transformNode:this})}}};
254materialNodeTemplate=function(a){TEX_DIF=0;TEX_SPEC=1;TEX_NORM=2;TEX_GLOW=3;if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.MATNODE;MATERIAL_MAX_LIGHTS=rdgeConstants.MAX_MATERIAL_LIGHTS;if(!a.lightChannel)a.lightChannel=[null,null,null,null];if(!a.sortCategory)a.sortCategory=rdgeConstants.categoryEnumeration.OPAQUE;if(!a.id)a.id=nodeIdGen.getId();if(!a.name)a.name="matNode"+a.id;if(!a.textureList){var b=g_Engine.getContext().renderer;a.textureList=[{name:"colMap",handle:b.getTextureByName("assets/images/white"), 253materialNodeTemplate=function(a){TEX_DIF=0;TEX_SPEC=1;TEX_NORM=2;TEX_GLOW=3;if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.MATNODE;MATERIAL_MAX_LIGHTS=rdgeConstants.MAX_MATERIAL_LIGHTS;if(!a.lightChannel)a.lightChannel=[null,null,null,null];if(!a.sortCategory)a.sortCategory=rdgeConstants.categoryEnumeration.OPAQUE;if(!a.id)a.id=nodeIdGen.getId();if(!a.name)a.name="matNode"+a.id;if(!a.textureList)g_Engine.getContext(),a.textureList=[];if(!a.uniforms)a.uniforms=[];a.setTexture=function(a,f){var g=
255unit:TEX_DIF,type:UNIFORMTYPE.TEXTURE2D},{name:"envMap",handle:b.getTextureByName("assets/images/material_paint"),unit:TEX_SPEC,type:UNIFORMTYPE.TEXTURE2D},{name:"normalMap",handle:b.getTextureByName("assets/images/blue"),unit:TEX_NORM,type:UNIFORMTYPE.TEXTURE2D},{name:"glowMap",handle:b.getTextureByName("assets/images/black"),unit:TEX_GLOW,type:UNIFORMTYPE.TEXTURE2D}]}if(!a.uniforms)a.uniforms=[];a.setTexture=function(a,b){var h=g_Engine.getContext().renderer;this.textureList[a].handle=h.getTextureByName("assets/images/"+ 254g_Engine.getContext().renderer;this.textureList[a].handle=g.getTextureByName("assets/images/"+f);this.textureList[a].unit=a;this.textureList[a].type=UNIFORMTYPE.TEXTURE2D};a.setDiffuseTexture=function(a){this.setTexture(TEX_DIF,a)};a.setSpecTexture=function(a){this.setTexture(TEX_SPEC,a)};a.setNormalTexture=function(a){this.setTexture(TEX_NORM,a)};a.setGlowTexture=function(a){this.setTexture(TEX_GLOW,a)};a.setUniform=function(a,f){for(var g=this.uniforms.length,h=0;h<g;++h)if(this.uniforms[h].name==
256b);this.textureList[a].unit=a;this.textureList[a].type=UNIFORMTYPE.TEXTURE2D};a.setDiffuseTexture=function(a){this.setTexture(TEX_DIF,a)};a.setSpecTexture=function(a){this.setTexture(TEX_SPEC,a)};a.setNormalTexture=function(a){this.setTexture(TEX_NORM,a)};a.setGlowTexture=function(a){this.setTexture(TEX_GLOW,a)};a.setUniform=function(a,b){for(var h=this.uniforms.length,l=0;l<h;++l)if(this.uniforms[l].name==a){this.uniforms[l].value=b;return}window.console.log("Could not find uniform: "+a)};a.setShader= 255a){this.uniforms[h].value=f;return}window.console.log("Could not find uniform: "+a)};a.setShader=function(a){this.shaderProgram=a};a.setSortCategory=function(b){a.sortCategory=b};a.enableLightChannel=function(b,f){verifyLightNode(f);if(typeof b=="object")for(var g=b.length,h=f.length!=void 0?f.length:0,l=0;l<g;++l)a.lightChannel[b]=h>0?f[Math.min(l,h-1)]:f;else b<MATERIAL_MAX_LIGHTS&&(a.lightChannel[b]=f)};a.disableLightChannel=function(b){if(typeof b!="object")for(var f=b.length,g=0;g<f;++g)MATERIAL_MAX_LIGHTS&&
257function(a){this.shaderProgram=a};a.setSortCategory=function(b){a.sortCategory=b};a.enableLightChannel=function(b,g){verifyLightNode(g);if(typeof b=="object")for(var h=b.length,l=g.length!=void 0?g.length:0,n=0;n<h;++n)a.lightChannel[b]=l>0?g[Math.min(n,l-1)]:g;else b<MATERIAL_MAX_LIGHTS&&(a.lightChannel[b]=g)};a.disableLightChannel=function(b){if(typeof b!="object")for(var g=b.length,h=0;h<g;++h)MATERIAL_MAX_LIGHTS&&(a.lightChannel[b[h]]=null);else b<MATERIAL_MAX_LIGHTS&&(a.lightChannel[b]=null)}; 256(a.lightChannel[b[g]]=null);else b<MATERIAL_MAX_LIGHTS&&(a.lightChannel[b]=null)};a.disableAllLights=function(){for(var b=0;b<MATERIAL_MAX_LIGHTS;++b)a.lightChannel[b]=null};a.toJSON=function(){var a={jsonExportName:"materialNode"},f;for(f in this)if(a[f]=this[f],f==="textureList")for(var g=a[f],h=0,l=g.length;h<l;++h)g[h].handle.image=g[h].handle.lookUpName;else f==="shaderProgram"&&typeof a[f]!="string"&&(a[f]=a[f].exportShader());return a}};
258a.disableAllLights=function(){for(var b=0;b<MATERIAL_MAX_LIGHTS;++b)a.lightChannel[b]=null};a.toJSON=function(){var a={jsonExportName:"materialNode"},b;for(b in this)if(a[b]=this[b],b==="textureList")for(var h=a[b],l=0,n=h.length;l<n;++l)h[l].handle.image=h[l].handle.lookUpName;else b==="shaderProgram"&&typeof a[b]!="string"&&(a[b]=a[b].exportShader());return a}};
259meshNodeTemplate=function(a,b,f){b.built||renderer.createPrimitive(b);if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.MESHNODE;if(!a.attribs){var g=nodeIdGen.getId();a.attribs={id:g,indexCount:b.indexCount,name:f,vertCount:b.posCount};a.name=f}if(!a.bbox)a.bbox=new box;a.data=null;a.primitive=b;f=b.posCount;if(f>0){b=b.positions;for(g=0;g<f-2;)a.bbox.addVec3([b[g+0],b[g+1],b[g+2]]),g+=3}else window.console.error("mesh "+a.attribs.name+": bounding volume not created")}; 257meshNodeTemplate=function(a,b,f){b.built||renderer.createPrimitive(b);if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.MESHNODE;if(!a.attribs){var g=nodeIdGen.getId();a.attribs={id:g,indexCount:b.indexCount,name:f,vertCount:b.posCount};a.name=f}if(!a.bbox)a.bbox=new box;a.data=null;a.primitive=b;f=b.posCount;if(f>0){b=b.positions;for(g=0;g<f-2;)a.bbox.addVec3([b[g+0],b[g+1],b[g+2]]),g+=3}else window.console.error("mesh "+a.attribs.name+": bounding volume not created")};
260lightNodeTemplate=function(a){if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.LIGHTNODE;if(!a.id)a.id=nodeIdGen.getId();if(!a.name)a.name="light_"+a.id;if(!a.typeName)a.typeName="dir_light";if(!a.castShadow)a.castShadow=!1;if(!a.depthMapBias)a.depthMapBias=0.0179;if(!a.depthMapSize)a.depthMapSize=1024;if(!a.coneAngle)a.coneAngle=0.707;if(!a.penumbraAngle)a.coneAngle=0;if(!a.dropOff)a.coneAngle=0.025;if(!a.color)a.color=[1,1,1,1];if(!a.dir)a.dir=[1,-1,1];if(!a.links)a.links=[];if(!a.position)a.position= 258lightNodeTemplate=function(a){if(!a.nodeType)a.nodeType=rdgeConstants.nodeType.LIGHTNODE;if(!a.id)a.id=nodeIdGen.getId();if(!a.name)a.name="light_"+a.id;if(!a.typeName)a.typeName="dir_light";if(!a.castShadow)a.castShadow=!1;if(!a.depthMapBias)a.depthMapBias=0.0179;if(!a.depthMapSize)a.depthMapSize=1024;if(!a.coneAngle)a.coneAngle=0.707;if(!a.penumbraAngle)a.coneAngle=0;if(!a.dropOff)a.coneAngle=0.025;if(!a.color)a.color=[1,1,1,1];if(!a.dir)a.dir=[1,-1,1];if(!a.links)a.links=[];if(!a.position)a.position=
261[0,0,0];if(!a.lightDiffuse)a.lightDiffuse=[1,1,1,1];if(!a.lightAmbient)a.lightAmbient=[0.5,0.5,0.5,1];if(!a.lightSpecular)a.lightSpecular=[1,1,1,1];a.setPosition=function(a){for(var f=0;f<3;f++)this.position[f]=a[f]};a.setDiffuseColor=function(a){for(var f=0;f<4;f++)this.lightDiffuse[f]=a[f]};a.setAmbientColor=function(a){for(var f=0;f<4;f++)this.lightAmbient[f]=a[f]};a.setSpecularColor=function(a){for(var f=0;f<4;f++)this.lightSpecular[f]=a[f]}};var g_drawCount=0;g_enableFlyCam=!1;g_sceneStats={};g_sceneStats.nodesVisible=new stat("scenegraph","nodesVisible",0,null,!1);g_sceneStats.nodesCulled=new stat("scenegraph","nodesCulled",0,null,!1);g_sceneStats.nodesVisited=new stat("scenegraph","nodesVisited",0,null,!1);g_sceneStats.reset=function(){g_sceneStats.nodesVisible.value=0;g_sceneStats.nodesVisited.value=0;g_sceneStats.nodesCulled.value=0}; 259[0,0,0];if(!a.lightDiffuse)a.lightDiffuse=[1,1,1,1];if(!a.lightAmbient)a.lightAmbient=[0.5,0.5,0.5,1];if(!a.lightSpecular)a.lightSpecular=[1,1,1,1];a.setPosition=function(a){for(var f=0;f<3;f++)this.position[f]=a[f]};a.setDiffuseColor=function(a){for(var f=0;f<4;f++)this.lightDiffuse[f]=a[f]};a.setAmbientColor=function(a){for(var f=0;f<4;f++)this.lightAmbient[f]=a[f]};a.setSpecularColor=function(a){for(var f=0;f<4;f++)this.lightSpecular[f]=a[f]}};var g_drawCount=0;g_enableFlyCam=!1;g_sceneStats={};g_sceneStats.nodesVisible=new stat("scenegraph","nodesVisible",0,null,!1);g_sceneStats.nodesCulled=new stat("scenegraph","nodesCulled",0,null,!1);g_sceneStats.nodesVisited=new stat("scenegraph","nodesVisited",0,null,!1);g_sceneStats.reset=function(){g_sceneStats.nodesVisible.value=0;g_sceneStats.nodesVisited.value=0;g_sceneStats.nodesCulled.value=0};
@@ -366,8 +364,8 @@ sceneRequestDef=function(a,b){this.name=b;this.addr=a;this.requestComplete=this.
366function validateUserState(a){if(!a.init)a.init=function(){};if(!a.update)a.update=function(a){var f=g_Engine.getContext().currentScene,f=g_Engine.getScene(f);f!=null&&f.update(a)};if(!a.draw)a.draw=function(){var a=g_Engine.getContext().currentScene,a=g_Engine.getScene(a);a!=null&&a.render()};if(!a.resize)a.resize=function(){};if(!a.shutdown)a.shutdown=function(){};if(!a.onComplete)a.onComplete=function(){}} 364function validateUserState(a){if(!a.init)a.init=function(){};if(!a.update)a.update=function(a){var f=g_Engine.getContext().currentScene,f=g_Engine.getScene(f);f!=null&&f.update(a)};if(!a.draw)a.draw=function(){var a=g_Engine.getContext().currentScene,a=g_Engine.getScene(a);a!=null&&a.render()};if(!a.resize)a.resize=function(){};if(!a.shutdown)a.shutdown=function(){};if(!a.onComplete)a.onComplete=function(){}}
367function RDGEStart(a){var b=a;typeof a==="string"&&(b=document.getElementById(a));if(b)g_Engine.registerCanvas(b),b.task=new RDGETask(b,!0),g_shaderMan||(g_shaderMan=new ShaderManager),g_meshMan||(g_meshMan=new MeshManager),g_Engine.initializeComplete||g_Engine.init()}function RDGEStop(){RDGEShutdown!=void 0&&RDGEShutdown()}function IRuntime(){this.Shutdown=this.Draw=this.Update=this.Resize=this.ReInit=this.init=null}g_poolList=[]; 365function RDGEStart(a){var b=a;typeof a==="string"&&(b=document.getElementById(a));if(b)g_Engine.registerCanvas(b),b.task=new RDGETask(b,!0),g_shaderMan||(g_shaderMan=new ShaderManager),g_meshMan||(g_meshMan=new MeshManager),g_Engine.initializeComplete||g_Engine.init()}function RDGEStop(){RDGEShutdown!=void 0&&RDGEShutdown()}function IRuntime(){this.Shutdown=this.Draw=this.Update=this.Resize=this.ReInit=this.init=null}g_poolList=[];
368function ConnPoll(){for(var a=g_poolList.length,b=0;b<a;++b)g_poolList[b].Poll()}RDGERequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); 366function ConnPoll(){for(var a=g_poolList.length,b=0;b<a;++b)g_poolList[b].Poll()}RDGERequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();
369RDGETask=function(){var a={};return function(b,f){this.id=b.rdgeid;this.lastTime=this.currTime=0;this.running=!1;this.context=null;if(b){this.context=g_Engine.ctxMan.handleToObject(b.rdgeCtxHandle);a[this.id]=function(){if(g.running)g.currTime=(new Date).getTime(),g.step((g.currTime-g.lastTime)/1E3),RDGERequestAnimationFrame(a[g.id],b),g.lastTime=g.currTime};this.start=function(){this.running=!0;this.lastTime=this.currTime=(new Date).getTime();a[this.id]()};this.stop=function(){this.running=!1};this.kill= 367RDGETask=function(){var a={};return function(b,f){this.id=b.rdgeid;this.lastTime=this.currTime=0;this.running=!1;this.context=null;if(b){this.context=g_Engine.ctxMan.handleToObject(b.rdgeCtxHandle);a[this.id]=function(){if(g.running)g.currTime=(new Date).getTime(),g.step((g.currTime-g.lastTime)/1E3),RDGERequestAnimationFrame(a[g.id],b),g.lastTime=g.currTime};this.start=function(){if(!this.running)this.running=!0,this.lastTime=this.currTime=(new Date).getTime(),a[this.id]()};this.stop=function(){this.running=
370function(){this.running=!1;a[this.id]=null};this.step=function(a){contextManager.currentCtx=this.context;this.context.fpsTracker.sample();this.context.ctxStateManager.tick(a)};var g=this;f&&g.start()}}}();var g_dbgPanel=null; 368!1};this.kill=function(){this.running=!1;a[this.id]=null};this.step=function(a){contextManager.currentCtx=this.context;this.context.fpsTracker.sample();this.context.ctxStateManager.tick(a)};var g=this;f&&g.start()}}}();var g_dbgPanel=null;
371function utilDbgPanel(a,b){this.id=a;this.root="#"+a;this.accordion=this.root+" .dbgpanel-accordion";this.categories={};this.counter=0;$(this.root).addClass("dbgpanel-outer ui-widget-content");$(this.root).draggable({handle:this.root,containment:"body"});$(this.root).resizable({minWidth:$(this.root).width(),minHeight:$(this.root).height()});$(this.root).append('<h3 class="dbgpanel-title">'+b+"</h3>");$(this.root).append('<div class="dbgpanel-accordion" />');$(this.accordion).accordion({clearStyle:!0})} 369function utilDbgPanel(a,b){this.id=a;this.root="#"+a;this.accordion=this.root+" .dbgpanel-accordion";this.categories={};this.counter=0;$(this.root).addClass("dbgpanel-outer ui-widget-content");$(this.root).draggable({handle:this.root,containment:"body"});$(this.root).resizable({minWidth:$(this.root).width(),minHeight:$(this.root).height()});$(this.root).append('<h3 class="dbgpanel-title">'+b+"</h3>");$(this.root).append('<div class="dbgpanel-accordion" />');$(this.accordion).accordion({clearStyle:!0})}
372utilDbgPanel.prototype.appendLabel=function(a,b){var f=this.getCategorySelector(a);$(f).append('<p class="dbgpanel-label">'+b+"</p>")}; 370utilDbgPanel.prototype.appendLabel=function(a,b){var f=this.getCategorySelector(a);$(f).append('<p class="dbgpanel-label">'+b+"</p>")};
373utilDbgPanel.prototype.appendBoolean=function(a,b,f,g){var a=this.getCategorySelector(a),h=this.getUniqueID();$(a).append('<div class="dbgpanel-button"><input type="checkbox" id="'+h+'"><label for="'+h+'" class="dbgpanel-button-label"/></div>');$("#"+h).prop("checked",b||b!=0);$("#"+h).button({label:f});$("#"+h).change(function(a){b=a.target.checked?typeof b=="number"?1:!0:typeof b=="number"?0:!1;g&&g(b)})}; 371utilDbgPanel.prototype.appendBoolean=function(a,b,f,g){var a=this.getCategorySelector(a),h=this.getUniqueID();$(a).append('<div class="dbgpanel-button"><input type="checkbox" id="'+h+'"><label for="'+h+'" class="dbgpanel-button-label"/></div>');$("#"+h).prop("checked",b||b!=0);$("#"+h).button({label:f});$("#"+h).change(function(a){b=a.target.checked?typeof b=="number"?1:!0:typeof b=="number"?0:!1;g&&g(b)})};
@@ -433,11 +431,11 @@ rdgeGlobalParameters =
433 "u_light3Amb": {'type': 'vec4', 'data': [0.5, 0.5, 0.5, 1.0]}, 431 "u_light3Amb": {'type': 'vec4', 'data': [0.5, 0.5, 0.5, 1.0]},
434 "u_light3Spec": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}}, 432 "u_light3Spec": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}},
435 "colMap": {'type': 'tex2d', 'data': "assets/images/white.png"}, 433 "colMap": {'type': 'tex2d', 'data': "assets/images/white.png"},
436 "envMap": {'type': 'tex2d', 'data': null}, 434 //"envMap": {'type': 'tex2d', 'data': null},
437 "normalMap": {'type': 'tex2d', 'data': null}, 435