Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Engine::Texture Class Reference

This object is used to store information regarding a texture. NOTE: Only the resource manager is allowed to create this object. More...

#include <Texture.hpp>

Public Member Functions

virtual ~Texture ()
 Destructor of texture object. More...
 
uint64_t GetTexture () const
 This method allows you to get the texture number assigned by the graphics API. More...
 
eastl::string GetFileName () const
 This method allows you to retrieve the name of this texture. More...
 
virtual void CreateTextureWithData (stbi_uc *data, bool genMipMaps, TextureDataSize bytes=TextureDataSize::U_CHAR, bool storage=false)
 This method allows you to create a texture from RGBA provided data. More...
 
int getWidth () const
 temp for vulkan More...
 
int getHeight () const
 This method allows you to get the height of this texture. More...
 
bool operator== (const Texture &texture)
 This method allows you to compare a texture against another texture. More...
 
bool operator!= (const Texture &texture)
 This method allows you to compare a texture against another texture. More...
 

Public Attributes

glm::vec4 mainColor = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)
 The color of this texture. More...
 

Protected Member Functions

 Texture (const eastl::string &filename, int desiredChannels=4)
 Creates a texture by loading the data from a texture file. This method used stb_image to load the image. More...
 

Protected Attributes

eastl::string fileName
 
TextureDataSize dataSize
 
uint64_t texture = 0
 
int width = 0
 
int height = 0
 
int channels = 0
 

Friends

class ResourceManager
 
class Skeleton
 

Detailed Description

This object is used to store information regarding a texture. NOTE: Only the resource manager is allowed to create this object.

Definition at line 23 of file Texture.hpp.

Constructor & Destructor Documentation

Engine::Texture::~Texture ( )
virtual

Destructor of texture object.

Definition at line 13 of file Texture.cpp.

Engine::Texture::Texture ( const eastl::string &  filename,
int  desiredChannels = 4 
)
explicitprotected

Creates a texture by loading the data from a texture file. This method used stb_image to load the image.

Parameters
filenameThis is the name of the texture you want to load. NOTE: The texture needs to be in the folder 'Resources/Textures/' (It can be in a subfolder, as long as it's in the Textures folder). And the extension type needs to be added as well.
desiredChannelsThe amount of desired channels for this texture. This value is 4 by default.

Definition at line 5 of file Texture.cpp.

Member Function Documentation

void Engine::Texture::CreateTextureWithData ( stbi_uc *  data,
bool  genMipMaps,
TextureDataSize  bytes = TextureDataSize::U_CHAR,
bool  storage = false 
)
virtual

This method allows you to create a texture from RGBA provided data.

Parameters
dataThe data of this texture.
genMipMapsThis bool defines if this texture should generate mip maps.
bytesThe number of bytes per color. Default is 1 (single char)
storageUsed by Vulkan only. Defines if you want to use VK_IMAGE_USAGE_STORAGE_BIT or VK_IMAGE_USAGE_SAMPLED_BIT.

Definition at line 27 of file Texture.cpp.

eastl::string Engine::Texture::GetFileName ( ) const

This method allows you to retrieve the name of this texture.

Returns
Returns the name of this texture as a std::string.

Definition at line 22 of file Texture.cpp.

int Engine::Texture::getHeight ( ) const
inline

This method allows you to get the height of this texture.

Returns
Returns the height of this texture as an int.

Definition at line 85 of file Texture.hpp.

uint64_t Engine::Texture::GetTexture ( ) const

This method allows you to get the texture number assigned by the graphics API.

Get the texture ID in OpenGL

Returns
Returns the texture number as un uint64_t.

Definition at line 17 of file Texture.cpp.

int Engine::Texture::getWidth ( ) const
inline

temp for vulkan

This method allows you to get the width of this texture.

Returns
Returns the width of this texture as an int.

Definition at line 80 of file Texture.hpp.

bool Engine::Texture::operator!= ( const Texture texture)

This method allows you to compare a texture against another texture.

Parameters
textureThe texture you want to compare against.
Returns
Returns true if the textures are not equal to each other otherwise it returns false.

Definition at line 43 of file Texture.cpp.

bool Engine::Texture::operator== ( const Texture texture)

This method allows you to compare a texture against another texture.

Parameters
textureThe texture you want to compare against.
Returns
Returns true if both textures are equal to each other otherwise it returns false.

Definition at line 31 of file Texture.cpp.

Friends And Related Function Documentation

friend class ResourceManager
friend

Definition at line 26 of file Texture.hpp.

friend class Skeleton
friend

Definition at line 27 of file Texture.hpp.

Member Data Documentation

int Engine::Texture::channels = 0
protected

Definition at line 106 of file Texture.hpp.

TextureDataSize Engine::Texture::dataSize
protected

Definition at line 102 of file Texture.hpp.

eastl::string Engine::Texture::fileName
protected

Definition at line 101 of file Texture.hpp.

int Engine::Texture::height = 0
protected

Definition at line 105 of file Texture.hpp.

glm::vec4 Engine::Texture::mainColor = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)

The color of this texture.

Definition at line 72 of file Texture.hpp.

uint64_t Engine::Texture::texture = 0
protected

Definition at line 103 of file Texture.hpp.

int Engine::Texture::width = 0
protected

Definition at line 104 of file Texture.hpp.


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