Added texture data format support

This commit is contained in:
2023-06-20 08:35:28 -07:00
parent 811271dc5d
commit 9574e9a3e9
32 changed files with 189 additions and 57 deletions

View File

@ -27,6 +27,11 @@ namespace Dawn {
TEXTURE_FILTER_MODE_LINEAR = 1
};
enum TextureDataFormat {
TEXTURE_DATA_FORMAT_UNSIGNED_BYTE = 0,
TEXTURE_DATA_FORMAT_FLOAT = 1
};
class ITexture : public StateOwner {
protected:
bool_t texturePropertiesNeedUpdating = true;
@ -69,11 +74,13 @@ namespace Dawn {
* @param width Width of the texture (in pixels).
* @param height Height of the texture (in pixels).
* @param format Data format of the texture to use.
* @param dataFormat Data format of the texture to use.
*/
virtual void setSize(
int32_t width,
int32_t height,
enum TextureFormat format
enum TextureFormat format,
enum TextureDataFormat dataFormat
) = 0;
/**

View File

@ -77,7 +77,7 @@ TrueTypeFaceTexture::TrueTypeFaceTexture(
y += face->glyph->bitmap.rows;
}
this->texture.setSize(w, h, TEXTURE_FORMAT_R);
this->texture.setSize(w, h, TEXTURE_FORMAT_R, TEXTURE_DATA_FORMAT_UNSIGNED_BYTE);
this->texture.buffer(buffer);
memoryFree(buffer);
}