diff options
Diffstat (limited to 'js/helper-classes/RDGE')
-rw-r--r-- | js/helper-classes/RDGE/GLRectangle.js | 8 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLWorld.js | 32 | ||||
-rw-r--r-- | js/helper-classes/RDGE/Materials/FlatMaterial.js | 41 | ||||
-rw-r--r-- | js/helper-classes/RDGE/src/core/script/engine.js | 18 | ||||
-rw-r--r-- | js/helper-classes/RDGE/src/core/script/jshader.js | 6 | ||||
-rw-r--r-- | js/helper-classes/RDGE/src/core/script/runtime.js | 4 |
6 files changed, 58 insertions, 51 deletions
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index bc3b1478..1bb4bcac 100644 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -279,10 +279,10 @@ function GLRectangle() | |||
279 | brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC; | 279 | brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC; |
280 | 280 | ||
281 | // stroke | 281 | // stroke |
282 | // var strokeMaterial = this.makeStrokeMaterial(); | 282 | var strokeMaterial = this.makeStrokeMaterial(); |
283 | // prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial) | 283 | prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial) |
284 | // this._primArray.push( prim ); | 284 | this._primArray.push( prim ); |
285 | // this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); | 285 | this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); |
286 | 286 | ||
287 | // fill | 287 | // fill |
288 | tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0; | 288 | tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0; |
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index b84bb585..0dc34034 100644 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js | |||
@@ -240,6 +240,7 @@ function GLWorld( canvas, use3D ) | |||
240 | if (renderer != aRenderer) console.log( "***** DIFFERENT RENDERERS *****" ); | 240 | if (renderer != aRenderer) console.log( "***** DIFFERENT RENDERERS *****" ); |
241 | renderer.disableCulling(); | 241 | renderer.disableCulling(); |
242 | this.myScene.render(); | 242 | this.myScene.render(); |
243 | console.log( "render" ); | ||
243 | 244 | ||
244 | if (this._firstRender) | 245 | if (this._firstRender) |
245 | { | 246 | { |
@@ -247,15 +248,15 @@ function GLWorld( canvas, use3D ) | |||
247 | 248 | ||
248 | if (!this.hasAnimatedMaterials()) | 249 | if (!this.hasAnimatedMaterials()) |
249 | { | 250 | { |
250 | this.myScene.render(); | 251 | //this.myScene.render(); |
251 | //this._canvas.task.stop(); | 252 | //this._canvas.task.stop(); |
252 | this._renderCount = 3; | 253 | this._renderCount = 10; |
253 | } | 254 | } |
254 | } | 255 | } |
255 | else if (this._renderCount >= 0) | 256 | else if (this._renderCount >= 0) |
256 | { | 257 | { |
257 | this._renderCount--; | 258 | this._renderCount--; |
258 | if (this._renderCount == 0) | 259 | if (this._renderCount <= 0) |
259 | this._canvas.task.stop(); | 260 | this._canvas.task.stop(); |
260 | } | 261 | } |
261 | 262 | ||
@@ -270,6 +271,7 @@ function GLWorld( canvas, use3D ) | |||
270 | this.onRunState = function() | 271 | this.onRunState = function() |
271 | { | 272 | { |
272 | console.log( "GLWorld.onRunState" ); | 273 | console.log( "GLWorld.onRunState" ); |
274 | this.restartRenderLoop(); | ||
273 | } | 275 | } |
274 | 276 | ||
275 | this.onLoadState = function() | 277 | this.onLoadState = function() |
@@ -387,16 +389,13 @@ function GLWorld( canvas, use3D ) | |||
387 | { | 389 | { |
388 | rdgeStarted = true; | 390 | rdgeStarted = true; |
389 | 391 | ||
390 | // TODO - temporary fix for RDGE id's | 392 | this._canvas.rdgeid = this._canvas.uuid; |
391 | this._canvas.id = this._canvas.uuid; | ||
392 | |||
393 | g_Engine.registerCanvas(this._canvas, this); | 393 | g_Engine.registerCanvas(this._canvas, this); |
394 | RDGEStart( this._canvas ); | 394 | RDGEStart( this._canvas ); |
395 | 395 | ||
396 | //this._canvas.fpsTracker = new fpsTracker( '0' ); | 396 | //this._canvas.fpsTracker = new fpsTracker( '0' ); |
397 | this._canvas.task = new RDGETask(this._canvas, false); | 397 | //this._canvas.task = new RDGETask(this._canvas, false); |
398 | this._canvas.task.stop() | 398 | this._canvas.task.stop() |
399 | //this._canvas.task.start() | ||
400 | } | 399 | } |
401 | } | 400 | } |
402 | 401 | ||
@@ -508,11 +507,16 @@ GLWorld.prototype.addObject = function( obj ) | |||
508 | 507 | ||
509 | GLWorld.prototype.restartRenderLoop = function() | 508 | GLWorld.prototype.restartRenderLoop = function() |
510 | { | 509 | { |
510 | console.log( "restartRenderLoop" ); | ||
511 | |||
511 | this._firstRender = true; | 512 | this._firstRender = true; |
512 | if (this._allMapsLoaded) | 513 | if (this._canvas.task) |
513 | this._canvas.task.start(); | 514 | { |
514 | else | 515 | if (this._allMapsLoaded) |
515 | this._canvas.task.stop(); | 516 | this._canvas.task.start(); |
517 | else | ||
518 | this._canvas.task.stop(); | ||
519 | } | ||
516 | } | 520 | } |
517 | 521 | ||
518 | //append to the list of objects if obj doesn't already exist | 522 | //append to the list of objects if obj doesn't already exist |
@@ -563,7 +567,7 @@ GLWorld.prototype.clearTree = function() | |||
563 | { | 567 | { |
564 | var root = this._rootNode; | 568 | var root = this._rootNode; |
565 | root.children = new Array(); | 569 | root.children = new Array(); |
566 | g_Engine.unregisterCanvas( this._canvas.id ) | 570 | g_Engine.unregisterCanvas( this._canvas.rdgeid ) |
567 | 571 | ||
568 | this.update( 0 ); | 572 | this.update( 0 ); |
569 | this.draw(); | 573 | this.draw(); |
@@ -805,7 +809,7 @@ GLWorld.prototype.getShapeFromPoint = function( offsetX, offsetY ) | |||
805 | GLWorld.prototype.export = function() | 809 | GLWorld.prototype.export = function() |
806 | { | 810 | { |
807 | var exportStr = "GLWorld 1.0\n"; | 811 | var exportStr = "GLWorld 1.0\n"; |
808 | exportStr += "id: " + this._canvas.id + "\n"; | 812 | exportStr += "id: " + this._canvas.rdgeid + "\n"; |
809 | exportStr += "fov: " + this._fov + "\n"; | 813 | exportStr += "fov: " + this._fov + "\n"; |
810 | exportStr += "zNear: " + this._zNear + "\n"; | 814 | exportStr += "zNear: " + this._zNear + "\n"; |
811 | exportStr += "zFar: " + this._zFar + "\n"; | 815 | exportStr += "zFar: " + this._zFar + "\n"; |
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js index f342eef8..3e3ae25e 100644 --- a/js/helper-classes/RDGE/Materials/FlatMaterial.js +++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js | |||
@@ -50,6 +50,12 @@ function FlatMaterial() | |||
50 | // set up the material node | 50 | // set up the material node |
51 | this._materialNode = createMaterialNode("flatMaterial"); | 51 | this._materialNode = createMaterialNode("flatMaterial"); |
52 | this._materialNode.setShader(this._shader); | 52 | this._materialNode.setShader(this._shader); |
53 | |||
54 | // initialize the taper properties | ||
55 | // this._shader.colorMe.u_limit1.set( [0.25] ); | ||
56 | // this._shader.colorMe.u_limit2.set( [0.5] ); | ||
57 | // this._shader.colorMe.u_limit3.set( [0.75] ); | ||
58 | // this._shader.colorMe.u_taperAmount.set( [0.5] ); | ||
53 | } | 59 | } |
54 | 60 | ||
55 | 61 | ||
@@ -102,10 +108,11 @@ function FlatMaterial() | |||
102 | var rtnStr = importStr.substr( index ); | 108 | var rtnStr = importStr.substr( index ); |
103 | return rtnStr; | 109 | return rtnStr; |
104 | } | 110 | } |
105 | } | ||
106 | 111 | ||
107 | // used to create unique names | 112 | this.update = function( time ) |
108 | var flatMaterialCounter = 0; | 113 | { |
114 | } | ||
115 | } | ||
109 | 116 | ||
110 | /////////////////////////////////////////////////////////////////////////////////////// | 117 | /////////////////////////////////////////////////////////////////////////////////////// |
111 | // RDGE shader | 118 | // RDGE shader |
@@ -114,35 +121,31 @@ var flatMaterialCounter = 0; | |||
114 | flatShaderDef = | 121 | flatShaderDef = |
115 | { | 122 | { |
116 | 'shaders': { // shader files | 123 | 'shaders': { // shader files |
117 | 'defaultVShader': "\ | 124 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", |
118 | uniform mat4 u_mvMatrix;\ | 125 | 'defaultFShader':"assets/shaders/Basic.frag.glsl", |
119 | uniform mat4 u_projMatrix;\ | ||
120 | attribute vec3 a_pos;\ | ||
121 | void main() {\ | ||
122 | gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ | ||
123 | }", | ||
124 | 'defaultFShader': "\ | ||
125 | precision highp float;\ | ||
126 | uniform vec4 color;\ | ||
127 | void main() {\ | ||
128 | gl_FragColor = color;\ | ||
129 | }", | ||
130 | }, | 126 | }, |
131 | 'techniques': { // rendering control | 127 | 'techniques': { // rendering control |
132 | 'colorMe':[ // simple color pass | 128 | 'colorMe':[ // simple color pass |
133 | { | 129 | { |
134 | 'vshader' : 'defaultVShader', | 130 | 'vshader' : 'defaultVShader', |
135 | 'fshader' : 'defaultFShader', | 131 | 'fshader' : 'defaultFShader', |
136 | 132 | ||
137 | // attributes | 133 | // attributes |
138 | 'attributes' : | 134 | 'attributes' : |
139 | { | 135 | { |
140 | 'a_pos' : { 'type' : 'vec3' } // only using position for this shader | 136 | 'vert' : { 'type' : 'vec3' }, |
137 | 'normal' : { 'type' : 'vec3' }, | ||
138 | 'texcoord' : { 'type' : 'vec2' }, | ||
141 | }, | 139 | }, |
142 | // attributes | 140 | // attributes |
143 | 'params' : | 141 | 'params' : |
144 | { | 142 | { |
145 | 'color' : { 'type' : 'vec4' } | 143 | 'color' : { 'type' : 'vec4' }, |
144 | |||
145 | //'u_limit1': { 'type': 'float' }, | ||
146 | //'u_limit2': { 'type': 'float' }, |