aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/Materials/TunnelMaterial.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/Materials/TunnelMaterial.js')
-rw-r--r--js/helper-classes/RDGE/Materials/TunnelMaterial.js130
1 files changed, 0 insertions, 130 deletions
diff --git a/js/helper-classes/RDGE/Materials/TunnelMaterial.js b/js/helper-classes/RDGE/Materials/TunnelMaterial.js
deleted file mode 100644
index fe277af6..00000000
--- a/js/helper-classes/RDGE/Materials/TunnelMaterial.js
+++ /dev/null
@@ -1,130 +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 GLMaterial
11// RDGE representation of a material.
12///////////////////////////////////////////////////////////////////////
13function TunnelMaterial()
14{
15 // initialize the inherited members
16 this.inheritedFrom = PulseMaterial;
17 this.inheritedFrom();
18
19 ///////////////////////////////////////////////////////////////////////
20 // Instance variables
21 ///////////////////////////////////////////////////////////////////////
22 this._name = "TunnelMaterial";
23 this._shaderName = "tunnel";
24
25 this._texMap = 'assets/images/rocky-normal.jpg';
26
27 this._time = 0.0;
28 this._dTime = 0.01;
29
30 ///////////////////////////////////////////////////////////////////////
31 // Properties
32 ///////////////////////////////////////////////////////////////////////
33 // all defined in parent PulseMaterial.js
34 // load the local default value
35 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
36
37 ///////////////////////////////////////////////////////////////////////
38 // Material Property Accessors
39 ///////////////////////////////////////////////////////////////////////
40
41 ///////////////////////////////////////////////////////////////////////
42
43
44 ///////////////////////////////////////////////////////////////////////
45 // Methods
46 ///////////////////////////////////////////////////////////////////////
47 // duplcate method requirde
48 this.dup = function( world )
49 {
50 // allocate a new uber material
51 var newMat = new TunnelMaterial();
52
53 // copy over the current values;
54 var propNames = [], propValues = [], propTypes = [], propLabels = [];
55 this.getAllProperties( propNames, propValues, propTypes, propLabels);
56 var n = propNames.length;
57 for (var i=0; i<n; i++)
58 newMat.setProperty( propNames[i], propValues[i] );
59
60 return newMat;
61 }
62
63 this.init = function( world )
64 {
65 // set up the shader
66 this._shader = new jshader();
67 this._shader.def = tunnelMaterialDef;
68 this._shader.init();
69
70 // set up the material node
71 this._materialNode = createMaterialNode("tunnelMaterial");
72 this._materialNode.setShader(this._shader);
73
74 this._time = 0;
75 if (this._shader && this._shader.default)
76 this._shader.default.u_time.set( [this._time] );
77
78 // set the shader values in the shader
79 this.updateTexture();
80 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
81 this.update( 0 );
82 }
83}
84
85///////////////////////////////////////////////////////////////////////////////////////
86// RDGE shader
87
88// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
89var tunnelMaterialDef =
90{'shaders':
91 {
92 'defaultVShader':"assets/shaders/Basic.vert.glsl",
93 'defaultFShader':"assets/shaders/Tunnel.frag.glsl"
94 },
95 'techniques':
96 {
97 'default':
98 [
99 {
100 'vshader' : 'defaultVShader',
101 'fshader' : 'defaultFShader',
102 // attributes
103 'attributes' :
104 {
105 'vert' : { 'type' : 'vec3' },
106 'normal' : { 'type' : 'vec3' },
107 'texcoord' : { 'type' : 'vec2' }
108 },
109 // parameters
110 'params' :
111 {
112 'u_tex0': { 'type' : 'tex2d' },
113 'u_time' : { 'type' : 'float' },
114 'u_resolution' : { 'type' : 'vec2' },
115 },
116
117 // render states
118 'states' :
119 {
120 'depthEnable' : true,
121 'offset':[1.0, 0.1]
122 },
123 },
124 ]
125 }
126};
127
128
129
130