Added Hulls to BSP component and collision creation

This commit is contained in:
antopilo
2023-03-14 22:41:06 -04:00
parent 7186ae001e
commit ea3f67a365
3 changed files with 32 additions and 17 deletions

View File

@@ -532,8 +532,7 @@ namespace Nuake {
currentMaterial = MaterialManager::Get()->GetMaterial("resources/Textures/default/Default.png");
texture->height = texture->width = 1;
}
face_geometry* face_geo_inst = &brush_geo_inst->faces[f];
std::vector<Vertex> vertices;
@@ -569,6 +568,18 @@ namespace Nuake {
});
}
// We need to push the hull points because the batching
// will create 1 model per material, this prevents us from
// having 1 collision shape per brush(convex).
std::vector<Vector3> hullPoints;
hullPoints.reserve(vertices.size());
for (const auto& v : vertices)
{
hullPoints.push_back(v.position);
}
bsp.Hulls.push_back(hullPoints);
for (int i = 0; i < (face_geo_inst->vertex_count - 2) * 3; ++i)
{
uint32_t index = face_geo_inst->indices[i];