diff options
author | hwc487 | 2012-03-22 15:47:11 -0700 |
---|---|---|
committer | hwc487 | 2012-03-22 15:47:11 -0700 |
commit | e927e4702d7dbd4a878f6979b3f56b46758f93de (patch) | |
tree | e6bb8951374a6504bd6c745ce7233da5cd4869dc /js/lib/rdge/materials/pulse-material.js | |
parent | 00cd98e49c959906d7c44bb6adcdef1f3d5148ae (diff) | |
parent | 31e924e1b8b8da8342b3ff2341c8284915486c0b (diff) | |
download | ninja-e927e4702d7dbd4a878f6979b3f56b46758f93de.tar.gz |
Merge branch 'integration' of github.com:ericmueller/ninja-internal into Textures
Diffstat (limited to 'js/lib/rdge/materials/pulse-material.js')
-rw-r--r-- | js/lib/rdge/materials/pulse-material.js | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js index 81db36c6..2075d1ff 100644 --- a/js/lib/rdge/materials/pulse-material.js +++ b/js/lib/rdge/materials/pulse-material.js | |||
@@ -125,18 +125,6 @@ var PulseMaterial = function PulseMaterial() { | |||
125 | var texMapName = this._propValues[this._propNames[0]]; | 125 | var texMapName = this._propValues[this._propNames[0]]; |
126 | var wrap = 'REPEAT', mips = true; | 126 | var wrap = 'REPEAT', mips = true; |
127 | var tex = this.loadTexture( texMapName, wrap, mips ); | 127 | var tex = this.loadTexture( texMapName, wrap, mips ); |
128 | |||
129 | /* | ||
130 | var glTex = new GLTexture( this.getWorld() ); | ||
131 | var prevWorld = this.findPreviousWorld(); | ||
132 | if (prevWorld) | ||
133 | { | ||
134 | var srcCanvas = prevWorld.getCanvas(); | ||
135 | tex = glTex.loadFromCanvas( srcCanvas ); | ||
136 | } | ||
137 | else | ||
138 | tex = glTex.loadFromFile( texMapName, wrap, mips ); | ||
139 | */ | ||
140 | 128 | ||
141 | if (tex) { | 129 | if (tex) { |
142 | technique.u_tex0.set( tex ); | 130 | technique.u_tex0.set( tex ); |
@@ -174,6 +162,38 @@ var PulseMaterial = function PulseMaterial() { | |||
174 | } | 162 | } |
175 | }; | 163 | }; |
176 | 164 | ||
165 | // JSON export | ||
166 | this.exportJSON = function() | ||
167 | { | ||
168 | var jObj = | ||
169 | { | ||
170 | 'material' : this.getShaderName(), | ||
171 | 'name' : this.getName(), | ||
172 | 'texture' : this._propValues[this._propNames[0]], | ||
173 | 'dTime' : this._dTime | ||
174 | }; | ||
175 | |||
176 | return jObj; | ||
177 | }; | ||
178 | |||
179 | this.importJSON = function( jObj ) | ||
180 | { | ||
181 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
182 | this.setName( jObj.name ); | ||
183 | |||
184 | try { | ||
185 | this._propValues[this._propNames[0]] = jObj.texture; | ||
186 | this._texMap = jObj.texture; | ||
187 | if (jObj.dTime) | ||
188 | this._dTime = jObj.dTime; | ||
189 | } | ||
190 | catch (e) | ||
191 | { | ||
192 | throw new Error( "could not import material: " + jObj ); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | |||
177 | this.export = function() { | 197 | this.export = function() { |
178 | // every material needs the base type and instance name | 198 | // every material needs the base type and instance name |
179 | var exportStr = "material: " + this.getShaderName() + "\n"; | 199 | var exportStr = "material: " + this.getShaderName() + "\n"; |