CoriEngine
Loading...
Searching...
No Matches
Cori::Graphics::Texture2D Class Referenceabstract

A regular 2D texture with 1 layer. More...

#include <Texture.hpp>

Inheritance diagram for Cori::Graphics::Texture2D:
Collaboration diagram for Cori::Graphics::Texture2D:

Classes

class  Descriptor
 Texture2D Descriptor meant to be used with AssetManager only. More...

Public Types

enum  PixelFormat { RGBA8888 , RGB888 }
 Available pixel formats. More...
enum  WrapMode { CLAMP_TO_EDGE , CLAMP_TO_BORDER , REPEAT }
 Available wrap modes. More...
enum  Filter { LINEAR , NEAREST }
 Available filtering options. More...

Public Member Functions

virtual uint32_t GetWidth () const =0
 Gives the texture width.
virtual uint32_t GetHeight () const =0
 Gives the texture height.
virtual bool HasSemiTransparency () const =0
 Checks if texture has semi transparency.
virtual void Bind (uint32_t slot) const =0
 Binds the texture to the slot.
AssetStatus GetStatus () const

Static Public Member Functions

static std::shared_ptr< Texture2DCreate (const std::shared_ptr< Image > &image)
 Creates a Texture2D from the Image.
static std::shared_ptr< Texture2DCreate (const void *pixelData, const uint32_t width, const uint32_t height, const Params &params)
 Creates a Texture2D.

Protected Attributes

AssetStatus m_Status { AssetStatus::UNSPECIFIED }

Detailed Description

A regular 2D texture with 1 layer.

Definition at line 99 of file Texture.hpp.

Member Enumeration Documentation

◆ Filter

Available filtering options.

Enumerator
LINEAR 
NEAREST 

Definition at line 38 of file Texture.hpp.

◆ PixelFormat

Available pixel formats.

Enumerator
RGBA8888 
RGB888 

Definition at line 24 of file Texture.hpp.

◆ WrapMode

Available wrap modes.

Enumerator
CLAMP_TO_EDGE 
CLAMP_TO_BORDER 
REPEAT 

Definition at line 31 of file Texture.hpp.

Member Function Documentation

◆ Bind()

virtual void Cori::Graphics::Texture::Bind ( uint32_t slot) const
pure virtualinherited

Binds the texture to the slot.

Parameters
slotSlot to bound the texture to.
Note
Don't touch this if you're not using it outside the provided Renderer2D.

Implemented in Cori::Graphics::Internal::OpenGLTexture2D.

◆ Create() [1/2]

std::shared_ptr< Texture2D > Cori::Graphics::Texture2D::Create ( const std::shared_ptr< Image > & image)
staticnodiscard

Creates a Texture2D from the Image.

Parameters
imageImage to create Texture2D from.
Returns
Shared pointer to the created Texture2D.

Definition at line 7 of file Texture.cpp.

Here is the call graph for this function:

◆ Create() [2/2]

std::shared_ptr< Texture2D > Cori::Graphics::Texture2D::Create ( const void * pixelData,
const uint32_t width,
const uint32_t height,
const Params & params )
staticnodiscard

Creates a Texture2D.

Parameters
pixelDataPixel data to create Texture2D from.
widthWidth of the source picture data.
heightHeight of the source picture data.
paramsParameters to create a texture with.
Returns
Shared pointer to the created Texture2D.

Definition at line 13 of file Texture.cpp.

Here is the call graph for this function:

◆ GetHeight()

virtual uint32_t Cori::Graphics::Texture::GetHeight ( ) const
nodiscardpure virtualinherited

Gives the texture height.

Returns
Texture height.

Implemented in Cori::Graphics::Internal::OpenGLTexture2D.

◆ GetStatus()

AssetStatus Cori::Graphics::Texture::GetStatus ( ) const
inlineinherited

Definition at line 88 of file Texture.hpp.

◆ GetWidth()

virtual uint32_t Cori::Graphics::Texture::GetWidth ( ) const
nodiscardpure virtualinherited

Gives the texture width.

Returns
Texture width.

Implemented in Cori::Graphics::Internal::OpenGLTexture2D.

◆ HasSemiTransparency()

virtual bool Cori::Graphics::Texture::HasSemiTransparency ( ) const
nodiscardpure virtualinherited

Checks if texture has semi transparency.

Returns

Implemented in Cori::Graphics::Internal::OpenGLTexture2D.

Member Data Documentation

◆ m_Status

AssetStatus Cori::Graphics::Texture::m_Status { AssetStatus::UNSPECIFIED }
protectedinherited

Definition at line 93 of file Texture.hpp.


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