Fix rotated box culling bug

This commit is contained in:
James Lambert 2023-12-02 19:43:42 -07:00
parent e32c299941
commit d6910a4e01
2 changed files with 5 additions and 2 deletions

View file

@ -71,12 +71,15 @@ void staticRenderPopulateRooms(struct FrustrumCullingInformation* cullingInfo, M
continue;
}
struct Vector3 center;
vector3Scale(&rotatedBox.origin, &center, 1.0f / SCENE_SCALE);
renderSceneAdd(
renderScene,
staticElement->displayList,
&staticMatrices[staticElement->transformIndex],
staticElement->materialIndex,
&rotatedBox.origin,
&center,
NULL
);
}

View file

@ -45,7 +45,7 @@ int isRotatedBoxOutsideFrustrum(struct FrustrumCullingInformation* frustrum, str
struct Vector3* normal = &frustrum->clippingPlanes[i].normal;
for (int axis = 0; axis < 3; ++axis) {
if (VECTOR3_AS_ARRAY(normal)[axis] > 0.0f) {
if (vector3Dot(&rotatedBox->sides[axis], normal) > 0.0f) {
vector3Add(&closestPoint, &rotatedBox->sides[axis], &closestPoint);
}
}