Skip to content

Commit 836178c

Browse files
authored
Refactor getLeft, getUp, and getDirection methods
1 parent b863f63 commit 836178c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

jme3-core/src/main/java/com/jme3/audio/Listener.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,16 @@ public Vector3f getVelocity(Vector3f store) {
166166
* @return The listener's left direction as a {@link Vector3f}.
167167
*/
168168
public Vector3f getLeft() {
169-
return rotation.getRotationColumn(0);
169+
return getLeft(null);
170170
}
171171

172-
173172
/**
174173
* Gets the left direction vector of the listener. This vector is derived from the listener's rotation.
175174
*
176175
* @param store The vector to store the result in.
177176
* @return The listener's left direction as a {@link Vector3f}.
178177
*/
179178
public Vector3f getLeft(Vector3f store) {
180-
if (store == null) store = new Vector3f();
181179
return rotation.getRotationColumn(0, store);
182180
}
183181

@@ -188,7 +186,7 @@ public Vector3f getLeft(Vector3f store) {
188186
* @return The listener's up direction as a {@link Vector3f}.
189187
*/
190188
public Vector3f getUp() {
191-
return rotation.getRotationColumn(1);
189+
return getUp(null);
192190
}
193191

194192
/**
@@ -199,7 +197,6 @@ public Vector3f getUp() {
199197
* @return The listener's up direction as a {@link Vector3f}.
200198
*/
201199
public Vector3f getUp(Vector3f store) {
202-
if (store == null) store = new Vector3f();
203200
return rotation.getRotationColumn(1, store);
204201
}
205202

@@ -210,7 +207,7 @@ public Vector3f getUp(Vector3f store) {
210207
* @return The listener's forward direction.
211208
*/
212209
public Vector3f getDirection() {
213-
return rotation.getRotationColumn(2);
210+
return getDirection(null);
214211
}
215212

216213
/**
@@ -221,7 +218,6 @@ public Vector3f getDirection() {
221218
* @return The listener's forward direction.
222219
*/
223220
public Vector3f getDirection(Vector3f store) {
224-
if (store == null) store = new Vector3f();
225221
return rotation.getRotationColumn(2, store);
226222
}
227223

0 commit comments

Comments
 (0)