aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/geom')
-rwxr-xr-xjs/lib/geom/rectangle.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js
index 51947ff1..f41c27f6 100755
--- a/js/lib/geom/rectangle.js
+++ b/js/lib/geom/rectangle.js
@@ -1280,11 +1280,41 @@ RectangleGeometry.pushIndices = RectangleFill.pushIndices;
1280RectangleGeometry.getVertex = RectangleFill.getVertex; 1280RectangleGeometry.getVertex = RectangleFill.getVertex;
1281RectangleGeometry.getUV = RectangleFill.getUV; 1281RectangleGeometry.getUV = RectangleFill.getUV;
1282 1282
1283RectangleGeometry.init = function()
1284{
1285 this.vertices = [];
1286 this.normals = [];
1287 this.uvs = [];
1288 this.indices = [];
1289}
1290
1291RectangleGeometry.addQuad = function( verts, normals, uvs )
1292{
1293 for (var i=0; i<4; i++)
1294 {
1295 RectangleGeometry.pushVertex( verts[i][0], verts[i][1], verts[i][2]);
1296 RectangleGeometry.pushNormal( normals[i] );
1297 RectangleGeometry.pushUV( uvs[i] );
1298 }
1299
1300 RectangleGeometry.pushIndices( 0, 1, 2 );
1301 RectangleGeometry.pushIndices( 2, 3, 0 );
1302}
1303
1304RectangleGeometry.buildPrimitive = function()
1305{
1306 var nVertices = this.vertices.length;
1307 return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices);
1308}
1309
1310
1311
1283 1312
1284Rectangle.prototype = new GeomObj(); 1313Rectangle.prototype = new GeomObj();
1285 1314
1286if (typeof exports === "object") { 1315if (typeof exports === "object") {
1287 exports.Rectangle = Rectangle; 1316 exports.Rectangle = Rectangle;
1317 exports.RectangleGeometry = RectangleGeometry;
1288} 1318}
1289 1319
1290 1320