Add mesh bounds metadata
This commit is contained in:
@@ -71,4 +71,15 @@ TEST(Mesh, AddSection) {
|
||||
EXPECT_EQ(mesh.GetSections()[0].materialID, 2u);
|
||||
}
|
||||
|
||||
TEST(Mesh, SetBounds) {
|
||||
Mesh mesh;
|
||||
|
||||
Bounds bounds;
|
||||
bounds.SetMinMax(Vector3(-1.0f, -2.0f, -3.0f), Vector3(1.0f, 2.0f, 3.0f));
|
||||
mesh.SetBounds(bounds);
|
||||
|
||||
EXPECT_EQ(mesh.GetBounds().GetMin(), Vector3(-1.0f, -2.0f, -3.0f));
|
||||
EXPECT_EQ(mesh.GetBounds().GetMax(), Vector3(1.0f, 2.0f, 3.0f));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -60,6 +60,10 @@ TEST(MeshLoader, LoadValidObjMesh) {
|
||||
EXPECT_TRUE(HasVertexAttribute(mesh->GetVertexAttributes(), VertexAttribute::Position));
|
||||
EXPECT_TRUE(HasVertexAttribute(mesh->GetVertexAttributes(), VertexAttribute::Normal));
|
||||
EXPECT_TRUE(HasVertexAttribute(mesh->GetVertexAttributes(), VertexAttribute::UV0));
|
||||
EXPECT_EQ(mesh->GetBounds().GetMin(), XCEngine::Math::Vector3(0.0f, 0.0f, -1.0f));
|
||||
EXPECT_EQ(mesh->GetBounds().GetMax(), XCEngine::Math::Vector3(1.0f, 1.0f, -1.0f));
|
||||
EXPECT_EQ(mesh->GetSections()[0].bounds.GetMin(), XCEngine::Math::Vector3(0.0f, 0.0f, -1.0f));
|
||||
EXPECT_EQ(mesh->GetSections()[0].bounds.GetMax(), XCEngine::Math::Vector3(1.0f, 1.0f, -1.0f));
|
||||
|
||||
const auto* vertices = static_cast<const StaticMeshVertex*>(mesh->GetVertexData());
|
||||
ASSERT_NE(vertices, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user