Fix build.

pull/216/head
castano 14 years ago
parent 3956d8a0c2
commit 1454cbac14

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

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

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

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

@ -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)
{
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())
{
@ -250,7 +250,7 @@ void NormalCompressorDXT1a::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alp
else
{
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;
if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha;
@ -278,7 +278,7 @@ void NormalCompressorDXT3::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alph
else
{
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;
if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha;
@ -312,7 +312,7 @@ void NormalCompressorDXT5::compressBlock(ColorBlock & rgba, nvtt::AlphaMode alph
else
{
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;
if (alphaMode == nvtt::AlphaMode_Transparency) flags |= nvsquish::kWeightColourByAlpha;

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

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

@ -21,7 +21,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#include <nvcore/Containers.h> // swap
#include <nvcore/Utils.h> // swap
#include <nvmath/Color.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++)
{
Vector3 t = block[i] - center;
covariance += t.xy() * t.z();
covariance += t.xy() * t.z;
}
float x0 = maxColor->x();
float y0 = maxColor->y();
float x1 = minColor->x();
float y1 = minColor->y();
float x0 = maxColor->x;
float y0 = maxColor->y;
float x1 = minColor->x;
float y1 = minColor->y;
if (covariance.x() < 0) {
if (covariance.x < 0) {
swap(x0, x1);
}
if (covariance.y() < 0) {
if (covariance.y < 0) {
swap(y0, y1);
}
maxColor->set(x0, y0, maxColor->z());
minColor->set(x1, y1, minColor->z());
maxColor->set(x0, y0, maxColor->z);
minColor->set(x1, y1, minColor->z);
}
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)
{
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 b = uint(clamp(v->z() * (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 b = uint(clamp(v->z * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f);
uint16 w = (r << 11) | (g << 5) | b;

@ -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)
{
img->setPixel(float(c.r) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 0);
img->setPixel(float(c.g) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 1);
img->setPixel(float(c.b) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 2);
img->setPixel(float(c.a) * 1.0f/255.0f, x*4 + xx, y*4 + yy, 3);
img->pixel(x*4 + xx, y*4 + yy, 0) = float(c.r) * 1.0f/255.0f;
img->pixel(x*4 + xx, y*4 + yy, 1) = float(c.g) * 1.0f/255.0f;
img->pixel(x*4 + xx, y*4 + yy, 2) = float(c.b) * 1.0f/255.0f;
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++)
{
img->setPixel(r, i, 0, 0);
img->setPixel(g, i, 0, 1);
img->setPixel(b, i, 0, 2);
img->setPixel(a, i, 0, 3);
img->setPixel(r, i, h-1, 0);
img->setPixel(g, i, h-1, 1);
img->setPixel(b, i, h-1, 2);
img->setPixel(a, i, h-1, 3);
img->pixel(i, 0, 0) = r;
img->pixel(i, 0, 1) = g;
img->pixel(i, 0, 2) = b;
img->pixel(i, 0, 3) = a;
img->pixel(i, h-1, 0) = r;
img->pixel(i, h-1, 1) = g;
img->pixel(i, h-1, 2) = b;
img->pixel(i, h-1, 3) = a;
}
for (int i = 0; i < h; i++)
{
img->setPixel(r, 0, i, 0);
img->setPixel(g, 0, i, 1);
img->setPixel(b, 0, i, 2);
img->setPixel(a, 0, i, 3);
img->setPixel(r, w-1, i, 0);
img->setPixel(g, w-1, i, 1);
img->setPixel(b, w-1, i, 2);
img->setPixel(a, w-1, i, 3);
img->pixel(0, i, 0) = r;
img->pixel(0, i, 1) = g;
img->pixel(0, i, 2) = b;
img->pixel(0, i, 3) = a;
img->pixel(w-1, i, 0) = r;
img->pixel(w-1, i, 1) = g;
img->pixel(w-1, i, 2) = b;
img->pixel(w-1, i, 3) = a;
}
}
}
@ -1134,4 +1134,4 @@ void TexImage::flipVertically() {
m->imageArray[i]->flip();
}
}
}

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

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

@ -57,7 +57,7 @@ struct MyAssertHandler : public nv::AssertHandler {
}
// 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);
nv::debug::dumpInfo();
exit(1);

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

@ -23,7 +23,6 @@
#include <nvcore/StrLib.h>
#include <nvcore/StdStream.h>
#include <nvcore/Containers.h>
#include <nvimage/Image.h>
#include <nvimage/DirectDrawSurface.h>
@ -123,7 +122,7 @@ struct NormalError
vc = nv::normalize(2.0f * (vc / 255.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++;
}

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

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

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save