aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/linear-gradient-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/linear-gradient-material.js')
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js55
1 files changed, 28 insertions, 27 deletions
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index 981bf9fd..2edaad8e 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -1,24 +1,25 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved. 3All Rights Reserved.
4BSD License.
5 4
6Redistribution and use in source and binary forms, with or without 5Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 6modification, are permitted provided that the following conditions are met:
8 7
9 - Redistributions of source code must retain the above copyright notice, 8* Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 9 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright 10
12 notice, this list of conditions and the following disclaimer in the 11* Redistributions in binary form must reproduce the above copyright notice,
13 documentation and/or other materials provided with the distribution. 12 this list of conditions and the following disclaimer in the documentation
14 - Neither the name of Motorola Mobility nor the names of its contributors 13 and/or other materials provided with the distribution.
15 may be used to endorse or promote products derived from this software 14
16 without specific prior written permission. 15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
17 18
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -107,15 +108,15 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
107 108
108/////////////////////////////////////////////////////////////////////////////////////// 109///////////////////////////////////////////////////////////////////////////////////////
109// RDGE shader 110// RDGE shader
110 111
111// shader spec (can also be loaded from a .JSON file, or constructed at runtime) 112// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
112var linearGradientMaterialDef = 113var linearGradientMaterialDef =
113{'shaders': 114{'shaders':
114 { 115 {
115 // shader file 116 // shader file
116 'defaultVShader':"assets/shaders/linearGradient.vert.glsl", 117 'defaultVShader':"assets/shaders/linearGradient.vert.glsl",
117 'defaultFShader':"assets/shaders/linearGradient.frag.glsl", 118 'defaultFShader':"assets/shaders/linearGradient.frag.glsl",
118 119
119 // this shader is inline 120 // this shader is inline
120 'dirLightVShader': "\ 121 'dirLightVShader': "\
121 uniform mat4 u_mvMatrix;\ 122 uniform mat4 u_mvMatrix;\
@@ -130,7 +131,7 @@ var linearGradientMaterialDef =
130 vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ 131 vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\
131 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ 132 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\
132 vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ 133 vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\
133 }", 134 }",
134 'dirLightFShader': "\ 135 'dirLightFShader': "\
135 precision highp float;\ 136 precision highp float;\
136 uniform vec4 u_light1Diff;\ 137 uniform vec4 u_light1Diff;\
@@ -150,7 +151,7 @@ var linearGradientMaterialDef =
150 }" 151 }"
151 }, 152 },
152 'techniques': 153 'techniques':
153 { 154 {
154 'default': 155 'default':
155 [ 156 [
156 { 157 {
@@ -164,16 +165,16 @@ var linearGradientMaterialDef =
164 'texcoord' : { 'type' : 'vec2' } 165 'texcoord' : { 'type' : 'vec2' }
165 }, 166 },
166 // parameters 167 // parameters
167 'params' : 168 'params' :
168 { 169 {
169 'u_color1' : { 'type' : 'vec4' }, 170 'u_color1' : { 'type' : 'vec4' },
170 'u_color2' : { 'type' : 'vec4' }, 171 'u_color2' : { 'type' : 'vec4' },
171 'u_color3' : { 'type' : 'vec4' }, 172 'u_color3' : { 'type' : 'vec4' },
172 'u_color4' : { 'type' : 'vec4' }, 173 'u_color4' : { 'type' : 'vec4' },
173 'u_colorStop1': { 'type' : 'float' }, 174 'u_colorStop1': { 'type' : 'float' },
174 'u_colorStop2': { 'type' : 'float' }, 175 'u_colorStop2': { 'type' : 'float' },
175 'u_colorStop3': { 'type' : 'float' }, 176 'u_colorStop3': { 'type' : 'float' },
176 'u_colorStop4': { 'type' : 'float' }, 177 'u_colorStop4': { 'type' : 'float' },
177 'u_cos_sin_angle': { 'type' : 'vec2' }, 178 'u_cos_sin_angle': { 'type' : 'vec2' },
178 'u_texTransform': { 'type' : 'mat3' } 179 'u_texTransform': { 'type' : 'mat3' }
179 //'u_colorCount': {'type' : 'int' } 180 //'u_colorCount': {'type' : 'int' }
@@ -181,7 +182,7 @@ var linearGradientMaterialDef =
181 }, 182 },
182 183
183 // render states 184 // render states
184 'states' : 185 'states' :
185 { 186 {
186 'depthEnable' : true, 187 'depthEnable' : true,
187 'offset':[1.0, 0.1] 188 'offset':[1.0, 0.1]
@@ -197,12 +198,12 @@ var linearGradientMaterialDef =
197 'a_nrm' : { 'type' : 'vec3' } 198 'a_nrm' : { 'type' : 'vec3' }
198 }, 199 },
199 // parameters 200 // parameters
200 'params' : 201 'params' :
201 { 202 {
202 }, 203 },
203 204
204 // render states 205 // render states
205 'states' : 206 'states' :
206 { 207 {
207 'depthEnable' : true, 208 'depthEnable' : true,
208 "blendEnable" : true, 209 "blendEnable" : true,