diff options
author | Eric Guzman | 2012-03-13 13:12:43 -0700 |
---|---|---|
committer | Eric Guzman | 2012-03-13 13:12:43 -0700 |
commit | 61fd46cad105f0a52afa028e5301b96120f00ab4 (patch) | |
tree | d8a7e23e1ea7d9b5c64a288822b7797bb19e50d4 /js/helper-classes/backup-delete/Materials/FlatMaterial.js | |
parent | 7e3161153b87b891875ac65368a19aed12909fa3 (diff) | |
parent | f56b8cf4d3316d250c0f0045fb78f0dbd5c56e94 (diff) | |
download | ninja-61fd46cad105f0a52afa028e5301b96120f00ab4.tar.gz |
Merge branch 'refs/heads/master' into CSSPanelUpdates
Conflicts:
js/controllers/styles-controller.js
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; |