aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/radial-blur-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/radial-blur-material.js')
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js94
1 files changed, 52 insertions, 42 deletions
diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js
index 4a32cacd..c1a6fe2e 100644
--- a/js/lib/rdge/materials/radial-blur-material.js
+++ b/js/lib/rdge/materials/radial-blur-material.js
@@ -49,17 +49,17 @@ var RadialBlurMaterial = function RadialBlurMaterial() {
49 /////////////////////////////////////////////////////////////////////// 49 ///////////////////////////////////////////////////////////////////////
50 // Property Accessors 50 // Property Accessors
51 /////////////////////////////////////////////////////////////////////// 51 ///////////////////////////////////////////////////////////////////////
52 this.getName = function () { return this._name; }; 52 this.getName = function () { return this._name; };
53 this.getShaderName = function () { return this._shaderName; }; 53 this.getShaderName = function () { return this._shaderName; };
54 this.getShaderDef = function() { return radialBlurMaterialDef; }; 54 this.getShaderDef = function() { return radialBlurMaterialDef; };
55 this.isAnimated = function () { return true; }; 55 this.isAnimated = function () { return true; };
56 56
57 /////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////
58 // Material Property Accessors 58 // Material Property Accessors
59 /////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////
60 this._propNames = ["u_tex0", "u_speed"]; 60 this._propNames = ["u_tex0", "u_speed"];
61 this._propLabels = ["Texture map", "Speed" ]; 61 this._propLabels = ["Texture map", "Speed" ];
62 this._propTypes = ["file", "float" ]; 62 this._propTypes = ["file", "float" ];
63 this._propValues = []; 63 this._propValues = [];
64 64
65 this._propValues[this._propNames[0]] = this._defaultTexMap.slice(0); 65 this._propValues[this._propNames[0]] = this._defaultTexMap.slice(0);
@@ -93,6 +93,16 @@ var RadialBlurMaterial = function RadialBlurMaterial() {
93 this.update(0); 93 this.update(0);
94 }; 94 };
95 95
96 this.resetToDefault = function()
97 {
98 this._propValues[this._propNames[0]] = this._defaultTexMap.slice(0);
99 this._propValues[this._propNames[1]] = 1.0;
100
101 var nProps = this._propNames.length;
102 for (var i=0; i<nProps; i++)
103 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
104 };
105
96 106
97 this.update = function () { 107 this.update = function () {
98 var material = this._materialNode; 108 var material = this._materialNode;
@@ -126,42 +136,42 @@ var RadialBlurMaterial = function RadialBlurMaterial() {
126// shader spec (can also be loaded from a .JSON file, or constructed at runtime) 136// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
127var radialBlurMaterialDef = 137var radialBlurMaterialDef =
128{ 'shaders': 138{ 'shaders':
129 { 139 {
130 'defaultVShader': "assets/shaders/Basic.vert.glsl", 140 'defaultVShader': "assets/shaders/Basic.vert.glsl",
131 'defaultFShader': "assets/shaders/radialBlur.frag.glsl" 141 'defaultFShader': "assets/shaders/radialBlur.frag.glsl"
132 }, 142 },
133 'techniques': 143 'techniques':
134 { 144 {
135 'default': 145 'default':
136 [ 146 [
137 { 147 {
138 'vshader': 'defaultVShader', 148 'vshader': 'defaultVShader',
139 'fshader': 'defaultFShader', 149 'fshader': 'defaultFShader',
140 // attributes 150 // attributes
141 'attributes': 151 'attributes':
142 { 152 {
143 'vert': { 'type': 'vec3' }, 153 'vert': { 'type': 'vec3' },
144 'normal': { 'type': 'vec3' }, 154 'normal': { 'type': 'vec3' },
145 'texcoord': { 'type': 'vec2' } 155 'texcoord': { 'type': 'vec2' }
146 }, 156 },
147 // parameters 157 // parameters
148 'params': 158 'params':
149 { 159 {
150 'u_tex0': { 'type': 'tex2d' }, 160 'u_tex0': { 'type': 'tex2d' },
151 'u_time': { 'type': 'float' }, 161 'u_time': { 'type': 'float' },
152 'u_speed': { 'type': 'float' }, 162 'u_speed': { 'type': 'float' },
153 'u_resolution': { 'type': 'vec2' }, 163 'u_resolution': { 'type': 'vec2' },
154 }, 164 },
155 165
156 // render states 166 // render states
157 'states': 167 'states':
158 { 168 {
159 'depthEnable': true, 169 'depthEnable': true,
160 'offset': [1.0, 0.1] 170 'offset': [1.0, 0.1]
161 } 171 }
162 } 172 }
163 ] 173 ]
164 } 174 }
165}; 175};
166 176
167 177