Support assembling texture arrays.

pull/235/head
mpersano 8 years ago
parent 9b79638f79
commit db8fc561c3

@ -586,6 +586,12 @@ void DDSHeader::setTextureCube()
this->header10.arraySize = 1; this->header10.arraySize = 1;
} }
void DDSHeader::setTextureArray(int imageCount)
{
this->header10.resourceDimension = DDS_DIMENSION_TEXTURE2D;
this->header10.arraySize = imageCount;
}
void DDSHeader::setLinearSize(uint size) void DDSHeader::setLinearSize(uint size)
{ {
this->flags &= ~DDSD_PITCH; this->flags &= ~DDSD_PITCH;

@ -325,6 +325,7 @@ namespace nv
void setTexture2D(); void setTexture2D();
void setTexture3D(); void setTexture3D();
void setTextureCube(); void setTextureCube();
void setTextureArray(int imageCount);
void setLinearSize(uint size); void setLinearSize(uint size);
void setPitch(uint pitch); void setPitch(uint pitch);
void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3); void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3);

@ -65,12 +65,12 @@ int main(int argc, char *argv[])
assembleVolume = true; assembleVolume = true;
assembleTextureArray = false; assembleTextureArray = false;
} }
/*if (strcmp("-array", argv[i]) == 0) if (strcmp("-array", argv[i]) == 0)
{ {
assembleCubeMap = false; assembleCubeMap = false;
assembleVolume = false; assembleVolume = false;
assembleTextureArray = true; assembleTextureArray = true;
}*/ }
else if (strcmp("-o", argv[i]) == 0) else if (strcmp("-o", argv[i]) == 0)
{ {
i++; i++;
@ -142,7 +142,6 @@ int main(int argc, char *argv[])
} }
} }
nv::StdOutputStream stream(output.str()); nv::StdOutputStream stream(output.str());
if (stream.isError()) { if (stream.isError()) {
printf("Error opening '%s' for writting\n", output.str()); printf("Error opening '%s' for writting\n", output.str());
@ -165,12 +164,16 @@ int main(int argc, char *argv[])
} }
else if (assembleTextureArray) else if (assembleTextureArray)
{ {
//header.setTextureArray(imageCount); header.setTextureArray(imageCount);
} }
// @@ It always outputs 32 bpp. // @@ It always outputs 32 bpp.
header.setPitch(4 * w); if (!assembleTextureArray) {
header.setPixelFormat(32, 0xFF0000, 0xFF00, 0xFF, hasAlpha ? 0xFF000000 : 0); header.setPitch(4 * w);
header.setPixelFormat(32, 0xFF0000, 0xFF00, 0xFF, hasAlpha ? 0xFF000000 : 0);
} else {
header.setDX10Format(hasAlpha ? nv::DXGI_FORMAT_B8G8R8A8_UNORM : nv::DXGI_FORMAT_B8G8R8X8_UNORM);
}
stream << header; stream << header;

Loading…
Cancel
Save