fixed floors sample

This commit is contained in:
Sandro Sobczyński
2020-11-03 16:44:39 +01:00
parent 5aa2a9bdb5
commit b75b2d6e4f
30 changed files with 331 additions and 224 deletions
+6 -13
View File
@@ -238,19 +238,11 @@ u32 Mesh::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals
return addedFaces;
}
void Mesh::getCurrentBoundingBoxVertex(Vector3 &o_result, const u32 &t_index)
{
o_result.set(
frames[animState.currentFrame].getBoundingBox(t_index).x + position.x,
frames[animState.currentFrame].getBoundingBox(t_index).y + position.y,
frames[animState.currentFrame].getBoundingBox(t_index).z + position.z);
}
u8 Mesh::isInFrustum(Plane *t_frustumPlanes)
{
Vector3 boxCalcTemp;
int boxResult = 1, boxIn = 0, boxOut = 0;
u8 boxResult = 1, boxIn = 0, boxOut = 0;
Vector3 *currentBoundingBox = getCurrentBoundingBox();
for (int i = 0; i < 6; i++)
{
boxOut = 0;
@@ -260,7 +252,10 @@ u8 Mesh::isInFrustum(Plane *t_frustumPlanes)
// both inside and out of the frustum
for (int y = 0; y < 8 && (boxIn == 0 || boxOut == 0); y++)
{
getCurrentBoundingBoxVertex(boxCalcTemp, y);
boxCalcTemp.set(
currentBoundingBox[y].x + position.x,
currentBoundingBox[y].y + position.y,
currentBoundingBox[y].z + position.z);
if (t_frustumPlanes[i].distanceTo(boxCalcTemp) < 0)
boxOut++;
else
@@ -288,7 +283,6 @@ void Mesh::setDefaultColor()
/** Sets texture level of details settings and CLUT settings */
void Mesh::setDefaultLODAndClut()
{
PRINT_LOG("Setting LOD, CLUT");
lod.calculation = LOD_USE_K;
lod.max_level = 0;
lod.mag_filter = LOD_MAG_NEAREST;
@@ -301,5 +295,4 @@ void Mesh::setDefaultLODAndClut()
clut.psm = 0;
clut.load_method = CLUT_NO_LOAD;
clut.address = 0;
PRINT_LOG("LOD, CLUT set!");
}