Skip to content

Commit 70c8a10

Browse files
authored
Merge branch 'master' into platform
2 parents 93f75bc + 8751505 commit 70c8a10

15 files changed

Lines changed: 735 additions & 306 deletions

File tree

jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
import java.io.IOException;
5353

5454
/**
55-
* A MotionEvent is a control over the spatial that manages the position and direction of the spatial while following a motion Path.
56-
*
55+
* A MotionEvent is a control over the spatial that manages
56+
* the position and direction of the spatial while following a motion Path.
5757
* You must first create a MotionPath and then create a MotionEvent to associate a spatial and the path.
5858
*
5959
* @author Nehon
@@ -70,6 +70,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
7070
protected Direction directionType = Direction.None;
7171
protected MotionPath path;
7272
private boolean isControl = true;
73+
private final Quaternion tempRotation = new Quaternion();
7374
/**
7475
* the distance traveled by the spatial on the path
7576
*/
@@ -79,7 +80,6 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC
7980
* Enum for the different type of target direction behavior.
8081
*/
8182
public enum Direction {
82-
8383
/**
8484
* The target stays in the starting direction.
8585
*/
@@ -229,13 +229,13 @@ public void write(JmeExporter ex) throws IOException {
229229
@Override
230230
public void read(JmeImporter im) throws IOException {
231231
super.read(im);
232-
InputCapsule in = im.getCapsule(this);
233-
lookAt = (Vector3f) in.readSavable("lookAt", null);
234-
upVector = (Vector3f) in.readSavable("upVector", Vector3f.UNIT_Y);
235-
rotation = (Quaternion) in.readSavable("rotation", null);
236-
directionType = in.readEnum("directionType", Direction.class, Direction.None);
237-
path = (MotionPath) in.readSavable("path", null);
238-
spatial = (Spatial) in.readSavable("spatial", null);
232+
InputCapsule ic = im.getCapsule(this);
233+
lookAt = (Vector3f) ic.readSavable("lookAt", null);
234+
upVector = (Vector3f) ic.readSavable("upVector", Vector3f.UNIT_Y);
235+
rotation = (Quaternion) ic.readSavable("rotation", null);
236+
directionType = ic.readEnum("directionType", Direction.class, Direction.None);
237+
path = (MotionPath) ic.readSavable("path", null);
238+
spatial = (Spatial) ic.readSavable("spatial", null);
239239
}
240240

241241
/**
@@ -249,9 +249,8 @@ public boolean needsDirection() {
249249
private void computeTargetDirection() {
250250
switch (directionType) {
251251
case Path:
252-
Quaternion q = new Quaternion();
253-
q.lookAt(direction, upVector);
254-
spatial.setLocalRotation(q);
252+
tempRotation.lookAt(direction, upVector);
253+
spatial.setLocalRotation(tempRotation);
255254
break;
256255
case LookAt:
257256
if (lookAt != null) {
@@ -260,10 +259,9 @@ private void computeTargetDirection() {
260259
break;
261260
case PathAndRotation:
262261
if (rotation != null) {
263-
Quaternion q2 = new Quaternion();
264-
q2.lookAt(direction, upVector);
265-
q2.multLocal(rotation);
266-
spatial.setLocalRotation(q2);
262+
tempRotation.lookAt(direction, upVector);
263+
tempRotation.multLocal(rotation);
264+
spatial.setLocalRotation(tempRotation);
267265
}
268266
break;
269267
case Rotation:
@@ -272,6 +270,7 @@ private void computeTargetDirection() {
272270
}
273271
break;
274272
case None:
273+
// no-op
275274
break;
276275
default:
277276
break;
@@ -376,8 +375,7 @@ public Vector3f getDirection() {
376375

377376
/**
378377
* Sets the direction of the spatial, using the Y axis as the up vector.
379-
* Use MotionEvent#setDirection((Vector3f direction,Vector3f upVector) if
380-
* you want a custom up vector.
378+
* If a custom up vector is desired, use {@link #setDirection(Vector3f, Vector3f)}.
381379
* This method is used by the motion path.
382380
*
383381
* @param direction the desired forward direction (not null, unaffected)

jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ private void updateParticleState(float tpf) {
11241124
lastPos.set(getWorldTranslation());
11251125

11261126
//This check avoids a NaN bounds when all the particles are dead during the first update.
1127-
if (!min.equals(Vector3f.POSITIVE_INFINITY) && !max.equals(Vector3f.NEGATIVE_INFINITY)) {
1127+
if (Vector3f.isValidVector(min) && Vector3f.isValidVector(max)) {
11281128
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
11291129
bbox.setMinMax(min, max);
11301130
this.setBoundRefresh();

jme3-core/src/main/java/com/jme3/effect/shapes/EmitterSphereShape.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public void getRandomPoint(Vector3f store) {
137137
@Override
138138
public void getRandomPointAndNormal(Vector3f store, Vector3f normal) {
139139
this.getRandomPoint(store);
140+
normal.set(store).subtractLocal(center).normalizeLocal();
140141
}
141142

142143
/**

jme3-core/src/main/java/com/jme3/input/JoystickButton.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2025 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,10 @@ public interface JoystickButton {
5050
public static final String BUTTON_9 = "9";
5151
public static final String BUTTON_10 = "10";
5252
public static final String BUTTON_11 = "11";
53+
public static final String BUTTON_12 = "12";
54+
public static final String BUTTON_13 = "13";
55+
public static final String BUTTON_14 = "14";
56+
public static final String BUTTON_15 = "15";
5357

5458
/**
5559
* Assign the mapping name to receive events from the given button index

0 commit comments

Comments
 (0)