CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RendererTexture Class Reference

A texture that is usable by the renderer and the GPU. More...

#include <CeresEngine/Renderer/Resources/RendererTexture.hpp>

Inheritance diagram for CeresEngine::RendererTexture:
CeresEngine::RefCounted< RendererTexture >

Public Member Functions

 RendererTexture (RendererTextureManager &manager, const TexturePtr &engineImage)
 Creates a new renderer texture instance.
 
 ~RendererTexture ()
 Destroys the renderer texture instance.
 
RendererTextureFlags getFlags () const noexcept
 A set of flags for the renderer texture.
 
bool isCompressed () const noexcept
 
bool isConverted () const noexcept
 
RendererTextureState getState () const noexcept
 The state the renderer texture is currently in.
 
bool isPending () const noexcept
 The texture is not uploaded to the GPU and the upload process hasn't started yet.
 
bool isUploading () const noexcept
 The texture is in the process of being uploaded to the GPU, but the asynchronous upload operation hasn't finished yet.
 
bool isRelocating () const noexcept
 The texture is uploaded to the GPU but is in the process of being relocated to another image.
 
bool isUploaded () const noexcept
 The texture is uploaded to the GPU and is ready to be used by the renderer.
 
RendererTextureType getType () const noexcept
 The type of renderer texture.
 
bool is2D () const noexcept
 The texture represents a regular 2D texture.
 
bool isCubeMap () const noexcept
 The texture represents a cube map texture with 6 faces.
 
bool isReady () const noexcept
 Checks if the texture is ready to be used by the renderer.
 
 operator bool () const noexcept
 Checks if the texture is ready to be used by the renderer.
 
const SPtr< Texture > & getResource () const noexcept
 A pointer to the image resource object that will be uploaded to the GPU.
 
const GPUImagePtrgetImage () const noexcept
 The current image instance as allocated by the texture manager.
 
Async uploadPixelData ()
 
- Public Member Functions inherited from CeresEngine::RefCounted< RendererTexture >
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Static Public Member Functions

static const GPUImagePtrgetImage (const RendererTexture &texture)
 The current image instance as allocated by the texture manager.
 
static GPUImagePtr getImage (const RendererTexture *const texture)
 The current image instance as allocated by the texture manager.
 
static GPUImagePtr getImage (const RendererTexturePtr &texture)
 The current image instance as allocated by the texture manager.
 

Public Attributes

Event< void()> didChangeImage
 An event triggered internally in the renderer whenever the GPU image for the texture has changed.
 

Private Member Functions

void setFlags (RendererTextureFlags flags)
 A set of flags for the renderer texture.
 
void setState (RendererTextureState state)
 The state the renderer texture is currently in.
 
void setImage (GPUImagePtr &&image)
 The current image instance as allocated by the texture manager.
 

Private Attributes

RendererTextureManagermManager
 The texture manager that owns and manages this texture instance.
 
UInt32 mID
 A ID that uniquely identifies the texture in the renderer.
 
RendererTextureFlags mFlags
 A set of flags for the renderer texture.
 
RendererTextureState mState = RendererTextureState::Pending
 The state the renderer texture is currently in.
 
RendererTextureType mType = RendererTextureType::Texture2D
 The type of renderer texture.
 
TexturePtr mResource
 A pointer to the image resource object that will be uploaded to the GPU.
 
GPUImagePtr mImage
 The current image instance as allocated by the texture manager.
 

Friends

class RendererTextureManager
 

Detailed Description

A texture that is usable by the renderer and the GPU.

A renderer texture is allocated by a RendererTextureManager, which is responsible for taking an Image instance, uploading it to the GPU in an appropriate Image.

The manager is free to relocate the GPU image into another image at any time. Whenever the manager relocates data, the user can be notified of changes by subscribing to the onImageChanged event.

The renderer might also require to perform conversions on the image format before uploading data to the GPU, in case the native image format is not supported by the GPU.

Constructor & Destructor Documentation

◆ RendererTexture()

CeresEngine::RendererTexture::RendererTexture ( RendererTextureManager manager,
const TexturePtr engineImage 
)
explicit

Creates a new renderer texture instance.

◆ ~RendererTexture()

CeresEngine::RendererTexture::~RendererTexture ( )

Destroys the renderer texture instance.

Since this object is reference counted, the destructor is usually called automatically when the reference count reaches zero.

Member Function Documentation

◆ getFlags()

RendererTextureFlags CeresEngine::RendererTexture::getFlags ( ) const
inlinenoexcept

A set of flags for the renderer texture.

◆ getImage() [1/4]

const GPUImagePtr & CeresEngine::RendererTexture::getImage ( ) const
inlinenoexcept

The current image instance as allocated by the texture manager.

The manager is free to relocate this image into another location if it can prove that relocating it will yield in faster rendering or better memory re-utilization.

◆ getImage() [2/4]

static const GPUImagePtr & CeresEngine::RendererTexture::getImage ( const RendererTexture texture)
inlinestatic

The current image instance as allocated by the texture manager.

