diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index a6bbdad..8191f64 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -586,6 +586,12 @@ void DDSHeader::setTextureCube() this->header10.arraySize = 1; } +void DDSHeader::setTextureArray(int imageCount) +{ + this->header10.resourceDimension = DDS_DIMENSION_TEXTURE2D; + this->header10.arraySize = imageCount; +} + void DDSHeader::setLinearSize(uint size) { this->flags &= ~DDSD_PITCH; diff --git a/src/nvimage/DirectDrawSurface.h b/src/nvimage/DirectDrawSurface.h index 07d135c..bae104b 100644 --- a/src/nvimage/DirectDrawSurface.h +++ b/src/nvimage/DirectDrawSurface.h @@ -325,6 +325,7 @@ namespace nv void setTexture2D(); void setTexture3D(); void setTextureCube(); + void setTextureArray(int imageCount); void setLinearSize(uint size); void setPitch(uint pitch); void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3); diff --git a/src/nvtt/tools/assemble.cpp b/src/nvtt/tools/assemble.cpp index 2886454..ff80a36 100644 --- a/src/nvtt/tools/assemble.cpp +++ b/src/nvtt/tools/assemble.cpp @@ -65,12 +65,12 @@ int main(int argc, char *argv[]) assembleVolume = true; assembleTextureArray = false; } - /*if (strcmp("-array", argv[i]) == 0) + if (strcmp("-array", argv[i]) == 0) { assembleCubeMap = false; assembleVolume = false; assembleTextureArray = true; - }*/ + } else if (strcmp("-o", argv[i]) == 0) { i++; @@ -142,7 +142,6 @@ int main(int argc, char *argv[]) } } - nv::StdOutputStream stream(output.str()); if (stream.isError()) { printf("Error opening '%s' for writting\n", output.str()); @@ -165,12 +164,16 @@ int main(int argc, char *argv[]) } else if (assembleTextureArray) { - //header.setTextureArray(imageCount); + header.setTextureArray(imageCount); } // @@ It always outputs 32 bpp. - header.setPitch(4 * w); - header.setPixelFormat(32, 0xFF0000, 0xFF00, 0xFF, hasAlpha ? 0xFF000000 : 0); + if (!assembleTextureArray) { + 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;