Effect using a texture as an input to use it as an environment for the view. More...
Public Member Functions | |
ImageEnvironmentEffect (System *system) noexcept | |
virtual | ~ImageEnvironmentEffect () |
nkGraphics::Texture * | getSourceTexture () const |
nkGraphics::Sampler * | getSourceSampler () const |
nkGraphics::Camera * | getSourceCamera () const |
IMAGE_ENVIRONMENT_PROJECTION | getSourceProjection () const |
void | setSourceTexture (nkGraphics::Texture *value) |
void | setSourceSampler (nkGraphics::Sampler *value) |
void | setSourceCamera (nkGraphics::Camera *value) |
void | setSourceProjection (IMAGE_ENVIRONMENT_PROJECTION value) |
virtual bool | load () override |
virtual void | unload () override |
Public Member Functions inherited from nkAstraeus::Effect | |
Effect (EFFECT_TYPE type) noexcept | |
virtual | ~Effect () |
nkMemory::StringView | getName () const |
nkGraphics::Shader * | getShader () const |
EFFECT_TYPE | getType () const |
void | setName (nkMemory::StringView value) |
Static Public Member Functions | |
static nkMemory::UniquePtr< ImageEnvironmentEffect > | create (System *system=nullptr) |
static IMAGE_ENVIRONMENT_PROJECTION | getRequiredProjection (const ImageEnvironmentEffectInfo &info) |
Effect using a texture as an input to use it as an environment for the view.
This effect allows to create environment only based on images. For instance, it can use cubemaps as input, which will make it use a given camera's direction to derive pixel directions to sample the texture from.
This effect can be used to easily add a more living background than the clear color.
|
noexcept |
Constructor. Alternatively, see ImageEnvironmentEffect::create(), or EffectManager::createOrRetrieve().
system | The system the resource should live in. |
|
virtual |
Destructor. See EffectManager::erase().
nkGraphics::Texture* nkAstraeus::ImageEnvironmentEffect::getSourceTexture | ( | ) | const |
nkGraphics::Sampler* nkAstraeus::ImageEnvironmentEffect::getSourceSampler | ( | ) | const |
nkGraphics::Camera* nkAstraeus::ImageEnvironmentEffect::getSourceCamera | ( | ) | const |
IMAGE_ENVIRONMENT_PROJECTION nkAstraeus::ImageEnvironmentEffect::getSourceProjection | ( | ) | const |
void nkAstraeus::ImageEnvironmentEffect::setSourceTexture | ( | nkGraphics::Texture * | value | ) |
Sets the source texture that will be used by the effect.
value | The texture to use as source. |
void nkAstraeus::ImageEnvironmentEffect::setSourceSampler | ( | nkGraphics::Sampler * | value | ) |
Sets the sampler that will be used by the effect. If none or nullptr is provided, then a default sampler will be used.
value | The sampler to use if required, nullptr to reset to the default one. |
void nkAstraeus::ImageEnvironmentEffect::setSourceCamera | ( | nkGraphics::Camera * | value | ) |
Sets the camera that will be used to derive the required pixel directions. If none or nullptr is provided, then the camera used by the context using the effect at drawing time will be used.
value | The camera to use if required, nullptr to reset to the default behavior. |
void nkAstraeus::ImageEnvironmentEffect::setSourceProjection | ( | IMAGE_ENVIRONMENT_PROJECTION | value | ) |
Sets the projection to use to correctly recompute the source texture's uvs. Defaults to AUTO, for which the projection will be EQUIRECTANGULAR for a 2D texture, and CUBE for a cubemap. This will be derived at loading time from the set source texture. If the texture is not loaded at that time, it is better to set it manually from this setter to be sure the right projection will be picked up during loading.
value | The projection to assume for the source texture set. |
|
overridevirtual |
Loads the effect and make it ready for rendering.
Implements nkAstraeus::Effect.
|
overridevirtual |
Unloads the effect and its internal memory. After that, the effect is unusable for rendering.
Implements nkAstraeus::Effect.
|
static |
Creates an instance of the class, and returns ownership over it.
system | The system the resource should live in. If left to nullptr, will seek the singleton instance of the system. |
|
static |
Allows to access the projection that will be used from a given info state. Used internally to derive the final projection used when AUTO is selected.
info | The information structure the selection will be based on. |