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/taper-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/taper-material.js')
-rw-r--r-- | js/lib/rdge/materials/taper-material.js | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/js/lib/rdge/materials/taper-material.js b/js/lib/rdge/materials/taper-material.js index 7feea79a..e59b6112 100644 --- a/js/lib/rdge/materials/taper-material.js +++ b/js/lib/rdge/materials/taper-material.js | |||
@@ -42,8 +42,10 @@ function TaperMaterial() | |||
42 | // duplcate method requirde | 42 | // duplcate method requirde |
43 | this.dup = function() { return new TaperMaterial(); } | 43 | this.dup = function() { return new TaperMaterial(); } |
44 | 44 | ||
45 | this.init = function() | 45 | this.init = function( world ) |
46 | { | 46 | { |
47 | this.setWorld( world ); | ||
48 | |||
47 | // set up the shader | 49 | // set up the shader |
48 | this._shader = new RDGE.jshader(); | 50 | this._shader = new RDGE.jshader(); |
49 | this._shader.def = taperShaderDef; | 51 | this._shader.def = taperShaderDef; |
@@ -53,7 +55,7 @@ function TaperMaterial() | |||
53 | this._shader.colorMe.color.set( this.getColor() ); | 55 | this._shader.colorMe.color.set( this.getColor() ); |
54 | 56 | ||
55 | // set up the material node | 57 | // set up the material node |
56 | this._materialNode = RDGE.createMaterialNode("taperMaterial"); | 58 | this._materialNode = RDGE.createMaterialNode("taperMaterial" + "_" + world.generateUniqueNodeID()); |
57 | this._materialNode.setShader(this._shader); | 59 | this._materialNode.setShader(this._shader); |
58 | 60 | ||
59 | // initialize the taper properties | 61 | // initialize the taper properties |
@@ -94,6 +96,33 @@ function TaperMaterial() | |||
94 | } | 96 | } |
95 | } | 97 | } |
96 | /////////////////////////////////////////////////////////////////////// | 98 | /////////////////////////////////////////////////////////////////////// |
99 | this.exportJSON = function() | ||
100 | { | ||
101 | var jObj = | ||
102 | { | ||
103 | 'material' : this.getShaderName(), | ||
104 | 'name' : this.getName(), | ||
105 | 'color' : this._propValues["color"] | ||
106 | }; | ||
107 | |||
108 | return jObj; | ||
109 | } | ||
110 | |||
111 | this.importJSON = function( jObj ) | ||
112 | { | ||
113 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
114 | this.setName( jObj.name ); | ||
115 | |||
116 | try | ||
117 | { | ||
118 | var color = jObj.color; | ||
119 | this.setProperty( "color", color); | ||
120 | } | ||
121 | catch (e) | ||
122 | { | ||
123 | throw new Error( "could not import material: " + jObj ); | ||
124 | } | ||
125 | } | ||
97 | 126 | ||
98 | this.export = function() | 127 | this.export = function() |
99 | { | 128 | { |
@@ -102,7 +131,7 @@ function TaperMaterial() | |||
102 | exportStr += "name: " + this.getName() + "\n"; | 131 | exportStr += "name: " + this.getName() + "\n"; |
103 | 132 | ||
104 | if (this._shader) | 133 | if (this._shader) |
105 | exportStr += "color: " + String(this._shader.colorMe.color) + "\n"; | 134 | exportStr += "color: " + this._shader.colorMe.color + "\n"; |
106 | else | 135 | else |
107 | exportStr += "color: " + this.getColor() + "\n"; | 136 | exportStr += "color: " + this.getColor() + "\n"; |
108 | exportStr += "endMaterial\n"; | 137 | exportStr += "endMaterial\n"; |