aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/shaders/Basic.frag.glsl17
-rw-r--r--assets/shaders/Taper.vert.glsl61
-rw-r--r--js/helper-classes/3D/snap-manager.js11
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js8
-rw-r--r--js/helper-classes/RDGE/GLWorld.js32
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js41
-rw-r--r--js/helper-classes/RDGE/src/core/script/engine.js18
-rw-r--r--js/helper-classes/RDGE/src/core/script/jshader.js6
-rw-r--r--js/helper-classes/RDGE/src/core/script/runtime.js4
9 files changed, 146 insertions, 52 deletions
diff --git a/assets/shaders/Basic.frag.glsl b/assets/shaders/Basic.frag.glsl
new file mode 100644
index 00000000..a2c21afa
--- /dev/null
+++ b/assets/shaders/Basic.frag.glsl
@@ -0,0 +1,17 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7
8#ifdef GL_ES
9precision highp float;
10#endif
11
12
13uniform vec4 color;
14
15void main() {
16 gl_FragColor = color;
17}
diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl
new file mode 100644
index 00000000..46f04fb3
--- /dev/null
+++ b/assets/shaders/Taper.vert.glsl
@@ -0,0 +1,61 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7
8#ifdef GL_ES
9precision highp float;
10#endif
11
12
13// attributes
14attribute vec3 vert;
15attribute vec3 normal;
16attribute vec2 texcoord;
17
18// scalar uniforms
19uniform float u_limit1;
20uniform float u_limit2;
21uniform float u_limit3;
22uniform float u_taperAmount;
23
24uniform vec4 color;
25
26
27// matrix uniforms
28uniform mat4 u_mvMatrix;
29uniform mat4 u_projMatrix;
30uniform mat4 u_worldMatrix;
31
32varying vec4 v_color;
33
34
35void main(void)
36{
37 vec3 pos = vert;
38 vec2 uv = texcoord;
39
40 v_color = vec4(0, 1, 0, 1);
41 if (uv.x > u_limit1)
42 {
43 if (uv.x < u_limit2)
44 {
45 float t = (uv.x - u_limit1)/(u_limit2 - u_limit1);
46 pos.y = pos.y - t*u_taperAmount;
47 v_color = vec4( 1, 1, 0, 1 );
48 }
49 else if (uv.x < u_limit3)
50 {
51 float t = 1.0 - (uv.x - u_limit2)/(u_limit3 - u_limit2);
52 pos.y = pos.y - t*u_taperAmount;
53 v_color = vec4( 0, 1, 1, 1 );
54 }
55 else
56 v_color = vec4(0,0,1,1);
57 }
58
59
60 gl_Position = u_projMatrix * u_mvMatrix * vec4(pos,1.0) ;
61} \ No newline at end of file
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 3ed96082..8819f637 100644
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -1780,7 +1780,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1780 var mergedSnap = this.mergeHitRecords( hitRecs ); 1780 var mergedSnap = this.mergeHitRecords( hitRecs );
1781 if (mergedSnap) 1781 if (mergedSnap)
1782 { 1782 {
1783 while (hitRecs.length > 0) hitRecs.pop(); 1783 while (hitRecs.length > 0) hitRecs.pop();
1784 hitRecs.push( mergedSnap ); 1784 hitRecs.push( mergedSnap );
1785 //console.log( "merged snaps" ); 1785 //console.log( "merged snaps" );
1786 } 1786 }
@@ -1836,6 +1836,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1836 hSnap.setLocalPoint( localPt ); 1836 hSnap.setLocalPoint( localPt );
1837 hSnap.setScreenPoint( scrPt ); 1837 hSnap.setScreenPoint( scrPt );
1838 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1838 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1839 hSnap.setElement( stage );
1840 hSnap.setPlane( [0,0,1,0] );
1841 hSnap.setPlaneMatrix( Matrix.I(4) );
1839 if (vSnap.hasAssociatedScreenPoint() ) 1842 if (vSnap.hasAssociatedScreenPoint() )
1840 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1843 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1841 if (vSnap.hasAssociatedScreenPoint2() ) 1844 if (vSnap.hasAssociatedScreenPoint2() )
@@ -1882,6 +1885,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1882 hSnap.setLocalPoint( localPt ); 1885 hSnap.setLocalPoint( localPt );
1883 hSnap.setScreenPoint( scrPt ); 1886 hSnap.setScreenPoint( scrPt );
1884 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1887 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1888 hSnap.setElement( stage );
1889 hSnap.setPlane( [0,0,1,0] );
1890 hSnap.setPlaneMatrix( Matrix.I(4) );
1885 if (vSnap.hasAssociatedScreenPoint() ) 1891 if (vSnap.hasAssociatedScreenPoint() )
1886 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1892 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1887 if (vSnap.hasAssociatedScreenPoint2() ) 1893 if (vSnap.hasAssociatedScreenPoint2() )
@@ -1934,6 +1940,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1934 hSnap.setLocalPoint( localPt ); 1940 hSnap.setLocalPoint( localPt );
1935 hSnap.setScreenPoint( scrPt ); 1941 hSnap.setScreenPoint( scrPt );
1936 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1942 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1943 hSnap.setElement( stage );
1944 hSnap.setPlane( [0,0,1,0] );
1945 hSnap.setPlaneMatrix( Matrix.I(4) );
1937 if (vSnap.hasAssociatedScreenPoint() ) 1946 if (vSnap.hasAssociatedScreenPoint() )
1938 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1947 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1939 if (vSnap.hasAssociatedScreenPoint2() ) 1948 if (vSnap.hasAssociatedScreenPoint2() )
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<