From 855b47452e8ff1096f8bc093e2bd702cbb963c5a Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 4 Aug 2020 17:41:28 +0200 Subject: [PATCH 1/3] Export opacity is 3DS closes https://github.com/assimp/assimp/issues/3291 --- code/AssetLib/3DS/3DSExporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/3DS/3DSExporter.cpp b/code/AssetLib/3DS/3DSExporter.cpp index fed96a51f..8c258d899 100644 --- a/code/AssetLib/3DS/3DSExporter.cpp +++ b/code/AssetLib/3DS/3DSExporter.cpp @@ -290,12 +290,17 @@ void Discreet3DSExporter::WriteMaterials() { ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_SPECULAR); WriteColor(color); } - + if (mat.Get(AI_MATKEY_COLOR_AMBIENT, color) == AI_SUCCESS) { ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_AMBIENT); WriteColor(color); } + if (mat.Get(AI_MATKEY_OPACITY, f) == AI_SUCCESS) { + ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_TRANSPARENCY); + WritePercentChunk(1.0f - f); + } + if (mat.Get(AI_MATKEY_COLOR_EMISSIVE, color) == AI_SUCCESS) { ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_SELF_ILLUM); WriteColor(color); From aabf12827ba516d8507793c558a67189744ea282 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 4 Aug 2020 17:52:43 +0200 Subject: [PATCH 2/3] fix typo --- code/AssetLib/3DS/3DSExporter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/AssetLib/3DS/3DSExporter.cpp b/code/AssetLib/3DS/3DSExporter.cpp index 8c258d899..ab0a5dbd2 100644 --- a/code/AssetLib/3DS/3DSExporter.cpp +++ b/code/AssetLib/3DS/3DSExporter.cpp @@ -296,6 +296,7 @@ void Discreet3DSExporter::WriteMaterials() { WriteColor(color); } + float f; if (mat.Get(AI_MATKEY_OPACITY, f) == AI_SUCCESS) { ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_TRANSPARENCY); WritePercentChunk(1.0f - f); From 1f348c5fc067bebed79fa7a8f2246984a709a1f6 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 4 Aug 2020 20:55:29 +0200 Subject: [PATCH 3/3] Remove redundant float f --- code/AssetLib/3DS/3DSExporter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/AssetLib/3DS/3DSExporter.cpp b/code/AssetLib/3DS/3DSExporter.cpp index ab0a5dbd2..ad8e10afe 100644 --- a/code/AssetLib/3DS/3DSExporter.cpp +++ b/code/AssetLib/3DS/3DSExporter.cpp @@ -339,7 +339,6 @@ void Discreet3DSExporter::WriteMaterials() { writer.PutU2(static_cast(shading_mode_out)); } - float f; if (mat.Get(AI_MATKEY_SHININESS, f) == AI_SUCCESS) { ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_SHININESS); WritePercentChunk(f);