diff options
author | John Mayhew | 2012-04-02 16:28:39 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-02 16:28:39 -0700 |
commit | b4155fb4c33675a8a7cd37473513718043fdf0ba (patch) | |
tree | 3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/lib/rdge/materials/twist-vert-material.js | |
parent | 5ba9aeac94c86049423fd5d4b37b277263939c13 (diff) | |
parent | c6de22bf42be90b403491b5f87b1818d9020310c (diff) | |
download | ninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/helper-classes/RDGE/rdge-compiled.js
js/helper-classes/RDGE/runtime/GLRuntime.js
js/helper-classes/RDGE/src/core/script/MeshManager.js
js/helper-classes/RDGE/src/core/script/engine.js
js/helper-classes/RDGE/src/core/script/fx/ssao.js
js/helper-classes/RDGE/src/core/script/init_state.js
js/helper-classes/RDGE/src/core/script/run_state.js
js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
js/helper-classes/RDGE/src/core/script/utilities.js
js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
js/helper-classes/RDGE/src/tools/rdge-compiled.js
js/lib/drawing/world.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-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/linear-gradient-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-blur-material.js
js/lib/rdge/materials/radial-gradient-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
js/preloader/Preloader.js
Diffstat (limited to 'js/lib/rdge/materials/twist-vert-material.js')
-rw-r--r-- | js/lib/rdge/materials/twist-vert-material.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/js/lib/rdge/materials/twist-vert-material.js b/js/lib/rdge/materials/twist-vert-material.js index 1f7b06b1..9af1953d 100644 --- a/js/lib/rdge/materials/twist-vert-material.js +++ b/js/lib/rdge/materials/twist-vert-material.js | |||
@@ -46,8 +46,10 @@ function TwistVertMaterial() | |||
46 | // duplcate method requirde | 46 | // duplcate method requirde |
47 | this.dup = function() { return new TwistVertMaterial(); } | 47 | this.dup = function() { return new TwistVertMaterial(); } |
48 | 48 | ||
49 | this.init = function() | 49 | this.init = function( world ) |
50 | { | 50 | { |
51 | this.setWorld( world ); | ||
52 | |||
51 | // set up the shader | 53 | // set up the shader |
52 | this._shader = new RDGE.jshader(); | 54 | this._shader = new RDGE.jshader(); |
53 | this._shader.def = twistVertShaderDef; | 55 | this._shader.def = twistVertShaderDef; |
@@ -57,7 +59,7 @@ function TwistVertMaterial() | |||
57 | this._shader.twistMe.color.set( this.getColor() ); | 59 | this._shader.twistMe.color.set( this.getColor() ); |
58 | 60 | ||
59 | // set up the material node | 61 | // set up the material node |
60 | this._materialNode = RDGE.createMaterialNode("twistVertMaterial"); | 62 | this._materialNode = RDGE.createMaterialNode("twistVertMaterial" + "_" + world.generateUniqueNodeID()); |
61 | this._materialNode.setShader(this._shader); | 63 | this._materialNode.setShader(this._shader); |
62 | 64 | ||
63 | // initialize the twist vert properties | 65 | // initialize the twist vert properties |
@@ -100,6 +102,34 @@ function TwistVertMaterial() | |||
100 | } | 102 | } |
101 | /////////////////////////////////////////////////////////////////////// | 103 | /////////////////////////////////////////////////////////////////////// |
102 | 104 | ||
105 | this.exportJSON = function() | ||
106 | { | ||
107 | var jObj = | ||
108 | { | ||
109 | 'material' : this.getShaderName(), | ||
110 | 'name' : this.getName(), | ||
111 | 'color' : this._propValues["color"] | ||
112 | }; | ||
113 | |||
114 | return jObj; | ||
115 | } | ||
116 | |||
117 | this.importJSON = function( jObj ) | ||
118 | { | ||
119 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
120 | this.setName( jObj.name ); | ||
121 | |||
122 | try | ||
123 | { | ||
124 | var color = jObj.color; | ||
125 | this.setProperty( "color", color); | ||
126 | } | ||
127 | catch (e) | ||
128 | { | ||
129 | throw new Error( "could not import material: " + importStr ); | ||
130 | } | ||
131 | } | ||
132 | |||
103 | this.export = function() | 133 | this.export = function() |
104 | { | 134 | { |
105 | // this function should be overridden by subclasses | 135 | // this function should be overridden by subclasses |