Add convenience constructor
This commit is contained in:
@@ -28,12 +28,19 @@ namespace OpenVulkano::Scene
|
||||
UpdateFrequency updateFrequency = UpdateFrequency::Never;
|
||||
const SamplerConfig* m_samplerConfig;
|
||||
bool updated = true;
|
||||
bool ownsData = false;
|
||||
|
||||
Texture(const SamplerConfig* samplerConfig = &SamplerConfig::DEFAULT, bool placeholder = false)
|
||||
: m_samplerConfig(samplerConfig)
|
||||
{ if (placeholder) MakePlaceholder(); }
|
||||
|
||||
~Texture() = default;
|
||||
Texture(Math::Vector2ui resolution, DataFormat format) : resolution(resolution, 1), format(format), ownsData(true)
|
||||
{
|
||||
size = format.CalculatedSize(resolution.x, resolution.y);
|
||||
textureBuffer = malloc(size);
|
||||
}
|
||||
|
||||
~Texture() { if (ownsData) free(textureBuffer); }
|
||||
|
||||
void MakePlaceholder(uint32_t width = 32, uint32_t height = 32,
|
||||
Math::Vector4uc color1 = {248, 123, 255, 255}, Math::Vector4uc color2 = {250, 19, 255, 255});
|
||||
|
||||
Reference in New Issue
Block a user