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
4848/**
4949 * A LightProbe is not exactly a light. It holds environment map information used for Image Based Lighting.
5050 * This is used for indirect lighting in the Physically Based Rendering pipeline.
51- *
51+ * <p>
5252 * A light probe has a position in world space. This is the position from where the Environment Map are rendered.
5353 * There are two environment data structure held by the LightProbe :
5454 * - The irradiance spherical harmonics factors (used for indirect diffuse lighting in the PBR pipeline).
5757 * To compute them see
5858 * {@link com.jme3.environment.LightProbeFactory#makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial)}
5959 * and {@link EnvironmentCamera}.
60- *
60+ * <p>
6161 * The light probe has an area of effect centered on its position. It can have a Spherical area or an Oriented Box area
62- *
62+ * <p>
6363 * A LightProbe will only be taken into account when it's marked as ready and enabled.
6464 * A light probe is ready when it has valid environment map data set.
6565 * Note that you should never call setReady yourself.
7171public class LightProbe extends Light implements Savable {
7272
7373 private static final Logger logger = Logger .getLogger (LightProbe .class .getName ());
74- public static final Matrix4f FALLBACK_MATRIX = new Matrix4f (0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -1 );
74+ public static final Matrix4f FALLBACK_MATRIX = new Matrix4f (
75+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -1 );
7576
7677 private Vector3f [] shCoefficients ;
7778 private TextureCubeMap prefilteredEnvMap ;
@@ -149,16 +150,12 @@ public void setPrefilteredMap(TextureCubeMap prefilteredEnvMap) {
149150 * @return the pre-existing matrix
150151 */
151152 public Matrix4f getUniformMatrix (){
152-
153153 Matrix4f mat = area .getUniformMatrix ();
154-
155154 // setting the (sp) entry of the matrix
156155 mat .m33 = nbMipMaps + 1f / area .getRadius ();
157-
158156 return mat ;
159157 }
160158
161-
162159 @ Override
163160 public void write (JmeExporter ex ) throws IOException {
164161 super .write (ex );
@@ -180,7 +177,7 @@ public void read(JmeImporter im) throws IOException {
180177 position = (Vector3f ) ic .readSavable ("position" , null );
181178 area = (ProbeArea )ic .readSavable ("area" , null );
182179 if (area == null ) {
183- // retro compat
180+ // retro compatibility
184181 BoundingSphere bounds = (BoundingSphere ) ic .readSavable ("bounds" , new BoundingSphere (1.0f , Vector3f .ZERO ));
185182 area = new SphereProbeArea (bounds .getCenter (), bounds .getRadius ());
186183 }
@@ -200,7 +197,6 @@ public void read(JmeImporter im) throws IOException {
200197 }
201198 }
202199
203-
204200 /**
205201 * returns the bounding volume of this LightProbe
206202 * @return a bounding volume.
@@ -318,8 +314,12 @@ public Type getType() {
318314
319315 @ Override
320316 public String toString () {
321- return "Light Probe : " + name + " at " + position + " / " + area ;
317+ return getClass ().getSimpleName ()
318+ + "[name=" + name
319+ + ", position=" + position
320+ + ", area=" + area
321+ + ", enabled=" + enabled
322+ + "]" ;
322323 }
323324
324-
325325}
0 commit comments