Class Texture#
Defined in File Texture.h
Inheritance Relationships#
Base Type#
public Karana::Core::Base(Class Base)
Derived Type#
public Karana::Scene::GrayscaleTexture(Class GrayscaleTexture)
Class Documentation#
-
class Texture : public Karana::Core::Base#
Class for a texture image.
See Scene layer for more discussion on the scene layer.
Subclassed by Karana::Scene::GrayscaleTexture
Public Functions
-
Texture(std::string_view name, const TextureData &data_in)#
Texture constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.
-
void writeToFile(const std::filesystem::path &filename)#
Write the texture to a file.
- Parameters:
filename – The name of the file to write to.
-
std::vector<unsigned char> writeToPngMem() const#
Write the texture to a png stream.
- Returns:
The png stream as an std::vector of unsigned char*
-
const TextureData &getData() const#
Get the texture data associated with the Texture.
- Returns:
The texture data associated with the Texture.
-
virtual void setData(const TextureData &data)#
Set the texture data associated with the Texture.
- Parameters:
data – The data to set the Texture data to.
-
virtual void setData(TextureData &&data)#
Set the texture data associated with the Texture.
- Parameters:
data – The data to set the Texture data to.
Public Static Functions
-
static kc::ks_ptr<Texture> create(std::string_view name, const TextureData &data)#
Create a Texture instance.
-
static kc::ks_ptr<Texture> create(std::string_view name, unsigned char *buffer, int len)#
Create a Texture instance.
-
static kc::ks_ptr<Texture> lookupOrCreateTexture(const std::filesystem::path &filename)#
Create a texture from a file name. This caches the texture so that future versions created with the same file name just return a pointer to the same texture.
- Parameters:
filename – The name of the file.
- Returns:
A ks_ptr to the Texture.
Protected Attributes
-
TextureData _data#
Holds the data for the texture.
-
Texture(std::string_view name, const TextureData &data_in)#