Class Texture
- Direct Known Subclasses:
Texture2D
,Texture3D
,TextureCubeMap
Each Texture object has the following properties:
- Boundary color - the texture boundary color. The texture boundary color is used when the boundaryModeS and boundaryModeT parameters are set to CLAMP or CLAMP_TO_BOUNDARY and if the texture boundary is not specified.
- Boundary Width - the texture boundary width, which must be 0 or 1. If the texture boundary width is 1, then all images for all mipmap levels will include a border. The actual texture image for level 0, for example, will be of dimension (width + 2*boundaryWidth) * (height + 2*boundaryWidth). The boundary texels will be used when linear filtering is to be applied.
- Boundary ModeS and Boundary ModeT - the boundary mode for the S and T coordinates, respectively. The boundary modes are as follows:
- CLAMP - clamps texture coordinates to be in the range [0,1]. Texture boundary texels or the constant boundary color if boundary width is 0 will be used for U,V values that fall outside this range.
- WRAP - repeats the texture by wrapping texture coordinates that are outside the range [0,1]. Only the fractional portion of the texture coordinates is used. The integer portion is discarded
- CLAMP_TO_EDGE - clamps texture coordinates such that filtering will not sample a texture boundary texel. Texels at the edge of the texture will be used instead.
- CLAMP_TO_BOUNDARY - clamps texture coordinates such that filtering will sample only texture boundary texels, that is, it will never get some samples from the boundary and some from the edge. This will ensure clean unfiltered boundaries. If the texture does not have a boundary, that is the boundary width is equal to 0, then the constant boundary color will be used.
- Image - an image or an array of images for all the mipmap levels. If only one image is provided, the MIPmap mode must be set to BASE_LEVEL.
- Magnification filter - the magnification filter function. Used when the pixel being rendered maps to an area less than or equal to one texel. The magnification filter functions are as follows:
- FASTEST - uses the fastest available method for processing geometry.
- NICEST - uses the nicest available method for processing geometry.
- BASE_LEVEL_POINT - selects the nearest texel in the base level texture image.
- BASE_LEVEL_LINEAR - performs a bilinear interpolation on the four nearest texels in the base level texture image. The texture value T' is computed as follows:
- LINEAR_SHARPEN - sharpens the resulting image by extrapolating from the base level plus one image to the base level image of this texture object.
- LINEAR_SHARPEN_RGB - performs linear sharpen filter for the rgb components only. The alpha component is computed using BASE_LEVEL_LINEAR filter.
- LINEAR_SHARPEN_ALPHA - performs linear sharpen filter for the alpha component only. The rgb components are computed using BASE_LEVEL_LINEAR filter.
- FILTER4 - applies an application-supplied weight function on the nearest 4x4 texels in the base level texture image. The texture value T' is computed as follows:
- Minification filter - the minification filter function. Used when the pixel being rendered maps to an area greater than one texel. The minifaction filter functions are as follows:
- FASTEST - uses the fastest available method for processing geometry.
- NICEST - uses the nicest available method for processing geometry.
- BASE_LEVEL_POINT - selects the nearest level in the base level texture map.
- BASE_LEVEL_LINEAR - performs a bilinear interpolation on the four nearest texels in the base level texture map.
- MULTI_LEVEL_POINT - selects the nearest texel in the nearest mipmap.
- MULTI_LEVEL_LINEAR - performs trilinear interpolation of texels between four texels each from the two nearest mipmap levels.
- FILTER4 - applies an application-supplied weight function on the nearest 4x4 texels in the base level texture image.
- MIPmap mode - the mode used for texture mapping for this object. The mode is one of the following:
- BASE_LEVEL - indicates that this Texture object only has a base-level image. If multiple levels are needed, they will be implicitly computed.
- MULTI_LEVEL_MIPMAP - indicates that this Texture object has multiple images. If MIPmap mode is set to MULTI_LEVEL_MIPMAP, images for Base Level through Max Level must be set.
- Format - the data format. The format is one of the following:
- INTENSITY - the texture image contains only texture values.
- LUMINANCE - the texture image contains only luminance values.
- ALPHA - the texture image contains only alpha values.
- LUMINANCE_ALPHA - the texture image contains both luminance and alpha values.
- RGB - the texture image contains red, green, and blue values.
- RGBA - the texture image contains red, green, blue, and alpha values.
- Base Level - specifies the mipmap level to be used when filter specifies BASE_LEVEL_POINT or BASE_LEVEL_LINEAR.
- Maximum Level - specifies the maximum level of image that needs to be defined for this texture to be valid. Note, for this texture to be valid, images for Base Level through Maximum Level have to be defined.
- Minimum LOD - specifies the minimum of the LOD range. LOD smaller than this value will be clamped to this value.
- Maximum LOD - specifies the maximum of the LOD range. LOD larger than this value will be clamped to this value.
- LOD offset - specifies the offset to be used in the LOD calculation to compensate for under or over sampled texture images.
- Anisotropic Mode - defines how anisotropic filter is applied for this texture object. The anisotropic modes are as follows:
- ANISOTROPIC_NONE - no anisotropic filtering.
- ANISOTROPIC_SINGLE_VALUE - applies the degree of anisotropic filter in both the minification and magnification filters.
- Anisotropic Filter Degree - controls the degree of anisotropy. This property applies to both minification and magnification filtering. If it is equal to 1.0, then an isotropic filtering as specified in the minification or magnification filter will be used. If it is greater than 1.0, and the anisotropic mode is equal to ANISOTROPIC_SINGLE_VALUE, then the degree of anisotropy will also be applied in the filtering.
- Sharpen Texture Function - specifies the function of level-of-detail used in combining the texture value computed from the base level image and the texture value computed from the base level plus one image. The final texture value is computed as follows:
- Filter4 Function - specifies the function to be applied to the nearest 4x4 texels. This property includes samples of the filter function f(x), 0<=x<=2. The number of function values supplied has to be equal to 2m + 1 for some integer value of m greater than or equal to 4.
-
i0 = trunc(u - 0.5)
j0 = trunc(v - 0.5)
i1 = i0 + 1
j1 = j0 + 1
a = frac(u - 0.5)
b = frac(v - 0.5)
T' = (1-a)*(1-b)*Ti0j0 + a*(1-b)*Ti1j0 + (1-a)*b*Ti0j1 + a*b*Ti1j1
i1 = trunc(u - 0.5) | i2 = i1 + 1 | i3 = i2 + 1 | i0 = i1 - 1 |
j1 = trunc(v - 0.5) | j3 = j2 + 1 | j2 = j1 + 1 | j0 = j1 - 1 |
a = frac(u - 0.5) | |||
b = frac(v - 0.5) |
T' = f(1+a) * f(1+b) * Ti0j0 +
f(a) * f(1+b) * Ti1j0 +
f(1-a) * f(1+b) * Ti2j0 +
f(2-a) * f(1+b) * Ti3j0 +
f(1+a) * f(b) * Ti0j1 +
f(a) * f(b) * Ti1j1 +
f(1-a) * f(b) * Ti2j1 +
f(2-a) * f(b) * Ti3j1 +
f(1+a) * f(1-b) * Ti0j2 +
f(a) * f(1-b) * Ti1j2 +
f(1-a) * f(1-b) * Ti2j2 +
f(2-a) * f(1-b) * Ti3j2 +
f(1+a) * f(2-b) * Ti0j3 +
f(a) * f(2-b) * Ti1j3 +
f(1-a) * f(2-b) * Ti2j3 +
f(2-a) * f(2-b) * Ti3j3
-
T' = ((1 + SharpenFunc(LOD)) * TBaseLevel) - (SharpenFunc(LOD) * TBaseLevel+1)
Note that as of Java 3D 1.5, the texture width and height are no longer required to be an exact power of two. However, not all graphics devices supports non-power-of-two textures. If non-power-of-two texture mapping is unsupported on a particular Canvas3D, textures with a width or height that are not an exact power of two are ignored for that canvas.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that this Texture object allows reading its anistropic filter information (e.g., anisotropic mode, anisotropic filter)static final int
Specifies that this Texture object allows reading its boundary color information.static final int
Specifies that this Texture object allows reading its boundary mode information.static final int
Specifies that this Texture object allows reading its enable flag.static final int
Specifies that this Texture object allows writing its enable flag.static final int
Specifies that this Texture object allows reading its filter information.static final int
Specifies that this Texture object allows reading its filter4 function information.static final int
Specifies that this Texture object allows reading its format information.static final int
Specifies that this Texture object allows reading its image component information.static final int
Specifies that this Texture object allows writing its image component information.static final int
Specifies that this Texture object allows reading its LOD range information (e.g., base level, maximum level, minimum lod, maximum lod, lod offset)static final int
Specifies that this Texture object allows writing its LOD range information (e.g., base level, maximum level, minimum lod, maximum lod, lod offset)static final int
Specifies that this Texture object allows reading its mipmap mode information.static final int
Specifies that this Texture object allows reading its sharpen texture function information.static final int
Specifies that this Texture object allows reading its size information (e.g., width, height, number of mipmap levels, boundary width).static final int
Specifies Texture contains only Alpha values.static final int
No anisotropic filter.static final int
Uses the degree of anisotropy in both the minification and magnification filters.static final int
Indicates that Texture object only has one level.static final int
Performs bilinear interpolation on the four nearest texels in level 0 texture map.static final int
Select the nearest texel in level 0 texture map.static final int
Clamps texture coordinates to be in the range [0, 1].static final int
Clamps texture coordinates such that filtering will sample only texture boundary texels.static final int
Clamps texture coordinates such that filtering will not sample a texture boundary texel.static final int
Uses the fastest available method for processing geometry.static final int
Applies an application-supplied weight function on the nearest 4x4 texels in the base level texture image.static final int
Specifies Texture contains only Intensity values.static final int
Sharpens the resulting image by extrapolating from the base level plus one image to the base level image of this texture object.static final int
Performs linear sharpen filter for the alpha component only.static final int
Performs linear sharpen filter for the rgb components only.static final int
Specifies Texture contains only luminance values.static final int
Specifies Texture contains Luminance and Alpha values.static final int
Performs tri-linear interpolation of texels between four texels each from two nearest mipmap levels.static final int
Indicates that this Texture object has multiple images, one for each mipmap level.static final int
Selects the nearest texel in the nearest mipmap.static final int
Uses the nicest available method for processing geometry.static final int
Specifies Texture contains Red, Green and Blue color values.static final int
Specifies Texture contains Red, Green, Blue color values and Alpha value.static final int
Repeats the texture by wrapping texture coordinates that are outside the range [0,1]. -
Constructor Summary
ConstructorsConstructorDescriptionTexture()
Constructs a Texture object with default parameters.Texture
(int mipMapMode, int format, int width, int height) Constructs an empty Texture object with specified mipMapMode, format, width and height.Texture
(int mipMapMode, int format, int width, int height, int boundaryWidth) Constructs an empty Texture object with specified mipMapMode, format, width, height, and boundaryWidth. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Retrieves the anisotropic filter degree for this texture object.int
Retrieves the anisotropic filter mode for this texture object.int
Retrieves the base level for this texture object.void
getBoundaryColor
(javax.vecmath.Color4f boundaryColor) Retrieves the texture boundary color for this texture object.int
Retrieves the boundary mode for the S coordinate.int
Retrieves the boundary mode for the T coordinate.int
Retrieves the width of the boundary of this Texture object.boolean
Retrieves the state of the texture enable flag.void
getFilter4Func
(float[] weights) Copies the array of filter4 function values into the specified array.int
Retrieves the number of filter4 function values for this texture object.int
Retrieves the format of this Texture object.int
Retrieves the height of this Texture object.getImage
(int level) Retrieves the image for a specified mipmap level.Retrieves the array of images for all mipmap levels.void
getLodOffset
(javax.vecmath.Tuple3f offset) Retrieves the LOD offset for this texture object.int
Retrieves the magnification filter.int
Retrieves the maximum level for this texture object.float
Retrieves the maximum level-of-detail for this texture object.int
Retrieves the minification filter.float
Retrieves the minimum level-of-detail for this texture object.int
Retrieves current mipmap mode.void
getSharpenTextureFunc
(float[] lod, float[] pts) Copies the array of sharpen texture LOD function points into the specified arrays.void
getSharpenTextureFunc
(javax.vecmath.Point2f[] pts) Copies the array of sharpen texture LOD function points including the lod values and the corresponding function values into the specified array.int
Gets the number of points in the sharpen texture LOD function for this texture object.int
getWidth()
Retrieves the width of this Texture object.int
Retrieves the number of mipmap levels needed for this Texture object.void
setAnisotropicFilterDegree
(float degree) Specifies the degree of anisotropy to be used when the anisotropic filter mode specifies ANISOTROPIC_SINGLE_VALUE.void
setAnisotropicFilterMode
(int mode) Specifies the anisotropic filter mode for this texture object.void
setBaseLevel
(int baseLevel) Specifies the base level for this texture object.void
setBoundaryColor
(float r, float g, float b, float a) Sets the texture boundary color for this texture object.void
setBoundaryColor
(javax.vecmath.Color4f boundaryColor) Sets the texture boundary color for this texture object.void
setBoundaryModeS
(int boundaryModeS) Sets the boundary mode for the S coordinate in this texture object.void
setBoundaryModeT
(int boundaryModeT) Sets the boundary mode for the T coordinate in this texture object.void
setEnable
(boolean state) Enables or disables texture mapping for this appearance component object.void
setFilter4Func
(float[] weights) sets the filter4 function for this texture object.void
setImage
(int level, ImageComponent image) Sets the image for a specified mipmap level.void
setImages
(ImageComponent[] images) Sets the array of images for all mipmap levels.void
setLodOffset
(float s, float t, float r) Specifies the LOD offset for this texture object.void
setLodOffset
(javax.vecmath.Tuple3f offset) Specifies the LOD offset for this texture object.void
setMagFilter
(int magFilter) Sets the magnification filter function.void
setMaximumLevel
(int maximumLevel) Specifies the maximum level for this texture object.void
setMaximumLOD
(float maximumLod) Specifies the maximum level-of-detail for this texture object.void
setMinFilter
(int minFilter) Sets the minification filter function.void
setMinimumLOD
(float minimumLod) Specifies the minimum level-of-detail for this texture object.void
setMipMapMode
(int mipMapMode) Sets mipmap mode for texture mapping for this texture object.void
setSharpenTextureFunc
(float[] lod, float[] pts) sets the sharpen texture LOD function for this texture object.void
setSharpenTextureFunc
(javax.vecmath.Point2f[] pts) sets the sharpen texture LOD function for this texture object.Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
Field Details
-
ALLOW_ENABLE_READ
public static final int ALLOW_ENABLE_READSpecifies that this Texture object allows reading its enable flag.- See Also:
-
ALLOW_ENABLE_WRITE
public static final int ALLOW_ENABLE_WRITESpecifies that this Texture object allows writing its enable flag.- See Also:
-
ALLOW_BOUNDARY_MODE_READ
public static final int ALLOW_BOUNDARY_MODE_READSpecifies that this Texture object allows reading its boundary mode information.- See Also:
-
ALLOW_FILTER_READ
public static final int ALLOW_FILTER_READSpecifies that this Texture object allows reading its filter information.- See Also:
-
ALLOW_IMAGE_READ
public static final int ALLOW_IMAGE_READSpecifies that this Texture object allows reading its image component information.- See Also:
-
ALLOW_IMAGE_WRITE
public static final int ALLOW_IMAGE_WRITESpecifies that this Texture object allows writing its image component information.- Since:
- Java 3D 1.2
- See Also:
-
ALLOW_FORMAT_READ
public static final int ALLOW_FORMAT_READSpecifies that this Texture object allows reading its format information.- Since:
- Java 3D 1.2
- See Also:
-
ALLOW_SIZE_READ
public static final int ALLOW_SIZE_READSpecifies that this Texture object allows reading its size information (e.g., width, height, number of mipmap levels, boundary width).- Since:
- Java 3D 1.2
- See Also:
-
ALLOW_MIPMAP_MODE_READ
public static final int ALLOW_MIPMAP_MODE_READSpecifies that this Texture object allows reading its mipmap mode information.- See Also:
-
ALLOW_BOUNDARY_COLOR_READ
public static final int ALLOW_BOUNDARY_COLOR_READSpecifies that this Texture object allows reading its boundary color information.- See Also:
-
ALLOW_LOD_RANGE_READ
public static final int ALLOW_LOD_RANGE_READSpecifies that this Texture object allows reading its LOD range information (e.g., base level, maximum level, minimum lod, maximum lod, lod offset)- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_LOD_RANGE_WRITE
public static final int ALLOW_LOD_RANGE_WRITESpecifies that this Texture object allows writing its LOD range information (e.g., base level, maximum level, minimum lod, maximum lod, lod offset)- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_ANISOTROPIC_FILTER_READ
public static final int ALLOW_ANISOTROPIC_FILTER_READSpecifies that this Texture object allows reading its anistropic filter information (e.g., anisotropic mode, anisotropic filter)- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_SHARPEN_TEXTURE_READ
public static final int ALLOW_SHARPEN_TEXTURE_READSpecifies that this Texture object allows reading its sharpen texture function information.- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_FILTER4_READ
public static final int ALLOW_FILTER4_READSpecifies that this Texture object allows reading its filter4 function information.- Since:
- Java 3D 1.3
- See Also:
-
FASTEST
Uses the fastest available method for processing geometry. This value can be used as a parameter to setMinFilter and setMagFilter. -
NICEST
Uses the nicest available method for processing geometry. This value can be used as a parameter to setMinFilter and setMagFilter. -
BASE_LEVEL_POINT
Select the nearest texel in level 0 texture map. Maps to NEAREST. -
BASE_LEVEL_LINEAR
Performs bilinear interpolation on the four nearest texels in level 0 texture map. Maps to LINEAR. -
MULTI_LEVEL_POINT
Selects the nearest texel in the nearest mipmap. Maps to NEAREST_MIPMAP_NEAREST.- See Also:
-
MULTI_LEVEL_LINEAR
Performs tri-linear interpolation of texels between four texels each from two nearest mipmap levels. Maps to LINEAR_MIPMAP_LINEAR, but an implementation can fall back to LINEAR_MIPMAP_NEAREST or NEAREST_MIPMAP_LINEAR.- See Also:
-
LINEAR_SHARPEN
Sharpens the resulting image by extrapolating from the base level plus one image to the base level image of this texture object.- Since:
- Java 3D 1.3
- See Also:
-
LINEAR_SHARPEN_RGB
Performs linear sharpen filter for the rgb components only. The alpha component is computed using BASE_LEVEL_LINEAR filter.- Since:
- Java 3D 1.3
- See Also:
-
LINEAR_SHARPEN_ALPHA
Performs linear sharpen filter for the alpha component only. The rgb components are computed using BASE_LEVEL_LINEAR filter.- Since:
- Java 3D 1.3
- See Also:
-
FILTER4
Applies an application-supplied weight function on the nearest 4x4 texels in the base level texture image.- Since:
- Java 3D 1.3
- See Also:
-
CLAMP
Clamps texture coordinates to be in the range [0, 1]. Texture boundary texels or the constant boundary color if boundary width is 0 will be used for U,V values that fall outside this range.- See Also:
-
WRAP
Repeats the texture by wrapping texture coordinates that are outside the range [0,1]. Only the fractional portion of the texture coordinates is used; the integer portion is discarded.- See Also:
-
CLAMP_TO_EDGE
Clamps texture coordinates such that filtering will not sample a texture boundary texel. Texels at the edge of the texture will be used instead.- Since:
- Java 3D 1.3
- See Also:
-
CLAMP_TO_BOUNDARY
Clamps texture coordinates such that filtering will sample only texture boundary texels. If the texture does not have a boundary, that is the boundary width is equal to 0, then the constant boundary color will be used.- Since:
- Java 3D 1.3
- See Also:
-
BASE_LEVEL
Indicates that Texture object only has one level. If multiple levels are needed, they will be implicitly computed.- See Also:
-
MULTI_LEVEL_MIPMAP
Indicates that this Texture object has multiple images, one for each mipmap level. In this mode, there arelog2(max(width,height))+1
separate images.- See Also:
-
INTENSITY
Specifies Texture contains only Intensity values.- See Also:
-
LUMINANCE
Specifies Texture contains only luminance values.- See Also:
-
ALPHA
Specifies Texture contains only Alpha values.- See Also:
-
LUMINANCE_ALPHA
Specifies Texture contains Luminance and Alpha values.- See Also:
-
RGB
Specifies Texture contains Red, Green and Blue color values.- See Also:
-
RGBA
Specifies Texture contains Red, Green, Blue color values and Alpha value.- See Also:
-
ANISOTROPIC_NONE
No anisotropic filter.- Since:
- Java 3D 1.3
- See Also:
-
ANISOTROPIC_SINGLE_VALUE
Uses the degree of anisotropy in both the minification and magnification filters.- Since:
- Java 3D 1.3
- See Also:
-
-
Constructor Details
-
Texture
public Texture()Constructs a Texture object with default parameters. The default values are as follows:-
enable flag : true
width : 0
height : 0
mipmap mode : BASE_LEVEL
format : RGB
boundary mode S : WRAP
boundary mode T : WRAP
min filter : BASE_LEVEL_POINT
mag filter : BASE_LEVEL_POINT
boundary color : black (0,0,0,0)
boundary width : 0
array of images : null
baseLevel : 0
maximumLevel :log2(max(width,height))
minimumLOD : -1000.0
maximumLOD : 1000.0
lod offset : (0, 0, 0)
anisotropic mode : ANISOTROPIC_NONE
anisotropic filter : 1.0
sharpen texture func: null
filter4 func: null
Note that the default constructor creates a texture object with a width and height of 0 and is, therefore, not useful.
-
Texture
public Texture(int mipMapMode, int format, int width, int height) Constructs an empty Texture object with specified mipMapMode, format, width and height. Defaults are used for all other parameters. IfmipMapMode
is set toBASE_LEVEL
, then the image at level 0 must be set by the application (using either thesetImage
orsetImages
method). IfmipMapMode
is set toMULTI_LEVEL_MIPMAP
, then images for levels Base Level through Maximum Level must be set. Note that a texture with a non-power-of-two width or height will only be rendered on a graphics device that supports non-power-of-two textures.- Parameters:
mipMapMode
- type of mipmap for this Texture: one of BASE_LEVEL, MULTI_LEVEL_MIPMAPformat
- data format of Textures saved in this object. One of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, RGBAwidth
- width of image at level 0.height
- height of image at level 0.- Throws:
IllegalArgumentException
- if width or height are not greater than 0, or if an invalid format or mipMapMode is specified.
-
Texture
public Texture(int mipMapMode, int format, int width, int height, int boundaryWidth) Constructs an empty Texture object with specified mipMapMode, format, width, height, and boundaryWidth. Defaults are used for all other parameters. IfmipMapMode
is set toBASE_LEVEL
, then the image at level 0 must be set by the application (using either thesetImage
orsetImages
method). IfmipMapMode
is set toMULTI_LEVEL_MIPMAP
, then images for levels Base Level through Maximum Level must be set. Note that a texture with a non-power-of-two width or height will only be rendered on a graphics device that supports non-power-of-two textures.- Parameters:
mipMapMode
- type of mipmap for this Texture: one of BASE_LEVEL, MULTI_LEVEL_MIPMAPformat
- data format of Textures saved in this object. One of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, RGBAwidth
- width of image at level 0. This does not include the width of the boundary.height
- height of image at level 0. This does not include the width of the boundary.boundaryWidth
- width of the boundary, which must be 0 or 1.- Throws:
IllegalArgumentException
- if width or height are not greater than 0, if an invalid format or mipMapMode is specified, or if the boundaryWidth is < 0 or > 1- Since:
- Java 3D 1.3
-
-
Method Details
-
setBoundaryModeS
public void setBoundaryModeS(int boundaryModeS) Sets the boundary mode for the S coordinate in this texture object.- Parameters:
boundaryModeS
- the boundary mode for the S coordinate. One of: CLAMP, WRAP, CLAMP_TO_EDGE, or CLAMP_TO_BOUNDARY.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifboundaryModeS
is a value other thanCLAMP
,WRAP
,CLAMP_TO_EDGE
, orCLAMP_TO_BOUNDARY
.
-
getBoundaryModeS
public int getBoundaryModeS()Retrieves the boundary mode for the S coordinate.- Returns:
- the current boundary mode for the S coordinate.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setBoundaryModeT
public void setBoundaryModeT(int boundaryModeT) Sets the boundary mode for the T coordinate in this texture object.- Parameters:
boundaryModeT
- the boundary mode for the T coordinate. One of: CLAMP, WRAP, CLAMP_TO_EDGE, or CLAMP_TO_BOUNDARY.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifboundaryModeT
is a value other thanCLAMP
,WRAP
,CLAMP_TO_EDGE
, orCLAMP_TO_BOUNDARY
.
-
getBoundaryModeT
public int getBoundaryModeT()Retrieves the boundary mode for the T coordinate.- Returns:
- the current boundary mode for the T coordinate.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setMinFilter
public void setMinFilter(int minFilter) Sets the minification filter function. This function is used when the pixel being rendered maps to an area greater than one texel.- Parameters:
minFilter
- the minification filter. One of: FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, MULTI_LEVEL_POINT, MULTI_LEVEL_LINEAR, or FILTER4- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifminFilter
is a value other thanFASTEST
,NICEST
,BASE_LEVEL_POINT
,BASE_LEVEL_LINEAR
,MULTI_LEVEL_POINT
,MULTI_LEVEL_LINEAR
, orFILTER4
.- See Also:
-
getMinFilter
public int getMinFilter()Retrieves the minification filter.- Returns:
- the current minification filter function.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setMagFilter
public void setMagFilter(int magFilter) Sets the magnification filter function. This function is used when the pixel being rendered maps to an area less than or equal to one texel.- Parameters:
magFilter
- the magnification filter, one of: FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, LINEAR_SHARPEN, LINEAR_SHARPEN_RGB, LINEAR_SHARPEN_ALPHA, or FILTER4.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifmagFilter
is a value other thanFASTEST
,NICEST
,BASE_LEVEL_POINT
,BASE_LEVEL_LINEAR
,LINEAR_SHARPEN
,LINEAR_SHARPEN_RGB
,LINEAR_SHARPEN_ALPHA
, orFILTER4
.- See Also:
-
getMagFilter
public int getMagFilter()Retrieves the magnification filter.- Returns:
- the current magnification filter function.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setImage
Sets the image for a specified mipmap level. Note that the image size must be the correct size for the specified mipmap level. The image size of the base level image, that is level 0, must be the same size in each dimension (width, height, depth) as this texture, excluding the border, if any. Each successive mipmap level must be 1/2 the size of the previous level, such thatsize[n] = floor(size[n-1]/2)
, exluding the border.- Parameters:
level
- mipmap level to set: 0 is the base levelimage
- ImageComponent object containing the texture image for the specified mipmap level- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphIllegalArgumentException
- if an ImageComponent3D is used in a Texture2D object or if an ImageComponent2D is used in a Texture3D object.IllegalArgumentException
- if the image being set at this level is not the correct size for this level.IllegalSharingException
- if this Texture is live and the specified image is being used by a Canvas3D as an off-screen buffer.IllegalSharingException
- if this Texture is being used by an immediate mode context and the specified image is being used by a Canvas3D as an off-screen buffer.
-
getImage
Retrieves the image for a specified mipmap level.- Parameters:
level
- mipmap level to get: 0 is the base level- Returns:
- the ImageComponent object containing the texture image at the specified mipmap level.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setImages
Sets the array of images for all mipmap levels. Note that the image size of the base level image,images[0]
, must be the same size in each dimension (width, height, depth) as this texture, excluding the border, if any. Each successive mipmap level must be 1/2 the size of the previous level, such thatsize[n] = floor(size[n-1]/2)
, exluding the border.- Parameters:
images
- array of ImageComponent objects containing the texture images for all mipmap levels- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphIllegalArgumentException
- if an ImageComponent3D is used in a Texture2D object or if an ImageComponent2D is used in a Texture3D object.IllegalArgumentException
- ifimages.length
is not equal to the total number of mipmap levels.IllegalArgumentException
- if the size of each dimension of the image at a given level in theimages
array is not the correct size.IllegalSharingException
- if this Texture is live and any of the specified images are being used by a Canvas3D as an off-screen buffer.IllegalSharingException
- if this Texture is being used by an immediate mode context and any of the specified images are being used by a Canvas3D as an off-screen buffer.- Since:
- Java 3D 1.2
-
getImages
Retrieves the array of images for all mipmap levels.- Returns:
- the array of ImageComponent objects for this Texture.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.2
-
getFormat
public int getFormat()Retrieves the format of this Texture object.- Returns:
- the format of this Texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.2
-
getWidth
public int getWidth()Retrieves the width of this Texture object.- Returns:
- the width of this Texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.2
-
getHeight
public int getHeight()Retrieves the height of this Texture object.- Returns:
- the height of this Texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.2
-
getBoundaryWidth
public int getBoundaryWidth()Retrieves the width of the boundary of this Texture object.- Returns:
- the width of the boundary of this Texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
numMipMapLevels
public int numMipMapLevels()Retrieves the number of mipmap levels needed for this Texture object.- Returns:
- (maximum Level - base Level + 1)
if
mipMapMode
isMULTI_LEVEL_MIPMAP
; otherwise it returns 1. - Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.2
-
setMipMapMode
public void setMipMapMode(int mipMapMode) Sets mipmap mode for texture mapping for this texture object.- Parameters:
mipMapMode
- the new mipmap mode for this object. One of: BASE_LEVEL or MULTI_LEVEL_MIPMAP.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifmipMapMode
is a value other thanBASE_LEVEL
orMULTI_LEVEL_MIPMAP
.
-
getMipMapMode
public int getMipMapMode()Retrieves current mipmap mode.- Returns:
- current mipmap mode of this texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setEnable
public void setEnable(boolean state) Enables or disables texture mapping for this appearance component object.- Parameters:
state
- true or false to enable or disable texture mapping- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getEnable
public boolean getEnable()Retrieves the state of the texture enable flag.- Returns:
- true if texture mapping is enabled, false if texture mapping is disabled
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setBoundaryColor
public void setBoundaryColor(javax.vecmath.Color4f boundaryColor) Sets the texture boundary color for this texture object. The texture boundary color is used when boundaryModeS or boundaryModeT is set to CLAMP or CLAMP_TO_BOUNDARY and if texture boundary is not specified.- Parameters:
boundaryColor
- the new texture boundary color.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.
-
setBoundaryColor
public void setBoundaryColor(float r, float g, float b, float a) Sets the texture boundary color for this texture object. The texture boundary color is used when boundaryModeS or boundaryModeT is set to CLAMP or CLAMP_TO_BOUNDARY and if texture boundary is not specified.- Parameters:
r
- the red component of the color.g
- the green component of the color.b
- the blue component of the color.a
- the alpha component of the color.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.
-
getBoundaryColor
public void getBoundaryColor(javax.vecmath.Color4f boundaryColor) Retrieves the texture boundary color for this texture object.- Parameters:
boundaryColor
- the vector that will receive the current texture boundary color.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setBaseLevel
public void setBaseLevel(int baseLevel) Specifies the base level for this texture object.- Parameters:
baseLevel
- index of the lowest defined mipmap level.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphIllegalArgumentException
- if specified baseLevel < 0, or if baseLevel > maximumLevel- Since:
- Java 3D 1.3
- See Also:
-
getBaseLevel
public int getBaseLevel()Retrieves the base level for this texture object.- Returns:
- base level for this texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setMaximumLevel
public void setMaximumLevel(int maximumLevel) Specifies the maximum level for this texture object.- Parameters:
maximumLevel
- index of the highest defined mipmap level.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphIllegalArgumentException
- if specified maximumLevel < baseLevel, or if maximumLevel >log2(max(width,height))
IllegalArgumentException
- if mipMipMapMode is equal to BASE_LEVEL and maximumLevel is not equal to zero.- Since:
- Java 3D 1.3
- See Also:
-
getMaximumLevel
public int getMaximumLevel()Retrieves the maximum level for this texture object.- Returns:
- maximum level for this texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setMinimumLOD
public void setMinimumLOD(float minimumLod) Specifies the minimum level-of-detail for this texture object.- Parameters:
minimumLod
- the minimum level-of-detail.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphIllegalArgumentException
- if specified lod > maximum lod- Since:
- Java 3D 1.3
- See Also:
-
getMinimumLOD
public float getMinimumLOD()Retrieves the minimum level-of-detail for this texture object.- Returns:
- the minimum level-of-detail
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setMaximumLOD
public void setMaximumLOD(float maximumLod) Specifies the maximum level-of-detail for this texture object.- Parameters:
maximumLod
- the maximum level-of-detail.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphIllegalArgumentException
- if specified lod < minimum lod- Since:
- Java 3D 1.3
- See Also:
-
getMaximumLOD
public float getMaximumLOD()Retrieves the maximum level-of-detail for this texture object.- Returns:
- the maximum level-of-detail
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setLodOffset
public void setLodOffset(float s, float t, float r) Specifies the LOD offset for this texture object.- Parameters:
s
- the s component of the LOD offsett
- the t component of the LOD offsetr
- the r component of the LOD offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
- See Also:
-
setLodOffset
public void setLodOffset(javax.vecmath.Tuple3f offset) Specifies the LOD offset for this texture object.- Parameters:
offset
- the LOD offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
- See Also:
-
getLodOffset
public void getLodOffset(javax.vecmath.Tuple3f offset) Retrieves the LOD offset for this texture object.- Parameters:
offset
- the vector that will receive the current LOD offset.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setAnisotropicFilterMode
public void setAnisotropicFilterMode(int mode) Specifies the anisotropic filter mode for this texture object.- Parameters:
mode
- the anisotropic filter mode. One of ANISOTROPIC_NONE or ANISOTROPIC_SINGLE_VALUE.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifmode
is a value other thanANISOTROPIC_NONE
orANISOTROPIC_SINGLE_VALUE
- Since:
- Java 3D 1.3
- See Also:
-
getAnisotropicFilterMode
public int getAnisotropicFilterMode()Retrieves the anisotropic filter mode for this texture object.- Returns:
- the currrent anisotropic filter mode of this texture object.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setAnisotropicFilterDegree
public void setAnisotropicFilterDegree(float degree) Specifies the degree of anisotropy to be used when the anisotropic filter mode specifies ANISOTROPIC_SINGLE_VALUE.- Parameters:
degree
- degree of anisotropy- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifdegree
< 1.0 ordegree
> the maximum degree of anisotropy.- Since:
- Java 3D 1.3
- See Also:
-
getAnisotropicFilterDegree
public float getAnisotropicFilterDegree()Retrieves the anisotropic filter degree for this texture object.- Returns:
- the current degree of anisotropy of this texture object
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setSharpenTextureFunc
public void setSharpenTextureFunc(float[] lod, float[] pts) sets the sharpen texture LOD function for this texture object.- Parameters:
lod
- array containing the level-of-detail values.pts
- array containing the function values for the corresponding level-of-detail values.- Throws:
IllegalStateException
- if the length oflod
does not match the length ofpts
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
setSharpenTextureFunc
public void setSharpenTextureFunc(javax.vecmath.Point2f[] pts) sets the sharpen texture LOD function for this texture object. The Point2f x,y values are defined as follows: x is the lod value, y is the corresponding function value.- Parameters:
pts
- array of Point2f containing the lod as well as the corresponding function value.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
getSharpenTextureFuncPointsCount
public int getSharpenTextureFuncPointsCount()Gets the number of points in the sharpen texture LOD function for this texture object.- Returns:
- the number of points in the sharpen texture LOD function.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getSharpenTextureFunc
public void getSharpenTextureFunc(float[] lod, float[] pts) Copies the array of sharpen texture LOD function points into the specified arrays. The arrays must be large enough to hold all the points.- Parameters:
lod
- the array to receive the level-of-detail values.pts
- the array to receive the function values for the corresponding level-of-detail values.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getSharpenTextureFunc
public void getSharpenTextureFunc(javax.vecmath.Point2f[] pts) Copies the array of sharpen texture LOD function points including the lod values and the corresponding function values into the specified array. The array must be large enough to hold all the points. The individual array elements must be allocated by the caller as well.- Parameters:
pts
- the array to receive the sharpen texture LOD function points- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setFilter4Func
public void setFilter4Func(float[] weights) sets the filter4 function for this texture object.- Parameters:
weights
- array containing samples of the filter4 function.- Throws:
IllegalArgumentException
- if the length ofweight
< 4RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
getFilter4FuncPointsCount
public int getFilter4FuncPointsCount()Retrieves the number of filter4 function values for this texture object.- Returns:
- the number of filter4 function values
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getFilter4Func
public void getFilter4Func(float[] weights) Copies the array of filter4 function values into the specified array. The array must be large enough to hold all the values.- Parameters:
weights
- the array to receive the function values.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-