From 64280907f31e6f6e5659acb0893df3e0da5bb044 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 22 Feb 2012 16:28:29 -0800 Subject: GL save and reload. --- js/document/html-document.js | 41 ++------- js/helper-classes/RDGE/rdge-compiled.js | 28 +++---- .../RDGE/runtime/CanvasDataManager.js | 98 ++++++++++++++++++++++ js/helper-classes/RDGE/runtime/CanvasLoader.js | 72 ---------------- js/helper-classes/RDGE/src/tools/rdge-compiled.js | 28 +++---- js/preloader/Preloader.js | 3 + 6 files changed, 135 insertions(+), 135 deletions(-) create mode 100644 js/helper-classes/RDGE/runtime/CanvasDataManager.js delete mode 100644 js/helper-classes/RDGE/runtime/CanvasLoader.js (limited to 'js') 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, { glData: { get: function() { - var elt = this.iframe; var elt = this.iframe.contentWindow.document.getElementById("UserContent"); this._glData = null; if (elt) { - this._glData = new Array(); - this.collectGLData( elt, this._glData ); + var cdm = new CanvasDataManager(); + this._glData = []; + cdm.collectGLData( elt, this._glData ); } return this._glData @@ -166,37 +166,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { set: function(value) { - var nWorlds = value.length; - for (var i=0; i= 0) - { - var endIndex = importStr.indexOf( "\n", startIndex ); - if (endIndex > 0) - { - var id = importStr.substring( startIndex+4, endIndex ); - var canvas = this.iframe.contentWindow.document.getElementById( id ); - if (canvas) - { - if (!canvas.elementModel) - { - NJUtils.makeElementModel(canvas, "Canvas", "shape", true); - } - - if (canvas.elementModel) - { - if (canvas.elementModel.shapeModel.GLWorld) - canvas.elementModel.shapeModel.GLWorld.clearTree(); - - var world = new GLWorld( canvas ); - canvas.elementModel.shapeModel.GLWorld = world; - world.import( importStr ); - } - } - } - } + console.log( "load canvas data: " + value ); + var cdm = new CanvasDataManager(); + cdm.loadGLData(elt, value); } } }, 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 a;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> 0&&(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]}, u_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]}, -u_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"}, -u_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", -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}; +u_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", +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",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}; rdgeConstants={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, MAX_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++} _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 transformNodeTemplate=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+ "|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;g0?g[Math.min(n,l-1)]:g;else b0?f[Math.min(l,h-1)]:f;else b0){b=b.positions;for(g=0;g'+b+"");$(this.root).append('
');$(this.accordion).accordion({clearStyle:!0})} utilDbgPanel.prototype.appendLabel=function(a,b){var f=this.getCategorySelector(a);$(f).append('

'+b+"

