@@ -87,20 +87,10 @@ public enum Axis {
8787 X , Y , Z
8888 }
8989
90- /**
91- * Represents the direction (positive or negative) along the chosen axis.
92- * This influences how the light's direction is set when `SpatialToLight`
93- * and how the spatial's rotation is derived from the light's direction
94- * when `LightToSpatial`.
95- */
96- public enum Direction {
97- Positive , Negative
98- }
99-
10090 private Light light ;
10191 private ControlDirection controlDir = ControlDirection .SpatialToLight ;
10292 private Axis axisRotation = Axis .Z ;
103- private Direction axisDirection = Direction . Positive ;
93+ private boolean invertAxisDirection = false ;
10494
10595 /**
10696 * For serialization only. Do not use.
@@ -159,12 +149,12 @@ public void setAxisRotation(Axis axisRotation) {
159149 this .axisRotation = axisRotation ;
160150 }
161151
162- public Direction getAxisDirection () {
163- return axisDirection ;
152+ public boolean isInvertAxisDirection () {
153+ return invertAxisDirection ;
164154 }
165155
166- public void setAxisDirection ( Direction axisDirection ) {
167- this .axisDirection = axisDirection ;
156+ public void setInvertAxisDirection ( boolean invertAxisDirection ) {
157+ this .invertAxisDirection = invertAxisDirection ;
168158 }
169159
170160 private void validateSupportedLightType (Light light ) {
@@ -206,7 +196,7 @@ private void spatialToLight(Light light) {
206196
207197 final Vector3f lightDirection = vars .vect2 ;
208198 spatial .getWorldRotation ().getRotationColumn (axisRotation .ordinal (), lightDirection );
209- if (axisDirection == Direction . Negative ) {
199+ if (invertAxisDirection ) {
210200 lightDirection .negateLocal ();
211201 }
212202
@@ -246,7 +236,7 @@ private void lightToSpatial(Light light) {
246236 } else if (light instanceof DirectionalLight ) {
247237 DirectionalLight dl = (DirectionalLight ) light ;
248238 lightDirection .set (dl .getDirection ());
249- if (axisDirection == Direction . Negative ) {
239+ if (invertAxisDirection ) {
250240 lightDirection .negateLocal ();
251241 }
252242 rotateSpatial = true ;
@@ -255,7 +245,7 @@ private void lightToSpatial(Light light) {
255245 SpotLight sl = (SpotLight ) light ;
256246 lightPosition .set (sl .getPosition ());
257247 lightDirection .set (sl .getDirection ());
258- if (axisDirection == Direction . Negative ) {
248+ if (invertAxisDirection ) {
259249 lightDirection .negateLocal ();
260250 }
261251 translateSpatial = true ;
@@ -300,7 +290,7 @@ public void read(JmeImporter im) throws IOException {
300290 light = (Light ) ic .readSavable ("light" , null );
301291 controlDir = ic .readEnum ("controlDir" , ControlDirection .class , ControlDirection .SpatialToLight );
302292 axisRotation = ic .readEnum ("axisRotation" , Axis .class , Axis .Z );
303- axisDirection = ic .readEnum ( "axisDirection " , Direction . class , Direction . Positive );
293+ invertAxisDirection = ic .readBoolean ( "invertAxisDirection " , false );
304294 }
305295
306296 @ Override
@@ -310,7 +300,7 @@ public void write(JmeExporter ex) throws IOException {
310300 oc .write (light , "light" , null );
311301 oc .write (controlDir , "controlDir" , ControlDirection .SpatialToLight );
312302 oc .write (axisRotation , "axisRotation" , Axis .Z );
313- oc .write (axisDirection , "axisDirection " , Direction . Positive );
303+ oc .write (invertAxisDirection , "invertAxisDirection " , false );
314304 }
315305
316306 @ Override
@@ -319,7 +309,7 @@ public String toString() {
319309 "[light=" + light +
320310 ", controlDir=" + controlDir +
321311 ", axisRotation=" + axisRotation +
322- ", axisDirection =" + axisDirection +
312+ ", invertAxisDirection =" + invertAxisDirection +
323313 ", enabled=" + enabled +
324314 ", spatial=" + spatial +
325315 "]" ;
0 commit comments