diff options
Diffstat (limited to 'js/lib/rdge/materials/z-invert-material.js')
-rw-r--r-- | js/lib/rdge/materials/z-invert-material.js | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js index 37e4d925..ead3bed2 100644 --- a/js/lib/rdge/materials/z-invert-material.js +++ b/js/lib/rdge/materials/z-invert-material.js | |||
@@ -47,24 +47,24 @@ var ZInvertMaterial = function ZInvertMaterial() { | |||
47 | // array textures indexed by shader uniform name | 47 | // array textures indexed by shader uniform name |
48 | this._glTextures = []; | 48 | this._glTextures = []; |
49 | 49 | ||
50 | this.isAnimated = function() { return true; }; | 50 | this.isAnimated = function() { return true; }; |
51 | this.getShaderDef = function() { return zInvertMaterialDef; }; | 51 | this.getShaderDef = function() { return zInvertMaterialDef; }; |
52 | 52 | ||
53 | /////////////////////////////////////////////////////////////////////// | 53 | /////////////////////////////////////////////////////////////////////// |
54 | // Properties | 54 | // Properties |
55 | /////////////////////////////////////////////////////////////////////// | 55 | /////////////////////////////////////////////////////////////////////// |
56 | // all defined in parent PulseMaterial.js | 56 | // all defined in parent PulseMaterial.js |
57 | // load the local default value | 57 | // load the local default value |
58 | this._propNames = ["u_tex0", "u_speed"]; | 58 | this._propNames = ["u_tex0", "u_speed"]; |
59 | this._propLabels = ["Texture map", "Speed"]; | 59 | this._propLabels = ["Texture map", "Speed"]; |
60 | this._propTypes = ["file", "float"]; | 60 | this._propTypes = ["file", "float"]; |
61 | 61 | ||
62 | var u_tex_index = 0, | 62 | var u_tex_index = 0, |
63 | u_speed_index = 1; | 63 | u_speed_index = 1; |
64 | 64 | ||
65 | this._propValues = []; | 65 | this._propValues = []; |
66 | this._propValues[ this._propNames[u_tex_index ] ] = this._defaultTexMap.slice(0); | 66 | this._propValues[ this._propNames[u_tex_index ] ] = this._defaultTexMap.slice(0); |
67 | this._propValues[ this._propNames[u_speed_index ] ] = 1.0; | 67 | this._propValues[ this._propNames[u_speed_index ] ] = 1.0; |
68 | 68 | ||
69 | /////////////////////////////////////////////////////////////////////// | 69 | /////////////////////////////////////////////////////////////////////// |
70 | // Methods | 70 | // Methods |
@@ -89,7 +89,7 @@ var ZInvertMaterial = function ZInvertMaterial() { | |||
89 | } | 89 | } |
90 | 90 | ||
91 | // set the shader values in the shader | 91 | // set the shader values in the shader |
92 | this.setShaderValues(); | 92 | this.setShaderValues(); |
93 | this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); | 93 | this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); |
94 | this.update(0); | 94 | this.update(0); |
95 | }; | 95 | }; |
@@ -111,42 +111,42 @@ var ZInvertMaterial = function ZInvertMaterial() { | |||
111 | // shader spec (can also be loaded from a .JSON file, or constructed at runtime) | 111 | // shader spec (can also be loaded from a .JSON file, or constructed at runtime) |
112 | var zInvertMaterialDef = | 112 | var zInvertMaterialDef = |
113 | { 'shaders': | 113 | { 'shaders': |
114 | { | 114 | { |
115 | 'defaultVShader': "assets/shaders/Basic.vert.glsl", | 115 | 'defaultVShader': "assets/shaders/Basic.vert.glsl", |
116 | 'defaultFShader': "assets/shaders/ZInvert.frag.glsl" | 116 | 'defaultFShader': "assets/shaders/ZInvert.frag.glsl" |
117 | }, | 117 | }, |
118 | 'techniques': | 118 | 'techniques': |
119 | { | 119 | { |
120 | 'default': | 120 | 'default': |
121 | [ | 121 | [ |
122 | { | 122 | { |
123 | 'vshader': 'defaultVShader', | 123 | 'vshader': 'defaultVShader', |
124 | 'fshader': 'defaultFShader', | 124 | 'fshader': 'defaultFShader', |
125 | // attributes | 125 | // attributes |
126 | 'attributes': | 126 | 'attributes': |
127 | { | 127 | { |
128 | 'vert': { 'type': 'vec3' }, | 128 | 'vert': { 'type': 'vec3' }, |
129 | 'normal': { 'type': 'vec3' }, | 129 | 'normal': { 'type': 'vec3' }, |
130 | 'texcoord': { 'type': 'vec2' } | 130 | 'texcoord': { 'type': 'vec2' } |
131 | }, | 131 | }, |
132 | // parameters | 132 | // parameters |
133 | 'params': | 133 | 'params': |
134 | { | 134 | { |
135 | 'u_tex0': { 'type': 'tex2d' }, | 135 | 'u_tex0': { 'type': 'tex2d' }, |
136 | 'u_time': { 'type': 'float' }, | 136 | 'u_time': { 'type': 'float' }, |
137 | 'u_speed': { 'type': 'float' }, | 137 | 'u_speed': { 'type': 'float' }, |
138 | 'u_resolution': { 'type': 'vec2' } | 138 | 'u_resolution': { 'type': 'vec2' } |
139 | }, | 139 | }, |
140 | 140 | ||
141 | // render states | 141 | // render states |
142 | 'states': | 142 | 'states': |
143 | { | 143 | { |
144 | 'depthEnable': true, | 144 | 'depthEnable': true, |
145 | 'offset': [1.0, 0.1] | 145 | 'offset': [1.0, 0.1] |
146 | } | 146 | } |
147 | } | 147 | } |
148 | ] | 148 | ] |
149 | } | 149 | } |
150 | }; | 150 | }; |
151 | 151 | ||
152 | ZInvertMaterial.prototype = new PulseMaterial(); | 152 | ZInvertMaterial.prototype = new PulseMaterial(); |