aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/Materials/UberMaterial.js
diff options
context:
space:
mode:
authorEric Guzman2012-03-17 00:05:14 -0700
committerEric Guzman2012-03-17 00:05:14 -0700
commita3192d8bc0f8c0698265817c14dcd2284fd89d7d (patch)
tree497ac55f550ed52f9d73b464aafb2aa6cb5f5038 /js/helper-classes/backup-delete/Materials/UberMaterial.js
parenta6a6f9bcc5ff92f5bb5e9275336dfaec2d8e8f4c (diff)
parent954f5a13e371febcb1c0fb8015c577ee51c23130 (diff)
downloadninja-a3192d8bc0f8c0698265817c14dcd2284fd89d7d.tar.gz
Merge branch 'refs/heads/master' into AddAnimationsLibrary
Conflicts: js/panels/presets/default-transition-presets.js
Diffstat (limited to 'js/helper-classes/backup-delete/Materials/UberMaterial.js')
-rwxr-xr-xjs/helper-classes/backup-delete/Materials/UberMaterial.js673
1 files changed, 0 insertions, 673 deletions
diff --git a/js/helper-classes/backup-delete/Materials/UberMaterial.js b/js/helper-classes/backup-delete/Materials/UberMaterial.js
deleted file mode 100755
index c7855c95..00000000
--- a/js/helper-classes/backup-delete/Materials/UberMaterial.js
+++ /dev/null
@@ -1,673 +0,0 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7
8
9/////////////////////////////////////////////////////////////////////////
10//// Class UberMaterial
11//// RDGE representation of a material.
12/////////////////////////////////////////////////////////////////////////
13function UberMaterial()
14{
15 // initialize the inherited members
16 this.inheritedFrom = GLMaterial;
17 this.inheritedFrom();
18
19 ///////////////////////////////////////////////////////////////////////
20 // Instance variables
21 ///////////////////////////////////////////////////////////////////////
22 this._name = "UberMaterial";
23 this._shaderName = "uber";
24 this.getShaderName = function() { return this._shaderName; };
25
26 // set some default values
27 this._ambientColor = [ 0.0, 0.0, 0.0, 1.0 ];
28 this._diffuseColor = [ 1.0, 1.0, 1.0, 1.0 ];
29 this._specularColor = [ 1.0, 1.0, 1.0, 1.0 ];
30 this._specularPower = 32.0;
31 this._environmentAmount = 0.2; // 0 .. 1
32
33 // set the default maps
34 this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' };
35 this._normalMapOb = { 'texture' : 'assets/images/rocky-normal.jpg', 'wrap' : 'REPEAT' };
36 this._specularMapOb = { 'texture' : 'assets/images/rocky-spec.jpg', 'wrap' : 'REPEAT' };
37 this._environmentMapOb = { 'texture' : 'assets/images/silver.png', 'wrap' : 'CLAMP', 'envReflection' : this._environmentAmount };
38
39 this._useDiffuseMap = true;
40 this._useNormalMap = true;
41 this._useSpecularMap = true;
42 this._useEnvironmentMap = true;
43 this._useLights = [true, true, true, true];
44
45 ///////////////////////////////////////////////////////////////////////
46 // Material Property Accessors
47 ///////////////////////////////////////////////////////////////////////
48 this._propNames = ["ambientColor", "diffuseColor", "specularColor", "specularPower" , "diffuseMap", "normalMap", "specularMap", "environmentMap", "environmentAmount" ];
49 this._propLabels = ["Ambient Color", "Diffuse Color", "Specular Color", "Specular Power", "Texture Map", "Bump Map", "Specular Map", "Environment Map", "Environment Map Amount" ];
50 this._propTypes = ["color", "color", "color", "float", "file", "file", "file", "file", "float" ];
51 this._propValues = [];
52
53 this._propValues[ this._propNames[0] ] = this._ambientColor.slice(0);
54 this._propValues[ this._propNames[1] ] = this._diffuseColor.slice(0);
55 this._propValues[ this._propNames[2] ] = this._specularColor.slice(0);
56 this._propValues[ this._propNames[3] ] = this._specularPower;
57 this._propValues[ this._propNames[4] ] = this._diffuseMapOb['texture'];
58 this._propValues[ this._propNames[5] ] = this._normalMapOb['texture'];
59 this._propValues[ this._propNames[6] ] = this._specularMapOb['texture'];
60 this._propValues[ this._propNames[7] ] = this._environmentMapOb['texture'];
61 this._propValues[ this._propNames[8] ] = this._environmentMapOb['envReflection'];
62
63 this.setProperty = function( prop, value )
64 {
65 if (prop == "color") prop = "ambientColor";
66 var valid = this.validateProperty( prop, value );
67 if (valid)
68 {
69 this._propValues[prop] = value;
70
71 switch (prop)
72 {
73 case "diffuseMap":
74 this.updateDiffuseMap();
75 break;
76 case "normalMap":
77 this.updateNormalMap();
78 break;
79 case "specularMap":
80 this.updateSpecularMap();
81 break;
82 case "environmentMap":
83 this.updateEnvironmentMap();
84 break;
85 case "environmentAmount":
86 this.updateEnvironmentAmount( value );
87 break;
88 case "specularPower":
89 this.updateSpecularPower( value );
90 break;
91 case "ambientColor":
92 this.updateAmbientColor( value );
93 break;
94 case "diffuseColor":
95 this.updateDiffuseColor( value );
96 break;
97 case "specularColor":
98 this.updateSpecularColor( value );
99 break;
100 }
101 }
102 };
103 ///////////////////////////////////////////////////////////////////////
104
105 // define the 4 lights
106 this._lights = [
107
108 {
109 'type' : 'point', // can be 'directional', 'point' or 'spot'
110 'spotInnerCutoff' : 14.0, // fragments in the inner cutoff 'cone' are full intensity.
111 'spotOuterCutoff' : 15.0, // fragments outside the outer cutoff 'cone' are unlit.
112 'position' : [ 8.0, 2.0, 8.0 ], // light position; ignored for directional lights
113 'direction' : [ -1.0, -1.0, -1.0 ], // light direction; ignored for point lights
114 'attenuation' : [ 1.0, 0.025, 0.00125 ], // light attenuation; constant, linear, quadratic
115 'diffuseColor' : [ 1.0, 0.5, 0.5, 1.0 ], // diffuse light color
116 'specularColor' : [ 1.0, 1.0, 1.0, 1.0 ] // specular light color
117 },
118 {
119 'type' : 'point',
120 'spotInnerCutoff' : 9.0,
121 'spotOuterCutoff' : 20.0,
122 'position' : [ -8.0, 2.0, 8.0 ],
123 'direction' : [ 1.0, -1.0, -1.0 ],
124 'attenuation' : [ 1.0, 0.025, 0.00125 ],
125 'diffuseColor' : [ 0.5, 1.0, 0.5, 1.0 ],
126 'specularColor' : [ 1.0, 1.0, 1.0, 1.0 ]
127 },
128 {
129 'type' : 'point',
130 'spotInnerCutoff' : 9.0,
131 'spotOuterCutoff' : 20.0,
132 'position' : [ -8.0, 2.0, -8.0 ],
133 'direction' : [ 1.0, -1.0, 1.0 ],
134 'attenuation' : [ 1.0, 0.25, 0.0125 ],
135 'diffuseColor' : [ 0.5, 0.5, 1.0, 1.0 ],
136 'specularColor' : [ 1.0, 1.0, 1.0, 1.0 ]
137 },
138 {
139 'type' : 'point',
140 'spotInnerCutoff' : 9.0,
141 'spotOuterCutoff' : 20.0,
142 'position' : [ 8.0, 4.0, -8.0 ],
143 'direction' : [ -1.0, -1.0, 1.0 ],
144 'attenuation' : [ 1.0, 0.25, 0.0125 ],
145 'diffuseColor' : [ 1.0, 1.0, 0.5, 1.0 ],
146 'specularColor' : [ 1.0, 1.0, 1.0, 1.0 ]
147 }
148 ];
149
150 this._ubershaderCaps =
151 {
152 // ubershader material properties.
153 'material' : {
154 'ambientColor' : this._ambientColor, // material ambient color
155 'diffuseColor' : this._diffuseColor, // material diffuse color
156 'specularColor' : this._specularColor, // material specular color
157 'specularPower' : this._specularPower // material specular power (shininess)
158 },
159
160 // ubershader supports up to four lights.
161 'lighting' : {
162 'light0' : this._lights[0],
163 'light1' : this._lights[1],
164 'light2' : this._lights[2],
165 'light3' : this._lights[3]
166 },
167
168 // uvTransform can be used to scale or offset the texture coordinates.
169 'uvTransform' : [ 2.0, 0, 0, 0, 0, 2.0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1],
170
171 // optional diffuse map
172 'diffuseMap' : this._diffuseMapOb,
173
174 // optional normal map
175 'normalMap' : this._normalMapOb,
176
177 // optional specular map
178 'specularMap' : this._specularMapOb,
179
180 // optional environment map
181 'environmentMap' : this._environmentMapOb
182 };
183
184 this.updateAmbientColor = function()
185 {
186 this._ambientColor = this._propValues['ambientColor'].slice(0);
187 var material = this._materialNode;
188 if (material)
189 {
190 var technique = material.shaderProgram.defaultTechnique;
191 technique.u_ambientColor.set(this._ambientColor);
192 }
193 };
194