public class LightProbe extends Light implements Savable
LightProbeFactory.makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial)
and EnvironmentCamera
.
The light probe has an area of effect centered on its position. It can have a Spherical area or an Oriented Box area
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.LightProbeFactory
,
EnvironmentCamera
Modifier and Type | Class and Description |
---|---|
static class |
LightProbe.AreaType |
Light.Type
Modifier and Type | Field and Description |
---|---|
static Matrix4f |
FALLBACK_MATRIX |
color, enabled, lastDistance, name
Constructor and Description |
---|
LightProbe()
Empty constructor used for serialization.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeLastDistance(Spatial owner)
Used internally to compute the last distance value.
|
ProbeArea |
getArea() |
LightProbe.AreaType |
getAreaType() |
BoundingVolume |
getBounds()
Deprecated.
use
getArea() |
int |
getNbMipMaps() |
Vector3f |
getPosition()
Returns the position of the LightProbe in world space
|
TextureCubeMap |
getPrefilteredEnvMap()
returns the prefiltered environment map texture of this light probe
Note that this Texture may not have image data yet if the LightProbe is not ready
|
Vector3f[] |
getShCoeffs() |
Light.Type |
getType()
Returns the light type
|
Matrix4f |
getUniformMatrix()
Returns the data to send to the shader.
|
boolean |
intersectsBox(BoundingBox box,
TempVars vars)
Determines if the light intersects with the given bounding box.
|
boolean |
intersectsFrustum(Camera camera,
TempVars vars)
Determines if the light intersects with the given camera frustum.
|
boolean |
intersectsSphere(BoundingSphere sphere,
TempVars vars)
Determines if the light intersects with the given bounding sphere.
|
boolean |
isReady()
return true if the LightProbe is ready, meaning the Environment maps have
been loaded or rnedered and are ready to be used by a material
|
void |
read(JmeImporter im) |
void |
setAreaType(LightProbe.AreaType type) |
void |
setBounds(BoundingVolume bounds)
Deprecated.
|
void |
setNbMipMaps(int nbMipMaps) |
void |
setPosition(Vector3f position)
Sets the position of the LightProbe in world space
|
void |
setPrefilteredMap(TextureCubeMap prefileteredEnvMap)
Sets the prefiltered environment map
|
void |
setReady(boolean ready)
Don't call this method directly.
|
void |
setShCoeffs(Vector3f[] shCoeffs) |
java.lang.String |
toString() |
void |
write(JmeExporter ex) |
clone, getColor, getName, isEnabled, isFrustumCheckNeeded, isIntersectsFrustum, setColor, setEnabled, setFrustumCheckNeeded, setIntersectsFrustum, setName
public static final Matrix4f FALLBACK_MATRIX
public LightProbe()
LightProbeFactory.makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial)
instead.public TextureCubeMap getPrefilteredEnvMap()
public void setPrefilteredMap(TextureCubeMap prefileteredEnvMap)
prefileteredEnvMap
- the prefiltered environment mappublic Matrix4f getUniformMatrix()
(ax, ay, az) is the pitch rotation axis (bx, by, bz) is the yaw rotation axis (cx, cy, cz) is the roll rotation axis Like in a standard 3x3 rotation matrix. It's also the valid rotation matrix of the probe in world space. Note that for the Spherical Probe area this part is a 3x3 identity matrix.
(px, py, pz) is the position of the center of the probe in world space Like in a valid 4x4 transform matrix.
(sx, sy, sy) is the extent of the probe ( the scale ) In a standard transform matrix the scale is applied to the rotation matrix part. In the shader we need the rotation and the scale to be separated, doing this avoid to extract the scale from a classic transform matrix in the shader
(sp) is a special entry, it contains the packed number of mip maps of the probe and the inverse radius for the probe. since the inverse radius in lower than 1, it's packed in the decimal part of the float. The number of mip maps is packed in the integer part of the float. (ie: for 6 mip maps and a radius of 3, sp= 6.3333333)
The radius is obvious for a SphereProbeArea, but in the case of a OrientedBoxProbeArea it's the max of the extent vector's components.
public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
@Deprecated public BoundingVolume getBounds()
getArea()
@Deprecated public void setBounds(BoundingVolume bounds)
bounds
- the bounds of the LightProbepublic ProbeArea getArea()
public void setAreaType(LightProbe.AreaType type)
public LightProbe.AreaType getAreaType()
public boolean isReady()
public void setReady(boolean ready)
ready
- the ready state of the LightProbe.public Vector3f[] getShCoeffs()
public void setShCoeffs(Vector3f[] shCoeffs)
public Vector3f getPosition()
public void setPosition(Vector3f position)
position
- the wolrd space positionpublic int getNbMipMaps()
public void setNbMipMaps(int nbMipMaps)
public boolean intersectsBox(BoundingBox box, TempVars vars)
Light
For non-local lights, such as directional lights
,
ambient lights
, or point lights
without influence radius, this method should always return true.
intersectsBox
in class Light
box
- The box to check intersection against.vars
- TempVars in case it is needed.public boolean intersectsFrustum(Camera camera, TempVars vars)
Light
directional lights
,
ambient lights
, or point lights
without influence radius, this method should always return true.intersectsFrustum
in class Light
camera
- The camera frustum to check intersection against.vars
- TempVars in case it is needed.public boolean intersectsSphere(BoundingSphere sphere, TempVars vars)
Light
For non-local lights, such as directional lights
,
ambient lights
, or point lights
without influence radius, this method should always return true.
intersectsSphere
in class Light
sphere
- The sphere to check intersection against.vars
- TempVars in case it is needed.protected void computeLastDistance(Spatial owner)
Light
computeLastDistance
in class Light
owner
- the Spatial whose distance is to be determinedpublic Light.Type getType()
Light
getType
in class Light
Light.Type
public java.lang.String toString()
toString
in class java.lang.Object