")}; utilDbgPanel.prototype.appendBoolean=function(a,b,f,g){var a=this.getCategorySelector(a),h=this.getUniqueID();$(a).append('
');$("#"+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 = "u_light3Amb": {'type': 'vec4', 'data': [0.5, 0.5, 0.5, 1.0]}, "u_light3Spec": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}}, "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"}, - "u_shadowDepthMap": {'type': 'tex2d', 'data': null}, - "u_depthMap": {'type': 'tex2d', 'data': null}, + //"envMap": {'type': 'tex2d', 'data': null}, + //"normalMap": {'type': 'tex2d', 'data': null}, + //"glowMap": {'type': 'tex2d', 'data': "assets/images/black.png"}, + //"u_shadowDepthMap": {'type': 'tex2d', 'data': null}, + //"u_depthMap": {'type': 'tex2d', 'data': null}, "u_matAmbient": {'type': 'vec4', 'data': [1.00,1.00,1.00, 1]}, "u_matDiffuse": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}, "u_matSpecular": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}, diff --git a/js/helper-classes/RDGE/runtime/CanvasDataManager.js b/js/helper-classes/RDGE/runtime/CanvasDataManager.js new file mode 100644 index 00000000..4985fc9a --- /dev/null +++ b/js/helper-classes/RDGE/runtime/CanvasDataManager.js @@ -0,0 +1,98 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + + +/////////////////////////////////////////////////////////////////////// +// Class ShapeRuntime +// Manages runtime shape display +/////////////////////////////////////////////////////////////////////// +function CanvasDataManager() +{ + this.loadGLData = function(root, valueArray) + { + var value = valueArray; + var nWorlds = value.length; + for (var i=0; i= 0) + { + var endIndex = importStr.indexOf( "\n", startIndex ); + if (endIndex > 0) + { + var id = importStr.substring( startIndex+4, endIndex ); + var canvas = this.findCanvasWithID( id, root ); + if (canvas) + { + var loadForAuthoring = true; + var index = importStr.indexOf( "scenedata: " ); + if (index >= 0) loadForAuthoring = false; + + if (loadForAuthoring) + { + if (!canvas.elementModel) + { + NJUtils.makeElementModel(canvas, "Canvas", "shape", true); + } + + if (canvas.elementModel) + { + if (canvas.elementModel.shapeModel.GLWorld) + canvas.elementModel.shapeModel.GLWorld.clearTree(); + + var world = new GLWorld( canvas ); + canvas.elementModel.shapeModel.GLWorld = world; + world.import( importStr ); + } + } + else + { + var rt = new GLRuntime( canvas, importStr ); + } + } + } + } + } + } + + this.collectGLData = function( elt, dataArray ) + { + if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) + { + var data = elt.elementModel.shapeModel.GLWorld.export(); + dataArray.push( data ); + } + + if (elt.children) + { + var nKids = elt.children.length; + for (var i=0; i -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. - */ - - - -/////////////////////////////////////////////////////////////////////// -// Class ShapeRuntime -// Manages runtime shape display -/////////////////////////////////////////////////////////////////////// -function CanvasLoader( root, valueArray, loadForAuthoring ) -{ - var value = valueArray; - var nWorlds = value.length; - for (var i=0; i= 0) - { - var endIndex = importStr.indexOf( "\n", startIndex ); - if (endIndex > 0) - { - var id = importStr.substring( startIndex+4, endIndex ); - var canvas = this.findCanvasWithID( id, root ); - if (canvas) - { - if (loadForAuthoring) - { - if (!canvas.elementModel) - { - NJUtils.makeElementModel(canvas, "Canvas", "shape", true); - } - - if (canvas.elementModel) - { - if (canvas.elementModel.shapeModel.GLWorld) - canvas.elementModel.shapeModel.GLWorld.clearTree(); - - var world = new GLWorld( canvas ); - canvas.elementModel.shapeModel.GLWorld = world; - world.import( importStr ); - } - } - else - { - var rt = new GLRuntime( canvas, importStr ); - } - } - } - } - } - - this.findCanvasWithID = function( id, elt ) - { - var cid = elt.getAttribute( "data-RDGE-id" ); - if (cid == id) return elt; - - if (elt.children) - { - var nKids = elt.children.length; - for (var i=0; i=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> 0&&(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]}, u_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]}, -u_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"}, -u_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", -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}; +u_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", +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",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}; rdgeConstants={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, MAX_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++} _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 transformNodeTemplate=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+ "|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;g0?g[Math.min(n,l-1)]:g;else b0?f[Math.min(l,h-1)]:f;else b0){b=b.positions;for(g=0;g'+b+"");$(this.root).append('
');$(this.accordion).accordion({clearStyle:!0})} utilDbgPanel.prototype.appendLabel=function(a,b){var f=this.getCategorySelector(a);$(f).append('

'+b+"

")}; utilDbgPanel.prototype.appendBoolean=function(a,b,f,g){var a=this.getCategorySelector(a),h=this.getUniqueID();$(a).append('
');$("#"+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 = "u_light3Amb": {'type': 'vec4', 'data': [0.5, 0.5, 0.5, 1.0]}, "u_light3Spec": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}}, "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"}, - "u_shadowDepthMap": {'type': 'tex2d', 'data': null}, - "u_depthMap": {'type': 'tex2d', 'data': null}, + //"envMap": {'type': 'tex2d', 'data': null}, + //"normalMap": {'type': 'tex2d', 'data': null}, + //"glowMap": {'type': 'tex2d', 'data': "assets/images/black.png"}, + //"u_shadowDepthMap": {'type': 'tex2d', 'data': null}, + //"u_depthMap": {'type': 'tex2d', 'data': null}, "u_matAmbient": {'type': 'vec4', 'data': [1.00,1.00,1.00, 1]}, "u_matDiffuse": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}, "u_matSpecular": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}, diff --git a/js/preloader/Preloader.js b/js/preloader/Preloader.js index 21d7fcee..5b806909 100755 --- a/js/preloader/Preloader.js +++ b/js/preloader/Preloader.js @@ -65,6 +65,9 @@ exports.Preloader = Montage.create(Component, { {"type":"js", "url":"js/helper-classes/RDGE/GLMaterial.js"}, {"type":"js", "url":"js/helper-classes/RDGE/GLLight.js"}, + {"type":"js", "url":"js/helper-classes/RDGE/runtime/CanvasDataManager.js"}, + {"type":"js", "url":"js/helper-classes/RDGE/runtime/GLRuntime.js"}, + {"type":"js", "url":"js/helper-classes/RDGE/Materials/FlatMaterial.js"}, {"type":"js", "url":"js/helper-classes/RDGE/Materials/TaperMaterial.js"}, {"type":"js", "url":"js/helper-classes/RDGE/Materials/TwistVertMaterial.js"}, -- cgit v1.2.3