Package com.ardor3d.image
Class Texture
java.lang.Object
com.ardor3d.image.Texture
- All Implemented Interfaces:
Savable
- Direct Known Subclasses:
Texture1D
,Texture2D
,Texture3D
,TextureCubeMap
Texture
defines a texture object to be used to display an image on a piece of geometry. The image to be
displayed is defined by the Image
class. All attributes required for texture mapping are contained
within this class. This includes mipmapping if desired, magnificationFilter options, apply options and correction
options. Default values are as follows: minificationFilter - NearestNeighborNoMipMaps, magnificationFilter -
NearestNeighbor, wrap - EdgeClamp on S,T and R, apply - Modulate, environment - None.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
static enum
static enum
static enum
static enum
static enum
static enum
The shadowing texture compare functionstatic enum
The shadowing texture compare modestatic enum
The type of depth texture translation to outputstatic enum
Formula to use for texture coordinate generationstatic enum
static enum
static enum
static enum
static enum
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTexture()
Constructor instantiates a newTexture
object with default attributes. -
Method Summary
Modifier and TypeMethodDescriptionabstract Texture
createSimpleClone
(Texture rVal) Retrieve a basic clone of this Texture (ie, clone everything but the image data, which is shared)boolean
float
getApply()
Get the depth texture compare functionGet the depth texture compare modeGet the depth texture apply modegetImage()
float
int
int
getTextureIdForContext
(Object glContext) getTextureIdForContextAsInteger
(Object glContext) int
abstract Texture.Type
getType()
abstract Texture.WrapMode
getWrap
(Texture.WrapAxis axis) boolean
boolean
boolean
void
read
(InputCapsule capsule) void
removeFromIdCache
(Object glContext) Removes any texture id for this texture for the given OpenGL context.void
setAnisotropicFilterPercent
(float percent) void
setApply
(Texture.ApplyMode apply) setApply
sets the apply mode for this texture.void
setBorderColor
(float red, float green, float blue, float alpha) sets the color used when texture operations encounter the border of a texture.void
setBorderColor
(ReadOnlyColorRGBA color) sets the color used when texture operations encounter the border of a texture.void
setCombineFuncAlpha
(Texture.CombinerFunctionAlpha combineFuncAlpha) void
setCombineFuncRGB
(Texture.CombinerFunctionRGB combineFuncRGB) void
setCombineOp0Alpha
(Texture.CombinerOperandAlpha combineOp0Alpha) void
setCombineOp0RGB
(Texture.CombinerOperandRGB combineOp0RGB) void
setCombineOp1Alpha
(Texture.CombinerOperandAlpha combineOp1Alpha) void
setCombineOp1RGB
(Texture.CombinerOperandRGB combineOp1RGB) void
setCombineOp2Alpha
(Texture.CombinerOperandAlpha combineOp2Alpha) void
setCombineOp2RGB
(Texture.CombinerOperandRGB combineOp2RGB) void
setCombineScaleAlpha
(Texture.CombinerScale combineScaleAlpha) void
setCombineScaleRGB
(Texture.CombinerScale combineScaleRGB) void
setCombineSrc0Alpha
(Texture.CombinerSource combineSrc0Alpha) void
setCombineSrc0RGB
(Texture.CombinerSource combineSrc0RGB) void
setCombineSrc1Alpha
(Texture.CombinerSource combineSrc1Alpha) void
setCombineSrc1RGB
(Texture.CombinerSource combineSrc1RGB) void
setCombineSrc2Alpha
(Texture.CombinerSource combineSrc2Alpha) void
setCombineSrc2RGB
(Texture.CombinerSource combineSrc2RGB) void
setConstantColor
(float red, float green, float blue, float alpha) sets a color that is used with CombinerSource.Constantvoid
sets a color that is used with CombinerSource.Constantvoid
setDepthCompareFunc
(Texture.DepthTextureCompareFunc depthCompareFunc) Set the depth texture compare functionvoid
setDepthCompareMode
(Texture.DepthTextureCompareMode depthCompareMode) Set the depth texture compare modevoid
setDepthMode
(Texture.DepthTextureMode depthMode) Set the depth texture apply modevoid
setDirty()
void
setEnvironmentalMapMode
(Texture.EnvironmentalMapMode envMapMode) void
setEnvPlaneQ
(ReadOnlyVector4 plane) void
setEnvPlaneR
(ReadOnlyVector4 plane) void
setEnvPlaneS
(ReadOnlyVector4 plane) void
setEnvPlaneT
(ReadOnlyVector4 plane) void
setHasBorder
(boolean hasBorder) void
setImage
sets the image object that defines the texture.void
setLodBias
(float bias) void
setMagnificationFilter
(Texture.MagnificationFilter magnificationFilter) void
setMinificationFilter
(Texture.MinificationFilter minificationFilter) void
void
setStoreImage
(boolean store) void
setTextureBaseLevel
(int textureBaseLevel) void
setTextureIdForContext
(Object glContext, int textureId) Sets the id for this texture in regards to the given OpenGL context.void
setTextureKey
(TextureKey tkey) void
setTextureMatrix
(ReadOnlyMatrix4 matrix) void
setTextureMaxLevel
(int textureMaxLevel) void
setTextureStoreFormat
(TextureStoreFormat storeFormat) abstract void
setWrap
(Texture.WrapAxis axis, Texture.WrapMode mode) Sets the wrap mode of this texture for a particular axis.abstract void
setWrap
(Texture.WrapMode mode) Sets the wrap mode of this texture for all axis.void
write
(OutputCapsule capsule)
-
Field Details
-
DEFAULT_STORE_IMAGE
public static boolean DEFAULT_STORE_IMAGE
-
-
Constructor Details
-
Texture
public Texture()Constructor instantiates a newTexture
object with default attributes.
-
-
Method Details
-
setConstantColor
sets a color that is used with CombinerSource.Constant- Parameters:
color
- the new constant color (the default isColorRGBA.BLACK_NO_ALPHA
)
-
setConstantColor
public void setConstantColor(float red, float green, float blue, float alpha) sets a color that is used with CombinerSource.Constant- Parameters:
red
- the red valuegreen
- the green valueblue
- the blue valuealpha
- the alpha value
-
setBorderColor
sets the color used when texture operations encounter the border of a texture.- Parameters:
color
- the new border color (the default isColorRGBA.BLACK_NO_ALPHA
)
-
setBorderColor
public void setBorderColor(float red, float green, float blue, float alpha) sets the color used when texture operations encounter the border of a texture.- Parameters:
red
- the red valuegreen
- the green valueblue
- the blue valuealpha
- the alpha value
-
getMinificationFilter
- Returns:
- the MinificationFilterMode of this texture.
-
setMinificationFilter
- Parameters:
minificationFilter
- the new MinificationFilterMode for this texture.- Throws:
IllegalArgumentException
- if minificationFilter is null
-
getMagnificationFilter
- Returns:
- the MagnificationFilterMode of this texture.
-
setMagnificationFilter
- Parameters:
magnificationFilter
- the new MagnificationFilter for this texture.- Throws:
IllegalArgumentException
- if magnificationFilter is null
-
setApply
setApply
sets the apply mode for this texture.- Parameters:
apply
- the apply mode for this texture.- Throws:
IllegalArgumentException
- if apply is null
-
setImage
setImage
sets the image object that defines the texture.- Parameters:
image
- the image that defines the texture.
-
getTextureIdForContext
- Parameters:
glContext
- the object representing the OpenGL context this texture belongs to. SeeRenderContext.getGlContextRep()
- Returns:
- the texture id of this texture in the given context. If the texture is not found in the given context, 0 is returned.
-
getTextureIdForContextAsInteger
- Parameters:
glContext
- the object representing the OpenGL context this texture belongs to. SeeRenderContext.getGlContextRep()
- Returns:
- the texture id of this texture in the given context as an Integer object. If the texture is not found in the given context, a 0 integer is returned.
-
setTextureIdForContext
Sets the id for this texture in regards to the given OpenGL context.- Parameters:
glContext
- the object representing the OpenGL context this texture belongs to. SeeRenderContext.getGlContextRep()
textureId
- the texture id of this texture. To be valid, this must be greater than 0.- Throws:
IllegalArgumentException
- if textureId is less than or equal to 0.
-
removeFromIdCache
Removes any texture id for this texture for the given OpenGL context.
Note: This does not remove the texture from the card and is provided for use by code that does remove textures from the card.
- Parameters:
glContext
- the object representing the OpenGL context this texture belongs to. SeeRenderContext.getGlContextRep()
-
getImage
- Returns:
- the image data that makes up this texture. If no image data has been set, this will return null.
-
getApply
- Returns:
- the apply mode of the texture.
-
getConstantColor
- Returns:
- the color set to be used with CombinerSource.Constant for this texture (as applicable). (the default is
ColorRGBA.BLACK_NO_ALPHA
)
-
getBorderColor
- Returns:
- the color to be used for border operations. (the default is
ColorRGBA.BLACK_NO_ALPHA
)
-
setWrap
Sets the wrap mode of this texture for a particular axis.- Parameters:
axis
- the texture axis to define a wrapmode on.mode
- the wrap mode for the given axis of the texture.- Throws:
IllegalArgumentException
- if axis or mode are null or invalid for this type of texture
-
setWrap
Sets the wrap mode of this texture for all axis.- Parameters:
mode
- the wrap mode for the given axis of the texture.- Throws:
IllegalArgumentException
- if mode is null or invalid for this type of texture
-
getWrap
- Parameters:
axis
- the axis to return for- Returns:
- the wrap mode for the given coordinate axis on this texture.
- Throws:
IllegalArgumentException
- if axis is null or invalid for this type of texture
-
getType
- Returns:
- the
Texture.Type
enum value of this Texture object.
-
getCombineFuncRGB
- Returns:
- the combineFuncRGB.
-
setCombineFuncRGB
- Parameters:
combineFuncRGB
- The combineFuncRGB to set.- Throws:
IllegalArgumentException
- if combineFuncRGB is null
-
getCombineOp0Alpha
- Returns:
- Returns the combineOp0Alpha.
-
setCombineOp0Alpha
- Parameters:
combineOp0Alpha
- The combineOp0Alpha to set.- Throws:
IllegalArgumentException
- if combineOp0Alpha is null
-
getCombineOp0RGB
- Returns:
- Returns the combineOp0RGB.
-
setCombineOp0RGB
- Parameters:
combineOp0RGB
- The combineOp0RGB to set.- Throws:
IllegalArgumentException
- if combineOp0RGB is null
-
getCombineOp1Alpha
- Returns:
- Returns the combineOp1Alpha.
-
setCombineOp1Alpha
- Parameters:
combineOp1Alpha
- The combineOp1Alpha to set.- Throws:
IllegalArgumentException
- if combineOp1Alpha is null
-
getCombineOp1RGB
- Returns:
- Returns the combineOp1RGB.
-
setCombineOp1RGB
- Parameters:
combineOp1RGB
- The combineOp1RGB to set.- Throws:
IllegalArgumentException
- if combineOp1RGB is null
-
getCombineOp2Alpha
- Returns:
- Returns the combineOp2Alpha.
-
setCombineOp2Alpha
- Parameters:
combineOp2Alpha
- The combineOp2Alpha to set.- Throws:
IllegalArgumentException
- if combineOp2Alpha is null
-
getCombineOp2RGB
- Returns:
- Returns the combineOp2RGB.
-
setCombineOp2RGB
- Parameters:
combineOp2RGB
- The combineOp2RGB to set.- Throws:
IllegalArgumentException
- if combineOp2RGB is null
-
getCombineScaleAlpha
- Returns:
- Returns the combineScaleAlpha.
-
setCombineScaleAlpha
- Parameters:
combineScaleAlpha
- The combineScaleAlpha to set.- Throws:
IllegalArgumentException
- if combineScaleAlpha is null
-
getCombineScaleRGB
- Returns:
- Returns the combineScaleRGB.
-
setCombineScaleRGB
- Parameters:
combineScaleRGB
- The combineScaleRGB to set.- Throws:
IllegalArgumentException
- if combineScaleRGB is null
-
getCombineSrc0Alpha
- Returns:
- Returns the combineSrc0Alpha.
-
setCombineSrc0Alpha
- Parameters:
combineSrc0Alpha
- The combineSrc0Alpha to set.- Throws:
IllegalArgumentException
- if combineSrc0Alpha is null
-
getCombineSrc0RGB
- Returns:
- Returns the combineSrc0RGB.
-
setCombineSrc0RGB
- Parameters:
combineSrc0RGB
- The combineSrc0RGB to set.- Throws:
IllegalArgumentException
- if combineSrc0RGB is null
-
getCombineSrc1Alpha
- Returns:
- Returns the combineSrc1Alpha.
-
setCombineSrc1Alpha
- Parameters:
combineSrc1Alpha
- The combineSrc1Alpha to set.- Throws:
IllegalArgumentException
- if combineSrc1Alpha is null
-
getCombineSrc1RGB
- Returns:
- Returns the combineSrc1RGB.
-
setCombineSrc1RGB
- Parameters:
combineSrc1RGB
- The combineSrc1RGB to set.- Throws:
IllegalArgumentException
- if combineSrc1RGB is null
-
getCombineSrc2Alpha
- Returns:
- Returns the combineSrc2Alpha.
-
setCombineSrc2Alpha
- Parameters:
combineSrc2Alpha
- The combineSrc2Alpha to set.- Throws:
IllegalArgumentException
- if combineSrc2Alpha is null
-
getCombineSrc2RGB
- Returns:
- Returns the combineSrc2RGB.
-
setCombineSrc2RGB
- Parameters:
combineSrc2RGB
- The combineSrc2RGB to set.- Throws:
IllegalArgumentException
- if combineSrc2RGB is null
-
getCombineFuncAlpha
- Returns:
- Returns the combineFuncAlpha.
-
setCombineFuncAlpha
- Parameters:
combineFuncAlpha
- The combineFuncAlpha to set.- Throws:
IllegalArgumentException
- if combineFuncAlpha is null
-
setEnvironmentalMapMode
- Parameters:
envMapMode
- the environmental map mode to set- Throws:
IllegalArgumentException
- if envMapMode is null
-
getEnvironmentalMapMode
-
getEnvPlaneS
-
setEnvPlaneS
-
getEnvPlaneT
-
setEnvPlaneT
-
getEnvPlaneR
-
setEnvPlaneR
-
getEnvPlaneQ
-
setEnvPlaneQ
-
getAnisotropicFilterPercent
public float getAnisotropicFilterPercent()- Returns:
- the anisotropic filtering level for this texture as a percentage (0.0 - 1.0)
-
setAnisotropicFilterPercent
public void setAnisotropicFilterPercent(float percent) - Parameters:
percent
- the anisotropic filtering level for this texture as a percentage (0.0 - 1.0)
-
getLodBias
public float getLodBias()- Returns:
- the lodBias for this texture
-
setLodBias
public void setLodBias(float bias) - Parameters:
bias
- the lod bias for this texture. The default is 0.
-
setTextureKey
-
getTextureKey
-
setTextureStoreFormat
-
setRenderedTexturePixelDataType
-
getRenderedTexturePixelDataType
-
getTextureStoreFormat
-
isStoreImage
public boolean isStoreImage() -
setStoreImage
public void setStoreImage(boolean store) -
hasBorder
public boolean hasBorder() -
setHasBorder
public void setHasBorder(boolean hasBorder) -
getDepthCompareFunc
Get the depth texture compare function- Returns:
- The depth texture compare function
-
setDepthCompareFunc
Set the depth texture compare function- Parameters:
depthCompareFunc
- The depth texture compare function
-
getDepthMode
Get the depth texture apply mode- Returns:
- The depth texture apply mode
-
setDepthMode
Set the depth texture apply mode- Parameters:
depthMode
- The depth texture apply mode
-
getDepthCompareMode
Get the depth texture compare mode- Returns:
- The depth texture compare mode
-
setDepthCompareMode
Set the depth texture compare mode- Parameters:
depthCompareMode
- The depth texture compare mode
-
setDirty
public void setDirty() -
isDirty
-
equals
-
createSimpleClone
-
createSimpleClone
Retrieve a basic clone of this Texture (ie, clone everything but the image data, which is shared)- Parameters:
rVal
- the texture to clone- Returns:
- Texture
-
getTextureMatrix
-
setTextureMatrix
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
-
getTextureBaseLevel
public int getTextureBaseLevel() -
setTextureBaseLevel
public void setTextureBaseLevel(int textureBaseLevel) -
getTextureMaxLevel
public int getTextureMaxLevel() -
setTextureMaxLevel
public void setTextureMaxLevel(int textureMaxLevel)
-