final double currSize = values[VAL_CURRENT_SIZE];
if (type == ParticleSystem.ParticleType.GeomMesh || type == ParticleSystem.ParticleType.Point) {
; // nothing to do
} else if (cam != null && parent.isCameraFacing()) {
final ReadOnlyVector3 camUp = cam.getUp();
final ReadOnlyVector3 camLeft = cam.getLeft();
final ReadOnlyVector3 camDir = cam.getDirection();
if (parent.isVelocityAligned()) {
bbX.set(_velocity).normalizeLocal().multiplyLocal(currSize);
camDir.cross(bbX, bbY).normalizeLocal().multiplyLocal(currSize);
} else if (orient == 0) {
bbX.set(camLeft).multiplyLocal(currSize);
bbY.set(camUp).multiplyLocal(currSize);
} else {
final double cA = MathUtils.cos(orient) * currSize;
final double sA = MathUtils.sin(orient) * currSize;
bbX.set(camLeft).multiplyLocal(cA).addLocal(camUp.getX() * sA, camUp.getY() * sA, camUp.getZ() * sA);
bbY.set(camLeft).multiplyLocal(-sA).addLocal(camUp.getX() * cA, camUp.getY() * cA, camUp.getZ() * cA);
}
} else {
final ReadOnlyVector3 left = parent.getFacingLeftVector();
final ReadOnlyVector3 up = parent.getFacingUpVector();
if (parent.isVelocityAligned()) {
bbX.set(_velocity).normalizeLocal().multiplyLocal(currSize);
up.cross(bbX, bbY).normalizeLocal().multiplyLocal(currSize);
} else if (orient == 0) {
bbX.set(left).multiplyLocal(currSize);
bbY.set(up).multiplyLocal(currSize);
} else {
final double cA = MathUtils.cos(orient) * currSize;
final double sA = MathUtils.sin(orient) * currSize;
bbX.set(left).multiplyLocal(cA).addLocal(up.getX() * sA, up.getY() * sA, up.getZ() * sA);
bbY.set(left).multiplyLocal(-sA).addLocal(up.getX() * cA, up.getY() * cA, up.getZ() * cA);
}
}
final Vector3 tempVec3 = Vector3.fetchTempInstance();
final FloatBuffer vertexBuffer = parent.getParticleGeometry().getMeshData().getVertexBuffer();
switch (type) {
case Quad: {
_position.subtract(bbX, tempVec3).subtractLocal(bbY);
BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 0);
_position.subtract(bbX, tempVec3).addLocal(bbY);
BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 1);
_position.add(bbX, tempVec3).addLocal(bbY);
BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 2);
_position.add(bbX, tempVec3).subtractLocal(bbY);
BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 3);
break;
}
case GeomMesh: {
final Quaternion tempQuat = Quaternion.fetchTempInstance();
final ReadOnlyVector3 norm = triModel.getNormal();
if (orient != 0) {
tempQuat.fromAngleNormalAxis(orient, norm);
}
for (int x = 0; x < 3; x++) {