aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/shaders/Flag.vert.glsl3
-rw-r--r--assets/shaders/Pulse.frag.glsl1
-rwxr-xr-xassets/shaders/test_fshader_full.glsl2
-rwxr-xr-xjs/lib/drawing/world.js21
-rwxr-xr-xjs/lib/geom/circle.js1600
-rwxr-xr-xjs/lib/geom/line.js46
-rwxr-xr-xjs/lib/geom/rectangle.js284
-rw-r--r--js/lib/geom/shape-primitive.js181
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js14
-rw-r--r--js/lib/rdge/materials/deform-material.js10
-rw-r--r--js/lib/rdge/materials/flag-material.js12
-rw-r--r--js/lib/rdge/materials/fly-material.js10
-rw-r--r--js/lib/rdge/materials/julia-material.js9
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js10
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js19
-rw-r--r--js/lib/rdge/materials/mandel-material.js9
-rwxr-xr-xjs/lib/rdge/materials/material.js14
-rw-r--r--js/lib/rdge/materials/plasma-material.js12
-rw-r--r--js/lib/rdge/materials/pulse-material.js12
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js10
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js50
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js10
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js10
-rw-r--r--js/lib/rdge/materials/star-material.js10
-rw-r--r--js/lib/rdge/materials/taper-material.js29
-rw-r--r--js/lib/rdge/materials/tunnel-material.js10
-rw-r--r--js/lib/rdge/materials/twist-material.js10
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js14
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js17
-rw-r--r--js/lib/rdge/materials/water-material.js13
-rw-r--r--js/lib/rdge/materials/z-invert-material.js10
31 files changed, 1560 insertions, 902 deletions
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl
index 1c842cb0..8ba00922 100644
--- a/assets/shaders/Flag.vert.glsl
+++ b/assets/shaders/Flag.vert.glsl
@@ -35,7 +35,8 @@ void main()
35 const float pi = 3.14159; 35 const float pi = 3.14159;
36 float angle = time; 36 float angle = time;
37 37
38 v_uv = texcoord; 38 v_uv.x = texcoord.x;
39 v_uv.y = texcoord.y;
39 40
40 float x = 2.0*pi*texcoord.x/u_waveWidth; 41 float x = 2.0*pi*texcoord.x/u_waveWidth;
41 float y = 2.0*pi*texcoord.y; 42 float y = 2.0*pi*texcoord.y;
diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl
index 9aeb05c9..b717d359 100644
--- a/assets/shaders/Pulse.frag.glsl
+++ b/assets/shaders/Pulse.frag.glsl
@@ -22,6 +22,7 @@ void main(void)
22 float cLength = length(cPos); 22 float cLength = length(cPos);
23 23
24 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0; 24 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0;
25 uv.y = 1.0 - uv.y;
25 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; 26 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength;
26 27
27 gl_FragColor = vec4(col,1.0); 28 gl_FragColor = vec4(col,1.0);
diff --git a/assets/shaders/test_fshader_full.glsl b/assets/shaders/test_fshader_full.glsl
index ef721b39..0ea3cf1b 100755
--- a/assets/shaders/test_fshader_full.glsl
+++ b/assets/shaders/test_fshader_full.glsl
@@ -38,7 +38,7 @@ varying vec3 vEyePos;
38 38
39void main() 39void main()
40{ 40{
41 vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); 41 vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, 1.0 - vECPos.w)).rgb, 1.0);
42 42
43 // normal mapping 43 // normal mapping
44 vec3 normal = normalize(vNormal.xyz); 44 vec3 normal = normalize(vNormal.xyz);
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 8068284e..39f97134 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -442,6 +442,7 @@ World.prototype.updateObject = function (obj) {
442 if (prims.length != materialNodes.length) 442 if (prims.length != materialNodes.length)
443 throw new Error("inconsistent material and primitive counts"); 443 throw new Error("inconsistent material and primitive counts");
444 var nPrims = prims.length; 444 var nPrims = prims.length;
445 var iPrim = 0;
445 var ctrTrNode; 446 var ctrTrNode;
446 if (nPrims > 0) 447 if (nPrims > 0)
447 { 448 {
@@ -459,8 +460,12 @@ World.prototype.updateObject = function (obj) {
459 ); 460 );
460 ctrTrNode.meshes = []; 461 ctrTrNode.meshes = [];
461 462
462 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]);
463 ctrTrNode.attachMaterial(materialNodes[0]); 463 ctrTrNode.attachMaterial(materialNodes[0]);
464 while ((iPrim < nPrims) && (materialNodes[iPrim] == materialNodes[0]))
465 {
466 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[iPrim]);
467 iPrim++;
468 }
464 } 469 }
465 470
466 // delete all of the child nodes 471 // delete all of the child nodes
@@ -481,16 +486,18 @@ World.prototype.updateObject = function (obj) {
481 } 486 }
482 ctrTrNode.children = []; 487 ctrTrNode.children = [];
483 488
484 for (var i = 1; i < nPrims; i++) 489 while (iPrim < nPrims)
485 { 490 {
486 // get the next primitive
487 childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++); 491 childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++);
488 ctrTrNode.insertAsChild(childTrNode); 492 ctrTrNode.insertAsChild(childTrNode);
493 var matNode = materialNodes[iPrim];
494 childTrNode.attachMaterial(matNode);
489 495
490 // attach the instanced box goe 496 while ((iPrim < nPrims) && (materialNodes[iPrim] == matNode))
491 var prim = prims[i]; 497 {
492 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim); 498 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[iPrim]);
493 childTrNode.attachMaterial(materialNodes[i]); 499 iPrim++;
500 }
494 } 501 }
495 502
496 // send a notification that the tree has changed 503 // send a notification that the tree has changed
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 086c1058..374dda58 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -18,173 +18,173 @@ var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
18/////////////////////////////////////////////////////////////////////// 18///////////////////////////////////////////////////////////////////////
19exports.Circle = Object.create(GeomObj, { 19exports.Circle = Object.create(GeomObj, {
20 20
21 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
22 // Instance variables 22 // Instance variables
23 /////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////
24 _width: { value : 2.0, writable: true }, 24 _width: { value : 2.0, writable: true },
25 _height: { value : 2.0, writable: true }, 25 _height: { value : 2.0, writable: true },
26 _xOffset: { value : 0, writable: true }, 26 _xOffset: { value : 0, writable: true },
27 _yOffset: { value : 0, writable: true }, 27 _yOffset: { value : 0, writable: true },
28 28
29 _radius: { value : 2.0, writable: true }, 29 _radius: { value : 2.0, writable: true },
30 _strokeWidth: { value : 0.25, writable: true }, 30 _strokeWidth: { value : 0.25, writable: true },
31 _innerRadius: { value : 0, writable: true }, 31 _innerRadius: { value : 0, writable: true },
32 _ovalHeight: { value : 4.0, writable: true }, 32 _ovalHeight: { value : 4.0, writable: true },
33 _strokeStyle: { value : "Solid", writable: true }, 33 _strokeStyle: { value : "Solid", writable: true },
34 _aspectRatio: { value : 1.0, writable: true }, 34 _aspectRatio: { value : 1.0, writable: true },
35 35
36 init: { 36 init: {
37 value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) { 37 value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) {
38 if(arguments.length > 0) { 38 if(arguments.length > 0) {
39 this._width = width; 39 this._width = width;
40 this._height = height; 40 this._height = height;
41 this._xOffset = xOffset; 41 this._xOffset = xOffset;
42 this._yOffset = yOffset; 42 this._yOffset = yOffset;
43 this._ovalHeight = 2.0 * this._radius; 43 this._ovalHeight = 2.0 * this._radius;
44 44
45 this._strokeWidth = strokeSize; 45 this._strokeWidth = strokeSize;
46 this._innerRadius = innerRadius; 46 this._innerRadius = innerRadius;
47 this._strokeColor = strokeColor; 47 this._strokeColor = strokeColor;
48 this._fillColor = fillColor; 48 this._fillColor = fillColor;
49 49
50 this._strokeStyle = strokeStyle; 50 this._strokeStyle = strokeStyle;
51 51
52 this._matrix = Matrix.I(4); 52 this._matrix = Matrix.I(4);
53 //this._matrix[12] = xOffset; 53 //this._matrix[12] = xOffset;
54 //this._matrix[13] = yOffset; 54 //this._matrix[13] = yOffset;
55 } 55 }
56 56
57 this.m_world = world; 57 this.m_world = world;
58 58
59 if(strokeMaterial) { 59 if(strokeMaterial) {
60 this._strokeMaterial = strokeMaterial.dup(); 60 this._strokeMaterial = strokeMaterial.dup();
61 } else { 61 } else {
62 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); 62 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
63 } 63 }
64 if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor ); 64 if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor );
65 65
66 if(fillMaterial) { 66 if(fillMaterial) {
67 this._fillMaterial = fillMaterial.dup(); 67 this._fillMaterial = fillMaterial.dup();