AC: Support Double-Sided Faces (#6252)

* AC: Support Double-Sided Faces

The AC format marks double-sided SURF elements with the 0x20 flag, which Assimp ignored. This commit adds support for double-sided faces.

On encountering a double-sided face via the flag mentioned above, the front face is generated as usual but is then duplicated. The winding order of the duplicate is flipped to form a back face. Vertices are duplicated too so that back faces work correctly with normal vector generation and face smoothing.

* Add test file

* Simplify test case

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
DIGITAL IMAGE DESIGN
2025-07-29 13:09:30 +02:00
committed by GitHub
co-authored by Kim Kulling
parent 9f4e7c6d8d
commit 6fa9d09a97
3 changed files with 69 additions and 4 deletions
+11
View File
@@ -141,3 +141,14 @@ TEST(utACImportExport, testFormatDetection) {
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/TestFormatDetection", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utACImportExport, importDobuleSidedFaces) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/doubleSidedFace.ac", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
// The scene contains one double-sided, rectangular AC surface. It should resolve to two quads (front + back) with eight
// vertices (one per side to guarantee proper normal vectors).
ASSERT_EQ(scene->mNumMeshes, 1u);
ASSERT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
ASSERT_EQ(scene->mMeshes[0]->mNumVertices, 8u);
}