aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:16:17 -0700
committerValerio Virgillito2012-07-09 14:18:36 -0700
commit1bbba17e8605434356de0a477710d6a0136986fc (patch)
tree7cdc80226b776c6fb2250e250acdbcd53fdb1ddd /js/lib/rdge/materials
parentdc5b7a479a185dda8e9a09f4bbe26bd290641624 (diff)
parentab80aa9c7da912db384ec48c656f84fd673b5253 (diff)
downloadninja-1bbba17e8605434356de0a477710d6a0136986fc.tar.gz
Merge branch 'Taper' of https://github.com/ericmueller/ninja-internal
Conflicts: js/lib/geom/circle.js js/lib/rdge/materials/linear-gradient-material.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/lib/rdge/materials')
-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.js24
-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.js51
-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, 316 insertions, 14 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js
index 3db3df1d..97efe441 100755
--- a/js/lib/rdge/materials/bump-metal-material.js
+++ b/js/lib/rdge/materials/bump-metal-material.js
@@ -44,6 +44,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
44 this._shaderName = "bumpMetal"; 44 this._shaderName = "bumpMetal";
45 45
46 46
47 this._defaultLightDiff = [0.3, 0.3, 0.3, 1.0];
47 this._defaultDiffuseTexture = "assets/images/metal.png"; 48 this._defaultDiffuseTexture = "assets/images/metal.png";
48 this._defaultSpecularTexture = "assets/images/silver.png"; 49 this._defaultSpecularTexture = "assets/images/silver.png";
49 this._defaultNormalTexture = "assets/images/normalMap.png"; 50 this._defaultNormalTexture = "assets/images/normalMap.png";
@@ -67,7 +68,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
67 this._propTypes = ["color", "file", "file", "file" ]; 68 this._propTypes = ["color", "file", "file", "file" ];
68 this._propValues = []; 69 this._propValues = [];
69 70
70 this._propValues[ this._propNames[0] ] = [0.3, 0.3, 0.3, 1.0]; 71 this._propValues[ this._propNames[0] ] = this._defaultLightDiff;
71 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0); 72 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0);
72 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0); 73 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0);
73 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); 74 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
@@ -96,8 +97,19 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
96 this.setShaderValues(); 97 this.setShaderValues();
97 this.update(0); 98 this.update(0);
98 }; 99 };
100
101 this.resetToDefault = function()
102 {
103 this._propValues[ this._propNames[0] ] = this._defaultLightDiff;
104 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0);
105 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0);
106 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
107 for (var i=0; i<4; i++)
108 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
109 };
99}; 110};
100 111
112
101/////////////////////////////////////////////////////////////////////////////////////// 113///////////////////////////////////////////////////////////////////////////////////////
102// RDGE shader 114// RDGE shader
103 115
diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js
index 234f22e4..6145f1a6 100644
--- a/js/lib/rdge/materials/deform-material.js
+++ b/js/lib/rdge/materials/deform-material.js
@@ -98,6 +98,16 @@ var DeformMaterial = function DeformMaterial() {
98 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); 98 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);
99 this.update(0); 99 this.update(0);
100 }; 100 };
101
102 this.resetToDefault = function()
103 {
104 this._propValues[this._propNames[0]] = this._defaultTexMap.slice(0);
105 this._propValues[this._propNames[1]] = 1.0;
106
107 var nProps = this._propNames.length;
108 for (var i=0; i<nProps; i++)
109 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
110 };
101}; 111};
102 112
103/////////////////////////////////////////////////////////////////////////////////////// 113///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/flag-material.js b/js/lib/rdge/materials/flag-material.js
index b87013ba..eb5e59df 100644
--- a/js/lib/rdge/materials/flag-material.js
+++ b/js/lib/rdge/materials/flag-material.js
@@ -102,6 +102,18 @@ var FlagMaterial = function FlagMaterial() {
102 this.setShaderValues(); 102 this.setShaderValues();
103 this.update( 0 ); 103 this.update( 0 );
104 } 104 }
105
106 this.resetToDefault = function()
107 {
108 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
109 this._propValues[ this._propNames[1] ] = this._waveWidth;
110 this._propValues[ this._propNames[2] ] = this._waveHeight;
111 this._propValues[ this._propNames[3] ] = this._speed;
112
113 var nProps = this._propNames.length;
114 for (var i=0; i<nProps; i++)
115 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
116 };
105}; 117};
106 118
107/////////////////////////////////////////////////////////////////////////////////////// 119///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js
index b4bf0972..eabc32ea 100644
--- a/js/lib/rdge/materials/fly-material.js
+++ b/js/lib/rdge/materials/fly-material.js
@@ -93,6 +93,16 @@ var FlyMaterial = function FlyMaterial() {
93 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 93 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
94 this.update( 0 ); 94 this.update( 0 );
95 }; 95 };
96
97 this.resetToDefault = function()
98 {
99 this._propValues[this._propNames[u_tex0_index]] = this._defaultTexMap.slice(0);
100 this._propValues[this._propNames[u_speed_index]] = 1.0;
101
102 var nProps = this._propNames.length;
103 for (var i=0; i<nProps; i++)
104 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
105 };
96}; 106};
97 107
98/////////////////////////////////////////////////////////////////////////////////////// 108///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js
index eed9e79a..35ae980a 100644
--- a/js/lib/rdge/materials/julia-material.js
+++ b/js/lib/rdge/materials/julia-material.js
@@ -86,6 +86,15 @@ var JuliaMaterial = function JuliaMaterial() {
86 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 86 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
87 this.update( 0 ); 87 this.update( 0 );
88 }; 88 };
89
90 this.resetToDefault = function()
91 {
92 this._propValues[this._propNames[u_speed_index]] = 1.0;
93
94 var nProps = this._propNames.length;
95 for (var i=0; i<nProps; i++)
96 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
97 };
89} 98}
90 99
91/////////////////////////////////////////////////////////////////////////////////////// 100///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js
index 648bf401..8ad02963 100644
--- a/js/lib/rdge/materials/keleidoscope-material.js
+++ b/js/lib/rdge/materials/keleidoscope-material.js
@@ -96,6 +96,16 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() {
96 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 96 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
97 this.update( 0 ); 97 this.update( 0 );
98 }; 98 };
99
100 this.resetToDefault = function()
101 {
102 this._propValues[this._propNames[u_tex0_index]] = this._defaultTexMap.slice(0);
103 this._propValues[this._propNames[u_speed_index]] = 1.0;
104
105 var nProps = this._propNames.length;
106 for (var i=0; i<nProps; i++)
107 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
108 };
99}; 109};
100 110
101/////////////////////////////////////////////////////////////////////////////////////// 111///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index 50ef56f0..137ced27 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -26,7 +26,7 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29 </copyright> */
30 30
31var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser; 31var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser;
32var Material = require("js/lib/rdge/materials/material").Material; 32var Material = require("js/lib/rdge/materials/material").Material;
@@ -104,6 +104,26 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
104 this.update( 0 ); 104 this.update( 0 );
105 }; 105 };