removed unecessary colors arr
This commit is contained in:
@@ -24,11 +24,11 @@ public:
|
|||||||
DffModel();
|
DffModel();
|
||||||
~DffModel();
|
~DffModel();
|
||||||
|
|
||||||
u32 getDrawData(u32 splitIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
|
u32 getDrawData(u32 splitIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
|
||||||
RwClump clump;
|
RwClump clump;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fillNextFace(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, u8 geometry, u32 t_getI, u32 t_setI);
|
void fillNextFace(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, u8 geometry, u32 t_getI, u32 t_setI);
|
||||||
u8 isMemoryAllocated;
|
u8 isMemoryAllocated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
char *filename;
|
char *filename;
|
||||||
MD2Model(char *t_md2File);
|
MD2Model(char *t_md2File);
|
||||||
~MD2Model();
|
~MD2Model();
|
||||||
u32 getCurrentFrameData(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
|
u32 getCurrentFrameData(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
|
||||||
void allocateMemory();
|
void allocateMemory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
void playAnimation(u32 t_startFrame, u32 t_endFrame);
|
void playAnimation(u32 t_startFrame, u32 t_endFrame);
|
||||||
u32 getVertexCount();
|
u32 getVertexCount();
|
||||||
void setAnimSpeed(float t_value);
|
void setAnimSpeed(float t_value);
|
||||||
u32 getDrawData(u32 splitIndex, VECTOR *t_vertices, VECTOR *t_normals, VECTOR *t_coordinates, VECTOR *t_colors, Vector3 &t_cameraPos);
|
u32 getDrawData(u32 splitIndex, VECTOR *t_vertices, VECTOR *t_normals, VECTOR *t_coordinates, Vector3 &t_cameraPos);
|
||||||
u8 isInFrustum(Plane *t_frustumPlanes);
|
u8 isInFrustum(Plane *t_frustumPlanes);
|
||||||
|
|
||||||
u8 isMd2Loaded, isObjLoaded, isDffLoaded, isSpecInitialized;
|
u8 isMd2Loaded, isObjLoaded, isDffLoaded, isSpecInitialized;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
ObjModel(char *t_objFile);
|
ObjModel(char *t_objFile);
|
||||||
~ObjModel();
|
~ObjModel();
|
||||||
void animate();
|
void animate();
|
||||||
u32 getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
|
u32 getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled);
|
||||||
u32 getFacesCount();
|
u32 getFacesCount();
|
||||||
u8 isMemoryAllocated;
|
u8 isMemoryAllocated;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ private:
|
|||||||
MATRIX localWorld, localScreen, localLight;
|
MATRIX localWorld, localScreen, localLight;
|
||||||
|
|
||||||
u32 calc3DObject(Matrix t_perspective, Mesh &t_mesh, RenderData *t_renderData, LightBulb *t_bulbs, u16 t_bulbsCount);
|
u32 calc3DObject(Matrix t_perspective, Mesh &t_mesh, RenderData *t_renderData, LightBulb *t_bulbs, u16 t_bulbsCount);
|
||||||
void convertCalcs(u32 t_vertCount, VECTOR *t_vertices, VECTOR *t_colors, VECTOR *t_sts, u8 t_alpha);
|
void convertCalcs(u32 t_vertCount, VECTOR *t_vertices, VECTOR *t_colors, VECTOR *t_sts, color_t &t_color);
|
||||||
void addCurrentCalcs(u32 &t_vertexCount);
|
void addCurrentCalcs(u32 &t_vertexCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ public:
|
|||||||
~VifSender();
|
~VifSender();
|
||||||
|
|
||||||
// TODO refactor
|
// TODO refactor
|
||||||
void 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 drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 vertCount2, VECTOR *vertices, VECTOR *normals, VECTOR *coordinates, Mesh *t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawVertices(Mesh *t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_colors, VECTOR *t_coordinates, prim_t *t_prim);
|
void drawVertices(Mesh *t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_coordinates, prim_t *t_prim);
|
||||||
|
|
||||||
MATRIX localWorld, localScreen;
|
MATRIX localWorld, localScreen;
|
||||||
VECTOR position, rotation;
|
VECTOR position, rotation;
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ DffModel::~DffModel() {}
|
|||||||
// Methods
|
// Methods
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
u32 DffModel::getDrawData(u32 splitIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled)
|
u32 DffModel::getDrawData(u32 splitIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled)
|
||||||
{
|
{
|
||||||
u32 result = 0;
|
u32 result = 0;
|
||||||
for (u32 i = 0; i < clump.geometryList.geometries[0].extension.materialSplit.splitInformation[splitIndex].faceIndex; i++)
|
for (u32 i = 0; i < clump.geometryList.geometries[0].extension.materialSplit.splitInformation[splitIndex].faceIndex; i++)
|
||||||
fillNextFace(o_vertices, o_normals, o_coordinates, o_colors, 0,
|
fillNextFace(o_vertices, o_normals, o_coordinates, 0,
|
||||||
clump.geometryList.geometries[0].extension.materialSplit.splitInformation[splitIndex].vertexInformation[i].vertex1,
|
clump.geometryList.geometries[0].extension.materialSplit.splitInformation[splitIndex].vertexInformation[i].vertex1,
|
||||||
result++);
|
result++);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DffModel::fillNextFace(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, u8 geometry, u32 t_getI, u32 t_setI)
|
void DffModel::fillNextFace(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, u8 geometry, u32 t_getI, u32 t_setI)
|
||||||
{
|
{
|
||||||
o_vertices[t_setI][0] = clump.geometryList.geometries[geometry].data.vertexInformation[t_getI].x;
|
o_vertices[t_setI][0] = clump.geometryList.geometries[geometry].data.vertexInformation[t_getI].x;
|
||||||
o_vertices[t_setI][1] = clump.geometryList.geometries[geometry].data.vertexInformation[t_getI].y;
|
o_vertices[t_setI][1] = clump.geometryList.geometries[geometry].data.vertexInformation[t_getI].y;
|
||||||
@@ -51,9 +51,4 @@ void DffModel::fillNextFace(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coo
|
|||||||
o_coordinates[t_setI][1] = 1.0F - clump.geometryList.geometries[geometry].data.textureMappingInformation[t_getI].v;
|
o_coordinates[t_setI][1] = 1.0F - clump.geometryList.geometries[geometry].data.textureMappingInformation[t_getI].v;
|
||||||
o_coordinates[t_setI][2] = 1.0F;
|
o_coordinates[t_setI][2] = 1.0F;
|
||||||
o_coordinates[t_setI][3] = 1.0F;
|
o_coordinates[t_setI][3] = 1.0F;
|
||||||
|
|
||||||
o_colors[t_setI][0] = 1.0F;
|
|
||||||
o_colors[t_setI][1] = 1.0F;
|
|
||||||
o_colors[t_setI][2] = 1.0F;
|
|
||||||
o_colors[t_setI][3] = 1.0F;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ MD2Model::~MD2Model()
|
|||||||
// Methods
|
// Methods
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
u32 MD2Model::getCurrentFrameData(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled)
|
u32 MD2Model::getCurrentFrameData(VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled)
|
||||||
{
|
{
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
animState.interpolation += animState.speed;
|
animState.interpolation += animState.speed;
|
||||||
@@ -109,11 +109,6 @@ u32 MD2Model::getCurrentFrameData(VECTOR *o_vertices, VECTOR *o_normals, VECTOR
|
|||||||
o_coordinates[i][1] = 1.0F - coordinates[CURR_COORD].y;
|
o_coordinates[i][1] = 1.0F - coordinates[CURR_COORD].y;
|
||||||
o_coordinates[i][2] = 1.0F;
|
o_coordinates[i][2] = 1.0F;
|
||||||
o_coordinates[i][3] = 1.0F;
|
o_coordinates[i][3] = 1.0F;
|
||||||
|
|
||||||
o_colors[i][0] = 1.0F;
|
|
||||||
o_colors[i][1] = 1.0F;
|
|
||||||
o_colors[i][2] = 1.0F;
|
|
||||||
o_colors[i][3] = 1.0F;
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,14 +208,14 @@ void Mesh::loadTextures(char *t_subfolder, char *t_extension)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO refactor
|
// TODO refactor
|
||||||
u32 Mesh::getDrawData(u32 splitIndex, VECTOR *t_vertices, VECTOR *t_normals, VECTOR *t_coordinates, VECTOR *t_colors, Vector3 &t_cameraPos)
|
u32 Mesh::getDrawData(u32 splitIndex, VECTOR *t_vertices, VECTOR *t_normals, VECTOR *t_coordinates, Vector3 &t_cameraPos)
|
||||||
{
|
{
|
||||||
if (isMd2Loaded)
|
if (isMd2Loaded)
|
||||||
return md2->getCurrentFrameData(t_vertices, t_normals, t_coordinates, t_colors, t_cameraPos, scale, shouldBeBackfaceCulled);
|
return md2->getCurrentFrameData(t_vertices, t_normals, t_coordinates, t_cameraPos, scale, shouldBeBackfaceCulled);
|
||||||
else if (isObjLoaded)
|
else if (isObjLoaded)
|
||||||
return obj->getDrawData(splitIndex, t_vertices, t_normals, t_coordinates, t_colors, t_cameraPos, scale, shouldBeBackfaceCulled);
|
return obj->getDrawData(splitIndex, t_vertices, t_normals, t_coordinates, t_cameraPos, scale, shouldBeBackfaceCulled);
|
||||||
else if (isDffLoaded)
|
else if (isDffLoaded)
|
||||||
return dff->getDrawData(splitIndex, t_vertices, t_normals, t_coordinates, t_colors, t_cameraPos, scale, shouldBeBackfaceCulled);
|
return dff->getDrawData(splitIndex, t_vertices, t_normals, t_coordinates, t_cameraPos, scale, shouldBeBackfaceCulled);
|
||||||
PRINT_ERR("Can't get draw data, because no 3D model was loaded!");
|
PRINT_ERR("Can't get draw data, because no 3D model was loaded!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void ObjModel::animate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ObjModel::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, VECTOR *o_colors, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled)
|
u32 ObjModel::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos, float t_scale, u8 t_shouldBeBackfaceCulled)
|
||||||
{
|
{
|
||||||
#define CURR_FRAME frames[animState.currentFrame]
|
#define CURR_FRAME frames[animState.currentFrame]
|
||||||
#define NEXT_FRAME frames[animState.nextFrame]
|
#define NEXT_FRAME frames[animState.nextFrame]
|
||||||
@@ -107,12 +107,7 @@ u32 ObjModel::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_nor
|
|||||||
o_coordinates[addedFaces][0] = CURR_FRAME.coordinates[MATERIAL.getStFace(matI + vertI)].x;
|
o_coordinates[addedFaces][0] = CURR_FRAME.coordinates[MATERIAL.getStFace(matI + vertI)].x;
|
||||||
o_coordinates[addedFaces][1] = CURR_FRAME.coordinates[MATERIAL.getStFace(matI + vertI)].y;
|
o_coordinates[addedFaces][1] = CURR_FRAME.coordinates[MATERIAL.getStFace(matI + vertI)].y;
|
||||||
o_coordinates[addedFaces][2] = 1.0F;
|
o_coordinates[addedFaces][2] = 1.0F;
|
||||||
o_coordinates[addedFaces][3] = 1.0F;
|
o_coordinates[addedFaces++][3] = 1.0F;
|
||||||
|
|
||||||
o_colors[addedFaces][0] = 1.0F;
|
|
||||||
o_colors[addedFaces][1] = 1.0F;
|
|
||||||
o_colors[addedFaces][2] = 1.0F;
|
|
||||||
o_colors[addedFaces++][3] = 1.0F;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return addedFaces;
|
return addedFaces;
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ u32 GifSender::calc3DObject(Matrix t_perspective, Mesh &t_mesh, RenderData *t_re
|
|||||||
VECTOR *normals = new VECTOR[vertexCount];
|
VECTOR *normals = new VECTOR[vertexCount];
|
||||||
VECTOR *coordinates = new VECTOR[vertexCount];
|
VECTOR *coordinates = new VECTOR[vertexCount];
|
||||||
VECTOR *colors = 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];
|
xyz = new xyz_t[vertexCount];
|
||||||
rgbaq = new color_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)
|
if (SHOULD_BE_LIGHTED)
|
||||||
create_local_light(localLight, rotation);
|
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);
|
create_local_screen(localScreen, localWorld, t_renderData->worldView->data, t_perspective.data);
|
||||||
|
|
||||||
if (SHOULD_BE_LIGHTED)
|
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_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[] lightDirections;
|
||||||
delete[] lightColors;
|
delete[] lightColors;
|
||||||
delete[] lightTypes;
|
delete[] lightTypes;
|
||||||
delete[] lights;
|
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);
|
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[] vertices;
|
||||||
delete[] normals;
|
delete[] normals;
|
||||||
delete[] coordinates;
|
|
||||||
delete[] colors;
|
delete[] colors;
|
||||||
|
delete[] coordinates;
|
||||||
|
|
||||||
return vertexCount;
|
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
|
// TODO get this via screensettings
|
||||||
const s32 centerX = ftoi4(2048);
|
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].r = (u8)(t_colors[i][0] * 128.0F);
|
||||||
rgbaq[i].g = (u8)(t_colors[i][1] * 128.0F);
|
rgbaq[i].g = (u8)(t_colors[i][1] * 128.0F);
|
||||||
rgbaq[i].b = (u8)(t_colors[i][2] * 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;
|
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)
|
void Renderer::drawByPath3(Mesh *t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||||
{
|
{
|
||||||
beginFrameIfNeeded();
|
beginFrameIfNeeded();
|
||||||
|
changeTexture(t_mesh, 0);
|
||||||
gifSender->initPacket(context);
|
gifSender->initPacket(context);
|
||||||
// TODO
|
// TODO
|
||||||
changeTexture(t_mesh, 0);
|
|
||||||
gifSender->addObjects(&renderData, &t_mesh, 1, t_bulbs, t_bulbsCount);
|
gifSender->addObjects(&renderData, &t_mesh, 1, t_bulbs, t_bulbsCount);
|
||||||
gifSender->sendPacket();
|
gifSender->sendPacket();
|
||||||
draw_wait_finish();
|
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 *vertices = new VECTOR[vertCount];
|
||||||
VECTOR *normals = new VECTOR[vertCount];
|
VECTOR *normals = new VECTOR[vertCount];
|
||||||
VECTOR *coordinates = new VECTOR[vertCount];
|
VECTOR *coordinates = new VECTOR[vertCount];
|
||||||
VECTOR *colors = new VECTOR[vertCount];
|
|
||||||
if (t_mesh->isObjLoaded)
|
if (t_mesh->isObjLoaded)
|
||||||
{
|
{
|
||||||
t_mesh->obj->animate();
|
t_mesh->obj->animate();
|
||||||
for (u32 i = 0; i < t_mesh->obj->frames[0].materialsCount; i++)
|
for (u32 i = 0; i < t_mesh->obj->frames[0].materialsCount; i++)
|
||||||
{
|
{
|
||||||
changeTexture(t_mesh, i);
|
changeTexture(t_mesh, i);
|
||||||
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, colors, *renderData.cameraPosition);
|
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, colors, t_mesh, t_bulbs, t_bulbsCount);
|
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (t_mesh->isMd2Loaded)
|
else if (t_mesh->isMd2Loaded)
|
||||||
{
|
{
|
||||||
changeTexture(t_mesh, 0);
|
changeTexture(t_mesh, 0);
|
||||||
vertCount = t_mesh->getDrawData(0, vertices, normals, coordinates, colors, *renderData.cameraPosition);
|
vertCount = t_mesh->getDrawData(0, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, colors, t_mesh, t_bulbs, t_bulbsCount);
|
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount);
|
||||||
}
|
}
|
||||||
else if (t_mesh->isDffLoaded)
|
else if (t_mesh->isDffLoaded)
|
||||||
for (u32 i = 0; i < t_mesh->dff->clump.geometryList.geometries[0].extension.materialSplit.header.splitCount; i++)
|
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;
|
const u32 currentTexI = t_mesh->dff->clump.geometryList.geometries[0].extension.materialSplit.splitInformation[i].materialIndex;
|
||||||
changeTexture(t_mesh, currentTexI);
|
changeTexture(t_mesh, currentTexI);
|
||||||
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, colors, *renderData.cameraPosition);
|
vertCount = t_mesh->getDrawData(i, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, colors, t_mesh, t_bulbs, t_bulbsCount);
|
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount);
|
||||||
}
|
}
|
||||||
delete[] vertices;
|
delete[] vertices;
|
||||||
delete[] normals;
|
delete[] normals;
|
||||||
delete[] coordinates;
|
delete[] coordinates;
|
||||||
delete[] colors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PATH1 Many */
|
/** PATH1 Many */
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ VifSender::~VifSender() {}
|
|||||||
// Methods
|
// 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))
|
if (t_mesh->shouldBeFrustumCulled == 1 && !t_mesh->isInFrustum(t_renderData->frustumPlanes))
|
||||||
return;
|
return;
|
||||||
@@ -60,7 +60,7 @@ void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 ver
|
|||||||
i -= 3;
|
i -= 3;
|
||||||
|
|
||||||
const u32 endI = i + (VU1_PACKAGE_VERTS_PER_BUFF - 1) > vertCount2 ? vertCount2 : i + (VU1_PACKAGE_VERTS_PER_BUFF - 1);
|
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
|
if (endI == vertCount2) // if there are no more vertices to draw, break
|
||||||
{
|
{
|
||||||
i = vertCount2;
|
i = vertCount2;
|
||||||
@@ -74,7 +74,7 @@ void VifSender::drawMesh(RenderData *t_renderData, Matrix t_perspective, u32 ver
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Draw using PATH1 */
|
/** 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;
|
const u32 vertCount = t_end - t_start;
|
||||||
vu1.addListBeginning();
|
vu1.addListBeginning();
|
||||||
|
|||||||
Reference in New Issue
Block a user