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
11 changes: 10 additions & 1 deletion jme3-core/src/main/java/com/jme3/light/AmbientLight.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012, 2015 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -83,4 +83,13 @@ public Type getType() {
return Type.Ambient;
}

@Override
public String toString() {
return getClass().getSimpleName()
+ "[name=" + name
+ ", color=" + color
+ ", enabled=" + enabled
+ "]";
}

}
17 changes: 11 additions & 6 deletions jme3-core/src/main/java/com/jme3/light/DirectionalLight.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012, 2015-2016 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -132,11 +132,6 @@ public Type getType() {
return Type.Directional;
}

@Override
public String toString() {
return getClass().getSimpleName() + "[name=" + name + ", direction=" + direction + ", color=" + color + ", enabled=" + enabled + "]";
}

@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
Expand All @@ -157,4 +152,14 @@ public DirectionalLight clone() {
l.direction = direction.clone();
return l;
}

@Override
public String toString() {
return getClass().getSimpleName()
+ "[name=" + name
+ ", direction=" + direction
+ ", color=" + color
+ ", enabled=" + enabled
+ "]";
}
}
26 changes: 13 additions & 13 deletions jme3-core/src/main/java/com/jme3/light/LightProbe.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -48,7 +48,7 @@
/**
* A LightProbe is not exactly a light. It holds environment map information used for Image Based Lighting.
* This is used for indirect lighting in the Physically Based Rendering pipeline.
*
* <p>
* A light probe has a position in world space. This is the position from where the Environment Map are rendered.
* There are two environment data structure held by the LightProbe :
* - The irradiance spherical harmonics factors (used for indirect diffuse lighting in the PBR pipeline).
Expand All @@ -57,9 +57,9 @@
* To compute them see
* {@link com.jme3.environment.LightProbeFactory#makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial)}
* and {@link EnvironmentCamera}.
*
* <p>
* The light probe has an area of effect centered on its position. It can have a Spherical area or an Oriented Box area
*
* <p>
* A LightProbe will only be taken into account when it's marked as ready and enabled.
* A light probe is ready when it has valid environment map data set.
* Note that you should never call setReady yourself.
Expand All @@ -71,7 +71,8 @@
public class LightProbe extends Light implements Savable {

private static final Logger logger = Logger.getLogger(LightProbe.class.getName());
public static final Matrix4f FALLBACK_MATRIX = new Matrix4f(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1);
public static final Matrix4f FALLBACK_MATRIX = new Matrix4f(
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1);

private Vector3f[] shCoefficients;
private TextureCubeMap prefilteredEnvMap;
Expand Down Expand Up @@ -149,16 +150,12 @@ public void setPrefilteredMap(TextureCubeMap prefilteredEnvMap) {
* @return the pre-existing matrix
*/
public Matrix4f getUniformMatrix(){

Matrix4f mat = area.getUniformMatrix();

// setting the (sp) entry of the matrix
mat.m33 = nbMipMaps + 1f / area.getRadius();

return mat;
}


@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
Expand All @@ -180,7 +177,7 @@ public void read(JmeImporter im) throws IOException {
position = (Vector3f) ic.readSavable("position", null);
area = (ProbeArea)ic.readSavable("area", null);
if(area == null) {
// retro compat
// retro compatibility
BoundingSphere bounds = (BoundingSphere) ic.readSavable("bounds", new BoundingSphere(1.0f, Vector3f.ZERO));
area = new SphereProbeArea(bounds.getCenter(), bounds.getRadius());
}
Expand All @@ -200,7 +197,6 @@ public void read(JmeImporter im) throws IOException {
}
}


/**
* returns the bounding volume of this LightProbe
* @return a bounding volume.
Expand Down Expand Up @@ -318,8 +314,12 @@ public Type getType() {

@Override
public String toString() {
return "Light Probe : " + name + " at " + position + " / " + area;
return getClass().getSimpleName()
+ "[name=" + name
+ ", position=" + position
+ ", area=" + area
+ ", enabled=" + enabled
+ "]";
}


}
13 changes: 12 additions & 1 deletion jme3-core/src/main/java/com/jme3/light/PointLight.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012, 2015-2016, 2018 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -247,4 +247,15 @@ public PointLight clone() {
p.position = position.clone();
return p;
}

@Override
public String toString() {
return getClass().getSimpleName()
+ "[name=" + name
+ ", position=" + position
+ ", radius=" + radius
+ ", color=" + color
+ ", enabled=" + enabled
+ "]";
}
}
21 changes: 16 additions & 5 deletions jme3-core/src/main/java/com/jme3/light/SpotLight.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -118,8 +118,7 @@ public SpotLight(Vector3f position, Vector3f direction, ColorRGBA color) {
setPosition(position);
setDirection(direction);
}



/**
* Creates a SpotLight at the given position, with the given direction,
* the given range and the given color.
Expand Down Expand Up @@ -160,7 +159,6 @@ public SpotLight(Vector3f position, Vector3f direction, float range, ColorRGBA c
setDirection(direction);
setSpotRange(range);
}


private void computeAngleParameters() {
float innerCos = FastMath.cos(spotInnerAngle);
Expand Down Expand Up @@ -458,5 +456,18 @@ public SpotLight clone() {
s.position = position.clone();
return s;
}
}

@Override
public String toString() {
return getClass().getSimpleName()
+ "[name=" + name
+ ", direction=" + direction
+ ", position=" + position
+ ", range=" + spotRange
+ ", innerAngle=" + spotInnerAngle
+ ", outerAngle=" + spotOuterAngle
+ ", color=" + color
+ ", enabled=" + enabled
+ "]";
}
}