Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
2587e2cf79 | |||
eb01ca604f | |||
f6a39d6eab | |||
4fa93f8676 | |||
639f11d0b9 | |||
6e32d1e010 | |||
85db14f213 | |||
ac5f849e91 | |||
4783d5621e | |||
85b9c2b0c5 | |||
447634d263 | |||
f436a71479 | |||
e848645e88 | |||
78b55e1e37 | |||
3b0e0c3402 | |||
a19e25228f | |||
d8ed531e4c | |||
73851ab86f | |||
0cabfb6cfa | |||
1fafffd8af | |||
96f22f8cd4 | |||
558f7970b1 | |||
d2fbcc5259 | |||
0e5a1877a8 | |||
8e436b1d30 |
@ -1,3 +1,9 @@
|
||||
NVIDIA Texture Tools version 2.0.8
|
||||
* Fix float to fixed image conversion. Patch provided by Alex Pfaffe. Fixes issue 121.
|
||||
* ColorBlock::isSingleColor compares only RGB channels. Fixes issue 115.
|
||||
* Fix cmake build in msvc. Fixes issue 111.
|
||||
* Better estimate principal component. Fixes issue 120.
|
||||
|
||||
NVIDIA Texture Tools version 2.0.7
|
||||
* Output correct exit codes. Fixes issue 92.
|
||||
* Fix thread-safety errors. Fixes issue 90.
|
||||
|
@ -53,11 +53,7 @@ ENDIF(ZLIB_FOUND)
|
||||
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
|
||||
SET(OPENEXR_FOUND TRUE)
|
||||
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${ZLIB_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR")
|
||||
|
||||
IF(OPENEXR_ILMTHREAD_LIBRARY)
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_LIBRARIES} ${OPENEXR_ILMTHREAD_LIBRARY})
|
||||
ENDIF(OPENEXR_ILMTHREAD_LIBRARY)
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR")
|
||||
ENDIF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
|
||||
|
||||
IF(OPENEXR_FOUND)
|
||||
|
@ -71,12 +71,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "NVIDIA Corporation"
|
||||
VALUE "FileDescription", "NVIDIA Texture Tools Dynamic Link Library"
|
||||
VALUE "FileVersion", "2, 0, 6, 0"
|
||||
VALUE "FileVersion", "2, 0, 8, 0"
|
||||
VALUE "InternalName", "nvtt"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2007"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2007-2010"
|
||||
VALUE "OriginalFilename", "nvtt.dll"
|
||||
VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library"
|
||||
VALUE "ProductVersion", "2, 0, 6, 0"
|
||||
VALUE "ProductVersion", "2, 0, 8, 0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -179,6 +179,8 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying header files..."
|
||||
CommandLine="xcopy /y /f /i "$(SolutionDir)\..\..\src\nvtt\nvtt*.h" "$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
@ -344,6 +346,8 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying header files..."
|
||||
CommandLine="xcopy /y /f /i "$(SolutionDir)\..\..\src\nvtt\nvtt*.h" "$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
@ -503,6 +507,8 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying header files..."
|
||||
CommandLine="xcopy /y /f /i "$(SolutionDir)\..\..\src\nvtt\nvtt*.h" "$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
@ -664,6 +670,8 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Copying header files..."
|
||||
CommandLine="xcopy /y /f /i "$(SolutionDir)\..\..\src\nvtt\nvtt*.h" "$(SolutionDir)\$(ConfigurationName).$(PlatformName)\include\nvtt\""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
@ -33,6 +33,7 @@ IF(UNIX)
|
||||
ENDIF(UNIX)
|
||||
|
||||
IF(NVCORE_SHARED)
|
||||
ADD_DEFINITIONS(-DNVCORE_SHARED=1)
|
||||
ADD_LIBRARY(nvcore SHARED ${CORE_SRCS})
|
||||
ELSE(NVCORE_SHARED)
|
||||
ADD_LIBRARY(nvcore ${CORE_SRCS})
|
||||
|
@ -17,7 +17,7 @@ namespace nv
|
||||
/// String hash based on Bernstein's hash.
|
||||
inline uint strHash(const char * data, uint h = 5381)
|
||||
{
|
||||
uint i;
|
||||
uint i = 0;
|
||||
while(data[i] != 0) {
|
||||
h = (33 * h) ^ uint(data[i]);
|
||||
i++;
|
||||
|
@ -53,6 +53,7 @@ ENDIF(OPENEXR_FOUND)
|
||||
ADD_DEFINITIONS(-DNVIMAGE_EXPORTS)
|
||||
|
||||
IF(NVIMAGE_SHARED)
|
||||
ADD_DEFINITIONS(-DNVIMAGE_SHARED=1)
|
||||
ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS})
|
||||
ELSE(NVIMAGE_SHARED)
|
||||
ADD_LIBRARY(nvimage ${IMAGE_SRCS})
|
||||
|
@ -113,9 +113,12 @@ void ColorBlock::splatY()
|
||||
/// Returns true if the block has a single color.
|
||||
bool ColorBlock::isSingleColor() const
|
||||
{
|
||||
for(int i = 1; i < 16; i++)
|
||||
Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
|
||||
uint u = m_color[0].u & mask.u;
|
||||
|
||||
for (int i = 1; i < 16; i++)
|
||||
{
|
||||
if (m_color[0] != m_color[i])
|
||||
if (u != (m_color[i].u & mask.u))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ DDSHeader::DDSHeader()
|
||||
|
||||
// Store version information on the reserved header attributes.
|
||||
this->reserved[9] = MAKEFOURCC('N', 'V', 'T', 'T');
|
||||
this->reserved[10] = (2 << 16) | (0 << 8) | (7); // major.minor.revision
|
||||
this->reserved[10] = (2 << 16) | (0 << 8) | (8); // major.minor.revision
|
||||
|
||||
this->pf.size = 32;
|
||||
this->pf.flags = 0;
|
||||
|
@ -19,6 +19,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
ADD_DEFINITIONS(-DNVMATH_EXPORTS)
|
||||
|
||||
IF(NVMATH_SHARED)
|
||||
ADD_DEFINITIONS(-DNVMATH_SHARED=1)
|
||||
ADD_LIBRARY(nvmath SHARED ${MATH_SRCS})
|
||||
ELSE(NVMATH_SHARED)
|
||||
ADD_LIBRARY(nvmath ${MATH_SRCS})
|
||||
|
@ -126,10 +126,8 @@ namespace nvtt
|
||||
// Convert linear float image to fixed image ready for compression.
|
||||
void toFixedImage(const InputOptions::Private & inputOptions)
|
||||
{
|
||||
if (this->asFixedImage() == NULL)
|
||||
if (m_floatImage != NULL) // apfaffe - We should check that we have a float image, if so convert it!
|
||||
{
|
||||
nvDebugCheck(m_floatImage != NULL);
|
||||
|
||||
if (inputOptions.isNormalMap || inputOptions.outputGamma == 1.0f)
|
||||
{
|
||||
m_fixedImage = m_floatImage->createImage();
|
||||
@ -175,11 +173,12 @@ namespace nvtt
|
||||
|
||||
const Image * asFixedImage() const
|
||||
{
|
||||
if (m_inputImage != NULL)
|
||||
// - apfaffe - switched logic to return the 'processed image' rather than the input!
|
||||
if (m_fixedImage != NULL && m_fixedImage.ptr() != NULL)
|
||||
{
|
||||
return m_inputImage;
|
||||
return m_fixedImage.ptr();
|
||||
}
|
||||
return m_fixedImage.ptr();
|
||||
return m_inputImage;
|
||||
}
|
||||
|
||||
Image * asMutableFixedImage()
|
||||
|
@ -128,7 +128,20 @@ inline __device__ __host__ float3 firstEigenVector( float matrix[6] )
|
||||
{
|
||||
// 8 iterations seems to be more than enough.
|
||||
|
||||
float3 v = make_float3(1.0f, 1.0f, 1.0f);
|
||||
float3 row0 = make_float3(matrix[0], matrix[1], matrix[2]);
|
||||
float3 row1 = make_float3(matrix[1], matrix[3], matrix[4]);
|
||||
float3 row2 = make_float3(matrix[2], matrix[4], matrix[5]);
|
||||
|
||||
float r0 = dot(row0, row0);
|
||||
float r1 = dot(row1, row1);
|
||||
float r2 = dot(row2, row2);
|
||||
|
||||
float3 v;
|
||||
if (r0 > r1 && r0 > r2) v = row0;
|
||||
else if (r1 > r2) v = row1;
|
||||
else v = row2;
|
||||
|
||||
//float3 v = make_float3(1.0f, 1.0f, 1.0f);
|
||||
for(int i = 0; i < 8; i++) {
|
||||
float x = v.x * matrix[0] + v.y * matrix[1] + v.z * matrix[2];
|
||||
float y = v.x * matrix[1] + v.y * matrix[3] + v.z * matrix[4];
|
||||
|
@ -61,6 +61,22 @@ Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weight
|
||||
}
|
||||
|
||||
|
||||
static Vec3 EstimatePrincipleComponent( Sym3x3 const& matrix )
|
||||
{
|
||||
Vec3 const row0(matrix[0], matrix[1], matrix[2]);
|
||||
Vec3 const row1(matrix[1], matrix[3], matrix[4]);
|
||||
Vec3 const row2(matrix[2], matrix[4], matrix[5]);
|
||||
|
||||
float r0 = Dot(row0, row0);
|
||||
float r1 = Dot(row1, row1);
|
||||
float r2 = Dot(row2, row2);
|
||||
|
||||
if (r0 > r1 && r0 > r2) return row0;
|
||||
if (r1 > r2) return row1;
|
||||
return row2;
|
||||
}
|
||||
|
||||
|
||||
#define POWER_ITERATION_COUNT 8
|
||||
|
||||
#if SQUISH_USE_SIMD
|
||||
@ -70,7 +86,13 @@ Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
|
||||
Vec4 const row0( matrix[0], matrix[1], matrix[2], 0.0f );
|
||||
Vec4 const row1( matrix[1], matrix[3], matrix[4], 0.0f );
|
||||
Vec4 const row2( matrix[2], matrix[4], matrix[5], 0.0f );
|
||||
Vec4 v = VEC4_CONST( 1.0f );
|
||||
|
||||
//Vec4 v = VEC4_CONST( 1.0f );
|
||||
//Vec4 v = row0; // row1, row2
|
||||
|
||||
Vec3 v3 = EstimatePrincipleComponent( matrix );
|
||||
Vec4 v( v3.X(), v3.Y(), v3.Z(), 0.0f );
|
||||
|
||||
for( int i = 0; i < POWER_ITERATION_COUNT; ++i )
|
||||
{
|
||||
// matrix multiply
|
||||
@ -91,7 +113,7 @@ Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
|
||||
|
||||
Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
|
||||
{
|
||||
Vec3 v(1, 1, 1);
|
||||
Vec3 v = EstimatePrincipleComponent( matrix );
|
||||
for (int i = 0; i < POWER_ITERATION_COUNT; i++)
|
||||
{
|
||||
float x = v.X() * matrix[0] + v.Y() * matrix[1] + v.Z() * matrix[2];
|
||||
|
@ -134,6 +134,7 @@ int main(int argc, char *argv[])
|
||||
MyAssertHandler assertHandler;
|
||||
MyMessageHandler messageHandler;
|
||||
|
||||
bool alpha = false;
|
||||
bool normal = false;
|
||||
bool color2normal = false;
|
||||
bool wrapRepeat = false;
|
||||
@ -157,6 +158,10 @@ int main(int argc, char *argv[])
|
||||
if (strcmp("-color", argv[i]) == 0)
|
||||
{
|
||||
}
|
||||
else if (strcmp("-alpha", argv[i]) == 0)
|
||||
{
|
||||
alpha = true;
|
||||
}
|
||||
else if (strcmp("-normal", argv[i]) == 0)
|
||||
{
|
||||
normal = true;
|
||||
@ -270,6 +275,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
printf("Input options:\n");
|
||||
printf(" -color \tThe input image is a color map (default).\n");
|
||||
printf(" -alpha \tThe input image has an alpha channel used for transparency.\n");
|
||||
printf(" -normal \tThe input image is a normal map.\n");
|
||||
printf(" -tonormal\tConvert input to normal map.\n");
|
||||
printf(" -clamp \tClamp wrapping mode (default).\n");
|
||||
@ -363,6 +369,15 @@ int main(int argc, char *argv[])
|
||||
inputOptions.setWrapMode(nvtt::WrapMode_Clamp);
|
||||
}
|
||||
|
||||
if (alpha)
|
||||
{
|
||||
inputOptions.setAlphaMode(nvtt::AlphaMode_Transparency);
|
||||
}
|
||||
else
|
||||
{
|
||||
inputOptions.setAlphaMode(nvtt::AlphaMode_None);
|
||||
}
|
||||
|
||||
if (normal)
|
||||
{
|
||||
setNormalMap(inputOptions);
|
||||
|
Reference in New Issue
Block a user