![]() |
CUGL 4.0
Cornell University Game Library
|
#include <CUSampler.h>
Public Member Functions | |
| Sampler () | |
| ~Sampler () | |
| void | dispose () |
| bool | init () |
| bool | initWithWrap (TextureWrap wrapS, TextureWrap wrapT) |
| bool | initWithFilters (TextureFilter magFilter, TextureFilter minFilter) |
| bool | init (TextureWrap wrapS, TextureWrap wrapT, TextureFilter magFilter, TextureFilter minFilter) |
| size_t | id () const |
| SamplerData * | getImplementation () |
| TextureFilter | getMagFilter () const |
| void | setMagFilter (TextureFilter filter) |
| TextureFilter | getMinFilter () const |
| void | setMinFilter (TextureFilter filter) |
| TextureWrap | getWrapS () const |
| void | setWrapS (TextureWrap wrap) |
| TextureWrap | getWrapT () const |
| void | setWrapT (TextureWrap wrap) |
Static Public Member Functions | |
| static std::shared_ptr< Sampler > | alloc () |
| static std::shared_ptr< Sampler > | allocWithWrap (TextureWrap wrapS, TextureWrap wrapT) |
| static std::shared_ptr< Sampler > | allocWithFilters (TextureFilter magFilter, TextureFilter minFilter) |
| static std::shared_ptr< Sampler > | alloc (TextureWrap wrapS, TextureWrap wrapT, TextureFilter magFilter, TextureFilter minFilter) |
This is a class representing a sampler.
A sampler is second part of a Texture. It is used to to instruct the texture how it should read and filter data from the underlying image. In OpenGL, this is a simple struct. However, its allocation is a little more involved in Vulkan and Metal.
|
inline |
Creates a new empty sampler with no filter or wrap-style.
This method performs no allocations. You must call init to generate a proper sampler.
|
inline |
Deletes this sampler, disposing all resources
|
inlinestatic |
Returns a newly allocated a default sampler.
The sampler will use a TextureFilter#LINEAR filter. It will also use TextureWrap#CLAMP on both axes.
|
inlinestatic |
Returns a newly allocated a sampler with the given wrap and filter values
| wrapS | The horizontal wrap |
| wrapT | The vertical wrap |
| magFilter | The filter for magnifying an image |
| minFilter | The filter for shrinking an image |
|
inlinestatic |
Returns a newly allocated sampler with the given filter values
The sampler will use TextureWrap#CLAMP on both axes.
| magFilter | The filter for magnifying an image |
| minFilter | The filter for shrinking an image |
|
inlinestatic |
Returns a newly allocated sampler with the given wrap values
The sampler will use a TextureFilter#LINEAR filter.
| wrapS | The horizontal wrap |
| wrapT | The vertical wrap |
| void cugl::graphics::Sampler::dispose | ( | ) |
Deletes the sampler and resets all attributes.
You must reinitialize the sampler to use it.
|
inline |
Returns the platform-specific implementation for this sampler
The value returned is an opaque type encapsulating the information for either OpenGL or Vulkan.
|
inline |
Returns the magnification filter of this sampler.
The magnification filter is the algorithm hint that the graphics card uses to make an image larger. The default is LINEAR.
|
inline |
Returns the minimization filter of this sampler.
The minimization filter is the algorithm hint that the graphics card uses to make an image smaller. The default is LINEAR.
|
inline |
Returns the horizontal wrap of this sampler.
The default is CLAMP.
|
inline |
Returns the vertical wrap of this sampler.
The default is CLAMP.
| size_t cugl::graphics::Sampler::id | ( | ) | const |
Returns a unique identifier for this sampler
This value can be used in memory-based hashes.
|
inline |
Initializes a default sampler.
The sampler will use a TextureFilter#LINEAR filter. It will also use TextureWrap#CLAMP on both axes.
| bool cugl::graphics::Sampler::init | ( | TextureWrap | wrapS, |
| TextureWrap | wrapT, | ||
| TextureFilter | magFilter, | ||
| TextureFilter | minFilter | ||
| ) |
Initializes a sampler with the given wrap and filter values
| wrapS | The horizontal wrap |
| wrapT | The vertical wrap |
| magFilter | The filter for magnifying an image |
| minFilter | The filter for shrinking an image |
|
inline |
Initializes a sampler with the given filter values
The sampler will use TextureWrap#CLAMP on both axes.
| magFilter | The filter for magnifying an image |
| minFilter | The filter for shrinking an image |
|
inline |
Initializes a sampler with the given wrap values
The sampler will use a TextureFilter#LINEAR filter.
| wrapS | The horizontal wrap |
| wrapT | The vertical wrap |
| void cugl::graphics::Sampler::setMagFilter | ( | TextureFilter | filter | ) |
Sets the magnification filter of this sampler.
The magnification filter is the algorithm hint that the graphics card uses to make an image larger. The default is LINEAR.
When this value is changed, the value will be pushed to the implementation and all subsequent drawing commands will use the new value. Previous drawing commands (including those in flight) are unaffected.
| filter | The magnification filter of this sampler. |
| void cugl::graphics::Sampler::setMinFilter | ( | TextureFilter | filter | ) |
Sets the minimization filter of this sampler.
The minimization filter is the algorithm hint that the graphics card uses to make an image smaller. The default is LINEAR.
When this value is changed, the value will be pushed to the implementation and all subsequent drawing commands will use the new value. Previous drawing commands (including those in flight) are unaffected.
| filter | The min filter of this sampler. |
| void cugl::graphics::Sampler::setWrapS | ( | TextureWrap | wrap | ) |
Sets the horizontal wrap of this sampler.
The default is CLAMP.
When this value is changed, the value will be pushed to the implementation and all subsequent drawing commands will use the new value. Previous drawing commands (including those in flight) are unaffected.
| wrap | The horizontal wrap setting of this sampler |
| void cugl::graphics::Sampler::setWrapT | ( | TextureWrap | wrap | ) |
Sets the vertical wrap of this sampler.
The default is CLAMP.
When this value is changed, the value will be pushed to the implementation and all subsequent drawing commands will use the new value. Previous drawing commands (including those in flight) are unaffected.
| wrap | The vertical wrap setting of this sampler |