1 // Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com> 2 // 3 // Permission is hereby granted, free of charge, to any person 4 // obtaining a copy of this software and associated documentation 5 // files (the "Software"), to deal in the Software without 6 // restriction, including without limitation the rights to use, 7 // copy, modify, merge, publish, distribute, sublicense, and/or sell 8 // copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following 10 // conditions: 11 // 12 // The above copyright notice and this permission notice shall be 13 // included in all copies or substantial portions of the Software. 14 // 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 // OTHER DEALINGS IN THE SOFTWARE. 23 24 #ifndef NV_TT_INPUTOPTIONS_H 25 #define NV_TT_INPUTOPTIONS_H 26 27 #include <nvcore/Ptr.h> 28 #include <nvmath/Vector.h> 29 #include <nvmath/Matrix.h> 30 #include <nvimage/Image.h> 31 #include "nvtt.h" 32 33 namespace nvtt 34 { 35 36 struct InputOptions::Private 37 { PrivatePrivate38 Private() : images(NULL) {} 39 40 WrapMode wrapMode; 41 TextureType textureType; 42 InputFormat inputFormat; 43 AlphaMode alphaMode; 44 45 uint faceCount; 46 uint mipmapCount; 47 uint imageCount; 48 49 struct InputImage; 50 InputImage * images; 51 52 // Gamma conversion. 53 float inputGamma; 54 float outputGamma; 55 56 // Color transform. 57 ColorTransform colorTransform; 58 nv::Matrix linearTransform; 59 60 // Mipmap generation options. 61 bool generateMipmaps; 62 int maxLevel; 63 MipmapFilter mipmapFilter; 64 65 // Kaiser filter parameters. 66 float kaiserWidth; 67 float kaiserAlpha; 68 float kaiserStretch; 69 70 // Normal map options. 71 bool isNormalMap; 72 bool normalizeMipmaps; 73 bool convertToNormalMap; 74 nv::Vector4 heightFactors; 75 nv::Vector4 bumpFrequencyScale; 76 77 // Adjust extents. 78 uint maxExtent; 79 RoundMode roundMode; 80 81 // @@ These are computed in nvtt::compress, so they should be mutable or stored elsewhere... 82 mutable uint targetWidth; 83 mutable uint targetHeight; 84 mutable uint targetDepth; 85 mutable uint targetMipmapCount; 86 87 void computeTargetExtents() const; 88 89 int realMipmapCount() const; 90 91 const nv::Image * image(uint face, uint mipmap) const; 92 const nv::Image * image(uint idx) const; 93 94 }; 95 96 // Internal image structure. 97 struct InputOptions::Private::InputImage 98 { InputImageInputImage99 InputImage() {} 100 101 int mipLevel; 102 int face; 103 104 int width; 105 int height; 106 int depth; 107 108 nv::AutoPtr<nv::Image> data; 109 }; 110 111 } // nvtt namespace 112 113 #endif // NV_TT_INPUTOPTIONS_H 114