added MeshTexture class

This commit is contained in:
Sandro Sobczyński
2020-10-30 14:37:39 +01:00
parent 99d4c3633b
commit aa97e471ed
7 changed files with 177 additions and 27 deletions
+2 -2
View File
@@ -56,10 +56,10 @@ void GifSender::sendTexture(MeshTexture &texture, texbuffer_t *t_texBuffer)
const u16 packetSize = 40;
packet_t *packet = packet_init(packetSize, PACKET_NORMAL);
qword_t *q = packet->data;
q = draw_texture_transfer(q, texture.data, texture.width, texture.height, GS_PSM_24, t_texBuffer->address, t_texBuffer->width);
q = draw_texture_transfer(q, texture.getData(), texture.getWidth(), texture.getHeight(), GS_PSM_24, t_texBuffer->address, t_texBuffer->width);
DMATAG_CNT(q, 2, 0, 0, 0);
q++;
q = draw_texture_wrapping(q, 0, &texture.wrapSettings);
q = draw_texture_wrapping(q, 0, texture.getWrapSettings());
q = draw_texture_flush(q);
dma_channel_send_chain(DMA_CHANNEL_GIF, packet->data, q - packet->data, 0, 0);
dma_wait_fast();
+3 -3
View File
@@ -115,11 +115,11 @@ void Renderer::deallocateTextureBuffer()
void Renderer::changeTexture(Mesh *t_mesh, u8 t_textureIndex)
{
if (t_mesh->spec->textures[t_textureIndex].id != lastTextureId)
if (t_mesh->spec->textures[t_textureIndex].getId() != lastTextureId)
{
lastTextureId = t_mesh->spec->textures[t_textureIndex].id;
lastTextureId = t_mesh->spec->textures[t_textureIndex].getId();
deallocateTextureBuffer();
allocateTextureBuffer(t_mesh->spec->textures[t_textureIndex].width, t_mesh->spec->textures[t_textureIndex].height);
allocateTextureBuffer(t_mesh->spec->textures[t_textureIndex].getWidth(), t_mesh->spec->textures[t_textureIndex].getHeight());
GifSender::sendTexture(t_mesh->spec->textures[t_textureIndex], &textureBuffer);
}
}