The manager is free to relocate this image into another location if it can prove that relocating it will yield in faster rendering or better memory re-utilization.

◆ getImage() [3/4]

static GPUImagePtr CeresEngine::RendererTexture::getImage ( const RendererTexture *const  texture)
inlinestatic

The current image instance as allocated by the texture manager.

The manager is free to relocate this image into another location if it can prove that relocating it will yield in faster rendering or better memory re-utilization.

◆ getImage() [4/4]

static GPUImagePtr CeresEngine::RendererTexture::getImage ( const RendererTexturePtr texture)
inlinestatic

The current image instance as allocated by the texture manager.

The manager is free to relocate this image into another location if it can prove that relocating it will yield in faster rendering or better memory re-utilization.

◆ getResource()

const SPtr< Texture > & CeresEngine::RendererTexture::getResource ( ) const
inlinenoexcept

A pointer to the image resource object that will be uploaded to the GPU.

◆ getState()

RendererTextureState CeresEngine::RendererTexture::getState ( ) const
inlinenoexcept

The state the renderer texture is currently in.

◆ getType()

RendererTextureType CeresEngine::RendererTexture::getType ( ) const
inlinenoexcept

The type of renderer texture.

◆ is2D()

bool CeresEngine::RendererTexture::is2D ( ) const
inlinenoexcept

The texture represents a regular 2D texture.

◆ isCompressed()

bool CeresEngine::RendererTexture::isCompressed ( ) const
inlinenoexcept

◆ isConverted()

bool CeresEngine::RendererTexture::isConverted ( ) const
inlinenoexcept

◆ isCubeMap()

bool CeresEngine::RendererTexture::isCubeMap ( ) const
inlinenoexcept

The texture represents a cube map texture with 6 faces.

◆ isPending()

bool CeresEngine::RendererTexture::isPending ( ) const
inlinenoexcept

The texture is not uploaded to the GPU and the upload process hasn't started yet.

◆ isReady()

bool CeresEngine::RendererTexture::isReady ( ) const
inlinenoexcept

Checks if the texture is ready to be used by the renderer.

◆ isRelocating()

bool CeresEngine::RendererTexture::isRelocating ( ) const
inlinenoexcept

The texture is uploaded to the GPU but is in the process of being relocated to another image.

The current image is still valid, but will be replaced soon as soon as the GPU finishes coping the data.

◆ isUploaded()

bool CeresEngine::RendererTexture::isUploaded ( ) const
inlinenoexcept

The texture is uploaded to the GPU and is ready to be used by the renderer.

◆ isUploading()

bool CeresEngine::RendererTexture::isUploading ( ) const
inlinenoexcept

The texture is in the process of being uploaded to the GPU, but the asynchronous upload operation hasn't finished yet.

◆ operator bool()

CeresEngine::RendererTexture::operator bool ( ) const
inlineexplicitnoexcept

Checks if the texture is ready to be used by the renderer.

◆ setFlags()

void CeresEngine::RendererTexture::setFlags ( RendererTextureFlags  flags)
private

A set of flags for the renderer texture.

◆ setImage()

void CeresEngine::RendererTexture::setImage ( GPUImagePtr &&  image)
private

The current image instance as allocated by the texture manager.

The manager is free to relocate this image into another location if it can prove that relocating it will yield in faster rendering or better memory re-utilization.

◆ setState()

void CeresEngine::RendererTexture::setState ( RendererTextureState  state)
private

The state the renderer texture is currently in.

◆ uploadPixelData()

Async CeresEngine::RendererTexture::uploadPixelData ( )

Friends And Related Symbol Documentation

◆ RendererTextureManager

Member Data Documentation

◆ didChangeImage

Event<void()> CeresEngine::RendererTexture::didChangeImage

An event triggered internally in the renderer whenever the GPU image for the texture has changed.

Users of the renderer texture can subscribe to this event to be notified when the manager relocates the GPU image to a different GPU image.

◆ mFlags

RendererTextureFlags CeresEngine::RendererTexture::mFlags
private

A set of flags for the renderer texture.

◆ mID

UInt32 CeresEngine::RendererTexture::mID
private

A ID that uniquely identifies the texture in the renderer.

Can be used to index the texture from bindless buffers.

◆ mImage

GPUImagePtr CeresEngine::RendererTexture::mImage
private

The current image instance as allocated by the texture manager.

The manager is free to relocate this image into another location if it can prove that relocating it will yield in faster rendering or better memory re-utilization.

◆ mManager

RendererTextureManager& CeresEngine::RendererTexture::mManager
private

The texture manager that owns and manages this texture instance.

◆ mResource

TexturePtr CeresEngine::RendererTexture::mResource
private

A pointer to the image resource object that will be uploaded to the GPU.

◆ mState

RendererTextureState CeresEngine::RendererTexture::mState = RendererTextureState::Pending
private

The state the renderer texture is currently in.

◆ mType

RendererTextureType CeresEngine::RendererTexture::mType = RendererTextureType::Texture2D
private

The type of renderer texture.


The documentation for this class was generated from the following file: