aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/deform-material.js
diff options
context:
space:
mode:
authorhwc4872012-04-19 13:01:43 -0700
committerhwc4872012-04-19 13:01:43 -0700
commite6a20fe64574763483dc602bd759278ccf5e5e68 (patch)
tree69defe7200206f0257fe90697136fadef59d521e /js/lib/rdge/materials/deform-material.js
parentae7eb87564632ce7c676bd728b8ff2710ff0bb83 (diff)
parent9284c19f076dec3b47ece7dc7bcd22d74e4246c3 (diff)
downloadninja-e6a20fe64574763483dc602bd759278ccf5e5e68.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts: js/lib/drawing/world.js js/lib/geom/geom-obj.js js/lib/rdge/materials/cloud-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js
Diffstat (limited to 'js/lib/rdge/materials/deform-material.js')
-rw-r--r--js/lib/rdge/materials/deform-material.js88
1 files changed, 44 insertions, 44 deletions
diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js
index c7bfe67a..a7a0c178 100644
--- a/js/lib/rdge/materials/deform-material.js
+++ b/js/lib/rdge/materials/deform-material.js
@@ -11,20 +11,20 @@ var DeformMaterial = function DeformMaterial() {
11 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
12 // Instance variables 12 // Instance variables
13 /////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////
14 this._name = "DeformMaterial"; 14 this._name = "DeformMaterial";
15 this._shaderName = "deform"; 15 this._shaderName = "deform";
16 16
17 this._texMap = 'assets/images/rocky-normal.jpg'; 17 this._texMap = 'assets/images/rocky-normal.jpg';
18 18
19 this._time = 0.0; 19 this._time = 0.0;
20 this._dTime = 0.01; 20 this._dTime = 0.01;
21 21
22 /////////////////////////////////////////////////////////////////////// 22 ///////////////////////////////////////////////////////////////////////
23 // Properties 23 // Properties
24 /////////////////////////////////////////////////////////////////////// 24 ///////////////////////////////////////////////////////////////////////
25 // all defined in parent PulseMaterial.js 25 // all defined in parent PulseMaterial.js
26 // load the local default value 26 // load the local default value
27 this._propValues[ this._propNames[0] ] = this._texMap.slice(0); 27 this._propValues[this._propNames[0]] = this._texMap.slice(0);
28 28
29 /////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////
30 // Material Property Accessors 30 // Material Property Accessors
@@ -36,48 +36,48 @@ var DeformMaterial = function DeformMaterial() {
36 /////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////
37 // Methods 37 // Methods
38 /////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////
39 // duplcate method requirde 39 // duplcate method requirde
40 this.dup = function( world ) { 40 this.dup = function (world) {
41 // allocate a new uber material 41 // allocate a new uber material
42 var newMat = new DeformMaterial(); 42 var newMat = new DeformMaterial();
43 43
44 // copy over the current values; 44 // copy over the current values;
45 var propNames = [], propValues = [], propTypes = [], propLabels = []; 45 var propNames = [], propValues = [], propTypes = [], propLabels = [];
46 this.getAllProperties( propNames, propValues, propTypes, propLabels); 46 this.getAllProperties(propNames, propValues, propTypes, propLabels);
47 var n = propNames.length; 47 var n = propNames.length;
48 for (var i=0; i<n; i++) 48 for (var i = 0; i < n; i++)
49 newMat.setProperty( propNames[i], propValues[i] ); 49 newMat.setProperty(propNames[i], propValues[i]);
50 50
51 return newMat; 51 return newMat;
52 }; 52 };
53 53
54 this.init = function( world ) { 54 this.init = function (world) {
55 // save the world 55 // save the world
56 if (world) this.setWorld( world ); 56 if (world) this.setWorld(world);
57 57
58 // set up the shader 58 // set up the shader
59 this._shader = new jshader(); 59 this._shader = new RDGE.jshader();
60 this._shader.def = deformMaterialDef; 60 this._shader.def = deformMaterialDef;
61 this._shader.init(); 61 this._shader.init();
62 62
63 // set up the material node 63 // set up the material node
64 this._materialNode = createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID()); 64 this._materialNode = RDGE.createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID());
65 this._materialNode.setShader(this._shader); 65 this._materialNode.setShader(this._shader);
66 66
67 this._time = 0; 67 this._time = 0;
68 if (this._shader && this._shader['default']) { 68 if (this._shader && this._shader['default']) {
69 this._shader['default'].u_time.set( [this._time] ); 69 this._shader['default'].u_time.set([this._time]);
70 } 70 }
71 71
72 // set up the texture 72 // set up the texture
73 var texMapName = this._propValues[this._propNames[0]]; 73 var texMapName = this._propValues[this._propNames[0]];
74 this._glTex = new Texture( world, texMapName ); 74 this._glTex = new Texture( world, texMapName );
75 75
76 // set the shader values in the shader 76 // set the shader values in the shader
77 this.updateTexture(); 77 this.updateTexture();
78 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 78 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);
79 this.update( 0 ); 79 this.update(0);
80 } 80 };
81}; 81};
82 82
83/////////////////////////////////////////////////////////////////////////////////////// 83///////////////////////////////////////////////////////////////////////////////////////