SamplerState¶
-
class SamplerState¶
Bases:
MemoryBaseRepresents 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.
Inheritance diagram
digraph inheritance87aac3a8ac { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "SamplerState" [URL="acron.core.SamplerState.html#acron.core.SamplerState",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "SamplerState" [arrowsize=0.75,style=""]; }-
enum FilterType¶
-
enumerator FT_nearest = 0¶
Point sample the pixel
-
enumerator FT_linear = 1¶
Bilinear filtering of four neighboring pixels
-
enumerator FT_nearest_mipmap_nearest = 2¶
Point sample the pixel from the nearest mipmap level
-
enumerator FT_linear_mipmap_nearest = 3¶
Bilinear filter the pixel from the nearest mipmap level
-
enumerator FT_nearest_mipmap_linear = 4¶
Point sample the pixel from two mipmap levels, and linearly blend
-
enumerator FT_linear_mipmap_linear = 5¶
A.k.a. trilinear filtering: Bilinear filter the pixel from two mipmap levels, and linearly blend the results.
-
enumerator FT_shadow = 6¶
The OpenGL ARB_shadow extension can be thought of as a kind of filtering.
-
enumerator FT_default = 7¶
Default is usually linear, but it depends on format. This was added at the end of the list to avoid bumping TXO version #.
-
enumerator FT_invalid = 8¶
Returned by string_filter_type() for an invalid match.
-
enumerator FT_nearest = 0¶
-
enum WrapMode¶
-
enumerator WM_clamp = 0¶
coords that would be outside [0-1] are clamped to 0 or 1
-
enumerator WM_repeat = 1¶
-
enumerator WM_mirror = 2¶
-
enumerator WM_mirror_once = 3¶
mirror once, then clamp
-
enumerator WM_border_color = 4¶
coords outside [0-1] use explicit border color Returned by string_wrap_mode() for an invalid match.
-
enumerator WM_invalid = 5¶
coords outside [0-1] use explicit border color Returned by string_wrap_mode() for an invalid match.
-
enumerator WM_clamp = 0¶
- SamplerState.__eq__()¶
- SamplerState.__init__()¶
Creates a new
SamplerStateinitialized to the default values.
- SamplerState.__lt__()¶
- SamplerState.__ne__()¶
- static SamplerState.format_filter_type()¶
Returns the indicated
FilterTypeconverted to a string word.
- SamplerState.get_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.
- SamplerState.get_border_color()¶
Returns the solid color of the texture’s border. Some OpenGL implementations use a border for tiling textures; in Acron, it is only used for specifying the clamp color.
- static SamplerState.get_class_type()¶
- static SamplerState.get_default()¶
Returns a reference to the global default immutable
SamplerStateobject.
- SamplerState.get_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.get_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.get_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.
- SamplerState.get_lod_bias()¶
Returns the bias that will be added to the texture level of detail when sampling this texture.
- SamplerState.get_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().
- SamplerState.get_max_lod()¶
Returns the maximum level of detail that will be observed when sampling this texture.
- SamplerState.get_min_lod()¶
Returns the minimum level of detail that will be observed when sampling this texture.
- SamplerState.get_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.get_wrap_u()¶
Returns the wrap mode of the texture in the U direction.
- SamplerState.get_wrap_v()¶
Returns the wrap mode of the texture in the V direction.
- SamplerState.get_wrap_w()¶
Returns the wrap mode of the texture in the W direction. This is the depth direction of 3-d textures.
- static SamplerState.is_mipmap()¶
Returns true if the indicated filter type requires the use of mipmaps, or false if it does not.
- SamplerState.is_prepared()¶
Returns true if the sampler has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.
- SamplerState.prepare()¶
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.
- SamplerState.prepare_now()¶
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
GraphicsStateGuardianis the currently active rendering context and that it is ready to accept new textures. If this is not necessarily the case, you should useprepare()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.
- SamplerState.release()¶
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.
- SamplerState.set_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.
- SamplerState.set_border_color()¶
Specifies the solid color of the SamplerState’s border. Some OpenGL implementations use a border for tiling
SamplerStates; in Acron, it is only used for specifying the clamp color.
- SamplerState.set_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.
- SamplerState.set_magfilter()¶
Sets the filtering method that should be used when viewing the
SamplerStateup close.
- SamplerState.set_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.
- SamplerState.set_min_lod()¶
Sets the minimum level of detail that will be used when sampling this texture. This may be a negative value.
- SamplerState.set_minfilter()¶
Sets the filtering method that should be used when viewing the
SamplerStatefrom a distance.
- SamplerState.set_wrap_u()¶
This setting determines what happens when the
SamplerStateis sampled with a U value outside the range 0.0-1.0. The default is WM_repeat, which indicates that theSamplerStateshould repeat indefinitely.
- SamplerState.set_wrap_v()¶
This setting determines what happens when the
SamplerStateis sampled with a V value outside the range 0.0-1.0. The default is WM_repeat, which indicates that theSamplerStateshould repeat indefinitely.
- SamplerState.set_wrap_w()¶
The W wrap direction is only used for 3-d
SamplerStates.
- static SamplerState.string_filter_type()¶
Returns the
FilterTypevalue associated with the given string representation, or FT_invalid if the string does not match any knownFilterTypevalue.
- static SamplerState.string_wrap_mode()¶
Returns the
WrapModevalue associated with the given string representation, or WM_invalid if the string does not match any knownWrapModevalue.
- SamplerState.uses_mipmaps()¶
Returns true if the minfilter settings on this sampler indicate the use of mipmapping, false otherwise.
-
enum FilterType¶