├── CMakeLists.txt ├── LICENSE ├── VERSION ├── buildpkg ├── cmake ├── DetermineProcessor.cmake ├── FindCUDA.cmake ├── FindCg.cmake ├── FindDirectX.cmake ├── FindFreeImage.cmake ├── FindGLEW.cmake ├── FindGLUT.cmake ├── FindMaya.cmake ├── FindOpenEXR.cmake └── OptimalOptions.cmake ├── configure ├── data └── bugs │ └── 01 │ └── ZSword.obj ├── extern ├── gnuwin32 │ ├── CMakeLists.txt │ ├── bin │ │ ├── jpeg62.dll │ │ ├── libpng12.dll │ │ ├── libtiff3.dll │ │ └── zlib1.dll │ ├── bin64 │ │ ├── jpeg62.dll │ │ ├── libpng12.dll │ │ ├── libtiff3.dll │ │ └── zlib1.dll │ ├── include │ │ ├── jconfig.h │ │ ├── jerror.h │ │ ├── jmorecfg.h │ │ ├── jpeglib.h │ │ ├── libpng12 │ │ │ ├── png.h │ │ │ └── pngconf.h │ │ ├── png.h │ │ ├── pngconf.h │ │ ├── tiff.h │ │ ├── tiffconf.h │ │ ├── tiffio.h │ │ ├── tiffvers.h │ │ ├── zconf.h │ │ └── zlib.h │ ├── lib │ │ ├── jpeg.lib │ │ ├── libjpeg.dll.a │ │ ├── libpng.dll.a │ │ ├── libpng.lib │ │ ├── libpng12.dll.a │ │ ├── libtiff.dll.a │ │ ├── libtiff.lib │ │ ├── libz.dll.a │ │ └── zlib.lib │ └── lib64 │ │ ├── jpeg.lib │ │ ├── libpng.lib │ │ ├── libtiff.lib │ │ └── zlib.lib └── tclap │ ├── Arg.h │ ├── ArgException.h │ ├── CmdLine.h │ ├── CmdLineInterface.h │ ├── CmdLineOutput.h │ ├── Constraint.h │ ├── DocBookOutput.h │ ├── HelpVisitor.h │ ├── IgnoreRestVisitor.h │ ├── MultiArg.h │ ├── MultiSwitchArg.h │ ├── OptionalUnlabeledTracker.h │ ├── StdOutput.h │ ├── SwitchArg.h │ ├── UnlabeledMultiArg.h │ ├── UnlabeledValueArg.h │ ├── ValueArg.h │ ├── ValuesConstraint.h │ ├── VersionVisitor.h │ ├── Visitor.h │ └── XorHandler.h └── src ├── CMakeLists.txt ├── nvconfig.h.in ├── nvcore ├── Algorithms.h ├── Array2D.cpp ├── Array2D.h ├── BitArray.h ├── CMakeLists.txt ├── Constraints.h ├── Containers.h ├── CpuInfo.cpp ├── CpuInfo.h ├── Debug.cpp ├── Debug.h ├── DefsGnucDarwin.h ├── DefsGnucLinux.h ├── DefsGnucWin32.h ├── DefsVcWin32.h ├── FileSystem.cpp ├── FileSystem.h ├── Library.cpp ├── Library.h ├── Memory.cpp ├── Memory.h ├── Prefetch.h ├── Ptr.h ├── Radix.cpp ├── Radix.h ├── Radix3.cpp ├── Radix3.h ├── RefCounted.cpp ├── RefCounted.h ├── StdStream.h ├── StrLib.cpp ├── StrLib.h ├── Stream.h ├── TextReader.cpp ├── TextReader.h ├── TextWriter.cpp ├── TextWriter.h ├── Timer.h ├── Tokenizer.cpp ├── Tokenizer.h ├── nvcore.h ├── poshlib │ ├── CMakeLists.txt │ ├── posh.c │ └── posh.h └── vsscanf_proxy_win64.masm ├── nvimage ├── BlockDXT.cpp ├── BlockDXT.h ├── CMakeLists.txt ├── ColorBlock.cpp ├── ColorBlock.h ├── ColorSpace.cpp ├── ColorSpace.h ├── ConeMap.cpp ├── ConeMap.h ├── DirectDrawSurface.cpp ├── DirectDrawSurface.h ├── Filter.cpp ├── Filter.h ├── FloatImage.cpp ├── FloatImage.h ├── HoleFilling.cpp ├── HoleFilling.h ├── Image.cpp ├── Image.h ├── ImageIO.cpp ├── ImageIO.h ├── NormalMap.cpp ├── NormalMap.h ├── NormalMipmap.cpp ├── NormalMipmap.h ├── PixelFormat.h ├── PsdFile.h ├── Quantize.cpp ├── Quantize.h ├── TgaFile.h ├── nvimage.h └── openexr │ ├── AUTHORS │ ├── CMakeLists.txt │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── LICENSE │ ├── README │ ├── README.CVS │ ├── README.OSX │ ├── README.cmake │ ├── README.win32 │ ├── doc │ ├── OpenEXRFileLayout.pdf │ ├── ReadingAndWritingImageFiles.pdf │ └── TechnicalIntroduction.pdf │ ├── gnuwin32 │ ├── CMakeLists.txt │ ├── bin │ │ └── zlib1.dll │ ├── include │ │ ├── zconf.h │ │ └── zlib.h │ └── lib │ │ ├── zlib-bcc.lib │ │ ├── zlib.def │ │ └── zlib.lib │ └── src │ ├── CMakeLists.txt │ ├── Half │ ├── CMakeLists.txt │ ├── eLut.cpp │ ├── eLut.h │ ├── half.cpp │ ├── half.h │ ├── halfFunction.h │ ├── halfLimits.h │ ├── toFloat.cpp │ └── toFloat.h │ ├── HalfTest │ ├── main.cpp │ ├── testArithmetic.cpp │ ├── testArithmetic.h │ ├── testBitPatterns.cpp │ ├── testBitPatterns.h │ ├── testClassification.cpp │ ├── testClassification.h │ ├── testError.cpp │ ├── testError.h │ ├── testFunction.cpp │ ├── testFunction.h │ ├── testLimits.cpp │ ├── testLimits.h │ ├── testSize.cpp │ └── testSize.h │ ├── Iex │ ├── CMakeLists.txt │ ├── Iex.h │ ├── IexBaseExc.cpp │ ├── IexBaseExc.h │ ├── IexErrnoExc.h │ ├── IexMacros.h │ ├── IexMathExc.h │ ├── IexThrowErrnoExc.cpp │ └── IexThrowErrnoExc.h │ ├── IexTest │ ├── main.cpp │ ├── testBaseExc.cpp │ └── testBaseExc.h │ ├── IlmBaseConfig.in.h │ ├── IlmImf │ ├── CMakeLists.txt │ ├── ImfArray.h │ ├── ImfAttribute.cpp │ ├── ImfAttribute.h │ ├── ImfAutoArray.h │ ├── ImfB44Compressor.cpp │ ├── ImfB44Compressor.h │ ├── ImfBoxAttribute.cpp │ ├── ImfBoxAttribute.h │ ├── ImfCRgbaFile.cpp │ ├── ImfCRgbaFile.h │ ├── ImfChannelList.cpp │ ├── ImfChannelList.h │ ├── ImfChannelListAttribute.cpp │ ├── ImfChannelListAttribute.h │ ├── ImfChromaticities.cpp │ ├── ImfChromaticities.h │ ├── ImfChromaticitiesAttribute.cpp │ ├── ImfChromaticitiesAttribute.h │ ├── ImfCompression.h │ ├── ImfCompressionAttribute.cpp │ ├── ImfCompressionAttribute.h │ ├── ImfCompressor.cpp │ ├── ImfCompressor.h │ ├── ImfConvert.cpp │ ├── ImfConvert.h │ ├── ImfDoubleAttribute.cpp │ ├── ImfDoubleAttribute.h │ ├── ImfEnvmap.cpp │ ├── ImfEnvmap.h │ ├── ImfEnvmapAttribute.cpp │ ├── ImfEnvmapAttribute.h │ ├── ImfFloatAttribute.cpp │ ├── ImfFloatAttribute.h │ ├── ImfFrameBuffer.cpp │ ├── ImfFrameBuffer.h │ ├── ImfFramesPerSecond.cpp │ ├── ImfFramesPerSecond.h │ ├── ImfHeader.cpp │ ├── ImfHeader.h │ ├── ImfHuf.cpp │ ├── ImfHuf.h │ ├── ImfIO.cpp │ ├── ImfIO.h │ ├── ImfInputFile.cpp │ ├── ImfInputFile.h │ ├── ImfInt64.h │ ├── ImfIntAttribute.cpp │ ├── ImfIntAttribute.h │ ├── ImfKeyCode.cpp │ ├── ImfKeyCode.h │ ├── ImfKeyCodeAttribute.cpp │ ├── ImfKeyCodeAttribute.h │ ├── ImfLineOrder.h │ ├── ImfLineOrderAttribute.cpp │ ├── ImfLineOrderAttribute.h │ ├── ImfLut.cpp │ ├── ImfLut.h │ ├── ImfMatrixAttribute.cpp │ ├── ImfMatrixAttribute.h │ ├── ImfMisc.cpp │ ├── ImfMisc.h │ ├── ImfName.h │ ├── ImfOpaqueAttribute.cpp │ ├── ImfOpaqueAttribute.h │ ├── ImfOutputFile.cpp │ ├── ImfOutputFile.h │ ├── ImfPixelType.h │ ├── ImfPizCompressor.cpp │ ├── ImfPizCompressor.h │ ├── ImfPreviewImage.cpp │ ├── ImfPreviewImage.h │ ├── ImfPreviewImageAttribute.cpp │ ├── ImfPreviewImageAttribute.h │ ├── ImfPxr24Compressor.cpp │ ├── ImfPxr24Compressor.h │ ├── ImfRational.cpp │ ├── ImfRational.h │ ├── ImfRationalAttribute.cpp │ ├── ImfRationalAttribute.h │ ├── ImfRgba.h │ ├── ImfRgbaFile.cpp │ ├── ImfRgbaFile.h │ ├── ImfRgbaYca.cpp │ ├── ImfRgbaYca.h │ ├── ImfRleCompressor.cpp │ ├── ImfRleCompressor.h │ ├── ImfScanLineInputFile.cpp │ ├── ImfScanLineInputFile.h │ ├── ImfStandardAttributes.cpp │ ├── ImfStandardAttributes.h │ ├── ImfStdIO.cpp │ ├── ImfStdIO.h │ ├── ImfStringAttribute.cpp │ ├── ImfStringAttribute.h │ ├── ImfTestFile.cpp │ ├── ImfTestFile.h │ ├── ImfThreading.cpp │ ├── ImfThreading.h │ ├── ImfTileDescription.h │ ├── ImfTileDescriptionAttribute.cpp │ ├── ImfTileDescriptionAttribute.h │ ├── ImfTileOffsets.cpp │ ├── ImfTileOffsets.h │ ├── ImfTiledInputFile.cpp │ ├── ImfTiledInputFile.h │ ├── ImfTiledMisc.cpp │ ├── ImfTiledMisc.h │ ├── ImfTiledOutputFile.cpp │ ├── ImfTiledOutputFile.h │ ├── ImfTiledRgbaFile.cpp │ ├── ImfTiledRgbaFile.h │ ├── ImfTimeCode.cpp │ ├── ImfTimeCode.h │ ├── ImfTimeCodeAttribute.cpp │ ├── ImfTimeCodeAttribute.h │ ├── ImfVecAttribute.cpp │ ├── ImfVecAttribute.h │ ├── ImfVersion.cpp │ ├── ImfVersion.h │ ├── ImfWav.cpp │ ├── ImfWav.h │ ├── ImfXdr.h │ ├── ImfZipCompressor.cpp │ ├── ImfZipCompressor.h │ ├── b44ExpLogTable.cpp │ └── b44ExpLogTable.h │ ├── IlmThread │ ├── CMakeLists.txt │ ├── IlmThread.cpp │ ├── IlmThread.h │ ├── IlmThreadMutex.cpp │ ├── IlmThreadMutex.h │ ├── IlmThreadMutexPosix.cpp │ ├── IlmThreadMutexWin32.cpp │ ├── IlmThreadPool.cpp │ ├── IlmThreadPool.h │ ├── IlmThreadPosix.cpp │ ├── IlmThreadSemaphore.cpp │ ├── IlmThreadSemaphore.h │ ├── IlmThreadSemaphorePosix.cpp │ ├── IlmThreadSemaphorePosixCompat.cpp │ ├── IlmThreadSemaphoreWin32.cpp │ └── IlmThreadWin32.cpp │ ├── Imath │ ├── CMakeLists.txt │ ├── ImathBox.cpp │ ├── ImathBox.h │ ├── ImathBoxAlgo.h │ ├── ImathColor.h │ ├── ImathColorAlgo.cpp │ ├── ImathColorAlgo.h │ ├── ImathEuler.h │ ├── ImathExc.h │ ├── ImathFrame.h │ ├── ImathFrustum.h │ ├── ImathFun.cpp │ ├── ImathFun.h │ ├── ImathGL.h │ ├── ImathGLU.h │ ├── ImathHalfLimits.h │ ├── ImathInt64.h │ ├── ImathInterval.h │ ├── ImathLimits.h │ ├── ImathLine.h │ ├── ImathLineAlgo.h │ ├── ImathMath.h │ ├── ImathMatrix.h │ ├── ImathMatrixAlgo.cpp │ ├── ImathMatrixAlgo.h │ ├── ImathPlane.h │ ├── ImathPlatform.h │ ├── ImathQuat.h │ ├── ImathRandom.cpp │ ├── ImathRandom.h │ ├── ImathRoots.h │ ├── ImathShear.cpp │ ├── ImathShear.h │ ├── ImathSphere.h │ ├── ImathVec.cpp │ ├── ImathVec.h │ └── ImathVecAlgo.h │ ├── ImathTest │ ├── main.cpp │ ├── testBoxAlgo.cpp │ ├── testBoxAlgo.h │ ├── testColor.cpp │ ├── testColor.h │ ├── testExtractEuler.cpp │ ├── testExtractEuler.h │ ├── testExtractSHRT.cpp │ ├── testExtractSHRT.h │ ├── testFrustum.cpp │ ├── testFrustum.h │ ├── testFun.cpp │ ├── testFun.h │ ├── testInvert.cpp │ ├── testInvert.h │ ├── testLineAlgo.cpp │ ├── testLineAlgo.h │ ├── testMatrix.cpp │ ├── testMatrix.h │ ├── testQuatSetRotation.cpp │ ├── testQuatSetRotation.h │ ├── testQuatSlerp.cpp │ ├── testQuatSlerp.h │ ├── testRandom.cpp │ ├── testRandom.h │ ├── testRoots.cpp │ ├── testRoots.h │ ├── testShear.cpp │ └── testShear.h │ └── OpenEXRConfig.in.h ├── nvmath ├── Basis.cpp ├── Basis.h ├── Bezier.cpp ├── Bezier.h ├── Box.h ├── CMakeLists.txt ├── Color.h ├── Fitting.cpp ├── Fitting.h ├── Frustum.cpp ├── Frustum.h ├── Half.cpp ├── Half.h ├── KahanSum.h ├── Matrix.h ├── Montecarlo.cpp ├── Montecarlo.h ├── Plane.cpp ├── Plane.h ├── Polygon.cpp ├── Polygon.h ├── Quaternion.h ├── Random.cpp ├── Random.h ├── Solver.cpp ├── Solver.h ├── Sparse.cpp ├── Sparse.h ├── SphericalHarmonic.cpp ├── SphericalHarmonic.h ├── TriBox.cpp ├── Triangle.cpp ├── Triangle.h ├── TypeSerialization.cpp ├── TypeSerialization.h ├── Vector.h ├── lsqr │ ├── lsqr.cpp │ └── lsqr.h └── nvmath.h └── nvmesh ├── BaseMesh.cpp ├── BaseMesh.h ├── CMakeLists.txt ├── MeshAdjacency.cpp ├── MeshAdjacency.h ├── MeshBuilder.cpp ├── MeshBuilder.h ├── MeshSmoothGroup.h ├── MeshTopology.cpp ├── MeshTopology.h ├── PolyMesh.cpp ├── PolyMesh.h ├── QuadTriMesh.cpp ├── QuadTriMesh.h ├── TriMesh.cpp ├── TriMesh.h ├── VertexData.cpp ├── VertexData.h ├── animation ├── Animation.cpp ├── Animation.h ├── Bone.h ├── CudaSkinning.cpp ├── CudaSkinning.h ├── MeshSkeleton.cpp ├── MeshSkeleton.h ├── MorphTarget.cpp └── MorphTarget.h ├── export ├── MeshExportOBJ.cpp └── MeshExportOBJ.h ├── geometry ├── Bounds.cpp ├── Bounds.h ├── CMakeLists.txt ├── MeshNormals.cpp ├── MeshNormals.h ├── MeshTransform.cpp ├── MeshTransform.h ├── TangentSpace.cpp └── TangentSpace.h ├── halfedge ├── HalfEdge.cpp ├── HalfEdge.h ├── HalfEdgeFace.cpp ├── HalfEdgeFace.h ├── HalfEdgeMesh.cpp ├── HalfEdgeMesh.h └── HalfEdgeVertex.h ├── import ├── ColladaFile.h ├── MD5File.h ├── MeshImport.cpp ├── MeshImport.h ├── MeshImportHeightMap.cpp ├── MeshImportHeightMap.h ├── MeshImportM.cpp ├── MeshImportM.h ├── MeshImportMD5.cpp ├── MeshImportMD5.h ├── MeshImportOBJ.cpp ├── MeshImportOBJ.h ├── MeshImportOFF.cpp ├── MeshImportOFF.h ├── MeshImportPLY.cpp ├── MeshImportPLY.h ├── MeshImportPSK.cpp ├── MeshImportPSK.h ├── MeshImportT3D.h ├── UnrealFile.cpp ├── UnrealFile.h └── XFile.h ├── kdtree ├── KDTree.cpp ├── KDTree.h ├── KDTreeBuilder.cpp ├── KDTreeBuilder.h ├── MeshKDTree.cpp └── MeshKDTree.h ├── mender ├── NVMeshMender.cpp └── NVMeshMender.h ├── nvmesh.h ├── param ├── Atlas.cpp ├── Atlas.h ├── LeastSquaresConformalMap.cpp ├── LeastSquaresConformalMap.h ├── NaturalParametrization.cpp ├── ParameterizationQuality.cpp ├── ParameterizationQuality.h ├── Parametrization.cpp ├── Seams.cpp ├── Seams.h ├── SingleFaceMap.cpp └── SingleFaceMap.h ├── qms ├── QuadSimplificationMesh.cpp └── QuadSimplificationMesh.h ├── raster ├── ClippedTriangle.cpp ├── ClippedTriangle.h ├── Raster.cpp └── Raster.h ├── raytracing ├── FaceBuffer.cpp ├── FaceBuffer.h ├── Grid.cpp ├── Grid.h └── Raytracing.h ├── render ├── MeshOptimizer.cpp ├── MeshOptimizer.h ├── NvTriStrip.cpp ├── NvTriStrip.h ├── NvTriStripObjects.cpp ├── NvTriStripObjects.h ├── NvTriStripVertexCache.cpp ├── NvTriStripVertexCache.h ├── VertexCache.cpp └── VertexCache.h ├── subdiv ├── AccMesh.cpp ├── AccMesh.h ├── AccMeshBuilder.cpp ├── AccMeshBuilder.h ├── AccPatch.cpp ├── AccPatch.h ├── Boundary.h ├── CubicGregoryMesh.cpp ├── CubicGregoryMesh.h ├── LimitSurface.cpp ├── LimitSurface.h ├── LoopGregoryApproximation.cpp ├── LoopGregoryApproximation.h ├── RemapFaces.cpp ├── RemapFaces.h ├── StencilMask.cpp ├── StencilMask.h ├── Subdivide.cpp └── Subdivide.h ├── test ├── BoundaryTan.cpp ├── CMakeLists.txt ├── LimitMask.cpp ├── LimitTangent.cpp ├── MeshTest.cpp └── RayTest.cpp ├── tools ├── CMakeLists.txt ├── analyzer │ ├── CMakeLists.txt │ └── MeshAnalyzer.cpp ├── baker │ ├── AccBaseSurface.cpp │ ├── AccBaseSurface.h │ ├── Baker.cpp │ ├── BaseMeshPass.cpp │ ├── BaseMeshPass.h │ ├── BaseSurface.h │ ├── CMakeLists.txt │ ├── CmdOptions.h │ ├── DetailedMeshPass.cpp │ ├── DetailedMeshPass.h │ ├── GeometryImage.h │ ├── Samplers.cpp │ ├── Samplers.h │ ├── TiledTask.cpp │ ├── TiledTask.h │ ├── TriBaseSurface.cpp │ └── TriBaseSurface.h ├── batcher │ ├── CMakeLists.txt │ └── MeshBatcher.cpp ├── bzrexport │ ├── BzrExport.cpp │ └── CMakeLists.txt ├── gridgen │ ├── CMakeLists.txt │ └── GridGen.cpp └── maya │ ├── CMakeLists.txt │ ├── MayaAnalyzer.cpp │ ├── MayaCommandLineExporter.cpp │ ├── MayaExportPlugin.cpp │ ├── MayaExporter.cpp │ ├── MayaExporter.h │ ├── MayaMeshBuilder.cpp │ ├── MayaMeshBuilder.h │ ├── MayaUtils.cpp │ ├── MayaUtils.h │ └── NvMayaExportScript.mel └── weld ├── Snap.cpp ├── Snap.h ├── VertexWeld.cpp ├── VertexWeld.h └── Weld.h /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) 2 | PROJECT(NV) 3 | 4 | SET(NV_CMAKE_DIR "${NV_SOURCE_DIR}/cmake") 5 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${NV_CMAKE_DIR}") 6 | 7 | IF(WIN32) 8 | # gnuwin32 paths: 9 | SET(GNUWIN32_PATH "${NV_SOURCE_DIR}/extern/gnuwin32") 10 | SET(CMAKE_INCLUDE_PATH "${GNUWIN32_PATH}/include") 11 | IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 12 | SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${GNUWIN32_PATH}/lib64") 13 | ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 14 | SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${GNUWIN32_PATH}/lib") 15 | ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 16 | 17 | # Set GLUT path: 18 | SET(GLUT_ROOT_PATH "${NV_SOURCE_DIR}/extern/glut") 19 | 20 | # Set GLEW path: 21 | SET(GLEW_ROOT_PATH "${NV_SOURCE_DIR}/src/nvgl/glew") 22 | 23 | IF(MSVC80) 24 | # SET(OPENEXR_PATH "${NV_SOURCE_DIR}/openexr/vs2005") 25 | ENDIF(MSVC80) 26 | 27 | IF(OPENEXR_PATH) 28 | SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${OPENEXR_PATH}/include") 29 | SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${OPENEXR_PATH}/lib") 30 | ENDIF(OPENEXR_PATH) 31 | 32 | ADD_SUBDIRECTORY(${GNUWIN32_PATH}) 33 | 34 | ENDIF(WIN32) 35 | 36 | INCLUDE(${NV_CMAKE_DIR}/OptimalOptions.cmake) 37 | MESSAGE(STATUS "Setting optimal options") 38 | MESSAGE(STATUS " Processor: ${NV_SYSTEM_PROCESSOR}") 39 | MESSAGE(STATUS " Compiler Flags: ${CMAKE_CXX_FLAGS}") 40 | 41 | 42 | ADD_SUBDIRECTORY(src) 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | NVIDIA Texture Tools is licensed under the MIT license. 2 | 3 | Copyright (c) 2009-2017 Ignacio Castaño 4 | Copyright (c) 2007-2009 NVIDIA Corporation 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the "Software"), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.1.2-20080715 -------------------------------------------------------------------------------- /buildpkg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | tar zcvf nvidia-mesh-tools-`cat VERSION`.tar.gz \ 4 | --exclude '.*' --exclude debian --exclude '*~' --exclude buildpkg \ 5 | --exclude 'build-*' --exclude tags --exclude Makefile \ 6 | --exclude vc7 --exclude vc8 --exclude project \ 7 | --exclude 'nvidia-mesh-tools-*.tar.gz' \ 8 | --transform 's,^,nvidia-mesh-tools/,' * 9 | -------------------------------------------------------------------------------- /cmake/DetermineProcessor.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Assume i586 by default. 3 | SET(NV_SYSTEM_PROCESSOR "i586") 4 | 5 | IF(UNIX) 6 | FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) 7 | IF(CMAKE_UNAME) 8 | EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val) 9 | 10 | IF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown") 11 | EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val) 12 | ENDIF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown") 13 | 14 | # processor may have double quote in the name, and that needs to be removed 15 | STRING(REGEX REPLACE "\"" "" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}") 16 | STRING(REGEX REPLACE "/" "_" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}") 17 | ENDIF(CMAKE_UNAME) 18 | 19 | # Get extended processor information with: 20 | # `cat /proc/cpuinfo` 21 | 22 | ELSE(UNIX) 23 | IF(WIN32) 24 | # It's not OK to trust $ENV{PROCESSOR_ARCHITECTURE}: its value depends on the type of executable being run, 25 | # so a 32-bit cmake (the default binary distribution) will always say "x86" regardless of the actual target. 26 | IF (CMAKE_SIZEOF_VOID_P EQUAL 8) 27 | SET (NV_SYSTEM_PROCESSOR "AMD64") 28 | ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) 29 | SET (NV_SYSTEM_PROCESSOR "x86") 30 | ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) 31 | ENDIF(WIN32) 32 | ENDIF(UNIX) 33 | 34 | 35 | -------------------------------------------------------------------------------- /cmake/FindDirectX.cmake: -------------------------------------------------------------------------------- 1 | 2 | IF (WIN32) 3 | 4 | FIND_PATH(DX9_INCLUDE_PATH d3d9.h 5 | PATHS 6 | "$ENV{DXSDK_DIR}/Include" 7 | "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include" 8 | DOC "The directory where D3D9.h resides") 9 | 10 | FIND_PATH(DX10_INCLUDE_PATH D3D10.h 11 | PATHS 12 | "$ENV{DXSDK_DIR}/Include" 13 | "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include" 14 | DOC "The directory where D3D10.h resides") 15 | 16 | FIND_LIBRARY(D3D10_LIBRARY d3d10.lib 17 | PATHS 18 | "$ENV{DXSDK_DIR}/Lib/x86" 19 | "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86" 20 | DOC "The directory where d3d10.lib resides") 21 | 22 | FIND_LIBRARY(D3DX10_LIBRARY d3dx10.lib 23 | PATHS 24 | "$ENV{DXSDK_DIR}/Lib/x86" 25 | "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86" 26 | DOC "The directory where d3dx10.lib resides") 27 | 28 | SET(DX10_LIBRARIES ${D3D10_LIBRARY} ${D3DX10_LIBRARY}) 29 | 30 | ENDIF (WIN32) 31 | 32 | IF (DX10_INCLUDE_PATH) 33 | SET( DX10_FOUND 1 CACHE STRING "Set to 1 if CG is found, 0 otherwise") 34 | ELSE (DX10_INCLUDE_PATH) 35 | SET( DX10_FOUND 0 CACHE STRING "Set to 1 if CG is found, 0 otherwise") 36 | ENDIF (DX10_INCLUDE_PATH) 37 | 38 | MARK_AS_ADVANCED( DX10_FOUND ) 39 | -------------------------------------------------------------------------------- /cmake/FindFreeImage.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find the FreeImage library and include path. 3 | # Once done this will define 4 | # 5 | # FREEIMAGE_FOUND 6 | # FREEIMAGE_INCLUDE_PATH 7 | # FREEIMAGE_LIBRARY 8 | # 9 | 10 | IF (WIN32) 11 | FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h 12 | ${PROJECT_SOURCE_DIR}/extern/FreeImage 13 | DOC "The directory where FreeImage.h resides") 14 | FIND_LIBRARY( FREEIMAGE_LIBRARY 15 | NAMES FreeImage freeimage 16 | PATHS 17 | ${PROJECT_SOURCE_DIR}/FreeImage 18 | DOC "The FreeImage library") 19 | ELSE (WIN32) 20 | FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h 21 | /usr/include 22 | /usr/local/include 23 | /sw/include 24 | /opt/local/include 25 | DOC "The directory where FreeImage.h resides") 26 | FIND_LIBRARY( FREEIMAGE_LIBRARY 27 | NAMES FreeImage freeimage 28 | PATHS 29 | /usr/lib64 30 | /usr/lib 31 | /usr/local/lib64 32 | /usr/local/lib 33 | /sw/lib 34 | /opt/local/lib 35 | DOC "The FreeImage library") 36 | ENDIF (WIN32) 37 | 38 | SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY}) 39 | 40 | IF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) 41 | SET( FREEIMAGE_FOUND TRUE CACHE BOOL "Set to TRUE if GLEW is found, FALSE otherwise") 42 | ELSE (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) 43 | SET( FREEIMAGE_FOUND FALSE CACHE BOOL "Set to TRUE if GLEW is found, FALSE otherwise") 44 | ENDIF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) 45 | 46 | MARK_AS_ADVANCED( 47 | FREEIMAGE_FOUND 48 | FREEIMAGE_LIBRARY 49 | FREEIMAGE_LIBRARIES 50 | FREEIMAGE_INCLUDE_PATH) 51 | 52 | -------------------------------------------------------------------------------- /cmake/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLEW library and include path. 3 | # Once done this will define 4 | # 5 | # GLEW_FOUND 6 | # GLEW_INCLUDE_PATH 7 | # GLEW_LIBRARY 8 | # 9 | 10 | IF (WIN32) 11 | FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h 12 | $ENV{PROGRAMFILES}/GLEW/include 13 | ${GLEW_ROOT_PATH}/include 14 | DOC "The directory where GL/glew.h resides") 15 | 16 | IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 17 | FIND_LIBRARY( GLEW_LIBRARY 18 | NAMES glew64 glew64s 19 | PATHS 20 | $ENV{PROGRAMFILES}/GLEW/lib 21 | ${GLEW_ROOT_PATH}/lib 22 | DOC "The GLEW library (64-bit)" 23 | ) 24 | ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 25 | FIND_LIBRARY( GLEW_LIBRARY 26 | NAMES glew GLEW glew32 glew32s 27 | PATHS 28 | $ENV{PROGRAMFILES}/GLEW/lib 29 | ${GLEW_ROOT_PATH}/lib 30 | DOC "The GLEW library" 31 | ) 32 | ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 33 | ELSE (WIN32) 34 | FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h 35 | /usr/include 36 | /usr/local/include 37 | /sw/include 38 | /opt/local/include 39 | ${GLEW_ROOT_PATH}/include 40 | DOC "The directory where GL/glew.h resides") 41 | 42 | FIND_LIBRARY( GLEW_LIBRARY 43 | NAMES GLEW glew 44 | PATHS 45 | /usr/lib64 46 | /usr/lib 47 | /usr/local/lib64 48 | /usr/local/lib 49 | /sw/lib 50 | /opt/local/lib 51 | ${GLEW_ROOT_PATH}/include 52 | DOC "The GLEW library") 53 | ENDIF (WIN32) 54 | 55 | SET(GLEW_FOUND "NO") 56 | IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY) 57 | SET(GLEW_LIBRARIES ${GLEW_LIBRARY}) 58 | SET(GLEW_FOUND "YES") 59 | ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY) 60 | 61 | -------------------------------------------------------------------------------- /cmake/FindMaya.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IF (WIN32) 5 | 6 | # Maya plugins can only be compiled with msvc 7 | IF (MSVC) 8 | 9 | FIND_PATH(MAYA_INCLUDE_PATH maya/MTypes.h 10 | PATHS 11 | "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/include" 12 | "$ENV{MAYA_LOCATION}/include" 13 | DOC "The directory where MTypes.h resides") 14 | 15 | # Find maya version! 16 | 17 | FIND_LIBRARY(MAYA_FOUNDATION_LIBRARY Foundation 18 | PATHS 19 | "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib" 20 | "$ENV{MAYA_LOCATION}/lib" 21 | DOC "The directory where Foundation.lib resides") 22 | 23 | FIND_LIBRARY(MAYA_OPENMAYA_LIBRARY OpenMaya 24 | PATHS 25 | "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib" 26 | "$ENV{MAYA_LOCATION}/lib" 27 | DOC "The directory where OpenMaya.lib resides") 28 | 29 | FIND_LIBRARY(MAYA_OPENMAYAANIM_LIBRARY OpenMayaAnim 30 | PATHS 31 | "$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib" 32 | "$ENV{MAYA_LOCATION}/lib" 33 | DOC "The directory where OpenMayaAnim.lib resides") 34 | 35 | SET(MAYA_LIBRARIES 36 | ${MAYA_FOUNDATION_LIBRARY} 37 | ${MAYA_OPENMAYA_LIBRARY} 38 | ${MAYA_OPENMAYAANIM_LIBRARY}) 39 | 40 | SET(MAYA_EXTENSION ".mll") 41 | 42 | ENDIF (MSVC) 43 | ELSE (WIN32) 44 | 45 | # On linux, check gcc version. 46 | 47 | # OSX and Linux 48 | 49 | FIND_PATH(MAYA_INCLUDE_PATH maya/MTypes.h 50 | PATHS 51 | /usr/autodesk/maya/include 52 | $ENV{MAYA_LOCATION}/include 53 | DOC "The directory where MTypes.h resides") 54 | 55 | # TODO 56 | 57 | ENDIF (WIN32) 58 | 59 | 60 | 61 | IF (MAYA_INCLUDE_PATH) 62 | SET( MAYA_FOUND 1 CACHE STRING "Set to 1 if Maya is found, 0 otherwise") 63 | ELSE (MAYA_INCLUDE_PATH) 64 | SET( MAYA_FOUND 0 CACHE STRING "Set to 1 if Maya is found, 0 otherwise") 65 | ENDIF (MAYA_INCLUDE_PATH) 66 | 67 | MARK_AS_ADVANCED( MAYA_FOUND ) 68 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | BOLD="\033[1m" 4 | RED="\033[91m" 5 | GREEN="\033[92m" 6 | YELLOW="\033[93m" 7 | CYAN="\033[96m" 8 | NORMAL="\033[0m" 9 | 10 | # Make sure cmake is available. 11 | if command -v cmake >/dev/null 2>&1; 12 | then 13 | CMAKE=cmake 14 | else 15 | echo "Error - cmake is not available!" 16 | exit 2 17 | fi 18 | 19 | 20 | help=false 21 | build="Debug" # release 22 | prefix=/usr/local 23 | 24 | # Parse the args 25 | for i in "$@" 26 | do 27 | case $i in 28 | --help ) help=true ;; 29 | --debug ) build="Debug" ;; 30 | --release ) build="Release" ;; 31 | --prefix=* ) prefix="${i#--prefix=}" ;; 32 | --prefix=* ) prefix="${i#--prefix=}" ;; 33 | * ) echo "Unrecognised argument $i" ;; 34 | esac 35 | done 36 | 37 | if [ "$help" = "true" ] 38 | then 39 | echo "---------------------------------------" 40 | echo "nv "`cat VERSION`" configuration script" 41 | echo "---------------------------------------" 42 | echo 43 | echo "--help Show this message." 44 | echo "--debug Configure debug build." 45 | echo "--release Configure release build." 46 | echo "--prefix=path Installation prefix." 47 | echo "--include=path Include path." 48 | echo "--lib=path Library path." 49 | exit 0 50 | fi 51 | 52 | echo "-- Configuring nv "`cat VERSION` 53 | 54 | mkdir -p ./build-$build 55 | cd ./build-$build 56 | $CMAKE .. -DCMAKE_BUILD_TYPE=$build -DCMAKE_INSTALL_PREFIX=$prefix -G "Unix Makefiles" || exit 1 57 | cd .. 58 | 59 | echo "" 60 | echo -e "Your configure completed "$GREEN"successfully"$NORMAL", now type "$BOLD"make"$NORMAL 61 | echo "" 62 | 63 | cat > Makefile << EOF 64 | all: 65 | @make --no-print-directory -C build-$build/ 66 | install: 67 | @make install --no-print-directory -C build-$build/ 68 | clean: 69 | @make clean --no-print-directory -C build-$build/ 70 | distclean: 71 | @rm -Rf build-$build/ 72 | EOF 73 | -------------------------------------------------------------------------------- /extern/gnuwin32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This executes only in Windows 2 | IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 3 | SET(GNUWIN32_BIN_PREFIX "bin64") 4 | ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 5 | SET(GNUWIN32_BIN_PREFIX "bin") 6 | ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") 7 | 8 | INSTALL(PROGRAMS 9 | ${GNUWIN32_BIN_PREFIX}/jpeg62.dll 10 | ${GNUWIN32_BIN_PREFIX}/libpng12.dll 11 | ${GNUWIN32_BIN_PREFIX}/libtiff3.dll 12 | ${GNUWIN32_BIN_PREFIX}/zlib1.dll 13 | DESTINATION bin) 14 | -------------------------------------------------------------------------------- /extern/gnuwin32/bin/jpeg62.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin/jpeg62.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin/libpng12.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin/libpng12.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin/libtiff3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin/libtiff3.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin/zlib1.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin64/jpeg62.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin64/jpeg62.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin64/libpng12.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin64/libpng12.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin64/libtiff3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin64/libtiff3.dll -------------------------------------------------------------------------------- /extern/gnuwin32/bin64/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/bin64/zlib1.dll -------------------------------------------------------------------------------- /extern/gnuwin32/include/jconfig.h: -------------------------------------------------------------------------------- 1 | /* jconfig.h. Generated automatically by configure. */ 2 | /* jconfig.cfg --- source file edited by configure script */ 3 | /* see jconfig.doc for explanations */ 4 | 5 | #define HAVE_PROTOTYPES 6 | #define HAVE_UNSIGNED_CHAR 7 | #define HAVE_UNSIGNED_SHORT 8 | 9 | #ifdef _WIN32 10 | # include 11 | /* Define "boolean" as unsigned char, not int, per Windows custom */ 12 | # if !defined __RPCNDR_H__ || defined __MINGW32__ /* don't conflict if rpcndr.h already read */ 13 | # ifndef boolean /* don't conflict if rpcndr.h already read */ 14 | typedef unsigned char boolean; 15 | # endif /* boolean */ 16 | # endif /* __RPCNDR_H__ */ 17 | # define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 18 | # define USE_WINDOWS_MESSAGEBOX 1 19 | #endif /* _WIN32 */ 20 | 21 | #undef void 22 | #undef const 23 | #undef CHAR_IS_UNSIGNED 24 | #define HAVE_STDDEF_H 25 | #define HAVE_STDLIB_H 26 | #undef NEED_BSD_STRINGS 27 | #undef NEED_SYS_TYPES_H 28 | #undef NEED_FAR_POINTERS 29 | #undef NEED_SHORT_EXTERNAL_NAMES 30 | /* Define this if you get warnings about undefined structures. */ 31 | #undef INCOMPLETE_TYPES_BROKEN 32 | 33 | #ifdef JPEG_INTERNALS 34 | 35 | #undef RIGHT_SHIFT_IS_UNSIGNED 36 | #define INLINE __inline__ 37 | /* These are for configuring the JPEG memory manager. */ 38 | #undef DEFAULT_MAX_MEM 39 | #undef NO_MKTEMP 40 | 41 | #endif /* JPEG_INTERNALS */ 42 | 43 | #ifdef JPEG_CJPEG_DJPEG 44 | 45 | #define BMP_SUPPORTED /* BMP image file format */ 46 | #define GIF_SUPPORTED /* GIF image file format */ 47 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 48 | #define RLE_SUPPORTED /* Utah RLE image file format */ 49 | #define TARGA_SUPPORTED /* Targa image file format */ 50 | 51 | #undef TWO_FILE_COMMANDLINE 52 | #undef NEED_SIGNAL_CATCHER 53 | #undef DONT_USE_B_MODE 54 | 55 | /* Define this if you want percent-done progress reports from cjpeg/djpeg. */ 56 | #undef PROGRESS_REPORT 57 | 58 | #endif /* JPEG_CJPEG_DJPEG */ 59 | -------------------------------------------------------------------------------- /extern/gnuwin32/include/tiffvers.h: -------------------------------------------------------------------------------- 1 | #define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." 2 | /* 3 | * This define can be used in code that requires 4 | * compilation-related definitions specific to a 5 | * version or versions of the library. Runtime 6 | * version checking should be done based on the 7 | * string returned by TIFFGetVersion. 8 | */ 9 | #define TIFFLIB_VERSION 20060323 10 | -------------------------------------------------------------------------------- /extern/gnuwin32/lib/jpeg.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/jpeg.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libjpeg.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libjpeg.dll.a -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libpng.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libpng.dll.a -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libpng.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libpng.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libpng12.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libpng12.dll.a -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libtiff.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libtiff.dll.a -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libtiff.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libtiff.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib/libz.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/libz.dll.a -------------------------------------------------------------------------------- /extern/gnuwin32/lib/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib/zlib.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib64/jpeg.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib64/jpeg.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib64/libpng.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib64/libpng.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib64/libtiff.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib64/libtiff.lib -------------------------------------------------------------------------------- /extern/gnuwin32/lib64/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/extern/gnuwin32/lib64/zlib.lib -------------------------------------------------------------------------------- /extern/tclap/Constraint.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Constraint.h 5 | * 6 | * Copyright (c) 2005, Michael E. Smoot 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_CONSTRAINT_H 23 | #define TCLAP_CONSTRAINT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * The interface that defines the interaction between the Arg and Constraint. 36 | */ 37 | template 38 | class Constraint 39 | { 40 | 41 | public: 42 | /** 43 | * Returns a description of the Constraint. 44 | */ 45 | virtual std::string description() const =0; 46 | 47 | /** 48 | * Returns the short ID for the Constraint. 49 | */ 50 | virtual std::string shortID() const =0; 51 | 52 | /** 53 | * The method used to verify that the value parsed from the command 54 | * line meets the constraint. 55 | * \param value - The value that will be checked. 56 | */ 57 | virtual bool check(const T& value) const =0; 58 | 59 | /** 60 | * Destructor. 61 | * Silences warnings about Constraint being a base class with virtual 62 | * functions but without a virtual destructor. 63 | */ 64 | virtual ~Constraint() { ; } 65 | }; 66 | 67 | } //namespace TCLAP 68 | #endif 69 | -------------------------------------------------------------------------------- /extern/tclap/HelpVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: HelpVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_HELP_VISITOR_H 23 | #define TCLAP_HELP_VISITOR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Visitor object that calls the usage method of the given CmdLineOutput 33 | * object for the specified CmdLine object. 34 | */ 35 | class HelpVisitor: public Visitor 36 | { 37 | protected: 38 | 39 | /** 40 | * The CmdLine the output will be generated for. 41 | */ 42 | CmdLineInterface* _cmd; 43 | 44 | /** 45 | * The output object. 46 | */ 47 | CmdLineOutput** _out; 48 | 49 | public: 50 | 51 | /** 52 | * Constructor. 53 | * \param cmd - The CmdLine the output will be generated for. 54 | * \param out - The type of output. 55 | */ 56 | HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) 57 | : Visitor(), _cmd( cmd ), _out( out ) { } 58 | 59 | /** 60 | * Calls the usage method of the CmdLineOutput for the 61 | * specified CmdLine. 62 | */ 63 | void visit() { (*_out)->usage(*_cmd); exit(0); } 64 | 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /extern/tclap/IgnoreRestVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: IgnoreRestVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_IGNORE_REST_VISITOR_H 24 | #define TCLAP_IGNORE_REST_VISITOR_H 25 | 26 | #include 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Vistor that tells the CmdLine to begin ignoring arguments after 33 | * this one is parsed. 34 | */ 35 | class IgnoreRestVisitor: public Visitor 36 | { 37 | public: 38 | 39 | /** 40 | * Constructor. 41 | */ 42 | IgnoreRestVisitor() : Visitor() {} 43 | 44 | /** 45 | * Sets Arg::_ignoreRest. 46 | */ 47 | void visit() { Arg::beginIgnoring(); } 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /extern/tclap/OptionalUnlabeledTracker.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: OptionalUnlabeledTracker.h 6 | * 7 | * Copyright (c) 2005, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H 25 | #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H 26 | 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | class OptionalUnlabeledTracker 32 | { 33 | 34 | public: 35 | 36 | static void check( bool req, const std::string& argName ); 37 | 38 | static void gotOptional() { alreadyOptionalRef() = true; } 39 | 40 | static bool& alreadyOptional() { return alreadyOptionalRef(); } 41 | 42 | private: 43 | 44 | static bool& alreadyOptionalRef() { static bool ct = false; return ct; } 45 | }; 46 | 47 | 48 | inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) 49 | { 50 | if ( OptionalUnlabeledTracker::alreadyOptional() ) 51 | throw( SpecificationException( 52 | "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", 53 | argName ) ); 54 | 55 | if ( !req ) 56 | OptionalUnlabeledTracker::gotOptional(); 57 | } 58 | 59 | 60 | } // namespace TCLAP 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /extern/tclap/Visitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Visitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_VISITOR_H 24 | #define TCLAP_VISITOR_H 25 | 26 | namespace TCLAP { 27 | 28 | /** 29 | * A base class that defines the interface for visitors. 30 | */ 31 | class Visitor 32 | { 33 | public: 34 | 35 | /** 36 | * Constructor. Does nothing. 37 | */ 38 | Visitor() { } 39 | 40 | /** 41 | * Destructor. Does nothing. 42 | */ 43 | virtual ~Visitor() { } 44 | 45 | /** 46 | * Does nothing. Should be overridden by child. 47 | */ 48 | virtual void visit() { } 49 | }; 50 | 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/nvconfig.h.in: -------------------------------------------------------------------------------- 1 | #ifndef NV_CONFIG 2 | #define NV_CONFIG 3 | 4 | #cmakedefine HAVE_UNISTD_H 5 | #cmakedefine HAVE_STDARG_H 6 | #cmakedefine HAVE_SIGNAL_H 7 | #cmakedefine HAVE_EXECINFO_H 8 | #cmakedefine HAVE_MALLOC_H 9 | 10 | #cmakedefine HAVE_PNG 11 | #cmakedefine HAVE_JPEG 12 | #cmakedefine HAVE_TIFF 13 | #cmakedefine HAVE_OPENEXR 14 | #cmakedefine HAVE_FREEIMAGE 15 | 16 | #cmakedefine HAVE_MAYA 17 | 18 | #endif // NV_CONFIG 19 | -------------------------------------------------------------------------------- /src/nvcore/Constraints.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_CORE_ALGORITHMS_H 4 | #define NV_CORE_ALGORITHMS_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | // Cool constraints from "Imperfect C++" 11 | 12 | // must_be_pod 13 | template 14 | struct must_be_pod 15 | { 16 | static void constraints() 17 | { 18 | union { T T_is_not_POD_type; }; 19 | } 20 | }; 21 | 22 | // must_be_pod_or_void 23 | template 24 | struct must_be_pod_or_void 25 | { 26 | static void constraints() 27 | { 28 | union { T T_is_not_POD_type; }; 29 | } 30 | }; 31 | template <> struct must_be_pod_or_void {}; 32 | 33 | // size_of 34 | template 35 | struct size_of 36 | { 37 | enum { value = sizeof(T) }; 38 | }; 39 | template <> 40 | struct size_of 41 | { 42 | enum { value = 0 }; 43 | }; 44 | 45 | // must_be_same_size 46 | template 47 | struct must_be_same_size 48 | { 49 | static void constraints() 50 | { 51 | const int T1_not_same_size_as_T2 = size_of::value == size_of::value; 52 | int i[T1_not_same_size_as_T2]; 53 | } 54 | }; 55 | 56 | 57 | } // nv namespace 58 | 59 | #endif // NV_CORE_ALGORITHMS_H 60 | -------------------------------------------------------------------------------- /src/nvcore/DefsGnucDarwin.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | #include // uint8_t, int8_t, ... 6 | 7 | // Function linkage 8 | #define DLL_IMPORT 9 | #if __GNUC__ >= 4 10 | # define DLL_EXPORT __attribute__((visibility("default"))) 11 | # define DLL_EXPORT_CLASS DLL_EXPORT 12 | #else 13 | # define DLL_EXPORT 14 | # define DLL_EXPORT_CLASS 15 | #endif 16 | 17 | // Function calling modes 18 | #if NV_CPU_X86 19 | # define NV_CDECL __attribute__((cdecl)) 20 | # define NV_STDCALL __attribute__((stdcall)) 21 | #else 22 | # define NV_CDECL 23 | # define NV_STDCALL 24 | #endif 25 | 26 | #define NV_FASTCALL __attribute__((fastcall)) 27 | #define NV_FORCEINLINE __attribute__((always_inline)) 28 | #define NV_DEPRECATED __attribute__((deprecated)) 29 | 30 | #if __GNUC__ > 2 31 | #define NV_PURE __attribute__((pure)) 32 | #define NV_CONST __attribute__((const)) 33 | #else 34 | #define NV_PURE 35 | #define NV_CONST 36 | #endif 37 | 38 | // Define __FUNC__ properly. 39 | #if __STDC_VERSION__ < 199901L 40 | # if __GNUC__ >= 2 41 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 42 | # else 43 | # define __FUNC__ "" 44 | # endif 45 | #else 46 | # define __FUNC__ __PRETTY_FUNCTION__ 47 | #endif 48 | 49 | #define restrict __restrict__ 50 | 51 | 52 | // Type definitions 53 | typedef uint8_t uint8; 54 | typedef int8_t int8; 55 | 56 | typedef uint16_t uint16; 57 | typedef int16_t int16; 58 | 59 | typedef uint32_t uint32; 60 | typedef int32_t int32; 61 | 62 | typedef uint64_t uint64; 63 | typedef int64_t int64; 64 | 65 | // Aliases 66 | typedef uint32 uint; 67 | -------------------------------------------------------------------------------- /src/nvcore/DefsGnucLinux.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | // Function linkage 6 | #define DLL_IMPORT 7 | #if __GNUC__ >= 4 8 | # define DLL_EXPORT __attribute__((visibility("default"))) 9 | # define DLL_EXPORT_CLASS DLL_EXPORT 10 | #else 11 | # define DLL_EXPORT 12 | # define DLL_EXPORT_CLASS 13 | #endif 14 | 15 | // Function calling modes 16 | #if NV_CPU_X86 17 | # define NV_CDECL __attribute__((cdecl)) 18 | # define NV_STDCALL __attribute__((stdcall)) 19 | #else 20 | # define NV_CDECL 21 | # define NV_STDCALL 22 | #endif 23 | 24 | #define NV_FASTCALL __attribute__((fastcall)) 25 | #define NV_FORCEINLINE __attribute__((always_inline)) 26 | #define NV_DEPRECATED __attribute__((deprecated)) 27 | 28 | 29 | #if __GNUC__ > 2 30 | #define NV_PURE __attribute__((pure)) 31 | #define NV_CONST __attribute__((const)) 32 | #else 33 | #define NV_PURE 34 | #define NV_CONST 35 | #endif 36 | 37 | // Define __FUNC__ properly. 38 | #if __STDC_VERSION__ < 199901L 39 | # if __GNUC__ >= 2 40 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 41 | # else 42 | # define __FUNC__ "" 43 | # endif 44 | #else 45 | # define __FUNC__ __PRETTY_FUNCTION__ 46 | #endif 47 | 48 | #define restrict __restrict__ 49 | 50 | 51 | // Type definitions 52 | typedef unsigned char uint8; 53 | typedef signed char int8; 54 | 55 | typedef unsigned short uint16; 56 | typedef signed short int16; 57 | 58 | typedef unsigned int uint32; 59 | typedef signed int int32; 60 | 61 | typedef unsigned long long uint64; 62 | typedef signed long long int64; 63 | 64 | // Aliases 65 | typedef uint32 uint; 66 | -------------------------------------------------------------------------------- /src/nvcore/DefsGnucWin32.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | // Function linkage 6 | #define DLL_IMPORT __declspec(dllimport) 7 | #define DLL_EXPORT __declspec(dllexport) 8 | #define DLL_EXPORT_CLASS DLL_EXPORT 9 | 10 | // Function calling modes 11 | #if NV_CPU_X86 12 | # define NV_CDECL __attribute__((cdecl)) 13 | # define NV_STDCALL __attribute__((stdcall)) 14 | #else 15 | # define NV_CDECL 16 | # define NV_STDCALL 17 | #endif 18 | 19 | #define NV_FASTCALL __attribute__((fastcall)) 20 | #define NV_FORCEINLINE __attribute__((always_inline)) 21 | #define NV_DEPRECATED __attribute__((deprecated)) 22 | 23 | #if __GNUC__ > 2 24 | #define NV_PURE __attribute__((pure)) 25 | #define NV_CONST __attribute__((const)) 26 | #else 27 | #define NV_PURE 28 | #define NV_CONST 29 | #endif 30 | 31 | // Define __FUNC__ properly. 32 | #if __STDC_VERSION__ < 199901L 33 | # if __GNUC__ >= 2 34 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 35 | # else 36 | # define __FUNC__ "" 37 | # endif 38 | #else 39 | # define __FUNC__ __PRETTY_FUNCTION__ 40 | #endif 41 | 42 | #define restrict __restrict__ 43 | 44 | 45 | // Type definitions 46 | typedef unsigned char uint8; 47 | typedef signed char int8; 48 | 49 | typedef unsigned short uint16; 50 | typedef signed short int16; 51 | 52 | typedef unsigned int uint32; 53 | typedef signed int int32; 54 | 55 | typedef unsigned long long uint64; 56 | typedef signed long long int64; 57 | 58 | // Aliases 59 | typedef uint32 uint; 60 | -------------------------------------------------------------------------------- /src/nvcore/FileSystem.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #include "FileSystem.h" 4 | #include 5 | 6 | #if NV_OS_WIN32 7 | //#include // PathFileExists 8 | #include // GetFileAttributes 9 | #include // _mkdir 10 | #else 11 | #include 12 | #include 13 | #include 14 | #endif 15 | 16 | using namespace nv; 17 | 18 | 19 | bool FileSystem::exists(const char * path) 20 | { 21 | #if NV_OS_UNIX 22 | return access(path, F_OK|R_OK) == 0; 23 | //struct stat buf; 24 | //return stat(path, &buf) == 0; 25 | #elif NV_OS_WIN32 26 | // PathFileExists requires linking to shlwapi.lib 27 | //return PathFileExists(path) != 0; 28 | return GetFileAttributesA(path) != 0xFFFFFFFF; 29 | #else 30 | if (FILE * fp = fopen(path, "r")) 31 | { 32 | fclose(fp); 33 | return true; 34 | } 35 | return false; 36 | #endif 37 | } 38 | 39 | bool FileSystem::createDirectory(const char * path) 40 | { 41 | #if NV_OS_WIN32 42 | return _mkdir(path) != -1; 43 | #else 44 | return mkdir(path, 0777) != -1; 45 | #endif 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/nvcore/FileSystem.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #ifndef NV_CORE_FILESYSTEM_H 4 | #define NV_CORE_FILESYSTEM_H 5 | 6 | 7 | namespace nv 8 | { 9 | 10 | namespace FileSystem 11 | { 12 | 13 | bool exists(const char * path); 14 | bool createDirectory(const char * path); 15 | 16 | } // FileSystem namespace 17 | 18 | } // nv namespace 19 | 20 | 21 | #endif // NV_CORE_FILESYSTEM_H 22 | -------------------------------------------------------------------------------- /src/nvcore/Library.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Library.h" 3 | #include "Debug.h" 4 | 5 | #if NV_OS_WIN32 6 | #define WIN32_LEAN_AND_MEAN 7 | #define VC_EXTRALEAN 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | 14 | 15 | void * nvLoadLibrary(const char * name) 16 | { 17 | #if NV_OS_WIN32 18 | return (void *)LoadLibraryExA( name, NULL, 0 ); 19 | #else 20 | return dlopen(name, RTLD_LAZY); 21 | #endif 22 | } 23 | 24 | void nvUnloadLibrary(void * handle) 25 | { 26 | nvDebugCheck(handle != NULL); 27 | #if NV_OS_WIN32 28 | FreeLibrary((HMODULE)handle); 29 | #else 30 | dlclose(handle); 31 | #endif 32 | } 33 | 34 | void * nvBindSymbol(void * handle, const char * symbol) 35 | { 36 | #if NV_OS_WIN32 37 | return (void *)GetProcAddress((HMODULE)handle, symbol); 38 | #else 39 | return (void *)dlsym(handle, symbol); 40 | #endif 41 | } 42 | -------------------------------------------------------------------------------- /src/nvcore/Library.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #ifndef NV_CORE_LIBRARY_H 4 | #define NV_CORE_LIBRARY_H 5 | 6 | #include 7 | 8 | #if NV_OS_WIN32 9 | #define LIBRARY_NAME(name) #name ".dll" 10 | #elif NV_OS_DARWIN 11 | #define NV_LIBRARY_NAME(name) "lib" #name ".dylib" 12 | #else 13 | #define NV_LIBRARY_NAME(name) "lib" #name ".so" 14 | #endif 15 | 16 | NVCORE_API void * nvLoadLibrary(const char * name); 17 | NVCORE_API void nvUnloadLibrary(void * lib); 18 | NVCORE_API void * nvBindSymbol(void * lib, const char * symbol); 19 | 20 | class NVCORE_CLASS Library 21 | { 22 | public: 23 | Library(const char * name) 24 | { 25 | handle = nvLoadLibrary(name); 26 | } 27 | ~Library() 28 | { 29 | if (isValid()) 30 | { 31 | nvUnloadLibrary(handle); 32 | } 33 | } 34 | 35 | bool isValid() const 36 | { 37 | return handle != NULL; 38 | } 39 | 40 | void * bindSymbol(const char * symbol) 41 | { 42 | return nvBindSymbol(handle, symbol); 43 | } 44 | 45 | private: 46 | void * handle; 47 | }; 48 | 49 | 50 | #endif // NV_CORE_LIBRARY_H 51 | -------------------------------------------------------------------------------- /src/nvcore/Memory.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Memory.h" 3 | #include "Debug.h" 4 | 5 | //#if HAVE_MALLOC_H 6 | //#include 7 | //#endif 8 | 9 | #include 10 | 11 | 12 | using namespace nv; 13 | 14 | void * nv::mem::malloc(size_t size) 15 | { 16 | return ::malloc(size); 17 | } 18 | 19 | void * nv::mem::malloc(size_t size, const char * file, int line) 20 | { 21 | NV_UNUSED(file); 22 | NV_UNUSED(line); 23 | return ::malloc(size); 24 | } 25 | 26 | void nv::mem::free(const void * ptr) 27 | { 28 | ::free(const_cast(ptr)); 29 | } 30 | 31 | void * nv::mem::realloc(void * ptr, size_t size) 32 | { 33 | nvDebugCheck(ptr != NULL || size != 0); // undefined realloc behavior. 34 | return ::realloc(ptr, size); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/nvcore/Prefetch.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_CORE_PREFETCH_H 4 | #define NV_CORE_PREFETCH_H 5 | 6 | #include 7 | 8 | // nvPrefetch 9 | #if NV_CC_GNUC 10 | 11 | #define nvPrefetch(ptr) __builtin_prefetch(ptr) 12 | 13 | #elif NV_CC_MSVC 14 | 15 | // Uses SSE Intrinsics for both x86 and x86_64 16 | #include 17 | 18 | __forceinline void nvPrefetch(const void * mem) 19 | { 20 | _mm_prefetch(static_cast(mem), _MM_HINT_T0); /* prefetcht0 */ 21 | // _mm_prefetch(static_cast(mem), _MM_HINT_NTA); /* prefetchnta */ 22 | } 23 | #else 24 | 25 | // do nothing in other case. 26 | #define nvPrefetch(ptr) 27 | 28 | #endif // NV_CC_MSVC 29 | 30 | #endif // NV_CORE_PREFETCH_H 31 | -------------------------------------------------------------------------------- /src/nvcore/RefCounted.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "RefCounted.h" 4 | 5 | using namespace nv; 6 | 7 | int nv::RefCounted::s_total_ref_count = 0; 8 | int nv::RefCounted::s_total_obj_count = 0; 9 | 10 | -------------------------------------------------------------------------------- /src/nvcore/TextReader.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | 5 | using namespace nv; 6 | 7 | /// Peek next character. 8 | char TextReader::peek() 9 | { 10 | nvDebugCheck(m_stream != NULL); 11 | nvDebugCheck(m_stream->isSeekable()); 12 | 13 | if (m_stream->isAtEnd()) { 14 | return 0; 15 | } 16 | 17 | uint pos = m_stream->tell(); 18 | 19 | char c; 20 | m_stream->serialize(&c, 1); 21 | m_stream->seek(pos); 22 | return c; 23 | } 24 | 25 | /// Read a single char. 26 | char TextReader::read() 27 | { 28 | nvDebugCheck(m_stream != NULL); 29 | 30 | char c; 31 | m_stream->serialize(&c, 1); 32 | 33 | if( m_stream->isAtEnd() ) { 34 | return 0; 35 | } 36 | 37 | return c; 38 | } 39 | 40 | /// Read from the current location to the end of the stream. 41 | const char * TextReader::readToEnd() 42 | { 43 | nvDebugCheck(m_stream != NULL); 44 | const int size = m_stream->size(); 45 | 46 | m_text.clear(); 47 | 48 | m_text.reserve(size + 1); 49 | m_text.resize(size); 50 | 51 | m_stream->serialize(m_text.mutableBuffer(), size); 52 | m_text.pushBack('\0'); 53 | 54 | return m_text.buffer(); 55 | } 56 | 57 | /// Read from the current location to the end of the line. 58 | const char * TextReader::readLine() 59 | { 60 | m_text.clear(); 61 | 62 | if (m_stream->isAtEnd()) { 63 | return NULL; 64 | } 65 | 66 | while (true) { 67 | char c = read(); 68 | 69 | if (c == 0 || c == '\n') { 70 | break; 71 | } 72 | else if (c == '\r') { 73 | if( peek() == '\n' ) { 74 | read(); 75 | } 76 | break; 77 | } 78 | 79 | m_text.pushBack(c); 80 | } 81 | 82 | m_text.pushBack('\0'); 83 | return m_text.buffer(); 84 | } 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/nvcore/TextReader.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NVCORE_TEXTREADER_H 4 | #define NVCORE_TEXTREADER_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace nv 11 | { 12 | 13 | /// Text reader. 14 | class NVCORE_CLASS TextReader { 15 | public: 16 | 17 | /// Ctor. 18 | TextReader(Stream * stream) : m_stream(stream), m_text(512) { 19 | nvCheck(stream != NULL); 20 | nvCheck(stream->isLoading()); 21 | } 22 | 23 | char peek(); 24 | char read(); 25 | 26 | const char *readToEnd(); 27 | 28 | // Returns a temporary string. 29 | const char * readLine(); 30 | 31 | private: 32 | Stream * m_stream; 33 | Array m_text; 34 | }; 35 | 36 | } // nv namespace 37 | 38 | #endif // NVCORE_TEXTREADER_H 39 | -------------------------------------------------------------------------------- /src/nvcore/TextWriter.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | 5 | using namespace nv; 6 | 7 | 8 | /// Constructor 9 | TextWriter::TextWriter(Stream * s) : 10 | s(s), 11 | str(1024) 12 | { 13 | nvCheck(s != NULL); 14 | nvCheck(s->isSaving()); 15 | } 16 | 17 | void TextWriter::writeString(const char * str) 18 | { 19 | nvDebugCheck(s != NULL); 20 | s->serialize(const_cast(str), (int)strlen(str)); 21 | } 22 | 23 | void TextWriter::writeString(const char * str, uint len) 24 | { 25 | nvDebugCheck(s != NULL); 26 | s->serialize(const_cast(str), len); 27 | } 28 | 29 | void TextWriter::write(const char * format, ...) 30 | { 31 | va_list arg; 32 | va_start(arg,format); 33 | str.format(format, arg); 34 | writeString(str.str(), str.length()); 35 | va_end(arg); 36 | } 37 | 38 | void TextWriter::write(const char * format, va_list arg) 39 | { 40 | va_list tmp; 41 | va_copy(tmp, arg); 42 | str.format(format, arg); 43 | writeString(str.str(), str.length()); 44 | va_end(tmp); 45 | } 46 | -------------------------------------------------------------------------------- /src/nvcore/TextWriter.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NVCORE_TEXTWRITER_H 4 | #define NVCORE_TEXTWRITER_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace nv 11 | { 12 | 13 | /// Text writer. 14 | class NVCORE_CLASS TextWriter 15 | { 16 | public: 17 | 18 | TextWriter(Stream * s); 19 | 20 | void writeString(const char * str); 21 | void writeString(const char * str, uint len); 22 | void write(const char * format, ...) __attribute__((format (printf, 2, 3))); 23 | void write(const char * format, va_list arg); 24 | 25 | private: 26 | 27 | Stream * s; 28 | 29 | // Temporary string. 30 | StringBuilder str; 31 | 32 | }; 33 | 34 | 35 | inline TextWriter & operator<<( TextWriter & tw, int i) 36 | { 37 | tw.write("%d", i); 38 | return tw; 39 | } 40 | 41 | inline TextWriter & operator<<( TextWriter & tw, uint i) 42 | { 43 | tw.write("%u", i); 44 | return tw; 45 | } 46 | 47 | inline TextWriter & operator<<( TextWriter & tw, float f) 48 | { 49 | tw.write("%f", f); 50 | return tw; 51 | } 52 | 53 | inline TextWriter & operator<<( TextWriter & tw, const char * str) 54 | { 55 | tw.writeString(str); 56 | return tw; 57 | } 58 | 59 | } // nv namespace 60 | 61 | 62 | 63 | 64 | 65 | #endif // NVCORE_TEXTWRITER_H 66 | -------------------------------------------------------------------------------- /src/nvcore/Timer.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #ifndef NV_CORE_TIMER_H 4 | #define NV_CORE_TIMER_H 5 | 6 | #include 7 | 8 | #include //clock 9 | 10 | class NVCORE_CLASS Timer 11 | { 12 | public: 13 | Timer() {} 14 | 15 | void start() { m_start = clock(); } 16 | int elapsed() const { return (1000 * (clock() - m_start)) / CLOCKS_PER_SEC; } 17 | 18 | private: 19 | clock_t m_start; 20 | }; 21 | 22 | #endif // NV_CORE_TIMER_H 23 | -------------------------------------------------------------------------------- /src/nvcore/poshlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(POSHLIB_SRCS 3 | posh.c 4 | posh.h) 5 | 6 | ADD_LIBRARY(posh STATIC ${POSHLIB_SRCS}) 7 | 8 | -------------------------------------------------------------------------------- /src/nvimage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvimage) 2 | 3 | SET(IMAGE_SRCS 4 | nvimage.h 5 | FloatImage.h 6 | FloatImage.cpp 7 | Filter.h 8 | Filter.cpp 9 | Image.h 10 | Image.cpp 11 | ImageIO.h 12 | ImageIO.cpp 13 | ColorBlock.h 14 | ColorBlock.cpp 15 | BlockDXT.h 16 | BlockDXT.cpp 17 | HoleFilling.h 18 | HoleFilling.cpp 19 | DirectDrawSurface.h 20 | DirectDrawSurface.cpp 21 | Quantize.h 22 | Quantize.cpp 23 | NormalMap.h 24 | NormalMap.cpp 25 | NormalMipmap.h 26 | NormalMipmap.cpp 27 | PsdFile.h 28 | TgaFile.h 29 | ColorSpace.h 30 | ColorSpace.cpp) 31 | 32 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 33 | 34 | IF(PNG_FOUND) 35 | SET(LIBS ${LIBS} ${PNG_LIBRARIES}) 36 | INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) 37 | ENDIF(PNG_FOUND) 38 | 39 | IF(JPEG_FOUND) 40 | SET(LIBS ${LIBS} ${JPEG_LIBRARIES}) 41 | INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) 42 | ENDIF(JPEG_FOUND) 43 | 44 | IF(TIFF_FOUND) 45 | SET(LIBS ${LIBS} ${TIFF_LIBRARIES}) 46 | INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 47 | ENDIF(TIFF_FOUND) 48 | 49 | IF(OPENEXR_FOUND) 50 | SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES}) 51 | INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS}) 52 | ENDIF(OPENEXR_FOUND) 53 | 54 | IF(FREEIMAGE_FOUND) 55 | SET(LIBS ${LIBS} ${FREEIMAGE_LIBRARIES}) 56 | INCLUDE_DIRECTORIES(${FREEIMAGE_INCLUDE_PATH}) 57 | ENDIF(FREEIMAGE_FOUND) 58 | 59 | # targets 60 | ADD_DEFINITIONS(-DNVIMAGE_EXPORTS) 61 | 62 | IF(NVIMAGE_SHARED) 63 | ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS}) 64 | ELSE(NVIMAGE_SHARED) 65 | ADD_LIBRARY(nvimage ${IMAGE_SRCS}) 66 | ENDIF(NVIMAGE_SHARED) 67 | 68 | TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh) 69 | 70 | INSTALL(TARGETS nvimage 71 | RUNTIME DESTINATION bin 72 | LIBRARY DESTINATION lib 73 | ARCHIVE DESTINATION lib/static) 74 | 75 | -------------------------------------------------------------------------------- /src/nvimage/ColorSpace.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- jim@tilander.org 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "ColorSpace.h" 9 | 10 | namespace nv 11 | { 12 | void ColorSpace::RGBtoYCoCg_R(Image* img) 13 | { 14 | const uint w = img->width(); 15 | const uint h = img->height(); 16 | 17 | for( uint y=0; y < h; y++ ) 18 | { 19 | for( uint x=0; x < w; x++ ) 20 | { 21 | Color32 pixel = img->pixel(x, y); 22 | 23 | const int r = pixel.r; 24 | const int g = pixel.g; 25 | const int b = pixel.b; 26 | 27 | const int Co = r - b; 28 | const int t = b + Co/2; 29 | const int Cg = g - t; 30 | const int Y = t + Cg/2; 31 | 32 | // Just saturate the chroma here (we loose out of one bit in each channel) 33 | // this just means that we won't have as high dynamic range. Perhaps a better option 34 | // is to loose the least significant bit instead? 35 | pixel.r = clamp(Co + 128, 0, 255); 36 | pixel.g = clamp(Cg + 128, 0, 255); 37 | pixel.b = 0; 38 | pixel.a = Y; 39 | } 40 | } 41 | } 42 | 43 | void ColorSpace::YCoCg_RtoRGB(Image* img) 44 | { 45 | const uint w = img->width(); 46 | const uint h = img->height(); 47 | 48 | for( uint y=0; y < h; y++ ) 49 | { 50 | for( uint x=0; x < w; x++ ) 51 | { 52 | Color32 pixel = img->pixel(x, y); 53 | 54 | const int Co = (int)pixel.r - 128; 55 | const int Cg = (int)pixel.g - 128; 56 | const int Y = pixel.a; 57 | 58 | const int t = Y - Cg/2; 59 | const int g = Cg + t; 60 | const int b = t - Co/2; 61 | const int r = b + Co; 62 | 63 | pixel.r = r; 64 | pixel.g = g; 65 | pixel.b = b; 66 | pixel.a = 1; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/nvimage/ColorSpace.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- jim@tilander.org 2 | 3 | #ifndef NV_IMAGE_COLORSPACE_H 4 | #define NV_IMAGE_COLORSPACE_H 5 | 6 | namespace nv 7 | { 8 | class Image; 9 | 10 | // Defines simple mappings between different color spaces and encodes them in the 11 | // input image. 12 | namespace ColorSpace 13 | { 14 | void RGBtoYCoCg_R(Image* img); 15 | void YCoCg_RtoRGB(Image* img); 16 | } 17 | } 18 | 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/nvimage/ConeMap.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 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_IMAGE_CONEMAP_H 25 | #define NV_IMAGE_CONEMAP_H 26 | 27 | #include 28 | #include 29 | 30 | namespace nv 31 | { 32 | class Image; 33 | class FloatImage; 34 | 35 | FloatImage * createConeMap(const Image * img, Vector4::Arg heightWeights); 36 | 37 | } // nv namespace 38 | 39 | #endif // NV_IMAGE_CONEMAP_H 40 | -------------------------------------------------------------------------------- /src/nvimage/Image.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_IMAGE_H 4 | #define NV_IMAGE_IMAGE_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | class Color32; 12 | 13 | /// 32 bit RGBA image. 14 | class NVIMAGE_CLASS Image 15 | { 16 | public: 17 | 18 | enum Format 19 | { 20 | Format_RGB, 21 | Format_ARGB, 22 | }; 23 | 24 | Image(); 25 | Image(const Image & img); 26 | ~Image(); 27 | 28 | const Image & operator=(const Image & img); 29 | 30 | 31 | void allocate(uint w, uint h); 32 | bool load(const char * name); 33 | 34 | void wrap(void * data, uint w, uint h); 35 | void unwrap(); 36 | 37 | uint width() const; 38 | uint height() const; 39 | 40 | const Color32 * scanline(uint h) const; 41 | Color32 * scanline(uint h); 42 | 43 | const Color32 * pixels() const; 44 | Color32 * pixels(); 45 | 46 | const Color32 & pixel(uint idx) const; 47 | Color32 & pixel(uint idx); 48 | 49 | const Color32 & pixel(uint x, uint y) const; 50 | Color32 & pixel(uint x, uint y); 51 | 52 | Format format() const; 53 | void setFormat(Format f); 54 | 55 | void fill(Color32 c); 56 | 57 | private: 58 | void free(); 59 | 60 | private: 61 | uint m_width; 62 | uint m_height; 63 | Format m_format; 64 | Color32 * m_data; 65 | }; 66 | 67 | 68 | inline const Color32 & Image::pixel(uint x, uint y) const 69 | { 70 | nvDebugCheck(x < width() && y < height()); 71 | return pixel(y * width() + x); 72 | } 73 | 74 | inline Color32 & Image::pixel(uint x, uint y) 75 | { 76 | nvDebugCheck(x < width() && y < height()); 77 | return pixel(y * width() + x); 78 | } 79 | 80 | } // nv namespace 81 | 82 | 83 | #endif // NV_IMAGE_IMAGE_H 84 | -------------------------------------------------------------------------------- /src/nvimage/NormalMipmap.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_NORMALMIPMAP_H 4 | #define NV_IMAGE_NORMALMIPMAP_H 5 | 6 | #include 7 | 8 | 9 | namespace nv 10 | { 11 | class FloatImage; 12 | 13 | FloatImage * createNormalMipmapMap(const FloatImage * img); 14 | 15 | } // nv namespace 16 | 17 | #endif // NV_IMAGE_NORMALMIPMAP_H 18 | -------------------------------------------------------------------------------- /src/nvimage/PsdFile.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_PSDFILE_H 4 | #define NV_IMAGE_PSDFILE_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | enum PsdColorMode 11 | { 12 | PsdColorMode_Bitmap = 0, 13 | PsdColorMode_GrayScale = 1, 14 | PsdColorMode_Indexed = 2, 15 | PsdColorMode_RGB = 3, 16 | PsdColorMode_CMYK = 4, 17 | PsdColorMode_MultiChannel = 7, 18 | PsdColorMode_DuoTone = 8, 19 | PsdColorMode_LabColor = 9 20 | }; 21 | 22 | /// PSD header. 23 | struct PsdHeader 24 | { 25 | uint32 signature; 26 | uint16 version; 27 | uint8 reserved[6]; 28 | uint16 channel_count; 29 | uint32 height; 30 | uint32 width; 31 | uint16 depth; 32 | uint16 color_mode; 33 | 34 | bool isValid() const 35 | { 36 | return signature == 0x38425053; // '8BPS' 37 | } 38 | 39 | bool isSupported() const 40 | { 41 | if (version != 1) { 42 | nvDebug("*** bad version number %u\n", version); 43 | return false; 44 | } 45 | if (channel_count > 4) { 46 | return false; 47 | } 48 | if (depth != 8) { 49 | return false; 50 | } 51 | if (color_mode != PsdColorMode_RGB) { 52 | return false; 53 | } 54 | return true; 55 | } 56 | }; 57 | 58 | 59 | inline Stream & operator<< (Stream & s, PsdHeader & head) 60 | { 61 | s << head.signature << head.version; 62 | for (int i = 0; i < 6; i++) { 63 | s << head.reserved[i]; 64 | } 65 | return s << head.channel_count << head.height << head.width << head.depth << head.color_mode; 66 | } 67 | 68 | } // nv namespace 69 | 70 | #endif // NV_IMAGE_PSDFILE_H 71 | -------------------------------------------------------------------------------- /src/nvimage/Quantize.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_QUANTIZE_H 4 | #define NV_IMAGE_QUANTIZE_H 5 | 6 | #include 7 | 8 | 9 | namespace nv 10 | { 11 | class Image; 12 | 13 | namespace Quantize 14 | { 15 | void RGB16(Image * img); 16 | void BinaryAlpha(Image * img, int alpha_threshold = 127); 17 | void Alpha4(Image * img); 18 | 19 | void FloydSteinberg_RGB16(Image * img); 20 | void FloydSteinberg_BinaryAlpha(Image * img, int alpha_threshold = 127); 21 | void FloydSteinberg_Alpha4(Image * img); 22 | 23 | void Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize); 24 | void FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize); 25 | 26 | // @@ Add palette quantization algorithms! 27 | } 28 | } 29 | 30 | 31 | #endif // NV_IMAGE_QUANTIZE_H 32 | -------------------------------------------------------------------------------- /src/nvimage/nvimage.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_H 4 | #define NV_IMAGE_H 5 | 6 | #include 7 | 8 | // Function linkage 9 | #if NVIMAGE_SHARED 10 | #ifdef NVIMAGE_EXPORTS 11 | #define NVIMAGE_API DLL_EXPORT 12 | #define NVIMAGE_CLASS DLL_EXPORT_CLASS 13 | #else 14 | #define NVIMAGE_API DLL_IMPORT 15 | #define NVIMAGE_CLASS DLL_IMPORT 16 | #endif 17 | #else 18 | #define NVIMAGE_API 19 | #define NVIMAGE_CLASS 20 | #endif 21 | 22 | #endif // NV_IMAGE_H 23 | -------------------------------------------------------------------------------- /src/nvimage/openexr/AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/AUTHORS -------------------------------------------------------------------------------- /src/nvimage/openexr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) 2 | PROJECT (OpenEXR) 3 | #ENABLE_TESTING() 4 | 5 | IF(WIN32) 6 | IF(NOT GNUWIN32_PATH) 7 | SET(GNUWIN32_PATH "${OpenEXR_SOURCE_DIR}/gnuwin32") 8 | SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${GNUWIN32_PATH}/include") 9 | SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${GNUWIN32_PATH}/lib") 10 | ENDIF(NOT GNUWIN32_PATH) 11 | ENDIF(WIN32) 12 | 13 | #SET(ILMBASE_SHARED) # Set to true to create shared libraries. 14 | #SET(OPENEXR_SHARED) # Set to true to create shared libraries. 15 | 16 | 17 | ADD_SUBDIRECTORY(src) 18 | -------------------------------------------------------------------------------- /src/nvimage/openexr/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm 2 | Entertainment Company Ltd. Portions contributed and copyright held by 3 | others as indicated. All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided with 16 | the distribution. 17 | 18 | * Neither the name of Industrial Light & Magic nor the names of 19 | any other contributors to this software may be used to endorse or 20 | promote products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 24 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 25 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | -------------------------------------------------------------------------------- /src/nvimage/openexr/ChangeLog: -------------------------------------------------------------------------------- 1 | Version 1.0.1: 2 | * Removed Windows .suo files from distribution. 3 | (Eric Wimmer) 4 | 5 | Version 1.0.0: 6 | * Bumped DSO version number to 6.0 7 | (Florian Kainz) 8 | * Rounding during float-to-half conversion now implements 9 | "round to nearest even" mode: if the original float value 10 | is exactly in the middle between the two closest half values 11 | then rounding chooses the half value whose least significant 12 | bit is zero. 13 | (Florian Kainz) 14 | * Installation Tuning: 15 | - Corrected version number on dso's (libtool) - now 5.0 16 | - Separated ILMBASE_LDFLAGS and ILMBASE_LIBS so that test programs 17 | in configure scripts of packages dependent on IlmBase can link 18 | with static libraries properly 19 | - eliminated some warning messages during install 20 | (Andrew Kunz) 21 | 22 | Version 0.9.0: 23 | * Initial release of this code as a separate library. 24 | Previously the libraries contained were part of 25 | version 1.4.0 of OpenEXR 26 | * New build scripts for Linux/Unix 27 | (Andrew Kunz) 28 | * New Windows project files and build scripts 29 | (Kimball Thurston) 30 | -------------------------------------------------------------------------------- /src/nvimage/openexr/INSTALL: -------------------------------------------------------------------------------- 1 | See the README file for instructions on how to build IlmBase from 2 | source. 3 | -------------------------------------------------------------------------------- /src/nvimage/openexr/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm 2 | Entertainment Company Ltd. Portions contributed and copyright held by 3 | others as indicated. All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided with 16 | the distribution. 17 | 18 | * Neither the name of Industrial Light & Magic nor the names of 19 | any other contributors to this software may be used to endorse or 20 | promote products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 24 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 25 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | -------------------------------------------------------------------------------- /src/nvimage/openexr/README: -------------------------------------------------------------------------------- 1 | ABOUT THE ILMBASE LIBRARIES 2 | ---------------------------- 3 | 4 | Half is a class that encapsulates our 16-bit floating-point format. 5 | 6 | IlmThread is a thread abstraction library for use with OpenEXR 7 | and other software packages. It currently supports pthreads and 8 | Windows threads. 9 | 10 | Imath implements 2D and 3D vectors, 3x3 and 4x4 matrices, quaternions 11 | and other useful 2D and 3D math functions. 12 | 13 | Iex is an exception-handling library. 14 | 15 | If you have questions about using the IlmBase libraries, you may want 16 | to join our developer mailing list. See http://www.openexr.com for 17 | details. 18 | 19 | 20 | LICENSE 21 | ------- 22 | 23 | The IlmBase source code distribution is free software. See the file 24 | named COPYING (included in this distribution) for details. 25 | 26 | 27 | BUILDING ILMBASE 28 | ---------------- 29 | 30 | To build IlmBase on GNU/Linux or other UNIX-like systems, do this: 31 | 32 | ./configure 33 | make 34 | make install 35 | 36 | unless you obtained IlmBase directly from CVS, in which case you 37 | should first read README.CVS. 38 | 39 | See README.OSX for details on building IlmBase in MacOS X. 40 | 41 | Do `make check` to run the IlmBase confidence tests. They should all 42 | pass; if you find a test that does not pass on your system, please let 43 | us know. 44 | 45 | Other UNIX variants haven't been tested, but should be easy to build. 46 | Let us know if you're having problems porting IlmBase to a particular 47 | platform. 48 | 49 | All include files needed to use the IlmBase libraries are installed in the 50 | OpenEXR subdirectory of the install prefix, e.g. /usr/local/include/OpenEXR. 51 | 52 | 53 | USING ILMBASE IN YOUR APPLICATIONS 54 | ---------------------------------- 55 | 56 | On systems with support for pkg-config, use `pkg-config --cflags 57 | IlmBase` for the C++ flags required to compile against IlmBase 58 | headers; and `pkg-config --libs IlmBase` for the linker flags required 59 | to link against IlmBase libraries. 60 | 61 | -------------------------------------------------------------------------------- /src/nvimage/openexr/README.CVS: -------------------------------------------------------------------------------- 1 | If you're using IlmBase from CVS, you should run the bootstrap script 2 | to create the auto* files. It's a good idea to run this whenever you 3 | update IlmBase from CVS. 4 | 5 | Then run './configure' and make. 6 | 7 | Note that the configure.ac file requires a fairly new version of 8 | automake. If you get this error message: 9 | 10 | running aclocal ... 11 | aclocal: configure.ac: 142: macro `AM_CFLAGS' not found in library 12 | aclocal: configure.ac: 143: macro `AM_CXXFLAGS' not found in library 13 | failed! 14 | 15 | you should upgrade your automake to version 1.6 or better. 16 | 17 | -------------------------------------------------------------------------------- /src/nvimage/openexr/README.OSX: -------------------------------------------------------------------------------- 1 | IlmBase on MacOS X 2 | ------------------ 3 | 4 | Building IlmBase on MacOS X is just like building it on GNU/Linux. 5 | Follow the instructions in the README file under BUILDLING ILMBASE, 6 | but see below re: shared libraries. 7 | 8 | On OS X 10.4, you can build universal binaries by passing 9 | '--enable-osx-universal-binaries --disable-dependency-tracking' to the 10 | configure script. The default is *not* to build universal binaries. 11 | 12 | 13 | Shared libraries 14 | ---------------- 15 | 16 | IlmBase requires the "flat namespace" option when built as a shared 17 | library. You may have problems trying to use IlmBase shared libraries 18 | with applications that expect OS X's two-level namespace. We have not 19 | tested the shared libs extensively, though they appear to work with 20 | exrdisplay and exrheader, but use them at your own risk. We will 21 | support two-level namespace shared libs in a future release. 22 | -------------------------------------------------------------------------------- /src/nvimage/openexr/README.cmake: -------------------------------------------------------------------------------- 1 | 2 | Linux build instructions: 3 | 4 | $ mkdir build 5 | $ cd build 6 | $ cmake .. 7 | $ make 8 | $ su -c "make install" 9 | 10 | 11 | Windows build instructions: 12 | 13 | * Using MSVC 2005: 14 | $ mkdir vc8 15 | $ cd vc8 16 | $ cmake .. -G "Visual Studio 2005" 17 | $ explorer.exe NV.sln 18 | 19 | * Using MSVC 2003: 20 | ... 21 | 22 | -------------------------------------------------------------------------------- /src/nvimage/openexr/doc/OpenEXRFileLayout.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/doc/OpenEXRFileLayout.pdf -------------------------------------------------------------------------------- /src/nvimage/openexr/doc/ReadingAndWritingImageFiles.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/doc/ReadingAndWritingImageFiles.pdf -------------------------------------------------------------------------------- /src/nvimage/openexr/doc/TechnicalIntroduction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/doc/TechnicalIntroduction.pdf -------------------------------------------------------------------------------- /src/nvimage/openexr/gnuwin32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INSTALL(PROGRAMS 3 | bin/zlib1.dll 4 | DESTINATION bin) 5 | -------------------------------------------------------------------------------- /src/nvimage/openexr/gnuwin32/bin/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/gnuwin32/bin/zlib1.dll -------------------------------------------------------------------------------- /src/nvimage/openexr/gnuwin32/lib/zlib-bcc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/gnuwin32/lib/zlib-bcc.lib -------------------------------------------------------------------------------- /src/nvimage/openexr/gnuwin32/lib/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/gnuwin32/lib/zlib.lib -------------------------------------------------------------------------------- /src/nvimage/openexr/src/Half/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (Half) 2 | 3 | SET(HALF_SRCS 4 | half.cpp 5 | half.h 6 | halfFunction.h 7 | halfLimits.h) 8 | 9 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 10 | 11 | IF(ILMBASE_SHARED) 12 | ADD_LIBRARY(Half SHARED ${HALF_SRCS}) 13 | ELSE(ILMBASE_SHARED) 14 | ADD_LIBRARY(Half ${HALF_SRCS}) 15 | ENDIF(ILMBASE_SHARED) 16 | 17 | #TARGET_LINK_LIBRARIES(Half ${LIBS}) 18 | 19 | INSTALL(TARGETS Half 20 | RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib 22 | ARCHIVE DESTINATION lib/static) 23 | 24 | INSTALL(FILES 25 | half.h 26 | halfFunction.h 27 | halfLimits.h 28 | DESTINATION include/OpenEXR) -------------------------------------------------------------------------------- /src/nvimage/openexr/src/Half/half.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/src/Half/half.cpp -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | 13 | #define TEST(x) if (argc < 2 || !strcmp (argv[1], #x)) x(); 14 | 15 | 16 | int 17 | main (int argc, char *argv[]) 18 | { 19 | std::cout << "\ntesting type half:\n\n" << std::flush; 20 | 21 | TEST (testSize); 22 | TEST (testArithmetic); 23 | TEST (testNormalizedConversionError); 24 | TEST (testDenormalizedConversionError); 25 | TEST (testRoundingError); 26 | TEST (testBitPatterns); 27 | TEST (testClassification); 28 | TEST (testLimits); 29 | TEST (testFunction); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testArithmetic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "half.h" 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | 9 | void 10 | testArithmetic () 11 | { 12 | cout << "basic arithmetic operations:\n"; 13 | 14 | float f1 (1); 15 | float f2 (2); 16 | half h1 (3); 17 | half h2 (4); 18 | 19 | cout << "f1 = " << f1 << ", " 20 | "f2 = " << f2 << ", " 21 | "h1 = " << h1 << ", " 22 | "h2 = " << h2 << endl; 23 | 24 | h1 = f1 + f2; 25 | assert (h1 == 3); 26 | 27 | cout << "h1 = f1 + f2: " << h1 << endl; 28 | 29 | h2 += f1; 30 | assert (h2 == 5); 31 | 32 | cout << "h2 += f1: " << h2 << endl; 33 | 34 | h2 = h1 + h2; 35 | assert (h2 == 8); 36 | 37 | cout << "h2 = h1 + h2: " << h2 << endl; 38 | 39 | h2 += h1; 40 | assert (h2 == 11); 41 | 42 | cout << "h2 += h1: " << h2 << endl; 43 | 44 | h1 = h2; 45 | assert (h1 == 11); 46 | 47 | cout << "h1 = h2: " << h1 << endl; 48 | 49 | h2 = -h1; 50 | assert (h2 == -11); 51 | 52 | cout << "h2 = -h1: " << h2 << endl; 53 | 54 | cout << "ok\n\n" << flush; 55 | } 56 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testArithmetic.h: -------------------------------------------------------------------------------- 1 | 2 | void testArithmetic (); 3 | 4 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testBitPatterns.h: -------------------------------------------------------------------------------- 1 | 2 | void testBitPatterns (); 3 | 4 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testClassification.h: -------------------------------------------------------------------------------- 1 | 2 | void testClassification (); 3 | 4 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testError.h: -------------------------------------------------------------------------------- 1 | 2 | void testNormalizedConversionError (); 3 | void testDenormalizedConversionError (); 4 | void testRoundingError (); 5 | 6 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "halfFunction.h" 3 | #include 4 | #include 5 | 6 | 7 | using namespace std; 8 | 9 | namespace { 10 | 11 | 12 | float 13 | divideByTwo (float x) 14 | { 15 | return x / 2; 16 | } 17 | 18 | 19 | struct timesN 20 | { 21 | timesN (float n): n (n) {} 22 | float operator () (float x) {return x * n;} 23 | float n; 24 | }; 25 | 26 | 27 | } // namespace 28 | 29 | 30 | void 31 | testFunction () 32 | { 33 | cout << "halfFunction\n"; 34 | 35 | halfFunction d2 (divideByTwo); 36 | 37 | assert (d2 (0) == 0); 38 | assert (d2 (2) == 1); 39 | assert (d2 (-2) == -1); 40 | assert (d2 (HALF_MAX) == HALF_MAX / 2); 41 | assert (d2 (-HALF_MAX) == -HALF_MAX / 2); 42 | assert (d2 (half::posInf()) == 0); 43 | assert (d2 (half::negInf()) == 0); 44 | assert (d2 (half::qNan()) == 0); 45 | 46 | halfFunction t5 (timesN (5), // function 47 | 0, HALF_MAX / 8, // domain 48 | -1, // default value 49 | half::posInf(), // posInfValue 50 | half::negInf(), // negInfValue 51 | half::qNan()); // nanValue 52 | 53 | assert (t5 (0) == 0); 54 | assert (t5 (2) == 10); 55 | assert (t5 (-2) == -1); 56 | assert (t5 (HALF_MAX) == -1); 57 | assert (t5 (-HALF_MAX) == -1); 58 | 59 | assert ( t5(half::posInf()).isInfinity()); 60 | assert (!t5(half::posInf()).isNegative()); 61 | 62 | assert (t5(half::negInf()).isInfinity()); 63 | assert (t5(half::negInf()).isNegative()); 64 | 65 | assert (t5(half::qNan()).isNan()); 66 | 67 | cout << "ok\n\n" << flush; 68 | } 69 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testFunction.h: -------------------------------------------------------------------------------- 1 | 2 | void testFunction (); 3 | 4 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testLimits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "halfLimits.h" 3 | #include 4 | #include 5 | 6 | 7 | using namespace std; 8 | 9 | namespace { 10 | 11 | float 12 | mypow (int x, int y) 13 | { 14 | bool negative = false; 15 | 16 | if (y < 0) 17 | { 18 | negative = true; 19 | y = -y; 20 | } 21 | 22 | float z = 1; 23 | 24 | while (y > 0) 25 | { 26 | z *= x; 27 | y -= 1; 28 | } 29 | 30 | if (negative) 31 | z = 1 / z; 32 | 33 | return z; 34 | } 35 | 36 | } // namespace 37 | 38 | 39 | void 40 | testLimits() 41 | { 42 | cout << "values in std::numeric_limits\n"; 43 | 44 | cout << "min_exponent\n"; 45 | 46 | { 47 | half h (mypow (2, numeric_limits::min_exponent - 1)); 48 | assert (h.isNormalized()); 49 | } 50 | 51 | { 52 | half h (mypow (2, numeric_limits::min_exponent - 2)); 53 | assert (h.isDenormalized()); 54 | } 55 | 56 | cout << "max_exponent\n"; 57 | 58 | { 59 | half h (mypow (2, numeric_limits::max_exponent - 1)); 60 | assert (h.isNormalized()); 61 | } 62 | 63 | { 64 | half h (mypow (2, numeric_limits::max_exponent)); 65 | assert (h.isInfinity()); 66 | } 67 | 68 | cout << "min_exponent10\n"; 69 | 70 | { 71 | half h (mypow (10, numeric_limits::min_exponent10)); 72 | assert (h.isNormalized()); 73 | } 74 | 75 | { 76 | half h (mypow (10, numeric_limits::min_exponent10 - 1)); 77 | assert (h.isDenormalized()); 78 | } 79 | 80 | cout << "max_exponent10\n"; 81 | 82 | { 83 | half h (mypow (10, numeric_limits::max_exponent10)); 84 | assert (h.isNormalized()); 85 | } 86 | 87 | { 88 | half h (mypow (10, numeric_limits::max_exponent10 + 1)); 89 | assert (h.isInfinity()); 90 | } 91 | 92 | cout << "ok\n\n" << flush; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testLimits.h: -------------------------------------------------------------------------------- 1 | 2 | void testLimits (); 3 | 4 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testSize.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "half.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | using namespace std; 9 | 10 | 11 | void 12 | testSize () 13 | { 14 | cout << "size and alignment\n"; 15 | 16 | half h[2]; 17 | 18 | int size = sizeof (half); 19 | ptrdiff_t algn = (char *)&h[1] - (char *)&h[0]; 20 | 21 | cout << "sizeof (half) = " << size << endl; 22 | cout << "alignof (half) = " << (int) algn << endl; 23 | 24 | assert (size == 2 && algn == 2); 25 | 26 | cout << "ok\n\n" << flush; 27 | } 28 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/HalfTest/testSize.h: -------------------------------------------------------------------------------- 1 | 2 | void testSize (); 3 | 4 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/Iex/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (Iex) 2 | 3 | SET(IEX_SRCS 4 | Iex.h 5 | IexBaseExc.cpp 6 | IexBaseExc.h 7 | IexErrnoExc.h 8 | IexMacros.h 9 | IexMathExc.h 10 | IexThrowErrnoExc.cpp 11 | IexThrowErrnoExc.h) 12 | 13 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 14 | 15 | IF(ILMBASE_SHARED) 16 | ADD_LIBRARY(Iex SHARED ${IEX_SRCS}) 17 | ELSE(ILMBASE_SHARED) 18 | ADD_LIBRARY(Iex ${IEX_SRCS}) 19 | ENDIF(ILMBASE_SHARED) 20 | 21 | #TARGET_LINK_LIBRARIES(Iex ${LIBS}) 22 | 23 | INSTALL(TARGETS Iex 24 | RUNTIME DESTINATION bin 25 | LIBRARY DESTINATION lib 26 | ARCHIVE DESTINATION lib/static) 27 | 28 | INSTALL(FILES 29 | Iex.h 30 | IexBaseExc.h 31 | IexErrnoExc.h 32 | IexMacros.h 33 | IexMathExc.h 34 | IexThrowErrnoExc.h 35 | DESTINATION include/OpenEXR) -------------------------------------------------------------------------------- /src/nvimage/openexr/src/IexTest/testBaseExc.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | void testBaseExc(); 38 | 39 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/IlmBaseConfig.in.h: -------------------------------------------------------------------------------- 1 | // 2 | // Define and set to 1 if the target system has POSIX thread support 3 | // and you want IlmBase to use it for multithreaded file I/O. 4 | // 5 | 6 | #cmakedefine HAVE_PTHREAD 1 7 | 8 | // 9 | // Define and set to 1 if the target system supports POSIX semaphores 10 | // and you want OpenEXR to use them; otherwise, OpenEXR will use its 11 | // own semaphore implementation. 12 | // 13 | 14 | #cmakedefine HAVE_POSIX_SEMAPHORES 1 15 | 16 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/IlmImf/ImfPizCompressor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/src/IlmImf/ImfPizCompressor.cpp -------------------------------------------------------------------------------- /src/nvimage/openexr/src/IlmImf/ImfRleCompressor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/src/IlmImf/ImfRleCompressor.cpp -------------------------------------------------------------------------------- /src/nvimage/openexr/src/IlmImf/ImfZipCompressor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvimage/openexr/src/IlmImf/ImfZipCompressor.cpp -------------------------------------------------------------------------------- /src/nvimage/openexr/src/IlmThread/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (IlmThread) 2 | 3 | SET(ILMTHREAD_SRCS 4 | IlmThread.cpp 5 | IlmThread.h 6 | IlmThreadMutex.cpp 7 | IlmThreadMutex.h 8 | IlmThreadPool.cpp 9 | IlmThreadPool.h 10 | IlmThreadSemaphore.cpp 11 | IlmThreadSemaphore.h) 12 | 13 | IF(WIN32) 14 | SET(ILMTHREAD_SRCS ${ILMTHREAD_SRCS} 15 | IlmThreadMutexWin32.cpp 16 | IlmThreadSemaphoreWin32.cpp 17 | IlmThreadWin32.cpp) 18 | ELSE(WIN32) 19 | SET(ILMTHREAD_SRCS ${ILMTHREAD_SRCS} 20 | IlmThreadMutexPosix.cpp 21 | IlmThreadPosix.cpp 22 | IlmThreadSemaphorePosix.cpp 23 | IlmThreadSemaphorePosixCompat.cpp) 24 | ENDIF(WIN32) 25 | 26 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../Iex) 27 | 28 | IF(ILMBASE_SHARED) 29 | ADD_LIBRARY(IlmThread SHARED ${ILMTHREAD_SRCS}) 30 | ELSE(ILMBASE_SHARED) 31 | ADD_LIBRARY(IlmThread ${ILMTHREAD_SRCS}) 32 | ENDIF(ILMBASE_SHARED) 33 | 34 | #TARGET_LINK_LIBRARIES(IlmThread ${LIBS}) 35 | 36 | INSTALL(TARGETS IlmThread 37 | RUNTIME DESTINATION bin 38 | LIBRARY DESTINATION lib 39 | ARCHIVE DESTINATION lib/static) 40 | 41 | INSTALL(FILES 42 | IlmThread.h 43 | IlmThreadMutex.h 44 | IlmThreadPool.h 45 | IlmThreadSemaphore.h 46 | DESTINATION include/OpenEXR) 47 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/Imath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (Imath) 2 | 3 | SET(IMATH_SRCS 4 | # ImathBox.cpp 5 | ImathBox.h 6 | ImathBoxAlgo.h 7 | ImathColor.h 8 | ImathColorAlgo.cpp 9 | ImathColorAlgo.h 10 | ImathEuler.h 11 | ImathExc.h 12 | ImathFrame.h 13 | ImathFrustum.h 14 | ImathFun.cpp 15 | ImathFun.h 16 | ImathGL.h 17 | ImathGLU.h 18 | ImathHalfLimits.h 19 | ImathInt64.h 20 | ImathInterval.h 21 | ImathLimits.h 22 | ImathLine.h 23 | ImathLineAlgo.h 24 | ImathMath.h 25 | ImathMatrix.h 26 | ImathMatrixAlgo.cpp 27 | ImathMatrixAlgo.h 28 | ImathPlane.h 29 | ImathPlatform.h 30 | ImathQuat.h 31 | ImathRandom.cpp 32 | ImathRandom.h 33 | ImathRoots.h 34 | # ImathShear.cpp 35 | ImathShear.h 36 | ImathSphere.h 37 | ImathVec.cpp 38 | ImathVec.h 39 | ImathVecAlgo.h) 40 | 41 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 42 | 43 | IF(ILMBASE_SHARED) 44 | ADD_LIBRARY(Imath SHARED ${IMATH_SRCS}) 45 | ELSE(ILMBASE_SHARED) 46 | ADD_LIBRARY(Imath ${IMATH_SRCS}) 47 | ENDIF(ILMBASE_SHARED) 48 | 49 | #TARGET_LINK_LIBRARIES(Imath ${LIBS}) 50 | 51 | INSTALL(TARGETS Imath 52 | RUNTIME DESTINATION bin 53 | LIBRARY DESTINATION lib 54 | ARCHIVE DESTINATION lib/static) 55 | 56 | INSTALL(FILES 57 | ImathBox.h 58 | ImathBoxAlgo.h 59 | ImathColor.h 60 | ImathColorAlgo.h 61 | ImathEuler.h 62 | ImathExc.h 63 | ImathFrame.h 64 | ImathFrustum.h 65 | ImathFun.cpp 66 | ImathFun.h 67 | ImathGL.h 68 | ImathGLU.h 69 | ImathHalfLimits.h 70 | ImathInt64.h 71 | ImathInterval.h 72 | ImathLimits.h 73 | ImathLine.h 74 | ImathLineAlgo.h 75 | ImathMath.h 76 | ImathMatrix.h 77 | ImathMatrixAlgo.h 78 | ImathPlane.h 79 | ImathPlatform.h 80 | ImathQuat.h 81 | ImathRandom.h 82 | ImathRoots.h 83 | ImathShear.h 84 | ImathSphere.h 85 | ImathVec.h 86 | ImathVecAlgo.h 87 | DESTINATION include/OpenEXR) 88 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/Imath/ImathBox.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2004, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | #include "ImathBox.h" 36 | 37 | // this file is necessary for template instantiation on windows 38 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testBoxAlgo.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2007, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | void testBoxAlgo (); 36 | 37 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testColor.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testColor (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testExtractEuler.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testExtractEuler (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testExtractSHRT.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testExtractSHRT (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testFrustum.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | void testFrustum (); 38 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testFun.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testFun (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testInvert.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testInvert (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testLineAlgo.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2006, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | void testLineAlgo (); 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testMatrix.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testMatrix (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testQuatSetRotation.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2006, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | void testQuatSetRotation (); 37 | 38 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testQuatSlerp.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2006, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | void testQuatSlerp (); 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testRandom.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testRandom (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testRoots.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testRoots (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/ImathTest/testShear.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | 38 | void testShear (); 39 | 40 | -------------------------------------------------------------------------------- /src/nvimage/openexr/src/OpenEXRConfig.in.h: -------------------------------------------------------------------------------- 1 | // 2 | // Define and set to 1 if the target system supports a proc filesystem 3 | // compatible with the Linux kernel's proc filesystem. Note that this 4 | // is only used by a program in the IlmImfTest test suite, it's not 5 | // used by any OpenEXR library or application code. 6 | // 7 | 8 | #cmakedefine HAVE_LINUX_PROCFS 1 9 | 10 | // 11 | // Define and set to 1 if the target system is a Darwin-based system 12 | // (e.g., OS X). 13 | // 14 | 15 | #cmakedefine HAVE_DARWIN 1 16 | 17 | // 18 | // Define and set to 1 if the target system has a complete 19 | // implementation, specifically if it supports the std::right 20 | // formatter. 21 | // 22 | 23 | #cmakedefine HAVE_COMPLETE_IOMANIP 1 24 | 25 | // 26 | // Define and set to 1 if the target system has support for large 27 | // stack sizes. 28 | // 29 | 30 | #cmakedefine HAVE_LARGE_STACK 1 31 | 32 | -------------------------------------------------------------------------------- /src/nvmath/Bezier.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MATH_BEZIER_H 4 | #define NV_MATH_BEZIER_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | 12 | void evaluateCubicBezierPatch(float u, float v, const Vector3 cp[16], Vector3 * pos, Vector3 * du, Vector3 * dv); 13 | 14 | void evaluateQuadGregoryPatch(float u, float v, const Vector3 cp[20], Vector3 * pos, Vector3 * du, Vector3 * dv); 15 | 16 | void evaluateTriangleGregoryPatch(float u, float v, const Vector3 cp[15], Vector3 * pos, Vector3 * du, Vector3 * dv); 17 | 18 | void evaluateQuadPmPatch(float u, float v, const Vector3 cp[24], Vector3 * pos, Vector3 * du, Vector3 * dv); 19 | 20 | void evaluateTrianglePmPatch(float u, float v, const Vector3 cp[18], Vector3 * pos, Vector3 * du, Vector3 * dv); 21 | 22 | 23 | } // nv namespace 24 | 25 | #endif // NV_MATH_BEZIER_H 26 | -------------------------------------------------------------------------------- /src/nvmath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvmath) 2 | 3 | SET(MATH_SRCS 4 | nvmath.h 5 | Vector.h 6 | Matrix.h 7 | Quaternion.h 8 | Plane.h Plane.cpp 9 | Box.h 10 | Color.h 11 | Frustum.h Frustum.cpp 12 | Montecarlo.h Montecarlo.cpp 13 | Random.h Random.cpp 14 | SphericalHarmonic.h SphericalHarmonic.cpp 15 | Basis.h Basis.cpp 16 | Triangle.h Triangle.cpp TriBox.cpp 17 | Polygon.h Polygon.cpp 18 | TypeSerialization.h TypeSerialization.cpp 19 | Sparse.h Sparse.cpp 20 | Solver.h Solver.cpp 21 | KahanSum.h 22 | Half.h Half.cpp 23 | Fitting.h Fitting.cpp 24 | Bezier.h Bezier.cpp) 25 | 26 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 27 | 28 | # targets 29 | ADD_DEFINITIONS(-DNVMATH_EXPORTS) 30 | 31 | IF(NVMATH_SHARED) 32 | ADD_LIBRARY(nvmath SHARED ${MATH_SRCS}) 33 | ELSE(NVMATH_SHARED) 34 | ADD_LIBRARY(nvmath ${MATH_SRCS}) 35 | ENDIF(NVMATH_SHARED) 36 | 37 | TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore) 38 | 39 | INSTALL(TARGETS nvmath 40 | RUNTIME DESTINATION bin 41 | LIBRARY DESTINATION lib 42 | ARCHIVE DESTINATION lib/static) 43 | -------------------------------------------------------------------------------- /src/nvmath/Fitting.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- icastano@gmail.com 2 | 3 | #ifndef NV_MATH_FITTING_H 4 | #define NV_MATH_FITTING_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace nv 11 | { 12 | namespace Fit 13 | { 14 | Vector3 computeCentroid(int n, const Vector3 * points); 15 | Vector3 computeCentroid(int n, const Vector3 * points, const float * weights, Vector3::Arg metric); 16 | 17 | Vector3 computeCovariance(int n, const Vector3 * points, float * covariance); 18 | Vector3 computeCovariance(int n, const Vector3 * points, const float * weights, Vector3::Arg metric, float * covariance); 19 | 20 | Vector3 computePrincipalComponent(int n, const Vector3 * points); 21 | Vector3 computePrincipalComponent(int n, const Vector3 * points, const float * weights, Vector3::Arg metric); 22 | 23 | Plane bestPlane(int n, const Vector3 * points); 24 | 25 | // Returns number of clusters [1-4]. 26 | int compute4Means(int n, const Vector3 * points, const float * weights, Vector3::Arg metric, Vector3 * cluster); 27 | } 28 | 29 | } // nv namespace 30 | 31 | #endif // NV_MATH_FITTING_H 32 | -------------------------------------------------------------------------------- /src/nvmath/Frustum.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MATH_FRUSTUM_H 4 | #define NV_MATH_FRUSTUM_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class Box; 11 | 12 | class NVMATH_CLASS Frustum 13 | { 14 | public: 15 | // Construct a frustum from typical view parameters. fovy has the same meaning as for glut_perspective_reshaper. 16 | // The resulting frustum is centred at the origin, pointing along the z-axis. 17 | Frustum() {} 18 | Frustum(float fovy, float aspect, float near, float far); 19 | 20 | // Unlike some intersection methods, we don't bother to distinguish intersects 21 | // from contains. A true result could indicate either. 22 | bool intersects(const Box&) const; 23 | 24 | private: 25 | friend Frustum transformFrustum(const Matrix&, const Frustum&); 26 | 27 | enum PlaneIndices { NEAR, LEFT, RIGHT, TOP, BOTTOM, FAR, PLANE_COUNT }; 28 | Plane planes[PLANE_COUNT]; 29 | }; 30 | 31 | Frustum transformFrustum(const Matrix&, const Frustum&); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/nvmath/Half.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_MATH_HALF_H 2 | #define NV_MATH_HALF_H 3 | 4 | #include 5 | 6 | uint32 half_to_float( uint16 h ); 7 | uint16 half_from_float( uint32 f ); 8 | 9 | #endif /* NV_MATH_HALF_H */ 10 | -------------------------------------------------------------------------------- /src/nvmath/KahanSum.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MATH_KAHANSUM_H 4 | #define NV_MATH_KAHANSUM_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | class KahanSum 12 | { 13 | public: 14 | KahanSum() : accum(0.0f), err(0) {}; 15 | 16 | void add(float f) 17 | { 18 | float compensated = f + err; 19 | float tmp = accum + compensated; 20 | err = accum - tmp; 21 | err += compensated; 22 | accum = tmp; 23 | } 24 | 25 | float sum() const 26 | { 27 | return accum; 28 | } 29 | 30 | private: 31 | float accum; 32 | float err; 33 | }; 34 | 35 | } // nv namespace 36 | 37 | 38 | #endif // NV_MATH_KAHANSUM_H 39 | -------------------------------------------------------------------------------- /src/nvmath/Matrix.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Matrix.h -------------------------------------------------------------------------------- /src/nvmath/Plane.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Plane.h" 4 | #include "Matrix.h" 5 | 6 | namespace nv 7 | { 8 | Plane transformPlane(const Matrix& m, Plane::Arg p) 9 | { 10 | Vector3 newVec = transformVector(m, p.vector()); 11 | 12 | Vector3 ptInPlane = p.offset() * p.vector(); 13 | ptInPlane = transformPoint(m, ptInPlane); 14 | 15 | return Plane(newVec, ptInPlane); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/nvmath/Polygon.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Polygon.cpp -------------------------------------------------------------------------------- /src/nvmath/Polygon.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Polygon.h -------------------------------------------------------------------------------- /src/nvmath/Random.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | #include 5 | 6 | using namespace nv; 7 | 8 | 9 | /// Get a random seed based on the current time. 10 | uint Rand::randomSeed() 11 | { 12 | return (uint)time(NULL); 13 | } 14 | 15 | 16 | void MTRand::initialize( uint32 seed ) 17 | { 18 | // Initialize generator state with seed 19 | // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. 20 | // In previous versions, most significant bits (MSBs) of the seed affect 21 | // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. 22 | uint32 *s = state; 23 | uint32 *r = state; 24 | int i = 1; 25 | *s++ = seed & 0xffffffffUL; 26 | for( ; i < N; ++i ) 27 | { 28 | *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL; 29 | r++; 30 | } 31 | } 32 | 33 | 34 | void MTRand::reload() 35 | { 36 | // Generate N new values in state 37 | // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) 38 | uint32 *p = state; 39 | int i; 40 | for( i = N - M; i--; ++p ) 41 | *p = twist( p[M], p[0], p[1] ); 42 | for( i = M; --i; ++p ) 43 | *p = twist( p[M-N], p[0], p[1] ); 44 | *p = twist( p[M-N], p[0], state[0] ); 45 | 46 | left = N, next = state; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/nvmath/Solver.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Solver.cpp -------------------------------------------------------------------------------- /src/nvmath/Solver.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MATH_SOLVER_H 4 | #define NV_MATH_SOLVER_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | // Linear solvers. 12 | NVMATH_API void LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f); 13 | NVMATH_API void LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, const uint * lockedParameters, uint lockedCount, float epsilon = 1e-5f); 14 | NVMATH_API void SymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f); 15 | // NVMATH_API void NonSymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f); 16 | 17 | } // nv namespace 18 | 19 | 20 | #endif // NV_MATH_SOLVER_H 21 | -------------------------------------------------------------------------------- /src/nvmath/Sparse.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Sparse.cpp -------------------------------------------------------------------------------- /src/nvmath/TriBox.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/TriBox.cpp -------------------------------------------------------------------------------- /src/nvmath/Triangle.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Triangle.cpp -------------------------------------------------------------------------------- /src/nvmath/Triangle.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmath/Triangle.h -------------------------------------------------------------------------------- /src/nvmath/TypeSerialization.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | using namespace nv; 15 | 16 | Stream & nv::operator<< (Stream & s, Vector2 & v) 17 | { 18 | float x = v.x(); 19 | float y = v.y(); 20 | 21 | s << x << y; 22 | 23 | if (s.isLoading()) 24 | { 25 | v.set(x, y); 26 | } 27 | 28 | return s; 29 | } 30 | 31 | Stream & nv::operator<< (Stream & s, Vector3 & v) 32 | { 33 | float x = v.x(); 34 | float y = v.y(); 35 | float z = v.z(); 36 | 37 | s << x << y << z; 38 | 39 | if (s.isLoading()) 40 | { 41 | v.set(x, y, z); 42 | } 43 | 44 | return s; 45 | } 46 | 47 | Stream & nv::operator<< (Stream & s, Vector4 & v) 48 | { 49 | float x = v.x(); 50 | float y = v.y(); 51 | float z = v.z(); 52 | float w = v.w(); 53 | 54 | s << x << y << z << w; 55 | 56 | if (s.isLoading()) 57 | { 58 | v.set(x, y, z, w); 59 | } 60 | 61 | return s; 62 | } 63 | 64 | Stream & nv::operator<< (Stream & s, Matrix & m) 65 | { 66 | return s; 67 | } 68 | 69 | Stream & nv::operator<< (Stream & s, Quaternion & q) 70 | { 71 | return s << q.asVector(); 72 | } 73 | 74 | Stream & nv::operator<< (Stream & s, Basis & basis) 75 | { 76 | return s << basis.tangent << basis.bitangent << basis.normal; 77 | } 78 | 79 | Stream & nv::operator<< (Stream & s, Box & box) 80 | { 81 | return s << box.m_mins << box.m_maxs; 82 | } 83 | 84 | Stream & nv::operator<< (Stream & s, Plane & plane) 85 | { 86 | return s << plane.asVector(); 87 | } 88 | -------------------------------------------------------------------------------- /src/nvmath/TypeSerialization.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MATH_TYPESERIALIZATION_H 4 | #define NV_MATH_TYPESERIALIZATION_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class Stream; 11 | 12 | class Vector2; 13 | class Vector3; 14 | class Vector4; 15 | 16 | class Matrix; 17 | class Quaternion; 18 | class Basis; 19 | class Box; 20 | class Plane; 21 | 22 | NVMATH_API Stream & operator<< (Stream & s, Vector2 & obj); 23 | NVMATH_API Stream & operator<< (Stream & s, Vector3 & obj); 24 | NVMATH_API Stream & operator<< (Stream & s, Vector4 & obj); 25 | 26 | NVMATH_API Stream & operator<< (Stream & s, Matrix & obj); 27 | NVMATH_API Stream & operator<< (Stream & s, Quaternion & obj); 28 | NVMATH_API Stream & operator<< (Stream & s, Basis & obj); 29 | NVMATH_API Stream & operator<< (Stream & s, Box & obj); 30 | NVMATH_API Stream & operator<< (Stream & s, Plane & obj); 31 | 32 | } // nv namespace 33 | 34 | #endif // NV_MATH_TYPESERIALIZATION_H 35 | -------------------------------------------------------------------------------- /src/nvmesh/BaseMesh.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | 5 | #include "BaseMesh.h" 6 | 7 | 8 | namespace nv 9 | { 10 | static Stream & operator<< (Stream & s, BaseMesh::Vertex & vertex) 11 | { 12 | return s << vertex.id << vertex.pos << vertex.nor << vertex.tex; 13 | } 14 | 15 | Stream & operator<< (Stream & s, BaseMesh & mesh) 16 | { 17 | return s << mesh.m_vertexArray; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/nvmesh/BaseMesh.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_BASEMESH_H 4 | #define NV_MESH_BASEMESH_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace nv 11 | { 12 | 13 | /// Base mesh without connectivity. 14 | class BaseMesh 15 | { 16 | public: 17 | struct Vertex; 18 | 19 | BaseMesh() {} 20 | 21 | BaseMesh(uint vertexNum) : 22 | m_vertexArray(vertexNum) {} 23 | 24 | // Vertex methods. 25 | uint vertexCount() const { return m_vertexArray.count(); } 26 | const Vertex & vertexAt(uint i) const { return m_vertexArray[i]; } 27 | Vertex & vertexAt(uint i) { return m_vertexArray[i]; } 28 | const Array & vertices() const { return m_vertexArray; } 29 | Array & vertices() { return m_vertexArray; } 30 | 31 | friend Stream & operator<< (Stream & s, BaseMesh & obj); 32 | 33 | protected: 34 | 35 | Array m_vertexArray; 36 | }; 37 | 38 | 39 | /// BaseMesh vertex. 40 | struct BaseMesh::Vertex 41 | { 42 | Vertex() : id(NIL), pos(zero), nor(zero), tex(zero) {} 43 | 44 | uint id; // @@ Vertex should be an index into the vertex data. 45 | Vector3 pos; 46 | Vector3 nor; 47 | Vector2 tex; 48 | }; 49 | 50 | inline bool operator==(const BaseMesh::Vertex & a, const BaseMesh::Vertex & b) 51 | { 52 | return a.pos == b.pos && a.nor == b.nor && a.tex == b.tex; 53 | } 54 | 55 | inline bool operator!=(const BaseMesh::Vertex & a, const BaseMesh::Vertex & b) 56 | { 57 | return a.pos != b.pos && a.nor != b.nor && a.tex != b.tex; 58 | } 59 | 60 | template <> struct hash 61 | { 62 | uint operator()(const BaseMesh::Vertex & v) const 63 | { 64 | return hash()(v.pos); 65 | } 66 | }; 67 | 68 | } // nv namespace 69 | 70 | #endif // NV_MESH_BASEMESH_H 71 | -------------------------------------------------------------------------------- /src/nvmesh/MeshAdjacency.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "MeshAdjacency.h" 4 | 5 | using namespace nv; 6 | 7 | void TriMeshAdjacency::buildAdjacency(TriMesh * mesh) 8 | { 9 | nvCheck(mesh != NULL); 10 | 11 | // Check out Eric Lengyel's code. 12 | 13 | } 14 | 15 | 16 | // Proximal methods. 17 | void TriMeshAdjacency::computeProximals() 18 | { 19 | } 20 | 21 | void TriMeshAdjacency::addProximal(uint r, uint v) 22 | { 23 | } 24 | 25 | bool TriMeshAdjacency::hasProximal(uint v) const 26 | { 27 | return false; 28 | } 29 | 30 | uint TriMeshAdjacency::countProximals(uint v) const 31 | { 32 | return 1; 33 | } 34 | 35 | uint TriMeshAdjacency::firstProximal(uint v) const 36 | { 37 | return v; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/nvmesh/MeshSmoothGroup.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_SMOOTHGROUP_H 4 | #define NV_MESH_SMOOTHGROUP_H 5 | 6 | namespace nv 7 | { 8 | 9 | /// Smooth group info can be represented in different ways. 10 | /// - MAX style smooth groups. 11 | /// - OBJ style smooth groups. 12 | /// - Creases. 13 | /// - Tagged meshes. 14 | class MeshSmoothGroup 15 | { 16 | public: 17 | MeshSmoothGroup(uint faceNum, uint edgeNum); 18 | ~MeshSmoothGroup(); 19 | 20 | uint group(uint face); 21 | bool crease(uint edge); 22 | 23 | public: 24 | bool useMaxStyleGroups; 25 | }; 26 | 27 | } // nv namespace 28 | 29 | #endif // NV_MESH_SMOOTHGROUP_H 30 | -------------------------------------------------------------------------------- /src/nvmesh/MeshTopology.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_MESHTOPOLOGY_H 4 | #define NV_MESH_MESHTOPOLOGY_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | namespace HalfEdge { class Mesh; } 11 | class MeshAdjacency; 12 | 13 | /// Mesh topology information. 14 | class MeshTopology 15 | { 16 | public: 17 | MeshTopology(const HalfEdge::Mesh * mesh) { buildTopologyInfo(mesh); } 18 | 19 | /// Determine if the mesh is connected. 20 | bool isConnected() const { return m_connectedCount == 1; } 21 | 22 | /// Determine if the mesh is closed. (Each edge is shared by two faces) 23 | bool isClosed() const { return m_boundaryCount == 0; } 24 | 25 | /// Return true if the mesh has the topology of a disk. 26 | bool isDisk() const { return isConnected() && m_boundaryCount == 1/* && m_eulerNumber == 1*/; } 27 | 28 | /// Return the number of connected components. 29 | int connectedCount() const { return m_connectedCount; } 30 | 31 | /// Return the number of open holes. 32 | int holeCount() const { return m_boundaryCount; } 33 | 34 | /// Return the genus of the mesh. 35 | int genus() const { return m_genus; } 36 | 37 | /// Return the euler number of the mesh. 38 | int euler() const { return m_eulerNumber; } 39 | 40 | 41 | static bool isQuadOnly(const HalfEdge::Mesh * mesh); 42 | 43 | 44 | private: 45 | 46 | NVMESH_API void buildTopologyInfo(const HalfEdge::Mesh * mesh); 47 | 48 | private: 49 | 50 | ///< Number of boundary loops. 51 | int m_boundaryCount; 52 | 53 | ///< Number of connected components. 54 | int m_connectedCount; 55 | 56 | ///< Euler number. 57 | int m_eulerNumber; 58 | 59 | /// Mesh genus. 60 | int m_genus; 61 | }; 62 | 63 | } // nv namespace 64 | 65 | #endif // NV_MESH_MESHTOPOLOGY_H 66 | -------------------------------------------------------------------------------- /src/nvmesh/PolyMesh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace nv; 4 | 5 | 6 | TriMesh * toTriMesh(bool triangulate) 7 | { 8 | return NULL; 9 | } 10 | 11 | QuadTriMesh * toQuadTriMesh() 12 | { 13 | return NULL; 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/nvmesh/PolyMesh.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_POLYMESH_H 4 | #define NV_MESH_POLYMESH_H 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace nv 12 | { 13 | class TriMesh; 14 | class QuadTriMesh; 15 | 16 | 17 | /// Polygon mesh. 18 | class PolyMesh : public BaseMesh 19 | { 20 | public: 21 | struct Face; 22 | typedef BaseMesh::Vertex Vertex; 23 | 24 | PolyMesh(uint indexCount, uint faceCount, uint vertexCount) : 25 | BaseMesh(vertexCount), 26 | m_indexArray(indexCount), m_faceArray(faceCount) {} 27 | 28 | // Face methods. 29 | uint faceCount() const { return m_faceArray.count(); } 30 | const Face & faceAt(uint i) const { return m_faceArray[i]; } 31 | const Array & faces() const { return m_faceArray; } 32 | 33 | // Conversion. 34 | TriMesh * toTriMesh(bool triangulate); 35 | QuadTriMesh * toQuadTriMesh(); 36 | 37 | friend Stream & operator<< (Stream & s, PolyMesh & obj); 38 | 39 | private: 40 | 41 | Array m_indexArray; 42 | Array m_faceArray; 43 | 44 | }; 45 | 46 | 47 | /// PolyMesh face. 48 | struct PolyMesh::Face 49 | { 50 | uint id; 51 | uint first, num; 52 | }; 53 | 54 | } // nv namespace 55 | 56 | #endif // NV_MESH_POLYMESH_H 57 | -------------------------------------------------------------------------------- /src/nvmesh/QuadTriMesh.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "QuadTriMesh.h" 4 | 5 | using namespace nv; 6 | 7 | 8 | bool QuadTriMesh::isQuadFace(uint i) const 9 | { 10 | return m_faceArray[i].isQuadFace(); 11 | } 12 | 13 | const QuadTriMesh::Vertex & QuadTriMesh::faceVertex(uint f, uint v) const 14 | { 15 | if (isQuadFace(f)) nvDebugCheck(v < 4); 16 | else nvDebugCheck(v < 3); 17 | 18 | const Face & face = this->faceAt(f); 19 | return this->vertexAt(face.v[v]); 20 | } 21 | 22 | 23 | namespace nv 24 | { 25 | static Stream & operator<< (Stream & s, QuadTriMesh::Face & face) 26 | { 27 | return s << face.id << face.v[0] << face.v[1] << face.v[2] << face.v[3]; 28 | } 29 | 30 | Stream & operator<< (Stream & s, QuadTriMesh & mesh) 31 | { 32 | return s << mesh.m_faceArray << (BaseMesh &) mesh; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/nvmesh/QuadTriMesh.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_QUADTRIMESH_H 4 | #define NV_MESH_QUADTRIMESH_H 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace nv 12 | { 13 | class Stream; 14 | 15 | /// Mixed quad/triangle mesh. 16 | class QuadTriMesh : public BaseMesh 17 | { 18 | public: 19 | struct Face; 20 | typedef BaseMesh::Vertex Vertex; 21 | 22 | QuadTriMesh() {}; 23 | 24 | QuadTriMesh(uint faceCount, uint vertexCount) : 25 | BaseMesh(vertexCount), 26 | m_faceArray(faceCount) {} 27 | 28 | // Face methods. 29 | uint faceCount() const { return m_faceArray.count(); } 30 | 31 | const Face & faceAt(uint i) const { return m_faceArray[i]; } 32 | Face & faceAt(uint i) { return m_faceArray[i]; } 33 | 34 | const Array & faces() const { return m_faceArray; } 35 | Array & faces() { return m_faceArray; } 36 | 37 | bool isQuadFace(uint i) const; 38 | 39 | const Vertex & faceVertex(uint f, uint v) const; 40 | 41 | friend Stream & operator<< (Stream & s, QuadTriMesh & obj); 42 | 43 | private: 44 | 45 | Array m_faceArray; 46 | 47 | }; 48 | 49 | 50 | /// QuadTriMesh face. 51 | struct QuadTriMesh::Face 52 | { 53 | uint id; 54 | uint v[4]; 55 | 56 | bool isQuadFace() const { return v[3] != NIL; } 57 | }; 58 | 59 | } // nv namespace 60 | 61 | 62 | #endif // NV_MESH_QUADTRIMESH_H 63 | -------------------------------------------------------------------------------- /src/nvmesh/TriMesh.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "TriMesh.h" 4 | 5 | using namespace nv; 6 | 7 | 8 | /// Triangle mesh. 9 | Vector3 TriMesh::faceNormal(uint f) const 10 | { 11 | const Face & face = this->faceAt(f); 12 | const Vector3 & p0 = this->vertexAt(face.v[0]).pos; 13 | const Vector3 & p1 = this->vertexAt(face.v[1]).pos; 14 | const Vector3 & p2 = this->vertexAt(face.v[2]).pos; 15 | return normalizeSafe(cross(p1 - p0, p2 - p0), Vector3(zero), 0.0f); 16 | } 17 | 18 | /// Get face vertex. 19 | const TriMesh::Vertex & TriMesh::faceVertex(uint f, uint v) const 20 | { 21 | nvDebugCheck(v < 3); 22 | const Face & face = this->faceAt(f); 23 | return this->vertexAt(face.v[v]); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/nvmesh/TriMesh.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_TRIMESH_H 4 | #define NV_MESH_TRIMESH_H 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace nv 12 | { 13 | /// Triangle mesh. 14 | class TriMesh : public BaseMesh 15 | { 16 | public: 17 | struct Face; 18 | typedef BaseMesh::Vertex Vertex; 19 | 20 | TriMesh(uint faceCount, uint vertexCount) : 21 | BaseMesh(vertexCount), 22 | m_faceArray(faceCount) {} 23 | 24 | // Face methods. 25 | uint faceCount() const { return m_faceArray.count(); } 26 | const Face & faceAt(uint i) const { return m_faceArray[i]; } 27 | Face & faceAt(uint i) { return m_faceArray[i]; } 28 | const Array & faces() const { return m_faceArray; } 29 | Array & faces() { return m_faceArray; } 30 | 31 | NVMESH_API Vector3 faceNormal(uint f) const; 32 | NVMESH_API const Vertex & faceVertex(uint f, uint v) const; 33 | 34 | friend Stream & operator<< (Stream & s, BaseMesh & obj); 35 | 36 | private: 37 | 38 | Array m_faceArray; 39 | 40 | }; 41 | 42 | 43 | /// TriMesh face. 44 | struct TriMesh::Face 45 | { 46 | uint id; 47 | uint v[3]; 48 | }; 49 | 50 | } // nv namespace 51 | 52 | #endif // NV_MESH_TRIMESH_H 53 | -------------------------------------------------------------------------------- /src/nvmesh/animation/Bone.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_BONE_H 4 | #define NV_MESH_BONE_H 5 | 6 | #include 7 | #include 8 | 9 | 10 | namespace nv 11 | { 12 | /// Build bone matrix from quatertion and offset. 13 | inline Matrix boneMatrix(Quaternion::Arg q, Vector3::Arg offset) 14 | { 15 | // calculate coefficients 16 | float x2 = 2 * q.x(); 17 | float y2 = 2 * q.y(); 18 | float z2 = 2 * q.z(); 19 | 20 | float xx, xy, xz, yy, yz, zz, wx, wy, wz; 21 | xx = q.x() * x2; xy = q.x() * y2; xz = q.x() * z2; 22 | yy = q.y() * y2; yz = q.y() * z2; zz = q.z() * z2; 23 | wx = q.w() * x2; wy = q.w() * y2; wz = q.w() * z2; 24 | 25 | Matrix m; 26 | m.data(0) = 1.0f - (yy + zz); 27 | m.data(1) = xy - wz; 28 | m.data(2) = xz + wy; 29 | m.data(3) = 0.0f; 30 | 31 | m.data(4) = xy + wz; 32 | m.data(5) = 1.0f - (xx + zz); 33 | m.data(6) = yz - wx; 34 | m.data(7) = 0.0f; 35 | 36 | m.data(8) = xz - wy; 37 | m.data(9) = yz + wx; 38 | m.data(10) = 1.0f - (xx + yy); 39 | m.data(11) = 0.0f; 40 | 41 | m.data(12) = offset.x(); 42 | m.data(13) = offset.y(); 43 | m.data(14) = offset.z(); 44 | m.data(15) = 1.0f; 45 | 46 | return m; 47 | } 48 | } 49 | 50 | 51 | #endif // NV_MESH_BONE_H 52 | -------------------------------------------------------------------------------- /src/nvmesh/export/MeshExportOBJ.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #ifndef NV_MESH_EXPORTOBJ_H 4 | #define NV_MESH_EXPORTOBJ_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class Stream; 11 | namespace HalfEdge { class Mesh; } 12 | 13 | bool exportMesh(const HalfEdge::Mesh * mesh, const char * name); 14 | 15 | bool exportMesh_OBJ(const HalfEdge::Mesh * mesh, Stream * stream); 16 | 17 | } // nv namespace 18 | 19 | #endif // NV_MESH_EXPORTOBJ_H 20 | -------------------------------------------------------------------------------- /src/nvmesh/geometry/Bounds.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace nv; 10 | 11 | Box MeshBounds::box(const BaseMesh * mesh) 12 | { 13 | nvCheck(mesh != NULL); 14 | 15 | Box bounds; 16 | bounds.clearBounds(); 17 | 18 | const uint vertexCount = mesh->vertexCount(); 19 | for (uint v = 0; v < vertexCount; v++) 20 | { 21 | const BaseMesh::Vertex & vertex = mesh->vertexAt(v); 22 | bounds.addPointToBounds( vertex.pos ); 23 | } 24 | 25 | return bounds; 26 | } 27 | 28 | Box MeshBounds::box(const HalfEdge::Mesh * mesh) 29 | { 30 | nvCheck(mesh != NULL); 31 | 32 | Box bounds; 33 | bounds.clearBounds(); 34 | 35 | const uint vertexCount = mesh->vertexCount(); 36 | for (uint v = 0; v < vertexCount; v++) 37 | { 38 | const HalfEdge::Vertex * vertex = mesh->vertexAt(v); 39 | nvDebugCheck(vertex != NULL); 40 | bounds.addPointToBounds( vertex->pos() ); 41 | } 42 | 43 | return bounds; 44 | } 45 | 46 | 47 | // TODO: Implement miniBall for bounding spheres: 48 | // http://www.flipcode.com/archives/Smallest_Enclosing_Spheres.shtml 49 | -------------------------------------------------------------------------------- /src/nvmesh/geometry/Bounds.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_MESHBOUNDS_H 4 | #define NV_MESH_MESHBOUNDS_H 5 | 6 | //#include 7 | #include 8 | 9 | #include 10 | 11 | namespace nv 12 | { 13 | class BaseMesh; 14 | namespace HalfEdge { class Mesh; } 15 | 16 | /// Bounding volumes computation. 17 | namespace MeshBounds 18 | { 19 | // Sphere sphere(const Mesh & mesh); 20 | Box box(const BaseMesh * mesh); 21 | Box box(const HalfEdge::Mesh * mesh); 22 | } 23 | 24 | } // nv namespace 25 | 26 | #endif // NV_MESH_MESHBOUNDS_H 27 | -------------------------------------------------------------------------------- /src/nvmesh/geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | #SUBDIRS(StanHull) 3 | -------------------------------------------------------------------------------- /src/nvmesh/geometry/MeshNormals.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/geometry/MeshNormals.cpp -------------------------------------------------------------------------------- /src/nvmesh/geometry/MeshNormals.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_NORMALS_H 4 | #define NV_MESH_NORMALS_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | namespace HalfEdge 11 | { 12 | class Mesh; 13 | class Vertex; 14 | class Edge; 15 | } 16 | 17 | class MeshSmoothGroup; 18 | class BaseMesh; 19 | class TriMesh; 20 | class QuadTriMesh; 21 | 22 | enum NormalFlags 23 | { 24 | WeightFaceArea = 0x01, 25 | WeightFaceAngle = 0x02 26 | }; 27 | 28 | namespace MeshNormals 29 | { 30 | bool hasNormals(const BaseMesh * mesh); 31 | 32 | void computeNormals(TriMesh * mesh, uint flags); 33 | void computeNormals(QuadTriMesh * mesh, uint flags); 34 | // void computeNormals(HalfEdge::Mesh * mesh, NormalFlags flags, MeshSmoothGroup * meshSmoothGroup = NULL); 35 | // void computeNormals(TriMesh * mesh, NormalFlags flags, MeshSmoothGroup * meshSmoothGroup = NULL); 36 | 37 | // @@ Not implemented: 38 | //void computeCreasedNormals(HalfEdge::Mesh * mesh, bool weightFaceArea, bool weightFaceAngle, MeshSmoothGroup * meshSmoothGroup = NULL); 39 | 40 | // @@ These functions should be moved to subdiv/LimitSurface.h 41 | 42 | void computeLoopNormals(HalfEdge::Mesh * mesh); 43 | void computeCatmullClarkNormals(HalfEdge::Mesh * mesh); 44 | 45 | Vector3 computeCatmullClarkNormal(const HalfEdge::Vertex * vertex); 46 | Vector3 computeCatmullClarkTangent(const HalfEdge::Edge * edge); 47 | 48 | } // MeshNormals namespace 49 | 50 | } // nv namespace 51 | 52 | #endif // NV_MESH_NORMALS_H 53 | -------------------------------------------------------------------------------- /src/nvmesh/geometry/MeshTransform.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_MESHTRANSFORM_H 4 | #define NV_MESH_MESHTRANSFORM_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class BaseMesh; 11 | namespace HalfEdge { class Mesh; } 12 | class Vector3; 13 | class Matrix; 14 | class Box; 15 | 16 | namespace MeshTransform 17 | { 18 | NVMESH_API void transform(HalfEdge::Mesh * mesh, const Matrix & matrix); 19 | NVMESH_API float fitBox(HalfEdge::Mesh * mesh, const Box & box); 20 | NVMESH_API void translate(HalfEdge::Mesh * mesh, const Vector3 & v); 21 | //NVMESH_API void flipAxis(HalfEdge::Mesh * mesh, int a, int b, int c); 22 | 23 | NVMESH_API void transform(BaseMesh * mesh, const Matrix & matrix); 24 | NVMESH_API float fitBox(BaseMesh * mesh, const Box & box); 25 | NVMESH_API void translate(BaseMesh * mesh, const Vector3 & v); 26 | } 27 | 28 | } // nv namespace 29 | 30 | 31 | #endif // NV_MESH_MESHTRANSFORM_H 32 | -------------------------------------------------------------------------------- /src/nvmesh/geometry/TangentSpace.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_TANGENTS_H 4 | #define NV_MESH_TANGENTS_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | class TriMesh; 12 | namespace HalfEdge { class Mesh; class Vertex; } 13 | 14 | namespace geometry 15 | { 16 | void computeMeshTangents(const TriMesh * mesh, Array & meshBasis); 17 | void computeLeastSquaresMeshTangents(const TriMesh * mesh, Array & meshBasis); 18 | 19 | void computeMeshTangents(const HalfEdge::Mesh * mesh, Array & meshBasis); 20 | void computeCatmullClarkTangents(const HalfEdge::Mesh * mesh, Array & meshBasis); 21 | 22 | void computeConformalMeshTangents(const HalfEdge::Mesh * mesh, Array & meshBasis); 23 | void computeConformalCatmullClarkTangents(const HalfEdge::Mesh * mesh, Array & meshBasis); 24 | 25 | void computeLengyelTangentBasis(const HalfEdge::Vertex * vertex, Basis * basis); 26 | void computeLeastSquaresTangentBasis(const HalfEdge::Vertex * vertex, Basis * basis); 27 | 28 | } // MeshTangents namespace 29 | 30 | } // nv namespace 31 | 32 | #endif // NV_MESH_TANGENTS_H 33 | -------------------------------------------------------------------------------- /src/nvmesh/halfedge/HalfEdge.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "HalfEdge.h" 4 | #include "HalfEdgeVertex.h" 5 | 6 | using namespace nv; 7 | 8 | Vector3 HalfEdge::Edge::midPoint() const 9 | { 10 | return (to()->pos() + from()->pos()) * 0.5f; 11 | } 12 | 13 | float HalfEdge::Edge::length() const 14 | { 15 | return ::length(to()->pos() - from()->pos()); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/nvmesh/import/ColladaFile.h: -------------------------------------------------------------------------------- 1 | // Add Collada import code here. 2 | -------------------------------------------------------------------------------- /src/nvmesh/import/MD5File.h: -------------------------------------------------------------------------------- 1 | // Add md5mesh/md5anim import code here. 2 | // 3 | // References: 4 | // 5 | // - MD5Mesh and MD5Anim files formats 6 | // http://tfc.duke.free.fr/coding/md5-specs-en.html 7 | // 8 | // - MD5ANIM (file format) 9 | // http://www.modwiki.net/wiki/MD5ANIM_(file_format) 10 | // 11 | // - Doom 3 md5mesh and md5anim Sample Code 12 | // http://socratis.dyndns.org/md5/index.shtml 13 | // 14 | // - http://tfcduke.developpez.com/tutoriel/format/md5/fichiers/ 15 | // 16 | // - http://www.nowan.net/cb/3d/ 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImport.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_H 4 | #define NV_MESH_IMPORT_H 5 | 6 | #include 7 | #include 8 | 9 | // This doesn't work on MSVC! 10 | #define NV_REGISTER_MESH_IMPORT_FACTORY(Factory) \ 11 | namespace { \ 12 | static Factory factory##Factory; \ 13 | struct Factory##Registrar { \ 14 | Factory##Registrar() { MeshImportFactory::addFactory(&factory##Factory); } \ 15 | ~Factory##Registrar() { MeshImportFactory::removeFactory(&factory##Factory); } \ 16 | }; \ 17 | static Factory##Registrar registrar##Factory; \ 18 | } 19 | 20 | namespace nv 21 | { 22 | class Stream; 23 | class Skeleton; 24 | 25 | /// Mesh importer. 26 | class MeshImport 27 | { 28 | public: 29 | virtual bool import(Stream * stream) = 0; 30 | 31 | const MeshBuilder & builder() const { return m_builder; }; 32 | 33 | // @@ This is not very clean, the importer has ownership of the skeleton. 34 | virtual const Skeleton * skeleton() const { return NULL; }; 35 | 36 | static MeshImport * importer(const char * fileName); 37 | 38 | protected: 39 | MeshBuilder m_builder; 40 | }; 41 | 42 | /// Factory of mesh importers. 43 | class MeshImportFactory 44 | { 45 | public: 46 | virtual const char * extension() const = 0; 47 | virtual MeshImport * createImporter() const = 0; 48 | 49 | // static MeshImport * findMeshImportByName(const char * name); 50 | // static MeshImport * findMeshImportFor(const char * fileName); 51 | 52 | static void addFactory(const MeshImportFactory * factory); 53 | static void removeFactory(const MeshImportFactory * factory); 54 | }; 55 | 56 | } // nv namespace 57 | 58 | #endif // NV_MESH_IMPORT_H 59 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportHeightMap.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "MeshImportHeightMap.h" 9 | 10 | 11 | #define SCALE_X 0.1f 12 | #define SCALE_Y 0.1f 13 | #define SCALE_Z 0.03f 14 | 15 | 16 | using namespace nv; 17 | 18 | 19 | /// Import a heightmap mesh. 20 | bool MeshImportHeightMap::import(Stream * stream) 21 | { 22 | m_builder.reset(); 23 | 24 | return false; 25 | 26 | // @@ Need image file name! 27 | Image * height_map = ImageIO::load("???", *stream); 28 | 29 | if (height_map == NULL) 30 | { 31 | // Image type not recognized. 32 | return false; 33 | } 34 | 35 | const uint w = height_map->width; 36 | const uint h = height_map->height; 37 | 38 | for (uint y = 0; y < h; y++) 39 | { 40 | for (uint x = 0; x < w; x++) 41 | { 42 | float z = height_map->pixel(x, y).a; 43 | m_builder.addPosition(Vector3(SCALE_X * x, SCALE_Y * y, SCALE_Z * z)); 44 | } 45 | } 46 | 47 | for (uint y = 0; y < h-1; y++) 48 | { 49 | for (uint x = 0; x < w-1; x++) 50 | { 51 | m_builder.addTriangle(y*w+x, y*w+x+1, (y+1)*w+x); 52 | m_builder.addTriangle((y+1)*w+x, y*w+x+1, (y+1)*w+x+1); 53 | } 54 | } 55 | 56 | m_builder.done(); 57 | 58 | return true; 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportHeightMap.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_HEIGHTMAP_H 4 | #define NV_MESH_IMPORT_HEIGHTMAP_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | /// Heightmap mesh importer. 12 | class MeshImportHeightMap : public MeshImport 13 | { 14 | public: 15 | virtual bool import(Stream * stream); 16 | }; 17 | 18 | } // nv namespace 19 | 20 | #endif // NV_MESH_IMPORT_HEIGHTMAP_H 21 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportM.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "MeshImportM.h" 9 | 10 | using namespace nv; 11 | 12 | 13 | /// Import an M mesh. 14 | bool MeshImportM::import(Stream * stream) 15 | { 16 | Tokenizer parser(stream); 17 | 18 | m_builder.reset(); 19 | 20 | try { 21 | HashMap indexMap(100); 22 | 23 | while (parser.nextLine()) { 24 | if (parser.token() == "{") { 25 | // Skip comments 26 | while (parser.nextToken(true)) { 27 | if (parser.token() == "}") break; 28 | } 29 | } 30 | else if (parser.token() == "Vertex") { 31 | if (parser.nextToken()) { 32 | uint index = parser.token().toUnsignedInt(); 33 | indexMap.add(index, indexMap.count()); 34 | 35 | float x, y, z; 36 | if (parser.nextToken()) x = parser.token().toFloat(); 37 | if (parser.nextToken()) y = parser.token().toFloat(); 38 | if (parser.nextToken()) z = parser.token().toFloat(); 39 | m_builder.addPosition(Vector3(x, y, z)); 40 | } 41 | } 42 | else if (parser.token() == "Face") { 43 | 44 | m_builder.beginPolygon(); 45 | 46 | parser.nextToken(); // skip face number 47 | 48 | while(parser.nextToken()) { 49 | uint idx = NIL; 50 | if (indexMap.get(parser.token().toUnsignedInt(), &idx)) 51 | { 52 | m_builder.addVertex(idx); 53 | } 54 | } 55 | 56 | m_builder.endPolygon(); 57 | } 58 | } 59 | } 60 | catch(TokenizerException) { 61 | return false; 62 | } 63 | 64 | m_builder.done(); 65 | 66 | return true; 67 | } 68 | 69 | 70 | class MeshImportFactoryM : public MeshImportFactory 71 | { 72 | public: 73 | virtual const char * extension() const { 74 | return ".m"; 75 | } 76 | virtual MeshImport * createImporter() const { 77 | return new MeshImportM(); 78 | } 79 | }; 80 | NV_REGISTER_MESH_IMPORT_FACTORY(MeshImportFactoryM); 81 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportM.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_M_H 4 | #define NV_MESH_IMPORT_M_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | /// M mesh importer. 12 | class MeshImportM : public MeshImport 13 | { 14 | public: 15 | virtual bool import(Stream * stream); 16 | }; 17 | 18 | } // nv namespace 19 | 20 | #endif // NV_MESH_IMPORT_M_H 21 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportMD5.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_MD5_H 4 | #define NV_MESH_IMPORT_MD5_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | class Tokenizer; 12 | 13 | /// MD5 mesh importer. 14 | class MeshImportMD5 : public MeshImport 15 | { 16 | public: 17 | virtual bool import(Stream * stream); 18 | 19 | const Skeleton * skeleton() const { return &m_skeleton; }; 20 | 21 | private: 22 | bool parseJoints(Tokenizer &); 23 | bool parseMesh(Tokenizer &); 24 | 25 | private: 26 | Skeleton m_skeleton; 27 | }; 28 | 29 | } // nv namespace 30 | 31 | 32 | #endif // NV_MESH_IMPORT_MD5_H 33 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportOBJ.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_OBJ_H 4 | #define NV_MESH_IMPORT_OBJ_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | /// OBJ mesh importer. 12 | class MeshImportOBJ : public MeshImport 13 | { 14 | public: 15 | virtual bool import(Stream * stream); 16 | }; 17 | 18 | } // nv namespace 19 | 20 | #endif // NV_MESH_IMPORT_OBJ_H 21 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportOFF.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_OFF_H 4 | #define NV_MESH_IMPORT_OFF_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | /// OFF mesh importer. 12 | class MeshImportOFF : public MeshImport 13 | { 14 | public: 15 | virtual bool import(Stream * stream); 16 | }; 17 | 18 | } // nv namespace 19 | 20 | #endif // NV_MESH_IMPORT_OBJ_H 21 | -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportPLY.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_PLY_H 4 | #define NV_MESH_IMPORT_PLY_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | /// OBJ mesh importer. 12 | class MeshImportPLY : public MeshImport 13 | { 14 | public: 15 | virtual bool import(Stream * stream); 16 | }; 17 | 18 | } // nv namespace 19 | 20 | #endif // NV_MESH_IMPORT_PLY_H -------------------------------------------------------------------------------- /src/nvmesh/import/MeshImportPSK.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_IMPORT_PSK_H 4 | #define NV_MESH_IMPORT_PSK_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | 12 | /// PSK mesh importer. 13 | class MeshImportPSK : public MeshImport 14 | { 15 | public: 16 | virtual bool import(Stream * stream); 17 | 18 | const Skeleton * skeleton() const { return &m_skeleton; }; 19 | 20 | private: 21 | Skeleton m_skeleton; 22 | }; 23 | 24 | } // nv namespace 25 | 26 | 27 | #endif // NV_MESH_IMPORT_PSK_H 28 | -------------------------------------------------------------------------------- /src/nvmesh/import/XFile.h: -------------------------------------------------------------------------------- 1 | // Add X import code here. 2 | // 3 | // References: 4 | // - Direct-X File Format, compiled by Paul Bourke 5 | // http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/ 6 | // 7 | // - Working with the DirectX .X File Format and Animation in DirectX 9.0 8 | // http://www.gamedev.net/reference/articles/article2079.asp 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/nvmesh/kdtree/KDTree.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/kdtree/KDTree.cpp -------------------------------------------------------------------------------- /src/nvmesh/kdtree/KDTree.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/kdtree/KDTree.h -------------------------------------------------------------------------------- /src/nvmesh/kdtree/KDTreeBuilder.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/kdtree/KDTreeBuilder.cpp -------------------------------------------------------------------------------- /src/nvmesh/kdtree/KDTreeBuilder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/kdtree/KDTreeBuilder.h -------------------------------------------------------------------------------- /src/nvmesh/kdtree/MeshKDTree.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/kdtree/MeshKDTree.cpp -------------------------------------------------------------------------------- /src/nvmesh/kdtree/MeshKDTree.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/kdtree/MeshKDTree.h -------------------------------------------------------------------------------- /src/nvmesh/mender/NVMeshMender.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/mender/NVMeshMender.cpp -------------------------------------------------------------------------------- /src/nvmesh/mender/NVMeshMender.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/mender/NVMeshMender.h -------------------------------------------------------------------------------- /src/nvmesh/nvmesh.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_H 4 | #define NV_MESH_H 5 | 6 | #include 7 | 8 | // Function linkage 9 | #if NVMESH_SHARED 10 | #ifdef NVMESH_EXPORTS 11 | #define NVMESH_API DLL_EXPORT 12 | #define NVMESH_CLASS DLL_EXPORT_CLASS 13 | #else 14 | #define NVMESH_API DLL_IMPORT 15 | #define NVMESH_CLASS DLL_IMPORT 16 | #endif 17 | #else 18 | #define NVMESH_API 19 | #define NVMESH_CLASS 20 | #endif 21 | 22 | #endif // NV_MESH_H 23 | -------------------------------------------------------------------------------- /src/nvmesh/param/LeastSquaresConformalMap.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_LEASTSQUARESCONFORMALMAP_H 4 | #define NV_MESH_LEASTSQUARESCONFORMALMAP_H 5 | 6 | namespace nv 7 | { 8 | namespace HalfEdge { class Mesh; } 9 | 10 | void computeLeastSquaresConformalMap(HalfEdge::Mesh * mesh); 11 | 12 | } // nv namespace 13 | 14 | #endif // NV_MESH_LEASTSQUARESCONFORMALMAP_H 15 | -------------------------------------------------------------------------------- /src/nvmesh/param/NaturalParametrization.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/param/NaturalParametrization.cpp -------------------------------------------------------------------------------- /src/nvmesh/param/ParameterizationQuality.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_PARAMETERIZATIONQUALITY_H 4 | #define NV_MESH_PARAMETERIZATIONQUALITY_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class Vector2; 11 | class Vector3; 12 | 13 | namespace HalfEdge 14 | { 15 | class HalfEdgeMesh; 16 | } 17 | 18 | // Estimate quality of existing parameterization. 19 | NVMESH_CLASS class ParameterizationQuality 20 | { 21 | public: 22 | ParameterizationQuality(const HalfEdge::Mesh * mesh); 23 | 24 | bool isValid() const; 25 | 26 | float rmsStretchMetric() const; 27 | float maxStretchMetric() const; 28 | 29 | float rmsConformalMetric() const; 30 | float maxAuthalicMetric() const; 31 | 32 | private: 33 | 34 | void processTriangle(Vector3 p[3], Vector2 t[3]); 35 | 36 | private: 37 | 38 | uint m_totalTriangleCount; 39 | uint m_flippedTriangleCount; 40 | 41 | float m_parametricArea; 42 | float m_geometricArea; 43 | 44 | float m_rmsStretchMetric; 45 | float m_maxStretchMetric; 46 | 47 | float m_rmsConformalMetric; 48 | float m_rmsAuthalicMetric; 49 | 50 | }; 51 | 52 | } // nv namespace 53 | 54 | #endif // NV_MESH_PARAMETERIZATIONQUALITY_H 55 | -------------------------------------------------------------------------------- /src/nvmesh/param/Parametrization.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/param/Parametrization.cpp -------------------------------------------------------------------------------- /src/nvmesh/param/Seams.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_SEAMS_H 4 | #define NV_MESH_SEAMS_H 5 | 6 | #include 7 | #include 8 | 9 | 10 | namespace nv 11 | { 12 | namespace HalfEdge { class Mesh; } 13 | class FloatImage; 14 | 15 | bool isValidTileAtlas(const HalfEdge::Mesh * mesh, uint w, uint h); 16 | bool isSeamless(const HalfEdge::Mesh * mesh, const FloatImage * img, uint channel=0); 17 | 18 | // Move seams texcoords to texel centers. 19 | void adjustSeamTexCoords(HalfEdge::Mesh * mesh, int width, int height, float offset=0.0f); 20 | 21 | bool fixTileAtlasSeams(const HalfEdge::Mesh * mesh, FloatImage * img, float offset=0.0f); 22 | bool fixCornerSeams(const HalfEdge::Mesh * mesh, FloatImage * img, float offset=0.0f); 23 | 24 | } // nv namespace 25 | 26 | #endif // NV_MESH_SEAMS_H 27 | -------------------------------------------------------------------------------- /src/nvmesh/param/SingleFaceMap.cpp: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #include 4 | #include 5 | #include 6 | #include "SingleFaceMap.h" 7 | 8 | using namespace nv; 9 | 10 | 11 | Vector3 faceNormal(const HalfEdge::Face * face) 12 | { 13 | // @@ Compute best fit plane? 14 | 15 | // For now we just use the normal of the first triangle. 16 | Vector3 p0 = face->edge()->from()->pos(); 17 | Vector3 p1 = face->edge()->to()->pos(); 18 | Vector3 p2 = face->edge()->next()->to()->pos(); 19 | 20 | return normalize(cross(p1 - p0, p2 - p0)); 21 | } 22 | 23 | 24 | void nv::computeSingleFaceMap(HalfEdge::Mesh * mesh) 25 | { 26 | nvDebugCheck(mesh != NULL); 27 | nvDebugCheck(mesh->faceCount() == 1); 28 | 29 | HalfEdge::Face * face = mesh->faceAt(0); 30 | nvCheck(face != NULL); 31 | 32 | Vector3 p0 = face->edge()->from()->pos(); 33 | Vector3 p1 = face->edge()->to()->pos(); 34 | 35 | Vector3 X = normalize(p1 - p0); 36 | Vector3 Z = faceNormal(face); 37 | Vector3 Y = normalize(cross(Z, X)); 38 | 39 | uint i = 0; 40 | for (HalfEdge::Face::EdgeIterator it(face->edges()); !it.isDone(); it.advance(), i++) 41 | { 42 | HalfEdge::Vertex * vertex = it.vertex(); 43 | nvCheck(vertex != NULL); 44 | 45 | if (i == 0) 46 | { 47 | vertex->setTex(Vector2(0, 0)); 48 | } 49 | else 50 | { 51 | Vector3 pn = vertex->pos(); 52 | 53 | float xn = dot((pn - p0), X); 54 | float yn = dot((pn - p0), Y); 55 | 56 | vertex->setTex(Vector2(xn, yn)); 57 | } 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/nvmesh/param/SingleFaceMap.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_SINGLEFACEMAP_H 4 | #define NV_MESH_SINGLEFACEMAP_H 5 | 6 | namespace nv 7 | { 8 | namespace HalfEdge 9 | { 10 | class Mesh; 11 | } 12 | 13 | void computeSingleFaceMap(HalfEdge::Mesh * mesh); 14 | 15 | } // nv namespace 16 | 17 | #endif // NV_MESH_SINGLEFACEMAP_H 18 | -------------------------------------------------------------------------------- /src/nvmesh/qms/QuadSimplificationMesh.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_QUADSIMPLIFICATIONMESH_H 4 | #define NV_MESH_QUADSIMPLIFICATIONMESH_H 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace nv 13 | { 14 | namespace HalfEdge { class Mesh; class Edge; class Face; class Vertex; } 15 | 16 | namespace QuadMeshSimplification 17 | { 18 | // Mesh simplification: 19 | void simplify(HalfEdge::Mesh * mesh, uint maxQuad, float maxQEM, float v = 0.9f, float q = 0.05f, float d = 0.05f); 20 | 21 | // Mesh smoothing: 22 | void smooth(HalfEdge::Mesh * mesh); 23 | 24 | // Simplification operators: 25 | void polyChordCollapse(HalfEdge::Edge * edge); 26 | void quadCollapse(HalfEdge::Face * face); 27 | void doubletCollapse(HalfEdge::Vertex * vertex); 28 | 29 | // Helpers: 30 | bool isDoublet(const HalfEdge::Face * face0, const HalfEdge::Face * face1); 31 | 32 | struct SimplificationState; 33 | 34 | // Functions for interactive simplification: 35 | SimplificationState * simplifyStart(HalfEdge::Mesh * mesh, uint maxQuad, float maxQEM, float v = 0.9f, float q = 0.05f, float d = 0.05f); 36 | bool simplifyStep(SimplificationState * state); 37 | void simplifyEnd(SimplificationState * state); 38 | } 39 | 40 | } // nv namespace 41 | 42 | #endif // NV_MESH_QUADSIMPLIFICATIONMESH_H 43 | -------------------------------------------------------------------------------- /src/nvmesh/raster/ClippedTriangle.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/raster/ClippedTriangle.cpp -------------------------------------------------------------------------------- /src/nvmesh/raster/Raster.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_RASTER_H 4 | #define NV_MESH_RASTER_H 5 | 6 | /** @file Raster.h 7 | * @brief Rasterization library. 8 | * 9 | * This is just a standard scanline rasterizer that I took from one of my old 10 | * projects. The perspective correction wasn't necessary so I just removed it. 11 | **/ 12 | 13 | #include 14 | #include 15 | 16 | #define RASTER_ANTIALIAS true 17 | #define RASTER_NOAA false 18 | 19 | namespace nv 20 | { 21 | namespace Raster 22 | { 23 | /// A callback to sample the environment. 24 | typedef void (NV_CDECL * SamplingCallback)(void * param, int x, int y, Vector3::Arg bar, Vector3::Arg dx, Vector3::Arg dy, float coverage); 25 | 26 | // Process the given triangle. 27 | NVMESH_API bool drawTriangle(bool antialias, Vector2::Arg extents, const Vector2 v[3], SamplingCallback cb, void * param); 28 | 29 | // Process the given quad. 30 | NVMESH_API bool drawQuad(bool antialias, Vector2::Arg extents, const Vector2 vertex[4], SamplingCallback, void * param); 31 | 32 | } 33 | } 34 | 35 | 36 | #endif // NV_MESH_RASTER_H 37 | -------------------------------------------------------------------------------- /src/nvmesh/raytracing/FaceBuffer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/raytracing/FaceBuffer.cpp -------------------------------------------------------------------------------- /src/nvmesh/raytracing/FaceBuffer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/raytracing/FaceBuffer.h -------------------------------------------------------------------------------- /src/nvmesh/raytracing/Grid.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/raytracing/Grid.cpp -------------------------------------------------------------------------------- /src/nvmesh/raytracing/Grid.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/raytracing/Grid.h -------------------------------------------------------------------------------- /src/nvmesh/raytracing/Raytracing.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/castano/nvidia-mesh-tools/45469f916440026bdd8a7e2ac509bf635ded7748/src/nvmesh/raytracing/Raytracing.h -------------------------------------------------------------------------------- /src/nvmesh/render/NvTriStripVertexCache.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "NvTriStripVertexCache.h" 3 | 4 | -------------------------------------------------------------------------------- /src/nvmesh/render/NvTriStripVertexCache.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef VERTEX_CACHE_H 3 | #define VERTEX_CACHE_H 4 | 5 | #include // memset 6 | 7 | class VertexCache 8 | { 9 | 10 | public: 11 | 12 | VertexCache(int size) 13 | { 14 | numEntries = size; 15 | 16 | entries = new int[numEntries]; 17 | 18 | for(int i = 0; i < numEntries; i++) 19 | entries[i] = -1; 20 | } 21 | 22 | VertexCache() { VertexCache(16); } 23 | ~VertexCache() { delete[] entries; entries = 0; } 24 | 25 | bool InCache(int entry) 26 | { 27 | bool returnVal = false; 28 | for(int i = 0; i < numEntries; i++) 29 | { 30 | if(entries[i] == entry) 31 | { 32 | returnVal = true; 33 | break; 34 | } 35 | } 36 | 37 | return returnVal; 38 | } 39 | 40 | int AddEntry(int entry) 41 | { 42 | int removed; 43 | 44 | removed = entries[numEntries - 1]; 45 | 46 | //push everything right one 47 | for(int i = numEntries - 2; i >= 0; i--) 48 | { 49 | entries[i + 1] = entries[i]; 50 | } 51 | 52 | entries[0] = entry; 53 | 54 | return removed; 55 | } 56 | 57 | void Clear() 58 | { 59 | memset(entries, -1, sizeof(int) * numEntries); 60 | } 61 | 62 | void Copy(VertexCache* inVcache) 63 | { 64 | for(int i = 0; i < numEntries; i++) 65 | { 66 | inVcache->Set(i, entries[i]); 67 | } 68 | } 69 | 70 | int At(int index) { return entries[index]; } 71 | void Set(int index, int value) { entries[index] = value; } 72 | 73 | private: 74 | 75 | int *entries; 76 | int numEntries; 77 | 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/nvmesh/render/VertexCache.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_VERTEXCACHE_H 4 | #define NV_MESH_VERTEXCACHE_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | struct VertexCache 11 | { 12 | enum Mode 13 | { 14 | Mode_Batch, 15 | Mode_FIFO, 16 | Mode_LRU, 17 | }; 18 | 19 | VertexCache(uint cacheSize = 32, Mode mode = Mode_Batch, uint maxPrimitivePerBatch = 32); 20 | VertexCache(const VertexCache & other); 21 | ~VertexCache(); 22 | 23 | void operator=(const VertexCache & other); 24 | 25 | uint cacheSize() const { return m_cacheSize; } 26 | Mode cacheMode() const { return m_mode; } 27 | 28 | void clear(); 29 | 30 | uint vertexCount() const; 31 | uint vertexAt(uint idx) const; 32 | 33 | int vertexPosition(uint v) const; 34 | float distanceToExit(uint v) const; 35 | 36 | bool hasVertex(uint v) const; 37 | bool addVertex(uint v); 38 | 39 | void addPrimitive(const uint * indices, uint primitiveSize, uint firstIndex = ~0); 40 | void flush(); 41 | 42 | struct Stats 43 | { 44 | uint primitiveCount; 45 | uint transformCount; 46 | uint batchCount; 47 | uint fullBatchCount; 48 | }; 49 | 50 | // Get stats 51 | void resetStats(); 52 | const Stats & stats() { return m_stats; } 53 | 54 | private: 55 | 56 | // Invariants: 57 | const uint m_cacheSize; 58 | const Mode m_mode; 59 | const uint m_maxPrimitivePerBatch; 60 | 61 | // Cache state: 62 | uint m_head; 63 | uint m_vertexCount; 64 | uint m_primitiveCount; 65 | uint * m_indices; 66 | 67 | // Statistics: 68 | Stats m_stats; 69 | 70 | }; 71 | 72 | } // nv namespace 73 | 74 | #endif // NV_MESH_VERTEXCACHE_H 75 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/Boundary.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_BOUNDARY_H 4 | #define NV_MESH_BOUNDARY_H 5 | 6 | namespace nv 7 | { 8 | 9 | // Subdivision surface boundary types. 10 | enum BoundaryMode 11 | { 12 | BoundaryMode_None, 13 | BoundaryMode_Spline 14 | // @@ Add spline mode with sharp corners. 15 | }; 16 | 17 | } // namespace nv 18 | 19 | #endif // NV_MESH_BOUNDARY_H 20 | 21 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/LimitSurface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_LIMITSURFACE_H 4 | #define NV_MESH_LIMITSURFACE_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace nv; 11 | 12 | 13 | void CatmullClark::projectToLimitSurface(HalfEdgeMesh * mesh) 14 | { 15 | } 16 | 17 | Vector3 CatmullClark::limitPosition(const HalfEdgeMesh::Vertex * vertex) 18 | { 19 | return Vector3(zero); 20 | } 21 | 22 | Vector3 CatmullClark::limitNormal(const HalfEdgeMesh::Vertex * vertex) 23 | { 24 | return Vector3(zero); 25 | } 26 | 27 | Vector3 CatmullClark::limitTangent(const HalfEdgeMesh::Edge * edge) 28 | { 29 | return Vector3(zero); 30 | } 31 | 32 | 33 | void Loop::projectToLimitSurface(HalfEdgeMesh * mesh) 34 | { 35 | } 36 | 37 | Vector3 Loop::limitPosition(const HalfEdgeMesh::Vertex * vertex) 38 | { 39 | return Vector3(zero); 40 | } 41 | 42 | Vector3 Loop::limitNormal(const HalfEdgeMesh::Vertex * vertex) 43 | { 44 | return Vector3(zero); 45 | } 46 | 47 | Vector3 Loop::limitTangent(const HalfEdgeMesh::Edge * edge) 48 | { 49 | return Vector3(zero); 50 | } 51 | 52 | #endif // NV_MESH_SUBDIVIDE_H 53 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/LimitSurface.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_LIMITSURFACE_H 4 | #define NV_MESH_LIMITSURFACE_H 5 | 6 | #include 7 | #include 8 | //#include 9 | 10 | namespace nv 11 | { 12 | namespace CatmullClark 13 | { 14 | 15 | void projectToLimitSurface(HalfEdgeMesh * mesh); 16 | 17 | Vector3 limitPosition(const HalfEdgeMesh::Vertex * vertex); 18 | Vector3 limitNormal(const HalfEdgeMesh::Vertex * vertex); 19 | Vector3 limitTangent(const HalfEdgeMesh::Edge * edge); 20 | 21 | //Stencil * limitPositionStencil(const HalfEdgeMesh::Vertex * vertex); 22 | //Stencil * limitTangentStencil(const HalfEdgeMesh::Vertex * edge); 23 | 24 | } // CatmullClark namespace 25 | 26 | namespace Loop 27 | { 28 | 29 | void projectToLimitSurface(HalfEdgeMesh * mesh); 30 | 31 | Vector3 limitPosition(const HalfEdgeMesh::Vertex * vertex); 32 | Vector3 limitNormal(const HalfEdgeMesh::Vertex * vertex); 33 | Vector3 limitTangent(const HalfEdgeMesh::Edge * edge); 34 | 35 | //Stencil * limitPositionStencil(const HalfEdgeMesh::Vertex * vertex); 36 | //Stencil * limitTangentStencil(const HalfEdgeMesh::Vertex * edge); 37 | 38 | } // Loop namespace 39 | 40 | } // nv namespace 41 | 42 | #endif // NV_MESH_LIMITSURFACE_H 43 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/LoopGregoryApproximation.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Denis Kovacs 2 | 3 | #ifndef NV_MESH_LOOPGREGORYAPPROXIMATION_H 4 | #define NV_MESH_LOOPGREGORYAPPROXIMATION_H 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace nv 13 | { 14 | namespace HalfEdge { class Mesh; } 15 | class CubicGregoryMesh; 16 | class ACCStencils; 17 | 18 | /// Charles Loop subdivision surface Gregory approximation. 19 | class LoopGregoryApproximation 20 | { 21 | public: 22 | 23 | enum Mode 24 | { 25 | QuadTriangle, 26 | QuadsOnly, 27 | TrianglesOnly, 28 | }; 29 | 30 | LoopGregoryApproximation(const HalfEdge::Mesh * mesh, BoundaryMode boundaryMode = BoundaryMode_None); 31 | ~LoopGregoryApproximation(); 32 | 33 | CubicGregoryMesh * buildMesh(Mode mode = QuadTriangle); 34 | 35 | private: 36 | 37 | HalfEdge::Mesh * m_mesh; 38 | BoundaryMode m_boundaryMode; 39 | }; 40 | 41 | } // nv namespace 42 | 43 | #endif // NV_MESH_LOOPGREGORYAPPROXIMATION_H 44 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/RemapFaces.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_REMAPFACES_H 4 | #define NV_MESH_REMAPFACES_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | namespace HalfEdge 11 | { 12 | class Mesh; 13 | class Face; 14 | } 15 | 16 | namespace RemapFaces 17 | { 18 | // Remap faces to avoid parametrization discontinuities. 19 | void consistentPatchOrientation(HalfEdge::Mesh * mesh); 20 | 21 | uint topologyId(const HalfEdge::Face * face); 22 | void minimizeTopologyCount(HalfEdge::Mesh * mesh); 23 | } 24 | 25 | } // nv namespace 26 | 27 | #endif // NV_MESH_REMAPFACES_H 28 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/StencilMask.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_STENCILMASK_H 4 | #define NV_MESH_STENCILMASK_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | 11 | class StencilMask 12 | { 13 | public: 14 | StencilMask(); 15 | explicit StencilMask(uint size); 16 | StencilMask(const StencilMask & mask); 17 | 18 | void resize(uint size); 19 | 20 | StencilMask & operator = (const StencilMask & mask); 21 | StencilMask & operator = (float value); 22 | 23 | void operator += (const StencilMask & mask); 24 | void operator -= (const StencilMask & mask); 25 | void operator *= (float scale); 26 | void operator /= (float scale); 27 | 28 | bool operator == (const StencilMask & other) const; 29 | bool operator != (const StencilMask & other) const; 30 | 31 | uint count() const { return m_weightArray.count(); } 32 | 33 | float operator[] (uint i) const { return m_weightArray[i]; } 34 | float & operator[] (uint i) { return m_weightArray[i]; } 35 | 36 | float sum() const; 37 | bool isNormalized() const; 38 | void normalize(); 39 | 40 | friend void swap(StencilMask & a, StencilMask & b) 41 | { 42 | swap(a.m_weightArray, b.m_weightArray); 43 | } 44 | 45 | private: 46 | 47 | Array m_weightArray; 48 | 49 | }; 50 | 51 | } // nv namespace 52 | 53 | #endif // NV_MESH_STENCILMASK_H 54 | -------------------------------------------------------------------------------- /src/nvmesh/subdiv/Subdivide.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_SUBDIVIDE_H 4 | #define NV_MESH_SUBDIVIDE_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | namespace HalfEdge { class Mesh; } 11 | class FloatImage; 12 | 13 | namespace Subdivide 14 | { 15 | 16 | HalfEdge::Mesh * doCatmullClarkSplit(const HalfEdge::Mesh * mesh); 17 | void displace(HalfEdge::Mesh * mesh, const FloatImage * img, int channel=0, Vector2::Arg offset=Vector2(zero)); 18 | 19 | HalfEdge::Mesh * doQuadTriangleSplit(const HalfEdge::Mesh * mesh); 20 | 21 | HalfEdge::Mesh * reduceToQuadOnly(const HalfEdge::Mesh * mesh); 22 | 23 | void projectToCatmullClarkLimitSurface(HalfEdge::Mesh * mesh); 24 | void projectToLoopLimitSurface(HalfEdge::Mesh * mesh); 25 | 26 | } // Subdivide namespace 27 | 28 | } // nv namespace 29 | 30 | #endif // NV_MESH_SUBDIVIDE_H 31 | -------------------------------------------------------------------------------- /src/nvmesh/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | #ADD_EXECUTABLE(nvmeshtest MeshTest.cpp) 5 | #TARGET_LINK_LIBRARIES(nvmeshtest ${LIBS} nvcore nvmath nvimage nvmesh) 6 | 7 | # TODO - Add rules for ginac. 8 | #ADD_EXECUTABLE(nvlimitmask LimitMask.cpp) 9 | #TARGET_LINK_LIBRARIES(nvlimitmask ${LIBS} nvcore nvmath nvmesh ginac) 10 | 11 | # TODO - Add rules for ginac. 12 | #ADD_EXECUTABLE(nvboundarytan BoundaryTan.cpp) 13 | #TARGET_LINK_LIBRARIES(nvboundarytan ${LIBS} nvcore nvmath nvmesh ginac) 14 | 15 | #ADD_EXECUTABLE(nvlimittan LimitTangent.cpp) 16 | #TARGET_LINK_LIBRARIES(nvlimittan ${LIBS} nvcore nvmath nvimage nvmesh) 17 | 18 | #ADD_EXECUTABLE(nvraytest RayTest.cpp) 19 | #TARGET_LINK_LIBRARIES(nvraytest ${LIBS} nvcore nvmath nvimage nvmesh) 20 | -------------------------------------------------------------------------------- /src/nvmesh/test/LimitMask.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | using namespace GiNaC; 7 | 8 | /* 9 | void test() 10 | { 11 | Vector3 v(1, 1, 1); 12 | 13 | for(int i = 0; i < 2; i++) 14 | { 15 | float v0 = 0.5 * (v.x() + v.y()); 16 | float v2 = 0.5 * (v.y() + v.z()); 17 | float v1 = 0.25 * (v0 + v2) + 0.5 * v.y(); 18 | v.set(v0, v1, v2); 19 | } 20 | 21 | printf("v = %f %f %f\n", v.x(), v.y(), v.z()); 22 | } 23 | */ 24 | 25 | // Compute the limit mask of the cubic B-Spline. 26 | int main(void) 27 | { 28 | symbol sv0("v0"); 29 | symbol sv1("v1"); 30 | symbol sv2("v2"); 31 | ex v0 = sv0; 32 | ex v1 = sv1; 33 | ex v2 = sv2; 34 | 35 | for(int i = 0; i < 10; i++) 36 | { 37 | v0 = (v0 + v1) / 2; 38 | v2 = (v1 + v2) / 2; 39 | v1 = (v0 + v2) / 4 + v1 / 2; 40 | } 41 | 42 | // cout << "v0 = " << evalf(v0) << endl; 43 | // cout << "v1 = " << evalf(v1) << endl; 44 | // cout << "v2 = " << evalf(v2) << endl; 45 | 46 | cout << evalf(v1.subs(sv0 == 1).subs(sv1 == 0).subs(sv2 == 0)) << endl; 47 | cout << evalf(v1.subs(sv0 == 0).subs(sv1 == 1).subs(sv2 == 0)) << endl; 48 | cout << evalf(v1.subs(sv0 == 0).subs(sv1 == 0).subs(sv2 == 1)) << endl; 49 | 50 | matrix A(4,4); 51 | A = -1, 3, -3, 1, 52 | 3, -6, 3, 0, 53 | -3, 0, 3, 0, 54 | 1, 4, 1, 0; 55 | A = A.mul_scalar(ex(1)/ex(6)); 56 | 57 | matrix B(4,4); 58 | B = -1, 3, -3, 1, 59 | 3, -6, 3, 0, 60 | -3, 3, 0, 0, 61 | 1, 0, 0, 0; 62 | 63 | cout << eval(B.inverse().mul(A)) << endl; 64 | 65 | 66 | return 0; 67 | } 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/nvmesh/test/RayTest.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace nv; 15 | 16 | 17 | struct MyMessageHandler : public MessageHandler 18 | { 19 | void log(const char * str, va_list arg) 20 | { 21 | va_list tmp; 22 | va_copy(tmp, arg); 23 | vprintf(str, arg); 24 | 25 | #if _DEBUG && NV_OS_WIN32 26 | // static StringBuilder buffer(1024); 27 | // buffer.format(str, arg); 28 | // OutputDebugStringA(buffer.str()); 29 | #endif 30 | 31 | va_end(tmp); 32 | } 33 | }; 34 | 35 | 36 | int main(int argc, const char * argv[]) 37 | { 38 | MyMessageHandler messageHandler; 39 | debug::setMessageHandler(&messageHandler); 40 | 41 | if (argc != 2) { 42 | printf("Usage: nvraytest filename\n"); 43 | return 0; 44 | } 45 | 46 | const char * fileName = argv[1]; 47 | 48 | Timer timer; 49 | 50 | timer.start(); 51 | 52 | AutoPtr mesh; 53 | 54 | { 55 | StdInputStream stream(fileName); 56 | if (stream.isError()) { 57 | printf("Error, cannot open '%s'\n", fileName); 58 | return 0; 59 | } 60 | 61 | printf("Importing '%s'\n", fileName); 62 | MeshImportOBJ importer; 63 | importer.import(&stream); 64 | 65 | printf("\nBuilding triangle mesh:\n"); 66 | mesh = importer.builder().buildTriMesh(); 67 | } 68 | 69 | printf("Triangle count = %u\n", mesh->faceCount()); 70 | printf("Vertex count = %u\n", mesh->vertexCount()); 71 | 72 | printf("%d sec\n", timer.elapsed() / 1000); 73 | 74 | timer.start(); 75 | 76 | AutoPtr kdTree( buildKDTree(mesh.ptr()) ); 77 | 78 | printf("%d sec\n", timer.elapsed() / 1000); 79 | 80 | nvDebug("DONE!\n"); 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /src/nvmesh/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | SUBDIRS(analyzer) 4 | SUBDIRS(baker) 5 | SUBDIRS(maya) 6 | SUBDIRS(bzrexport) 7 | SUBDIRS(batcher) 8 | SUBDIRS(gridgen) 9 | 10 | -------------------------------------------------------------------------------- /src/nvmesh/tools/analyzer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | ADD_EXECUTABLE(nvmeshanalyzer MeshAnalyzer.cpp) 5 | TARGET_LINK_LIBRARIES(nvmeshanalyzer ${LIBS} nvcore nvmath nvimage nvmesh) 6 | 7 | INSTALL(TARGETS nvmeshanalyzer DESTINATION bin) 8 | -------------------------------------------------------------------------------- /src/nvmesh/tools/baker/AccBaseSurface.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_BAKER_ACCBASESURFACE_H 4 | #define NV_BAKER_ACCBASESURFACE_H 5 | 6 | #include "BaseSurface.h" 7 | 8 | #include 9 | 10 | 11 | namespace nv 12 | { 13 | class AccMesh; 14 | class SurfacePatch; 15 | class TexCoordPatch; 16 | class TangentSpacePatch; 17 | 18 | class AccBaseSurface : public BaseSurface 19 | { 20 | public: 21 | AccBaseSurface(const AccMesh * mesh); 22 | ~AccBaseSurface(); 23 | 24 | virtual uint faceCount() const; 25 | virtual void selectFace(uint i); 26 | 27 | virtual FaceDomain::Enum domain() const; 28 | virtual void textureCoordinates(Vector2 * texCoordArray) const; 29 | 30 | virtual void evaluate(float u, float v, Vector3 * pos, Basis * patchFrame, Basis * chartFrame) const; 31 | 32 | private: 33 | SmartPtr m_mesh; 34 | const SurfacePatch * m_surfacePatch; 35 | const TexCoordPatch * m_texCoordPatch; 36 | const TangentSpacePatch * m_tangentSpacePatch; 37 | }; 38 | 39 | }; 40 | 41 | #endif // NV_BAKER_ACCBASESURFACE_H 42 | -------------------------------------------------------------------------------- /src/nvmesh/tools/baker/BaseMeshPass.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Denis Kovacs 2 | 3 | #ifndef NV_BAKER_BASEMESHPASS_H 4 | #define NV_BAKER_BASEMESHPASS_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "GeometryImage.h" 11 | #include "CmdOptions.h" 12 | 13 | namespace nv 14 | { 15 | class BaseSurface; 16 | 17 | class BaseMeshPass : public CmdOptionsProvider 18 | { 19 | public: 20 | BaseMeshPass(); 21 | 22 | ~BaseMeshPass(); 23 | 24 | virtual CmdOptions * getCmdOptions(); 25 | virtual void setCmdOptions(CmdOptions * opt); 26 | 27 | bool loadMesh(); 28 | void freeMesh(); 29 | 30 | void initGeometryMap(Vector2::Arg extents); 31 | const GeometryImage * geometryMap() const { return m_geometryMap.ptr(); } 32 | 33 | void rasterizeMesh(GeometryImage * detailedGeometryMap, BitMap * detailedGeometryMask); 34 | void applyFilters(); 35 | 36 | void saveMaps(const char * name) const; 37 | 38 | private: 39 | 40 | bool saveDisplacementMap(const char * displacementMapFile) const; 41 | bool saveNormalMap(const char * fileName) const; 42 | 43 | private: 44 | AutoPtr m_mesh; 45 | AutoPtr m_geometryMap; 46 | AutoPtr m_geometryMask; 47 | 48 | // Options: 49 | struct Options; 50 | 51 | std::string m_meshFileName; 52 | int m_subdivisionLevels; 53 | int m_baseMeshType; 54 | bool m_displacements3D; 55 | bool m_tangentSpace; 56 | 57 | 58 | }; 59 | }; 60 | 61 | #endif // NV_BAKER_BASEMESHPASS_H 62 | -------------------------------------------------------------------------------- /src/nvmesh/tools/baker/BaseSurface.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_BAKER_BASESURFACE_H 4 | #define NV_BAKER_BASESURFACE_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class Basis; 11 | 12 | namespace FaceDomain 13 | { 14 | enum Enum { 15 | Triangle, 16 | Quad 17 | }; 18 | } 19 | 20 | // BaseSurface interface. 21 | class BaseSurface 22 | { 23 | public: 24 | virtual ~BaseSurface() {}; 25 | 26 | virtual uint faceCount() const = 0; 27 | virtual void selectFace(uint i) = 0; 28 | 29 | virtual FaceDomain::Enum domain() const = 0; 30 | virtual void textureCoordinates(Vector2 * texCoordArray) const = 0; 31 | 32 | virtual void evaluate(float u, float v, Vector3 * pos, Basis * patchFrame, Basis * chartFrame) const = 0; 33 | }; 34 | 35 | }; 36 | 37 | #endif // NV_BAKER_BASESURFACE_H 38 | -------------------------------------------------------------------------------- /src/nvmesh/tools/baker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${NV_SOURCE_DIR}/extern) 3 | 4 | IF(OPENEXR_FOUND) 5 | # SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES}) 6 | INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS}) 7 | ENDIF(OPENEXR_FOUND) 8 | 9 | SET(SRCS 10 | Baker.cpp 11 | Samplers.h Samplers.cpp 12 | GeometryImage.h 13 | DetailedMeshPass.h DetailedMeshPass.cpp 14 | BaseMeshPass.h BaseMeshPass.cpp 15 | BaseSurface.h 16 | AccBaseSurface.h AccBaseSurface.cpp 17 | TriBaseSurface.h TriBaseSurface.cpp 18 | TiledTask.h TiledTask.cpp 19 | CmdOptions.h) 20 | 21 | ADD_EXECUTABLE(nvbaker ${SRCS}) 22 | 23 | TARGET_LINK_LIBRARIES(nvbaker ${LIBS} nvcore nvmath nvmesh nvimage) 24 | 25 | INSTALL(TARGETS nvbaker DESTINATION bin) 26 | 27 | -------------------------------------------------------------------------------- /src/nvmesh/tools/baker/CmdOptions.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Edgar Velazquez-Armendariz 2 | 3 | #ifndef NV_BAKER_CMDOPTIONS_H 4 | #define NV_BAKER_CMDOPTIONS_H 5 | 6 | #include 7 | 8 | namespace nv { 9 | 10 | /// Basic common protocol for command line options using TCLAP: the classes will provide 11 | /// a method which returns a fresh opaque object with the options and which provides 12 | /// a single method to add its options to a command line. 13 | struct CmdOptions { 14 | virtual void add(TCLAP::CmdLine & cmd) = 0; 15 | }; 16 | 17 | class CmdOptionsProvider { 18 | // The responsible of handling the options object is the caller: the Options 19 | // provider only creates it. 20 | virtual CmdOptions * getCmdOptions() = 0; 21 | virtual void setCmdOptions(CmdOptions * opt) = 0; 22 | }; 23 | 24 | 25 | } // namespace nv 26 | 27 | #endif // NV_BAKER_CMDOPTIONS_H 28 | -------------------------------------------------------------------------------- /src/nvmesh/tools/baker/TriBaseSurface.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_BAKER_TRIBASESURFACE_H 4 | #define NV_BAKER_TRIBASESURFACE_H 5 | 6 | #include 7 | 8 | #include "BaseSurface.h" 9 | 10 | namespace nv 11 | { 12 | class Basis; 13 | class TriMesh; 14 | namespace HalfEdge { class Mesh; } 15 | 16 | enum PositionMode { 17 | PositionMode_Linear, 18 | PositionMode_PNTriangle, 19 | PositionMode_NMTriangle, 20 | }; 21 | 22 | enum NormalMode { 23 | NormalMode_Linear, 24 | NormalMode_Quadratic, 25 | NormalMode_ImprovedQuadratic, 26 | }; 27 | 28 | enum TangentMode { 29 | TangentMode_Linear, 30 | TangentMode_LinearOrtho, // Recompute bitangent from normal/ 31 | }; 32 | 33 | 34 | enum TangentSpaceMode { 35 | TangentSpaceMode_MeshMender, 36 | TangentSpaceMode_Lengyel, 37 | TangentSpaceMode_Castano, 38 | TangentSpaceMode_UE3, 39 | }; 40 | 41 | enum TangentSpaceProcessing { 42 | TangentSpaceProcessing_None, 43 | TangentSpaceProcessing_GramShmidtOrthogonalize, 44 | TangentSpaceProcessing_CastanoOrthogonalize, 45 | TangentSpaceProcessing_UE3, 46 | }; 47 | 48 | 49 | class TriBaseSurface : public BaseSurface 50 | { 51 | public: 52 | TriBaseSurface(TriMesh * mesh); 53 | ~TriBaseSurface(); 54 | 55 | void prepare(TangentSpaceMode tangentMode); 56 | 57 | void setInterpolationMode(PositionMode positionMode, NormalMode normalMode); 58 | 59 | virtual uint faceCount() const; 60 | virtual void selectFace(uint i); 61 | 62 | virtual FaceDomain::Enum domain() const; 63 | virtual void textureCoordinates(Vector2 * texCoordArray) const; 64 | 65 | virtual void evaluate(float u, float v, Vector3 * pos, Basis * patchFrame, Basis * chartFrame) const; 66 | 67 | private: 68 | AutoPtr m_mesh; 69 | uint m_faceIndex; 70 | 71 | Array m_basisArray; 72 | 73 | PositionMode m_positionMode; 74 | NormalMode m_normalMode; 75 | 76 | }; 77 | 78 | }; 79 | 80 | #endif // NV_BAKER_TRIBASESURFACE_H 81 | -------------------------------------------------------------------------------- /src/nvmesh/tools/batcher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | ADD_EXECUTABLE(nvmeshbatcher MeshBatcher.cpp) 5 | TARGET_LINK_LIBRARIES(nvmeshbatcher ${LIBS} nvcore nvmath nvimage nvmesh) 6 | 7 | INSTALL(TARGETS nvmeshbatcher DESTINATION bin) 8 | -------------------------------------------------------------------------------- /src/nvmesh/tools/bzrexport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | ADD_EXECUTABLE(nvbzrexport BzrExport.cpp) 5 | TARGET_LINK_LIBRARIES(nvbzrexport ${LIBS} nvcore nvmath nvimage nvmesh) 6 | 7 | INSTALL(TARGETS nvbzrexport DESTINATION bin) 8 | -------------------------------------------------------------------------------- /src/nvmesh/tools/gridgen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | ADD_EXECUTABLE(nvgridgen GridGen.cpp) 5 | TARGET_LINK_LIBRARIES(nvgridgen ${LIBS} nvcore nvmath nvimage nvmesh) 6 | 7 | INSTALL(TARGETS nvgridgen DESTINATION bin) 8 | -------------------------------------------------------------------------------- /src/nvmesh/tools/maya/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | IF(MAYA_FOUND) 3 | SOURCE_GROUP("MEL Scripts" "\\.mel") 4 | 5 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${MAYA_INCLUDE_PATH}) 6 | 7 | ADD_DEFINITIONS(-DNT_PLUGIN) 8 | 9 | # Shared nvmaya library 10 | ADD_LIBRARY(nvmaya MayaUtils.h MayaUtils.cpp MayaMeshBuilder.h MayaMeshBuilder.cpp) 11 | TARGET_LINK_LIBRARIES(nvmaya ${LIBS} ${MAYA_LIBRARIES} nvcore nvmath nvimage nvmesh) 12 | 13 | 14 | # MayaAnalyzer plugin 15 | ADD_LIBRARY(MayaAnalyzer SHARED MayaAnalyzer.cpp) 16 | TARGET_LINK_LIBRARIES(MayaAnalyzer ${LIBS} ${MAYA_LIBRARIES} nvcore nvmath nvimage nvmesh nvmaya) 17 | 18 | INSTALL(TARGETS MayaAnalyzer DESTINATION bin/maya) 19 | 20 | SET_TARGET_PROPERTIES(MayaAnalyzer 21 | PROPERTIES 22 | PREFIX "Nv" 23 | SUFFIX "${MAYA_EXTENSION}") 24 | 25 | 26 | # MayaExporter plugin 27 | ADD_LIBRARY(MayaExporter SHARED MayaExportPlugin.cpp MayaExporter.cpp MayaExporter.h NvMayaExportScript.mel) 28 | TARGET_LINK_LIBRARIES(MayaExporter ${LIBS} ${MAYA_LIBRARIES} nvcore nvmath nvimage nvmesh nvmaya) 29 | 30 | INSTALL(TARGETS MayaExporter DESTINATION bin/maya) 31 | 32 | SET_TARGET_PROPERTIES(MayaExporter 33 | PROPERTIES 34 | PREFIX "Nv" 35 | SUFFIX "${MAYA_EXTENSION}") 36 | 37 | 38 | # MayaCommandLineExporter tool 39 | ADD_EXECUTABLE(MayaCommandLineExporter MayaCommandLineExporter.cpp MayaExporter.cpp MayaExporter.h) 40 | TARGET_LINK_LIBRARIES(MayaCommandLineExporter ${LIBS} ${MAYA_LIBRARIES} nvcore nvmath nvimage nvmesh nvmaya) 41 | 42 | INSTALL(TARGETS MayaCommandLineExporter DESTINATION bin) 43 | 44 | ENDIF(MAYA_FOUND) 45 | 46 | -------------------------------------------------------------------------------- /src/nvmesh/tools/maya/MayaCommandLineExporter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "MayaExporter.h" 10 | 11 | using namespace nv; 12 | 13 | 14 | int main(int argc, char* argv[]) 15 | { 16 | printf("Maya Command Line Exporter - Copyright NVIDIA Corporation 2008\n\n"); 17 | 18 | if (argc != 2) { 19 | printf("Usage options: MayaCommandLineExporter 'fileName'\n"); 20 | return 0; 21 | } 22 | 23 | char * pluginName = argv[0]; 24 | const char * fileName = argv[1]; 25 | 26 | // initialise the maya library 27 | MLibrary::initialize(pluginName); 28 | 29 | ExportOptions options; 30 | 31 | //options.parse(argc - 1, argv + 1); 32 | options.setFileName("out.nvmesh"); 33 | 34 | if (!options.isValid()) 35 | { 36 | printf("Invalid export options.\n"); 37 | } 38 | else 39 | { 40 | if (MFileIO::open(fileName) == MS::kSuccess) 41 | { 42 | Exporter exporter; 43 | 44 | if (exporter.doExport(options) == MS::kSuccess) 45 | { 46 | printf("Export succeeded.\n"); 47 | } 48 | else 49 | { 50 | printf("Export failed.\n"); 51 | } 52 | } 53 | } 54 | 55 | printf("\n"); 56 | 57 | // cleanup maya 58 | MLibrary::cleanup(); 59 | 60 | return 0; 61 | } -------------------------------------------------------------------------------- /src/nvmesh/tools/maya/MayaExporter.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_MAYAEXPORTER_H 4 | #define NV_MESH_MAYAEXPORTER_H 5 | 6 | #include 7 | 8 | class MArgList; 9 | class MFileObject; 10 | 11 | 12 | namespace nv 13 | { 14 | 15 | // Export options. 16 | struct ExportOptions 17 | { 18 | ExportOptions(); 19 | 20 | void setDefaults(); 21 | 22 | void parse(const MArgList & args); 23 | void parse(const MString & optionsString); 24 | void parse(int argc, const char ** argv); 25 | 26 | void setFileName(const char * fileName); 27 | void setFileObject(const MFileObject & file); 28 | 29 | void setExportSelected(bool exportSelected); 30 | 31 | bool isValid() const; 32 | 33 | private: 34 | friend class Exporter; 35 | 36 | const char * filePath() const; 37 | 38 | int frameCount() const; 39 | float totalTime() const; 40 | 41 | private: 42 | 43 | bool m_exportSelected; 44 | 45 | bool m_exportReferencePose; 46 | bool m_exportVertexAnimation; 47 | 48 | MString m_filePath; 49 | 50 | // Animation export options: 51 | float m_referenceFrame; 52 | float m_beginTime; 53 | float m_endTime; 54 | float m_sampleFrequency; 55 | 56 | }; 57 | 58 | 59 | // Exporter. 60 | class Exporter 61 | { 62 | public: 63 | 64 | MStatus doExport(const ExportOptions & options); 65 | 66 | private: 67 | 68 | // @@ Compute scene stats? 69 | 70 | }; 71 | 72 | 73 | } // nv namespace 74 | 75 | 76 | #endif // NV_MESH_MAYAEXPORTER_H 77 | -------------------------------------------------------------------------------- /src/nvmesh/tools/maya/MayaMeshBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_MAYAMESHBUILDER_H 4 | #define NV_MESH_MAYAMESHBUILDER_H 5 | 6 | #include 7 | 8 | class MDagPath; 9 | 10 | namespace nv 11 | { 12 | class TriMesh; 13 | class QuadTriMesh; 14 | class PolyMesh; 15 | namespace HalfEdge { class Mesh; } 16 | 17 | /// Build options. 18 | struct MayaMeshBuilderOptions 19 | { 20 | MayaMeshBuilderOptions(); 21 | MayaMeshBuilderOptions(const MayaMeshBuilderOptions & options); 22 | const MayaMeshBuilderOptions & operator=(const MayaMeshBuilderOptions & options); 23 | 24 | bool addTexcoords; 25 | bool addNormals; 26 | }; 27 | 28 | 29 | /// Maya mesh builder. 30 | class MayaMeshBuilder 31 | { 32 | public: 33 | 34 | MayaMeshBuilder(const MayaMeshBuilderOptions & options); 35 | 36 | bool addScene(); 37 | bool addSelection(); 38 | bool addNode(const MDagPath & dagPath); 39 | 40 | void done(); 41 | void reset(); 42 | 43 | TriMesh * buildTriMesh() const; 44 | QuadTriMesh * buildQuadTriMesh() const; 45 | //PolyMesh * buildPolyMesh() const; 46 | 47 | HalfEdge::Mesh * buildHalfEdgeMesh() const; 48 | 49 | // Expose attribute indices of the unified vertex array. 50 | uint vertexCount() const; 51 | uint positionIndex(uint vertex) const; 52 | uint normalIndex(uint vertex) const; 53 | uint texcoordIndex(uint vertex) const; 54 | 55 | private: 56 | 57 | const MayaMeshBuilderOptions m_options; 58 | 59 | MeshBuilder m_builder; 60 | 61 | }; 62 | 63 | } 64 | 65 | 66 | #endif // NV_MESH_MAYAMESHBUILDER_H 67 | -------------------------------------------------------------------------------- /src/nvmesh/tools/maya/MayaUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_MAYAUTILS_H 4 | #define NV_MESH_MAYAUTILS_H 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | class MStatus; 12 | class MDagPath; 13 | class MFnMesh; 14 | class MFnSkinCluster; 15 | 16 | namespace nv 17 | { 18 | namespace HalfEdge { class Mesh; } 19 | class Skeleton; 20 | 21 | 22 | class MayaTime 23 | { 24 | public: 25 | MayaTime() : m_initialTime(currentTime()) {} 26 | 27 | MayaTime(MTime t) : m_initialTime(currentTime()) 28 | { 29 | setCurrentTime(t); 30 | } 31 | ~MayaTime() 32 | { 33 | setCurrentTime(m_initialTime); 34 | } 35 | 36 | void setCurrentTime(MTime t) 37 | { 38 | MAnimControl::setCurrentTime(t); 39 | } 40 | 41 | MTime currentTime() const 42 | { 43 | return MAnimControl::currentTime(); 44 | } 45 | 46 | const MTime m_initialTime; 47 | }; 48 | 49 | 50 | namespace MayaUtils 51 | { 52 | // Build a half edge mesh from the given maya mesh. 53 | HalfEdge::Mesh * buildHalfEdgeMesh(const MDagPath & node); 54 | 55 | bool getMeshPositions(const MDagPath & dagPath, Array * points); 56 | 57 | // Build a skeleton from the given maya mesh. 58 | Skeleton * buildSkeleton(const MDagPath & node); 59 | 60 | MStatus getSkinAndMesh(/*ref*/ MFnMesh & meshFn, /*out*/MFnSkinCluster & skinCluster); 61 | MStatus getSkinAndMeshGMAN(/*ref*/ MFnMesh & meshFn, /*out*/MFnSkinCluster & skinCluster); 62 | 63 | } // MayaUtils namespace 64 | } 65 | 66 | 67 | #endif // NV_MESH_MAYAUTILS_H 68 | -------------------------------------------------------------------------------- /src/nvmesh/weld/Snap.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_MESH_SNAP_H 4 | #define NV_MESH_SNAP_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | class TriMesh; 12 | 13 | NVMESH_API uint SnapVertices(TriMesh * mesh, float posThreshold=NV_EPSILON, float texThreshold=1.0f/1024, float norThreshold=NV_NORMAL_EPSILON); 14 | 15 | } // nv namespace 16 | 17 | 18 | #endif // NV_MESH_SNAP_H 19 | -------------------------------------------------------------------------------- /src/nvmesh/weld/VertexWeld.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2006 -- Ignacio Castano 2 | 3 | #ifndef NV_MESH_VERTEXWELD_H 4 | #define NV_MESH_VERTEXWELD_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class TriMesh; 11 | class QuadMesh; 12 | 13 | NVMESH_API void WeldVertices(TriMesh * mesh); 14 | NVMESH_API void WeldVertices(QuadTriMesh * mesh); 15 | 16 | } // nv namespace 17 | 18 | 19 | #endif // NV_MESH_VERTEXWELD_H 20 | --------------------------------------------------------------------------------