From 2092acf520e3f346f15e42c76c2f616e7d094c97 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Thu, 9 Feb 2012 12:10:37 -0800 Subject: Squashed commit of the following: commit ce81a3f4387d80f9ac406e73b843fb5dbe9cf432 Merge: e78f431 fba39db Author: Valerio Virgillito Date: Thu Feb 9 11:57:35 2012 -0800 Merge pull request #26 from pushkarjoshi/pentool Pentool commit e78f4312c194d9e8188075cf1fe87e4be22b24e4 Author: Valerio Virgillito Date: Thu Feb 9 11:56:40 2012 -0800 adding oneway to the 3d bindings to fix a bug where the stage was getting selected. Signed-off-by: Valerio Virgillito commit fba39dbb3bd64eddf6162fbf57232089e446fb06 Author: Pushkar Joshi Date: Thu Feb 9 10:50:05 2012 -0800 removing shaders commit fa700027b541ec8f37c55f4fe17da5f78759ebd5 Author: Pushkar Joshi Date: Wed Feb 8 16:06:37 2012 -0800 fill all paths even if they are open commit 18243deb66ab14a014756bfb0be1a52648c7771a Merge: 802e92e 0537f8f Author: Pushkar Joshi Date: Wed Feb 8 15:42:40 2012 -0800 Merge branch 'master' into pentool Conflicts: js/helper-classes/RDGE/GLWorld.js js/helper-classes/RDGE/MaterialsLibrary.js commit 802e92eb70b00849dadacf2c6590d27edbe65d99 Author: Pushkar Joshi Date: Wed Feb 8 15:39:47 2012 -0800 bug fixes for better anchor point rotation and removing snapping on hover and mouse down commit 9b6b228524f14bf65ba60aaf3d0993c8ec5bff2d Author: Pushkar Joshi Date: Tue Feb 7 15:22:11 2012 -0800 some minor bug fixes and code cleanup commit 4bbe42e6d01fd0f81d13357a75b40eae9925dda3 Merge: e7aa17a 8950b34 Author: Pushkar Joshi Date: Tue Feb 7 07:21:27 2012 -0800 Merge branch 'master' into pentool commit e7aa17a9b472640355e95c54841399f6203050d4 Author: Pushkar Joshi Date: Tue Feb 7 07:20:28 2012 -0800 don't use colorToHex function because it only works for 3D color (needs a fix to colorToHex) commit acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9 Merge: 4d4de64 4222db9 Author: Pushkar Joshi Date: Thu Feb 2 11:28:45 2012 -0800 Merge branch 'working' of c:/Code/github/emueller/ninja-internal/ into pentool commit 4d4de64472603426a73b26cc98ba8206190949b8 Merge: 0e87c02 5233508 Author: Pushkar Joshi Date: Thu Feb 2 11:19:30 2012 -0800 Merge branch 'master' into pentool commit 4222db97e353fb65fab787ba5927d16d9fa4e1f7 Author: hwc487 Date: Wed Feb 1 16:18:26 2012 -0800 Removed a console log and set the Plasma material to animating. commit 30bc466a0ac80f8303e223c19704b90457293cdc Author: hwc487 Date: Wed Feb 1 15:57:20 2012 -0800 Fixed plane orientations for view orientations other than front. commit 11db5a63bda57c630eaf1d8baded9b79ca7ac1f2 Author: hwc487 Date: Wed Feb 1 15:11:21 2012 -0800 listen for the appMouseUp event in the Pan tool commit 823945a2bcb42bbf9c6a1cd0ef723b8f415e557f Author: hwc487 Date: Wed Feb 1 14:39:46 2012 -0800 factor in the zoom factor when drawing the stage compass. commit 0e87c02e74e08c7bf156373b0d2459563e17ecd6 Author: Pushkar Joshi Date: Wed Feb 1 14:38:15 2012 -0800 make GLAnchorPoint functions as part of its prototype commit 5a288b9d3f8e6690149978d9d0e7bea98cc81312 Author: hwc487 Date: Wed Feb 1 14:09:24 2012 -0800 Fix for a marquee zoom bug. commit 715f95cacead0025a57823e4cefa22e618f15df0 Author: hwc487 Date: Wed Feb 1 14:00:06 2012 -0800 mouse wheel for zoom tool commit 62d38a080b2918a0284c854e9bf882bfeeea1e0b Author: Pushkar Joshi Date: Wed Feb 1 13:21:11 2012 -0800 avoid overriding GlGeomObj translate method commit 799369e153baf92eb10f26e91a1ab664900da8ed Merge: b2ce8b8 c0f4374 Author: hwc487 Date: Wed Feb 1 13:06:17 2012 -0800 Merge branch 'ToolFixes' of github.com:mqg734/ninja-internal into working commit b2ce8b819cc85a558d862c04965b7e65a6ce8640 Author: hwc487 Date: Wed Feb 1 13:05:32 2012 -0800 changes to allow minimal rendering ofnon-animated materials. commit ada488781ff815a827e7f5903f2c55773e3be0f3 Author: Pushkar Joshi Date: Wed Feb 1 12:16:11 2012 -0800 when selecting anchor points, first check if the selected anchor position is close enough commit 107f79288ed87a282dd52075640297cc02bdf318 Author: Pushkar Joshi Date: Wed Feb 1 12:00:44 2012 -0800 performance improvement: add most of the GLSubpath functions to its prototype commit c00d5d3072e487be200559f692ce4399222d5fa5 Author: Pushkar Joshi Date: Tue Jan 31 14:25:05 2012 -0800 handle the case of proper redraw when the alt key is held down even after mouse up commit c006b3e75d5e23da63687a04cd30bf56a3a8a80d Merge: f0e3fa6 1d8af9f Author: Pushkar Joshi Date: Tue Jan 31 12:07:43 2012 -0800 Merge branch 'master' into pentool commit f0e3fa691b3c042c9fc49a7a0cde8ddf8100c195 Author: Pushkar Joshi Date: Tue Jan 31 12:05:15 2012 -0800 display the anchor point to be selected on mouse hover commit aa1b4b78d9e1b9cc15529dbf7196b7ac8a88e260 Merge: 0b8d8b2 6066b9b Author: hwc487 Date: Tue Jan 31 10:46:48 2012 -0800 Merge branch 'ToolFixes' of github.com:mqg734/ninja-internal into working Conflicts: js/stage/stage.reel/stage.js commit 0b8d8b2eb595b64ef53440b949f3c5ec891daf8a Merge: 8e43a46 e4837ed Author: hwc487 Date: Tue Jan 31 09:22:56 2012 -0800 Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into working commit 8e43a46e3d79323fe06dc7771bc611a2c3c85c5c Author: hwc487 Date: Mon Jan 30 16:15:12 2012 -0800 Renderer startup handling of non-animated materials. Changed zoom from the document bar to keep the location center of the viewable portion of the document fixed. commit c41d2c2b749b67921f243fb7594ce0cdb1ccce36 Merge: 86a801c f129a23 Author: hwc487 Date: Mon Jan 30 16:09:00 2012 -0800 Merge branch 'staging' of github.com:Motorola-Mobility/ninja-internal into working commit 972e0ce4df7b332601ad006ca8b7dd9e189a59ef Author: Pushkar Joshi Date: Mon Jan 30 14:38:48 2012 -0800 do the fill before the stroke for the path, so the stroke width renders acc. to user specification commit da7ad067b146200847b543faf288844221dff928 Author: Pushkar Joshi Date: Mon Jan 30 14:30:31 2012 -0800 missed a couple of pen tool property files on last checkin commit 76abbaafb0d90bb1dc9c63a5a5a78ab95bb00420 Author: Pushkar Joshi Date: Mon Jan 30 13:56:33 2012 -0800 Merge pushkar branch on gerritt with github version commit 86a801c057fc3b0580d6130be5740c2ee503444f Author: hwc487 Date: Fri Jan 27 15:52:36 2012 -0800 updated from old repo Signed-off-by: Jonathan Duran --- js/helper-classes/RDGE/rdge-compiled.js | 102 ++++++++++++++++---------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'js/helper-classes/RDGE/rdge-compiled.js') diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js index 4b74aa17..e55516db 100644 --- a/js/helper-classes/RDGE/rdge-compiled.js +++ b/js/helper-classes/RDGE/rdge-compiled.js @@ -19,14 +19,14 @@ vec4.equal=function(a,b,f){f||(f=0.0010);return vec4.distanceSq(a,b)=4?b[3]:1;return[a[0]*f+a[4]*g+a[8]*h+a[12]*l,a[1]*f+a[5]*g+a[9]*h+a[13]*l,a[2]*f+a[6]*g+a[10]*h+a[14]*l,a[3]*f+a[7]*g+a[11]*h+a[15]*l]};mat4.transformVector=function(a,b){var a=mat4.inverse(a),f=b[0],g=b[1],h=b[2],l=b.length>=4?b[3]:0;return[a[0]*f+a[1]*g+a[2]*h+a[3]*l,a[4]*f+a[5]*g+a[6]*h+a[7]*l,a[8]*f+a[9]*g+a[10]*h+a[11]*l,a[12]*f+a[13]*g+a[14]*h+a[15]*l]}; mat4.transformPoint4x3=function(a,b){var f=b[0],g=b[1],h=b[2];return[a[0]*f+a[4]*g+a[8]*h+a[12],a[1]*f+a[5]*g+a[9]*h+a[13],a[2]*f+a[6]*g+a[10]*h+a[14],1]};mat4.transformVector4x3=function(a,b){var a=mat4.inverse(a),f=b[0],g=b[1],h=b[2];return[a[0]*f+a[1]*g+a[2]*h,a[4]*f+a[5]*g+a[6]*h,a[8]*f+a[9]*g+a[10]*h,0]};mat4.getRow=function(a,b){b*=4;return[a[b],a[b+1],a[b+2],a[b+3]]};mat4.getCol=function(a,b){return[a[b],a[b+4],a[b+8],a[b+12]]}; @@ -36,7 +36,7 @@ mat4.translateY=function(a,b){return mat4.translate(a,[0,b,0])};mat4.translateZ= b[2]-a[2]*b[1],a[3]*b[1]-a[0]*b[2]+a[1]*b[3]+a[2]*b[0],a[3]*b[2]+a[0]*b[1]-a[1]*b[0]+a[2]*b[3]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=4?[a[0]+b[0]*f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2],a[3]+b[3]*f[3]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f,a[3]+b[3]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=4?[a[0]*b[0],a[1]*a[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},lengthSq:function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]},length:function(a){return Math.sqrt(a[0]* a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a},inverse:function(a){var b=vec4.lengthSq(a);return b>1.0E-5?(b=1/b,[a[0]*-b,a[1]*-b,a[2]*-b,a[3]]):a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}};quat.applyRotation=function(a,b){return mat4.transformPoint(quat.toMatrix(a),b)}; quat.lerp=function(a,b,f){return quat.normalize([a[0]+(b[0]-a[0])*f,a[1]+(b[1]-a[1])*f,a[2]+(b[2]-a[2])*f,a[3]+(b[3]-a[3])*f])};quat.slerp=function(a,b,f){var g=quat.dot(a,b);if(g>=0.9)return quat.lerp(a,b,f);var h=Math.sqrt(Math.abs(1-g*g));if(h<0.0010)return a;var g=g<0?-1:1,l=Math.asin(h),n=1/h,h=Math.sin((1-f)*l)*n,f=Math.sin(f*l)*n*g;quat.scale(a,h);quat.scale(b,f);return quat.normalize(quat.add(a,b))}; -quat.toMatrix=function(a){var b=2*a[0],f=2*a[1],g=2*a[2],h=b*a[3],l=f*a[3],n=g*a[3];b*=a[0];var o=f*a[0],q=g*a[0];f*=a[1];var p=g*a[1],a=g*a[2];return[1-(f+a),o+n,q-l,0,o-n,1-(b+a),p+h,0,q+l,p-h,1-(b+f),0,0,0,0,1]};var stat=function(){pages={};dlgId="";self=function(a,b,f,g,h){h==void 0&&(h=!0);category=!a?"default":a;pages[category]||(pages[category]=[]);pages[category].push(this);this.name=b;this.value=this.defValue=f;this.func=g;this.reset=h;this.reportInterval=500;stat.dirty=!0;stat.find=function(a,b){var f=pages[a];for(i=0;i'+a+"");g+="";for(a in pages)pages[a]&&(g+='
',g+="
");g+="";f.innerHTML=g;$("#stat_tabs").tabs();stat.dirty=!1}for(a in pages)f=document.getElementById(a),stat.report(f,a,b)};stat.report=function(a,b){b||(b="default");var f=pages[b];if(f){outputHTML='';var g=0;for(i=0;i', outputHTML+=f[i].func?f[i].name+" : "+f[i].func(f[i].value):f[i].name+" : "+f[i].value,outputHTML+="",g++>=3&&(outputHTML+="",g=0),f[i].reset)f[i].value=f[i].defValue;outputHTML+="
";a.innerHTML=outputHTML}}};setInterval(function(){self.reportAll("RDGE_STATS")},500);return self}(); dbCanvas=function(a,b){this.front=document.createElement("canvas");this.front.setAttribute("width",a);this.front.setAttribute("height",b);this.front.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");this.front.ctx=this.front.getContext("2d");this.back=document.createElement("canvas");this.back.setAttribute("width",a);this.back.setAttribute("height",b);this.front.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");this.back.ctx=this.back.getContext("2d"); @@ -64,7 +64,7 @@ this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.cl b,h){var l=a.split(".")[1],n=this.textureMap[a];if(n===void 0)n=this.createTexture(a+(l?"":".png"),b,h),this.textureMap[a]=n,n.lookUpName=a;return n};_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,h){var l=this.ctx.createTexture();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=new _texparams(b,h),l.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(l)}; return 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, this.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= -b;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(q){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, +b;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, n.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, b,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", defaultFShader:"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"}}]}}}; @@ -91,61 +91,60 @@ g.bufferUsage):(this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[a.buffers 0,new Float32Array(a.indexBuffer),a.indexUsage)):this.buffers[a.buffersID].indexHandle=this.createIndexBufferUINT16(a.indexBuffer,a.indexUsage):(this.ctx.bindBuffer(this.ctx.ELEMENT_ARRAY_BUFFER,this.buffers[a.buffersID].indexHandle),this.ctx.bufferSubData(this.ctx.ELEMENT_ARRAY_BUFFER,0,new Float32Array(a.indexBuffer),a.indexUsage)),a.indexCount=b,a.triCount=b/3):a.triCount=a.posCount/3}else this.createPrimitive(a)}; _renderer.prototype.deletePrimitive=function(a){var b=this.buffers[a.buffersID];if(b){var f=this;b.forEach(function(a){f.ctx.deleteBuffer(a)});delete this.buffers[a.buffersID]}};_renderer.prototype.getPrimitiveBuffer=function(a,b){return this.buffers[a.buffersID][b]}; _renderer.prototype.drawPrimitive=function(a,b,f){g_renderStats.numDrawCalls.value++;g_renderStats.numTriangles.value+=Math.floor(a.triCount);g_renderStats.numVerts.value+=Math.floor(a.coordCount/3);a.indexCount?this.drawIndexedPrimitive(a,b,f):this.drawNonIndexedPrimitive(a,b,f);a.useDoubleBuffer===!0&&a.flip(this)}; -_renderer.prototype.drawIndexedPrimitive=function(a,b,f){var g=b=0,h=a.buffersID,l="",n=f.length,o=0,q=a.frontBufferIndex*a.doubleBufferOffset;for(g_Engine.getContext();o0;)for(var b=Math.min(this.lineBuffer.length,this.maxLines),f=0;b>0;){var g=this.lineBuffer.shift(),h=f*6,l=f*8;this.posBufferData[h+0]=g[0][0];this.posBufferData[h+1]=g[0][1];this.posBufferData[h+2]=g[0][2];this.posBufferData[h+3]=g[1][0];this.posBufferData[h+4]=g[1][1];this.posBufferData[h+ 5]=g[1][2];this.colorBufferData[l+0]=g[2][0];this.colorBufferData[l+1]=g[2][1];this.colorBufferData[l+2]=g[2][2];this.colorBufferData[l+3]=g[2][3];this.colorBufferData[l+4]=g[3][0];this.colorBufferData[l+5]=g[3][1];this.colorBufferData[l+6]=g[3][2];this.colorBufferData[l+7]=g[3][3];b--;f++;if(b<=0){this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.posBufferObject);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,null);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,this.posBufferData);this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, this.colorBufferObject);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,null);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,this.colorBufferData);this.ctx.disable(this.ctx.DEPTH_TEST);this.shader.begin();this.shader.beginPass(0);this.ctx.enableVertexAttribArray(0);this.ctx.enableVertexAttribArray(1);this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.posBufferObject);this.ctx.vertexAttribPointer(0,3,this.ctx.FLOAT,!1,0,0);this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.colorBufferObject);this.ctx.vertexAttribPointer(1, 4,this.ctx.FLOAT,!1,0,0);this.ctx.drawArrays(this.ctx.LINES,0,f*2);this.shader.endPass();this.shader.end();this.ctx.enable(this.ctx.DEPTH_TEST);a++;this.ctx.finish();this.ctx.flush();break}}};renderUtils={createBox:function(){var a=g_Engine.getContext().renderer,b=new rdgePrimitiveDefinition;b.vertexDefinition={vert:{type:rdgeConstants.VS_ELEMENT_POS,bufferIndex:0,bufferUsage:rdgeConstants.BUFFER_STATIC},a_pos:{type:rdgeConstants.VS_ELEMENT_POS,bufferIndex:0,bufferUsage:rdgeConstants.BUFFER_STATIC},normal:{type:rdgeConstants.VS_ELEMENT_FLOAT3,bufferIndex:1,bufferUsage:rdgeConstants.BUFFER_STATIC},a_nrm:{type:rdgeConstants.VS_ELEMENT_FLOAT3,bufferIndex:1,bufferUsage:rdgeConstants.BUFFER_STATIC}, texcoord:{type:rdgeConstants.VS_ELEMENT_FLOAT2,bufferIndex:2,bufferUsage:rdgeConstants.BUFFER_STATIC},a_uv:{type:rdgeConstants.VS_ELEMENT_FLOAT2,bufferIndex:2,bufferUsage:rdgeConstants.BUFFER_STATIC}};b.bufferStreams=[[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0, 0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],[1,1,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1]];b.streamUsage=[rdgeConstants.BUFFER_STATIC,rdgeConstants.BUFFER_STATIC,rdgeConstants.BUFFER_STATIC];b.indexUsage=rdgeConstants.BUFFER_STREAM;b.indexBuffer=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23];b.type=rdgeConstants.TRIANGLES;a.createPrimitive(b);return b}}; -function makeSphere(a,b,f,g){for(var h=[],l=[],n=[],o=[],q=0;q<=f;++q)for(var p=0;p<=g;++p){var r=q*Math.PI/f,s=p*2*Math.PI/g,u=Math.sin(r),v=Math.sin(s),r=Math.cos(r),s=Math.cos(s)*u;u*=v;var v=1-p/g,x=q/f;l.push(s);l.push(r);l.push(u);n.push(v);n.push(x);h.push(b*s);h.push(b*r);h.push(b*u)}for(q=0;q");var f=this.def.shaders[a.vshader],g=this.def.shaders[a.fshader]; -this.ctx.useProgram(null);var h=null,l=null;f.indexOf("{")!=-1?l=f:(l=new XMLHttpRequest,l.open("GET",f,!1),l.send(null),l=l.responseText);h=this.buildShader(this.ctx.VERTEX_SHADER,l);l=null;f.indexOf("{")!=-1?l=g:(l=new XMLHttpRequest,l.open("GET",g,!1),l.send(null),l=l.responseText);l=this.buildShader(this.ctx.FRAGMENT_SHADER,l);if(!h||!l)return null;this.compiledShaders[a.vshader]=h;this.compiledShaders[a.fshader]=l;f=this.ctx.createProgram();if(!f)return null;this.ctx.attachShader(f,h);this.ctx.attachShader(f, -l);g=0;a.attribPairs=[];for(var n in a.attributes)a.attribPairs.push({loc:g,name:n}),this.ctx.bindAttribLocation(f,g++,n);this.ctx.linkProgram(f);return!this.ctx.getProgramParameter(f,this.ctx.LINK_STATUS)?(a=this.ctx.getProgramInfoLog(f),window.console.log("Error in program linking:"+a),this.ctx.deleteProgram(f),this.ctx.deleteProgram(l),this.ctx.deleteProgram(h),null):f};this.setLightContext=function(a){for(t in this.technique)for(var f=this.technique.passes.length,g=0;g");var f=this.def.shaders[a.vshader],g=this.def.shaders[a.fshader];this.ctx.useProgram(null);var h=null,l=null;f.indexOf("{")!=-1?l=f:(l=new XMLHttpRequest,l.open("GET",f,!1),l.send(null),l=l.responseText);h=this.buildShader(this.ctx.VERTEX_SHADER, +l);l=null;f.indexOf("{")!=-1?l=g:(l=new XMLHttpRequest,l.open("GET",g,!1),l.send(null),l=l.responseText);l=this.buildShader(this.ctx.FRAGMENT_SHADER,l);if(!h||!l)return null;this.compiledShaders[a.vshader]=h;this.compiledShaders[a.fshader]=l;f=this.ctx.createProgram();if(!f)return null;this.ctx.attachShader(f,h);this.ctx.attachShader(f,l);g=0;a.attribPairs=[];for(var n in a.attributes)a.attribPairs.push({loc:g,name:n}),this.ctx.bindAttribLocation(f,g++,n);this.ctx.linkProgram(f);return!this.ctx.getProgramParameter(f, +this.ctx.LINK_STATUS)?(a=this.ctx.getProgramInfoLog(f),window.console.log("Error in program linking:"+a),this.ctx.deleteProgram(f),this.ctx.deleteProgram(l),this.ctx.deleteProgram(h),null):f};this.setLightContext=function(a){for(t in this.technique)for(var f=this.technique.passes.length,g=0;g