From 2ad4c28a7780ce0f3a5362f889eed90fa05431f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Chatelain?= Date: Fri, 19 Feb 2016 15:43:04 +0100 Subject: [PATCH] Only export RGBA texture for Sketchfab --- Win/Mineways.cpp | 2 +- Win/ObjFileManip.cpp | 30 ++++++++++++++++++++++++------ Win/blockInfo.h | 2 ++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Win/Mineways.cpp b/Win/Mineways.cpp index acc06be5..8f19cae4 100644 --- a/Win/Mineways.cpp +++ b/Win/Mineways.cpp @@ -2555,7 +2555,7 @@ int publishToSketchfab( HWND hWnd, wchar_t *objFileName, wchar_t *terrainFileNam BLF_FLATSIDE | BLF_3D_BIT; // Set options for Sketchfab publication. Need to determine best settings here, the user will not have the choice - gOptions.exportFlags |= EXPT_OUTPUT_MATERIALS | EXPT_OUTPUT_TEXTURE_IMAGES | EXPT_GROUP_BY_MATERIAL; + gOptions.exportFlags |= EXPT_OUTPUT_MATERIALS | EXPT_OUTPUT_TEXTURE_IMAGES | EXPT_GROUP_BY_MATERIAL | EXPT_SKFB; gOptions.exportFlags |= (gpEFD->chkHollow[gpEFD->fileType] ? EXPT_HOLLOW_BOTTOM : 0x0) | diff --git a/Win/ObjFileManip.cpp b/Win/ObjFileManip.cpp index 80afca3a..475f2ca3 100644 --- a/Win/ObjFileManip.cpp +++ b/Win/ObjFileManip.cpp @@ -13716,17 +13716,35 @@ static int writeOBJMtlFile() && !( gOptions->pEFD->chkLeavesSolid && (gBlockDefinitions[type].flags & BLF_LEAF_PART) ) ) { // cutouts or alpha - gModel.usesRGBA = 1; - gModel.usesAlpha = 1; - typeTextureFileName = textureRGBA; - sprintf_s(mapdString,256,"map_d %s\n", textureAlpha ); + if ((gOptions->exportFlags & EXPT_SKFB)) + { + gModel.usesRGBA = 1; + gModel.usesAlpha = 0; + typeTextureFileName = textureRGBA; + sprintf_s(mapdString,256,"map_d %s\n", typeTextureFileName ); + } + else + { + gModel.usesRGBA = 1; + gModel.usesAlpha = 1; + typeTextureFileName = textureRGBA; + sprintf_s(mapdString,256,"map_d %s\n", textureAlpha ); + } } else { - gModel.usesRGB = 1; if ( gExportTexture ) { - typeTextureFileName = textureRGB; + if (gOptions->exportFlags & EXPT_SKFB) + { + gModel.usesRGBA = 1; + typeTextureFileName = textureRGBA; + } + else + { + gModel.usesRGB = 1; + typeTextureFileName = textureRGB; + } } else { diff --git a/Win/blockInfo.h b/Win/blockInfo.h index 2a7bc78f..5a32b25c 100644 --- a/Win/blockInfo.h +++ b/Win/blockInfo.h @@ -220,6 +220,8 @@ extern UnitType gUnitTypeTable[]; // use biomes for export #define EXPT_BIOME 0x2000000 +// Sketchfab export (to export only RGBA texture) +#define EXPT_SKFB 0x4000000 #define EP_FIELD_LENGTH 20