Skip to content

Commit

Permalink
Only export RGBA texture for Sketchfab
Browse files Browse the repository at this point in the history
  • Loading branch information
AurL committed Feb 22, 2016
1 parent e2f7f62 commit 2ad4c28
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Win/Mineways.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
30 changes: 24 additions & 6 deletions Win/ObjFileManip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 2 additions & 0 deletions Win/blockInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2ad4c28

Please sign in to comment.