aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/shape-primitive.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/geom/shape-primitive.js')
-rw-r--r--js/lib/geom/shape-primitive.js27
1 files changed, 1 insertions, 26 deletions
diff --git a/js/lib/geom/shape-primitive.js b/js/lib/geom/shape-primitive.js
index 858f38c8..380cf334 100644
--- a/js/lib/geom/shape-primitive.js
+++ b/js/lib/geom/shape-primitive.js
@@ -49,7 +49,7 @@ ShapePrimitive.create = function(coords, normals, uvs, indices, primType, ver
49 return prim; 49 return prim;
50}; 50};
51 51
52ShapePrimitive.getBounds = function( prim ) 52ShapePrimitive.getMeshBounds = function( verts, nVerts )
53{ 53{
54 if (!verts || (nVerts <= 0)) return null; 54 if (!verts || (nVerts <= 0)) return null;
55 55
@@ -76,31 +76,6 @@ ShapePrimitive.refineMesh = function( verts, norms, uvs, indices, nVertices, pa
76 var oldVrtCount = nVertices; 76 var oldVrtCount = nVertices;
77 77
78 // get the param range 78 // get the param range
79 var verts = prim.bufferStreams[0];
80 var nVerts = verts.length;
81 var xMin = verts[0], xMax = verts[0],
82 yMin = verts[1], yMax = verts[1],
83 zMin = verts[2], zMax = verts[2];
84
85 for (var index=3; index<verts.length; )
86 {
87 if (verts[index] < xMin) xMin = verts[index];
88 else if (verts[index] > xMax) xMax = verts[index];
89
90 index++;
91 if (verts[index] < yMin) yMin = verts[index];
92 else if (verts[index] > yMax) yMax = verts[index];
93
94 index++;
95 if (verts[index] < zMin) zMin = verts[index];
96 else if (verts[index] > zMax) zMax = verts[index];
97
98 index++;
99 }
100
101 return [xMin, yMin, zMin, xMax, yMax, zMax];
102};
103
104 var pUMin = paramRange[0], pVMin = paramRange[1], 79 var pUMin = paramRange[0], pVMin = paramRange[1],
105 pUMax = paramRange[2], pVMax = paramRange[3]; 80 pUMax = paramRange[2], pVMax = paramRange[3];
106 var iTriangle = 0; 81 var iTriangle = 0;