sculpto
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
scl::texture_2d Class Referenceabstract

#include <texture.h>

Inheritance diagram for scl::texture_2d:
scl::gl_texture_2d

Public Member Functions

int GetWidth () const
 
int GetHeight () const
 
virtual ~texture_2d ()=default
 
virtual void Bind (u32 Slot) const =0
 
virtual void Unbind () const =0
 
virtual image GetImage ()=0
 
virtual void Free ()=0
 

Static Public Member Functions

static shared< texture_2dCreate (const image &Image, texture_type Type=texture_type::COLOR)
 

Protected Attributes

int Width {}
 
int Height {}
 

Detailed Description

Texture interface.

Definition at line 25 of file texture.h.

Constructor & Destructor Documentation

◆ ~texture_2d()

virtual scl::texture_2d::~texture_2d ( )
virtualdefault

Texture default deatructor.

Member Function Documentation

◆ Bind()

virtual void scl::texture_2d::Bind ( u32  Slot) const
pure virtual
  • Bind texture to current render stage function.
Parameters
Slot- texture slot to bind it in.
Returns
None.

Implemented in scl::gl_texture_2d.

◆ Create()

scl::shared< scl::texture_2d > scl::texture_2d::Create ( const image Image,
texture_type  Type = texture_type::COLOR 
)
static
  • Create texture from image container function.
Parameters
Image- image container to get data from.
Returns
created texture pointer.

Definition at line 14 of file texture.cpp.

15{
16 switch (render_context::GetApi())
17 {
18 case scl::render_context_api::OpenGL: return CreateShared<gl_texture_2d>(Image, Type);
19 case scl::render_context_api::DirectX: SCL_CORE_ASSERT(0, "This API is currently unsupported."); return nullptr;
20 }
21
22 SCL_CORE_ASSERT(0, "Unknown render API was selected.");
23 return nullptr;
24}
#define SCL_CORE_ASSERT(expr,...)
Definition: assert.h:69
static render_context_api GetApi()

◆ Free()

virtual void scl::texture_2d::Free ( )
pure virtual
  • Unload texture from GPU memory function.
Parameters
None.
Returns
None.

Implemented in scl::gl_texture_2d.

◆ GetHeight()

int scl::texture_2d::GetHeight ( ) const
inline

Texture height (in pixels) getter function.

Definition at line 34 of file texture.h.

34{ return Height; }

◆ GetImage()

virtual image scl::texture_2d::GetImage ( )
pure virtual
  • Load texture image from GPU memory function.
Parameters
None.
Returns
texture image.

Implemented in scl::gl_texture_2d.

◆ GetWidth()

int scl::texture_2d::GetWidth ( ) const
inline

Texture data getter/setter function.

Texture width (in pixels) getter function.

Definition at line 32 of file texture.h.

32{ return Width; }

◆ Unbind()

virtual void scl::texture_2d::Unbind ( ) const
pure virtual
  • Unbind texture from current render stage function.
Parameters
Slot- texture slot to unbind it from.
Returns
None.

Implemented in scl::gl_texture_2d.

Member Data Documentation

◆ Height

int scl::texture_2d::Height {}
protected

Definition at line 28 of file texture.h.

◆ Width

int scl::texture_2d::Width {}
protected

Texture data.

Definition at line 28 of file texture.h.


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