aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge
diff options
context:
space:
mode:
authorhwc4872012-06-28 11:44:15 -0700
committerhwc4872012-06-28 11:44:15 -0700
commit22cbc9644b79df60b3f6336f9563debd47fb3ea1 (patch)
treef32687a920a039e0f048fab74627e0dc4ad6a8f1 /js/lib/rdge
parent2ebf3e3ea24d0d580575dfa13d31588dac1de445 (diff)
downloadninja-22cbc9644b79df60b3f6336f9563debd47fb3ea1.tar.gz
Added capability to split a mesh into multiiple parts to avoid buffer overflow situations.
Diffstat (limited to 'js/lib/rdge')
-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
23 files changed, 312 insertions, 12 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js
index 99a80da2..ea3322cf 100755
--- a/js/lib/rdge/materials/bump-metal-material.js
+++ b/js/lib/rdge/materials/bump-metal-material.js
@@ -20,6 +20,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
20 this._shaderName = "bumpMetal"; 20 this._shaderName = "bumpMetal";
21 21
22 22
23 this._defaultLightDiff = [0.3, 0.3, 0.3, 1.0];
23 this._defaultDiffuseTexture = "assets/images/metal.png"; 24 this._defaultDiffuseTexture = "assets/images/metal.png";
24 this._defaultSpecularTexture = "assets/images/silver.png"; 25 this._defaultSpecularTexture = "assets/images/silver.png";
25 this._defaultNormalTexture = "assets/images/normalMap.png"; 26 this._defaultNormalTexture = "assets/images/normalMap.png";
@@ -43,7 +44,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
43 this._propTypes = ["color", "file", "file", "file" ]; 44 this._propTypes = ["color", "file", "file", "file" ];
44 this._propValues = []; 45 this._propValues = [];
45 46
46 this._propValues[ this._propNames[0] ] = [0.3, 0.3, 0.3, 1.0]; 47 this._propValues[ this._propNames[0] ] = this._defaultLightDiff;
47 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0); 48 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0);
48 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0); 49 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0);
49 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); 50 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
@@ -72,8 +73,19 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
72 this.setShaderValues(); 73 this.setShaderValues();
73 this.update(0); 74 this.update(0);
74 }; 75 };
76
77 this.resetToDefault = function()
78 {
79 this._propValues[ this._propNames[0] ] = this._defaultLightDiff;
80 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0);
81 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0);
82 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
83 for (var i=0; i<4; i++)
84 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
85 };
75}; 86};
76 87
88
77/////////////////////////////////////////////////////////////////////////////////////// 89///////////////////////////////////////////////////////////////////////////////////////
78// RDGE shader 90// RDGE shader
79 91
diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js
index 4354408d..c2275b24 100644
--- a/js/lib/rdge/materials/deform-material.js
+++ b/js/lib/rdge/materials/deform-material.js
@@ -74,6 +74,16 @@ var DeformMaterial = function DeformMaterial() {
74 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); 74 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);
75 this.update(0); 75 this.update(0);
76 }; 76 };
77
78 this.resetToDefault = function()
79 {
80 this._propValues[this._propNames[0]] = this._defaultTexMap.slice(0);
81 this._propValues[this._propNames[1]] = 1.0;
82
83 var nProps = this._propNames.length;
84 for (var i=0; i<nProps; i++)
85 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
86 };
77}; 87};
78 88
79/////////////////////////////////////////////////////////////////////////////////////// 89///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/flag-material.js b/js/lib/rdge/materials/flag-material.js
index 7e3c17f9..d0a22454 100644
--- a/js/lib/rdge/materials/flag-material.js
+++ b/js/lib/rdge/materials/flag-material.js
@@ -78,6 +78,18 @@ var FlagMaterial = function FlagMaterial() {
78 this.setShaderValues(); 78 this.setShaderValues();
79 this.update( 0 ); 79 this.update( 0 );
80 } 80 }
81
82 this.resetToDefault = function()
83 {
84 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
85 this._propValues[ this._propNames[1] ] = this._waveWidth;
86 this._propValues[ this._propNames[2] ] = this._waveHeight;
87 this._propValues[ this._propNames[3] ] = this._speed;
88
89 var nProps = this._propNames.length;
90 for (var i=0; i<nProps; i++)
91 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
92 };
81}; 93};
82 94
83/////////////////////////////////////////////////////////////////////////////////////// 95///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js
index 4e8bd9b5..b6cf2ba1 100644
--- a/js/lib/rdge/materials/fly-material.js
+++ b/js/lib/rdge/materials/fly-material.js
@@ -69,6 +69,16 @@ var FlyMaterial = function FlyMaterial() {
69 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 69 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
70 this.update( 0 ); 70 this.update( 0 );
71 }; 71 };
72
73 this.resetToDefault = function()
74 {
75 this._propValues[this._propNames[u_tex0_index]] = this._defaultTexMap.slice(0);
76 this._propValues[this._propNames[u_speed_index]] = 1.0;
77
78 var nProps = this._propNames.length;
79 for (var i=0; i<nProps; i++)
80 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
81 };
72}; 82};
73 83
74/////////////////////////////////////////////////////////////////////////////////////// 84///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js
index d89fa594..e4b5c4a4 100644
--- a/js/lib/rdge/materials/julia-material.js
+++ b/js/lib/rdge/materials/julia-material.js
@@ -62,6 +62,15 @@ var JuliaMaterial = function JuliaMaterial() {
62 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 62 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
63 this.update( 0 ); 63 this.update( 0 );
64 }; 64 };
65
66 this.resetToDefault = function()
67 {
68 this._propValues[this._propNames[u_speed_index]] = 1.0;
69
70 var nProps = this._propNames.length;
71 for (var i=0; i<nProps; i++)
72 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
73 };
65} 74}
66 75
67/////////////////////////////////////////////////////////////////////////////////////// 76///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js
index b16d9022..533aaee7 100644
--- a/js/lib/rdge/materials/keleidoscope-material.js
+++ b/js/lib/rdge/materials/keleidoscope-material.js
@@ -72,6 +72,16 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() {
72 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 72 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
73 this.update( 0 ); 73 this.update( 0 );
74 }; 74 };
75
76 this.resetToDefault = function()
77 {
78 this._propValues[this._propNames[u_tex0_index]] = this._defaultTexMap.slice(0);
79 this._propValues[this._propNames[u_speed_index]] = 1.0;
80
81 var nProps = this._propNames.length;
82 for (var i=0; i<nProps; i++)
83 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
84 };
75}; 85};
76 86
77/////////////////////////////////////////////////////////////////////////////////////// 87///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index 7e53db84..f5c54726 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -79,6 +79,25 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
79 this.setShaderValues(); 79 this.setShaderValues();
80 this.update( 0 ); 80 this.update( 0 );
81 }; 81 };
82
83 this.resetToDefault = function()
84 {
85 this._propValues[this._propNames[0]] = this._color1.slice(0);
86 this._propValues[this._propNames[1]] = this._color2.slice(0);
87 this._propValues[this._propNames[2]] = this._color3.slice(0);
88 this._propValues[this._propNames[3]] = this._color4.slice(0);
89
90 this._propValues[this._propNames[4]] = this._colorStop1;
91 this._propValues[this._propNames[5]] = this._colorStop2;
92 this._propValues[this._propNames[6]] = this._colorStop3;
93 this._propValues[this._propNames[7]] = this._colorStop4;
94
95 this._propValues[this._propNames[8]] = [ Math.cos(this._angle), Math.sin(this._angle) ];
96
97 var nProps = this._propNames.length;