Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
@@ -294,6 +294,8 @@ inline void SetDecodedIndexBuffer_Draco(const draco::Mesh &dracoMesh, Mesh::Prim
|
||||
// Usually uint32_t but shouldn't assume
|
||||
if (sizeof(dracoMesh.face(draco::FaceIndex(0))[0]) == componentBytes) {
|
||||
memcpy(decodedIndexBuffer->GetPointer(), &dracoMesh.face(draco::FaceIndex(0))[0], decodedIndexBuffer->byteLength);
|
||||
// Assign this alternate data buffer to the accessor
|
||||
prim.indices->decodedBuffer.swap(decodedIndexBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BIN
test/models/glTF2/draco/robot.glb
Normal file
BIN
test/models/glTF2/draco/robot.glb
Normal file
Binary file not shown.
@@ -896,6 +896,27 @@ TEST_F(utglTF2ImportExport, import_dracoEncoded) {
|
||||
ASSERT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_GENERATOR, generator));
|
||||
ASSERT_EQ(strcmp(generator.C_Str(), "COLLADA2GLTF"), 0);
|
||||
}
|
||||
#endif
|
||||
const aiScene *robotScene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/draco/robot.glb",
|
||||
aiProcess_ValidateDataStructure);
|
||||
#ifndef ASSIMP_ENABLE_DRACO
|
||||
// No draco support, scene should not load
|
||||
ASSERT_EQ(robotScene, nullptr);
|
||||
#else
|
||||
ASSERT_NE(robotScene, nullptr);
|
||||
ASSERT_NE(robotScene->mMetaData, nullptr);
|
||||
{
|
||||
ASSERT_TRUE(robotScene->mMetaData->HasKey(AI_METADATA_SOURCE_FORMAT));
|
||||
aiString format;
|
||||
ASSERT_TRUE(robotScene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT, format));
|
||||
ASSERT_EQ(strcmp(format.C_Str(), "glTF2 Importer"), 0);
|
||||
}
|
||||
{
|
||||
ASSERT_TRUE(robotScene->mMetaData->HasKey(AI_METADATA_SOURCE_FORMAT_VERSION));
|
||||
aiString version;
|
||||
ASSERT_TRUE(robotScene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT_VERSION, version));
|
||||
ASSERT_EQ(strcmp(version.C_Str(), "2.0"), 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user