Panda3D
|
Represents a set of settings that indicate how a texture is sampled. More...
#include <pandadoc.hpp>
Public Types | |
enum | FilterType { FT_nearest = 0 , FT_linear = 1 , FT_nearest_mipmap_nearest = 2 , FT_linear_mipmap_nearest = 3 , FT_nearest_mipmap_linear = 4 , FT_linear_mipmap_linear = 5 , FT_shadow = 6 , FT_default = 7 , FT_invalid = 8 } |
enum | WrapMode { WM_clamp = 0 , WM_repeat = 1 , WM_mirror = 2 , WM_mirror_once = 3 , WM_border_color = 4 , WM_invalid = 5 } |
Public Member Functions | |
__init__ () | |
Creates a new SamplerState initialized to the default values. | |
__init__ (const SamplerState) | |
int | getAnisotropicDegree () |
Returns the degree of anisotropic filtering that should be applied to the texture. | |
const LColor | getBorderColor () |
Returns the solid color of the texture's border. | |
int | getEffectiveAnisotropicDegree () |
Returns the degree of anisotropic filtering that should be applied to the texture. | |
SamplerState::FilterType | getEffectiveMagfilter () |
Returns the filter mode of the texture for magnification, with special treatment for FT_default. | |
SamplerState::FilterType | getEffectiveMinfilter () |
Returns the filter mode of the texture for minification, with special treatment for FT_default. | |
float | getLodBias () |
Returns the bias that will be added to the texture level of detail when sampling this texture. | |
SamplerState::FilterType | getMagfilter () |
Returns the filter mode of the texture for magnification. | |
float | getMaxLod () |
Returns the maximum level of detail that will be observed when sampling this texture. | |
SamplerState::FilterType | getMinfilter () |
Returns the filter mode of the texture for minification. | |
float | getMinLod () |
Returns the minimum level of detail that will be observed when sampling this texture. | |
SamplerState::WrapMode | getWrapU () |
Returns the wrap mode of the texture in the U direction. | |
SamplerState::WrapMode | getWrapV () |
Returns the wrap mode of the texture in the V direction. | |
SamplerState::WrapMode | getWrapW () |
Returns the wrap mode of the texture in the W direction. | |
bool | isPrepared (PreparedGraphicsObjects prepared_objects) |
Returns true if the sampler has already been prepared or enqueued for preparation on the indicated GSG, false otherwise. | |
bool | operator!= (const SamplerState other) |
bool | operator< (const SamplerState other) |
bool | operator== (const SamplerState other) |
prepare (PreparedGraphicsObjects prepared_objects) | |
Indicates that the sampler should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame. | |
SamplerContext | prepareNow (PreparedGraphicsObjects prepared_objects, GraphicsStateGuardianBase gsg) |
Creates a context for the sampler on the particular GSG, if it does not already exist. | |
release (PreparedGraphicsObjects prepared_objects) | |
Frees the texture context only on the indicated object, if it exists there. | |
setAnisotropicDegree (int anisotropic_degree) | |
Specifies the level of anisotropic filtering to apply to the SamplerState. | |
setBorderColor (const LColor color) | |
Specifies the solid color of the SamplerState's border. | |
setLodBias (float lod_bias) | |
Sets the value that will be added to the level of detail when sampling the texture. | |
setMagfilter (SamplerState::FilterType filter) | |
Sets the filtering method that should be used when viewing the SamplerState up close. | |
setMaxLod (float max_lod) | |
Sets the maximum level of detail that will be used when sampling this texture. | |
setMinfilter (SamplerState::FilterType filter) | |
Sets the filtering method that should be used when viewing the SamplerState from a distance. | |
setMinLod (float min_lod) | |
Sets the minimum level of detail that will be used when sampling this texture. | |
setWrapU (SamplerState::WrapMode wrap) | |
This setting determines what happens when the SamplerState is sampled with a U value outside the range 0.0-1.0. | |
setWrapV (SamplerState::WrapMode wrap) | |
This setting determines what happens when the SamplerState is sampled with a V value outside the range 0.0-1.0. | |
setWrapW (SamplerState::WrapMode wrap) | |
The W wrap direction is only used for 3-d SamplerStates. | |
bool | usesMipmaps () |
Returns true if the minfilter settings on this sampler indicate the use of mipmapping, false otherwise. | |
Static Public Member Functions | |
static str | formatFilterType (SamplerState::FilterType ft) |
Returns the indicated FilterType converted to a string word. | |
static str | formatWrapMode (SamplerState::WrapMode wm) |
Returns the indicated WrapMode converted to a string word. | |
static TypeHandle | getClassType () |
static const SamplerState | getDefault () |
Returns a reference to the global default immutable SamplerState object. | |
static bool | isMipmap (SamplerState::FilterType type) |
Returns true if the indicated filter type requires the use of mipmaps, or false if it does not. | |
static SamplerState::FilterType | stringFilterType (str str) |
Returns the FilterType value associated with the given string representation, or FT_invalid if the string does not match any known FilterType value. | |
static SamplerState::WrapMode | stringWrapMode (str str) |
Returns the WrapMode value associated with the given string representation, or WM_invalid if the string does not match any known WrapMode value. | |
Public Attributes | |
int | anisotropic_degree |
Returns the degree of anisotropic filtering that should be applied to the texture. | |
const LColor | border_color |
Returns the solid color of the texture's border. | |
int | effective_anisotropic_degree |
Returns the degree of anisotropic filtering that should be applied to the texture. | |
SamplerState::FilterType | effective_magfilter |
Returns the filter mode of the texture for magnification, with special treatment for FT_default. | |
SamplerState::FilterType | effective_minfilter |
Returns the filter mode of the texture for minification, with special treatment for FT_default. | |
float | lod_bias |
Returns the bias that will be added to the texture level of detail when sampling this texture. | |
SamplerState::FilterType | magfilter |
Returns the filter mode of the texture for magnification. | |
float | max_lod |
Returns the maximum level of detail that will be observed when sampling this texture. | |
float | min_lod |
Returns the minimum level of detail that will be observed when sampling this texture. | |
SamplerState::FilterType | minfilter |
Returns the filter mode of the texture for minification. | |
SamplerState::WrapMode | wrap_u |
Returns the wrap mode of the texture in the U direction. | |
SamplerState::WrapMode | wrap_v |
Returns the wrap mode of the texture in the V direction. | |
SamplerState::WrapMode | wrap_w |
Returns the wrap mode of the texture in the W direction. | |
Represents a set of settings that indicate how a texture is sampled.
This can be used to sample the same texture using different settings in different places.
enum FilterType |
enum WrapMode |
__init__ | ( | ) |
Creates a new SamplerState initialized to the default values.
__init__ | ( | const SamplerState | ) |
|
static |
Returns the indicated FilterType converted to a string word.
|
static |
Returns the indicated WrapMode converted to a string word.
int getAnisotropicDegree | ( | ) |
Returns the degree of anisotropic filtering that should be applied to the texture.
This value may return 0, indicating the default value; see also get_effective_anisotropic_degree.
const LColor getBorderColor | ( | ) |
Returns the solid color of the texture's border.
Some OpenGL implementations use a border for tiling textures; in Panda, it is only used for specifying the clamp color.
|
static |
|
static |
Returns a reference to the global default immutable SamplerState object.
int getEffectiveAnisotropicDegree | ( | ) |
Returns the degree of anisotropic filtering that should be applied to the texture.
This value will normally not return 0, unless there is an error in the config file.
SamplerState::FilterType getEffectiveMagfilter | ( | ) |
Returns the filter mode of the texture for magnification, with special treatment for FT_default.
This will normally not return FT_default, unless there is an error in the config file.
SamplerState::FilterType getEffectiveMinfilter | ( | ) |
Returns the filter mode of the texture for minification, with special treatment for FT_default.
This will normally not return FT_default, unless there is an error in the config file.
float getLodBias | ( | ) |
Returns the bias that will be added to the texture level of detail when sampling this texture.
SamplerState::FilterType getMagfilter | ( | ) |
Returns the filter mode of the texture for magnification.
The mipmap constants are invalid here. This may return FT_default; see also get_effective_minfilter().
float getMaxLod | ( | ) |
Returns the maximum level of detail that will be observed when sampling this texture.
SamplerState::FilterType getMinfilter | ( | ) |
Returns the filter mode of the texture for minification.
If this is one of the mipmap constants, then the texture requires mipmaps. This may return FT_default; see also get_effective_minfilter().
float getMinLod | ( | ) |
Returns the minimum level of detail that will be observed when sampling this texture.
SamplerState::WrapMode getWrapU | ( | ) |
Returns the wrap mode of the texture in the U direction.
SamplerState::WrapMode getWrapV | ( | ) |
Returns the wrap mode of the texture in the V direction.
SamplerState::WrapMode getWrapW | ( | ) |
Returns the wrap mode of the texture in the W direction.
This is the depth direction of 3-d textures.
|
static |
Returns true if the indicated filter type requires the use of mipmaps, or false if it does not.
bool isPrepared | ( | PreparedGraphicsObjects | prepared_objects | ) |
Returns true if the sampler has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.
bool operator!= | ( | const SamplerState | other | ) |
bool operator< | ( | const SamplerState | other | ) |
bool operator== | ( | const SamplerState | other | ) |
prepare | ( | PreparedGraphicsObjects | prepared_objects | ) |
Indicates that the sampler should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.
Use this function instead of prepare_now() to preload samplers from a user interface standpoint.
SamplerContext prepareNow | ( | PreparedGraphicsObjects | prepared_objects, |
GraphicsStateGuardianBase | gsg ) |
Creates a context for the sampler on the particular GSG, if it does not already exist.
Returns the new (or old) SamplerContext. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new textures. If this is not necessarily the case, you should use prepare() instead.
Normally, this is not called directly except by the GraphicsStateGuardian; a sampler does not need to be explicitly prepared by the user before it may be rendered.
release | ( | PreparedGraphicsObjects | prepared_objects | ) |
Frees the texture context only on the indicated object, if it exists there.
Returns true if it was released, false if it had not been prepared.
setAnisotropicDegree | ( | int | anisotropic_degree | ) |
Specifies the level of anisotropic filtering to apply to the SamplerState.
Set this 0 to indicate the default value, which is specified in the SamplerState-anisotropic-degree config variable.
To explicitly disable anisotropic filtering, set this value to 1. To explicitly enable anisotropic filtering, set it to a value higher than 1; larger numbers indicate greater degrees of filtering.
setBorderColor | ( | const LColor | color | ) |
Specifies the solid color of the SamplerState's border.
Some OpenGL implementations use a border for tiling SamplerStates; in Panda, it is only used for specifying the clamp color.
setLodBias | ( | float | lod_bias | ) |
Sets the value that will be added to the level of detail when sampling the texture.
This may be a negative value, although some graphics hardware may not support the use of negative LOD values.
setMagfilter | ( | SamplerState::FilterType | filter | ) |
Sets the filtering method that should be used when viewing the SamplerState up close.
setMaxLod | ( | float | max_lod | ) |
Sets the maximum level of detail that will be used when sampling this texture.
This may exceed the number of mipmap levels that the texture has.
setMinfilter | ( | SamplerState::FilterType | filter | ) |
Sets the filtering method that should be used when viewing the SamplerState from a distance.
setMinLod | ( | float | min_lod | ) |
Sets the minimum level of detail that will be used when sampling this texture.
This may be a negative value.
setWrapU | ( | SamplerState::WrapMode | wrap | ) |
This setting determines what happens when the SamplerState is sampled with a U value outside the range 0.0-1.0.
The default is WM_repeat, which indicates that the SamplerState should repeat indefinitely.
setWrapV | ( | SamplerState::WrapMode | wrap | ) |
This setting determines what happens when the SamplerState is sampled with a V value outside the range 0.0-1.0.
The default is WM_repeat, which indicates that the SamplerState should repeat indefinitely.
setWrapW | ( | SamplerState::WrapMode | wrap | ) |
The W wrap direction is only used for 3-d SamplerStates.
|
static |
Returns the FilterType value associated with the given string representation, or FT_invalid if the string does not match any known FilterType value.
|
static |
Returns the WrapMode value associated with the given string representation, or WM_invalid if the string does not match any known WrapMode value.
bool usesMipmaps | ( | ) |
Returns true if the minfilter settings on this sampler indicate the use of mipmapping, false otherwise.
int anisotropic_degree |
Returns the degree of anisotropic filtering that should be applied to the texture.
This value may return 0, indicating the default value; see also get_effective_anisotropic_degree.
const LColor border_color |
Returns the solid color of the texture's border.
Some OpenGL implementations use a border for tiling textures; in Panda, it is only used for specifying the clamp color.
int effective_anisotropic_degree |
Returns the degree of anisotropic filtering that should be applied to the texture.
This value will normally not return 0, unless there is an error in the config file.
SamplerState::FilterType effective_magfilter |
Returns the filter mode of the texture for magnification, with special treatment for FT_default.
This will normally not return FT_default, unless there is an error in the config file.
SamplerState::FilterType effective_minfilter |
Returns the filter mode of the texture for minification, with special treatment for FT_default.
This will normally not return FT_default, unless there is an error in the config file.
float lod_bias |
Returns the bias that will be added to the texture level of detail when sampling this texture.
SamplerState::FilterType magfilter |
Returns the filter mode of the texture for magnification.
The mipmap constants are invalid here. This may return FT_default; see also get_effective_minfilter().
float max_lod |
Returns the maximum level of detail that will be observed when sampling this texture.
float min_lod |
Returns the minimum level of detail that will be observed when sampling this texture.
SamplerState::FilterType minfilter |
Returns the filter mode of the texture for minification.
If this is one of the mipmap constants, then the texture requires mipmaps. This may return FT_default; see also get_effective_minfilter().
SamplerState::WrapMode wrap_u |
Returns the wrap mode of the texture in the U direction.
SamplerState::WrapMode wrap_v |
Returns the wrap mode of the texture in the V direction.
SamplerState::WrapMode wrap_w |
Returns the wrap mode of the texture in the W direction.
This is the depth direction of 3-d textures.