aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/Materials/JuliaMaterial.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/Materials/JuliaMaterial.js')
-rw-r--r--js/helper-classes/RDGE/Materials/JuliaMaterial.js150
1 files changed, 0 insertions, 150 deletions
diff --git a/js/helper-classes/RDGE/Materials/JuliaMaterial.js b/js/helper-classes/RDGE/Materials/JuliaMaterial.js
deleted file mode 100644
index 9b5d588c..00000000
--- a/js/helper-classes/RDGE/Materials/JuliaMaterial.js
+++ /dev/null
@@ -1,150 +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 JuliaMaterial()
14{
15 // initialize the inherited members
16 this.inheritedFrom = PulseMaterial;
17 this.inheritedFrom();
18
19 ///////////////////////////////////////////////////////////////////////
20 // Instance variables
21 ///////////////////////////////////////////////////////////////////////
22 this._name = "JuliaMaterial";
23 this._shaderName = "julia";
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 // no properties
34 this._propNames = [];
35 this._propLabels = [];
36 this._propTypes = [];
37 this._propValues = [];
38
39 ///////////////////////////////////////////////////////////////////////
40 // Material Property Accessors
41 ///////////////////////////////////////////////////////////////////////
42
43 ///////////////////////////////////////////////////////////////////////
44
45
46 ///////////////////////////////////////////////////////////////////////
47 // Methods
48 ///////////////////////////////////////////////////////////////////////
49 // duplcate method requirde
50 this.dup = function( world )
51 {
52 // allocate a new uber material
53 var newMat = new JuliaMaterial();
54
55 // copy over the current values;
56 var propNames = [], propValues = [], propTypes = [], propLabels = [];
57 this.getAllProperties( propNames, propValues, propTypes, propLabels);
58 var n = propNames.length;
59 for (var i=0; i<n; i++)
60 newMat.setProperty( propNames[i], propValues[i] );
61
62 return newMat;
63 }
64
65 this.init = function( world )
66 {
67 // save the world
68 if (world) this.setWorld( world );
69
70 // set up the shader
71 this._shader = new jshader();
72 this._shader.def = JuliaMaterialDef;
73 this._shader.init();
74
75 // set up the material node
76 this._materialNode = createMaterialNode("juliaMaterial_" + world.generateUniqueNodeID());
77 this._materialNode.setShader(this._shader);
78
79 this._time = 0;
80 if (this._shader && this._shader.default)
81 this._shader.default.u_time.set( [this._time] );
82
83 // set the shader values in the shader
84 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
85 this.update( 0 );
86 }
87
88 this.update = function( time )
89 {
90 var material = this._materialNode;
91 if (material)
92 {
93 var technique = material.shaderProgram.default;
94 var renderer = g_Engine.getContext().renderer;
95 if (renderer && technique)
96 {
97 if (this._shader && this._shader.default)
98 this._shader.default.u_time.set( [this._time] );
99 this._time = time;
100 }
101 }
102 }
103}
104
105///////////////////////////////////////////////////////////////////////////////////////
106// RDGE shader
107
108// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
109var JuliaMaterialDef =
110{'shaders':
111 {
112 'defaultVShader':"assets/shaders/Basic.vert.glsl",
113 'defaultFShader':"assets/shaders/Julia.frag.glsl"
114 },
115 'techniques':
116 {
117 'default':
118 [
119 {
120 'vshader' : 'defaultVShader',
121 'fshader' : 'defaultFShader',
122 // attributes
123 'attributes' :
124 {
125 'vert' : { 'type' : 'vec3' },
126 'normal' : { 'type' : 'vec3' },
127 'texcoord' : { 'type' : 'vec2' }
128 },
129 // parameters
130 'params' :
131 {
132 'u_tex0': { 'type' : 'tex2d' },
133 'u_time' : { 'type' : 'float' },
134 'u_resolution' : { 'type' : 'vec2' },
135 },
136
137 // render states
138 'states' :
139 {
140 'depthEnable' : true,
141 'offset':[1.0, 0.1]
142 },
143 },
144 ]
145 }
146};
147
148
149
150