aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge')
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js4
-rw-r--r--js/lib/rdge/materials/deform-material.js2
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js41
-rw-r--r--js/lib/rdge/materials/fly-material.js2
-rw-r--r--js/lib/rdge/materials/julia-material.js2
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js2
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js2
-rw-r--r--js/lib/rdge/materials/mandel-material.js2
-rw-r--r--js/lib/rdge/materials/plasma-material.js7
-rw-r--r--js/lib/rdge/materials/pulse-material.js7
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js2
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js7
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js2
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js2
-rw-r--r--js/lib/rdge/materials/star-material.js2
-rw-r--r--js/lib/rdge/materials/taper-material.js6
-rw-r--r--js/lib/rdge/materials/tunnel-material.js2
-rw-r--r--js/lib/rdge/materials/twist-material.js2
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js6
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js71
-rw-r--r--js/lib/rdge/materials/water-material.js2
-rw-r--r--js/lib/rdge/materials/z-invert-material.js2
-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.js630
-rw-r--r--js/lib/rdge/runtime/RuntimeMaterial.js317
26 files changed, 1520 insertions, 44 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js
index 61126952..67b16371 100755
--- a/js/lib/rdge/materials/bump-metal-material.js
+++ b/js/lib/rdge/materials/bump-metal-material.js
@@ -75,7 +75,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
75 this.setProperty = function( prop, value ) 75 this.setProperty = function( prop, value )
76 { 76 {
77 // every material should do something with the "color" property 77 // every material should do something with the "color" property
78 if (prop === "color") prop = "lightDiff"; 78 if (prop === "color") return;
79 79
80 // make sure we have legitimate imput 80 // make sure we have legitimate imput
81 var ok = this.validateProperty( prop, value ); 81 var ok = this.validateProperty( prop, value );
@@ -116,7 +116,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
116 this._shader['default'].u_light0Diff.set( this.getLightDiff() ); 116 this._shader['default'].u_light0Diff.set( this.getLightDiff() );
117 117
118 // set up the material node 118 // set up the material node
119 this._materialNode = createMaterialNode( this.getShaderName() ); 119 this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() );
120 this._materialNode.setShader(this._shader); 120 this._materialNode.setShader(this._shader);
121 121
122 // set some image maps 122 // set some image maps
diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js
index 1e6af6ac..dfd89d12 100644
--- a/js/lib/rdge/materials/deform-material.js
+++ b/js/lib/rdge/materials/deform-material.js
@@ -60,7 +60,7 @@ var DeformMaterial = function DeformMaterial() {
60 this._shader.init(); 60 this._shader.init();
61 61
62 // set up the material node 62 // set up the material node
63 this._materialNode = createMaterialNode("deformMaterial"); 63 this._materialNode = createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID());
64 this._materialNode.setShader(this._shader); 64 this._materialNode.setShader(this._shader);
65 65
66 this._time = 0; 66 this._time = 0;
diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js
index be8bf2b8..97e4f646 100755
--- a/js/lib/rdge/materials/flat-material.js
+++ b/js/lib/rdge/materials/flat-material.js
@@ -36,19 +36,27 @@ var FlatMaterial = function FlatMaterial() {
36 // duplcate method requirde 36 // duplcate method requirde
37 this.dup = function() { return new FlatMaterial(); } ; 37 this.dup = function() { return new FlatMaterial(); } ;
38 38
39 this.init = function() 39 this.init = function( world )
40 { 40 {
41 // set up the shader 41 // save the world
42 this._shader = new jshader(); 42 if (world)
43 this._shader.def = flatShaderDef; 43 {
44 this._shader.init(); 44 this.setWorld( world );
45 45
46 // set the defaults 46 // set up the shader
47 this._shader.colorMe.color.set( this.getColor() ); 47 this._shader = new jshader();
48 48 this._shader.def = flatShaderDef;
49 // set up the material node 49 this._shader.init();
50 this._materialNode = createMaterialNode("flatMaterial"); 50
51 this._materialNode.setShader(this._shader); 51 // set the defaults
52 this._shader.colorMe.color.set( this.getColor() );
53
54 // set up the material node
55 this._materialNode = createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() );
56 this._materialNode.setShader(this._shader);
57 }
58 else
59 throw new Error( "GLWorld not supplied to material initialization" );
52 }; 60 };
53 61
54 62
@@ -73,15 +81,12 @@ var FlatMaterial = function FlatMaterial() {
73 }; 81 };
74 /////////////////////////////////////////////////////////////////////// 82 ///////////////////////////////////////////////////////////////////////
75 83
76 this.export = function() { 84 this.export = function()
85 {
77 // this function should be overridden by subclasses 86 // this function should be overridden by subclasses
78 var exportStr = "material: " + this.getShaderName() + "\n"; 87 var exportStr = "material: " + this.getShaderName() + "\n";
79 exportStr += "name: " + this.getName() + "\n"; 88 exportStr += "name: " + this.getName() + "\n";
80 89 exportStr += "color: " + String(this._propValues["color"]) + "\n";
81 if (this._shader)
82 exportStr += "color: " + String(this._shader.colorMe.color) + "\n";
83 else
84 exportStr += "color: " + this.getColor() + "\n";
85 exportStr += "endMaterial\n"; 90 exportStr += "endMaterial\n";
86 91
87 return exportStr; 92 return exportStr;
diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js
index 8eadb3ab..bd92ecd8 100644
--- a/js/lib/rdge/materials/fly-material.js
+++ b/js/lib/rdge/materials/fly-material.js
@@ -53,7 +53,7 @@ var FlyMaterial = function FlyMaterial() {
53 this._shader.init(); 53 this._shader.init();
54 54
55 // set up the material node 55 // set up the material node
56 this._materialNode = createMaterialNode("flyMaterial"); 56 this._materialNode = createMaterialNode("flyMaterial" + "_" + world.generateUniqueNodeID());
57 this._materialNode.setShader(this._shader); 57 this._materialNode.setShader(this._shader);
58 58
59 this._time = 0; 59 this._time = 0;
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js
index 07536f33..976dfad3 100644
--- a/js/lib/rdge/materials/julia-material.js
+++ b/js/lib/rdge/materials/julia-material.js
@@ -55,7 +55,7 @@ var JuliaMaterial = function JuliaMaterial() {
55 this._shader.init(); 55 this._shader.init();
56 56
57 // set up the material node 57 // set up the material node
58 this._materialNode = createMaterialNode("juliaMaterial"); 58 this._materialNode = createMaterialNode("juliaMaterial" + "_" + world.generateUniqueNodeID());
59 this._materialNode.setShader(this._shader); 59 this._materialNode.setShader(this._shader);
60 60
61 this._time = 0; 61 this._time = 0;
diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js
index 3ef5d613..16d1ccfa 100644
--- a/js/lib/rdge/materials/keleidoscope-material.js
+++ b/js/lib/rdge/materials/keleidoscope-material.js
@@ -60,7 +60,7 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() {
60 this._shader.init(); 60 this._shader.init();
61 61
62 // set up the material node 62 // set up the material node
63 this._materialNode = createMaterialNode("keleidoscopeMaterial"); 63 this._materialNode = createMaterialNode("keleidoscopeMaterial" + "_" + world.generateUniqueNodeID());
64 this._materialNode.setShader(this._shader); 64 this._materialNode.setShader(this._shader);
65 65
66 this._time = 0; 66 this._time = 0;
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index 2c52c67d..8e05e23d 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -212,7 +212,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
212 this._shader.init(); 212 this._shader.init();
213 213
214 // set up the material node 214 // set up the material node
215 this._materialNode = createMaterialNode( this.getShaderName() ); 215 this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() );
216 this._materialNode.setShader(this._shader); 216 this._materialNode.setShader(this._shader);
217 217
218 // send the current values to the shader 218 // send the current values to the shader
diff --git a/js/lib/rdge/materials/mandel-material.js b/js/lib/rdge/materials/mandel-material.js
index 07e009a2..d9f00383 100644
--- a/js/lib/rdge/materials/mandel-material.js
+++ b/js/lib/rdge/materials/mandel-material.js
@@ -66,7 +66,7 @@ var MandelMaterial = function MandelMaterial() {
66 this._shader.init(); 66 this._shader.init();
67 67
68 // set up the material node 68 // set up the material node
69 this._materialNode = createMaterialNode("mandelMaterial"); 69 this._materialNode = createMaterialNode("mandelMaterial" + "_" + world.generateUniqueNodeID());
70 this._materialNode.setShader(this._shader); 70 this._materialNode.setShader(this._shader);
71 71
72 this._time = 0; 72 this._time = 0;
diff --git a/js/lib/rdge/materials/plasma-material.js b/js/lib/rdge/materials/plasma-material.js
index 9ecc2b48..62d0db70 100644
--- a/js/lib/rdge/materials/plasma-material.js
+++ b/js/lib/rdge/materials/plasma-material.js
@@ -54,7 +54,10 @@ var PlasmaMaterial = function PlasmaMaterial() {
54 return new PlasmaMaterial(); 54 return new PlasmaMaterial();
55 }; 55 };
56 56