aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/deform-material.js
diff options
context:
space:
mode:
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 dfd89d12..328330bf 100644
--- a/js/lib/rdge/materials/deform-material.js
+++ b/js/lib/rdge/materials/deform-material.js
@@ -10,20 +10,20 @@ var DeformMaterial = function DeformMaterial() {
10 /////////////////////////////////////////////////////////////////////// 10 ///////////////////////////////////////////////////////////////////////
11 // Instance variables 11 // Instance variables
12 /////////////////////////////////////////////////////////////////////// 12 ///////////////////////////////////////////////////////////////////////
13 this._name = "DeformMaterial"; 13 this._name = "DeformMaterial";
14 this._shaderName = "deform"; 14 this._shaderName = "deform";
15 15
16 this._texMap = 'assets/images/rocky-normal.jpg'; 16 this._texMap = 'assets/images/rocky-normal.jpg';
17 17
18 this._time = 0.0; 18 this._time = 0.0;
19 this._dTime = 0.01; 19 this._dTime = 0.01;
20 20
21 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
22 // Properties 22 // Properties
23 /////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////
24 // all defined in parent PulseMaterial.js 24 // all defined in parent PulseMaterial.js
25 // load the local default value 25 // load the local default value
26 this._propValues[ this._propNames[0] ] = this._texMap.slice(0); 26 this._propValues[this._propNames[0]] = this._texMap.slice(0);
27 27
28 /////////////////////////////////////////////////////////////////////// 28 ///////////////////////////////////////////////////////////////////////
29 // Material Property Accessors 29 // Material Property Accessors
@@ -35,44 +35,44 @@ var DeformMaterial = function DeformMaterial() {
35 /////////////////////////////////////////////////////////////////////// 35 ///////////////////////////////////////////////////////////////////////
36 // Methods 36 // Methods
37 /////////////////////////////////////////////////////////////////////// 37 ///////////////////////////////////////////////////////////////////////
38 // duplcate method requirde 38 // duplcate method requirde
39 this.dup = function( world ) { 39 this.dup = function (world) {
40 // allocate a new uber material 40 // allocate a new uber material
41 var newMat = new DeformMaterial(); 41 var newMat = new DeformMaterial();
42 42
43 // copy over the current values; 43 // copy over the current values;
44 var propNames = [], propValues = [], propTypes = [], propLabels = []; 44 var propNames = [], propValues = [], propTypes = [], propLabels = [];
45 this.getAllProperties( propNames, propValues, propTypes, propLabels); 45 this.getAllProperties(propNames, propValues, propTypes, propLabels);
46 var n = propNames.length; 46 var n = propNames.length;
47 for (var i=0; i<n; i++) 47 for (var i = 0; i < n; i++)
48 newMat.setProperty( propNames[i], propValues[i] ); 48 newMat.setProperty(propNames[i], propValues[i]);
49 49
50 return newMat; 50 return newMat;
51 }; 51 };
52 52
53 this.init = function( world ) { 53 this.init = function (world) {
54 // save the world 54 // save the world
55 if (world) this.setWorld( world ); 55 if (world) this.setWorld(world);
56 56
57 // set up the shader 57 // set up the shader
58 this._shader = new jshader(); 58 this._shader = new RDGE.jshader();
59 this._shader.def = deformMaterialDef; 59 this._shader.def = deformMaterialDef;
60 this._shader.init(); 60 this._shader.init();
61 61
62 // set up the material node 62 // set up the material node
63 this._materialNode = createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID()); 63 this._materialNode = RDGE.createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID());
64 this._materialNode.setShader(this._shader); 64 this._materialNode.setShader(this._shader);
65 65
66 this._time = 0; 66 this._time = 0;
67 if (this._shader && this._shader['default']) { 67 if (this._shader && this._shader['default']) {
68 this._shader['default'].u_time.set( [this._time] ); 68 this._shader['default'].u_time.set([this._time]);
69 } 69 }
70 70
71 // set the shader values in the shader 71 // set the shader values in the shader
72 this.updateTexture(); 72 this.updateTexture();
73 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 73 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);
74 this.update( 0 ); 74 this.update(0);
75 } 75 };
76}; 76};
77 77
78/////////////////////////////////////////////////////////////////////////////////////// 78///////////////////////////////////////////////////////////////////////////////////////