diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/lib/rdge/materials/julia-material.js | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz |
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts:
js/components/gradientpicker.reel/gradientpicker.js
js/components/tools-properties/text-properties.reel/text-properties.js
js/document/views/base.js
js/document/views/design.js
js/helper-classes/3D/StageLine.js
js/helper-classes/3D/draw-utils.js
js/lib/drawing/world.js
js/lib/geom/circle.js
js/lib/geom/line.js
js/lib/geom/rectangle.js
js/lib/geom/shape-primitive.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/flag-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/water-material.js
js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
js/panels/Materials/materials-popup.reel/materials-popup.html
js/panels/Materials/materials-popup.reel/materials-popup.js
js/tools/LineTool.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/lib/rdge/materials/julia-material.js')
-rw-r--r-- | js/lib/rdge/materials/julia-material.js | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js index 35ae980a..ccd2628d 100644 --- a/js/lib/rdge/materials/julia-material.js +++ b/js/lib/rdge/materials/julia-material.js | |||
@@ -35,57 +35,57 @@ var JuliaMaterial = function JuliaMaterial() { | |||
35 | /////////////////////////////////////////////////////////////////////// | 35 | /////////////////////////////////////////////////////////////////////// |
36 | // Instance variables | 36 | // Instance variables |
37 | /////////////////////////////////////////////////////////////////////// | 37 | /////////////////////////////////////////////////////////////////////// |
38 | this._name = "Julia"; | 38 | this._name = "Julia"; |
39 | this._shaderName = "julia"; | 39 | this._shaderName = "julia"; |
40 | 40 | ||
41 | this._defaultTexMap = 'assets/images/rocky-normal.jpg'; | 41 | this._defaultTexMap = 'assets/images/rocky-normal.jpg'; |
42 | 42 | ||
43 | this._time = 0.0; | 43 | this._time = 0.0; |
44 | this._dTime = 0.01; | 44 | this._dTime = 0.01; |
45 | 45 | ||
46 | /////////////////////////////////////////////////////////////////////// | 46 | /////////////////////////////////////////////////////////////////////// |
47 | // Properties | 47 | // Properties |
48 | /////////////////////////////////////////////////////////////////////// | 48 | /////////////////////////////////////////////////////////////////////// |
49 | var u_speed_index = 0; | 49 | var u_speed_index = 0; |
50 | this._propNames = [ "u_speed" ]; | 50 | this._propNames = [ "u_speed" ]; |
51 | this._propLabels = [ "Speed" ]; | 51 | this._propLabels = [ "Speed" ]; |
52 | this._propTypes = [ "float" ]; | 52 | this._propTypes = [ "float" ]; |
53 | this._propValues = []; | 53 | this._propValues = []; |
54 | this._propValues[this._propNames[u_speed_index]] = 1.0; | 54 | this._propValues[this._propNames[u_speed_index]] = 1.0; |
55 | 55 | ||
56 | /////////////////////////////////////////////////////////////////////// | 56 | /////////////////////////////////////////////////////////////////////// |
57 | // Material Property Accessors | 57 | // Material Property Accessors |
58 | /////////////////////////////////////////////////////////////////////// | 58 | /////////////////////////////////////////////////////////////////////// |
59 | this.isAnimated = function() { return true; }; | 59 | this.isAnimated = function() { return true; }; |
60 | this.getShaderDef = function() { return JuliaMaterialDef; } | 60 | this.getShaderDef = function() { return JuliaMaterialDef; } |
61 | 61 | ||
62 | /////////////////////////////////////////////////////////////////////// | 62 | /////////////////////////////////////////////////////////////////////// |
63 | // Methods | 63 | // Methods |
64 | /////////////////////////////////////////////////////////////////////// | 64 | /////////////////////////////////////////////////////////////////////// |
65 | 65 | ||
66 | this.init = function( world ) { | 66 | this.init = function( world ) { |
67 | // save the world | 67 | // save the world |
68 | if (world) this.setWorld( world ); | 68 | if (world) this.setWorld( world ); |
69 | 69 | ||
70 | // set up the shader | 70 | // set up the shader |
71 | this._shader = new RDGE.jshader(); | 71 | this._shader = new RDGE.jshader(); |
72 | this._shader.def = JuliaMaterialDef; | 72 | this._shader.def = JuliaMaterialDef; |
73 | this._shader.init(); | 73 | this._shader.init(); |
74 | 74 | ||
75 | // set up the material node | 75 | // set up the material node |
76 | this._materialNode = RDGE.createMaterialNode("juliaMaterial" + "_" + world.generateUniqueNodeID()); | 76 | this._materialNode = RDGE.createMaterialNode("juliaMaterial" + "_" + world.generateUniqueNodeID()); |
77 | this._materialNode.setShader(this._shader); | 77 | this._materialNode.setShader(this._shader); |
78 | 78 | ||
79 | this._time = 0; | 79 | this._time = 0; |
80 | if (this._shader && this._shader['default']) { | 80 | if (this._shader && this._shader['default']) { |
81 | this._shader['default'].u_time.set( [this._time] ); | 81 | this._shader['default'].u_time.set( [this._time] ); |
82 | } | 82 | } |
83 | 83 | ||
84 | // set the shader values in the shader | 84 | // set the shader values in the shader |
85 | this.setShaderValues(); | 85 | this.setShaderValues(); |
86 | this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); | 86 | this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); |
87 | this.update( 0 ); | 87 | this.update( 0 ); |
88 | }; | 88 | }; |
89 | 89 | ||
90 | this.resetToDefault = function() | 90 | this.resetToDefault = function() |
91 | { | 91 | { |
@@ -99,45 +99,45 @@ var JuliaMaterial = function JuliaMaterial() { | |||
99 | 99 | ||
100 | /////////////////////////////////////////////////////////////////////////////////////// | 100 | /////////////////////////////////////////////////////////////////////////////////////// |
101 | // RDGE shader | 101 | // RDGE shader |
102 | 102 | ||
103 | // shader spec (can also be loaded from a .JSON file, or constructed at runtime) | 103 | // shader spec (can also be loaded from a .JSON file, or constructed at runtime) |
104 | var JuliaMaterialDef = | 104 | var JuliaMaterialDef = |
105 | {'shaders': | 105 | {'shaders': |
106 | { | 106 | { |
107 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", | 107 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", |
108 | 'defaultFShader':"assets/shaders/Julia.frag.glsl" | 108 | 'defaultFShader':"assets/shaders/Julia.frag.glsl" |
109 | }, | 109 | }, |
110 | 'techniques': | 110 | 'techniques': |
111 | { | 111 | { |
112 | 'default': | 112 | 'default': |
113 | [ | 113 | [ |
114 | { | 114 | { |
115 | 'vshader' : 'defaultVShader', | 115 | 'vshader' : 'defaultVShader', |
116 | 'fshader' : 'defaultFShader', | 116 | 'fshader' : 'defaultFShader', |
117 | // attributes | 117 | // attributes |
118 | 'attributes' : | 118 | 'attributes' : |
119 | { | 119 | { |
120 | 'vert' : { 'type' : 'vec3' }, | 120 | 'vert' : { 'type' : 'vec3' }, |
121 | 'normal' : { 'type' : 'vec3' }, | 121 | 'normal' : { 'type' : 'vec3' }, |
122 | 'texcoord' : { 'type' : 'vec2' } | 122 | 'texcoord' : { 'type' : 'vec2' } |
123 | }, | 123 | }, |
124 | // parameters | 124 | // parameters |
125 | 'params' : | 125 | 'params' : |
126 | { | 126 | { |
127 | 'u_time' : { 'type' : 'float' }, | 127 | 'u_time' : { 'type' : 'float' }, |
128 | 'u_speed' : { 'type' : 'float' }, | 128 | 'u_speed' : { 'type' : 'float' }, |
129 | 'u_resolution' : { 'type' : 'vec2' }, | 129 | 'u_resolution' : { 'type' : 'vec2' }, |
130 | }, | 130 | }, |
131 | 131 | ||
132 | // render states | 132 | // render states |
133 | 'states' : | 133 | 'states' : |
134 | { | 134 | { |
135 | 'depthEnable' : true, | 135 | 'depthEnable' : true, |
136 | 'offset':[1.0, 0.1] | 136 | 'offset':[1.0, 0.1] |
137 | } | 137 | } |
138 | } | 138 | } |
139 | ] | 139 | ] |
140 | } | 140 | } |
141 | }; | 141 | }; |
142 | 142 | ||
143 | JuliaMaterial.prototype = new PulseMaterial(); | 143 | JuliaMaterial.prototype = new PulseMaterial(); |