Kemena3D
Loading...
Searching...
No Matches
kemena::kTexture2D Class Reference

Extends kTexture with 2D-specific metadata and optional CPU-side pixel data. More...

#include <ktexture2d.h>

Inheritance diagram for kemena::kTexture2D:
Collaboration diagram for kemena::kTexture2D:

Public Member Functions

 kTexture2D ()
 Constructs an empty 2D texture with zeroed metadata and no pixel data.
virtual ~kTexture2D ()
 Destroys the 2D texture and releases any retained CPU-side pixel data.
void setWidth (int newWidth)
 Sets the texture width.
int getWidth ()
 Returns the texture width in pixels.
void setHeight (int newHeight)
 Sets the texture height.
int getHeight ()
 Returns the texture height in pixels.
void setChannels (int newChannel)
 Sets the number of colour channels.
int getChannels ()
 Returns the number of colour channels.
void setData (unsigned char *newData)
 Stores a pointer to the CPU-side pixel data.
unsigned char * getData ()
 Returns the CPU-side pixel data pointer.
Public Member Functions inherited from kemena::kTexture
 kTexture ()
 Constructs an empty texture with no GPU handle assigned.
virtual ~kTexture ()
 Virtual destructor; allows safe polymorphic deletion of derived textures.
kTextureduplicate (kString newName)
 Creates a shallow copy with a different sampler name.
void setTextureID (GLuint newTextureID)
 Sets the GPU texture handle.
GLuint getTextureID ()
 Returns the GPU texture handle.
void setTextureName (kString newName)
 Sets the GLSL sampler uniform name for this texture.
kString getTextureName ()
 Returns the GLSL sampler uniform name.
void setType (kTextureType newType)
 Sets the texture type (2D or cube map).
kTextureType getType ()
 Returns the texture type.

Detailed Description

Extends kTexture with 2D-specific metadata and optional CPU-side pixel data.

Pixel data is optionally retained after upload (when keepData is true in kAssetManager::loadTexture2D) for later CPU access.

Constructor & Destructor Documentation

◆ kTexture2D()

kemena::kTexture2D::kTexture2D ( )

Constructs an empty 2D texture with zeroed metadata and no pixel data.

◆ ~kTexture2D()

virtual kemena::kTexture2D::~kTexture2D ( )
virtual

Destroys the 2D texture and releases any retained CPU-side pixel data.

Member Function Documentation

◆ getChannels()

int kemena::kTexture2D::getChannels ( )

Returns the number of colour channels.

Returns
Channel count.

◆ getData()

unsigned char * kemena::kTexture2D::getData ( )

Returns the CPU-side pixel data pointer.

Returns
Raw pixel bytes, or nullptr if not retained.

◆ getHeight()

int kemena::kTexture2D::getHeight ( )

Returns the texture height in pixels.

Returns
Height.

◆ getWidth()

int kemena::kTexture2D::getWidth ( )

Returns the texture width in pixels.

Returns
Width.

◆ setChannels()

void kemena::kTexture2D::setChannels ( int newChannel)

Sets the number of colour channels.

Parameters
newChannelChannel count (1=grey, 3=RGB, 4=RGBA).

◆ setData()

void kemena::kTexture2D::setData ( unsigned char * newData)

Stores a pointer to the CPU-side pixel data.

Parameters
newDataPointer to raw pixel bytes; caller manages lifetime.

◆ setHeight()

void kemena::kTexture2D::setHeight ( int newHeight)

Sets the texture height.

Parameters
newHeightHeight in pixels.

◆ setWidth()

void kemena::kTexture2D::setWidth ( int newWidth)

Sets the texture width.

Parameters
newWidthWidth in pixels.

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