diff options
author | Pushkar Joshi | 2012-03-13 11:36:11 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-03-13 11:36:11 -0700 |
commit | 6023f7c8258e660388ee33730601f1161f9299e9 (patch) | |
tree | 632484428b398f71b8481aa8e30180895ff2483c /js/helper-classes/backup-delete/Materials | |
parent | 76f2021618c0a6a99a1b855233e353e84ca99467 (diff) | |
parent | 4ad1650f629e7e345eade52ed6dadc233b27cc45 (diff) | |
download | ninja-6023f7c8258e660388ee33730601f1161f9299e9.tar.gz |
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/helper-classes/backup-delete/Materials')
22 files changed, 140 insertions, 55 deletions
diff --git a/js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js b/js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js index a7a3724e..52332ab8 100755 --- a/js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js +++ b/js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js | |||
@@ -65,7 +65,7 @@ function BumpMetalMaterial() | |||
65 | this.setProperty = function( prop, value ) | 65 | this.setProperty = function( prop, value ) |
66 | { | 66 | { |
67 | // every material should do something with the "color" property | 67 | // every material should do something with the "color" property |
68 | if (prop === "color") prop = "lightDiff"; | 68 | if (prop === "color") return; //prop = "lightDiff"; |
69 | 69 | ||
70 | // make sure we have legitimate imput | 70 | // make sure we have legitimate imput |
71 | var ok = this.validateProperty( prop, value ); | 71 | var ok = this.validateProperty( prop, value ); |
@@ -97,22 +97,27 @@ function BumpMetalMaterial() | |||
97 | this.init = function( world ) | 97 | this.init = function( world ) |
98 | { | 98 | { |
99 | // save the world | 99 | // save the world |
100 | if (world) this.setWorld( world ); | 100 | if (world) |
101 | 101 | { | |
102 | // set up the shader | 102 | this.setWorld( world ); |
103 | this._shader = new jshader(); | 103 | |
104 | this._shader.def = bumpMetalMaterialDef; | 104 | // set up the shader |
105 | this._shader.init(); | 105 | this._shader = new jshader(); |
106 | this._shader.default.u_light0Diff.set( this.getLightDiff() ); | 106 | this._shader.def = bumpMetalMaterialDef; |
107 | 107 | this._shader.init(); | |
108 | // set up the material node | 108 | this._shader.default.u_light0Diff.set( this.getLightDiff() ); |
109 | this._materialNode = createMaterialNode( this.getShaderName() ); | 109 | |
110 | this._materialNode.setShader(this._shader); | 110 | // set up the material node |
111 | 111 | this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); | |
112 | // set some image maps | 112 | this._materialNode.setShader(this._shader); |
113 | this.updateTexture(1); | 113 | |
114 | this.updateTexture(2); | 114 | // set some image maps |
115 | this.updateTexture(3); | 115 | this.updateTexture(1); |
116 | this.updateTexture(2); | ||
117 | this.updateTexture(3); | ||
118 | } | ||
119 | else | ||
120 | throw new Error( "GLWorld not supplied to material initialization" ); | ||
116 | }; | 121 | }; |
117 | 122 | ||
118 | this.updateTexture = function( index ) | 123 | this.updateTexture = function( index ) |
diff --git a/js/helper-classes/backup-delete/Materials/DeformMaterial.js b/js/helper-classes/backup-delete/Materials/DeformMaterial.js index ddc97383..b7101227 100644 --- a/js/helper-classes/backup-delete/Materials/DeformMaterial.js +++ b/js/helper-classes/backup-delete/Materials/DeformMaterial.js | |||
@@ -71,7 +71,7 @@ function DeformMaterial() | |||
71 | this._shader.init(); | 71 | this._shader.init(); |
72 | 72 | ||
73 | // set up the material node | 73 | // set up the material node |
74 | this._materialNode = createMaterialNode("deformMaterial"); | 74 | this._materialNode = createMaterialNode("deformMaterial_" + world.generateUniqueNodeID()); |
75 | this._materialNode.setShader(this._shader); | 75 | this._materialNode.setShader(this._shader); |
76 | 76 | ||
77 | this._time = 0; | 77 | this._time = 0; |
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; |
diff --git a/js/helper-classes/backup-delete/Materials/FlyMaterial.js b/js/helper-classes/backup-delete/Materials/FlyMaterial.js index 4a44e2e5..a70b53e8 100644 --- a/js/helper-classes/backup-delete/Materials/FlyMaterial.js +++ b/js/helper-classes/backup-delete/Materials/FlyMaterial.js | |||
@@ -71,7 +71,7 @@ function FlyMaterial() | |||
71 | this._shader.init(); | 71 | this._shader.init(); |
72 | 72 | ||
73 | // set up the material node | 73 | // set up the material node |
74 | this._materialNode = createMaterialNode("flyMaterial"); | 74 | this._materialNode = createMaterialNode("flyMaterial_" + world.generateUniqueNodeID()); |
75 | this._materialNode.setShader(this._shader); | 75 | this._materialNode.setShader(this._shader); |
76 | 76 | ||
77 | this._time = 0; | 77 | this._time = 0; |
diff --git a/js/helper-classes/backup-delete/Materials/JuliaMaterial.js b/js/helper-classes/backup-delete/Materials/JuliaMaterial.js index f95263f4..9b5d588c 100644 --- a/js/helper-classes/backup-delete/Materials/JuliaMaterial.js +++ b/js/helper-classes/backup-delete/Materials/JuliaMaterial.js | |||
@@ -73,7 +73,7 @@ function JuliaMaterial() | |||
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 = createMaterialNode("juliaMaterial"); | 76 | this._materialNode = 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; |
diff --git a/js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js b/js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js index 1547aca9..af7ce97c 100644 --- a/js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js +++ b/js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js | |||
@@ -71,7 +71,7 @@ function KeleidoscopeMaterial() | |||
71 | this._shader.init(); | 71 | this._shader.init(); |
72 | 72 | ||
73 | // set up the material node | 73 | // set up the material node |
74 | this._materialNode = createMaterialNode("keleidoscopeMaterial"); | 74 | this._materialNode = createMaterialNode("keleidoscopeMaterial_" + world.generateUniqueNodeID()); |
75 | this._materialNode.setShader(this._shader); | 75 | this._materialNode.setShader(this._shader); |
76 |