34#define NVTT_VERSION 30205
37#define NVTT_FORBID_COPY(Class) \
39 Class(const Class &); \
40 void operator=(const Class &); \
45#define NVTT_DECLARE_PIMPL(Class) \
94 NVTT_API void setPixelFormat(
unsigned int bitcount,
unsigned int rmask,
unsigned int gmask,
unsigned int bmask,
unsigned int amask);
303 virtual void beginImage(
int size,
int width,
int height,
int depth,
int face,
int miplevel) = 0;
306 virtual bool writeData(
const void * data,
int size) = 0;
606 NVTT_API void enableTiming(
bool enable,
int detailLevel = 1);
786 NVTT_API float average(
int channel,
int alpha_channel = -1,
float gamma = 2.2f)
const;
843 NVTT_API void range(
int channel,
float * rangeMin,
float * rangeMax,
int alpha_channel = -1,
float alpha_ref = 0.f,
TimingContext *tc = 0)
const;
1374 NVTT_API bool copy(
const Surface & src,
int xsrc,
int ysrc,
int zsrc,
int xsize,
int ysize,
int zsize,
int xdst,
int ydst,
int zdst,
TimingContext *tc = 0);
1434 NVTT_API void GetSurface(
int faceId,
int mipId,
Surface& surface,
bool expectSigned = false);
1447 NVTT_API bool loadDDS(const
char * fileName,
bool forcenormal = false);
1458 NVTT_API bool loadDDSFromMemory(const
void * data,
unsigned long long sizeInBytes,
bool forcenormal = false);
1461 NVTT_API bool saveImage(const
char* fileName,
int faceId,
int mipId);
1614 NVTT_API void range(
int channel,
float * minimum_ptr,
float * maximum_ptr)
const;
1762 NVTT_API size_t GetRecord(
int i,
char* outDescription,
size_t outDescriptionSize,
double& outSeconds);
Namespace for all public non-macro NVTT fields.
Definition nvtt.h:52
WrapMode
Wrap modes. Specifies how to handle coordinates outside the typical image range.
Definition nvtt.h:133
@ WrapMode_Mirror
Definition nvtt.h:143
@ WrapMode_Repeat
Definition nvtt.h:139
@ WrapMode_Clamp
Definition nvtt.h:136
NVTT_API unsigned int version()
Return the NVTT version number, as 10000*fork + 100*major + minor.
TextureType
Texture types. Specifies the dimensionality of a texture.
Definition nvtt.h:148
AlphaMode
Alpha mode.
Definition nvtt.h:279
@ AlphaMode_Premultiplied
Definition nvtt.h:290
@ AlphaMode_None
Definition nvtt.h:282
@ AlphaMode_Transparency
Definition nvtt.h:285
MipmapFilter
Mipmap downsampling filters. Each of these can be customized using filterWidth and params when callin...
Definition nvtt.h:167
@ MipmapFilter_Min
Definition nvtt.h:220
@ MipmapFilter_Triangle
Definition nvtt.h:176
@ MipmapFilter_Box
Definition nvtt.h:172
@ MipmapFilter_Max
Definition nvtt.h:223
@ MipmapFilter_Mitchell
Definition nvtt.h:207
@ MipmapFilter_Kaiser
Definition nvtt.h:193
NVTT_API const char * errorString(Error e)
Return string for the given error code.
ToneMapper
Tone mapping functions.
Definition nvtt.h:638
@ ToneMapper_Reinhard
Applies a Reinhard operator to each channel: c' = c / (c + 1).
Definition nvtt.h:644
@ ToneMapper_Halo
Applies an exponential tone mapper to each channel: c' = 1 - 2^(-c).
Definition nvtt.h:648
@ ToneMapper_Lightmap
Same as ToneMapper_Linear.
Definition nvtt.h:650
@ ToneMapper_Reindhart
Name for backwards compatibility.
Definition nvtt.h:646
@ ToneMapper_Linear
Definition nvtt.h:642
void(* MessageCallback)(Severity severity, Error error, const char *message, const void *userData)
Definition nvtt.h:370
ResizeFilter
Texture resizing filters.
Definition nvtt.h:228
@ ResizeFilter_Max
Definition nvtt.h:248
@ ResizeFilter_Kaiser
Definition nvtt.h:239
@ ResizeFilter_Triangle
Definition nvtt.h:236
@ ResizeFilter_Box
Definition nvtt.h:232
@ ResizeFilter_Min
Definition nvtt.h:245
@ ResizeFilter_Mitchell
Definition nvtt.h:242
NormalTransform
Specifies a normal transformation, used to store 3D (x, y, z) normals in 2D (x, y).
Definition nvtt.h:622
@ NormalTransform_Orthographic
Reconstructs the z component using z = sqrt(1 - x^2 + y^2).
Definition nvtt.h:624
@ NormalTransform_Paraboloid
Reconstructed using normalize(x, y, 1 - min(x^2 + y^2, 1)).
Definition nvtt.h:630
@ NormalTransform_Quartic
Reconstructed using normalize(x, y, (1-x^2)(1-y^2)).
Definition nvtt.h:632
@ NormalTransform_Stereographic
Definition nvtt.h:628
CubeLayout
Specifies how to fold or unfold a cube map from or to a 2D texture.
Definition nvtt.h:1467
@ CubeLayout_Column
Definition nvtt.h:1496
@ CubeLayout_Row
Definition nvtt.h:1501
@ CubeLayout_HorizontalCross
Definition nvtt.h:1486
@ CubeLayout_VerticalCross
Definition nvtt.h:1477
@ CubeLayout_LatitudeLongitude
Same as CubeLayout_VerticalCross.
Definition nvtt.h:1503
Severity
Message severity.
Definition nvtt.h:349
@ Severity_Error
Definition nvtt.h:360
@ Severity_Warning
Definition nvtt.h:356
@ Severity_Info
Definition nvtt.h:352
Quality
Quality modes.
Definition nvtt_lowlevel.h:329
RoundMode
Extents rounding mode.
Definition nvtt.h:270
@ RoundMode_ToNearestPowerOfTwo
Each extent is rounded either up or down to the nearest power of two.
Definition nvtt.h:273
@ RoundMode_ToNextPowerOfTwo
Each extent is rounded up to the next power of two.
Definition nvtt.h:272
@ RoundMode_ToPreviousPowerOfTwo
Each element is rounded down to the next power of two.
Definition nvtt.h:274
@ RoundMode_None
Each extent is left as-is.
Definition nvtt.h:271
Format
Supported block-compression formats, including compressor variants.
Definition nvtt_lowlevel.h:218
InputFormat
Input formats. Used when creating an nvtt::Surface from an RGB/RGBA array.
Definition nvtt.h:156
@ InputFormat_BGRA_8SB
[-127, 127] 8 bit int
Definition nvtt.h:158
@ InputFormat_RGBA_16F
16 bit floating point.
Definition nvtt.h:159
@ InputFormat_RGBA_32F
32 bit floating point.
Definition nvtt.h:160
@ InputFormat_R_32F
Single channel 32 bit floating point.
Definition nvtt.h:161
@ InputFormat_BGRA_8UB
[0, 255] 8 bit uint
Definition nvtt.h:157
NVTT_API bool setMessageCallback(MessageCallback callback, const void *userData)
PixelType
Pixel value types.
Definition nvtt_lowlevel.h:302
EdgeFixup
Use EdgeFixup_None if unsure; this affects how certain cube surface processing algorithms work.
Definition nvtt.h:1507
@ EdgeFixup_Average
Currently unimplemented.
Definition nvtt.h:1511
@ EdgeFixup_Warp
Applies a cubic warp to each face's coordinate system in cosinePowerFilter() and fastResample(),...
Definition nvtt.h:1510
@ EdgeFixup_Stretch
Slightly stretches and shifts the coordinate systems cosinePowerFilter() and fastResample() use.
Definition nvtt.h:1509
@ EdgeFixup_None
No effect.
Definition nvtt.h:1508
Error
Error codes.
Definition nvtt.h:317
@ Error_FileOpen
I/O error attempting to open the given file.
Definition nvtt.h:323
@ Error_UnsupportedFeature
Unsupported feature.
Definition nvtt.h:321
@ Error_FileWrite
I/O error attempting to write to the given file.
Definition nvtt.h:324
@ Error_Messaging
Internal error while invoking the message callback.
Definition nvtt.h:326
@ Error_CudaError
CUDA reported an error during an operation.
Definition nvtt.h:322
@ Error_None
No error.
Definition nvtt.h:318
@ Error_InvalidInput
The input to the function was invalid (for instance, a negative size).
Definition nvtt.h:320
@ Error_UnsupportedOutputFormat
The chosen container does not support the requested format (for instance, attempting to store BC7 dat...
Definition nvtt.h:325
@ Error_OutputWrite
OutputOptions::writeData() returned false.
Definition nvtt.h:329
@ Error_OutOfDeviceMemory
Out of device memory (allocating a GPU-side buffer failed).
Definition nvtt.h:328
@ Error_Unknown
Alias used before NVTT 3.2 for Error_None.
Definition nvtt.h:319
@ Error_OutOfHostMemory
Out of host memory (allocating a CPU-side buffer failed).
Definition nvtt.h:327
Container
Container type for encoded data.
Definition nvtt.h:422
@ Container_DDS
DDS without the DX10 header extension. Compatible with legacy readers, but doesn't support BC6 or BC7...
Definition nvtt.h:423
@ Container_DDS10
DDS without the DX10 header. Supports BC6 and BC7, but may be unreadable by legacy readers.
Definition nvtt.h:424
#define NVTT_FORBID_COPY(Class)
Prevents a class from being copied.
Definition nvtt.h:37
#define NVTT_DECLARE_PIMPL(Class)
Hides the members of the implementation of the class behind a Private structure.
Definition nvtt.h:45
#define NVTT_DEPRECATED_API
These functions are accessible via the NVTT DLL, but there are better replacements for them,...
Definition nvtt_lowlevel.h:60
#define NVTT_API
Functions with this macro are accessible via the NVTT DLL.
Definition nvtt_lowlevel.h:56
Structure defining a list of inputs to be compressed.
Definition nvtt.h:1663
Compression options. This class describes the desired compression format and other compression settin...
Definition nvtt.h:64
NVTT_API void setPixelType(PixelType pixelType)
Set pixel type.
NVTT_API void reset()
Set default compression options.
NVTT_API void setQuality(Quality quality)
Set compression quality settings.
NVTT_API void setColorWeights(float red, float green, float blue, float alpha=1.0f)
Set the weights of each color channel used to measure compression error.
NVTT_API unsigned int d3d9Format() const
Translates to a D3D format.
NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold=127)
Set quantization options.
NVTT_API void setPitchAlignment(int pitchAlignment)
Set pitch alignment in bytes.
NVTT_API void setFormat(Format format)
Set desired compression format.
NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask)
Describes an RGB/RGBA format using 32-bit masks per channel.
Compression context.
Definition nvtt.h:479
A CubeSurface is one level of a cube map texture.
Definition nvtt.h:1525
NVTT_API int edgeLength() const
Returns the edge length of any of the faces.
NVTT_API ~CubeSurface()
Destructor.
NVTT_API CubeSurface fastResample(int size, EdgeFixup fixupMethod) const
Produces a resized version of this CubeSurface using nearest-neighbor sampling.
NVTT_API Surface unfold(CubeLayout layout) const
Creates a Surface containing an unfolded/flattened representation of the cube surface.
NVTT_API CubeSurface cosinePowerFilter(int size, float cosinePower, EdgeFixup fixupMethod) const
Spherically convolves this CubeSurface with a max(0.0f, cos(theta))^cosinePower kernel,...
NVTT_API Surface & face(int face)
Get a non-const reference to the surface for the given face.
NVTT_API const Surface & face(int face) const
Get a const reference to the surface for the given face.
NVTT_API int countMipmaps() const
Returns the number of mips that would be in a full mipmap chain starting with this CubeSurface.
NVTT_API void fold(const Surface &img, CubeLayout layout)
Sets this CubeSurface from a 2D unfolded surface in img.
NVTT_API CubeSurface(const CubeSurface &img)
Copy constructor.
NVTT_API float average(int channel) const
Computes an average value for the given channel over the entire sphere.
NVTT_API CubeSurface irradianceFilter(int size, EdgeFixup fixupMethod) const
Unimplemented; returns a null CubeSurface.
NVTT_API bool save(const char *fileName) const
Save a cube map to a DDS file in memory.
NVTT_API void clamp(int channel, float low=0.0f, float high=1.0f)
Clamps values in the given channel to the range [low, high].
NVTT_API CubeSurface()
Creates a null CubeSurface.
NVTT_API void toGamma(float gamma)
Raises channels 0...2 to the power 1/gamma.
NVTT_API bool loadFromMemory(const void *data, unsigned long long sizeInBytes, int mipmap)
Load a cube map from a DDS file in memory.
NVTT_API bool load(const char *fileName, int mipmap)
Load a cube map from a DDS file.
NVTT_API void range(int channel, float *minimum_ptr, float *maximum_ptr) const
Sets *minimum_ptr and *maximum_ptr to the minimum and maximum values in the given channel.
NVTT_API void operator=(const CubeSurface &img)
Assignment operator.
NVTT_API bool isNull() const
Returns if this CubeSurface is null (i.e. has no underlying data, or all faces have size 0x0).
NVTT_API void toLinear(float gamma)
Raises channels 0...2 to the power gamma.
Inheritable interface for handling errors.
Definition nvtt.h:338
virtual void error(Error e)=0
Called to signal an error.
virtual ~ErrorHandler()
Destructor.
Definition nvtt.h:340
Inheritable interface for outputting data.
Definition nvtt.h:298
virtual ~OutputHandler()
Destructor.
Definition nvtt.h:300
virtual void endImage()=0
Indicate the end of the compressed image. (New in NVTT 2.1)
virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel)=0
Indicate the start of a new compressed image that's part of the final texture.
virtual bool writeData(const void *data, int size)=0
Output data. Compressed data is output as soon as it's generated to minimize memory allocations.
Output Options.
Definition nvtt.h:435
NVTT_API void reset()
Set default options.
NVTT_API void setFileName(const char *fileName)
NVTT_API void setContainer(Container container)
Set container. Defaults to Container_DDS.
NVTT_API void setErrorHandler(ErrorHandler *errorHandler)
Set error handler.
NVTT_API void setFileHandle(void *fp)
Set output file handle.
NVTT_API void setUserVersion(int version)
NVTT_API void setOutputHandler(OutputHandler *outputHandler)
Set output handler.
NVTT_API void setSrgbFlag(bool b)
NVTT_API void setOutputHeader(bool outputHeader)
Set output header. Defaults to true.
A surface is one level of a 2D or 3D texture.
Definition nvtt.h:698
NVTT_API void resize(int w, int h, int d, ResizeFilter filter, float filterWidth, const float *params=0, TimingContext *tc=0)
NVTT_API float * channel(int i)
Returns a pointer that can be used to modify channel i's CPU data. See channel(int) const.
NVTT_API void setAtlasBorder(int w, int h, float r, float g, float b, float a, TimingContext *tc=0)
Draws borders of a given color around each w x h tile contained within the surface,...
NVTT_API void fromYCoCg(TimingContext *tc=0)
Converts from (Co, Cg, scale, Y) colors to (r, g, b, 1) colors.
NVTT_API int height() const
Returns the height (Y size) of the surface.
NVTT_API void operator=(const Surface &img)
Assignment operator.
NVTT_API void blend(float r, float g, float b, float a, float t, TimingContext *tc=0)
Interpolates all texels between their current color and a constant color (r, g, b,...
NVTT_API Surface createToksvigMap(float power, TimingContext *tc=0) const
Unimplemented. This would equivalent to mipmapping a normal map and then measuring how much mipmappin...
NVTT_API bool save(const char *fileName, bool hasAlpha=false, bool hdr=false, TimingContext *tc=0) const
Saves texture data to file.
NVTT_API void toYCoCg(TimingContext *tc=0)
Converts from (r, g, b, -) colors to (Co, Cg, 1, Y) colors.
NVTT_API void toSrgb(TimingContext *tc=0)
Applies the linear-to-sRGB transfer function to channels 0...2.
NVTT_API void setWrapMode(WrapMode mode)
Set the Surface's wrap mode. See WrapMode for details.
NVTT_API Surface createSubImage(int x0, int x1, int y0, int y1, int z0, int z1, TimingContext *tc=0) const
Creates a new surface from the range of pixels from x = x0 to x1, y = y0 to y1, and z = z0 to z1.
NVTT_API void toLM(float range=1.0f, float threshold=0.0f, TimingContext *tc=0)
Stores luminance-only values in a two-channel way. Maybe consider BC4 compression instead.
NVTT_API AlphaMode alphaMode() const
Returns the alpha mode of the surface. See setAlphaMode()
NVTT_API void flipX(TimingContext *tc=0)
Flips the surface along the X axis.
NVTT_API bool setImage3D(Format format, int w, int h, int d, const void *data, TimingContext *tc=0)
Set surface values from an encoded data source.
NVTT_API void toLinearFromXenonSrgb(TimingContext *tc=0)
Converts colors in channels 0...2 from the Xenon sRGB piecewise linear sRGB approximation to linear.
NVTT_API void convolve(int channel, int kernelSize, float *kernelData, TimingContext *tc=0)
Convolves a channel with a kernel.
NVTT_API void flipY(TimingContext *tc=0)
Flips the surface along the Y axis.
NVTT_API void normalizeNormalMap(TimingContext *tc=0)
Renormalizes the elements of a signed normal map, replacing (r, g, b) with normalize(r,...
NVTT_API void histogram(int channel, float rangeMin, float rangeMax, int binCount, int *binPtr, TimingContext *tc=0) const
Stores a histogram of channel values between rangeMin and rangeMax into binPtr[0.....
NVTT_API void setNormalMap(bool isNormalMap)
Set whether the Surface represents a normal map. This can be accessed using isNormalMap(),...
NVTT_API void fromRGBM(float range=1.0f, float threshold=0.25f, TimingContext *tc=0)
Produces HDR (r, g, b, 1) values from an LDR (red, green, blue, magnitude) storage method.
NVTT_API float alphaTestCoverage(float alphaRef=0.5, int alpha_channel=3) const
Returns the approximate fraction (0 to 1) of the image with an alpha value greater than alphaRef.
NVTT_API bool isNull() const
Returns if the surface is null (i.e. refers to nothing, such as if it was just created using Surface(...
NVTT_API void canvasSize(int w, int h, int d, TimingContext *tc=0)
Crops or expands this surface from the (0,0,0) corner, with any new values cleared to 0.
NVTT_API const float * data() const
Returns a const pointer to the surface's CPU data.
NVTT_API void expandNormals(float scale=2.0f, float bias=-1.0f, TimingContext *tc=0)
Expands packed normals in [0, 1] to signed normals in [-1, 1] using (r, g, b, a) |-> (2r-1,...
NVTT_API void toneMap(ToneMapper tm, float *parameters, TimingContext *tc=0)
Applies an HDR-to-LDR tone mapper.
NVTT_API void fromLUVW(float range=1.0f, TimingContext *tc=0)
Converts from toLUVW()'s color space to RGB colors.
NVTT_API const float * channel(int i) const
Returns a const pointer to channel i's CPU data.
NVTT_API bool addChannel(const Surface &img, int srcChannel, int dstChannel, float scale, TimingContext *tc=0)
Add channel srcChannel of img, multiplied by scale, to dstChannel of this surface.
NVTT_API void binarize(int channel, float threshold, bool dither, TimingContext *tc=0)
Sets values in the given channel to either 1 or 0 depending on if they're greater than the threshold,...
NVTT_API bool setImage2D(Format format, int w, int h, const void *data, TimingContext *tc=0)
Set 2D surface values from an encoded data source. Same as setImage3D() with d=1.
NVTT_API void premultiplyAlpha(TimingContext *tc=0)
Converts to premultiplied alpha, replacing (r, g, b, a) with (ar, ag, ab, a).
NVTT_API bool buildNextMipmapSolidColor(const float *const color_components, TimingContext *tc=0)
Replaces this surface with a surface the size of the next mip in a mip chain (half the width and heig...
NVTT_API Surface createCleanMap(TimingContext *tc=0) const
Unimplemented. Currently returns a null surface.
NVTT_API bool copyChannel(const Surface &srcImage, int srcChannel, TimingContext *tc=0)
Copies channel srcChannel from srcImage to srcChannel of this surface.
NVTT_API void ToCPU(TimingContext *tc=0)
Makes succeeding operations work on the CPU buffer.
NVTT_API bool setImage(int w, int h, int d, TimingContext *tc=0)
Sets this surface to a new w x h x d uninitialized image.
NVTT_API void toLinear(float gamma, TimingContext *tc=0)
Raises channels 0...2 to the power gamma.
NVTT_API bool isNormalMap() const
Returns whether the image represents a normal map. See setNormalMap()
NVTT_API ~Surface()
Destructor.
NVTT_API bool setImage(InputFormat format, int w, int h, int d, const void *r, const void *g, const void *b, const void *a, TimingContext *tc=0)
Sets this surface given uncompressed input data, with different pointers for each channel.
NVTT_API void toGamma(float gamma, TimingContext *tc=0)
Raises channels 0...2 to the power 1/gamma.
NVTT_API int depth() const
Returns the depth (Z size) of the surface. 1 for 2D surfaces.
NVTT_API TextureType type() const
Returns the dimensionality of the surface. This is set for instance by setImage().
NVTT_API void resize(int maxExtent, RoundMode mode, ResizeFilter filter, float filterWidth, const float *params=0, TimingContext *tc=0)
Resizes this surface so that its largest side has length maxExtent, subject to a rounding mode,...
NVTT_API void swizzle(int r, int g, int b, int a, TimingContext *tc=0)
Swizzles the channels of the surface.
NVTT_API bool load(const char *fileName, bool *hasAlpha=0, bool expectSigned=false, TimingContext *tc=0)
Loads texture data from a file.
NVTT_API void toLogScale(int channel, float base, TimingContext *tc=0)
Replaces all values with their log with the given base.
NVTT_API void abs(int channel, TimingContext *tc=0)
Replaces all colors by their absolute value.
NVTT_API Surface clone() const
Creates a deep copy of this Surface, with its own internal data. (New in NVTT 3.1)
NVTT_API bool loadFromMemory(const void *data, unsigned long long sizeInBytes, bool *hasAlpha=0, bool expectSigned=false, TimingContext *tc=0)
Variant of load() that reads from memory instead of a file.
NVTT_API void flipZ(TimingContext *tc=0)
Flips the surface along the Z axis.
NVTT_API void toXenonSrgb(TimingContext *tc=0)
Converts colors in channels 0...2 from linear to a piecewise linear sRGB approximation.
NVTT_API void toLinearFromSrgbUnclamped(TimingContext *tc=0)
Applies the sRGB-to-linear transfer function to channels 0...2, but does not clamp output to [0,...
NVTT_API bool copyChannel(const Surface &srcImage, int srcChannel, int dstChannel, TimingContext *tc=0)
Copies channel srcChannel from srcImage to dstChannel of this surface.
NVTT_API void toLinearFromSrgb(TimingContext *tc=0)
Applies the sRGB-to-linear transfer function to channels 0...2.
NVTT_API const float * gpuData() const
Get a CUDA pointer to const image data on the GPU, using the same layout as data()....
NVTT_API int countMipmaps(int min_size) const
Returns the number of mipmaps in a mipmap chain, stopping when canMakeNextMipmap() returns false.
NVTT_API void fromLogScale(int channel, float base, TimingContext *tc=0)
Inverts toLogScale() by replacing all values x with base^x.
NVTT_API void toLinear(int channel, float gamma, TimingContext *tc=0)
Raises the given channel to the power gamma.
NVTT_API void transform(const float w0[4], const float w1[4], const float w2[4], const float w3[4], const float offset[4], TimingContext *tc=0)
Applies a 4x4 affine transformation to the values in channels 0...3.
NVTT_API void demultiplyAlpha(float epsilon=1e-12f, TimingContext *tc=0)
Converts from premultiplied to unpremultiplied alpha, with special handling around zero alpha values.
NVTT_API int countMipmaps() const
Returns the number of mipmaps in a full mipmap chain. Each mip is half the size of the previous,...
NVTT_API void fill(float r, float g, float b, float a, TimingContext *tc=0)
Sets all texels in the surface to a solid color.
NVTT_API Surface()
Creates an empty surface. All data will be null until a setImage() function is called.
NVTT_API void resize(int w, int h, int d, ResizeFilter filter, TimingContext *tc=0)
Resizes this surface to have size w x h x d using a given filter.
NVTT_API void transformNormals(NormalTransform xform, TimingContext *tc=0)
Applies a 3D->2D normal transformation, setting the z (blue) channel to 0.
NVTT_API void toLUVW(float range=1.0f, TimingContext *tc=0)
Converts from RGB colors to a (U, V, W, L) color space, much like RGBM.
NVTT_API bool setImage(InputFormat format, int w, int h, int d, const void *data, bool unsignedToSigned=false, TimingContext *tc=0)
Sets this surface given uncompressed input data.
NVTT_API void toRGBE(int mantissaBits, int exponentBits, TimingContext *tc=0)
Produces a shared-exponent Red, Green, Blue, Exponent encoding of the HDR RGB channels,...
NVTT_API Surface(const Surface &img)
Copy constructor.
NVTT_API int width() const
Returns the width (X size) of the surface.
NVTT_API bool buildNextMipmap(MipmapFilter filter, int min_size=1, TimingContext *tc=0)
Resizes this surface to create the next mip in a mipmap chain.
NVTT_API void toNormalMap(float sm, float medium, float big, float large, TimingContext *tc=0)
Sets the RGB channels to a normal map generated by interpreting the alpha channel as a heightmap,...
NVTT_API void ToGPU(TimingContext *tc=0, bool performCopy=true)
Makes succeeding operations work on the GPU buffer.
NVTT_API void scaleBias(int channel, float scale, float bias, TimingContext *tc=0)
Applies a scale and bias to the given channel. Each value x is replaced by x * scale + bias.
NVTT_API void resize(int maxExtent, RoundMode mode, ResizeFilter filter, TimingContext *tc=0)
Resizes this surface so that its largest side has length maxExtent, subject to a rounding mode.
NVTT_API void fromRGBE(int mantissaBits, int exponentBits, TimingContext *tc=0)
Produces HDR (r, g, b, 1) values from an LDR (red, green, blue, exponent) storage method.
NVTT_API float * data()
Returns a pointer that can be used to modify the surface's CPU data. See data() const.
NVTT_API WrapMode wrapMode() const
Returns the wrap mode of the surface. See setWrapMode()
NVTT_API void reconstructNormals(NormalTransform xform, TimingContext *tc=0)
Reconstructs 3D normals from 2D transformed normals.
NVTT_API void quantize(int channel, int bits, bool exactEndPoints, bool dither, TimingContext *tc=0)
Quantizes this channel to a particular number of bits, with optional dithering.
NVTT_API void setBorder(float r, float g, float b, float a, TimingContext *tc=0)
Sets all texels on the border of the surface to a solid color.
NVTT_API void toGreyScale(float redScale, float greenScale, float blueScale, float alphaScale, TimingContext *tc=0)
Sets channels 0...3 to the result of converting to grayscale, with customizable channel weights.
NVTT_API void clamp(int channel, float low=0.0f, float high=1.0f, TimingContext *tc=0)
Clamps all values in the channel to the range [low, high].
NVTT_API float * gpuDataMutable()
Get a CUDA pointer to non-const image data on the GPU, using the same layout as data()....
NVTT_API void toRGBM(float range=1.0f, float threshold=0.25f, TimingContext *tc=0)
Produces an LDR Red, Green, Blue, Magnitude encoding of the HDR RGB channels.
NVTT_API void setAlphaMode(AlphaMode alphaMode)
Set the Surface's alpha mode. See AlphaMode for details.
NVTT_API float average(int channel, int alpha_channel=-1, float gamma=2.2f) const
Computes the average of a channel, possibly with alpha or with a gamma transfer function.
NVTT_API void packNormals(float scale=0.5f, float bias=0.5f, TimingContext *tc=0)
Packs signed normals in [-1, 1] to an unsigned range [0, 1], using (r, g, b, a) |-> (r/2+1/2,...
NVTT_API bool canMakeNextMipmap(int min_size=1)
Returns whether a the surface would have a next mip in a mip chain with minimum size `min_size.
NVTT_API void toGamma(int channel, float gamma, TimingContext *tc=0)
Raises the given channel to the power 1/gamma.
NVTT_API void resize_make_square(int maxExtent, RoundMode roundMode, ResizeFilter filter, TimingContext *tc=0)
Resizes this surface so that its longest side has length maxExtent and the result is square or cubica...
NVTT_API bool buildNextMipmap(MipmapFilter filter, float filterWidth, const float *params=0, int min_size=1, TimingContext *tc=0)
Version of buildNextMipmap(MipmapFilter, int, TimingContext*) with customizable parameters.
NVTT_API bool copy(const Surface &src, int xsrc, int ysrc, int zsrc, int xsize, int ysize, int zsize, int xdst, int ydst, int zdst, TimingContext *tc=0)
Copies all channels of a rectangle from src to this surface.
NVTT_API void range(int channel, float *rangeMin, float *rangeMax, int alpha_channel=-1, float alpha_ref=0.f, TimingContext *tc=0) const
Sets *rangeMin and *rangeMax to the range of values in the channel, possibly using alpha testing.
NVTT_API void blockScaleCoCg(int bits=5, float threshold=0.0f, TimingContext *tc=0)
Stores per-block YCoCg scaling information for potentially better 4-channel compression of YCoCg data...
NVTT_API void toSrgbUnclamped(TimingContext *tc=0)
Applies the linear-to-sRGB transfer function to channels 0...2, but does not clamp output to [0,...
NVTT_API void scaleAlphaToCoverage(float coverage, float alphaRef=0.5f, int alpha_channel=3, TimingContext *tc=0)
Attempts to scale the alpha channel so that a fraction coverage (between 0 and 1) of the surface has ...
NVTT_API void toCleanNormalMap(TimingContext *tc=0)
Sets the z (blue) channel to x^2 + y^2.
Surface-set struct for convenience of handling multi-level texture files such as DDS,...
Definition nvtt.h:1408
A TimingContext is a way to collect timing data from a number of functions, and report how much time ...
Definition nvtt.h:1722
NVTT_API void PrintRecords()
Prints all records including their levels of nesting.
NVTT_API int GetRecordCount()
Returns the number of timing records stored.
NVTT_API size_t GetRecord(int i, char *outDescription, size_t outDescriptionSize, double &outSeconds)
Returns the description and length in seconds of the ith record.
NVTT_DEPRECATED_API void GetRecord(int i, char *description, double &seconds)
Returns the description and length in seconds of the ith record.
NVTT_API void SetDetailLevel(int detailLevel)
Sets this TimingContext's detail level.
NVTT_API TimingContext(int detailLevel=1)
Creates a TimingContext with the given detailLevel.
NVTT_API ~TimingContext()
Destructor.