Package com.jme3.environment.baker
Class GenericEnvBaker
java.lang.Object
com.jme3.environment.baker.GenericEnvBaker
- All Implemented Interfaces:
EnvBaker
- Direct Known Subclasses:
IBLGLEnvBaker
,IBLHybridEnvBakerLight
Render the environment into a cubemap
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AssetManager
protected static Vector3f[]
protected static Vector3f[]
protected static Vector3f[]
protected List<ByteArrayOutputStream>
protected final Camera
protected Image.Format
protected TextureCubeMap
protected final RenderManager
protected boolean
-
Constructor Summary
ModifierConstructorDescriptionprotected
GenericEnvBaker
(RenderManager rm, AssetManager am, Image.Format colorFormat, Image.Format depthFormat, int env_size) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bakeEnvironment
(Spatial scene, Vector3f position, float frustumNear, float frustumFar, Predicate<Geometry> filter) Bakes the environment.void
clean()
Cleans the environment baker This method should be called when the baker is no longer needed It will clean up all the resources.protected void
endPulling
(Texture tx) Ends pulling the data into the textureGets the environment map.boolean
Gets if textures should be pulled from the GPU.protected int
limitMips
(int nbMipMaps, int baseW, int baseH, RenderManager rm) protected ByteBuffer
pull
(FrameBuffer fb, Texture env, int faceId) Pulls the data from the framebuffer into the texture Nb.void
setTexturePulling
(boolean v) Specifies whether textures should be pulled from the GPU.protected void
Starts pulling the data from the framebuffer into the texture.protected Camera
updateAndGetInternalCamera
(int faceId, int w, int h, Vector3f position, float frustumNear, float frustumFar) Updates the internal camera to face the given cubemap face and return it.
-
Field Details
-
axisX
-
axisY
-
axisZ
-
envMap
-
depthFormat
-
renderManager
-
assetManager
-
cam
-
texturePulling
protected boolean texturePulling -
bos
-
-
Constructor Details
-
GenericEnvBaker
protected GenericEnvBaker(RenderManager rm, AssetManager am, Image.Format colorFormat, Image.Format depthFormat, int env_size)
-
-
Method Details
-
setTexturePulling
public void setTexturePulling(boolean v) Description copied from interface:EnvBaker
Specifies whether textures should be pulled from the GPU.- Specified by:
setTexturePulling
in interfaceEnvBaker
-
isTexturePulling
public boolean isTexturePulling()Description copied from interface:EnvBaker
Gets if textures should be pulled from the GPU.- Specified by:
isTexturePulling
in interfaceEnvBaker
- Returns:
-
getEnvMap
Description copied from interface:EnvBaker
Gets the environment map. -
updateAndGetInternalCamera
protected Camera updateAndGetInternalCamera(int faceId, int w, int h, Vector3f position, float frustumNear, float frustumFar) Updates the internal camera to face the given cubemap face and return it.- Parameters:
faceId
- the id of the face (0-5)w
- width of the camerah
- height of the cameraposition
- position of the camerafrustumNear
- near frustumfrustumFar
- far frustum- Returns:
- The updated camera
-
clean
public void clean()Description copied from interface:EnvBaker
Cleans the environment baker This method should be called when the baker is no longer needed It will clean up all the resources. -
bakeEnvironment
public void bakeEnvironment(Spatial scene, Vector3f position, float frustumNear, float frustumFar, Predicate<Geometry> filter) Description copied from interface:EnvBaker
Bakes the environment.- Specified by:
bakeEnvironment
in interfaceEnvBaker
- Parameters:
scene
- The scene to bakeposition
- The position of the camerafrustumNear
- The near frustumfrustumFar
- The far frustumfilter
- A filter to select which geometries to bake
-
startPulling
protected void startPulling()Starts pulling the data from the framebuffer into the texture. -
pull
Pulls the data from the framebuffer into the texture Nb. mipmaps must be pulled sequentially on the same faceId.- Parameters:
fb
- the framebuffer to pull fromenv
- the texture to pull intofaceId
- id of face if cubemap or 0 otherwise- Returns:
- the ByteBuffer containing the pulled data
-
endPulling
Ends pulling the data into the texture- Parameters:
tx
- the texture to pull into
-
limitMips
-