aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/html-document.js40
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js64
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js15
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/fx/ssao.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/init_state.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jshader.js8
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js1
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js4
-rw-r--r--js/helper-classes/RDGE/src/tools/rdge-compiled.js64
-rw-r--r--js/io/system/ninjalibrary.js10
-rwxr-xr-xjs/lib/drawing/world.js8
-rwxr-xr-xjs/lib/geom/circle.js5
-rwxr-xr-xjs/lib/geom/geom-obj.js42
-rwxr-xr-xjs/lib/geom/rectangle.js5
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js6
-rw-r--r--js/lib/rdge/materials/pulse-material.js8
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js6
-rw-r--r--js/lib/rdge/materials/taper-material.js2
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js46
-rw-r--r--js/lib/rdge/runtime/CanvasDataManager.js83
-rw-r--r--js/lib/rdge/runtime/GLRuntime.js357
-rw-r--r--js/lib/rdge/runtime/RuntimeGeomObj.js633
-rw-r--r--js/lib/rdge/runtime/RuntimeMaterial.js351
-rw-r--r--js/mediators/io-mediator.js38
25 files changed, 266 insertions, 1546 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 0dc26884..79450494 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -9,7 +9,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 TextDocument = require("js/document/text-document").TextDocument, 10 TextDocument = require("js/document/text-document").TextDocument,
11 NJUtils = require("js/lib/NJUtils").NJUtils, 11 NJUtils = require("js/lib/NJUtils").NJUtils,
12 CanvasDataManager = require("js/lib/rdge/runtime/CanvasDataManager").CanvasDataManager,
13 GLWorld = require("js/lib/drawing/world").World; 12 GLWorld = require("js/lib/drawing/world").World;
14//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
15// 14//
@@ -189,35 +188,36 @@ exports.HTMLDocument = Montage.create(TextDocument, {
189// }, 188// },
190 189
191 glData: { 190 glData: {
192 get: function() 191 get: function() {
193 { 192 //
194 var elt = this.iframe.contentWindow.document.getElementById("UserContent"); 193 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
195 this._glData = null; 194 //
196 if (elt) 195 if (elt) {
197 {
198 var cdm = new CanvasDataManager();
199 this._glData = []; 196 this._glData = [];
200 cdm.collectGLData( elt, this._glData ); 197 //if (path) {
198 //this.collectGLData(elt, this._glData, path);
199 //} else {
200 this.collectGLData(elt, this._glData );
201 //}
202 } else {
203 this._glData = null
201 } 204 }
202 205 //
203 return this._glData; 206 return this._glData;
204 }, 207 },
205 208 set: function(value) {
206 set: function(value)
207 {
208 var elt = this.documentRoot; 209 var elt = this.documentRoot;
209 if (elt) 210 if (elt) {
210 {
211 var nWorlds= value.length; 211 var nWorlds= value.length;
212 for (var i=0; i<nWorlds; i++) { 212 for (var i=0; i<nWorlds; i++) {
213 var importStr = value[i]; 213 var importStr = value[i];
214 var startIndex = importStr.indexOf("id: "); 214 var startIndex = importStr.indexOf( "id: " );
215 if (startIndex >= 0) { 215 if (startIndex >= 0) {
216 var endIndex = importStr.indexOf("\n", startIndex); 216 var endIndex = importStr.indexOf( "\n", startIndex );
217 if (endIndex > 0) { 217 if (endIndex > 0) {
218 var id = importStr.substring( startIndex+4, endIndex); 218 var id = importStr.substring( startIndex+4, endIndex );
219 if (id) { 219 if (id) {
220 var canvas = this.findCanvasWithID(id, elt); 220 var canvas = this.findCanvasWithID( id, elt );
221 if (canvas) { 221 if (canvas) {
222 if (!canvas.elementModel) { 222 if (!canvas.elementModel) {
223 NJUtils.makeElementModel(canvas, "Canvas", "shape", true); 223 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
@@ -228,9 +228,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
228 } 228 }
229 var index = importStr.indexOf( "webGL: " ); 229 var index = importStr.indexOf( "webGL: " );
230 var useWebGL = (index >= 0) 230 var useWebGL = (index >= 0)
231 var world = new GLWorld(canvas, useWebGL); 231 var world = new GLWorld( canvas, useWebGL );
232 world.import( importStr ); 232 world.import( importStr );
233 this.buildShapeModel(canvas.elementModel, world); 233 this.buildShapeModel( canvas.elementModel, world );
234 } 234 }
235 } 235 }
236 } 236 }
diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js
index a211d17f..d1040d73 100755
--- a/js/helper-classes/RDGE/rdge-compiled.js
+++ b/js/helper-classes/RDGE/rdge-compiled.js
@@ -54,14 +54,14 @@ this.ctx.clearColor(1,0,0,1);this.clearColor=[1,0,0,1];this.clearFlags=this.ctx.
545123;this.INT=5124;this.UNSIGNED_INT=5125;this.FLOAT=5126;this.VS_ELEMENT_FLOAT4=4;this.VS_ELEMENT_FLOAT3=this.VS_ELEMENT_NORM=this.VS_ELEMENT_POS=3;this.VS_ELEMENT_UV=this.VS_ELEMENT_FLOAT2=2;this.VS_ELEMENT_FLOAT=1;this.MAX_ELEM_TYPES=7;this.BUFFER_STATIC=35040;this.BUFFER_DYNAMIC=35044;this.BUFFER_STREAM=35048;this.MAX_MATERIAL_LIGHTS=4;this.usedTextureUnits=5;this.vpY=this.vpX=0;this.vpWidth=a.width;this.vpHeight=a.height;this.cameraMan=new cameraManager;this.buffers=[];this.cullBackFace=function(){this.ctx.cullFace(this.ctx.Back)}; 545123;this.INT=5124;this.UNSIGNED_INT=5125;this.FLOAT=5126;this.VS_ELEMENT_FLOAT4=4;this.VS_ELEMENT_FLOAT3=this.VS_ELEMENT_NORM=this.VS_ELEMENT_POS=3;this.VS_ELEMENT_UV=this.VS_ELEMENT_FLOAT2=2;this.VS_ELEMENT_FLOAT=1;this.MAX_ELEM_TYPES=7;this.BUFFER_STATIC=35040;this.BUFFER_DYNAMIC=35044;this.BUFFER_STREAM=35048;this.MAX_MATERIAL_LIGHTS=4;this.usedTextureUnits=5;this.vpY=this.vpX=0;this.vpWidth=a.width;this.vpHeight=a.height;this.cameraMan=new cameraManager;this.buffers=[];this.cullBackFace=function(){this.ctx.cullFace(this.ctx.Back)};
55this.cullFrontFace=function(){this.ctx.cullFace(this.ctx.FRONT)};this.disableCulling=function(){this.ctx.disable(this.ctx.CULL_FACE)};this.enableCulling=function(){this.ctx.enable(this.ctx.CULL_FACE)};this.enablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.disablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.enablePointSprites=function(){};this.disablePointSprites=function(){};this.setClearColor=function(a){this.clearColor=a.slice(); 55this.cullFrontFace=function(){this.ctx.cullFace(this.ctx.FRONT)};this.disableCulling=function(){this.ctx.disable(this.ctx.CULL_FACE)};this.enableCulling=function(){this.ctx.enable(this.ctx.CULL_FACE)};this.enablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.disablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.enablePointSprites=function(){};this.disablePointSprites=function(){};this.setClearColor=function(a){this.clearColor=a.slice();
56this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.clearFlags=a};this._clear=function(){this.ctx.clear(this.clearFlags)};this.clear=function(a){this.ctx.clear(a)};this.flush=function(){this.ctx.flush()};this.setViewPort=function(a,b,h,l){this.vpX=a;this.vpY=b;this.vpWidth=h;this.vpHeight=l;this.ctx.viewport(this.vpX,this.vpY,this.vpWidth,this.vpHeight)};this.cameraManager=function(){return this.cameraMan};this.textureMap=[];this.rttMap=[];this.getTextureByName=function(a, 56this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.clearFlags=a};this._clear=function(){this.ctx.clear(this.clearFlags)};this.clear=function(a){this.ctx.clear(a)};this.flush=function(){this.ctx.flush()};this.setViewPort=function(a,b,h,l){this.vpX=a;this.vpY=b;this.vpWidth=h;this.vpHeight=l;this.ctx.viewport(this.vpX,this.vpY,this.vpWidth,this.vpHeight)};this.cameraManager=function(){return this.cameraMan};this.textureMap=[];this.rttMap=[];this.getTextureByName=function(a,
57b,h){var l=a.split(".")[1],n=this.textureMap[a];n===void 0?(n=this.createTexture(a+(l?"":".png"),b,h),this.textureMap[a]=n,n.lookUpName=a,n.previouslyReferenced=!1):n.previouslyReferenced=!0;return n};this.unloadedTextureCount=0;_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,h){var l=this.ctx.createTexture();this.unloadedTextureCount++;b===void 0&&(b="CLAMP");h===void 0&&(h=!0);if(l)l.image=new Image,l.image.src=a,l.image.context=g_Engine.getContext(),l.texparams= 57b,h){var l=a.split(".")[1],l=l?"":".png",n=this.textureMap[a];n===void 0?(a=g_Engine.remapAssetFolder(a),n=this.createTexture(a+l,b,h),this.textureMap[a]=n,n.lookUpName=a,n.previouslyReferenced=!1):n.previouslyReferenced=!0;return n};this.unloadedTextureCount=0;_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,h){var l=this.ctx.createTexture();this.unloadedTextureCount++;b===void 0&&(b="CLAMP");h===void 0&&(h=!0);if(l)l.image=new Image,l.image.src=a,l.image.context=
58new _texparams(b,h),l.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(l);this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")},l.image.onerror=function(){this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")};return l};this.commitTexture=function(a){this.ctx.bindTexture(this.ctx.TEXTURE_2D, 58g_Engine.getContext(),l.texparams=new _texparams(b,h),l.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(l);this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")},l.image.onerror=function(){this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")};
59a);this.ctx.texImage2D(this.ctx.TEXTURE_2D,0,this.ctx.RGBA,this.ctx.RGBA,this.ctx.UNSIGNED_BYTE,a.image);a.texparams.mips&&this.ctx.generateMipmap(this.ctx.TEXTURE_2D);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MAG_FILTER,this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MIN_FILTER,a.texparams.mips?this.ctx.LINEAR_MIPMAP_LINEAR:this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_S,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT: 59return l};this.commitTexture=function(a){this.ctx.bindTexture(this.ctx.TEXTURE_2D,a);this.ctx.texImage2D(this.ctx.TEXTURE_2D,0,this.ctx.RGBA,this.ctx.RGBA,this.ctx.UNSIGNED_BYTE,a.image);a.texparams.mips&&this.ctx.generateMipmap(this.ctx.TEXTURE_2D);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MAG_FILTER,this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MIN_FILTER,a.texparams.mips?this.ctx.LINEAR_MIPMAP_LINEAR:this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,
60this.ctx.CLAMP_TO_EDGE);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_T,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.bindTexture(this.ctx.TEXTURE_2D,null)};this.verify=function(a){var b=this.ctx.getError();b!=0&&window.console.log("GLError ( "+a+") : "+b)};this.createRenderTargetTexture=function(a,b,h,l){var n=this.ctx,o=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,o);o.width=b;o.height=h;b=n.createTexture();n.bindTexture(n.TEXTURE_2D,b); 60this.ctx.TEXTURE_WRAP_S,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_T,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.bindTexture(this.ctx.TEXTURE_2D,null)};this.verify=function(a){var b=this.ctx.getError();b!=0&&window.console.log("GLError ( "+a+") : "+b)};this.createRenderTargetTexture=function(a,b,h,l){var n=this.ctx,o=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,o);o.width=
61try{n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,null)}catch(p){h=new WebctxUnsignedByteArray(o.width*o.height*4),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,h)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,l?n.LINEAR_MIPMAP_NEAREST:n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);l&& 61b;o.height=h;b=n.createTexture();n.bindTexture(n.TEXTURE_2D,b);try{n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,null)}catch(p){h=new WebctxUnsignedByteArray(o.width*o.height*4),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,h)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,l?n.LINEAR_MIPMAP_NEAREST:n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,
62n.generateMipmap(n.TEXTURE_2D);l=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,l);n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height);n.getError(n.bindFramebuffer(n.FRAMEBUFFER,o));n.getError(n.bindRenderbuffer(n.RENDERBUFFER,l));n.getError(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height));n.bindRenderbuffer(n.RENDERBUFFER,null);n.getError(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b,0));n.getError(n.framebufferRenderbuffer(n.FRAMEBUFFER, 62n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);l&&n.generateMipmap(n.TEXTURE_2D);l=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,l);n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height);n.getError(n.bindFramebuffer(n.FRAMEBUFFER,o));n.getError(n.bindRenderbuffer(n.RENDERBUFFER,l));n.getError(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height));n.bindRenderbuffer(n.RENDERBUFFER,null);n.getError(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,
63n.DEPTH_ATTACHMENT,n.RENDERBUFFER,l));n.bindFramebuffer(n.FRAMEBUFFER,null);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null);b.id="RT_"+nodeIdGen.getId();b.frameBuffer=o;this.textureMap[a]&&window.console.log("Notification: render target: "+a+" has overwritten an existing render target");return this.textureMap[a]=b};this.defaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/test_vshader.glsl",defaultFShader:"assets/shaders/test_fshader.glsl"}, 63b,0));n.getError(n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,l));n.bindFramebuffer(n.FRAMEBUFFER,null);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null);b.id="RT_"+nodeIdGen.getId();b.frameBuffer=o;this.textureMap[a]&&window.console.log("Notification: render target: "+a+" has overwritten an existing render target");return this.textureMap[a]=b};this.defaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/test_vshader.glsl",
64techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}}; 64defaultFShader:"assets/shaders/test_fshader.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}};
65rdgeDefaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/Basic.vert.glsl",defaultFShader:"assets/shaders/Basic.frag.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; 65rdgeDefaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/Basic.vert.glsl",defaultFShader:"assets/shaders/Basic.frag.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};
66rdgeDepthMapShaderDef={shaders:{depthMapVShader:"assets/shaders/depthMap_vshader.glsl",depthMapFShader:"assets/shaders/depthMap_fshader.glsl"},techniques:{shadowDepthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}],depthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}}, 66rdgeDepthMapShaderDef={shaders:{depthMapVShader:"assets/shaders/depthMap_vshader.glsl",depthMapFShader:"assets/shaders/depthMap_fshader.glsl"},techniques:{shadowDepthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}],depthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},
67params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};rdgeViewSpaceNormalsShader={shaders:{normalsVShader:"assets/shaders/norm_depth_vshader.glsl",normalsFShader:"assets/shaders/norm_depth_fshader.glsl"},techniques:{depthMapWNormal:[{vshader:"normalsVShader",fshader:"normalsFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; 67params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};rdgeViewSpaceNormalsShader={shaders:{normalsVShader:"assets/shaders/norm_depth_vshader.glsl",normalsFShader:"assets/shaders/norm_depth_fshader.glsl"},techniques:{depthMapWNormal:[{vshader:"normalsVShader",fshader:"normalsFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};
@@ -118,22 +118,22 @@ jshader=function(a){this.name=a;this.def=null;this.technique={};this.params={};t
118"mat4",paramTypeNameMapping[a.SAMPLER_2D]="tex2d",paramTypeNameMapping[a.SAMPLER_CUBE]="texCube";this.bindParameters=function(a){for(var f=a.defParamsList,g=a.lightParams,h=a.lightContext,l=f.length,n=0,o=Array(2),p=0,n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,rdgeGlobalParameters[f[n].name].data);f=rdgeConstants.MAX_MATERIAL_LIGHTS;for(l=0;l<f;++l)if(h[l]!=null&&g[l]){n=g[l].length; 118"mat4",paramTypeNameMapping[a.SAMPLER_2D]="tex2d",paramTypeNameMapping[a.SAMPLER_CUBE]="texCube";this.bindParameters=function(a){for(var f=a.defParamsList,g=a.lightParams,h=a.lightContext,l=f.length,n=0,o=Array(2),p=0,n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,rdgeGlobalParameters[f[n].name].data);f=rdgeConstants.MAX_MATERIAL_LIGHTS;for(l=0;l<f;++l)if(h[l]!=null&&g[l]){n=g[l].length;
119for(p=0;p<n;++p)lightDataMap[g[l][p].dataIndex](this.ctx,g[l][p].loc,h[l])}p=this.renderer.usedTextureUnits;f=a.paramsList;l=f.length;for(n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,f[n].data)};createJShaderTexture=function(a,f){var g=null,g=typeof f.data=="string"?a.canvas.renderer.getTextureByName(f.data,f.wrap,f.repeat,f.mips):a.canvas.renderer.getTextureByName(f.data.lookUpName, 119for(p=0;p<n;++p)lightDataMap[g[l][p].dataIndex](this.ctx,g[l][p].loc,h[l])}p=this.renderer.usedTextureUnits;f=a.paramsList;l=f.length;for(n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,f[n].data)};createJShaderTexture=function(a,f){var g=null,g=typeof f.data=="string"?a.canvas.renderer.getTextureByName(f.data,f.wrap,f.repeat,f.mips):a.canvas.renderer.getTextureByName(f.data.lookUpName,
120f.wrap,f.repeat,f.mips);return[g]};paramType=function(a,f,g,h,l){this.loc=a.getUniformLocation(h,f);this.loc==null&&window.console.log("ctx:"+a.canvas.rdgeid+", technique: "+l+", uniform: "+f+" was not found, jshader param will have no affect");f=g[f];this.type=f.type;if(f.data==void 0)switch(f.type){case "vec4":this.data=vec4.zero();break;case "vec3":this.data=vec3.zero();break;case "vec2":this.data=vec2.zero();break;case "mat4":this.data=mat4.zero();break;case "mat3":this.data=Array(9);break;case "mat2":this.data= 120f.wrap,f.repeat,f.mips);return[g]};paramType=function(a,f,g,h,l){this.loc=a.getUniformLocation(h,f);this.loc==null&&window.console.log("ctx:"+a.canvas.rdgeid+", technique: "+l+", uniform: "+f+" was not found, jshader param will have no affect");f=g[f];this.type=f.type;if(f.data==void 0)switch(f.type){case "vec4":this.data=vec4.zero();break;case "vec3":this.data=vec3.zero();break;case "vec2":this.data=vec2.zero();break;case "mat4":this.data=mat4.zero();break;case "mat3":this.data=Array(9);break;case "mat2":this.data=
121[0,0,0,0];break;case "float":this.data=[0];break;case "int":this.data=[0];break;case "tex2d":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")];break;case "texCube":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")]}else this.data=f.type=="tex2d"||f.type=="texCube"?createJShaderTexture(a,f):f.data.slice();this.get=function(){return this.data.slice()};this.set=function(f){if(this.type=="tex2d"||this.type=="texCube")typeof f=="string"&&(f=a.canvas.renderer.getTextureByName(f)), 121[0,0,0,0];break;case "float":this.data=[0];break;case "int":this.data=[0];break;case "tex2d":this.data=[a.canvas.renderer.getTextureByName(g_Engine._assetPath+"images/white.png")];break;case "texCube":this.data=[a.canvas.renderer.getTextureByName(g_Engine._assetPath+"images/white.png")]}else this.data=f.type=="tex2d"||f.type=="texCube"?createJShaderTexture(a,f):f.data.slice();this.get=function(){return this.data.slice()};this.set=function(f){if(this.type=="tex2d"||this.type=="texCube")typeof f=="string"&&
122this.data[0]=f;else for(var g=this.data.length,h=0;h<g;++h)this.data[h]=f[h]}};globalParam=function(a,f,g,h){this.type=g.type;this.data=g.data;this.loc=a.getUniformLocation(h,f);if(this.data)this.data=g.type=="tex2d"||g.type=="texCube"?createJShaderTexture(a,g):g.data.slice();else switch(g.type){case "vec4":this.data=vec4.zero();break;case "vec3"