aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/uber-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/uber-material.js')
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js37
1 files changed, 19 insertions, 18 deletions
diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js
index 416cb980..d83b83bc 100755
--- a/js/lib/rdge/materials/uber-material.js
+++ b/js/lib/rdge/materials/uber-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
@@ -146,9 +147,9 @@ var UberMaterial = function UberMaterial() {
146 'spotOuterCutoff': 15.0, // fragments outside the outer cutoff 'cone' are unlit. 147 'spotOuterCutoff': 15.0, // fragments outside the outer cutoff 'cone' are unlit.
147 'position': [8.0, 2.0, 8.0], // light position; ignored for directional lights 148 'position': [8.0, 2.0, 8.0], // light position; ignored for directional lights
148 'direction': [-1.0, -1.0, -1.0], // light direction; ignored for point lights 149 'direction': [-1.0, -1.0, -1.0], // light direction; ignored for point lights
149 'attenuation': [1.0, 0.025, 0.00125], // light attenuation; constant, linear, quadratic 150 'attenuation': [1.0, 0.025, 0.00125], // light attenuation; constant, linear, quadratic
150 'diffuseColor': [1.0, 0.5, 0.5, 1.0], // diffuse light color 151 'diffuseColor': [1.0, 0.5, 0.5, 1.0], // diffuse light color
151 'specularColor': [1.0, 1.0, 1.0, 1.0] // specular light color 152 'specularColor': [1.0, 1.0, 1.0, 1.0] // specular light color
152 }, 153 },
153 { 154 {
154 'type': 'point', 155 'type': 'point',
@@ -184,7 +185,7 @@ var UberMaterial = function UberMaterial() {
184 185
185 this._ubershaderCaps = 186 this._ubershaderCaps =
186 { 187 {
187 // ubershader material properties. 188 // ubershader material properties.
188 'material': { 189 'material': {
189 'ambientColor': this._ambientColor, // material ambient color 190 'ambientColor': this._ambientColor, // material ambient color
190 'diffuseColor': this._diffuseColor, // material diffuse color 191 'diffuseColor': this._diffuseColor, // material diffuse color
@@ -192,7 +193,7 @@ var UberMaterial = function UberMaterial() {
192 'specularPower': this._specularPower // material specular power (shininess) 193 'specularPower': this._specularPower // material specular power (shininess)
193 }, 194 },
194 195
195 // ubershader supports up to four lights. 196 // ubershader supports up to four lights.
196 'lighting': { 197 'lighting': {
197 'light0': this._lights[0], 198 'light0': this._lights[0],
198 'light1': this._lights[1], 199 'light1': this._lights[1],
@@ -386,7 +387,7 @@ var UberMaterial = function UberMaterial() {
386 // get the current values; 387 // get the current values;
387 var propNames = [], propValues = [], propTypes = [], propLabels = []; 388 var propNames = [], propValues = [], propTypes = [], propLabels = [];
388 this.getAllProperties(propNames, propValues, propTypes, propLabels); 389 this.getAllProperties(propNames, propValues, propTypes, propLabels);
389 390
390 // allocate a new material 391 // allocate a new material
391 var newMat = new UberMaterial(); 392 var newMat = new UberMaterial();
392 newMat._useDiffuseMap = this._useDiffuseMap; 393 newMat._useDiffuseMap = this._useDiffuseMap;
@@ -434,7 +435,7 @@ var UberMaterial = function UberMaterial() {
434 } 435 }
435 } 436 }
436 } 437 }
437 438
438 this.isAnimated = function() 439 this.isAnimated = function()
439 { 440 {
440 var anim = (this._diffuseTexture && this._diffuseTexture.isAnimated()); 441 var anim = (this._diffuseTexture && this._diffuseTexture.isAnimated());
@@ -687,7 +688,7 @@ var UberMaterial = function UberMaterial() {
687 var vshader = preproc + uberVShader; 688 var vshader = preproc + uberVShader;
688 var fshader = preproc + uberFShader; 689 var fshader = preproc + uberFShader;
689 690
690 // build output jshader 691 // build output jshader
691 var uberJShader = new RDGE.jshader(); 692 var uberJShader = new RDGE.jshader();
692 uberJShader.def = { 693 uberJShader.def = {
693 'shaders': { 694 'shaders': {