Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers
colors.rewind();
sizes.rewind();
texcoords.rewind();

for (int i = 0; i < particles.length; i++) {
Particle p = particles[i];

Expand All @@ -153,6 +154,7 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers

texcoords.put(startX).put(startY).put(endX).put(endY);
}

positions.flip();
colors.flip();
sizes.flip();
Expand Down
15 changes: 9 additions & 6 deletions jme3-core/src/main/java/com/jme3/effect/ParticleTriMesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers

boolean facingVelocity = emitter.isFacingVelocity();

Vector3f up = new Vector3f(),
left = new Vector3f();
Vector3f up = new Vector3f();
Vector3f left = new Vector3f();

if (!facingVelocity) {
up.set(camUp);
Expand All @@ -189,6 +189,7 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers
for (int i = 0; i < particles.length; i++) {
Particle p = particles[i];
boolean dead = p.life == 0;

if (dead) {
positions.put(0).put(0).put(0);
positions.put(0).put(0).put(0);
Expand All @@ -202,11 +203,13 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers
camDir.cross(left, up);
up.multLocal(p.size);
left.multLocal(p.size);

} else if (faceNormal != null) {
up.set(faceNormal).crossLocal(Vector3f.UNIT_X);
faceNormal.cross(up, left);
up.multLocal(p.size);
left.multLocal(p.size);

if (p.angle != 0) {
TempVars vars = TempVars.get();
vars.vect1.set(faceNormal).normalizeLocal();
Expand All @@ -226,6 +229,7 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers
up.x = camLeft.x * -sin + camUp.x * cos;
up.y = camLeft.y * -sin + camUp.y * cos;
up.z = camLeft.z * -sin + camUp.z * cos;

} else {
up.set(camUp);
left.set(camLeft);
Expand Down Expand Up @@ -273,10 +277,9 @@ public void updateParticleData(Particle[] particles, Camera cam, Matrix3f invers

positions.clear();
colors.clear();
if (!uniqueTexCoords)
texcoords.clear();
else {
texcoords.clear();
texcoords.clear();

if (uniqueTexCoords) {
tvb.updateData(texcoords);
}

Expand Down