diff options
Diffstat (limited to 'js/lib/rdge/materials')
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 | |||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 29 | </copyright> */ |
30 | 30 | ||
31 | var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser; | 31 | var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser; |
32 | var Material = require("js/lib/rdge/materials/material").Material; | 32 | var 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 | }; |
106 | 106 | ||
107 | this.resetToDefault = function() | ||
108 | { | ||
109 | this._propValues[this._propNames[0]] = this._color1.slice(0); | ||
110 | this._propValues[this._propNames[1]] = this._color2.slice(0); | ||
111 | this._propValues[this._propNames[2]] = this._color3.slice(0); | ||
112 | this._propValues[this._propNames[3]] = this._color4.slice(0); | ||
113 | |||
114 | this._propValues[this._propNames[4]] = this._colorStop1; | ||
115 |