refactored texturelink, loadFrom(), mesh color

This commit is contained in:
h4570
2020-12-28 14:19:51 +01:00
parent 152bc7d6cf
commit 6e09741d19
20 changed files with 239 additions and 154 deletions
+11 -11
View File
@@ -83,7 +83,7 @@ void VifSender::calcMatrix(const RenderData &t_renderData, const Vector3 &t_posi
modelViewProj = *t_renderData.projection * modelViewProj;
}
void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 vertCount2, VECTOR *vertices, VECTOR *normals, VECTOR *coordinates, Mesh &t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount, texbuffer_t *textureBuffer)
void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 vertCount2, VECTOR *vertices, VECTOR *normals, VECTOR *coordinates, Mesh &t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount, texbuffer_t *textureBuffer, color_t *t_color)
{
// we have to split 3D object into small parts, because of small memory of VU1
@@ -97,7 +97,7 @@ void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 ver
i -= 3;
const u32 endI = i + (VU1_PACKAGE_VERTS_PER_BUFF - 1) > vertCount2 ? vertCount2 : i + (VU1_PACKAGE_VERTS_PER_BUFF - 1);
drawVertices(t_mesh, i, endI, vertices, coordinates, t_renderData->prim, textureBuffer, isDrawWaitEnabled ? endI == vertCount2 : false);
drawVertices(t_mesh, i, endI, vertices, coordinates, t_renderData->prim, textureBuffer, isDrawWaitEnabled ? endI == vertCount2 : false, t_color);
if (endI == vertCount2) // if there are no more vertices to draw, break
{
i = vertCount2;
@@ -130,7 +130,7 @@ void VifSender::setDoubleBufferAddStaticData()
}
/** Draw using PATH1 */
void VifSender::drawVertices(Mesh &t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_coordinates, prim_t *t_prim, texbuffer_t *t_texBuff, u8 t_addDrawWait)
void VifSender::drawVertices(Mesh &t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_coordinates, prim_t *t_prim, texbuffer_t *t_texBuff, u8 t_addDrawWait, color_t *t_color)
{
const u32 vertCount = t_end - t_start;
lastVertCount = vertCount;
@@ -143,10 +143,10 @@ void VifSender::drawVertices(Mesh &t_mesh, u32 t_start, u32 t_end, VECTOR *t_ver
packet2_utils_gs_add_lod(currPacket, &t_mesh.lod);
packet2_utils_gs_add_texbuff_clut(currPacket, t_texBuff, &t_mesh.clut);
packet2_utils_gs_add_prim_giftag(currPacket, t_prim, vertCount, DRAW_STQ2_REGLIST, 3, 0);
packet2_add_u32(currPacket, t_mesh.color.r);
packet2_add_u32(currPacket, t_mesh.color.g);
packet2_add_u32(currPacket, t_mesh.color.b);
packet2_add_u32(currPacket, t_mesh.color.a);
packet2_add_u32(currPacket, t_color->r);
packet2_add_u32(currPacket, t_color->g);
packet2_add_u32(currPacket, t_color->b);
packet2_add_u32(currPacket, t_color->a);
u32 vif_added_bytes = packet2_utils_vu_close_unpack(currPacket);
packet2_utils_vu_add_unpack_data(currPacket, vif_added_bytes, t_vertices + t_start, vertCount, true);
vif_added_bytes += vertCount;
@@ -183,10 +183,10 @@ void VifSender::drawTheSameWithOtherMatrices(const RenderData &t_renderData, Mes
packet2_utils_vu_close_unpack(currMPacket);
packet2_utils_vu_open_unpack(currMPacket, VU1_RGBA_ADDRESS, true);
{
packet2_add_u32(currMPacket, t_meshes[i]->color.r);
packet2_add_u32(currMPacket, t_meshes[i]->color.g);
packet2_add_u32(currMPacket, t_meshes[i]->color.b);
packet2_add_u32(currMPacket, t_meshes[i]->color.a);
packet2_add_u32(currMPacket, t_meshes[i]->getMaterial(0).color.r);
packet2_add_u32(currMPacket, t_meshes[i]->getMaterial(0).color.g);
packet2_add_u32(currMPacket, t_meshes[i]->getMaterial(0).color.b);
packet2_add_u32(currMPacket, t_meshes[i]->getMaterial(0).color.a);
}
packet2_utils_vu_close_unpack(currMPacket);