diff options
Diffstat (limited to 'js/lib/rdge')
23 files changed, 421 insertions, 13 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index fa830d3d..044dc59b 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 8f88b22e..274369d6 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 f0d9b84c..7ad8b6e9 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 13291e25..873f82ce 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 cf9176df..ccd2628d 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 8f235948..9d395370 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 da6d205c..e1d31a42 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; |
@@ -103,6 +103,76 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
103 | this.setShaderValues(); | 103 | this.setShaderValues(); |
104 | this.update( 0 ); | 104 | this.update( 0 ); |
105 | }; | 105 | }; |
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); | ||
< |