diff options
author | Nivesh Rajbhandari | 2012-03-13 13:05:33 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-13 13:05:33 -0700 |
commit | 92fc2e3c4bca2edb04102431b4959aafe022f329 (patch) | |
tree | d48c090f71ed2cd6bd6ce38ff68c36ab69299985 /js/helper-classes/backup-delete/Materials/FlatMaterial.js | |
parent | efb92cf52680d31f05fed3757e74862592cc2d4c (diff) | |
parent | f56b8cf4d3316d250c0f0045fb78f0dbd5c56e94 (diff) | |
download | ninja-92fc2e3c4bca2edb04102431b4959aafe022f329.tar.gz |
Merge branch 'refs/heads/ninja-internal' into ToolFixes
Diffstat (limited to 'js/helper-classes/backup-delete/Materials/FlatMaterial.js')
-rwxr-xr-x | js/helper-classes/backup-delete/Materials/FlatMaterial.js | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/js/helper-classes/backup-delete/Materials/FlatMaterial.js b/js/helper-classes/backup-delete/Materials/FlatMaterial.js index 570e7f9e..eb8970b8 100755 --- a/js/helper-classes/backup-delete/Materials/FlatMaterial.js +++ b/js/helper-classes/backup-delete/Materials/FlatMaterial.js | |||
@@ -40,19 +40,27 @@ function FlatMaterial() | |||
40 | // duplcate method requirde | 40 | // duplcate method requirde |
41 | this.dup = function() { return new FlatMaterial(); } ; | 41 | this.dup = function() { return new FlatMaterial(); } ; |
42 | 42 | ||
43 | this.init = function() | 43 | this.init = function( world ) |
44 | { | 44 | { |
45 | // set up the shader | 45 | // save the world |
46 | this._shader = new jshader(); | 46 | if (world) |
47 | this._shader.def = flatShaderDef; | 47 | { |
48 | this._shader.init(); | 48 | this.setWorld( world ); |
49 | |||
50 | // set up the shader | ||
51 | this._shader = new jshader(); | ||
52 | this._shader.def = flatShaderDef; | ||
53 | this._shader.init(); | ||
49 | 54 | ||
50 | // set the defaults | 55 | // set the defaults |
51 | this._shader.colorMe.color.set( this.getColor() ); | 56 | this._shader.colorMe.color.set( this.getColor() ); |
52 | 57 | ||
53 | // set up the material node | 58 | // set up the material node |
54 | this._materialNode = createMaterialNode("flatMaterial"); | 59 | this._materialNode = createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() ); |
55 | this._materialNode.setShader(this._shader); | 60 | this._materialNode.setShader(this._shader); |
61 | } | ||
62 | else | ||
63 | throw new Error( "GLWorld not supplied to material initialization" ); | ||
56 | }; | 64 | }; |
57 | 65 | ||
58 | 66 | ||
@@ -83,11 +91,7 @@ function FlatMaterial() | |||
83 | // this function should be overridden by subclasses | 91 | // this function should be overridden by subclasses |
84 | var exportStr = "material: " + this.getShaderName() + "\n"; | 92 | var exportStr = "material: " + this.getShaderName() + "\n"; |
85 | exportStr += "name: " + this.getName() + "\n"; | 93 | exportStr += "name: " + this.getName() + "\n"; |
86 | 94 | exportStr += "color: " + String(this._propValues["color"]) + "\n"; | |
87 | if (this._shader) | ||
88 | exportStr += "color: " + String(this._shader.colorMe.color) + "\n"; | ||
89 | else | ||
90 | exportStr += "color: " + this.getColor() + "\n"; | ||
91 | exportStr += "endMaterial\n"; | 95 | exportStr += "endMaterial\n"; |
92 | 96 | ||
93 | return exportStr; | 97 | return exportStr; |