* The bounding box will compute faster, maybe even more faster on Android .. If its bad, please go ahead and complain
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9548 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
7825249952
commit
d46ee26002
@ -222,12 +222,20 @@ public class BoundingBox extends BoundingVolume {
|
||||
|
||||
TempVars vars = TempVars.get();
|
||||
|
||||
BufferUtils.populateFromBuffer(vars.vect1, points, 0);
|
||||
float minX = vars.vect1.x, minY = vars.vect1.y, minZ = vars.vect1.z;
|
||||
float maxX = vars.vect1.x, maxY = vars.vect1.y, maxZ = vars.vect1.z;
|
||||
float[] tmpArray = vars.skinPositions;
|
||||
|
||||
for (int i = 1, len = points.remaining() / 3; i < len; i++) {
|
||||
BufferUtils.populateFromBuffer(vars.vect1, points, i);
|
||||
float minX = Float.MAX_VALUE, minY = Float.MAX_VALUE, minZ = Float.MAX_VALUE;
|
||||
float maxX = Float.MIN_VALUE, maxY = Float.MIN_VALUE, maxZ = Float.MIN_VALUE;
|
||||
|
||||
int iterations = (int) FastMath.ceil(points.limit() / ((float) tmpArray.length));
|
||||
for (int i = iterations - 1; i >= 0; i--) {
|
||||
int bufLength = Math.min(tmpArray.length, points.remaining());
|
||||
points.get(tmpArray, 0, bufLength);
|
||||
|
||||
for (int j = 0; j < bufLength; j += 3) {
|
||||
vars.vect1.x = tmpArray[j];
|
||||
vars.vect1.y = tmpArray[j+1];
|
||||
vars.vect1.z = tmpArray[j+2];
|
||||
|
||||
if (vars.vect1.x < minX) {
|
||||
minX = vars.vect1.x;
|
||||
@ -247,6 +255,7 @@ public class BoundingBox extends BoundingVolume {
|
||||
maxZ = vars.vect1.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vars.release();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user