Fix build.

This commit is contained in:
castano 2010-05-28 07:45:11 +00:00
parent 3956d8a0c2
commit 1454cbac14
17 changed files with 347 additions and 367 deletions

View File

@ -7,12 +7,12 @@
//#include <shlwapi.h> // PathFileExists //#include <shlwapi.h> // PathFileExists
#include <windows.h> // GetFileAttributes #include <windows.h> // GetFileAttributes
#include <direct.h> // _mkdir #include <direct.h> // _mkdir
#include <stdio.h> // remove, unlink
#else #else
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <stdio.h> // remove, unlink
using namespace nv; using namespace nv;
@ -59,4 +59,4 @@ bool FileSystem::removeFile(const char * path)
{ {
// @@ Use unlink or remove? // @@ Use unlink or remove?
return remove(path) == 0; return remove(path) == 0;
} }

View File

@ -5,13 +5,12 @@
#include "nvcore.h" #include "nvcore.h"
#include "Debug.h" #include "Debug.h"
#include "RefCounted.h" // WeakProxy
namespace nv namespace nv
{ {
class WeakProxy;
/** Simple auto pointer template class. /** Simple auto pointer template class.
* *
* This is very similar to the standard auto_ptr class, but with some * This is very similar to the standard auto_ptr class, but with some
@ -274,10 +273,10 @@ namespace nv
void operator=(T * p) void operator=(T * p)
{ {
if (p) { if (p != NULL) {
m_proxy = p->getWeakProxy(); m_proxy = p->getWeakProxy();
assert(m_proxy != NULL); nvDebugCheck(m_proxy != NULL);
assert(m_proxy->ptr() == p); nvDebugCheck(m_proxy->ptr() == p);
} }
else { else {
m_proxy = NULL; m_proxy = NULL;
@ -298,7 +297,7 @@ namespace nv
T * operator->() const T * operator->() const
{ {
T * p = ptr(); T * p = ptr();
assert(p != NULL); nvDebugCheck(p != NULL);
return p; return p;
} }

View File

@ -132,7 +132,8 @@
#define NV_STRING2(x) #x #define NV_STRING2(x) #x
#define NV_STRING(x) NV_STRING2(x) #define NV_STRING(x) NV_STRING2(x)
#if NV_CC_GNUC #if NV_CC_GNUC
#define NV_FILE_LINE __FILE__ ":" NV_STRING(__LINE__) ": " //#define NV_FILE_LINE __FILE__ ":" NV_STRING(__LINE__) ": "
#define NV_FILE_LINE
#else #else
#define NV_FILE_LINE __FILE__ "(" NV_STRING(__LINE__) ") : " #define NV_FILE_LINE __FILE__ "(" NV_STRING(__LINE__) ") : "
#endif #endif
@ -153,6 +154,9 @@
/// Null index. @@ Move this somewhere else... This could have collisions with other definitions! /// Null index. @@ Move this somewhere else... This could have collisions with other definitions!
#define NIL uint(~0) #define NIL uint(~0)
// @@ Move this to DefsGnuc?
#include <cstddef> // size_t, NULL
/// Null pointer. /// Null pointer.
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0

View File

@ -5,7 +5,7 @@ SET(MATH_SRCS
Vector.h Vector.h
Matrix.h Matrix.h
Plane.h Plane.cpp Plane.h Plane.cpp
Box.h Box.cpp Box.h
Color.h Color.h
Half.h Half.cpp Half.h Half.cpp
Fitting.h Fitting.cpp) Fitting.h Fitting.cpp)

View File

@ -213,7 +213,7 @@ void FastCompressorBC5::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMo
void NormalCompressorDXT1::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output) void NormalCompressorDXT1::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output)
{ {
nvsquish::WeightedClusterFit fit; nvsquish::WeightedClusterFit fit;
fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z);
if (rgba.isSingleColor()) if (rgba.isSingleColor())
{ {
@ -250,7 +250,7 @@ void NormalCompressorDXT1a::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alp
else else
{ {
nvsquish::WeightedClusterFit fit; nvsquish::WeightedClusterFit fit;
fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z);
int flags = nvsquish::kDxt1; int flags = nvsquish::kDxt1;
if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha; if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha;
@ -278,7 +278,7 @@ void NormalCompressorDXT3::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alph
else else
{ {
nvsquish::WeightedClusterFit fit; nvsquish::WeightedClusterFit fit;
fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z);
int flags = 0; int flags = 0;
if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha; if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha;
@ -312,7 +312,7 @@ void NormalCompressorDXT5::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alph
else else
{ {
nvsquish::WeightedClusterFit fit; nvsquish::WeightedClusterFit fit;
fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); fit.SetMetric(compressionOptions.colorWeight.x, compressionOptions.colorWeight.y, compressionOptions.colorWeight.z);
int flags = 0; int flags = 0;
if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha; if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha;

View File

@ -23,7 +23,7 @@
#include <string.h> // memcpy #include <string.h> // memcpy
#include <nvcore/Containers.h> // nextPowerOfTwo #include <nvcore/Utils.h> // nextPowerOfTwo
#include <nvcore/Memory.h> #include <nvcore/Memory.h>
#include <nvmath/Color.h> #include <nvmath/Color.h>

View File

@ -29,7 +29,7 @@
#include <nvmath/Color.h> #include <nvmath/Color.h>
#include <nvcore/Containers.h> // swap #include <nvcore/Utils.h> // swap
#include <limits.h> #include <limits.h>

View File

@ -21,7 +21,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
#include <nvcore/Containers.h> // swap #include <nvcore/Utils.h> // swap
#include <nvmath/Color.h> #include <nvmath/Color.h>
#include <nvmath/Fitting.h> #include <nvmath/Fitting.h>
@ -86,23 +86,23 @@ inline static void selectDiagonal(const Vector3 * block, uint num, Vector3 * res
for (uint i = 0; i < num; i++) for (uint i = 0; i < num; i++)
{ {
Vector3 t = block[i] - center; Vector3 t = block[i] - center;
covariance += t.xy() * t.z(); covariance += t.xy() * t.z;
} }
float x0 = maxColor->x(); float x0 = maxColor->x;
float y0 = maxColor->y(); float y0 = maxColor->y;
float x1 = minColor->x(); float x1 = minColor->x;
float y1 = minColor->y(); float y1 = minColor->y;
if (covariance.x() < 0) { if (covariance.x < 0) {
swap(x0, x1); swap(x0, x1);
} }
if (covariance.y() < 0) { if (covariance.y < 0) {
swap(y0, y1); swap(y0, y1);
} }
maxColor->set(x0, y0, maxColor->z()); maxColor->set(x0, y0, maxColor->z);
minColor->set(x1, y1, minColor->z()); minColor->set(x1, y1, minColor->z);
} }
inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict minColor) inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict minColor)
@ -114,9 +114,9 @@ inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict min
inline static uint16 roundAndExpand(Vector3 * restrict v) inline static uint16 roundAndExpand(Vector3 * restrict v)
{ {
uint r = uint(clamp(v->x() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); uint r = uint(clamp(v->x * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f);
uint g = uint(clamp(v->y() * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f); uint g = uint(clamp(v->y * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f);
uint b = uint(clamp(v->z() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); uint b = uint(clamp(v->z * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f);
uint16 w = (r << 11) | (g << 5) | b; uint16 w = (r << 11) | (g << 5) | b;

View File

@ -501,10 +501,10 @@ bool TexImage::setImage2D(Format format, Decoder decoder, int w, int h, int idx,
if (x * 4 + xx < w && y * 4 + yy < h) if (x * 4 + xx < w && y * 4 + yy < h)
{ {
img->setPixel(float(c.r) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 0); img->pixel(x*4 + xx, y*4 + yy, 0) = float(c.r) * 1.0f/255.0f;
img->setPixel(float(c.g) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 1); img->pixel(x*4 + xx, y*4 + yy, 1) = float(c.g) * 1.0f/255.0f;
img->setPixel(float(c.b) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 2); img->pixel(x*4 + xx, y*4 + yy, 2) = float(c.b) * 1.0f/255.0f;
img->setPixel(float(c.a) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 3); img->pixel(x*4 + xx, y*4 + yy, 3) = float(c.a) * 1.0f/255.0f;
} }
} }
} }
@ -908,28 +908,28 @@ void TexImage::setBorder(float r, float g, float b, float a)
for (int i = 0; i < w; i++) for (int i = 0; i < w; i++)
{ {
img->setPixel(r, i, 0, 0); img->pixel(i, 0, 0) = r;
img->setPixel(g, i, 0, 1); img->pixel(i, 0, 1) = g;
img->setPixel(b, i, 0, 2); img->pixel(i, 0, 2) = b;
img->setPixel(a, i, 0, 3); img->pixel(i, 0, 3) = a;
img->setPixel(r, i, h-1, 0); img->pixel(i, h-1, 0) = r;
img->setPixel(g, i, h-1, 1); img->pixel(i, h-1, 1) = g;
img->setPixel(b, i, h-1, 2); img->pixel(i, h-1, 2) = b;
img->setPixel(a, i, h-1, 3); img->pixel(i, h-1, 3) = a;
} }
for (int i = 0; i < h; i++) for (int i = 0; i < h; i++)
{ {
img->setPixel(r, 0, i, 0); img->pixel(0, i, 0) = r;
img->setPixel(g, 0, i, 1); img->pixel(0, i, 1) = g;
img->setPixel(b, 0, i, 2); img->pixel(0, i, 2) = b;
img->setPixel(a, 0, i, 3); img->pixel(0, i, 3) = a;
img->setPixel(r, w-1, i, 0); img->pixel(w-1, i, 0) = r;
img->setPixel(g, w-1, i, 1); img->pixel(w-1, i, 1) = g;
img->setPixel(b, w-1, i, 2); img->pixel(w-1, i, 2) = b;
img->setPixel(a, w-1, i, 3); img->pixel(w-1, i, 3) = a;
} }
} }
} }
@ -1134,4 +1134,4 @@ void TexImage::flipVertically() {
m->imageArray[i]->flip(); m->imageArray[i]->flip();
} }
} }

View File

@ -26,7 +26,7 @@
#include "nvtt.h" #include "nvtt.h"
#include <nvcore/Containers.h> #include <nvcore/Array.h>
#include <nvcore/RefCounted.h> #include <nvcore/RefCounted.h>
#include <nvcore/Ptr.h> #include <nvcore/Ptr.h>

View File

@ -21,8 +21,11 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
#include "CudaCompressorDXT.h"
#include "CudaUtils.h"
#include <nvcore/Debug.h> #include <nvcore/Debug.h>
#include <nvcore/Containers.h> #include <nvcore/Utils.h>
#include <nvmath/Color.h> #include <nvmath/Color.h>
#include <nvimage/Image.h> #include <nvimage/Image.h>
#include <nvimage/ColorBlock.h> #include <nvimage/ColorBlock.h>
@ -32,10 +35,6 @@
#include <nvtt/QuickCompressDXT.h> #include <nvtt/QuickCompressDXT.h>
#include <nvtt/OptimalCompressDXT.h> #include <nvtt/OptimalCompressDXT.h>
#include "CudaCompressorDXT.h"
#include "CudaUtils.h"
#if defined HAVE_CUDA #if defined HAVE_CUDA
#include <cuda_runtime_api.h> #include <cuda_runtime_api.h>
#endif #endif

View File

@ -57,7 +57,7 @@ struct MyAssertHandler : public nv::AssertHandler {
} }
// Handler method, note that func might be NULL! // Handler method, note that func might be NULL!
virtual int assert( const char *exp, const char *file, int line, const char *func ) { virtual int assertion( const char *exp, const char *file, int line, const char *func ) {
fprintf(stderr, "Assertion failed: %s\nIn %s:%d\n", exp, file, line); fprintf(stderr, "Assertion failed: %s\nIn %s:%d\n", exp, file, line);
nv::debug::dumpInfo(); nv::debug::dumpInfo();
exit(1); exit(1);

View File

@ -172,7 +172,7 @@ int main(int argc, char *argv[])
uint w = dds.width(); uint w = dds.width();
uint h = dds.height(); uint h = dds.height();
// @@ Clamp window size is texture larger than desktop? // @@ Clamp window size if texture larger than desktop?
glutInit(&argc, argv); glutInit(&argc, argv);

View File

@ -23,7 +23,6 @@
#include <nvcore/StrLib.h> #include <nvcore/StrLib.h>
#include <nvcore/StdStream.h> #include <nvcore/StdStream.h>
#include <nvcore/Containers.h>
#include <nvimage/Image.h> #include <nvimage/Image.h>
#include <nvimage/DirectDrawSurface.h> #include <nvimage/DirectDrawSurface.h>
@ -123,7 +122,7 @@ struct NormalError
vc = nv::normalize(2.0f * (vc / 255.0f) - 1.0f); vc = nv::normalize(2.0f * (vc / 255.0f) - 1.0f);
ade += acosf(nv::clamp(dot(vo, vc), -1.0f, 1.0f)); ade += acosf(nv::clamp(dot(vo, vc), -1.0f, 1.0f));
mse += length_squared((vo - vc) * (255 / 2.0f)); mse += lengthSquared((vo - vc) * (255 / 2.0f));
samples++; samples++;
} }

View File

@ -24,7 +24,6 @@
#include <nvcore/Ptr.h> #include <nvcore/Ptr.h>
#include <nvcore/StrLib.h> #include <nvcore/StrLib.h>
#include <nvcore/StdStream.h> #include <nvcore/StdStream.h>
#include <nvcore/Containers.h>
#include <nvimage/Image.h> #include <nvimage/Image.h>
#include <nvimage/ImageIO.h> #include <nvimage/ImageIO.h>

View File

@ -24,7 +24,6 @@
#include <nvcore/Ptr.h> #include <nvcore/Ptr.h>
#include <nvcore/StrLib.h> #include <nvcore/StrLib.h>
#include <nvcore/StdStream.h> #include <nvcore/StdStream.h>
#include <nvcore/Containers.h>
#include <nvimage/Image.h> #include <nvimage/Image.h>
#include <nvimage/ImageIO.h> #include <nvimage/ImageIO.h>

File diff suppressed because it is too large Load Diff