diff options
Diffstat (limited to 'js/lib/geom')
-rwxr-xr-x | js/lib/geom/rectangle.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index d4dd8033..70f6b01b 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js | |||
@@ -1294,6 +1294,7 @@ RectangleGeometry.init = function() | |||
1294 | 1294 | ||
1295 | RectangleGeometry.addQuad = function( verts, normals, uvs ) | 1295 | RectangleGeometry.addQuad = function( verts, normals, uvs ) |
1296 | { | 1296 | { |
1297 | var offset = this.vertices.length/3; | ||
1297 | for (var i=0; i<4; i++) | 1298 | for (var i=0; i<4; i++) |
1298 | { | 1299 | { |
1299 | RectangleGeometry.pushVertex( verts[i][0], verts[i][1], verts[i][2]); | 1300 | RectangleGeometry.pushVertex( verts[i][0], verts[i][1], verts[i][2]); |
@@ -1301,13 +1302,13 @@ RectangleGeometry.addQuad = function( verts, normals, uvs ) | |||
1301 | RectangleGeometry.pushUV( uvs[i] ); | 1302 | RectangleGeometry.pushUV( uvs[i] ); |
1302 | } | 1303 | } |
1303 | 1304 | ||
1304 | RectangleGeometry.pushIndices( 0, 1, 2 ); | 1305 | RectangleGeometry.pushIndices( 0+offset, 1+offset, 2+offset ); |
1305 | RectangleGeometry.pushIndices( 2, 3, 0 ); | 1306 | RectangleGeometry.pushIndices( 2+offset, 3+offset, 0+offset ); |
1306 | } | 1307 | } |
1307 | 1308 | ||
1308 | RectangleGeometry.buildPrimitive = function() | 1309 | RectangleGeometry.buildPrimitive = function() |
1309 | { | 1310 | { |
1310 | var nVertices = this.vertices.length; | 1311 | var nVertices = this.vertices.length/3; |
1311 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 1312 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); |
1312 | } | 1313 | } |
1313 | 1314 | ||