diff options
author | Pushkar Joshi | 2012-04-06 12:13:59 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-04-06 12:13:59 -0700 |
commit | 6cce5e9367676f5b452c28dd7d960aa46f4e464c (patch) | |
tree | 779125b7c1fc668c02e0dfbb661494a16242c329 /js/lib/geom/line.js | |
parent | f61545fd7054088efc88aafffd78e11df80d750d (diff) | |
parent | 7656b6eac7aec59697c6cddbe2a507fe9e4aa187 (diff) | |
download | ninja-6cce5e9367676f5b452c28dd7d960aa46f4e464c.tar.gz |
Merge branch 'master' into pentool
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-x | js/lib/geom/line.js | 74 |
1 files changed, 2 insertions, 72 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js index e839e229..1b2dd4fc 100755 --- a/js/lib/geom/line.js +++ b/js/lib/geom/line.js | |||
@@ -140,76 +140,6 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok | |||
140 | this.importMaterialsJSON( jObj.materials ); | 140 | this.importMaterialsJSON( jObj.materials ); |
141 | }; | 141 | }; |
142 | 142 | ||
143 | this.export = function() { | ||
144 | var rtnStr = "type: " + this.geomType() + "\n"; | ||
145 | |||
146 | rtnStr += "xoff: " + this._xOffset + "\n"; | ||
147 | rtnStr += "yoff: " + this._yOffset + "\n"; | ||
148 | rtnStr += "width: " + this._width + "\n"; | ||
149 | rtnStr += "height: " + this._height + "\n"; | ||
150 | rtnStr += "xAdj: " + this._xAdj + "\n"; | ||
151 | rtnStr += "yAdj: " + this._yAdj + "\n"; | ||
152 | rtnStr += "strokeWidth: " + this._strokeWidth + "\n"; | ||
153 | |||
154 | if(this._strokeColor.gradientMode) { | ||
155 | rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n"; | ||
156 | rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n"; | ||
157 | } else { | ||
158 | rtnStr += "strokeColor: " + String(this._strokeColor) + "\n"; | ||
159 | } | ||
160 | |||
161 | rtnStr += "strokeStyle: " + this._strokeStyle + "\n"; | ||
162 | rtnStr += "slope: " + String(this._slope) + "\n"; | ||
163 | |||
164 | rtnStr += "strokeMat: "; | ||
165 | if (this._strokeMaterial) { | ||
166 | rtnStr += this._strokeMaterial.getName(); | ||
167 | } else { | ||
168 | rtnStr += MaterialsModel.getDefaultMaterialName(); | ||
169 | } | ||
170 | |||
171 | rtnStr += "\n"; | ||
172 | return rtnStr; | ||
173 | }; | ||
174 | |||
175 | this.import = function( importStr ) { | ||
176 | this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) ); | ||
177 | this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) ); | ||
178 | this._width = Number( this.getPropertyFromString( "width: ", importStr ) ); | ||
179 | this._height = Number( this.getPropertyFromString( "height: ", importStr ) ); | ||
180 | this._xAdj = Number( this.getPropertyFromString( "xAdj: ", importStr ) ); | ||
181 | this._yAdj = Number( this.getPropertyFromString( "yAdj: ", importStr ) ); | ||
182 | this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); | ||
183 | var slope = this.getPropertyFromString( "slope: ", importStr ); | ||
184 | |||
185 | if(isNaN(Number(slope))) { | ||
186 | this._slope = slope; | ||
187 | } else { | ||
188 | this._slope = Number(slope); | ||
189 | } | ||
190 | |||
191 | var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); | ||
192 | this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); | ||
193 | |||
194 | if(importStr.indexOf("strokeGradientMode: ") < 0) | ||
195 | { | ||
196 | this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); | ||
197 | } else { | ||
198 | this._strokeColor = {}; | ||
199 | this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr ); | ||
200 | this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr )); | ||
201 | } | ||
202 | |||
203 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); | ||
204 | if (!strokeMat) { | ||
205 | console.log( "object material not found in library: " + strokeMaterialName ); | ||
206 | strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | ||
207 | } | ||
208 | |||
209 | this._strokeMaterial = strokeMat; | ||
210 | |||
211 | }; | ||
212 | |||
213 | /////////////////////////////////////////////////////////////////////// | 143 | /////////////////////////////////////////////////////////////////////// |
214 | // Methods | 144 | // Methods |
215 | /////////////////////////////////////////////////////////////////////// | 145 | /////////////////////////////////////////////////////////////////////// |
@@ -220,7 +150,7 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok | |||
220 | if (!world._useWebGL) return; | 150 | if (!world._useWebGL) return; |
221 | 151 | ||
222 | // make sure RDGE has the correct context | 152 | // make sure RDGE has the correct context |
223 | g_Engine.setContext( world.getCanvas().rdgeid ); | 153 | RDGE.globals.engine.setContext( world.getCanvas().rdgeid ); |
224 | 154 | ||
225 | // create the gl buffer | 155 | // create the gl buffer |
226 | var gl = world.getGLContext(); | 156 | var gl = world.getGLContext(); |
@@ -381,7 +311,7 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok | |||
381 | indices.push( index ); index++; | 311 | indices.push( index ); index++; |
382 | } | 312 | } |
383 | 313 | ||
384 | var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, g_Engine.getContext().renderer.TRIANGLES, indices.length); | 314 | var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length); |
385 | 315 | ||
386 | var strokeMaterial = this.makeStrokeMaterial(); | 316 | var strokeMaterial = this.makeStrokeMaterial(); |
387 | 317 | ||