diff options
author | Nivesh Rajbhandari | 2012-02-09 14:18:20 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-09 14:18:20 -0800 |
commit | 3ba2be686e1981c8af3054ead1c7bb59af8b5d66 (patch) | |
tree | be9de86dc81afa3b8cdc821e7fced63946a959ac /js/helper-classes/RDGE/Materials/FlatMaterial.js | |
parent | a3ede9f0a790afd57e5d0f4c9fd50eaad1d5a3bc (diff) | |
download | ninja-3ba2be686e1981c8af3054ead1c7bb59af8b5d66.tar.gz |
Updated linear and radial gradient materials import/export routines.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/Materials/FlatMaterial.js')
-rw-r--r-- | js/helper-classes/RDGE/Materials/FlatMaterial.js | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js index a250dc0a..570e7f9e 100644 --- a/js/helper-classes/RDGE/Materials/FlatMaterial.js +++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js | |||
@@ -26,11 +26,11 @@ function FlatMaterial() | |||
26 | /////////////////////////////////////////////////////////////////////// | 26 | /////////////////////////////////////////////////////////////////////// |
27 | // Property Accessors | 27 | // Property Accessors |
28 | /////////////////////////////////////////////////////////////////////// | 28 | /////////////////////////////////////////////////////////////////////// |
29 | this.getColor = function() { return this._color; } | 29 | this.getColor = function() { return this._color; }; |
30 | this.getShaderName = function() { return this._shaderName; } | 30 | this.getShaderName = function() { return this._shaderName; }; |
31 | 31 | ||
32 | this.isAnimated = function() { return false; } | 32 | this.isAnimated = function() { return false; }; |
33 | this.hasVertexDeformation = function() { return true; } | 33 | this.hasVertexDeformation = function() { return true; }; |
34 | this._hasVertexDeformation = true; | 34 | this._hasVertexDeformation = true; |
35 | this._vertexDeformationTolerance = 0.2; | 35 | this._vertexDeformationTolerance = 0.2; |
36 | 36 | ||
@@ -38,7 +38,7 @@ function FlatMaterial() | |||
38 | // Methods | 38 | // Methods |
39 | /////////////////////////////////////////////////////////////////////// | 39 | /////////////////////////////////////////////////////////////////////// |
40 | // duplcate method requirde | 40 | // duplcate method requirde |
41 | this.dup = function() { return new FlatMaterial(); } | 41 | this.dup = function() { return new FlatMaterial(); } ; |
42 | 42 | ||
43 | this.init = function() | 43 | this.init = function() |
44 | { | 44 | { |
@@ -53,14 +53,7 @@ function FlatMaterial() | |||
53 | // set up the material node | 53 | // set up the material node |
54 | this._materialNode = createMaterialNode("flatMaterial"); | 54 | this._materialNode = createMaterialNode("flatMaterial"); |
55 | this._materialNode.setShader(this._shader); | 55 | this._materialNode.setShader(this._shader); |
56 | 56 | }; | |
57 | // initialize the taper properties | ||
58 | // this._shader.colorMe.u_limit1.set( [0.25] ); | ||
59 | // this._shader.colorMe.u_limit2.set( [0.5] ); | ||
60 | // this._shader.colorMe.u_limit3.set( [0.75] ); | ||
61 | // this._shader.colorMe.u_center.set( [0.0] ); | ||
62 | // this._shader.colorMe.u_taperAmount.set( [0.5] ); | ||
63 | } | ||
64 | 57 | ||
65 | 58 | ||
66 | /////////////////////////////////////////////////////////////////////// | 59 | /////////////////////////////////////////////////////////////////////// |
@@ -82,7 +75,7 @@ function FlatMaterial() | |||
82 | if (this._shader && this._shader.colorMe) | 75 | if (this._shader && this._shader.colorMe) |
83 | this._shader.colorMe[prop].set(value); | 76 | this._shader.colorMe[prop].set(value); |
84 | } | 77 | } |
85 | } | 78 | }; |
86 | /////////////////////////////////////////////////////////////////////// | 79 | /////////////////////////////////////////////////////////////////////// |
87 | 80 | ||
88 | this.export = function() | 81 | this.export = function() |
@@ -98,7 +91,7 @@ function FlatMaterial() | |||
98 | exportStr += "endMaterial\n"; | 91 | exportStr += "endMaterial\n"; |
99 | 92 | ||
100 | return exportStr; | 93 | return exportStr; |
101 | } | 94 | }; |
102 | 95 | ||
103 | this.import = function( importStr ) | 96 | this.import = function( importStr ) |
104 | { | 97 | { |
@@ -125,11 +118,12 @@ function FlatMaterial() | |||
125 | } | 118 | } |
126 | 119 | ||
127 | return rtnStr; | 120 | return rtnStr; |
128 | } | 121 | }; |
129 | 122 | ||
130 | this.update = function( time ) | 123 | this.update = function( time ) |
131 | { | 124 | { |
132 | } | 125 | }; |
126 | |||
133 | } | 127 | } |
134 | 128 | ||
135 | /////////////////////////////////////////////////////////////////////////////////////// | 129 | /////////////////////////////////////////////////////////////////////////////////////// |
@@ -139,9 +133,8 @@ function FlatMaterial() | |||
139 | flatShaderDef = | 133 | flatShaderDef = |
140 | { | 134 | { |
141 | 'shaders': { // shader files | 135 | 'shaders': { // shader files |
142 | //'defaultVShader':"assets/shaders/Taper.vert.glsl", | ||
143 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", | 136 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", |
144 | 'defaultFShader':"assets/shaders/Basic.frag.glsl", | 137 | 'defaultFShader':"assets/shaders/Basic.frag.glsl" |
145 | }, | 138 | }, |
146 | 'techniques': { // rendering control | 139 | 'techniques': { // rendering control |
147 | 'colorMe':[ // simple color pass | 140 | 'colorMe':[ // simple color pass |
@@ -154,20 +147,14 @@ flatShaderDef = | |||
154 | { | 147 | { |
155 | 'vert' : { 'type' : 'vec3' }, | 148 | 'vert' : { 'type' : 'vec3' }, |
156 | 'normal' : { 'type' : 'vec3' }, | 149 | 'normal' : { 'type' : 'vec3' }, |
157 | 'texcoord' : { 'type' : 'vec2' }, | 150 | 'texcoord' : { 'type' : 'vec2' } |
158 | }, | 151 | }, |
159 | // attributes | 152 | // attributes |
160 | 'params' : | 153 | 'params' : |
161 | { | 154 | { |
162 | 'color' : { 'type' : 'vec4' }, | 155 | 'color' : { 'type' : 'vec4' } |
163 | 156 | } | |
164 | //'u_limit1': { 'type': 'float' }, | 157 | } |
165 | //'u_limit2': { 'type': 'float' }, | ||
166 | //'u_limit3': { 'type': 'float' }, | ||
167 | //'u_center': { 'type': 'float' }, | ||
168 | //'u_taperAmount': { 'type': 'float' } | ||
169 | }, | ||
170 | }, | ||
171 | ] | 158 | ] |
172 | } | 159 | } |
173 | }; | 160 | }; |