More header optimizations.

This commit is contained in:
castano 2011-10-11 18:52:24 +00:00
parent d11d7a5f38
commit e98d795d2b
12 changed files with 1227 additions and 1217 deletions

View File

@ -189,7 +189,7 @@ NV_COMPILER_CHECK(sizeof(uint32) == 4);
#define NV_ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) #define NV_ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
#if 1 #if 0 // Disabled in The Witness.
#if NV_CC_MSVC #if NV_CC_MSVC
#define NV_MESSAGE(x) message(__FILE__ "(" NV_STRING(__LINE__) ") : " x) #define NV_MESSAGE(x) message(__FILE__ "(" NV_STRING(__LINE__) ") : " x)
#else #else

View File

@ -6,7 +6,7 @@
#include "nvmath/Color.h" #include "nvmath/Color.h"
#include "nvmath/Vector.inl" #include "nvmath/Vector.inl"
#include "nvmath/Matrix.h" #include "nvmath/Matrix.inl"
#include "nvcore/Utils.h" // max #include "nvcore/Utils.h" // max
#include "nvcore/Ptr.h" #include "nvcore/Ptr.h"

4
src/nvmath/Matrix.cpp Normal file
View File

@ -0,0 +1,4 @@
// This code is in the public domain -- castanyo@yahoo.es
#include "Matrix.h"
#include "Matrix.inl"

File diff suppressed because it is too large Load Diff

1124
src/nvmath/Matrix.inl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#include "Plane.h" #include "Plane.h"
#include "Plane.inl" #include "Plane.inl"
#include "Matrix.h" #include "Matrix.inl"
namespace nv namespace nv
{ {

View File

@ -5,6 +5,8 @@
#include "Atomic.h" #include "Atomic.h"
#include "ThreadPool.h" #include "ThreadPool.h"
#include "nvcore/Utils.h" // toI32
using namespace nv; using namespace nv;
#define ENABLE_PARALLEL_FOR 0 #define ENABLE_PARALLEL_FOR 0
@ -52,7 +54,7 @@ void ParallelFor::run(uint count) {
nvDebugCheck(idx >= count); nvDebugCheck(idx >= count);
#else #else
for (int i = 0; i < count; i++) { for (int i = 0; i < toI32(count); i++) {
task(context, i); task(context, i);
} }
#endif #endif

View File

@ -1,8 +1,8 @@
// This code is in the public domain -- castano@gmail.com // This code is in the public domain -- castano@gmail.com
#pragma once #pragma once
#ifndef NV_THREAD_THREADPOOL_H #ifndef NV_THREAD_THREADPOOL_H
#define NV_THREAD_THREADPOOL_H #define NV_THREAD_THREADPOOL_H
#include "nvthread.h" #include "nvthread.h"

View File

@ -518,7 +518,7 @@ Vector3 CubeSurface::Private::applyCosinePowerFilter(const Vector3 & filterDir,
// Focal point in polar coordinates: // Focal point in polar coordinates:
Vector2 Fp = toPolar(F); Vector2 Fp = toPolar(F);
nvCheck(Fp.y >= 0.0f); // top nvCheck(Fp.y >= 0.0f); // top
nvCheck(Fp.y <= PI/2); // horizon //nvCheck(Fp.y <= PI/2); // horizon
// If this is an ellipse: // If this is an ellipse:
if (Fp.y + coneAngle < PI/2) { if (Fp.y + coneAngle < PI/2) {

View File

@ -29,7 +29,7 @@
#include "nvcore/Utils.h" // nextPowerOfTwo #include "nvcore/Utils.h" // nextPowerOfTwo
#include "nvcore/Memory.h" #include "nvcore/Memory.h"
#include <string.h> // memcpy #include <string.h> // memcpy, memset

View File

@ -1,84 +1,82 @@
// Copyright (c) 2009-2011 Ignacio Castano <castano@gmail.com> // Copyright (c) 2009-2011 Ignacio Castano <castano@gmail.com>
// Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano <icastano@nvidia.com> // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano <icastano@nvidia.com>
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, // restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell // copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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.
#ifndef NVTT_INPUTOPTIONS_H #ifndef NVTT_INPUTOPTIONS_H
#define NVTT_INPUTOPTIONS_H #define NVTT_INPUTOPTIONS_H
#include <nvcore/Ptr.h> #include "nvtt.h"
#include <nvmath/Vector.h>
#include <nvmath/Matrix.h> #include "nvmath/Vector.h"
#include <nvimage/Image.h>
#include <nvimage/FloatImage.h>
#include "nvtt.h" namespace nvtt
{
namespace nvtt
{ struct InputOptions::Private
{
struct InputOptions::Private Private() : images(NULL) {}
{
Private() : images(NULL) {} WrapMode wrapMode;
TextureType textureType;
WrapMode wrapMode; InputFormat inputFormat;
TextureType textureType; AlphaMode alphaMode;
InputFormat inputFormat;
AlphaMode alphaMode; uint width;
uint height;
uint width; uint depth;
uint height; uint faceCount;
uint depth; uint mipmapCount;
uint faceCount; uint imageCount;
uint mipmapCount;
uint imageCount; void ** images;
void ** images; // Gamma conversion.
float inputGamma;
// Gamma conversion. float outputGamma;
float inputGamma;
float outputGamma; // Mipmap generation options.
bool generateMipmaps;
// Mipmap generation options. int maxLevel;
bool generateMipmaps; MipmapFilter mipmapFilter;
int maxLevel;
MipmapFilter mipmapFilter; // Kaiser filter parameters.
float kaiserWidth;
// Kaiser filter parameters. float kaiserAlpha;
float kaiserWidth; float kaiserStretch;
float kaiserAlpha;
float kaiserStretch; // Normal map options.
bool isNormalMap;
// Normal map options. bool normalizeMipmaps;
bool isNormalMap; bool convertToNormalMap;
bool normalizeMipmaps; nv::Vector4 heightFactors;
bool convertToNormalMap; nv::Vector4 bumpFrequencyScale;
nv::Vector4 heightFactors;
nv::Vector4 bumpFrequencyScale; // Adjust extents.
uint maxExtent;
// Adjust extents. RoundMode roundMode;
uint maxExtent; };
RoundMode roundMode;
}; } // nvtt namespace
} // nvtt namespace #endif // NVTT_INPUTOPTIONS_H
#endif // NVTT_INPUTOPTIONS_H

View File

@ -25,7 +25,7 @@
#include "Surface.h" #include "Surface.h"
#include "nvmath/Vector.inl" #include "nvmath/Vector.inl"
#include "nvmath/Matrix.h" #include "nvmath/Matrix.inl"
#include "nvmath/Color.h" #include "nvmath/Color.h"
#include "nvmath/Half.h" #include "nvmath/Half.h"