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
FieldsModifier and TypeFieldDescriptionprotected final AssetManagerprotected static Vector3f[]protected static Vector3f[]protected static Vector3f[]protected List<ByteArrayOutputStream>protected final Cameraprotected Image.Formatprotected TextureCubeMapprotected final RenderManagerprotected boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericEnvBaker(RenderManager rm, AssetManager am, Image.Format colorFormat, Image.Format depthFormat, int env_size) -
Method Summary
Modifier and TypeMethodDescriptionvoidbakeEnvironment(Spatial scene, Vector3f position, float frustumNear, float frustumFar, Predicate<Geometry> filter) Bakes the environment.voidclean()Cleans the environment baker This method should be called when the baker is no longer needed It will clean up all the resources.protected voidendPulling(Texture tx) Ends pulling the data into the textureGets the environment map.booleanGets if textures should be pulled from the GPU.protected intlimitMips(int nbMipMaps, int baseW, int baseH, RenderManager rm) protected ByteBufferpull(FrameBuffer fb, Texture env, int faceId) Pulls the data from the framebuffer into the texture Nb.voidsetTexturePulling(boolean v) Specifies whether textures should be pulled from the GPU.protected voidStarts pulling the data from the framebuffer into the texture.protected CameraupdateAndGetInternalCamera(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:EnvBakerSpecifies whether textures should be pulled from the GPU.- Specified by:
setTexturePullingin interfaceEnvBaker
-
isTexturePulling
public boolean isTexturePulling()Description copied from interface:EnvBakerGets if textures should be pulled from the GPU.- Specified by:
isTexturePullingin interfaceEnvBaker- Returns:
-
getEnvMap
Description copied from interface:EnvBakerGets 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:EnvBakerCleans 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:EnvBakerBakes the environment.- Specified by:
bakeEnvironmentin 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
-