Fix build under OSX with clang. Fixes issue 180.

This commit is contained in:
castano
2012-09-11 16:22:09 +00:00
parent 15f5e19d40
commit 1d8d067caf
13 changed files with 96 additions and 39 deletions

View File

@ -21,7 +21,7 @@ SET(NVTT_SRCS
CompressionOptions.h CompressionOptions.cpp
InputOptions.h InputOptions.cpp
OutputOptions.h OutputOptions.cpp
TaskDispatcher.h TaskDispatcher.cpp
TaskDispatcher.h #TaskDispatcher.cpp
Surface.h Surface.cpp
CubeSurface.h CubeSurface.cpp
cuda/CudaUtils.h cuda/CudaUtils.cpp

View File

@ -523,6 +523,30 @@ Vector3 CubeSurface::Private::applyCosinePowerFilter(const Vector3 & filterDir,
int x0 = 0, x1 = L;
int y0 = 0, y1 = L;
if (false) {
// New approach?
// For each face, we are looking for 4 planes that bound the cone.
// All planes go through the origin.
// Plane fully determined by its normal.
// We only care about planes aligned to one axis. So, for the XY face, we have 4 planes:
// Plane goes through origin.
// Plane normal is unit length.
// Plane must be tangent to cone ->
// angle between plane normal and cone axis is 90 - cone angle & 90 + cone angle
// dot(N, D) == cos(90 - cone angle)
// dot(N, D) == cos(90 + cone angle)
// Plane must contain face UV axis
// Find the 4 planes and how they intersect the unit face, which gives us (u0,v0, u1,v1).
// Expand uv coordinates, clamp to
}
// @@ Ugh. This is wrong, or only right when filterDir is aligned to one axis.
if (false) {
// uv coordinates corresponding to filterDir.

View File

@ -83,7 +83,7 @@ inline static void findMinMaxColorsBox(const Vector3 * block, uint num, Vector3
inline static void selectDiagonal(const Vector3 * block, uint num, Vector3 * restrict maxColor, Vector3 * restrict minColor)
{
Vector3 center = (*maxColor + *minColor) * 0.5;
Vector3 center = (*maxColor + *minColor) * 0.5f;
Vector2 covariance = Vector2(0.0f);
for (uint i = 0; i < num; i++)
@ -714,8 +714,8 @@ void QuickCompress::compressDXT5(const ColorBlock & rgba, BlockDXT5 * dxtBlock,
void QuickCompress::outputBlock4(const ColorSet & set, const Vector3 & start, const Vector3 & end, BlockDXT1 * block)
{
Vector3 minColor = start * 255;
Vector3 maxColor = end * 255;
Vector3 minColor = start * 255.0f;
Vector3 maxColor = end * 255.0f;
uint16 color0 = roundAndExpand(&maxColor);
uint16 color1 = roundAndExpand(&minColor);
@ -727,15 +727,15 @@ void QuickCompress::outputBlock4(const ColorSet & set, const Vector3 & start, co
block->col0 = Color16(color0);
block->col1 = Color16(color1);
block->indices = computeIndices4(set, maxColor / 255, minColor / 255);
block->indices = computeIndices4(set, maxColor / 255.0f, minColor / 255.0f);
//optimizeEndPoints4(set, block);
}
void QuickCompress::outputBlock3(const ColorSet & set, const Vector3 & start, const Vector3 & end, BlockDXT1 * block)
{
Vector3 minColor = start * 255;
Vector3 maxColor = end * 255;
Vector3 minColor = start * 255.0f;
Vector3 maxColor = end * 255.0f;
uint16 color0 = roundAndExpand(&minColor);
uint16 color1 = roundAndExpand(&maxColor);
@ -747,7 +747,7 @@ void QuickCompress::outputBlock3(const ColorSet & set, const Vector3 & start, co
block->col0 = Color16(color0);
block->col1 = Color16(color1);
block->indices = computeIndices3(set, maxColor / 255, minColor / 255);
block->indices = computeIndices3(set, maxColor / 255.0f, minColor / 255.0f);
//optimizeEndPoints3(set, block);
}

View File

@ -33,6 +33,7 @@
#include <nvcore/TextWriter.h>
#include <nvcore/FileSystem.h>
#include <nvcore/Timer.h>
#include <nvcore/Array.inl>
#include <stdlib.h> // free
#include <string.h> // memcpy

View File

@ -105,6 +105,7 @@ GLuint createTexture(nv::DirectDrawSurface & dds)
else {
// Add support for cubemaps.
}
return tex;
}
void drawQuad()

View File

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