removed unecessary colors arr
This commit is contained in:
@@ -177,7 +177,7 @@ u32 GifSender::calc3DObject(Matrix t_perspective, Mesh &t_mesh, RenderData *t_re
|
||||
VECTOR *normals = new VECTOR[vertexCount];
|
||||
VECTOR *coordinates = new VECTOR[vertexCount];
|
||||
VECTOR *colors = new VECTOR[vertexCount];
|
||||
vertexCount = t_mesh.getDrawData(0, vertices, normals, coordinates, colors, *t_renderData->cameraPosition);
|
||||
vertexCount = t_mesh.getDrawData(0, vertices, normals, coordinates, *t_renderData->cameraPosition);
|
||||
|
||||
xyz = new xyz_t[vertexCount];
|
||||
rgbaq = new color_t[vertexCount];
|
||||
@@ -195,7 +195,7 @@ u32 GifSender::calc3DObject(Matrix t_perspective, Mesh &t_mesh, RenderData *t_re
|
||||
if (SHOULD_BE_LIGHTED)
|
||||
create_local_light(localLight, rotation);
|
||||
|
||||
// I cant put perspective from renderData here. PS2SDK bug?
|
||||
// I cant put perspective from renderData here. ee-gcc bug?
|
||||
create_local_screen(localScreen, localWorld, t_renderData->worldView->data, t_perspective.data);
|
||||
|
||||
if (SHOULD_BE_LIGHTED)
|
||||
@@ -212,27 +212,41 @@ u32 GifSender::calc3DObject(Matrix t_perspective, Mesh &t_mesh, RenderData *t_re
|
||||
|
||||
calculate_lights(lights, vertexCount, normals, lightDirections, lightColors, lightTypes, lightsCount);
|
||||
|
||||
calculate_colours(colors, vertexCount, colors, lights);
|
||||
for (u32 i = 0; i < vertexCount; i++)
|
||||
{
|
||||
// Apply the light value to the colour.
|
||||
colors[i][0] = (t_mesh.color.r * lights[i][0]);
|
||||
colors[i][1] = (t_mesh.color.g * lights[i][1]);
|
||||
colors[i][2] = (t_mesh.color.b * lights[i][2]);
|
||||
vector_clamp(colors[i], colors[i], 0.00f, 1.99f);
|
||||
}
|
||||
|
||||
delete[] lightDirections;
|
||||
delete[] lightColors;
|
||||
delete[] lightTypes;
|
||||
delete[] lights;
|
||||
}
|
||||
else
|
||||
for (u32 i = 0; i < vertexCount; i++)
|
||||
{
|
||||
colors[i][0] = t_mesh.color.r / 128.0F;
|
||||
colors[i][1] = t_mesh.color.g / 128.0F;
|
||||
colors[i][2] = t_mesh.color.b / 128.0F;
|
||||
}
|
||||
|
||||
calculate_vertices(vertices, vertexCount, vertices, localScreen);
|
||||
|
||||
convertCalcs(vertexCount, vertices, colors, coordinates, t_mesh.color.a);
|
||||
convertCalcs(vertexCount, vertices, colors, coordinates, t_mesh.color);
|
||||
|
||||
delete[] vertices;
|
||||
delete[] normals;
|
||||
delete[] coordinates;
|
||||
delete[] colors;
|
||||
delete[] coordinates;
|
||||
|
||||
return vertexCount;
|
||||
}
|
||||
|
||||
void GifSender::convertCalcs(u32 t_vertexCount, VECTOR *t_vertices, VECTOR *t_colors, VECTOR *t_sts, u8 t_alpha)
|
||||
void GifSender::convertCalcs(u32 t_vertexCount, VECTOR *t_vertices, VECTOR *t_colors, VECTOR *t_sts, color_t &t_color)
|
||||
{
|
||||
// TODO get this via screensettings
|
||||
const s32 centerX = ftoi4(2048);
|
||||
@@ -254,7 +268,7 @@ void GifSender::convertCalcs(u32 t_vertexCount, VECTOR *t_vertices, VECTOR *t_co
|
||||
rgbaq[i].r = (u8)(t_colors[i][0] * 128.0F);
|
||||
rgbaq[i].g = (u8)(t_colors[i][1] * 128.0F);
|
||||
rgbaq[i].b = (u8)(t_colors[i][2] * 128.0F);
|
||||
rgbaq[i].a = t_alpha;
|
||||
rgbaq[i].a = t_color.a;
|
||||
rgbaq[i].q = q;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +143,9 @@ void Renderer::drawByPath3(Mesh **t_meshes, u16 t_amount, LightBulb *t_bulbs, u1
|
||||
void Renderer::drawByPath3(Mesh *t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||
{
|
||||
beginFrameIfNeeded();
|
||||
changeTexture(t_mesh, 0);
|
||||
gifSender->initPacket(context);
|
||||
// TODO
|
||||
changeTexture(t_mesh, 0);
|
||||
gifSender->addObjects(&renderData, &t_mesh, 1, t_bulbs, t_bulbsCount);
|
||||
gifSender->sendPacket();
|
||||
draw_wait_finish();
|
||||
@@ -179,35 +179,33 @@ void Renderer::draw(Mesh *t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||
VECTOR *vertices = new VECTOR[vertCount];
|
||||
VECTOR *normals = new VECTOR[vertCount];
|
||||
VECTOR *coordinates = new VECTOR[vertCount];
|
||||
VECTOR *colors = new VECTOR[vertCount];
|
||||
if (t_mesh->isObjLoaded)
|
||||
{
|
||||
t_mesh->obj->animate();
|
||||
for (u32 i = 0; i < t_mesh->obj->frames[0].materialsCount; i++)
|
||||
{
|
||||
changeTexture(t_mesh, i);
|
||||
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, colors, *renderData.cameraPosition);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, colors, t_mesh, t_bulbs, t_bulbsCount);
|
||||
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount);
|
||||
}
|
||||
}
|
||||
else if (t_mesh->isMd2Loaded)
|
||||
{
|
||||
changeTexture(t_mesh, 0);
|
||||
vertCount = t_mesh->getDrawData(0, vertices, normals, coordinates, colors, *renderData.cameraPosition);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, colors, t_mesh, t_bulbs, t_bulbsCount);
|
||||
vertCount = t_mesh->getDrawData(0, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount);
|
||||
}
|
||||
else if (t_mesh->isDffLoaded)
|
||||
for (u32 i = 0; i < t_mesh->dff->clump.geometryList.geometries[0].extension.materialSplit.header.splitCount; i++)
|
||||
{
|
||||
const u32 currentTexI = t_mesh->dff->clump.geometryList.geometries[0].extension.materialSplit.splitInformation[i].materialIndex;
|
||||
changeTexture(t_mesh, currentTexI);
|
||||
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, colors, *renderData.cameraPosition);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, colors, t_mesh, t_bulbs, t_bulbsCount);
|
||||
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount);
|
||||
}
|
||||
delete[] vertices;
|
||||
delete[] normals;
|
||||
delete[] coordinates;
|
||||
delete[] colors;
|
||||
}
|
||||
|
||||
/** PATH1 Many */
|
||||
|
||||
@@ -37,7 +37,7 @@ VifSender::~VifSender() {}
|
||||
// Methods
|
||||
// ----
|
||||
|
||||
void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 vertCount2, VECTOR *vertices, VECTOR *normals, VECTOR *coordinates, VECTOR *colors, Mesh *t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||
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)
|
||||
{
|
||||
if (t_mesh->shouldBeFrustumCulled == 1 && !t_mesh->isInFrustum(t_renderData->frustumPlanes))
|
||||
return;
|
||||
@@ -60,7 +60,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, colors, coordinates, t_renderData->prim);
|
||||
drawVertices(t_mesh, i, endI, vertices, coordinates, t_renderData->prim);
|
||||
if (endI == vertCount2) // if there are no more vertices to draw, break
|
||||
{
|
||||
i = vertCount2;
|
||||
@@ -74,7 +74,7 @@ void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 ver
|
||||
}
|
||||
|
||||
/** Draw using PATH1 */
|
||||
void VifSender::drawVertices(Mesh *t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_colors, VECTOR *t_coordinates, prim_t *t_prim)
|
||||
void VifSender::drawVertices(Mesh *t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_coordinates, prim_t *t_prim)
|
||||
{
|
||||
const u32 vertCount = t_end - t_start;
|
||||
vu1.addListBeginning();
|
||||
|
||||
Reference in New Issue
Block a user