diff --git a/trunk/project/vc8/nvcompress/nvcompress.rc b/trunk/project/vc8/nvcompress/nvcompress.rc index 57ee9dc..842ded1 100644 Binary files a/trunk/project/vc8/nvcompress/nvcompress.rc and b/trunk/project/vc8/nvcompress/nvcompress.rc differ diff --git a/trunk/project/vc8/nvddsinfo/nvddsinfo.rc b/trunk/project/vc8/nvddsinfo/nvddsinfo.rc new file mode 100644 index 0000000..842ded1 Binary files /dev/null and b/trunk/project/vc8/nvddsinfo/nvddsinfo.rc differ diff --git a/trunk/project/vc8/nvddsinfo/nvddsinfo.vcproj b/trunk/project/vc8/nvddsinfo/nvddsinfo.vcproj index 33ff893..91fdf5f 100644 --- a/trunk/project/vc8/nvddsinfo/nvddsinfo.vcproj +++ b/trunk/project/vc8/nvddsinfo/nvddsinfo.vcproj @@ -15,6 +15,7 @@ @@ -170,12 +171,24 @@ RelativePath="..\..\..\src\nvimage\nvtt\tools\cmdline.h" > + + + + + + diff --git a/trunk/project/vc8/nvddsinfo/nvidia.ico b/trunk/project/vc8/nvddsinfo/nvidia.ico new file mode 100644 index 0000000..6aa721e Binary files /dev/null and b/trunk/project/vc8/nvddsinfo/nvidia.ico differ diff --git a/trunk/project/vc8/nvddsinfo/resource.h b/trunk/project/vc8/nvddsinfo/resource.h new file mode 100644 index 0000000..e765787 --- /dev/null +++ b/trunk/project/vc8/nvddsinfo/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by nvcompress.rc +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/trunk/project/vc8/nvtt/nvtt.vcproj b/trunk/project/vc8/nvtt/nvtt.vcproj index 9aac4c6..294d02d 100644 --- a/trunk/project/vc8/nvtt/nvtt.vcproj +++ b/trunk/project/vc8/nvtt/nvtt.vcproj @@ -212,7 +212,7 @@ UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" + DebugInformationFormat="0" /> expandNormals(0); img->normalize(0); + img->packNormals(0); } diff --git a/trunk/src/nvimage/nvtt/InputOptions.cpp b/trunk/src/nvimage/nvtt/InputOptions.cpp index 37773c2..e6a04d2 100644 --- a/trunk/src/nvimage/nvtt/InputOptions.cpp +++ b/trunk/src/nvimage/nvtt/InputOptions.cpp @@ -226,6 +226,12 @@ void InputOptions::setQuantization(bool colorDithering, bool alphaDithering, boo } +/// Indicate whether input is a normal map or not. +void InputOptions::setNormalMap(bool b) +{ + m.normalMap = b; +} + /// Enable normal map conversion. void InputOptions::setConvertToNormalMap(bool convert) { diff --git a/trunk/src/nvimage/nvtt/InputOptions.h b/trunk/src/nvimage/nvtt/InputOptions.h index 370d739..0fe5fe3 100644 --- a/trunk/src/nvimage/nvtt/InputOptions.h +++ b/trunk/src/nvimage/nvtt/InputOptions.h @@ -1,24 +1,24 @@ -// Copyright NVIDIA Corporation 2007 -- Ignacio Castano -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #ifndef NV_TT_INPUTOPTIONS_H @@ -64,6 +64,7 @@ namespace nvtt MipmapFilter mipmapFilter; // Normal map options. + bool normalMap; bool normalizeMipmaps; bool convertToNormalMap; nv::Vector4 heightFactors; diff --git a/trunk/src/nvimage/nvtt/dxtlib.cpp b/trunk/src/nvimage/nvtt/dxtlib.cpp index e9dc21d..8c9f94a 100644 --- a/trunk/src/nvimage/nvtt/dxtlib.cpp +++ b/trunk/src/nvimage/nvtt/dxtlib.cpp @@ -255,8 +255,14 @@ static FloatImage * toFloatImage(const Image * image, const InputOptions::Privat FloatImage * floatImage = new FloatImage(image); - // Convert to linear space. - if (inputOptions.inputGamma != 1.0f) { + if (inputOptions.normalMap) + { + // Expand normals. to [-1, 1] range. + // floatImage->expandNormals(0); + } + else if (inputOptions.inputGamma != 1.0f) + { + // Convert to linear space. floatImage->toLinear(0, 3, inputOptions.inputGamma); } diff --git a/trunk/src/nvimage/nvtt/nvtt.h b/trunk/src/nvimage/nvtt/nvtt.h index a05263b..0aad694 100644 --- a/trunk/src/nvimage/nvtt/nvtt.h +++ b/trunk/src/nvimage/nvtt/nvtt.h @@ -172,6 +172,7 @@ namespace nvtt NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127); // Set normal map options. + NVTT_API void setNormalMap(bool b); NVTT_API void setConvertToNormalMap(bool convert); NVTT_API void setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale); NVTT_API void setNormalFilter(float small, float medium, float big, float large); diff --git a/trunk/src/nvimage/nvtt/tools/compress.cpp b/trunk/src/nvimage/nvtt/tools/compress.cpp index 952083c..1346f1f 100644 --- a/trunk/src/nvimage/nvtt/tools/compress.cpp +++ b/trunk/src/nvimage/nvtt/tools/compress.cpp @@ -98,6 +98,7 @@ struct MyErrorHandler : public nvtt::ErrorHandler // Set color to normal map conversion options. void setColorToNormalMap(nvtt::InputOptions & inputOptions) { + inputOptions.setNormalMap(false); inputOptions.setConvertToNormalMap(true); inputOptions.setHeightEvaluation(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 0.0f); //inputOptions.setNormalFilter(1.0f, 0, 0, 0); @@ -109,6 +110,7 @@ void setColorToNormalMap(nvtt::InputOptions & inputOptions) // Set options for normal maps. void setNormalMap(nvtt::InputOptions & inputOptions) { + inputOptions.setNormalMap(true); inputOptions.setConvertToNormalMap(false); inputOptions.setGamma(1.0f, 1.0f); inputOptions.setNormalizeMipmaps(true); @@ -117,6 +119,7 @@ void setNormalMap(nvtt::InputOptions & inputOptions) // Set options for color maps. void setColorMap(nvtt::InputOptions & inputOptions) { + inputOptions.setNormalMap(false); inputOptions.setConvertToNormalMap(false); inputOptions.setGamma(2.2f, 2.2f); inputOptions.setNormalizeMipmaps(false); @@ -333,7 +336,8 @@ int main(int argc, char *argv[]) } else { - inputOptions.setMipmapping(true, nvtt::MipmapFilter_Kaiser); + inputOptions.setMipmapping(true, nvtt::MipmapFilter_Box); + //inputOptions.setMipmapping(true, nvtt::MipmapFilter_Kaiser); } if (wrapRepeat)