chore: implements updateTextureInfo for texture packet update

This commit is contained in:
Wellinator
2024-01-31 17:57:19 -03:00
parent f727dae150
commit 1c4a84dffa
2 changed files with 17 additions and 0 deletions
@@ -29,6 +29,12 @@ class RendererCoreTexture {
RendererCoreTextureBuffers useTexture(const Texture* t_tex);
/**
* Called by user after changing texture wrap settings
* Updates texture packet without reallocate it
*/
RendererCoreTextureBuffers updateTextureInfo(const Texture* t_tex);
/** Called by renderer during initialization */
void init(RendererCoreGS* gs, Path3* path3);
@@ -56,6 +56,17 @@ RendererCoreTextureBuffers RendererCoreTexture::useTexture(
return newTexBuffer;
}
RendererCoreTextureBuffers RendererCoreTexture::updateTextureInfo(
const Texture* t_tex) {
TYRA_ASSERT(t_tex != nullptr, "Provided nullptr texture!");
auto allocated = getAllocatedBuffersByTextureId(t_tex->id);
TYRA_ASSERT(allocated.id != 0, "Can't update an unallocated texture!");
path3->sendTexture(t_tex, allocated);
return allocated;
}
RendererCoreTextureBuffers RendererCoreTexture::getAllocatedBuffersByTextureId(
const u32& t_id) {
for (u32 i = 0; i < currentAllocations.size(); i++)