Class FacedCubemapData
- java.lang.Object
-
- com.badlogic.gdx.graphics.glutils.FacedCubemapData
-
- All Implemented Interfaces:
CubemapData
public class FacedCubemapData extends java.lang.Object implements CubemapData
A FacedCubemapData holds a cubemap data definition based on aTextureDataper face.
-
-
Field Summary
Fields Modifier and Type Field Description protected TextureData[]data
-
Constructor Summary
Constructors Constructor Description FacedCubemapData()Construct an empty Cubemap.FacedCubemapData(int width, int height, int depth, Pixmap.Format format)Construct a Cubemap withPixmaps for each side of the specified size.FacedCubemapData(FileHandle positiveX, FileHandle negativeX, FileHandle positiveY, FileHandle negativeY, FileHandle positiveZ, FileHandle negativeZ)Construct a Cubemap with the specified texture files for the sides, optionally generating mipmaps.FacedCubemapData(FileHandle positiveX, FileHandle negativeX, FileHandle positiveY, FileHandle negativeY, FileHandle positiveZ, FileHandle negativeZ, boolean useMipMaps)Construct a Cubemap with the specified texture files for the sides, optionally generating mipmaps.FacedCubemapData(Pixmap positiveX, Pixmap negativeX, Pixmap positiveY, Pixmap negativeY, Pixmap positiveZ, Pixmap negativeZ)Construct a Cubemap with the specifiedPixmaps for the sides, does not generate mipmaps.FacedCubemapData(Pixmap positiveX, Pixmap negativeX, Pixmap positiveY, Pixmap negativeY, Pixmap positiveZ, Pixmap negativeZ, boolean useMipMaps)Construct a Cubemap with the specifiedPixmaps for the sides, optionally generating mipmaps.FacedCubemapData(TextureData positiveX, TextureData negativeX, TextureData positiveY, TextureData negativeY, TextureData positiveZ, TextureData negativeZ)Construct a Cubemap with the specifiedTextureData's for the sides
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsumeCubemapData()Uploads the pixel data for the 6 faces of the cube to the OpenGL ES texture.intgetHeight()TextureDatagetTextureData(Cubemap.CubemapSide side)intgetWidth()booleanisComplete()booleanisManaged()booleanisPrepared()voidload(Cubemap.CubemapSide side, FileHandle file)Loads the texture specified using theFileHandleand sets it to specified side, overwriting any previous data set to that side.voidload(Cubemap.CubemapSide side, Pixmap pixmap)Sets the specified side of this cubemap to the specifiedPixmap, overwriting any previous data set to that side.voidprepare()Prepares the TextureData for a call toCubemapData.consumeCubemapData().
-
-
-
Field Detail
-
data
protected final TextureData[] data
-
-
Constructor Detail
-
FacedCubemapData
public FacedCubemapData()
Construct an empty Cubemap. Use the load(...) methods to set the texture of each side. Every side of the cubemap must be set before it can be used.
-
FacedCubemapData
public FacedCubemapData(FileHandle positiveX, FileHandle negativeX, FileHandle positiveY, FileHandle negativeY, FileHandle positiveZ, FileHandle negativeZ)
Construct a Cubemap with the specified texture files for the sides, optionally generating mipmaps.
-
FacedCubemapData
public FacedCubemapData(FileHandle positiveX, FileHandle negativeX, FileHandle positiveY, FileHandle negativeY, FileHandle positiveZ, FileHandle negativeZ, boolean useMipMaps)
Construct a Cubemap with the specified texture files for the sides, optionally generating mipmaps.
-
FacedCubemapData
public FacedCubemapData(Pixmap positiveX, Pixmap negativeX, Pixmap positiveY, Pixmap negativeY, Pixmap positiveZ, Pixmap negativeZ)
Construct a Cubemap with the specifiedPixmaps for the sides, does not generate mipmaps.
-
FacedCubemapData
public FacedCubemapData(Pixmap positiveX, Pixmap negativeX, Pixmap positiveY, Pixmap negativeY, Pixmap positiveZ, Pixmap negativeZ, boolean useMipMaps)
Construct a Cubemap with the specifiedPixmaps for the sides, optionally generating mipmaps.
-
FacedCubemapData
public FacedCubemapData(int width, int height, int depth, Pixmap.Format format)Construct a Cubemap withPixmaps for each side of the specified size.
-
FacedCubemapData
public FacedCubemapData(TextureData positiveX, TextureData negativeX, TextureData positiveY, TextureData negativeY, TextureData positiveZ, TextureData negativeZ)
Construct a Cubemap with the specifiedTextureData's for the sides
-
-
Method Detail
-
isManaged
public boolean isManaged()
- Specified by:
isManagedin interfaceCubemapData- Returns:
- whether this implementation can cope with a EGL context loss.
-
load
public void load(Cubemap.CubemapSide side, FileHandle file)
Loads the texture specified using theFileHandleand sets it to specified side, overwriting any previous data set to that side. Note that you need to reload throughCubemap.load(CubemapData)any cubemap using this data for the change to be taken in account.- Parameters:
side- TheCubemap.CubemapSidefile- The textureFileHandle
-
load
public void load(Cubemap.CubemapSide side, Pixmap pixmap)
Sets the specified side of this cubemap to the specifiedPixmap, overwriting any previous data set to that side. Note that you need to reload throughCubemap.load(CubemapData)any cubemap using this data for the change to be taken in account.- Parameters:
side- TheCubemap.CubemapSidepixmap- ThePixmap
-
isComplete
public boolean isComplete()
- Returns:
- True if all sides of this cubemap are set, false otherwise.
-
getTextureData
public TextureData getTextureData(Cubemap.CubemapSide side)
- Returns:
- The
TextureDatafor the specified side, can be null if the cubemap is incomplete.
-
getWidth
public int getWidth()
- Specified by:
getWidthin interfaceCubemapData- Returns:
- the width of the pixel data
-
getHeight
public int getHeight()
- Specified by:
getHeightin interfaceCubemapData- Returns:
- the height of the pixel data
-
isPrepared
public boolean isPrepared()
- Specified by:
isPreparedin interfaceCubemapData- Returns:
- whether the TextureData is prepared or not.
-
prepare
public void prepare()
Description copied from interface:CubemapDataPrepares the TextureData for a call toCubemapData.consumeCubemapData(). This method can be called from a non OpenGL thread and should thus not interact with OpenGL.- Specified by:
preparein interfaceCubemapData
-
consumeCubemapData
public void consumeCubemapData()
Description copied from interface:CubemapDataUploads the pixel data for the 6 faces of the cube to the OpenGL ES texture. The caller must bind an OpenGL ES texture. A call toCubemapData.prepare()must preceed a call to this method. Any internal data structures created inCubemapData.prepare()should be disposed of here.- Specified by:
consumeCubemapDatain interfaceCubemapData
-
-