Class LightProbe
- Direct Known Subclasses:
EnvironmentProbeControl
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.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.light.Light
Light.Type
-
Field Summary
Fields inherited from class com.jme3.light.Light
color, enabled, lastDistance, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
computeLastDistance
(Spatial owner) Used internally to compute the last distance value.getArea()
Deprecated.int
Returns the position of the LightProbe in world spacereturns the prefiltered environment map texture of this light probe Note that this Texture may not have image data yet if the LightProbe is not readyVector3f[]
getType()
Returns the light typeReturns 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 rendered and are ready to be used by a materialvoid
read
(JmeImporter im) void
void
setNbMipMaps
(int nbMipMaps) void
setPosition
(Vector3f position) Sets the position of the LightProbe in world spacevoid
setPrefilteredMap
(TextureCubeMap prefilteredEnvMap) Sets the prefiltered environment mapvoid
setReady
(boolean ready) Don't call this method directly.void
setShCoeffs
(Vector3f[] shCoefficients) toString()
void
write
(JmeExporter ex) Methods inherited from class com.jme3.light.Light
clone, getColor, getName, isEnabled, isFrustumCheckNeeded, isIntersectsFrustum, setColor, setEnabled, setFrustumCheckNeeded, setIntersectsFrustum, setName
-
Field Details
-
FALLBACK_MATRIX
-
-
Constructor Details
-
LightProbe
public LightProbe()Empty constructor used for serialization. You should never call it, useLightProbeFactory.makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial)
instead.
-
-
Method Details
-
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- Returns:
- the prefiltered environment map
-
setPrefilteredMap
Sets the prefiltered environment map- Parameters:
prefilteredEnvMap
- the prefiltered environment map
-
getUniformMatrix
Returns the data to send to the shader. This is a column major matrix that is not a classic transform matrix, it's laid out in a particular way // 3x3 rot mat| // 0 1 2 | 3 // 0 | ax bx cx | px | ) // 1 | ay by cy | py | probe position // 2 | az bz cz | pz | ) // --|----------| // 3 | sx sy sz sp | 1/probe radius + nbMipMaps // --scale--(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 so avoids extracting 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 an OrientedBoxProbeArea it's the max of the extent vector's components.
- Returns:
- the pre-existing matrix
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classLight
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classLight
- Throws:
IOException
-
getBounds
Deprecated.usegetArea()
returns the bounding volume of this LightProbe- Returns:
- a bounding volume.
-
getArea
-
setAreaType
-
getAreaType
-
isReady
public boolean isReady()return true if the LightProbe is ready, meaning the Environment maps have been loaded or rendered and are ready to be used by a material- Returns:
- the LightProbe ready state
-
setReady
public void setReady(boolean ready) Don't call this method directly. It's meant to be called by additional systems that will load or render the Environment maps of the LightProbe- Parameters:
ready
- the ready state of the LightProbe.
-
getShCoeffs
-
setShCoeffs
-
getPosition
Returns the position of the LightProbe in world space- Returns:
- the world-space position
-
setPosition
Sets the position of the LightProbe in world space- Parameters:
position
- the world-space position
-
getNbMipMaps
public int getNbMipMaps() -
setNbMipMaps
public void setNbMipMaps(int nbMipMaps) -
intersectsBox
Description copied from class:Light
Determines if the light intersects with the given bounding box.For non-local lights, such as
directional lights
,ambient lights
, orpoint lights
without influence radius, this method should always return true.- Specified by:
intersectsBox
in classLight
- Parameters:
box
- The box to check intersection against.vars
- TempVars in case it is needed.- Returns:
- True if the light intersects the box, false otherwise.
-
intersectsFrustum
Description copied from class:Light
Determines if the light intersects with the given camera frustum. For non-local lights, such asdirectional lights
,ambient lights
, orpoint lights
without influence radius, this method should always return true.- Specified by:
intersectsFrustum
in classLight
- Parameters:
camera
- The camera frustum to check intersection against.vars
- TempVars in case it is needed.- Returns:
- True if the light intersects the frustum, false otherwise.
-
intersectsSphere
Description copied from class:Light
Determines if the light intersects with the given bounding sphere.For non-local lights, such as
directional lights
,ambient lights
, orpoint lights
without influence radius, this method should always return true.- Specified by:
intersectsSphere
in classLight
- Parameters:
sphere
- The sphere to check intersection against.vars
- TempVars in case it is needed.- Returns:
- True if the light intersects the sphere, false otherwise.
-
computeLastDistance
Description copied from class:Light
Used internally to compute the last distance value.- Specified by:
computeLastDistance
in classLight
- Parameters:
owner
- the Spatial whose distance is to be determined
-
getType
Description copied from class:Light
Returns the light type -
toString
-
getArea()