├── .clang-format ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── external ├── cmft │ ├── CMakeLists.txt │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── dependency │ │ ├── CL │ │ │ ├── cl.h │ │ │ ├── cl_d3d10.h │ │ │ ├── cl_d3d11.h │ │ │ ├── cl_dx9_media_sharing.h │ │ │ ├── cl_egl.h │ │ │ ├── cl_ext.h │ │ │ ├── cl_gl.h │ │ │ ├── cl_gl_ext.h │ │ │ ├── cl_platform.h │ │ │ └── opencl.h │ │ └── stb │ │ │ └── stb_image.h │ ├── include │ │ └── cmft │ │ │ ├── allocator.h │ │ │ ├── clcontext.h │ │ │ ├── cubemapfilter.h │ │ │ ├── image.h │ │ │ └── print.h │ └── src │ │ └── cmft │ │ ├── CMakeLists.txt │ │ ├── allocator.cpp │ │ ├── clcontext.cpp │ │ ├── clcontext_internal.h │ │ ├── common │ │ ├── cl.h │ │ ├── commandline.h │ │ ├── config.h │ │ ├── fpumath.h │ │ ├── halffloat.h │ │ ├── handlealloc.h │ │ ├── os.h │ │ ├── platform.h │ │ ├── print.cpp │ │ ├── stb_image.cpp │ │ ├── stb_image.h │ │ ├── timer.h │ │ └── utils.h │ │ ├── cubemapfilter.cpp │ │ ├── cubemaputils.h │ │ ├── image.cpp │ │ ├── radiance.cl │ │ └── radiance.h └── nvidia-texture-tools │ ├── .gitignore │ ├── CMakeLists.txt │ ├── ChangeLog │ ├── LICENSE │ ├── README.md │ ├── VERSION │ ├── buildpkg │ ├── cmake │ ├── DetermineProcessor.cmake │ ├── FindCg.cmake │ ├── FindDirectX.cmake │ ├── FindFreeImage.cmake │ ├── FindGLEW.cmake │ ├── FindMaya.cmake │ ├── FindOpenEXR.cmake │ └── OptimalOptions.cmake │ ├── configure │ ├── doc │ └── release_todo │ ├── extern │ ├── CMakeLists.txt │ ├── EtcLib │ │ ├── CMakeLists.txt │ │ ├── Etc │ │ │ ├── Etc.cpp │ │ │ ├── Etc.h │ │ │ ├── EtcColor.h │ │ │ ├── EtcColorFloatRGBA.h │ │ │ ├── EtcConfig.h │ │ │ ├── EtcImage.cpp │ │ │ ├── EtcImage.h │ │ │ ├── EtcMath.cpp │ │ │ └── EtcMath.h │ │ └── EtcCodec │ │ │ ├── EtcBlock4x4.cpp │ │ │ ├── EtcBlock4x4.h │ │ │ ├── EtcBlock4x4Encoding.cpp │ │ │ ├── EtcBlock4x4Encoding.h │ │ │ ├── EtcBlock4x4EncodingBits.h │ │ │ ├── EtcBlock4x4Encoding_ETC1.cpp │ │ │ ├── EtcBlock4x4Encoding_ETC1.h │ │ │ ├── EtcBlock4x4Encoding_R11.cpp │ │ │ ├── EtcBlock4x4Encoding_R11.h │ │ │ ├── EtcBlock4x4Encoding_RG11.cpp │ │ │ ├── EtcBlock4x4Encoding_RG11.h │ │ │ ├── EtcBlock4x4Encoding_RGB8.cpp │ │ │ ├── EtcBlock4x4Encoding_RGB8.h │ │ │ ├── EtcBlock4x4Encoding_RGB8A1.cpp │ │ │ ├── EtcBlock4x4Encoding_RGB8A1.h │ │ │ ├── EtcBlock4x4Encoding_RGBA8.cpp │ │ │ ├── EtcBlock4x4Encoding_RGBA8.h │ │ │ ├── EtcDifferentialTrys.cpp │ │ │ ├── EtcDifferentialTrys.h │ │ │ ├── EtcErrorMetric.h │ │ │ ├── EtcIndividualTrys.cpp │ │ │ ├── EtcIndividualTrys.h │ │ │ ├── EtcSortedBlockList.cpp │ │ │ └── EtcSortedBlockList.h │ ├── FreeImage │ │ ├── FreeImage.def │ │ ├── FreeImage.h │ │ ├── Whatsnew.txt │ │ ├── license-fi.txt │ │ └── license-gpl.txt │ ├── atitc │ │ ├── ATI_Compress.chm │ │ └── ATI_Compress.h │ ├── butteraugli │ │ ├── CMakeLists.txt │ │ ├── butteraugli.cc │ │ └── butteraugli.h │ ├── etcpack │ │ ├── CMakeLists.txt │ │ ├── etcdec.cxx │ │ ├── etcpack.cxx │ │ ├── image.cxx │ │ └── image.h │ ├── glew │ │ ├── LICENSE.txt │ │ ├── README.txt │ │ └── include │ │ │ └── GL │ │ │ ├── glew.h │ │ │ ├── glxew.h │ │ │ └── wglew.h │ ├── gnuwin32 │ │ ├── CMakeLists.txt │ │ └── include │ │ │ ├── jconfig.h │ │ │ ├── jerror.h │ │ │ ├── jmorecfg.h │ │ │ ├── jpeglib.h │ │ │ ├── png.h │ │ │ ├── pngconf.h │ │ │ ├── tiff.h │ │ │ ├── tiffconf.h │ │ │ ├── tiffio.h │ │ │ ├── tiffvers.h │ │ │ ├── zconf.h │ │ │ └── zlib.h │ ├── poshlib │ │ ├── CMakeLists.txt │ │ ├── posh.c │ │ └── posh.h │ ├── pvrtextool │ │ └── Include │ │ │ ├── PVRTArray.h │ │ │ ├── PVRTDecompress.h │ │ │ ├── PVRTError.h │ │ │ ├── PVRTGlobal.h │ │ │ ├── PVRTMap.h │ │ │ ├── PVRTString.h │ │ │ ├── PVRTTexture.h │ │ │ ├── PVRTTypes.h │ │ │ ├── PVRTexture.h │ │ │ ├── PVRTextureDefines.h │ │ │ ├── PVRTextureFormat.h │ │ │ ├── PVRTextureHeader.h │ │ │ ├── PVRTextureUtilities.h │ │ │ └── PVRTextureVersion.h │ ├── rg_etc1_v104 │ │ ├── CMakeLists.txt │ │ ├── rg_etc1.cpp │ │ └── rg_etc1.h │ ├── skylight │ │ ├── ArHosekSkyModel.c │ │ ├── ArHosekSkyModel.h │ │ ├── ArHosekSkyModelData.h │ │ └── README.txt │ └── stb │ │ ├── stb_dxt.h │ │ └── stb_image.h │ └── src │ ├── CMakeLists.txt │ ├── bc6h │ ├── CMakeLists.txt │ ├── bits.h │ ├── shapes_two.h │ ├── tile.h │ ├── zoh.cpp │ ├── zoh.h │ ├── zoh_utils.cpp │ ├── zoh_utils.h │ ├── zohone.cpp │ └── zohtwo.cpp │ ├── bc7 │ ├── CMakeLists.txt │ ├── avpcl.cpp │ ├── avpcl.h │ ├── avpcl_mode0.cpp │ ├── avpcl_mode1.cpp │ ├── avpcl_mode2.cpp │ ├── avpcl_mode3.cpp │ ├── avpcl_mode4.cpp │ ├── avpcl_mode5.cpp │ ├── avpcl_mode6.cpp │ ├── avpcl_mode7.cpp │ ├── avpcl_utils.cpp │ ├── avpcl_utils.h │ ├── bits.h │ ├── endpts.h │ ├── shapes_three.h │ ├── shapes_two.h │ └── tile.h │ ├── nvconfig.h.in │ ├── nvcore │ ├── Array.h │ ├── Array.inl │ ├── CMakeLists.txt │ ├── Debug.cpp │ ├── Debug.h │ ├── DefsGnucDarwin.h │ ├── DefsGnucLinux.h │ ├── DefsGnucWin32.h │ ├── DefsVcWin32.h │ ├── FileSystem.cpp │ ├── FileSystem.h │ ├── ForEach.h │ ├── Hash.h │ ├── Memory.cpp │ ├── Memory.h │ ├── Ptr.h │ ├── RefCounted.h │ ├── StdStream.h │ ├── StrLib.cpp │ ├── StrLib.h │ ├── Stream.h │ ├── TextWriter.cpp │ ├── TextWriter.h │ ├── Timer.cpp │ ├── Timer.h │ ├── Utils.h │ └── nvcore.h │ ├── nvimage │ ├── BlockDXT.cpp │ ├── BlockDXT.h │ ├── CMakeLists.txt │ ├── ColorBlock.cpp │ ├── ColorBlock.h │ ├── ColorSpace.cpp │ ├── ColorSpace.h │ ├── DirectDrawSurface.cpp │ ├── DirectDrawSurface.h │ ├── ErrorMetric.cpp │ ├── ErrorMetric.h │ ├── Filter.cpp │ ├── Filter.h │ ├── FloatImage.cpp │ ├── FloatImage.h │ ├── Image.cpp │ ├── Image.h │ ├── ImageIO.cpp │ ├── ImageIO.h │ ├── KtxFile.cpp │ ├── KtxFile.h │ ├── NormalMap.cpp │ ├── NormalMap.h │ ├── PixelFormat.h │ ├── PsdFile.h │ ├── Quantize.cpp │ ├── Quantize.h │ ├── TgaFile.h │ ├── ValveTextureFormat.h │ └── nvimage.h │ ├── nvmath │ ├── Box.cpp │ ├── Box.h │ ├── Box.inl │ ├── CMakeLists.txt │ ├── Color.cpp │ ├── Color.h │ ├── Color.inl │ ├── Fitting.cpp │ ├── Fitting.h │ ├── Gamma.cpp │ ├── Gamma.h │ ├── Half.cpp │ ├── Half.h │ ├── Matrix.cpp │ ├── Matrix.h │ ├── Matrix.inl │ ├── PackedFloat.cpp │ ├── PackedFloat.h │ ├── Plane.cpp │ ├── Plane.h │ ├── Plane.inl │ ├── SimdVector.h │ ├── SimdVector_SSE.h │ ├── SimdVector_VE.h │ ├── SphericalHarmonic.cpp │ ├── SphericalHarmonic.h │ ├── Vector.cpp │ ├── Vector.h │ ├── Vector.inl │ ├── ftoi.h │ └── nvmath.h │ ├── nvthread │ ├── Atomic.h │ ├── CMakeLists.txt │ ├── Event.cpp │ ├── Event.h │ ├── Mutex.cpp │ ├── Mutex.h │ ├── ParallelFor.cpp │ ├── ParallelFor.h │ ├── Thread.cpp │ ├── Thread.h │ ├── ThreadPool.cpp │ ├── ThreadPool.h │ ├── Win32.h │ ├── nvthread.cpp │ └── nvthread.h │ └── nvtt │ ├── BlockCompressor.cpp │ ├── BlockCompressor.h │ ├── CMakeLists.txt │ ├── ClusterFit.cpp │ ├── ClusterFit.h │ ├── CompressionOptions.cpp │ ├── CompressionOptions.h │ ├── Compressor.h │ ├── CompressorDX10.cpp │ ├── CompressorDX10.h │ ├── CompressorDX11.cpp │ ├── CompressorDX11.h │ ├── CompressorDX9.cpp │ ├── CompressorDX9.h │ ├── CompressorDXT1.cpp │ ├── CompressorDXT1.h │ ├── CompressorDXT5_RGBM.cpp │ ├── CompressorDXT5_RGBM.h │ ├── CompressorETC.cpp │ ├── CompressorETC.h │ ├── CompressorRGB.cpp │ ├── CompressorRGB.h │ ├── Context.cpp │ ├── Context.h │ ├── CubeSurface.cpp │ ├── CubeSurface.h │ ├── InputOptions.cpp │ ├── InputOptions.h │ ├── OptimalCompressDXT.cpp │ ├── OptimalCompressDXT.h │ ├── OutputOptions.cpp │ ├── OutputOptions.h │ ├── QuickCompressDXT.cpp │ ├── QuickCompressDXT.h │ ├── SingleColorLookup.cpp │ ├── SingleColorLookup.h │ ├── Surface.cpp │ ├── Surface.h │ ├── TaskDispatcher.cpp │ ├── TaskDispatcher.h │ ├── cuda │ ├── BitmapTable.h │ ├── CompressKernel.cu │ ├── ConvolveKernel.cu │ ├── CudaCompressorDXT.cpp │ ├── CudaCompressorDXT.h │ ├── CudaMath.h │ ├── CudaUtils.cpp │ └── CudaUtils.h │ ├── experimental │ ├── nvtt_experimental.cpp │ ├── nvtt_experimental.h │ └── test.cpp │ ├── nvtt.cpp │ ├── nvtt.h │ ├── nvtt_wrapper.cpp │ ├── nvtt_wrapper.h │ ├── squish │ ├── CMakeLists.txt │ ├── ChangeLog │ ├── Doxyfile │ ├── README │ ├── alpha.cpp │ ├── alpha.h │ ├── clusterfit.cpp │ ├── clusterfit.h │ ├── colourblock.cpp │ ├── colourblock.h │ ├── colourfit.cpp │ ├── colourfit.h │ ├── colourset.cpp │ ├── colourset.h │ ├── config │ ├── config.h │ ├── extra │ │ ├── squishgen.cpp │ │ ├── squishgen2.cpp │ │ ├── squishpng.cpp │ │ └── squishtest.cpp │ ├── fastclusterfit.cpp │ ├── fastclusterfit.h │ ├── fastclusterlookup.inl │ ├── maths.cpp │ ├── maths.h │ ├── rangefit.cpp │ ├── rangefit.h │ ├── simd.h │ ├── simd_3dnow.h │ ├── simd_sse.h │ ├── simd_ve.h │ ├── singlechannelfit.cpp │ ├── singlechannelfit.h │ ├── singlecolourfit.cpp │ ├── singlecolourfit.h │ ├── singlecolourlookup.inl │ ├── squish.cpp │ ├── squish.h │ ├── weightedclusterfit.cpp │ └── weightedclusterfit.h │ ├── tests │ ├── CMakeLists.txt │ ├── GoogleCharts.h │ ├── ctest.c │ ├── cubemaptest.cpp │ ├── driverapi.cpp │ ├── filtertest.cpp │ ├── hdrtest.cpp │ ├── imperativeapi.cpp │ ├── mpegenc.cpp │ ├── process_alpha_map.cpp │ └── testsuite.cpp │ └── tools │ ├── CMakeLists.txt │ ├── assemble.cpp │ ├── benchmark.cpp │ ├── cmdline.h │ ├── compress.cpp │ ├── compressdialog.cpp │ ├── compressdialog.h │ ├── compressdialog.ui │ ├── ddsinfo.cpp │ ├── ddsview.cpp │ ├── decompress.cpp │ ├── imgdiff.cpp │ ├── nvtt-thumbnailer.schema.in │ ├── resize.cpp │ ├── thumbnailer.cpp │ └── ui │ ├── configdialog.cpp │ ├── configdialog.h │ ├── configdialog.ui │ └── main.cpp ├── include ├── common │ ├── filesystem.h │ ├── header.h │ ├── image.h │ ├── material.h │ ├── mesh.h │ └── scene.h ├── exporter │ ├── image_exporter.h │ ├── material_exporter.h │ ├── mesh_exporter.h │ └── scene_exporter.h ├── importer │ ├── image_importer.h │ └── mesh_importer.h └── loader │ └── loader.h └── src ├── brdf_lut ├── CMakeLists.txt └── main.cpp ├── common ├── CMakeLists.txt ├── filesystem.cpp └── image.cpp ├── exporter ├── CMakeLists.txt ├── image_exporter.cpp ├── material_exporter.cpp ├── mesh_exporter.cpp └── scene_exporter.cpp ├── image_export ├── CMakeLists.txt └── main.cpp ├── importer ├── CMakeLists.txt ├── image_importer.cpp └── mesh_importer.cpp ├── loader ├── CMakeLists.txt └── loader.cpp ├── mesh_export ├── CMakeLists.txt └── main.cpp └── sh_project ├── CMakeLists.txt └── main.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: WebKit 3 | AlignAfterOpenBracket: Align 4 | AlignConsecutiveAssignments: 'true' 5 | AlignConsecutiveDeclarations: 'true' 6 | AlignEscapedNewlines: Left 7 | AlignOperands: 'false' 8 | AlignTrailingComments: 'true' 9 | AllowAllParametersOfDeclarationOnNextLine: 'true' 10 | AllowShortBlocksOnASingleLine: 'true' 11 | AllowShortCaseLabelsOnASingleLine: 'true' 12 | AllowShortFunctionsOnASingleLine: All 13 | AllowShortIfStatementsOnASingleLine: 'true' 14 | AllowShortLoopsOnASingleLine: 'true' 15 | AlwaysBreakAfterReturnType: None 16 | AlwaysBreakBeforeMultilineStrings: 'false' 17 | AlwaysBreakTemplateDeclarations: 'true' 18 | BinPackArguments: 'false' 19 | BinPackParameters: 'false' 20 | BreakBeforeBraces: Allman 21 | BreakBeforeInheritanceComma: 'false' 22 | BreakBeforeTernaryOperators: 'false' 23 | BreakConstructorInitializers: AfterColon 24 | BreakStringLiterals: 'true' 25 | CompactNamespaces: 'true' 26 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' 27 | Cpp11BracedListStyle: 'false' 28 | FixNamespaceComments: 'true' 29 | IncludeBlocks: Regroup 30 | IndentCaseLabels: 'true' 31 | IndentPPDirectives: AfterHash 32 | IndentWrappedFunctionNames: 'true' 33 | KeepEmptyLinesAtTheStartOfBlocks: 'false' 34 | Language: Cpp 35 | NamespaceIndentation: None 36 | PointerAlignment: Left 37 | ReflowComments: 'true' 38 | SortIncludes: 'false' 39 | SortUsingDeclarations: 'true' 40 | SpaceAfterCStyleCast: 'false' 41 | SpaceBeforeAssignmentOperators: 'true' 42 | SpaceBeforeParens: ControlStatements 43 | SpaceInEmptyParentheses: 'false' 44 | SpacesInAngles: 'false' 45 | SpacesInCStyleCastParentheses: 'false' 46 | SpacesInContainerLiterals: 'true' 47 | SpacesInParentheses: 'false' 48 | SpacesInSquareBrackets: 'false' 49 | 50 | ... 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | external/assimp 35 | external/assimp/* 36 | external/glm 37 | external/glm/* 38 | external/json 39 | external/json/* 40 | external/stb 41 | external/stb/* 42 | bin/ 43 | bin/* 44 | lib/ 45 | lib/* 46 | build/ 47 | build/* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/assimp"] 2 | path = external/assimp 3 | url = https://github.com/assimp/assimp.git 4 | [submodule "external/glm"] 5 | path = external/glm 6 | url = https://github.com/g-truc/glm.git 7 | [submodule "external/json"] 8 | path = external/json 9 | url = https://github.com/nlohmann/json.git 10 | [submodule "external/stb"] 11 | path = external/stb 12 | url = https://github.com/nothings/stb.git 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dihara Wijetunga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License: MIT](https://img.shields.io/packagist/l/doctrine/orm.svg)](https://opensource.org/licenses/MIT) 2 | 3 | # AssetCore 4 | A command line tool that converts game assets into a simple binary format for fast loading. 5 | 6 | ## Dependencies 7 | * [Assimp](https://github.com/assimp/assimp) 8 | * [glm](https://github.com/g-truc/glm) 9 | * [json](https://github.com/nlohmann/json) 10 | 11 | ## License 12 | ``` 13 | Copyright (c) 2019 Dihara Wijetunga 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 16 | associated documentation files (the "Software"), to deal in the Software without restriction, 17 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 18 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 19 | subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial 22 | portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 25 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 26 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 28 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | ``` 30 | -------------------------------------------------------------------------------- /external/cmft/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8 FATAL_ERROR) 2 | 3 | project("cmft") 4 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/external") 6 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/external") 7 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 8 | 9 | IF(APPLE) 10 | set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14") 11 | set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") 12 | set(CMAKE_EXE_LINKER_FLAGS "-pagezero_size 10000 -image_base 100000000") 13 | ENDIF() 14 | 15 | set(CL_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/dependency/CL") 16 | set(DEP_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/dependency") 17 | set(CMFT_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include") 18 | 19 | 20 | include_directories("${CL_INCLUDE_DIRS}" 21 | "${DEP_INCLUDE_DIRS}" 22 | "${CMFT_INCLUDE_DIRS}") 23 | 24 | add_subdirectory(src/cmft) 25 | -------------------------------------------------------------------------------- /external/cmft/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014-2015 Dario Manesku. All rights reserved. 2 | 3 | https://github.com/dariomanesku/cmft 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR 16 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 18 | SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 23 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 24 | OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | https://github.com/dariomanesku/cmft/blob/master/LICENSE 27 | -------------------------------------------------------------------------------- /external/cmft/dependency/CL/opencl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2012 The Khronos Group Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and/or associated documentation files (the 6 | * "Materials"), to deal in the Materials without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Materials, and to 9 | * permit persons to whom the Materials are furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included 13 | * in all copies or substantial portions of the Materials. 14 | * 15 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 22 | ******************************************************************************/ 23 | 24 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | #ifndef __OPENCL_H 27 | #define __OPENCL_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #ifdef __APPLE__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __OPENCL_H */ 54 | 55 | -------------------------------------------------------------------------------- /external/cmft/include/cmft/clcontext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #ifndef CMFT_CLCONTEXT_H_HEADER_GUARD 7 | #define CMFT_CLCONTEXT_H_HEADER_GUARD 8 | 9 | #include 10 | 11 | #define CMFT_CL_VENDOR_INTEL (0x1) 12 | #define CMFT_CL_VENDOR_AMD (0x2) 13 | #define CMFT_CL_VENDOR_NVIDIA (0x4) 14 | #define CMFT_CL_VENDOR_OTHER (0x8) 15 | #define CMFT_CL_VENDOR_ANY_GPU (CMFT_CL_VENDOR_AMD|CMFT_CL_VENDOR_NVIDIA) 16 | #define CMFT_CL_VENDOR_ANY_CPU (CMFT_CL_VENDOR_AMD|CMFT_CL_VENDOR_INTEL) 17 | 18 | #define CMFT_CL_DEVICE_TYPE_DEFAULT (1 << 0) /* CL_DEVICE_TYPE_DEFAULT */ 19 | #define CMFT_CL_DEVICE_TYPE_CPU (1 << 1) /* CL_DEVICE_TYPE_CPU */ 20 | #define CMFT_CL_DEVICE_TYPE_GPU (1 << 2) /* CL_DEVICE_TYPE_GPU */ 21 | #define CMFT_CL_DEVICE_TYPE_ACCELERATOR (1 << 3) /* CL_DEVICE_TYPE_ACCELERATOR */ 22 | #define CMFT_CL_DEVICE_TYPE_ALL (0xFFFFFFFF) /* CL_DEVICE_TYPE_ALL */ 23 | 24 | namespace cmft 25 | { 26 | // OpenCl. 27 | //---- 28 | 29 | int32_t clLoad(); 30 | void clPrintDevices(); 31 | int32_t clUnload(); 32 | 33 | 34 | // ClContext. 35 | //----- 36 | 37 | struct ClContext; 38 | 39 | ClContext* clInit(uint32_t _vendor = CMFT_CL_VENDOR_ANY_GPU 40 | , uint32_t _preferredDeviceType = CMFT_CL_DEVICE_TYPE_GPU 41 | , uint32_t _preferredDeviceIdx = 0 42 | , const char* _vendorStrPart = NULL 43 | ); 44 | void clDestroy(ClContext* _context); 45 | 46 | } // namespace cmft 47 | 48 | #endif //CMFT_CLCONTEXT_H_HEADER_GUARD 49 | 50 | /* vim: set sw=4 ts=4 expandtab: */ 51 | -------------------------------------------------------------------------------- /external/cmft/include/cmft/print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #ifndef CMFT_PRINT_H_HEADER_GUARD 7 | #define CMFT_PRINT_H_HEADER_GUARD 8 | 9 | namespace cmft 10 | { 11 | typedef int (*PrintFunc)(const char* _format, ...); 12 | 13 | void setWarningPrintf(PrintFunc _printf); 14 | void setInfoPrintf(PrintFunc _printf); 15 | 16 | } // namespace cmft 17 | 18 | #endif //CMFT_PRINT_H_HEADER_GUARD 19 | 20 | /* vim: set sw=4 ts=4 expandtab: */ 21 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++") 5 | 6 | file(GLOB_RECURSE TERMINUS_SOURCE *.cpp 7 | *.h 8 | *.c 9 | ${PROJECT_SOURCE_DIR}/include/*.h) 10 | 11 | add_library(cmft ${TERMINUS_SOURCE}) 12 | 13 | set_target_properties( cmft 14 | PROPERTIES 15 | ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib/cmft" 16 | LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib/cmft" 17 | RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin/" ) 18 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/allocator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #include 7 | 8 | namespace cmft 9 | { 10 | CrtAllocator g_crtAllocator; 11 | CrtStackAllocator g_crtStackAllocator; 12 | 13 | AllocatorI* g_allocator = &g_crtAllocator; 14 | StackAllocatorI* g_stackAllocator = &g_crtStackAllocator; 15 | 16 | void setAllocator(AllocatorI* _allocator) 17 | { 18 | g_allocator = (NULL != _allocator) ? _allocator : &g_crtAllocator; 19 | } 20 | 21 | void setStackAllocator(StackAllocatorI* _stackAllocator) 22 | { 23 | g_stackAllocator = (NULL != _stackAllocator) ? _stackAllocator : &g_crtStackAllocator; 24 | } 25 | 26 | } // namespace cmft 27 | 28 | /* vim: set sw=4 ts=4 expandtab: */ 29 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/clcontext_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #ifndef CMFT_CLCONTEXT_INTERNAL_H_HEADER_GUARD 7 | #define CMFT_CLCONTEXT_INTERNAL_H_HEADER_GUARD 8 | 9 | #include "common/cl.h" 10 | 11 | namespace cmft 12 | { 13 | struct ClContext 14 | { 15 | ClContext() 16 | { 17 | m_device = NULL; 18 | m_context = NULL; 19 | m_commandQueue = NULL; 20 | m_deviceVendor[0] = '\0'; 21 | m_deviceName[0] = '\0'; 22 | } 23 | 24 | cl_device_id m_device; 25 | cl_context m_context; 26 | cl_command_queue m_commandQueue; 27 | cl_device_type m_deviceType; 28 | char m_deviceVendor[128]; 29 | char m_deviceName[128]; 30 | }; 31 | 32 | } // namespace cmft 33 | 34 | #endif //CMFT_CLCONTEXT_INTERNAL_H_HEADER_GUARD 35 | 36 | /* vim: set sw=4 ts=4 expandtab: */ 37 | 38 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/common/print.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #include "config.h" 7 | #include 8 | #include // ::printf 9 | 10 | namespace cmft 11 | { 12 | PrintFunc printfWarning = ::printf; 13 | PrintFunc printfInfo = ::printf; 14 | 15 | void setWarningPrintf(PrintFunc _printf) 16 | { 17 | printfWarning = _printf; 18 | } 19 | 20 | void setInfoPrintf(PrintFunc _printf) 21 | { 22 | printfInfo = _printf; 23 | } 24 | 25 | } // namespace cmft 26 | 27 | /* vim: set sw=4 ts=4 expandtab: */ 28 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/common/stb_image.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #include "utils.h" 7 | 8 | CMFT_PRAGMA_DIAGNOSTIC_PUSH(); 9 | CMFT_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow"); 10 | CMFT_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-function"); 11 | CMFT_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wcast-qual"); 12 | #ifndef STB_IMAGE_IMPLEMENTATION 13 | #define STB_IMAGE_IMPLEMENTATION 14 | #include 15 | #endif 16 | CMFT_PRAGMA_DIAGNOSTIC_POP(); 17 | 18 | /* vim: set sw=4 ts=4 expandtab: */ 19 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/common/stb_image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | #ifndef CMFT_STB_IMAGE_H_HEADER_GUARD 7 | #define CMFT_STB_IMAGE_H_HEADER_GUARD 8 | 9 | #include 10 | 11 | #endif // CMFT_STB_IMAGE_HEADER_GUARD 12 | 13 | /* vim: set sw=4 ts=4 expandtab: */ 14 | 15 | -------------------------------------------------------------------------------- /external/cmft/src/cmft/common/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Dario Manesku. All rights reserved. 3 | * License: http://www.opensource.org/licenses/BSD-2-Clause 4 | */ 5 | 6 | /* 7 | * Adapted from: https://github.com/bkaradzic/bx/include/bx/timer.h 8 | * Copyright 2010-2016 Branimir Karadzic. All rights reserved. 9 | * License: https://github.com/bkaradzic/bx#license-bsd-2-clause 10 | */ 11 | #ifndef CMFT_OS_H_HEADER_GUARD 12 | #define CMFT_OS_H_HEADER_GUARD 13 | 14 | #include "platform.h" 15 | #include 16 | 17 | #if CMFT_PLATFORM_WINDOWS 18 | # include 19 | #else 20 | # include // gettimeofday 21 | #endif // CMFT_PLATFORM_ 22 | 23 | namespace cmft 24 | { 25 | inline int64_t getHPCounter() 26 | { 27 | #if CMFT_PLATFORM_WINDOWS 28 | LARGE_INTEGER li; 29 | // Performance counter value may unexpectedly leap forward 30 | // http://support.microsoft.com/kb/274323 31 | QueryPerformanceCounter(&li); 32 | int64_t i64 = li.QuadPart; 33 | #else 34 | struct timeval now; 35 | gettimeofday(&now, 0); 36 | int64_t i64 = now.tv_sec*INT64_C(1000000) + now.tv_usec; 37 | #endif // CMFT_PLATFORM_ 38 | 39 | return i64; 40 | } 41 | 42 | inline int64_t getHPFrequency() 43 | { 44 | #if CMFT_PLATFORM_WINDOWS 45 | LARGE_INTEGER li; 46 | QueryPerformanceFrequency(&li); 47 | return li.QuadPart; 48 | #else 49 | return INT64_C(1000000); 50 | #endif // CMFT_PLATFORM_ 51 | } 52 | } 53 | 54 | #endif // CMFT_OS_H_HEADER_GUARD 55 | 56 | /* vim: set sw=4 ts=4 expandtab: */ 57 | 58 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/.gitignore: -------------------------------------------------------------------------------- 1 | **/bin/ 2 | **/obj/ 3 | **/Debug/ 4 | **/Release/ 5 | **/Debug.x64/ 6 | **/Release.x64/ 7 | **/Debug.Win32/ 8 | **/Release.Win32/ 9 | **/Debug-CUDA/ 10 | **/Release-CUDA/ 11 | *.vcxproj.user 12 | *.opensdf 13 | *.sdf 14 | *.suo 15 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/CMakeLists.txt -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/README.md: -------------------------------------------------------------------------------- 1 | NVIDIA Texture Tools 2 | ==================== 3 | 4 | The NVIDIA Texture Tools is a collection of image processing and texture 5 | manipulation tools, designed to be integrated in game tools and asset 6 | processing pipelines. 7 | 8 | The primary features of the library are mipmap and normal map generation, format 9 | conversion, and DXT compression. 10 | 11 | 12 | ### How to build (Windows) 13 | 14 | Open `project/vc12/thekla.sln` using Visual Studio. 15 | 16 | Solutions for previous versions are also available, but they may not be up to date. 17 | 18 | 19 | ### How to build (Linux/OSX) 20 | 21 | Use [cmake](http://www.cmake.org/) and the provided configure script: 22 | 23 | ```bash 24 | $ ./configure 25 | $ make 26 | $ sudo make install 27 | ``` 28 | 29 | 30 | ### Using NVIDIA Texture Tools 31 | 32 | To use the NVIDIA Texture Tools in your own applications you just have to 33 | include the following header file: 34 | 35 | src/nvtt/nvtt.h 36 | 37 | And include the nvtt library in your projects. 38 | 39 | The following file contains a simple example that shows how to use the library: 40 | 41 | src/nvtt/tools/compress.cpp 42 | 43 | Detailed documentation of the API can be found at: 44 | 45 | https://github.com/castano/nvidia-texture-tools/wiki/ApiDocumentation 46 | 47 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/VERSION: -------------------------------------------------------------------------------- 1 | 2.1.1 2 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/buildpkg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | tar zcvf nvidia-texture-tools-`cat VERSION`.tar.gz \ 4 | --exclude '.*' --exclude debian --exclude '*~' --exclude buildpkg \ 5 | --exclude 'build-*' --exclude data --exclude tags --exclude Makefile \ 6 | --exclude 'doc' --exclude 'nvidia-texture-tools-*.tar.gz' \ 7 | --exclude 'extern/skylight' --exclude 'extern/FreeImage' \ 8 | --exclude 'extern/atitc' --exclude 'extern/glew' \ 9 | --exclude 'extern/gnuwin32' \ 10 | --exclude '*.user' -s ',^,nvidia-texture-tools/,' * 11 | # --exclude '*.user' --transform 's,^,nvidia-texture-tools/,' * 12 | # --exclude '*.user' * 13 | 14 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | ${FREEIMAGE_ROOT_DIR}/include 13 | ${FREEIMAGE_ROOT_DIR} 14 | DOC "The directory where FreeImage.h resides") 15 | FIND_LIBRARY( FREEIMAGE_LIBRARY 16 | NAMES FreeImage freeimage 17 | PATHS 18 | ${FREEIMAGE_ROOT_DIR}/lib 19 | ${FREEIMAGE_ROOT_DIR} 20 | DOC "The FreeImage library") 21 | ELSE (WIN32) 22 | FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h 23 | /usr/include 24 | /usr/local/include 25 | /sw/include 26 | /opt/local/include 27 | DOC "The directory where FreeImage.h resides") 28 | FIND_LIBRARY( FREEIMAGE_LIBRARY 29 | NAMES FreeImage freeimage 30 | PATHS 31 | /usr/lib64 32 | /usr/lib 33 | /usr/local/lib64 34 | /usr/local/lib 35 | /sw/lib 36 | /opt/local/lib 37 | DOC "The FreeImage library") 38 | ENDIF (WIN32) 39 | 40 | SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY}) 41 | 42 | IF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) 43 | SET( FREEIMAGE_FOUND TRUE CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise") 44 | ELSE (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) 45 | SET( FREEIMAGE_FOUND FALSE CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise") 46 | ENDIF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) 47 | 48 | MARK_AS_ADVANCED( 49 | FREEIMAGE_FOUND 50 | FREEIMAGE_LIBRARY 51 | FREEIMAGE_LIBRARIES 52 | FREEIMAGE_INCLUDE_PATH) 53 | 54 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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_DIR}/include 14 | DOC "The directory where GL/glew.h resides") 15 | 16 | FIND_LIBRARY( GLEW_LIBRARY 17 | NAMES glew GLEW glew32 glew32s 18 | PATHS 19 | $ENV{PROGRAMFILES}/GLEW/lib 20 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin 21 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib 22 | DOC "The GLEW library") 23 | ELSE (WIN32) 24 | FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h 25 | /usr/include 26 | /usr/local/include 27 | /sw/include 28 | /opt/local/include 29 | ${GLEW_ROOT_DIR}/include 30 | DOC "The directory where GL/glew.h resides") 31 | 32 | # Prefer the static library. 33 | FIND_LIBRARY( GLEW_LIBRARY 34 | NAMES libGLEW.a GLEW 35 | PATHS 36 | /usr/lib64 37 | /usr/lib 38 | /usr/local/lib64 39 | /usr/local/lib 40 | /sw/lib 41 | /opt/local/lib 42 | ${GLEW_ROOT_DIR}/lib 43 | DOC "The GLEW library") 44 | ENDIF (WIN32) 45 | 46 | SET(GLEW_FOUND "NO") 47 | IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY) 48 | SET(GLEW_LIBRARIES ${GLEW_LIBRARY}) 49 | SET(GLEW_FOUND "YES") 50 | ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY) 51 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/cmake/FindOpenEXR.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find OpenEXR's libraries, and include path. 3 | # Once done this will define: 4 | # 5 | # OPENEXR_FOUND = OpenEXR found. 6 | # OPENEXR_INCLUDE_PATHS = OpenEXR include directories. 7 | # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. 8 | # 9 | 10 | INCLUDE(FindZLIB) 11 | 12 | 13 | IF(ZLIB_FOUND) 14 | 15 | SET(LIBRARY_PATHS 16 | /usr/lib 17 | /usr/local/lib 18 | /sw/lib 19 | /opt/local/lib 20 | $ENV{PROGRAM_FILES}/OpenEXR/lib/static) 21 | 22 | FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h 23 | PATH_SUFFIXES OpenEXR 24 | /usr/include 25 | /usr/local/include 26 | /sw/include 27 | /opt/local/include) 28 | 29 | FIND_LIBRARY(OPENEXR_HALF_LIBRARY 30 | NAMES Half 31 | PATHS ${LIBRARY_PATHS}) 32 | 33 | FIND_LIBRARY(OPENEXR_IEX_LIBRARY 34 | NAMES Iex 35 | PATHS ${LIBRARY_PATHS}) 36 | 37 | FIND_LIBRARY(OPENEXR_IMATH_LIBRARY 38 | NAMES Imath 39 | PATHS ${LIBRARY_PATHS}) 40 | 41 | FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY 42 | NAMES IlmImf 43 | PATHS ${LIBRARY_PATHS}) 44 | 45 | FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY 46 | NAMES IlmThread 47 | PATHS ${LIBRARY_PATHS}) 48 | 49 | ENDIF(ZLIB_FOUND) 50 | 51 | #MESSAGE(STATUS ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY}) 52 | 53 | IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) 54 | SET(OPENEXR_FOUND TRUE) 55 | SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR") 56 | SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR") 57 | ENDIF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) 58 | 59 | IF(OPENEXR_FOUND) 60 | IF(NOT OPENEXR_FIND_QUIETLY) 61 | MESSAGE(STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}") 62 | ENDIF(NOT OPENEXR_FIND_QUIETLY) 63 | ELSE(OPENEXR_FOUND) 64 | IF(OPENEXR_FIND_REQUIRED) 65 | MESSAGE(FATAL_ERROR "Could not find OpenEXR library") 66 | ENDIF(OPENEXR_FIND_REQUIRED) 67 | ENDIF(OPENEXR_FOUND) 68 | 69 | MARK_AS_ADVANCED( 70 | OPENEXR_INCLUDE_PATHS 71 | OPENEXR_LIBRARIES 72 | OPENEXR_ILMIMF_LIBRARY 73 | OPENEXR_IMATH_LIBRARY 74 | OPENEXR_IEX_LIBRARY 75 | OPENEXR_HALF_LIBRARY) 76 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | * ) echo "Unrecognised argument $i" ;; 33 | esac 34 | done 35 | 36 | if [ "$help" = "true" ] 37 | then 38 | echo "-----------------------------------------------" 39 | echo "nvidia-texture-tools "`cat VERSION`" configuration script" 40 | echo "-----------------------------------------------" 41 | echo 42 | echo "--help Show this message." 43 | echo "--debug Configure debug build." 44 | echo "--release Configure release build." 45 | echo "--prefix=path Installation prefix." 46 | echo "--include=path Include path." 47 | echo "--lib=path Library path." 48 | exit 0 49 | fi 50 | 51 | echo "-- Configuring nvidia-texture-tools "`cat VERSION` 52 | 53 | mkdir -p ./build-$build 54 | cd ./build-$build 55 | $CMAKE .. -DNVTT_SHARED=0 -DCMAKE_BUILD_TYPE=$build -DCMAKE_INSTALL_PREFIX=$prefix -G "Unix Makefiles" || exit 1 56 | cd .. 57 | 58 | echo "" 59 | echo -e "Your configure completed "$GREEN"successfully"$NORMAL", now type "$BOLD"make"$NORMAL 60 | echo "" 61 | 62 | cat > Makefile << EOF 63 | all: 64 | @+make --no-print-directory -C build-$build/ 65 | install: 66 | @+make install --no-print-directory -C build-$build/ 67 | package: 68 | @+make package --no-print-directory -C build-$build/ 69 | test: 70 | @+make test --no-print-directory -C build-$build/ 71 | clean: 72 | @+make clean --no-print-directory -C build-$build/ 73 | distclean: 74 | @rm -Rf build-$build/ 75 | EOF 76 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/doc/release_todo: -------------------------------------------------------------------------------- 1 | Update version number in nvimage/DirectDrawSurface.cpp 2 | Update version number in CMakeLists.txt 3 | Update version number in VERSION 4 | Update version number in NVIDIA_Texture_Tools_README.txt 5 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | IF(WIN32) 3 | ADD_SUBDIRECTORY(gnuwin32) 4 | ENDIF(WIN32) 5 | 6 | ADD_SUBDIRECTORY(poshlib) 7 | 8 | ADD_SUBDIRECTORY(EtcLib) 9 | ADD_SUBDIRECTORY(rg_etc1_v104) 10 | #ADD_SUBDIRECTORY(etcpack) 11 | 12 | ADD_SUBDIRECTORY(butteraugli) 13 | 14 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The Etc2Comp Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | project(EtcLib) 16 | include_directories(./Etc) 17 | include_directories(./EtcCodec) 18 | 19 | file(GLOB SOURCES 20 | ${PROJECT_SOURCE_DIR}/Etc/*.h 21 | ${PROJECT_SOURCE_DIR}/EtcCodec/*.h 22 | ${PROJECT_SOURCE_DIR}/Etc/*.cpp 23 | ${PROJECT_SOURCE_DIR}/EtcCodec/*.cpp) 24 | ADD_LIBRARY(EtcLib STATIC ${SOURCES}) 25 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/Etc/Etc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "EtcConfig.h" 18 | #include "Etc.h" 19 | 20 | #include 21 | 22 | namespace Etc 23 | { 24 | // ---------------------------------------------------------------------------------------------------- 25 | // C-style inteface to the encoder 26 | // 27 | void Encode(float *a_pafSourceRGBA, 28 | unsigned int a_uiSourceWidth, 29 | unsigned int a_uiSourceHeight, 30 | Image::Format a_format, 31 | ErrorMetric a_eErrMetric, 32 | float a_fEffort, 33 | unsigned int a_uiJobs, 34 | unsigned int a_uiMaxJobs, 35 | unsigned char **a_ppaucEncodingBits, 36 | unsigned int *a_puiEncodingBitsBytes, 37 | unsigned int *a_puiExtendedWidth, 38 | unsigned int *a_puiExtendedHeight, 39 | int *a_piEncodingTime_ms, bool a_bVerboseOutput) 40 | { 41 | 42 | Image image(a_pafSourceRGBA, a_uiSourceWidth, 43 | a_uiSourceHeight, 44 | a_eErrMetric); 45 | image.m_bVerboseOutput = a_bVerboseOutput; 46 | image.Encode(a_format, a_eErrMetric, a_fEffort, a_uiJobs, a_uiMaxJobs); 47 | 48 | *a_ppaucEncodingBits = image.GetEncodingBits(); 49 | *a_puiEncodingBitsBytes = image.GetEncodingBitsBytes(); 50 | *a_puiExtendedWidth = image.GetExtendedWidth(); 51 | *a_puiExtendedHeight = image.GetExtendedHeight(); 52 | *a_piEncodingTime_ms = image.GetEncodingTimeMs(); 53 | } 54 | 55 | // ---------------------------------------------------------------------------------------------------- 56 | // 57 | 58 | } 59 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/Etc/Etc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "EtcConfig.h" 20 | #include "EtcImage.h" 21 | #include "EtcColor.h" 22 | #include "EtcErrorMetric.h" 23 | 24 | #define ETCCOMP_MIN_EFFORT_LEVEL (0.0f) 25 | #define ETCCOMP_DEFAULT_EFFORT_LEVEL (40.0f) 26 | #define ETCCOMP_MAX_EFFORT_LEVEL (100.0f) 27 | 28 | namespace Etc 29 | { 30 | class Block4x4EncodingBits; 31 | 32 | // C-style inteface to the encoder 33 | void Encode(float *a_pafSourceRGBA, 34 | unsigned int a_uiSourceWidth, 35 | unsigned int a_uiSourceHeight, 36 | Image::Format a_format, 37 | ErrorMetric a_eErrMetric, 38 | float a_fEffort, 39 | unsigned int a_uiJobs, 40 | unsigned int a_uimaxJobs, 41 | unsigned char **a_ppaucEncodingBits, 42 | unsigned int *a_puiEncodingBitsBytes, 43 | unsigned int *a_puiExtendedWidth, 44 | unsigned int *a_puiExtendedHeight, 45 | int *a_piEncodingTime_ms, bool a_bVerboseOutput = false); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/Etc/EtcColor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace Etc 22 | { 23 | 24 | inline float LogToLinear(float a_fLog) 25 | { 26 | static const float ALPHA = 0.055f; 27 | static const float ONE_PLUS_ALPHA = 1.0f + ALPHA; 28 | 29 | if (a_fLog <= 0.04045f) 30 | { 31 | return a_fLog / 12.92f; 32 | } 33 | else 34 | { 35 | return powf((a_fLog + ALPHA) / ONE_PLUS_ALPHA, 2.4f); 36 | } 37 | } 38 | 39 | inline float LinearToLog(float &a_fLinear) 40 | { 41 | static const float ALPHA = 0.055f; 42 | static const float ONE_PLUS_ALPHA = 1.0f + ALPHA; 43 | 44 | if (a_fLinear <= 0.0031308f) 45 | { 46 | return 12.92f * a_fLinear; 47 | } 48 | else 49 | { 50 | return ONE_PLUS_ALPHA * powf(a_fLinear, (1.0f/2.4f)) - ALPHA; 51 | } 52 | } 53 | 54 | class ColorR8G8B8A8 55 | { 56 | public: 57 | 58 | unsigned char ucR; 59 | unsigned char ucG; 60 | unsigned char ucB; 61 | unsigned char ucA; 62 | 63 | }; 64 | } 65 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/Etc/EtcConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #ifdef _WIN32 20 | #define ETC_WINDOWS (1) 21 | #else 22 | #define ETC_WINDOWS (0) 23 | #endif 24 | 25 | #if __APPLE__ 26 | #define ETC_OSX (1) 27 | #else 28 | #define ETC_OSX (0) 29 | #endif 30 | 31 | #if __unix__ 32 | #define ETC_UNIX (1) 33 | #else 34 | #define ETC_UNIX (0) 35 | #endif 36 | 37 | 38 | // short names for common types 39 | #include 40 | typedef int8_t i8; 41 | typedef int16_t i16; 42 | typedef int32_t i32; 43 | typedef int64_t i64; 44 | 45 | typedef uint8_t u8; 46 | typedef uint16_t u16; 47 | typedef uint32_t u32; 48 | typedef uint64_t u64; 49 | 50 | typedef float f32; 51 | typedef double f64; 52 | 53 | // Keep asserts enabled in release builds during development 54 | #undef NDEBUG 55 | 56 | // 0=disable. stb_image can be used if you need to compress 57 | //other image formats like jpg 58 | #define USE_STB_IMAGE_LOAD 0 59 | 60 | #if ETC_WINDOWS 61 | #include 62 | #define _CRT_SECURE_NO_WARNINGS (1) 63 | #include 64 | #endif 65 | 66 | #include 67 | 68 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/Etc/EtcMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "EtcConfig.h" 18 | #include "EtcMath.h" 19 | 20 | namespace Etc 21 | { 22 | 23 | // ---------------------------------------------------------------------------------------------------- 24 | // calculate the line that best fits the set of XY points contained in a_afX[] and a_afY[] 25 | // use a_fSlope and a_fOffset to define that line 26 | // 27 | bool Regression(float a_afX[], float a_afY[], unsigned int a_Points, 28 | float *a_fSlope, float *a_fOffset) 29 | { 30 | float fPoints = (float)a_Points; 31 | 32 | float fSumX = 0.0f; 33 | float fSumY = 0.0f; 34 | float fSumXY = 0.0f; 35 | float fSumX2 = 0.0f; 36 | 37 | for (unsigned int uiPoint = 0; uiPoint < a_Points; uiPoint++) 38 | { 39 | fSumX += a_afX[uiPoint]; 40 | fSumY += a_afY[uiPoint]; 41 | fSumXY += a_afX[uiPoint] * a_afY[uiPoint]; 42 | fSumX2 += a_afX[uiPoint] * a_afX[uiPoint]; 43 | } 44 | 45 | float fDivisor = fPoints*fSumX2 - fSumX*fSumX; 46 | 47 | // if vertical line 48 | if (fDivisor == 0.0f) 49 | { 50 | *a_fSlope = 0.0f; 51 | *a_fOffset = 0.0f; 52 | return true; 53 | } 54 | 55 | *a_fSlope = (fPoints*fSumXY - fSumX*fSumY) / fDivisor; 56 | *a_fOffset = (fSumY - (*a_fSlope)*fSumX) / fPoints; 57 | 58 | return false; 59 | } 60 | 61 | // ---------------------------------------------------------------------------------------------------- 62 | // 63 | 64 | } // namespace Etc 65 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/Etc/EtcMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace Etc 22 | { 23 | 24 | // ---------------------------------------------------------------------------------------------------- 25 | // return true if vertical line 26 | bool Regression(float a_afX[], float a_afY[], unsigned int a_Points, 27 | float *a_fSlope, float *a_fOffset); 28 | 29 | inline float ConvertMSEToPSNR(float a_fMSE) 30 | { 31 | if (a_fMSE == 0.0f) 32 | { 33 | return INFINITY; 34 | } 35 | 36 | return 10.0f * log10f(1.0f / a_fMSE); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/EtcCodec/EtcDifferentialTrys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "EtcColorFloatRGBA.h" 20 | 21 | namespace Etc 22 | { 23 | 24 | class DifferentialTrys 25 | { 26 | public: 27 | 28 | static const unsigned int MAX_RADIUS = 2; 29 | 30 | DifferentialTrys(ColorFloatRGBA a_frgbaColor1, 31 | ColorFloatRGBA a_frgbaColor2, 32 | const unsigned int *a_pauiPixelMapping1, 33 | const unsigned int *a_pauiPixelMapping2, 34 | unsigned int a_uiRadius, 35 | int a_iGrayOffset1, int a_iGrayOffset2); 36 | 37 | inline static int MoveAwayFromEdge(int a_i, int a_iDistance) 38 | { 39 | if (a_i < (0+ a_iDistance)) 40 | { 41 | return (0 + a_iDistance); 42 | } 43 | else if (a_i > (31- a_iDistance)) 44 | { 45 | return (31 - a_iDistance); 46 | } 47 | 48 | return a_i; 49 | } 50 | 51 | class Try 52 | { 53 | public : 54 | static const unsigned int SELECTORS = 8; // per half 55 | 56 | int m_iRed; 57 | int m_iGreen; 58 | int m_iBlue; 59 | unsigned int m_uiCW; 60 | unsigned int m_auiSelectors[SELECTORS]; 61 | float m_fError; 62 | }; 63 | 64 | class Half 65 | { 66 | public: 67 | 68 | static const unsigned int MAX_TRYS = 125; 69 | 70 | void Init(int a_iRed, int a_iGreen, int a_iBlue, 71 | const unsigned int *a_pauiPixelMapping, 72 | unsigned int a_uiRadius); 73 | 74 | // center of trys 75 | int m_iRed; 76 | int m_iGreen; 77 | int m_iBlue; 78 | 79 | const unsigned int *m_pauiPixelMapping; 80 | unsigned int m_uiRadius; 81 | 82 | unsigned int m_uiTrys; 83 | Try m_atry[MAX_TRYS]; 84 | 85 | Try *m_ptryBest; 86 | }; 87 | 88 | Half m_half1; 89 | Half m_half2; 90 | 91 | bool m_boolSeverelyBentColors; 92 | }; 93 | 94 | // ---------------------------------------------------------------------------------------------------- 95 | // 96 | 97 | } // namespace Etc 98 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/EtcCodec/EtcErrorMetric.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace Etc 20 | { 21 | 22 | enum ErrorMetric 23 | { 24 | RGBA, 25 | REC709, 26 | NUMERIC, 27 | NORMALXYZ, 28 | // 29 | ERROR_METRICS, 30 | // 31 | BT709 = REC709 32 | }; 33 | 34 | inline const char *ErrorMetricToString(ErrorMetric errorMetric) 35 | { 36 | switch (errorMetric) 37 | { 38 | case RGBA: 39 | return "RGBA"; 40 | case REC709: 41 | return "REC709"; 42 | case NUMERIC: 43 | return "NUMERIC"; 44 | case NORMALXYZ: 45 | return "NORMALXYZ"; 46 | case ERROR_METRICS: 47 | default: 48 | return "UNKNOWN"; 49 | } 50 | } 51 | } // namespace Etc 52 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/EtcLib/EtcCodec/EtcIndividualTrys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Etc2Comp Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "EtcColorFloatRGBA.h" 20 | 21 | namespace Etc 22 | { 23 | 24 | class IndividualTrys 25 | { 26 | public: 27 | 28 | static const unsigned int MAX_RADIUS = 1; 29 | 30 | IndividualTrys(ColorFloatRGBA a_frgbaColor1, 31 | ColorFloatRGBA a_frgbaColor2, 32 | const unsigned int *a_pauiPixelMapping1, 33 | const unsigned int *a_pauiPixelMapping2, 34 | unsigned int a_uiRadius); 35 | 36 | inline static int MoveAwayFromEdge(int a_i, int a_iDistance) 37 | { 38 | if (a_i < (0+ a_iDistance)) 39 | { 40 | return (0 + a_iDistance); 41 | } 42 | else if (a_i > (15- a_iDistance)) 43 | { 44 | return (15 - a_iDistance); 45 | } 46 | 47 | return a_i; 48 | } 49 | 50 | class Try 51 | { 52 | public : 53 | static const unsigned int SELECTORS = 8; // per half 54 | 55 | int m_iRed; 56 | int m_iGreen; 57 | int m_iBlue; 58 | unsigned int m_uiCW; 59 | unsigned int m_auiSelectors[SELECTORS]; 60 | float m_fError; 61 | }; 62 | 63 | class Half 64 | { 65 | public: 66 | 67 | static const unsigned int MAX_TRYS = 27; 68 | 69 | void Init(int a_iRed, int a_iGreen, int a_iBlue, 70 | const unsigned int *a_pauiPixelMapping, 71 | unsigned int a_uiRadius); 72 | 73 | // center of trys 74 | int m_iRed; 75 | int m_iGreen; 76 | int m_iBlue; 77 | 78 | const unsigned int *m_pauiPixelMapping; 79 | unsigned int m_uiRadius; 80 | 81 | unsigned int m_uiTrys; 82 | Try m_atry[MAX_TRYS]; 83 | 84 | Try *m_ptryBest; 85 | }; 86 | 87 | Half m_half1; 88 | Half m_half2; 89 | 90 | }; 91 | 92 | // ---------------------------------------------------------------------------------------------------- 93 | // 94 | 95 | } // namespace Etc 96 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/FreeImage/FreeImage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/extern/FreeImage/FreeImage.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/FreeImage/Whatsnew.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/extern/FreeImage/Whatsnew.txt -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/atitc/ATI_Compress.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/extern/atitc/ATI_Compress.chm -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/butteraugli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(BUTTERAUGLI_SRCS 3 | butteraugli.cc 4 | butteraugli.h) 5 | 6 | ADD_LIBRARY(butteraugli STATIC ${BUTTERAUGLI_SRCS}) 7 | 8 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/etcpack/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(ETCPACK_SRCS 3 | etcdec.cxx 4 | etcpack.cxx 5 | image.cxx 6 | image.h) 7 | 8 | add_definitions("-DPGMOUT=0") 9 | ADD_LIBRARY(etcpack STATIC ${ETCPACK_SRCS}) 10 | 11 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/glew/README.txt: -------------------------------------------------------------------------------- 1 | See doc/index.html for more information. 2 | 3 | If you downloaded the tarball from the GLEW website, you just need to: 4 | 5 | Unix: 6 | 7 | make 8 | 9 | Windows: 10 | 11 | use the project file in build/vc6/ 12 | 13 | If you wish to build GLEW from scratch (update the extension data from 14 | the net or add your own extension information), you need a Unix 15 | environment (including wget, perl, and GNU make). The extension data 16 | is regenerated from the top level source directory with: 17 | 18 | make extensions 19 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/gnuwin32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INSTALL(PROGRAMS 3 | bin/win32/jpeg62.dll 4 | bin/win32/libpng12.dll 5 | bin/win32/libtiff3.dll 6 | bin/win32/zlib1.dll 7 | DESTINATION bin) 8 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/poshlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(POSHLIB_SRCS 3 | posh.c 4 | posh.h) 5 | 6 | ADD_LIBRARY(posh STATIC ${POSHLIB_SRCS}) 7 | 8 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/pvrtextool/Include/PVRTDecompress.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | @File PVRTDecompress.h 4 | 5 | @Title PVRTDecompress 6 | 7 | @Version 8 | 9 | @Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential. 10 | 11 | @Platform ANSI compatible 12 | 13 | @Description PVRTC and ETC Texture Decompression. 14 | 15 | ******************************************************************************/ 16 | 17 | #ifndef _PVRTDECOMPRESS_H_ 18 | #define _PVRTDECOMPRESS_H_ 19 | 20 | /*!*********************************************************************** 21 | @Function PVRTDecompressPVRTC 22 | @Input pCompressedData The PVRTC texture data to decompress 23 | @Input Do2bitMode Signifies whether the data is PVRTC2 or PVRTC4 24 | @Input XDim X dimension of the texture 25 | @Input YDim Y dimension of the texture 26 | @Return Returns the amount of data that was decompressed. 27 | @Modified pResultImage The decompressed texture data 28 | @Description Decompresses PVRTC to RGBA 8888 29 | *************************************************************************/ 30 | int PVRTDecompressPVRTC(const void *pCompressedData, 31 | const int Do2bitMode, 32 | const int XDim, 33 | const int YDim, 34 | unsigned char* pResultImage); 35 | 36 | /*!*********************************************************************** 37 | @Function PVRTDecompressETC 38 | @Input pSrcData The ETC texture data to decompress 39 | @Input x X dimension of the texture 40 | @Input y Y dimension of the texture 41 | @Modified pDestData The decompressed texture data 42 | @Input nMode The format of the data 43 | @Returns The number of bytes of ETC data decompressed 44 | @Description Decompresses ETC to RGBA 8888 45 | *************************************************************************/ 46 | int PVRTDecompressETC(const void * const pSrcData, 47 | const unsigned int &x, 48 | const unsigned int &y, 49 | void *pDestData, 50 | const int &nMode); 51 | 52 | 53 | #endif /* _PVRTDECOMPRESS_H_ */ 54 | 55 | /***************************************************************************** 56 | End of file (PVRTBoneBatch.h) 57 | *****************************************************************************/ 58 | 59 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/pvrtextool/Include/PVRTError.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | @File PVRTError.h 4 | 5 | @Title PVRTError 6 | 7 | @Version 8 | 9 | @Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential. 10 | 11 | @Platform ANSI compatible 12 | 13 | @Description 14 | 15 | ******************************************************************************/ 16 | #ifndef _PVRTERROR_H_ 17 | #define _PVRTERROR_H_ 18 | 19 | #if defined(ANDROID) 20 | #include 21 | #else 22 | #if defined(_WIN32) 23 | #include 24 | #else 25 | #include 26 | #endif 27 | #endif 28 | /*!*************************************************************************** 29 | Macros 30 | *****************************************************************************/ 31 | 32 | /*! Outputs a string to the standard error if built for debugging. */ 33 | #if !defined(PVRTERROR_OUTPUT_DEBUG) 34 | #if defined(_DEBUG) || defined(DEBUG) 35 | #if defined(ANDROID) 36 | #define PVRTERROR_OUTPUT_DEBUG(A) __android_log_print(ANDROID_LOG_INFO, "PVRTools", A); 37 | #elif defined(_WIN32) 38 | #define PVRTERROR_OUTPUT_DEBUG(A) OutputDebugStringA(A); 39 | #else 40 | #define PVRTERROR_OUTPUT_DEBUG(A) fprintf(stderr,A); 41 | #endif 42 | #else 43 | #define PVRTERROR_OUTPUT_DEBUG(A) 44 | #endif 45 | #endif 46 | 47 | 48 | /*!*************************************************************************** 49 | Enums 50 | *****************************************************************************/ 51 | /*! Enum error codes */ 52 | enum EPVRTError 53 | { 54 | PVR_SUCCESS = 0, 55 | PVR_FAIL = 1, 56 | PVR_OVERFLOW = 2 57 | }; 58 | 59 | /*!*************************************************************************** 60 | @Function PVRTErrorOutputDebug 61 | @Input format printf style format followed by arguments it requires 62 | @Description Outputs a string to the standard error. 63 | *****************************************************************************/ 64 | void PVRTErrorOutputDebug(char const * const format, ...); 65 | 66 | #endif // _PVRTERROR_H_ 67 | 68 | /***************************************************************************** 69 | End of file (PVRTError.h) 70 | *****************************************************************************/ 71 | 72 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/pvrtextool/Include/PVRTextureVersion.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | @File PVRTextureVersion.h 4 | 5 | @Title 6 | 7 | @Version 8 | 9 | @Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential. 10 | 11 | @Platform ANSI 12 | 13 | @Description Texture processing routines. 14 | 15 | ******************************************************************************/ 16 | #ifndef PVRTEXLIBVERSION_H 17 | #define PVRTEXLIBVERSION_H 18 | #define PVRTLMAJORVERSION 4 19 | #define PVRTLMINORVERSION 2 20 | #define PVRTLSTRINGVERSION "4.2" 21 | #define PVRTLVERSIONDESCRIPTOR "" //"BETA" //"ALPHA" //"ENGINEERING DROP" 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/rg_etc1_v104/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(RGETC_SRCS 3 | rg_etc1.cpp 4 | rg_etc1.h) 5 | 6 | ADD_LIBRARY(rg_etc1 STATIC ${RGETC_SRCS}) 7 | 8 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/extern/skylight/README.txt: -------------------------------------------------------------------------------- 1 | The files in this archive are a sample implementation of the analytical 2 | skylight model presented in the SIGGRAPH 2012 paper 3 | 4 | 5 | "An Analytic Model for Full Spectral Sky-Dome Radiance" 6 | 7 | by 8 | 9 | Lukas Hosek and Alexander Wilkie 10 | Charles University in Prague, Czech Republic 11 | 12 | 13 | Version: 1.0, May 11th, 2012 14 | 15 | 16 | Please visit http://cgg.mff.cuni.cz/projects/SkylightModelling/ to check if 17 | an updated version of this code has been published! 18 | 19 | 20 | This archive contains the following files: 21 | 22 | README.txt This file. 23 | 24 | ArHosekSkyModel.h Header file for the reference functions. Their 25 | usage is explained there, and sample code for 26 | calling them is given. 27 | 28 | ArHosekSkyModel.c Implementation of the functions. 29 | 30 | ArHosekSkyModelData.h Coefficient data. 31 | 32 | Please note that the source files are in C99, so that when e.g. compiling this 33 | code with gcc, you have to add the "-std=c99" or "-std=gnu99" flags. -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc6h/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(bc6h) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | SET(BC6H_SRCS 6 | bits.h 7 | shapes_two.h 8 | tile.h 9 | zoh_utils.cpp 10 | zoh_utils.h 11 | zoh.cpp 12 | zoh.h 13 | zohone.cpp 14 | zohtwo.cpp) 15 | 16 | ADD_LIBRARY(bc6h STATIC ${BC6H_SRCS}) 17 | TARGET_LINK_LIBRARIES(bc6h nvcore nvmath) 18 | 19 | IF(NOT WIN32) 20 | IF(CMAKE_COMPILER_IS_GNUCXX) 21 | SET_TARGET_PROPERTIES(bc6h PROPERTIES COMPILE_FLAGS -fPIC) 22 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 23 | ENDIF(NOT WIN32) 24 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc6h/bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | #pragma once 13 | #ifndef _ZOH_BITS_H 14 | #define _ZOH_BITS_H 15 | 16 | // read/write a bitstream 17 | 18 | #include "nvcore/Debug.h" 19 | 20 | namespace ZOH { 21 | 22 | class Bits 23 | { 24 | public: 25 | 26 | Bits(char *data, int maxdatabits) { nvAssert (data && maxdatabits > 0); bptr = bend = 0; bits = data; maxbits = maxdatabits; readonly = 0;} 27 | Bits(const char *data, int availdatabits) { nvAssert (data && availdatabits > 0); bptr = 0; bend = availdatabits; cbits = data; maxbits = availdatabits; readonly = 1;} 28 | 29 | void write(int value, int nbits) { 30 | nvAssert (nbits >= 0 && nbits < 32); 31 | nvAssert (sizeof(int)>= 4); 32 | for (int i=0; i>i); 34 | } 35 | int read(int nbits) { 36 | nvAssert (nbits >= 0 && nbits < 32); 37 | nvAssert (sizeof(int)>= 4); 38 | int out = 0; 39 | for (int i=0; i= 0 && ptr < maxbits); bptr = ptr; } 45 | int getsize() { return bend; } 46 | 47 | private: 48 | int bptr; // next bit to read 49 | int bend; // last written bit + 1 50 | char *bits; // ptr to user bit stream 51 | const char *cbits; // ptr to const user bit stream 52 | int maxbits; // max size of user bit stream 53 | char readonly; // 1 if this is a read-only stream 54 | 55 | int readone() { 56 | nvAssert (bptr < bend); 57 | if (bptr >= bend) return 0; 58 | int bit = (readonly ? cbits[bptr>>3] : bits[bptr>>3]) & (1 << (bptr & 7)); 59 | ++bptr; 60 | return bit != 0; 61 | } 62 | void writeone(int bit) { 63 | nvAssert (!readonly); // "Writing a read-only bit stream" 64 | nvAssert (bptr < maxbits); 65 | if (bptr >= maxbits) return; 66 | if (bit&1) 67 | bits[bptr>>3] |= 1 << (bptr & 7); 68 | else 69 | bits[bptr>>3] &= ~(1 << (bptr & 7)); 70 | if (bptr++ >= bend) bend = bptr; 71 | } 72 | }; 73 | 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc6h/zoh.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | #pragma once 13 | #ifndef _ZOH_H 14 | #define _ZOH_H 15 | 16 | #include "tile.h" 17 | 18 | namespace ZOH { 19 | 20 | // UNUSED ZOH MODES are 0x13, 0x17, 0x1b, 0x1f 21 | 22 | static const int NREGIONS_TWO = 2; 23 | static const int NREGIONS_ONE = 1; 24 | static const int NCHANNELS = 3; 25 | 26 | struct FltEndpts 27 | { 28 | nv::Vector3 A; 29 | nv::Vector3 B; 30 | }; 31 | 32 | struct IntEndpts 33 | { 34 | int A[NCHANNELS]; 35 | int B[NCHANNELS]; 36 | }; 37 | 38 | struct ComprEndpts 39 | { 40 | uint A[NCHANNELS]; 41 | uint B[NCHANNELS]; 42 | }; 43 | 44 | static const int BLOCKSIZE=16; 45 | static const int BITSIZE=128; 46 | 47 | void compress(const Tile &t, char *block); 48 | void decompress(const char *block, Tile &t); 49 | 50 | float compressone(const Tile &t, char *block); 51 | float compresstwo(const Tile &t, char *block); 52 | void decompressone(const char *block, Tile &t); 53 | void decompresstwo(const char *block, Tile &t); 54 | 55 | float refinetwo(const Tile &tile, int shapeindex_best, const FltEndpts endpts[NREGIONS_TWO], char *block); 56 | float roughtwo(const Tile &tile, int shape, FltEndpts endpts[NREGIONS_TWO]); 57 | 58 | float refineone(const Tile &tile, int shapeindex_best, const FltEndpts endpts[NREGIONS_ONE], char *block); 59 | float roughone(const Tile &tile, int shape, FltEndpts endpts[NREGIONS_ONE]); 60 | 61 | bool isone(const char *block); 62 | 63 | } 64 | 65 | #endif // _ZOH_H 66 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc7/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(bc7) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | SET(BC7_SRCS 6 | avpcl.cpp 7 | avpcl.h 8 | avpcl_mode0.cpp 9 | avpcl_mode1.cpp 10 | avpcl_mode2.cpp 11 | avpcl_mode3.cpp 12 | avpcl_mode4.cpp 13 | avpcl_mode5.cpp 14 | avpcl_mode6.cpp 15 | avpcl_mode7.cpp 16 | bits.h 17 | endpts.h 18 | shapes_three.h 19 | shapes_two.h 20 | tile.h 21 | avpcl_utils.cpp 22 | avpcl_utils.h) 23 | 24 | ADD_LIBRARY(bc7 STATIC ${BC7_SRCS}) 25 | TARGET_LINK_LIBRARIES(bc7 nvcore nvmath) 26 | 27 | TARGET_LINK_LIBRARIES(bc7 nvmath) 28 | 29 | IF(NOT WIN32) 30 | IF(CMAKE_COMPILER_IS_GNUCXX) 31 | SET_TARGET_PROPERTIES(bc7 PROPERTIES COMPILE_FLAGS -fPIC) 32 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 33 | ENDIF(NOT WIN32) 34 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc7/avpcl_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | 13 | // utility class holding common routines 14 | #ifndef _AVPCL_UTILS_H 15 | #define _AVPCL_UTILS_H 16 | 17 | #include "nvmath/Vector.h" 18 | 19 | namespace AVPCL { 20 | 21 | inline int SIGN_EXTEND(int x, int nb) { return ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x)); } 22 | 23 | static const int INDEXMODE_BITS = 1; // 2 different index modes 24 | static const int NINDEXMODES = (1<<(INDEXMODE_BITS)); 25 | static const int INDEXMODE_ALPHA_IS_3BITS = 0; 26 | static const int INDEXMODE_ALPHA_IS_2BITS = 1; 27 | 28 | static const int ROTATEMODE_BITS = 2; // 4 different rotate modes 29 | static const int NROTATEMODES = (1<<(ROTATEMODE_BITS)); 30 | static const int ROTATEMODE_RGBA_RGBA = 0; 31 | static const int ROTATEMODE_RGBA_AGBR = 1; 32 | static const int ROTATEMODE_RGBA_RABG = 2; 33 | static const int ROTATEMODE_RGBA_RGAB = 3; 34 | 35 | class Utils 36 | { 37 | public: 38 | // error metrics 39 | static float metric4(nv::Vector4::Arg a, nv::Vector4::Arg b); 40 | static float metric3(nv::Vector3::Arg a, nv::Vector3::Arg b, int rotatemode); 41 | static float metric1(float a, float b, int rotatemode); 42 | 43 | static float metric4premult(nv::Vector4::Arg rgba0, nv::Vector4::Arg rgba1); 44 | static float metric3premult_alphaout(nv::Vector3::Arg rgb0, float a0, nv::Vector3::Arg rgb1, float a1); 45 | static float metric3premult_alphain(nv::Vector3::Arg rgb0, nv::Vector3::Arg rgb1, int rotatemode); 46 | static float metric1premult(float rgb0, float a0, float rgb1, float a1, int rotatemode); 47 | 48 | static float premult(float r, float a); 49 | 50 | // quantization and unquantization 51 | static int unquantize(int q, int prec); 52 | static int quantize(float value, int prec); 53 | 54 | // lerping 55 | static int lerp(int a, int b, int i, int bias, int denom); 56 | static nv::Vector4 lerp(nv::Vector4::Arg a, nv::Vector4::Arg b, int i, int bias, int denom); 57 | }; 58 | 59 | } 60 | 61 | #endif -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc7/bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | 13 | #ifndef _AVPCL_BITS_H 14 | #define _AVPCL_BITS_H 15 | 16 | // read/write a bitstream 17 | 18 | #include "nvcore/Debug.h" 19 | 20 | namespace AVPCL { 21 | 22 | class Bits 23 | { 24 | public: 25 | 26 | Bits(char *data, int maxdatabits) { nvAssert (data && maxdatabits > 0); bptr = bend = 0; bits = data; maxbits = maxdatabits; readonly = 0;} 27 | Bits(const char *data, int availdatabits) { nvAssert (data && availdatabits > 0); bptr = 0; bend = availdatabits; cbits = data; maxbits = availdatabits; readonly = 1;} 28 | 29 | void write(int value, int nbits) { 30 | nvAssert (nbits >= 0 && nbits < 32); 31 | nvAssert (sizeof(int)>= 4); 32 | for (int i=0; i>i); 34 | } 35 | int read(int nbits) { 36 | nvAssert (nbits >= 0 && nbits < 32); 37 | nvAssert (sizeof(int)>= 4); 38 | int out = 0; 39 | for (int i=0; i= 0 && ptr < maxbits); bptr = ptr; } 45 | int getsize() { return bend; } 46 | 47 | private: 48 | int bptr; // next bit to read 49 | int bend; // last written bit + 1 50 | char *bits; // ptr to user bit stream 51 | const char *cbits; // ptr to const user bit stream 52 | int maxbits; // max size of user bit stream 53 | char readonly; // 1 if this is a read-only stream 54 | 55 | int readone() { 56 | nvAssert (bptr < bend); 57 | if (bptr >= bend) return 0; 58 | int bit = (readonly ? cbits[bptr>>3] : bits[bptr>>3]) & (1 << (bptr & 7)); 59 | ++bptr; 60 | return bit != 0; 61 | } 62 | void writeone(int bit) { 63 | nvAssert (!readonly); // "Writing a read-only bit stream" 64 | nvAssert (bptr < maxbits); 65 | if (bptr >= maxbits) return; 66 | if (bit&1) 67 | bits[bptr>>3] |= 1 << (bptr & 7); 68 | else 69 | bits[bptr>>3] &= ~(1 << (bptr & 7)); 70 | if (bptr++ >= bend) bend = bptr; 71 | } 72 | }; 73 | 74 | } 75 | 76 | #endif -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc7/endpts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | 13 | #ifndef _AVPCL_ENDPTS_H 14 | #define _AVPCL_ENDPTS_H 15 | 16 | // endpoint definitions and routines to search through endpoint space 17 | 18 | #include "nvmath/Vector.h" 19 | 20 | namespace AVPCL { 21 | 22 | static const int NCHANNELS_RGB = 3; 23 | static const int NCHANNELS_RGBA = 4; 24 | static const int CHANNEL_R = 0; 25 | static const int CHANNEL_G = 1; 26 | static const int CHANNEL_B = 2; 27 | static const int CHANNEL_A = 3; 28 | 29 | struct FltEndpts 30 | { 31 | nv::Vector4 A; 32 | nv::Vector4 B; 33 | }; 34 | 35 | struct IntEndptsRGB 36 | { 37 | int A[NCHANNELS_RGB]; 38 | int B[NCHANNELS_RGB]; 39 | }; 40 | 41 | struct IntEndptsRGB_1 42 | { 43 | int A[NCHANNELS_RGB]; 44 | int B[NCHANNELS_RGB]; 45 | int lsb; // shared lsb for A and B 46 | }; 47 | 48 | struct IntEndptsRGB_2 49 | { 50 | int A[NCHANNELS_RGB]; 51 | int B[NCHANNELS_RGB]; 52 | int a_lsb; // lsb for A 53 | int b_lsb; // lsb for B 54 | }; 55 | 56 | 57 | struct IntEndptsRGBA 58 | { 59 | int A[NCHANNELS_RGBA]; 60 | int B[NCHANNELS_RGBA]; 61 | }; 62 | 63 | struct IntEndptsRGBA_2 64 | { 65 | int A[NCHANNELS_RGBA]; 66 | int B[NCHANNELS_RGBA]; 67 | int a_lsb; // lsb for A 68 | int b_lsb; // lsb for B 69 | }; 70 | 71 | struct IntEndptsRGBA_2a 72 | { 73 | int A[NCHANNELS_RGBA]; 74 | int B[NCHANNELS_RGBA]; 75 | int a_lsb; // lsb for RGB channels of A 76 | int b_lsb; // lsb for RGB channels of A 77 | }; 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/bc7/tile.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007 nVidia, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 4 | 5 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | 10 | See the License for the specific language governing permissions and limitations under the License. 11 | */ 12 | 13 | #ifndef _AVPCL_TILE_H 14 | #define _AVPCL_TILE_H 15 | 16 | #include "nvmath/Vector.h" 17 | #include 18 | #include "avpcl_utils.h" 19 | 20 | namespace AVPCL { 21 | 22 | // extract a tile of pixels from an array 23 | 24 | class Tile 25 | { 26 | public: 27 | static const int TILE_H = 4; 28 | static const int TILE_W = 4; 29 | static const int TILE_TOTAL = TILE_H * TILE_W; 30 | nv::Vector4 data[TILE_H][TILE_W]; 31 | float importance_map[TILE_H][TILE_W]; 32 | int size_x, size_y; // actual size of tile 33 | 34 | Tile() {}; 35 | ~Tile(){}; 36 | Tile(int xs, int ys) {size_x = xs; size_y = ys;} 37 | }; 38 | 39 | } 40 | 41 | #endif -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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_OPENMP 11 | #cmakedefine HAVE_DISPATCH_H 12 | 13 | #define HAVE_STBIMAGE 14 | //#cmakedefine HAVE_PNG 15 | //#cmakedefine HAVE_JPEG 16 | //#cmakedefine HAVE_TIFF 17 | //#cmakedefine HAVE_OPENEXR 18 | //#cmakedefine HAVE_FREEIMAGE 19 | 20 | #cmakedefine HAVE_MAYA 21 | 22 | #endif // NV_CONFIG 23 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Array.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Array.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Array.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Array.inl -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvcore) 2 | 3 | SET(CORE_SRCS 4 | nvcore.h 5 | Array.h 6 | Debug.h Debug.cpp 7 | DefsGnucDarwin.h 8 | DefsGnucLinux.h 9 | DefsGnucWin32.h 10 | DefsVcWin32.h 11 | FileSystem.h FileSystem.cpp 12 | ForEach.h 13 | Memory.h Memory.cpp 14 | Ptr.h 15 | RefCounted.h 16 | StrLib.h StrLib.cpp 17 | Stream.h 18 | StdStream.h 19 | TextWriter.h TextWriter.cpp 20 | Timer.h Timer.cpp 21 | Utils.h) 22 | 23 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 24 | 25 | # targets 26 | ADD_DEFINITIONS(-DNVCORE_EXPORTS) 27 | 28 | IF(UNIX) 29 | SET(LIBS ${LIBS} ${CMAKE_DL_LIBS}) 30 | ENDIF(UNIX) 31 | 32 | IF(NVCORE_SHARED) 33 | ADD_DEFINITIONS(-DNVCORE_SHARED=1) 34 | ADD_LIBRARY(nvcore SHARED ${CORE_SRCS}) 35 | ELSE(NVCORE_SHARED) 36 | ADD_LIBRARY(nvcore ${CORE_SRCS}) 37 | ENDIF(NVCORE_SHARED) 38 | 39 | TARGET_LINK_LIBRARIES(nvcore ${LIBS}) 40 | 41 | # On NetBSD and FreeBSD backtrace() is provided by libexecinfo, not libc. 42 | if (CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") 43 | TARGET_LINK_LIBRARIES(nvcore execinfo) 44 | endif() 45 | 46 | INSTALL(TARGETS nvcore 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib/static) 50 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Debug.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Debug.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Debug.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Debug.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/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, ... uintptr_t 6 | #include // operator new, size_t, NULL 7 | 8 | // Function linkage 9 | #define DLL_IMPORT 10 | #if __GNUC__ >= 4 11 | # define DLL_EXPORT __attribute__((visibility("default"))) 12 | # define DLL_EXPORT_CLASS DLL_EXPORT 13 | #else 14 | # define DLL_EXPORT 15 | # define DLL_EXPORT_CLASS 16 | #endif 17 | 18 | // Function calling modes 19 | #if NV_CPU_X86 20 | # define NV_CDECL __attribute__((cdecl)) 21 | # define NV_STDCALL __attribute__((stdcall)) 22 | #else 23 | # define NV_CDECL 24 | # define NV_STDCALL 25 | #endif 26 | 27 | #define NV_FASTCALL __attribute__((fastcall)) 28 | #define NV_FORCEINLINE __attribute__((always_inline)) inline 29 | #define NV_DEPRECATED __attribute__((deprecated)) 30 | #define NV_THREAD_LOCAL __thread 31 | 32 | #if __GNUC__ > 2 33 | #define NV_PURE __attribute__((pure)) 34 | #define NV_CONST __attribute__((const)) 35 | #else 36 | #define NV_PURE 37 | #define NV_CONST 38 | #endif 39 | 40 | #define NV_NOINLINE __attribute__((noinline)) 41 | 42 | // Define __FUNC__ properly. 43 | #if __STDC_VERSION__ < 199901L 44 | # if __GNUC__ >= 2 45 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 46 | # else 47 | # define __FUNC__ "" 48 | # endif 49 | #else 50 | # define __FUNC__ __PRETTY_FUNCTION__ 51 | #endif 52 | 53 | #define restrict __restrict__ 54 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/DefsGnucLinux.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | #include // uint8_t, int8_t, ... uintptr_t 6 | #include // operator new, size_t, NULL 7 | 8 | // Function linkage 9 | #define DLL_IMPORT 10 | #if __GNUC__ >= 4 11 | # define DLL_EXPORT __attribute__((visibility("default"))) 12 | # define DLL_EXPORT_CLASS DLL_EXPORT 13 | #else 14 | # define DLL_EXPORT 15 | # define DLL_EXPORT_CLASS 16 | #endif 17 | 18 | // Function calling modes 19 | #if NV_CPU_X86 20 | # define NV_CDECL __attribute__((cdecl)) 21 | # define NV_STDCALL __attribute__((stdcall)) 22 | #else 23 | # define NV_CDECL 24 | # define NV_STDCALL 25 | #endif 26 | 27 | #define NV_FASTCALL __attribute__((fastcall)) 28 | //#if __GNUC__ > 3 29 | // It seems that GCC does not assume always_inline implies inline. I think this depends on the GCC version :( 30 | #define NV_FORCEINLINE inline __attribute__((always_inline)) 31 | //#else 32 | // Some compilers complain that inline and always_inline are redundant. 33 | //#define NV_FORCEINLINE __attribute__((always_inline)) 34 | //#endif 35 | #define NV_DEPRECATED __attribute__((deprecated)) 36 | #define NV_THREAD_LOCAL __thread 37 | 38 | #if __GNUC__ > 2 39 | #define NV_PURE __attribute__((pure)) 40 | #define NV_CONST __attribute__((const)) 41 | #else 42 | #define NV_PURE 43 | #define NV_CONST 44 | #endif 45 | 46 | #define NV_NOINLINE __attribute__((noinline)) 47 | 48 | // Define __FUNC__ properly. 49 | #if __STDC_VERSION__ < 199901L 50 | # if __GNUC__ >= 2 51 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 52 | # else 53 | # define __FUNC__ "" 54 | # endif 55 | #else 56 | # define __FUNC__ __PRETTY_FUNCTION__ 57 | #endif 58 | 59 | #define restrict __restrict__ 60 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/DefsGnucWin32.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | //#include // size_t, NULL 6 | 7 | // Function linkage 8 | #define DLL_IMPORT __declspec(dllimport) 9 | #define DLL_EXPORT __declspec(dllexport) 10 | #define DLL_EXPORT_CLASS DLL_EXPORT 11 | 12 | // Function calling modes 13 | #if NV_CPU_X86 14 | # define NV_CDECL __attribute__((cdecl)) 15 | # define NV_STDCALL __attribute__((stdcall)) 16 | #else 17 | # define NV_CDECL 18 | # define NV_STDCALL 19 | #endif 20 | 21 | #define NV_FASTCALL __attribute__((fastcall)) 22 | #define NV_FORCEINLINE __attribute__((always_inline)) 23 | #define NV_DEPRECATED __attribute__((deprecated)) 24 | 25 | #if __GNUC__ > 2 26 | #define NV_PURE __attribute__((pure)) 27 | #define NV_CONST __attribute__((const)) 28 | #else 29 | #define NV_PURE 30 | #define NV_CONST 31 | #endif 32 | 33 | #define NV_NOINLINE __attribute__((noinline)) 34 | 35 | // Define __FUNC__ properly. 36 | #if __STDC_VERSION__ < 199901L 37 | # if __GNUC__ >= 2 38 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 39 | # else 40 | # define __FUNC__ "" 41 | # endif 42 | #else 43 | # define __FUNC__ __PRETTY_FUNCTION__ 44 | #endif 45 | 46 | #define restrict __restrict__ 47 | 48 | /* 49 | // Type definitions 50 | typedef unsigned char uint8; 51 | typedef signed char int8; 52 | 53 | typedef unsigned short uint16; 54 | typedef signed short int16; 55 | 56 | typedef unsigned int uint32; 57 | typedef signed int int32; 58 | 59 | typedef unsigned long long uint64; 60 | typedef signed long long int64; 61 | 62 | // Aliases 63 | typedef uint32 uint; 64 | */ 65 | 66 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/FileSystem.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_CORE_FILESYSTEM_H 5 | #define NV_CORE_FILESYSTEM_H 6 | 7 | #include "nvcore.h" 8 | 9 | namespace nv 10 | { 11 | 12 | namespace FileSystem 13 | { 14 | NVCORE_API bool exists(const char * path); 15 | NVCORE_API bool createDirectory(const char * path); 16 | NVCORE_API bool changeDirectory(const char * path); 17 | NVCORE_API bool removeFile(const char * path); 18 | NVCORE_API bool copyFile(const char * src, const char * dst); 19 | } // FileSystem namespace 20 | 21 | } // nv namespace 22 | 23 | 24 | #endif // NV_CORE_FILESYSTEM_H 25 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/ForEach.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/ForEach.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Hash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Hash.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Memory.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Memory.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Memory.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- Ignacio Castaño 2 | 3 | #pragma once 4 | #ifndef NV_CORE_MEMORY_H 5 | #define NV_CORE_MEMORY_H 6 | 7 | #include "nvcore.h" 8 | 9 | #include // malloc(), realloc() and free() 10 | #include // memset 11 | //#include // size_t 12 | 13 | #if NV_OS_LINUX 14 | #include // memalign() 15 | #endif 16 | 17 | //#include // new and delete 18 | 19 | #define TRACK_MEMORY_LEAKS 0 20 | #if TRACK_MEMORY_LEAKS 21 | #include 22 | #endif 23 | 24 | 25 | #if NV_CC_GNUC 26 | # define NV_ALIGN_16 __attribute__ ((__aligned__ (16))) 27 | #else 28 | # define NV_ALIGN_16 __declspec(align(16)) 29 | #endif 30 | 31 | 32 | #define NV_OVERRIDE_ALLOC 0 33 | 34 | #if NV_OVERRIDE_ALLOC 35 | 36 | // Custom memory allocator 37 | extern "C" { 38 | NVCORE_API void * malloc(size_t size); 39 | NVCORE_API void * debug_malloc(size_t size, const char * file, int line); 40 | NVCORE_API void free(void * ptr); 41 | NVCORE_API void * realloc(void * ptr, size_t size); 42 | } 43 | 44 | /* 45 | #ifdef _DEBUG 46 | #define new new(__FILE__, __LINE__) 47 | #define malloc(i) debug_malloc(i, __FILE__, __LINE__) 48 | #endif 49 | */ 50 | 51 | #endif 52 | 53 | namespace nv { 54 | NVCORE_API void * aligned_malloc(size_t size, size_t alignment); 55 | NVCORE_API void aligned_free(void * ); 56 | 57 | // C++ helpers. 58 | template NV_FORCEINLINE T * malloc(size_t count) { 59 | return (T *)::malloc(sizeof(T) * count); 60 | } 61 | 62 | template NV_FORCEINLINE T * realloc(T * ptr, size_t count) { 63 | return (T *)::realloc(ptr, sizeof(T) * count); 64 | } 65 | 66 | template NV_FORCEINLINE void free(const T * ptr) { 67 | ::free((void *)ptr); 68 | } 69 | 70 | template NV_FORCEINLINE void zero(T & data) { 71 | memset(&data, 0, sizeof(T)); 72 | } 73 | 74 | } // nv namespace 75 | 76 | #endif // NV_CORE_MEMORY_H 77 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Ptr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Ptr.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/RefCounted.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/RefCounted.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/StdStream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/StdStream.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/StrLib.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/StrLib.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/StrLib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/StrLib.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Stream.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Stream.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/TextWriter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/TextWriter.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/TextWriter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/TextWriter.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Timer.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #include "Timer.h" 4 | 5 | using namespace nv; 6 | 7 | 8 | #if NV_OS_WIN32 9 | 10 | #define WINDOWS_LEAN_AND_MEAN 11 | #define VC_EXTRALEAN 12 | #define NOMINMAX 13 | #include // QueryPerformanceFrequency, QueryPerformanceCounter 14 | 15 | 16 | uint64 nv::systemClockFrequency() 17 | { 18 | uint64 frequency; 19 | QueryPerformanceFrequency((LARGE_INTEGER*) &frequency); 20 | return frequency; 21 | } 22 | 23 | uint64 nv::systemClock() 24 | { 25 | uint64 counter; 26 | QueryPerformanceCounter((LARGE_INTEGER*) &counter); 27 | return counter; 28 | } 29 | 30 | #else 31 | 32 | #include // clock 33 | 34 | uint64 nv::systemClockFrequency() 35 | { 36 | return CLOCKS_PER_SEC; 37 | } 38 | 39 | uint64 nv::systemClock() 40 | { 41 | return clock(); 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Timer.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_CORE_TIMER_H 5 | #define NV_CORE_TIMER_H 6 | 7 | #include "nvcore.h" 8 | 9 | #if NV_CC_MSVC 10 | #include 11 | #endif 12 | 13 | namespace nv { 14 | 15 | #if NV_CC_MSVC 16 | NV_FORCEINLINE uint64 fastCpuClock() { return __rdtsc(); } 17 | #elif NV_CC_GNUC && NV_CPU_X86 18 | NV_FORCEINLINE uint64 fastCpuClock() { 19 | uint64 val; 20 | __asm__ volatile (".byte 0x0f, 0x31" : "=A" (val)); 21 | return val; 22 | } 23 | #elif NV_CC_GNUC && NV_CPU_X86_64 24 | NV_FORCEINLINE uint64 fastCpuClock() { 25 | uint hi, lo; 26 | __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); 27 | return uint64(lo) | (uint64(hi) << 32); 28 | } 29 | #else 30 | NV_FORCEINLINE uint64 fastCpuClock() { return 0; } 31 | #endif 32 | 33 | uint64 systemClockFrequency(); 34 | uint64 systemClock(); 35 | 36 | class NVCORE_CLASS Timer 37 | { 38 | public: 39 | Timer() {} 40 | 41 | void start() { m_start = systemClock(); } 42 | void stop() { m_stop = systemClock(); } 43 | 44 | float elapsed() const { return float(m_stop - m_start) / systemClockFrequency(); } 45 | 46 | private: 47 | uint64 m_start; 48 | uint64 m_stop; 49 | }; 50 | 51 | } // nv namespace 52 | 53 | #endif // NV_CORE_TIMER_H 54 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/Utils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/Utils.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvcore/nvcore.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvcore/nvcore.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvimage) 2 | 3 | SET(IMAGE_SRCS 4 | nvimage.h 5 | BlockDXT.h BlockDXT.cpp 6 | ColorBlock.h ColorBlock.cpp 7 | DirectDrawSurface.h DirectDrawSurface.cpp 8 | ErrorMetric.h ErrorMetric.cpp 9 | Filter.h Filter.cpp 10 | FloatImage.h FloatImage.cpp 11 | Image.h Image.cpp 12 | ImageIO.h ImageIO.cpp 13 | #KtxFile.h KtxFile.cpp 14 | NormalMap.h NormalMap.cpp 15 | PixelFormat.h 16 | PsdFile.h 17 | TgaFile.h 18 | KtxFile.h KtxFile.cpp) 19 | 20 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 21 | 22 | IF(PNG_FOUND) 23 | SET(LIBS ${LIBS} ${PNG_LIBRARIES}) 24 | INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) 25 | ENDIF(PNG_FOUND) 26 | 27 | IF(JPEG_FOUND) 28 | SET(LIBS ${LIBS} ${JPEG_LIBRARIES}) 29 | INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) 30 | ENDIF(JPEG_FOUND) 31 | 32 | IF(TIFF_FOUND) 33 | SET(LIBS ${LIBS} ${TIFF_LIBRARIES}) 34 | INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 35 | ENDIF(TIFF_FOUND) 36 | 37 | IF(OPENEXR_FOUND) 38 | SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES}) 39 | INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS}) 40 | ENDIF(OPENEXR_FOUND) 41 | 42 | IF(FREEIMAGE_FOUND) 43 | SET(LIBS ${LIBS} ${FREEIMAGE_LIBRARIES}) 44 | INCLUDE_DIRECTORIES(${FREEIMAGE_INCLUDE_PATH}) 45 | ENDIF(FREEIMAGE_FOUND) 46 | 47 | # targets 48 | ADD_DEFINITIONS(-DNVIMAGE_EXPORTS) 49 | 50 | IF(NVIMAGE_SHARED) 51 | ADD_DEFINITIONS(-DNVIMAGE_SHARED=1) 52 | ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS}) 53 | ELSE(NVIMAGE_SHARED) 54 | ADD_LIBRARY(nvimage ${IMAGE_SRCS}) 55 | ENDIF(NVIMAGE_SHARED) 56 | 57 | TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore posh bc6h bc7 nvmath) 58 | 59 | INSTALL(TARGETS nvimage 60 | RUNTIME DESTINATION bin 61 | LIBRARY DESTINATION lib 62 | ARCHIVE DESTINATION lib/static) 63 | 64 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/ColorSpace.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- jim@tilander.org 2 | 3 | #include "ColorSpace.h" 4 | 5 | #include "nvimage/Image.h" 6 | #include "nvmath/Color.h" 7 | 8 | 9 | namespace nv 10 | { 11 | void ColorSpace::RGBtoYCoCg_R(Image* img) 12 | { 13 | const uint w = img->width(); 14 | const uint h = img->height(); 15 | 16 | for( uint y=0; y < h; y++ ) 17 | { 18 | for( uint x=0; x < w; x++ ) 19 | { 20 | Color32 pixel = img->pixel(x, y); 21 | 22 | const int r = pixel.r; 23 | const int g = pixel.g; 24 | const int b = pixel.b; 25 | 26 | const int Co = r - b; 27 | const int t = b + Co/2; 28 | const int Cg = g - t; 29 | const int Y = t + Cg/2; 30 | 31 | // Just saturate the chroma here (we loose out of one bit in each channel) 32 | // this just means that we won't have as high dynamic range. Perhaps a better option 33 | // is to loose the least significant bit instead? 34 | pixel.r = clamp(Co + 128, 0, 255); 35 | pixel.g = clamp(Cg + 128, 0, 255); 36 | pixel.b = 0; 37 | pixel.a = Y; 38 | } 39 | } 40 | } 41 | 42 | void ColorSpace::YCoCg_RtoRGB(Image* img) 43 | { 44 | const uint w = img->width(); 45 | const uint h = img->height(); 46 | 47 | for( uint y=0; y < h; y++ ) 48 | { 49 | for( uint x=0; x < w; x++ ) 50 | { 51 | Color32 pixel = img->pixel(x, y); 52 | 53 | const int Co = (int)pixel.r - 128; 54 | const int Cg = (int)pixel.g - 128; 55 | const int Y = pixel.a; 56 | 57 | const int t = Y - Cg/2; 58 | const int g = Cg + t; 59 | const int b = t - Co/2; 60 | const int r = b + Co; 61 | 62 | pixel.r = r; 63 | pixel.g = g; 64 | pixel.b = b; 65 | pixel.a = 1; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/ColorSpace.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- jim@tilander.org 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_COLORSPACE_H 5 | #define NV_IMAGE_COLORSPACE_H 6 | 7 | namespace nv 8 | { 9 | class Image; 10 | 11 | // Defines simple mappings between different color spaces and encodes them in the 12 | // input image. 13 | namespace ColorSpace 14 | { 15 | void RGBtoYCoCg_R(Image* img); 16 | void YCoCg_RtoRGB(Image* img); 17 | } 18 | } 19 | 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/ErrorMetric.h: -------------------------------------------------------------------------------- 1 | 2 | #include "nvimage.h" 3 | #include "FloatImage.h" // For FloatImage::WrapMode 4 | 5 | 6 | namespace nv 7 | { 8 | class FloatImage; 9 | 10 | float rmsColorError(const FloatImage * ref, const FloatImage * img, bool alphaWeight); 11 | float rmsAlphaError(const FloatImage * ref, const FloatImage * img); 12 | 13 | float averageColorError(const FloatImage * ref, const FloatImage * img, bool alphaWeight); 14 | float averageAlphaError(const FloatImage * ref, const FloatImage * img); 15 | 16 | float rmsBilinearColorError(const FloatImage * ref, const FloatImage * img, FloatImage::WrapMode wm, bool alphaWeight); 17 | 18 | float cieLabError(const FloatImage * ref, const FloatImage * img); 19 | float cieLab94Error(const FloatImage * ref, const FloatImage * img); 20 | float spatialCieLabError(const FloatImage * ref, const FloatImage * img); 21 | 22 | float averageAngularError(const FloatImage * img0, const FloatImage * img1); 23 | float rmsAngularError(const FloatImage * img0, const FloatImage * img1); 24 | 25 | } // nv namespace 26 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/Image.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_IMAGE_H 5 | #define NV_IMAGE_IMAGE_H 6 | 7 | #include "nvimage.h" 8 | #include "nvcore/Debug.h" 9 | 10 | #if NV_USE_ALTIVEC 11 | #undef pixel 12 | #endif 13 | 14 | namespace nv 15 | { 16 | class Color32; 17 | 18 | /// 32 bit RGBA image. 19 | class NVIMAGE_CLASS Image 20 | { 21 | public: 22 | 23 | enum Format 24 | { 25 | Format_RGB, 26 | Format_ARGB, 27 | }; 28 | 29 | Image(); 30 | Image(const Image & img); 31 | ~Image(); 32 | 33 | const Image & operator=(const Image & img); 34 | 35 | 36 | void allocate(uint w, uint h, uint d = 1); 37 | void acquire(Color32 * data, uint w, uint h, uint d = 1); 38 | bool load(const char * name); 39 | 40 | void resize(uint w, uint h, uint d = 1); 41 | 42 | void wrap(void * data, uint w, uint h, uint d = 1); 43 | void unwrap(); 44 | 45 | uint width() const; 46 | uint height() const; 47 | uint depth() const; 48 | 49 | const Color32 * scanline(uint h) const; 50 | Color32 * scanline(uint h); 51 | 52 | const Color32 * pixels() const; 53 | Color32 * pixels(); 54 | 55 | const Color32 & pixel(uint idx) const; 56 | Color32 & pixel(uint idx); 57 | 58 | const Color32 & pixel(uint x, uint y, uint z = 0) const; 59 | Color32 & pixel(uint x, uint y, uint z = 0); 60 | 61 | Format format() const; 62 | void setFormat(Format f); 63 | 64 | void fill(Color32 c); 65 | 66 | private: 67 | void free(); 68 | 69 | private: 70 | uint m_width; 71 | uint m_height; 72 | uint m_depth; 73 | Format m_format; 74 | Color32 * m_data; 75 | }; 76 | 77 | 78 | inline const Color32 & Image::pixel(uint x, uint y, uint z) const 79 | { 80 | nvDebugCheck(x < m_width && y < m_height && z < m_depth); 81 | return pixel((z * m_height + y) * m_width + x); 82 | } 83 | 84 | inline Color32 & Image::pixel(uint x, uint y, uint z) 85 | { 86 | nvDebugCheck(x < m_width && y < m_height && z < m_depth); 87 | return pixel((z * m_height + y) * m_width + x); 88 | } 89 | 90 | } // nv namespace 91 | 92 | 93 | #endif // NV_IMAGE_IMAGE_H 94 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/ImageIO.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_IMAGEIO_H 5 | #define NV_IMAGE_IMAGEIO_H 6 | 7 | #include "nvimage.h" 8 | 9 | #include "nvcore/StrLib.h" 10 | 11 | 12 | namespace nv 13 | { 14 | class Image; 15 | class FloatImage; 16 | class Stream; 17 | 18 | namespace ImageIO 19 | { 20 | NVIMAGE_API Image * load(const char * fileName); 21 | NVIMAGE_API Image * load(const char * fileName, Stream & s); 22 | 23 | NVIMAGE_API FloatImage * loadFloat(const char * fileName); 24 | NVIMAGE_API FloatImage * loadFloat(const char * fileName, Stream & s); 25 | 26 | NVIMAGE_API bool save(const char * fileName, const Image * img, const char ** tags=NULL); // NULL terminated list. 27 | NVIMAGE_API bool save(const char * fileName, Stream & s, const Image * img, const char ** tags=NULL); 28 | 29 | NVIMAGE_API bool saveFloat(const char * fileName, const FloatImage * fimage, uint baseComponent, uint componentCount); 30 | NVIMAGE_API bool saveFloat(const char * fileName, Stream & s, const FloatImage * fimage, uint baseComponent, uint componentCount); 31 | 32 | } // ImageIO namespace 33 | 34 | } // nv namespace 35 | 36 | 37 | #endif // NV_IMAGE_IMAGEIO_H 38 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/KtxFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvimage/KtxFile.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/KtxFile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvimage/KtxFile.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/NormalMap.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 | #pragma once 25 | #ifndef NV_IMAGE_NORMALMAP_H 26 | #define NV_IMAGE_NORMALMAP_H 27 | 28 | #include "nvimage.h" 29 | #include "FloatImage.h" 30 | 31 | #include "nvmath/Vector.h" 32 | 33 | 34 | namespace nv 35 | { 36 | class Image; 37 | 38 | enum NormalMapFilter 39 | { 40 | NormalMapFilter_Sobel3x3, // fine detail 41 | NormalMapFilter_Sobel5x5, // medium detail 42 | NormalMapFilter_Sobel7x7, // large detail 43 | NormalMapFilter_Sobel9x9, // very large 44 | }; 45 | 46 | // @@ These two functions should be deprecated: 47 | FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, NormalMapFilter filter = NormalMapFilter_Sobel3x3); 48 | FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, Vector4::Arg filterWeights); 49 | 50 | FloatImage * createNormalMap(const FloatImage * img, FloatImage::WrapMode wm, Vector4::Arg filterWeights); 51 | 52 | void normalizeNormalMap(FloatImage * img); 53 | 54 | // @@ Add generation of DU/DV maps. 55 | 56 | 57 | } // nv namespace 58 | 59 | #endif // NV_IMAGE_NORMALMAP_H 60 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/PsdFile.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_PSDFILE_H 5 | #define NV_IMAGE_PSDFILE_H 6 | 7 | #include "nvcore/Stream.h" 8 | 9 | namespace nv 10 | { 11 | enum PsdColorMode 12 | { 13 | PsdColorMode_Bitmap = 0, 14 | PsdColorMode_GrayScale = 1, 15 | PsdColorMode_Indexed = 2, 16 | PsdColorMode_RGB = 3, 17 | PsdColorMode_CMYK = 4, 18 | PsdColorMode_MultiChannel = 7, 19 | PsdColorMode_DuoTone = 8, 20 | PsdColorMode_LabColor = 9 21 | }; 22 | 23 | /// PSD header. 24 | struct PsdHeader 25 | { 26 | uint32 signature; 27 | uint16 version; 28 | uint8 reserved[6]; 29 | uint16 channel_count; 30 | uint32 height; 31 | uint32 width; 32 | uint16 depth; 33 | uint16 color_mode; 34 | 35 | bool isValid() const 36 | { 37 | return signature == 0x38425053; // '8BPS' 38 | } 39 | 40 | bool isSupported() const 41 | { 42 | if (version != 1) { 43 | nvDebug("*** bad version number %u\n", version); 44 | return false; 45 | } 46 | if (channel_count > 4) { 47 | return false; 48 | } 49 | if (depth != 8) { // @@ Add support for 16 bit depths. 50 | return false; 51 | } 52 | if (color_mode != PsdColorMode_RGB) { 53 | return false; 54 | } 55 | return true; 56 | } 57 | }; 58 | 59 | 60 | inline Stream & operator<< (Stream & s, PsdHeader & head) 61 | { 62 | s << head.signature << head.version; 63 | for (int i = 0; i < 6; i++) { 64 | s << head.reserved[i]; 65 | } 66 | return s << head.channel_count << head.height << head.width << head.depth << head.color_mode; 67 | } 68 | 69 | } // nv namespace 70 | 71 | #endif // NV_IMAGE_PSDFILE_H 72 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/Quantize.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_QUANTIZE_H 5 | #define NV_IMAGE_QUANTIZE_H 6 | 7 | #include "nvimage.h" 8 | 9 | 10 | namespace nv 11 | { 12 | class Image; 13 | 14 | namespace Quantize 15 | { 16 | void RGB16(Image * img); 17 | void BinaryAlpha(Image * img, int alpha_threshold = 127); 18 | void Alpha4(Image * img); 19 | 20 | void FloydSteinberg_RGB16(Image * img); 21 | void FloydSteinberg_BinaryAlpha(Image * img, int alpha_threshold = 127); 22 | void FloydSteinberg_Alpha4(Image * img); 23 | 24 | void Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize); 25 | void FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize); 26 | 27 | // @@ Add palette quantization algorithms! 28 | } 29 | } 30 | 31 | 32 | #endif // NV_IMAGE_QUANTIZE_H 33 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvimage/nvimage.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #pragma once 4 | #ifndef NV_IMAGE_H 5 | #define NV_IMAGE_H 6 | 7 | #include "nvcore/nvcore.h" 8 | #include "nvcore/Debug.h" // nvDebugCheck 9 | #include "nvcore/Utils.h" // isPowerOfTwo 10 | 11 | // Function linkage 12 | #if NVIMAGE_SHARED 13 | #ifdef NVIMAGE_EXPORTS 14 | #define NVIMAGE_API DLL_EXPORT 15 | #define NVIMAGE_CLASS DLL_EXPORT_CLASS 16 | #else 17 | #define NVIMAGE_API DLL_IMPORT 18 | #define NVIMAGE_CLASS DLL_IMPORT 19 | #endif 20 | #else 21 | #define NVIMAGE_API 22 | #define NVIMAGE_CLASS 23 | #endif 24 | 25 | 26 | namespace nv { 27 | 28 | // Some utility functions: 29 | 30 | inline uint computeBitPitch(uint w, uint bitsize, uint alignmentInBits) 31 | { 32 | nvDebugCheck(isPowerOfTwo(alignmentInBits)); 33 | 34 | return ((w * bitsize + alignmentInBits - 1) / alignmentInBits) * alignmentInBits; 35 | } 36 | 37 | inline uint computeBytePitch(uint w, uint bitsize, uint alignmentInBytes) 38 | { 39 | uint pitch = computeBitPitch(w, bitsize, 8*alignmentInBytes); 40 | nvDebugCheck((pitch & 7) == 0); 41 | 42 | return (pitch + 7) / 8; 43 | } 44 | 45 | 46 | } // nv namespace 47 | 48 | #endif // NV_IMAGE_H 49 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvmath) 2 | 3 | SET(MATH_SRCS 4 | nvmath.h 5 | Box.h Box.inl 6 | Color.h Color.inl 7 | Fitting.h Fitting.cpp 8 | Gamma.h Gamma.cpp 9 | Half.h Half.cpp 10 | Matrix.h Matrix.inl Matrix.cpp 11 | Plane.h Plane.inl Plane.cpp 12 | SphericalHarmonic.h SphericalHarmonic.cpp 13 | SimdVector.h SimdVector_SSE.h SimdVector_VE.h 14 | Vector.h Vector.inl) 15 | 16 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 17 | 18 | # targets 19 | ADD_DEFINITIONS(-DNVMATH_EXPORTS) 20 | 21 | IF(NVMATH_SHARED) 22 | ADD_DEFINITIONS(-DNVMATH_SHARED=1) 23 | ADD_LIBRARY(nvmath SHARED ${MATH_SRCS}) 24 | ELSE(NVMATH_SHARED) 25 | ADD_LIBRARY(nvmath ${MATH_SRCS}) 26 | ENDIF(NVMATH_SHARED) 27 | 28 | TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore) 29 | 30 | INSTALL(TARGETS nvmath 31 | RUNTIME DESTINATION bin 32 | LIBRARY DESTINATION lib 33 | ARCHIVE DESTINATION lib/static) 34 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Color.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Color.h" 4 | #include "Color.inl" 5 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Fitting.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- Ignacio Castaño 2 | 3 | #pragma once 4 | #ifndef NV_MATH_FITTING_H 5 | #define NV_MATH_FITTING_H 6 | 7 | #include "Vector.h" 8 | #include "Plane.h" 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, const Vector3 & metric); 16 | 17 | Vector4 computeCentroid(int n, const Vector4 * points); 18 | Vector4 computeCentroid(int n, const Vector4 * points, const float * weights, const Vector4 & metric); 19 | 20 | Vector3 computeCovariance(int n, const Vector3 * points, float * covariance); 21 | Vector3 computeCovariance(int n, const Vector3 * points, const float * weights, const Vector3 & metric, float * covariance); 22 | 23 | Vector4 computeCovariance(int n, const Vector4 * points, float * covariance); 24 | Vector4 computeCovariance(int n, const Vector4 * points, const float * weights, const Vector4 & metric, float * covariance); 25 | 26 | Vector3 computePrincipalComponent_PowerMethod(int n, const Vector3 * points); 27 | Vector3 computePrincipalComponent_PowerMethod(int n, const Vector3 * points, const float * weights, const Vector3 & metric); 28 | 29 | Vector3 computePrincipalComponent_EigenSolver(int n, const Vector3 * points); 30 | Vector3 computePrincipalComponent_EigenSolver(int n, const Vector3 * points, const float * weights, const Vector3 & metric); 31 | 32 | Vector4 computePrincipalComponent_EigenSolver(int n, const Vector4 * points); 33 | Vector4 computePrincipalComponent_EigenSolver(int n, const Vector4 * points, const float * weights, const Vector4 & metric); 34 | 35 | Vector3 computePrincipalComponent_SVD(int n, const Vector3 * points); 36 | Vector4 computePrincipalComponent_SVD(int n, const Vector4 * points); 37 | 38 | Plane bestPlane(int n, const Vector3 * points); 39 | bool isPlanar(int n, const Vector3 * points, float epsilon = NV_EPSILON); 40 | 41 | bool eigenSolveSymmetric3(const float matrix[6], float eigenValues[3], Vector3 eigenVectors[3]); 42 | bool eigenSolveSymmetric4(const float matrix[10], float eigenValues[4], Vector4 eigenVectors[4]); 43 | 44 | // Returns number of clusters [1-4]. 45 | int compute4Means(int n, const Vector3 * points, const float * weights, const Vector3 & metric, Vector3 * cluster); 46 | } 47 | 48 | } // nv namespace 49 | 50 | #endif // NV_MATH_FITTING_H 51 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Gamma.h: -------------------------------------------------------------------------------- 1 | // 2 | // Fast implementations of powf(x,5/11) and powf(x,11/5) for gamma conversion 3 | // Copyright 2017 Ken Cooke 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a 6 | // copy of this software and associated documentation files (the "Software"), 7 | // to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | // and/or sell copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included 13 | // in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | // 23 | 24 | #pragma once 25 | #ifndef NV_MATH_GAMMA_H 26 | #define NV_MATH_GAMMA_H 27 | 28 | #include "nvmath.h" 29 | 30 | namespace nv { 31 | 32 | // gamma conversion of float array (in-place is allowed) 33 | void powf_5_11(const float* src, float* dst, int count); 34 | void powf_11_5(const float* src, float* dst, int count); 35 | 36 | } // nv namespace 37 | 38 | #endif // NV_MATH_GAMMA_H 39 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Half.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvmath/Half.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/PackedFloat.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvmath/PackedFloat.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/PackedFloat.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_MATH_PACKEDFLOAT_H 5 | #define NV_MATH_PACKEDFLOAT_H 6 | 7 | #include "nvmath.h" 8 | #include "Vector.h" 9 | 10 | namespace nv 11 | { 12 | 13 | union FloatRGB9E5 { 14 | uint32 v; 15 | struct { 16 | #if NV_BIG_ENDIAN 17 | uint32 e : 5; 18 | uint32 zm : 9; 19 | uint32 ym : 9; 20 | uint32 xm : 9; 21 | #else 22 | uint32 xm : 9; 23 | uint32 ym : 9; 24 | uint32 zm : 9; 25 | uint32 e : 5; 26 | #endif 27 | }; 28 | }; 29 | 30 | union FloatR11G11B10 { 31 | uint32 v; 32 | struct { 33 | #if NV_BIG_ENDIAN 34 | uint32 ze : 5; 35 | uint32 zm : 5; 36 | uint32 ye : 5; 37 | uint32 ym : 6; 38 | uint32 xe : 5; 39 | uint32 xm : 6; 40 | #else 41 | uint32 xm : 6; 42 | uint32 xe : 5; 43 | uint32 ym : 6; 44 | uint32 ye : 5; 45 | uint32 zm : 5; 46 | uint32 ze : 5; 47 | #endif 48 | }; 49 | }; 50 | 51 | union FloatRGBE8 { 52 | uint32 v; 53 | struct { 54 | #if NV_LITTLE_ENDIAN 55 | uint8 r, g, b, e; 56 | #else 57 | uint8 e: 8; 58 | uint8 b: 8; 59 | uint8 g: 8; 60 | uint8 r: 8; 61 | #endif 62 | }; 63 | }; 64 | 65 | NVMATH_API Vector3 rgb9e5_to_vector3(FloatRGB9E5 v); 66 | NVMATH_API FloatRGB9E5 vector3_to_rgb9e5(const Vector3 & v); 67 | 68 | NVMATH_API float float11_to_float32(uint v); 69 | NVMATH_API float float10_to_float32(uint v); 70 | 71 | NVMATH_API Vector3 r11g11b10_to_vector3(FloatR11G11B10 v); 72 | NVMATH_API FloatR11G11B10 vector3_to_r11g11b10(const Vector3 & v); 73 | 74 | NVMATH_API Vector3 rgbe8_to_vector3(FloatRGBE8 v); 75 | NVMATH_API FloatRGBE8 vector3_to_rgbe8(const Vector3 & v); 76 | 77 | } // nv 78 | 79 | #endif // NV_MATH_PACKEDFLOAT_H 80 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Plane.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Plane.h" 4 | #include "Plane.inl" 5 | #include "Matrix.inl" 6 | 7 | namespace nv 8 | { 9 | Plane transformPlane(const Matrix & m, const Plane & p) 10 | { 11 | Vector3 newVec = transformVector(m, p.vector()); 12 | 13 | Vector3 ptInPlane = p.offset() * p.vector(); 14 | ptInPlane = transformPoint(m, ptInPlane); 15 | 16 | return Plane(newVec, ptInPlane); 17 | } 18 | 19 | Vector3 planeIntersection(const Plane & a, const Plane & b, const Plane & c) 20 | { 21 | return dot(a.vector(), cross(b.vector(), c.vector())) * ( 22 | a.offset() * cross(b.vector(), c.vector()) + 23 | c.offset() * cross(a.vector(), b.vector()) + 24 | b.offset() * cross(c.vector(), a.vector())); 25 | } 26 | 27 | } // nv namespace 28 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Plane.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvmath/Plane.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Plane.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvmath/Plane.inl -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/SimdVector.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvmath/SimdVector.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvmath/Vector.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include "Vector.h" 4 | #include "Vector.inl" 5 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvthread) 2 | 3 | SET(THREAD_SRCS 4 | nvthread.h nvthread.cpp 5 | Atomic.h 6 | Event.h Event.cpp 7 | Mutex.h Mutex.cpp 8 | ParallelFor.h ParallelFor.cpp 9 | Thread.h Thread.cpp 10 | ThreadPool.h ThreadPool.cpp) 11 | 12 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 13 | 14 | # targets 15 | ADD_DEFINITIONS(-DNVTHREAD_EXPORTS) 16 | 17 | IF(NVTHREAD_SHARED) 18 | ADD_LIBRARY(nvthread SHARED ${THREAD_SRCS}) 19 | ELSE(NVTHREAD_SHARED) 20 | ADD_LIBRARY(nvthread ${THREAD_SRCS}) 21 | ENDIF(NVTHREAD_SHARED) 22 | 23 | TARGET_LINK_LIBRARIES(nvthread ${LIBS} nvcore) 24 | 25 | INSTALL(TARGETS nvthread 26 | RUNTIME DESTINATION bin 27 | LIBRARY DESTINATION lib 28 | ARCHIVE DESTINATION lib/static) 29 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/Event.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #include "Event.h" 4 | 5 | #if NV_OS_WIN32 6 | #include "Win32.h" 7 | #elif NV_OS_USE_PTHREAD 8 | #include 9 | #endif 10 | 11 | using namespace nv; 12 | 13 | #if NV_OS_WIN32 14 | 15 | struct Event::Private { 16 | HANDLE handle; 17 | }; 18 | 19 | Event::Event() : m(new Private) { 20 | m->handle = CreateEvent(/*lpEventAttributes=*/NULL, /*bManualReset=*/FALSE, /*bInitialState=*/FALSE, /*lpName=*/NULL); 21 | } 22 | 23 | Event::~Event() { 24 | CloseHandle(m->handle); 25 | } 26 | 27 | void Event::post() { 28 | SetEvent(m->handle); 29 | } 30 | 31 | void Event::wait() { 32 | WaitForSingleObject(m->handle, INFINITE); 33 | } 34 | 35 | #elif NV_OS_USE_PTHREAD 36 | 37 | struct Event::Private { 38 | pthread_cond_t pt_cond; 39 | pthread_mutex_t pt_mutex; 40 | int count; 41 | int wait_count; 42 | }; 43 | 44 | Event::Event() : m(new Private) { 45 | m->count=0; 46 | m->wait_count=0; 47 | pthread_mutex_init(&m->pt_mutex, NULL); 48 | pthread_cond_init(&m->pt_cond, NULL); 49 | } 50 | 51 | Event::~Event() { 52 | pthread_cond_destroy(&m->pt_cond); 53 | pthread_mutex_destroy(&m->pt_mutex); 54 | } 55 | 56 | void Event::post() { 57 | pthread_mutex_lock(&m->pt_mutex); 58 | 59 | m->count++; 60 | 61 | //ACS: move this after the unlock? 62 | if(m->wait_count>0) { 63 | pthread_cond_signal(&m->pt_cond); 64 | } 65 | 66 | pthread_mutex_unlock(&m->pt_mutex); 67 | } 68 | 69 | void Event::wait() { 70 | pthread_mutex_lock(&m->pt_mutex); 71 | 72 | while(m->count==0) { 73 | m->wait_count++; 74 | pthread_cond_wait(&m->pt_cond, &m->pt_mutex); 75 | m->wait_count--; 76 | } 77 | m->count--; 78 | 79 | pthread_mutex_unlock(&m->pt_mutex); 80 | } 81 | 82 | #endif // NV_OS_UNIX 83 | 84 | 85 | /*static*/ void Event::post(Event * events, uint count) { 86 | for (uint i = 0; i < count; i++) { 87 | events[i].post(); 88 | } 89 | } 90 | 91 | /*static*/ void Event::wait(Event * events, uint count) { 92 | // @@ Use wait for multiple objects in win32? 93 | 94 | for (uint i = 0; i < count; i++) { 95 | events[i].wait(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/Event.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_THREAD_EVENT_H 5 | #define NV_THREAD_EVENT_H 6 | 7 | #include "nvthread.h" 8 | 9 | #include "nvcore/Ptr.h" 10 | 11 | namespace nv 12 | { 13 | // This is intended to be used by a single waiter thread. 14 | class NVTHREAD_CLASS Event 15 | { 16 | NV_FORBID_COPY(Event); 17 | public: 18 | Event(); 19 | ~Event(); 20 | 21 | void post(); 22 | void wait(); // Wait resets the event. 23 | 24 | static void post(Event * events, uint count); 25 | static void wait(Event * events, uint count); 26 | 27 | private: 28 | struct Private; 29 | AutoPtr m; 30 | }; 31 | 32 | } // nv namespace 33 | 34 | #endif // NV_THREAD_EVENT_H 35 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/Mutex.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_THREAD_MUTEX_H 5 | #define NV_THREAD_MUTEX_H 6 | 7 | #include "nvthread.h" 8 | 9 | #include "nvcore/Ptr.h" 10 | 11 | namespace nv 12 | { 13 | 14 | class NVTHREAD_CLASS Mutex 15 | { 16 | NV_FORBID_COPY(Mutex); 17 | public: 18 | Mutex (const char * name); 19 | ~Mutex (); 20 | 21 | void lock(); 22 | bool tryLock(); 23 | void unlock(); 24 | 25 | private: 26 | struct Private; 27 | AutoPtr m; 28 | }; 29 | 30 | 31 | // Templated lock that can be used with any mutex. 32 | template 33 | class Lock 34 | { 35 | NV_FORBID_COPY(Lock); 36 | public: 37 | 38 | Lock (M & m) : m_mutex (m) { m_mutex.lock(); } 39 | ~Lock () { m_mutex.unlock(); } 40 | 41 | private: 42 | M & m_mutex; 43 | }; 44 | 45 | } // nv namespace 46 | 47 | #endif // NV_THREAD_MUTEX_H 48 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/ParallelFor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvthread/ParallelFor.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/ParallelFor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvthread/ParallelFor.h -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/Thread.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | #pragma once 4 | #ifndef NV_THREAD_THREAD_H 5 | #define NV_THREAD_THREAD_H 6 | 7 | #include "nvthread.h" 8 | 9 | #include "nvcore/Ptr.h" // AutoPtr 10 | 11 | namespace nv 12 | { 13 | typedef void ThreadFunc(void * arg); 14 | 15 | class NVTHREAD_CLASS Thread 16 | { 17 | NV_FORBID_COPY(Thread); 18 | public: 19 | Thread(); 20 | Thread(const char * name); 21 | ~Thread(); 22 | 23 | void setName(const char * name); 24 | 25 | void start(ThreadFunc * func, void * arg); 26 | void wait(); 27 | 28 | bool isRunning() const; 29 | 30 | static void spinWait(uint count); 31 | static void yield(); 32 | static void sleep(uint ms); 33 | 34 | static void wait(Thread * threads, uint count); 35 | 36 | struct Private; 37 | AutoPtr p; 38 | }; 39 | 40 | } // nv namespace 41 | 42 | #endif // NV_THREAD_THREAD_H 43 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvthread/Win32.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castano@gmail.com 2 | 3 | // Never include this from a header file. 4 | 5 | #define WIN32_LEAN_AND_MEAN 6 | #define VC_EXTRALEAN 7 | #define _WIN32_WINNT 0x0400 // for SwitchToThread, TryEnterCriticalSection 8 | #include 9 | //#include // for _beginthreadex -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(nvtt) 2 | 3 | ADD_SUBDIRECTORY(squish) 4 | 5 | SET(NVTT_SRCS 6 | nvtt.h nvtt.cpp 7 | nvtt_wrapper.h nvtt_wrapper.cpp 8 | ClusterFit.h ClusterFit.cpp 9 | Compressor.h 10 | BlockCompressor.h BlockCompressor.cpp 11 | CompressorDX9.h CompressorDX9.cpp 12 | CompressorDX10.h CompressorDX10.cpp 13 | CompressorDX11.h CompressorDX11.cpp 14 | CompressorDXT1.h CompressorDXT1.cpp 15 | CompressorDXT5_RGBM.h CompressorDXT5_RGBM.cpp 16 | CompressorETC.h CompressorETC.cpp 17 | CompressorRGB.h CompressorRGB.cpp 18 | Context.h Context.cpp 19 | QuickCompressDXT.h QuickCompressDXT.cpp 20 | OptimalCompressDXT.h OptimalCompressDXT.cpp 21 | SingleColorLookup.h SingleColorLookup.cpp 22 | CompressionOptions.h CompressionOptions.cpp 23 | InputOptions.h InputOptions.cpp 24 | OutputOptions.h OutputOptions.cpp 25 | TaskDispatcher.h #TaskDispatcher.cpp 26 | Surface.h Surface.cpp 27 | CubeSurface.h CubeSurface.cpp 28 | cuda/CudaUtils.h cuda/CudaUtils.cpp 29 | cuda/CudaMath.h 30 | cuda/BitmapTable.h 31 | cuda/CudaCompressorDXT.h cuda/CudaCompressorDXT.cpp) 32 | 33 | IF (CUDA_FOUND) 34 | ADD_DEFINITIONS(-DHAVE_CUDA) 35 | CUDA_COMPILE(CUDA_SRCS cuda/CompressKernel.cu) 36 | SET(NVTT_SRCS ${NVTT_SRCS} ${CUDA_SRCS}) 37 | SET(LIBS ${LIBS} ${CUDA_LIBRARIES}) 38 | INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) 39 | ENDIF (CUDA_FOUND) 40 | 41 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 42 | INCLUDE_DIRECTORIES(${NV_SOURCE_DIR}/extern/rg_etc1_v104) 43 | 44 | ADD_DEFINITIONS(-DNVTT_EXPORTS) 45 | 46 | IF(NVTT_SHARED) 47 | ADD_LIBRARY(nvtt SHARED ${NVTT_SRCS}) 48 | ELSE(NVTT_SHARED) 49 | ADD_LIBRARY(nvtt ${NVTT_SRCS}) 50 | ENDIF(NVTT_SHARED) 51 | 52 | TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvimage nvthread squish bc6h bc7 nvmath rg_etc1) 53 | 54 | INSTALL(TARGETS nvtt 55 | RUNTIME DESTINATION bin 56 | LIBRARY DESTINATION lib 57 | ARCHIVE DESTINATION lib/static) 58 | 59 | INSTALL(FILES nvtt.h DESTINATION include/nvtt) 60 | 61 | 62 | ADD_SUBDIRECTORY(tools) 63 | ADD_SUBDIRECTORY(tests) 64 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/Compressor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef NVTT_COMPRESSOR_H 26 | #define NVTT_COMPRESSOR_H 27 | 28 | #include "nvtt.h" 29 | #include "nvcore/nvcore.h" // uint 30 | 31 | namespace nv 32 | { 33 | 34 | struct CompressorInterface 35 | { 36 | virtual ~CompressorInterface() {} 37 | virtual void compress(nvtt::AlphaMode alphaMode, uint w, uint h, uint d, const float * rgba, nvtt::TaskDispatcher * dispatcher, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions) = 0; 38 | }; 39 | 40 | } // nv namespace 41 | 42 | #endif // NVTT_COMPRESSOR_H 43 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CompressorDX11.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 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 NVTT_COMPRESSORDX11_H 25 | #define NVTT_COMPRESSORDX11_H 26 | 27 | #include "BlockCompressor.h" 28 | 29 | namespace nv 30 | { 31 | struct CompressorBC6 : public FloatColorCompressor 32 | { 33 | virtual void compressBlock(Vector4 colors[16], float weights[16], const nvtt::CompressionOptions::Private & compressionOptions, void * output); 34 | virtual uint blockSize(const nvtt::CompressionOptions::Private & ) const { return 16; } 35 | }; 36 | 37 | struct CompressorBC7 : public FloatColorCompressor 38 | { 39 | virtual void compressBlock(Vector4 colors[16], float weights[16], const nvtt::CompressionOptions::Private & compressionOptions, void * output); 40 | virtual uint blockSize(const nvtt::CompressionOptions::Private & ) const { return 16; } 41 | }; 42 | 43 | } // nv namespace 44 | 45 | 46 | #endif // NVTT_COMPRESSORDX11_H 47 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CompressorDXT1.h: -------------------------------------------------------------------------------- 1 | 2 | namespace nv { 3 | 4 | class Color32; 5 | struct ColorBlock; 6 | struct BlockDXT1; 7 | class Vector3; 8 | class Vector4; 9 | 10 | // All these functions return MSE. 11 | 12 | float compress_dxt1_single_color_optimal(Color32 c, BlockDXT1 * output); 13 | float compress_dxt1_single_color_optimal(const Vector3 & color, BlockDXT1 * output); 14 | 15 | float compress_dxt1_single_color(const Vector3 * colors, const float * weights, int count, const Vector3 & color_weights, BlockDXT1 * output); 16 | //float compress_dxt1_least_squares_fit(const Vector4 input_colors[16], const Vector3 * colors, const float * weights, int count, const Vector3 & color_weights, BlockDXT1 * output); 17 | float compress_dxt1_bounding_box_exhaustive(const Vector4 input_colors[16], const Vector3 * colors, const float * weights, int count, const Vector3 & color_weights, bool three_color_mode, int search_limit, BlockDXT1 * output); 18 | void compress_dxt1_cluster_fit(const Vector4 input_colors[16], const Vector3 * colors, const float * weights, int count, const Vector3 & color_weights, bool three_color_mode, BlockDXT1 * output); 19 | 20 | // Cluster fit end point selection. 21 | float compress_dxt1(const Vector4 input_colors[16], const float input_weights[16], const Vector3 & color_weights, bool three_color_mode, BlockDXT1 * output); 22 | 23 | // Quick end point selection followed by least squares refinement. 24 | float compress_dxt1_fast(const Vector4 input_colors[16], const float input_weights[16], const Vector3 & color_weights, BlockDXT1 * output); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CompressorDXT5_RGBM.h: -------------------------------------------------------------------------------- 1 | 2 | namespace nv { 3 | 4 | struct BlockDXT5; 5 | class Vector4; 6 | 7 | float compress_dxt5_rgbm(const Vector4 input_colors[16], const float input_weights[16], float min_m, BlockDXT5 * output); 8 | float compress_etc2_rgbm(Vector4 input_colors[16], float input_weights[16], float min_m, void * output); 9 | } 10 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CompressorETC.h: -------------------------------------------------------------------------------- 1 | #include "nvcore/nvcore.h" 2 | 3 | namespace nv { 4 | 5 | class Vector3; 6 | class Vector4; 7 | 8 | void decompress_etc(const void * input_block, Vector4 output_colors[16]); 9 | void decompress_eac(const void * input_block, Vector4 output_colors[16], int output_channel); 10 | void decompress_etc_eac(const void * input_block, Vector4 output_colors[16]); 11 | 12 | float compress_etc1(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 13 | float compress_etc2(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 14 | float compress_etc2_a1(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 15 | float compress_eac(Vector4 input_colors[16], float input_weights[16], int input_channel, int search_radius, bool use_11bit_mode, void * output); 16 | float compress_etc2_eac(Vector4 input_colors[16], float input_weights[16], const Vector3 & color_weights, void * output); 17 | 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CompressorRGB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef NVTT_COMPRESSORRGB_H 26 | #define NVTT_COMPRESSORRGB_H 27 | 28 | #include "Compressor.h" 29 | 30 | namespace nv 31 | { 32 | struct PixelFormatConverter : public CompressorInterface 33 | { 34 | virtual void compress(nvtt::AlphaMode alphaMode, uint w, uint h, uint d, const float * data, nvtt::TaskDispatcher * dispatcher, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); 35 | }; 36 | 37 | } // nv namespace 38 | 39 | 40 | #endif // NVTT_COMPRESSORRGB_H 41 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/CubeSurface.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvtt/CubeSurface.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/SingleColorLookup.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "SingleColorLookup.h" 3 | 4 | #include "nvcore/Debug.h" 5 | 6 | #include // abs 7 | 8 | // Globals 9 | uint8 OMatch5[256][2]; 10 | uint8 OMatch6[256][2]; 11 | uint8 OMatchAlpha5[256][2]; 12 | uint8 OMatchAlpha6[256][2]; 13 | 14 | 15 | 16 | static int Mul8Bit(int a, int b) 17 | { 18 | int t = a * b + 128; 19 | return (t + (t >> 8)) >> 8; 20 | } 21 | 22 | static inline int Lerp13(int a, int b) 23 | { 24 | #ifdef DXT_USE_ROUNDING_BIAS 25 | // with rounding bias 26 | return a + Mul8Bit(b-a, 0x55); 27 | #else 28 | // without rounding bias 29 | // replace "/ 3" by "* 0xaaab) >> 17" if your compiler sucks or you really need every ounce of speed. 30 | return (a * 2 + b) / 3; 31 | #endif 32 | } 33 | 34 | static void PrepareOptTable(uint8 * table, const uint8 * expand, int size, bool alpha_mode) 35 | { 36 | for (int i = 0; i < 256; i++) 37 | { 38 | int bestErr = 256 * 100; 39 | 40 | for (int min = 0; min < size; min++) 41 | { 42 | for (int max = 0; max < size; max++) 43 | { 44 | int mine = expand[min]; 45 | int maxe = expand[max]; 46 | 47 | int err; 48 | if (alpha_mode) err = abs((maxe + mine)/2 - i); 49 | else err = abs(Lerp13(maxe, mine) - i); 50 | err *= 100; 51 | 52 | // DX10 spec says that interpolation must be within 3% of "correct" result, 53 | // add this as error term. (normally we'd expect a random distribution of 54 | // +-1.5% error, but nowhere in the spec does it say that the error has to be 55 | // unbiased - better safe than sorry). 56 | err += abs(max - min) * 3; 57 | 58 | if (err < bestErr) 59 | { 60 | table[i*2+0] = max; 61 | table[i*2+1] = min; 62 | bestErr = err; 63 | } 64 | } 65 | } 66 | } 67 | } 68 | 69 | 70 | NV_AT_STARTUP(initSingleColorLookup()); 71 | 72 | void initSingleColorLookup() 73 | { 74 | uint8 expand5[32]; 75 | uint8 expand6[64]; 76 | 77 | for (int i = 0; i < 32; i++) { 78 | expand5[i] = (i<<3) | (i>>2); 79 | } 80 | 81 | for (int i = 0; i < 64; i++) { 82 | expand6[i] = (i<<2) | (i>>4); 83 | } 84 | 85 | PrepareOptTable(&OMatch5[0][0], expand5, 32, false); 86 | PrepareOptTable(&OMatch6[0][0], expand6, 64, false); 87 | PrepareOptTable(&OMatchAlpha5[0][0], expand5, 32, true); 88 | PrepareOptTable(&OMatchAlpha6[0][0], expand6, 64, true); 89 | } 90 | 91 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/SingleColorLookup.h: -------------------------------------------------------------------------------- 1 | 2 | #include "nvcore/nvcore.h" // uint8 3 | 4 | extern uint8 OMatch5[256][2]; 5 | extern uint8 OMatch6[256][2]; 6 | extern uint8 OMatchAlpha5[256][2]; 7 | extern uint8 OMatchAlpha6[256][2]; 8 | 9 | void initSingleColorLookup(); -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/TaskDispatcher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diharaw/asset-core/88b53d0d01795e5e112853304a9dbf3873f25fe6/external/nvidia-texture-tools/src/nvtt/TaskDispatcher.cpp -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/cuda/CudaUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef NV_TT_CUDAUTILS_H 26 | #define NV_TT_CUDAUTILS_H 27 | 28 | namespace nv 29 | { 30 | 31 | namespace cuda 32 | { 33 | bool isHardwarePresent(); 34 | int deviceCount(); 35 | int getFastestDevice(); 36 | bool setDevice(int i); 37 | void exit(); 38 | }; 39 | 40 | } // nv namespace 41 | 42 | 43 | #endif // NV_TT_CUDAUTILS_H 44 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/experimental/nvtt_experimental.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "nvtt_experimental.h" 3 | 4 | struct NvttTexture 5 | { 6 | NvttTexture() : 7 | m_constant(false), 8 | m_image(NULL), 9 | m_floatImage(NULL) 10 | { 11 | } 12 | 13 | ~NvttTexture() 14 | { 15 | if (m_constant && m_image) m_image->unwrap(); 16 | delete m_image; 17 | delete m_floatImage; 18 | } 19 | 20 | bool m_constant; 21 | Image * m_image; 22 | FloatImage * m_floatImage; 23 | }; 24 | 25 | NvttTexture * nvttCreateTexture() 26 | { 27 | return new NvttTexture(); 28 | } 29 | 30 | void nvttDestroyTexture(NvttTexture * tex) 31 | { 32 | delete tex; 33 | } 34 | 35 | void nvttSetImageData(NvttImage * img, NvttInputFormat format, uint w, uint h, void * data) 36 | { 37 | nvCheck(img != NULL); 38 | 39 | if (format == NVTT_InputFormat_BGRA_8UB) 40 | { 41 | img->m_constant = false; 42 | img->m_image->allocate(w, h); 43 | memcpy(img->m_image->pixels(), data, w * h * 4); 44 | } 45 | else 46 | { 47 | nvCheck(false); 48 | } 49 | } 50 | 51 | void nvttCompressImage(NvttImage * img, NvttFormat format) 52 | { 53 | nvCheck(img != NULL); 54 | 55 | // @@ Invoke appropriate compressor. 56 | } 57 | 58 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/experimental/test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "nvtt_experimental.h" 3 | 4 | /* 5 | Errors in the original API: 6 | - Too many memory copies. 7 | - Implementation too complicated. 8 | - Error output should not be in output options. 9 | - Data driven interface. Follows the dialog model. Provide all the data upfront. 10 | */ 11 | 12 | 13 | // Output texture with mipmaps 14 | void example0() 15 | { 16 | CompressionOptions compressionOptions; 17 | OutputOptions outputOptions; 18 | 19 | Texture img; 20 | img.setTexture2D(format, w, h, 0, data); 21 | 22 | Compressor context; 23 | context.outputHeader(outputOptions); 24 | context.outputCompressed(img, compressionOptions, outputOptions); 25 | 26 | img.toLinear(2.2); 27 | while (img.downsample(NVTT_FILTER_BOX)) 28 | { 29 | img.toGamma(2.2); 30 | outputCompressed(img, compressionOptions, outputOptions); 31 | } 32 | } 33 | 34 | 35 | // Output texture with colored mipmaps 36 | void example1() 37 | { 38 | CompressionOptions compressionOptions; 39 | OutputOptions outputOptions; 40 | 41 | Texture img; 42 | img.setTexture2D(format, w, h, 0, data); 43 | 44 | Compressor context; 45 | context.outputHeader(outputOptions); 46 | context.outputCompressed(img, compressionOptions, outputOptions); 47 | 48 | img.toLinear(2.2); 49 | while (img.downsample(NVTT_FILTER_BOX)) 50 | { 51 | img.toGamma(2.2); 52 | 53 | Texture mipmap = img; 54 | mipmap.blend(color[i].r, color[i].g, color[i].b, 0.5f); 55 | 56 | context.outputCompressed(mipmap, compressionOptions, outputOptions); 57 | } 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/nvtt.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2011 Ignacio Castano 2 | // Copyright (c) 2007-2009 NVIDIA Corporation -- Ignacio Castano 3 | // 4 | // Permission is hereby granted, free of charge, to any person 5 | // obtaining a copy of this software and associated documentation 6 | // files (the "Software"), to deal in the Software without 7 | // restriction, including without limitation the rights to use, 8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the 10 | // Software is furnished to do so, subject to the following 11 | // conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be 14 | // included in all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | // OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #include "nvtt.h" 26 | #include "nvcore/nvcore.h" 27 | 28 | using namespace nvtt; 29 | 30 | // Return a string for the given error. 31 | const char * nvtt::errorString(Error e) 32 | { 33 | NV_COMPILER_CHECK(Error_Count == 7); 34 | switch(e) 35 | { 36 | case Error_Unknown: 37 | return "Unknown error"; 38 | case Error_InvalidInput: 39 | return "Invalid input"; 40 | case Error_UnsupportedFeature: 41 | return "Unsupported feature"; 42 | case Error_CudaError: 43 | return "CUDA error"; 44 | case Error_FileOpen: 45 | return "Error opening file"; 46 | case Error_FileWrite: 47 | return "Error writing through output handler"; 48 | case Error_UnsupportedOutputFormat: 49 | return "The container file does not support the selected output format"; 50 | default: 51 | return "Invalid error"; 52 | } 53 | } 54 | 55 | // Return NVTT version. 56 | unsigned int nvtt::version() 57 | { 58 | return NVTT_VERSION; 59 | } 60 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(squish) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | SET(SQUISH_SRCS 6 | fastclusterfit.cpp 7 | fastclusterfit.h 8 | weightedclusterfit.cpp 9 | weightedclusterfit.h 10 | colourblock.cpp 11 | colourblock.h 12 | colourfit.cpp 13 | colourfit.h 14 | colourset.cpp 15 | colourset.h 16 | config.h 17 | maths.cpp 18 | maths.h 19 | simd.h 20 | simd_sse.h 21 | simd_ve.h) 22 | 23 | ADD_LIBRARY(squish STATIC ${SQUISH_SRCS}) 24 | 25 | IF(NOT WIN32) 26 | 27 | IF("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 28 | SET(CMAKE_COMPILER_IS_CLANGXX 1) 29 | ENDIF() 30 | 31 | IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) 32 | SET_TARGET_PROPERTIES(squish PROPERTIES COMPILE_FLAGS -fPIC) 33 | ENDIF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) 34 | ENDIF(NOT WIN32) 35 | 36 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | 1.7 3 | * Fixed floating-point equality issue in clusterfit sort (x86 affected only) 4 | * Implemented proper SSE(2) floor function for 50% speedup on SSE builds 5 | * The range fit implementation now uses the correct colour metric 6 | 7 | 1.6 8 | * Fixed bug in CompressImage where masked pixels were not skipped over 9 | * DXT3 and DXT5 alpha compression now properly use the mask to ignore pixels 10 | * Fixed major DXT1 bug that can generate unexpected transparent pixels 11 | 12 | 1.5 13 | * Added CompressMasked function to handle incomplete DXT blocks more cleanly 14 | * Added kWeightColourByAlpha flag for better quality images when alpha blending 15 | 16 | 1.4 17 | * Fixed stack overflow in rangefit 18 | 19 | 1.3 20 | * Worked around SSE floor implementation bug, proper fix needed! 21 | * This release has visual studio and makefile builds that work 22 | 23 | 1.2 24 | * Added provably optimal single colour compressor 25 | * Added extra/squishgen.cpp that generates single colour lookup tables 26 | 27 | 1.1 28 | * Fixed a DXT1 colour output bug 29 | * Changed argument order for Decompress function to match Compress 30 | * Added GetStorageRequirements function 31 | * Added CompressImage function 32 | * Added DecompressImage function 33 | * Moved squishtool.cpp to extra/squishpng.cpp 34 | * Added extra/squishtest.cpp 35 | 36 | 1.0 37 | * Initial release 38 | 39 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/README: -------------------------------------------------------------------------------- 1 | LICENSE 2 | ------- 3 | 4 | The squish library is distributed under the terms and conditions of the MIT 5 | license. This license is specified at the top of each source file and must be 6 | preserved in its entirety. 7 | 8 | BUILDING AND INSTALLING THE LIBRARY 9 | ----------------------------------- 10 | 11 | If you are using Visual Studio 2003 or above under Windows then load the Visual 12 | Studio 2003 project in the vs7 folder. By default, the library is built using 13 | SSE optimisations. To change this either change or remove the SQUISH_USE_SSE=1 14 | from the preprocessor symbols. 15 | 16 | If you are using a Mac then load the Xcode 2.2 project in the distribution. By 17 | default, the library is built using Altivec optimisations. To change this 18 | either change or remove SQUISH_USE_ALTIVEC=1 from the preprocessor symbols. I 19 | guess I'll have to think about changing this for the new Intel Macs that are 20 | rolling out... 21 | 22 | If you are using unix then first edit the config file in the base directory of 23 | the distribution, enabling Altivec or SSE with the USE_ALTIVEC or USE_SSE 24 | variables, and editing the optimisation flags passed to the C++ compiler if 25 | necessary. Then make can be used to build the library, and make install (from 26 | the superuser account) can be used to install (into /usr/local by default). 27 | 28 | REPORTING BUGS OR FEATURE REQUESTS 29 | ---------------------------------- 30 | 31 | Feedback can be sent to Simon Brown (the developer) at si@sjbrown.co.uk 32 | 33 | New releases are announced on the squish library homepage at 34 | http://sjbrown.co.uk/?code=squish 35 | 36 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/alpha.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_ALPHA_H 27 | #define SQUISH_ALPHA_H 28 | 29 | #include "squish.h" 30 | 31 | namespace squish { 32 | 33 | void CompressAlphaDxt3( u8 const* rgba, void* block ); 34 | void CompressAlphaDxt5( u8 const* rgba, void* block ); 35 | 36 | void DecompressAlphaDxt3( u8* rgba, void const* block ); 37 | void DecompressAlphaDxt5( u8* rgba, void const* block ); 38 | 39 | } // namespace squish 40 | 41 | #endif // ndef SQUISH_ALPHA_H 42 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/colourblock.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_COLOURBLOCK_H 27 | #define NV_SQUISH_COLOURBLOCK_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | 32 | namespace nvsquish { 33 | 34 | void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); 35 | void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); 36 | //void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ); 37 | //void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ); 38 | 39 | void DecompressColour( u8* rgba, void const* block, bool isDxt1 ); 40 | 41 | } // namespace squish 42 | 43 | #endif // ndef SQUISH_COLOURBLOCK_H 44 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/colourfit.cpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #include "colourfit.h" 27 | #include "colourset.h" 28 | 29 | namespace nvsquish { 30 | 31 | ColourFit::ColourFit() 32 | { 33 | } 34 | 35 | void ColourFit::SetColourSet( ColourSet const* colours, int flags ) 36 | { 37 | m_colours = colours; 38 | m_flags = flags; 39 | } 40 | 41 | void ColourFit::Compress( void* block ) 42 | { 43 | bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 ); 44 | if( isDxt1 ) 45 | { 46 | Compress3( block ); 47 | 48 | if( !m_colours->IsTransparent() ) 49 | { 50 | Compress4( block ); 51 | } 52 | } 53 | else 54 | { 55 | Compress4( block ); 56 | } 57 | } 58 | 59 | } // namespace squish 60 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/colourfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_COLOURFIT_H 27 | #define NV_SQUISH_COLOURFIT_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | 32 | namespace nvsquish { 33 | 34 | class ColourSet; 35 | 36 | class ColourFit 37 | { 38 | public: 39 | ColourFit(); 40 | 41 | void SetColourSet( ColourSet const* colours, int flags ); 42 | 43 | void Compress( void* block ); 44 | 45 | protected: 46 | virtual void Compress3( void* block ) = 0; 47 | virtual void Compress4( void* block ) = 0; 48 | 49 | ColourSet const* m_colours; 50 | int m_flags; 51 | }; 52 | 53 | } // namespace squish 54 | 55 | #endif // ndef SQUISH_COLOURFIT_H 56 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/colourset.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_COLOURSET_H 27 | #define NV_SQUISH_COLOURSET_H 28 | 29 | #include "squish.h" 30 | #include "maths.h" 31 | #include "simd.h" 32 | 33 | namespace nvsquish { 34 | 35 | /*! @brief Represents a set of block colours 36 | */ 37 | class ColourSet 38 | { 39 | public: 40 | ColourSet( u8 const* rgba, int flags, bool createMinimalSet = true ); 41 | 42 | int GetCount() const { return m_count; } 43 | Vec3 const* GetPoints() const { return m_points; } 44 | float const* GetWeights() const { return m_weights; } 45 | bool IsTransparent() const { return m_transparent; } 46 | 47 | void RemapIndices( u8 const* source, u8* target ) const; 48 | 49 | private: 50 | int m_count; 51 | Vec3 m_points[16]; 52 | float m_weights[16]; 53 | int m_remap[16]; 54 | bool m_transparent; 55 | 56 | #if SQUISH_USE_SIMD 57 | public: 58 | Vec4 const* GetPointsSimd() const { return m_points_simd; } 59 | Vec4 const* GetWeightsSimd() const { return m_weights_simd; } 60 | 61 | private: 62 | Vec4 m_points_simd[16]; 63 | Vec4 m_weights_simd[16]; 64 | #endif 65 | }; 66 | 67 | } // namespace sqish 68 | 69 | #endif // ndef SQUISH_COLOURSET_H 70 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/config: -------------------------------------------------------------------------------- 1 | # config file used for the Makefile only 2 | 3 | # define to 1 to use altivec instructions 4 | USE_ALTIVEC ?= 0 5 | 6 | # define to 1 to use sse instructions 7 | USE_SSE ?= 0 8 | 9 | # default flags 10 | CXXFLAGS ?= -O2 11 | ifeq ($(USE_ALTIVEC),1) 12 | CPPFLAGS += -DSQUISH_USE_ALTIVEC=1 13 | CXXFLAGS += -maltivec 14 | endif 15 | ifeq ($(USE_SSE),1) 16 | CPPFLAGS += -DSQUISH_USE_SSE=1 17 | CXXFLAGS += -msse 18 | endif 19 | 20 | # where should we install to 21 | INSTALL_DIR ?= /usr/local 22 | 23 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/config.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_CONFIG_H 27 | #define SQUISH_CONFIG_H 28 | 29 | // Set to 1 when building squish to use altivec instructions. 30 | #ifndef SQUISH_USE_ALTIVEC 31 | # define SQUISH_USE_ALTIVEC defined(__VEC__) 32 | #endif 33 | 34 | // Set to 1 when building squish to use sse instructions. 35 | #ifndef SQUISH_USE_SSE 36 | # if defined(__SSE2__) 37 | # define SQUISH_USE_SSE 2 38 | # elif defined(__SSE__) 39 | # define SQUISH_USE_SSE 1 40 | # else 41 | # define SQUISH_USE_SSE 0 42 | # endif 43 | #endif 44 | 45 | // Internally et SQUISH_USE_SIMD when either altivec or sse is available. 46 | #if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE 47 | # error "Cannot enable both altivec and sse!" 48 | #endif 49 | #if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE 50 | # define SQUISH_USE_SIMD 1 51 | #else 52 | # define SQUISH_USE_SIMD 0 53 | #endif 54 | 55 | #endif // ndef SQUISH_CONFIG_H 56 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/fastclusterfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | Copyright (c) 2006 Ignacio Castano icastano@nvidia.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included 15 | in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------- */ 26 | 27 | #ifndef NV_SQUISH_FASTCLUSTERFIT_H 28 | #define NV_SQUISH_FASTCLUSTERFIT_H 29 | 30 | #include "squish.h" 31 | #include "maths.h" 32 | #include "simd.h" 33 | #include "colourfit.h" 34 | 35 | namespace nvsquish { 36 | 37 | class FastClusterFit : public ColourFit 38 | { 39 | public: 40 | FastClusterFit(); 41 | 42 | void SetColourSet( ColourSet const* colours, int flags ); 43 | 44 | void SetMetric(float r, float g, float b); 45 | float GetBestError() const; 46 | 47 | // Make them public 48 | virtual void Compress3( void* block ); 49 | virtual void Compress4( void* block ); 50 | 51 | private: 52 | 53 | Vec3 m_principle; 54 | 55 | #if SQUISH_USE_SIMD 56 | Vec4 m_unweighted[17]; 57 | Vec4 m_metric; 58 | Vec4 m_metricSqr; 59 | Vec4 m_xxsum; 60 | Vec4 m_xsum; 61 | Vec4 m_besterror; 62 | #else 63 | Vec3 m_unweighted[17]; 64 | Vec3 m_metric; 65 | Vec3 m_metricSqr; 66 | Vec3 m_xxsum; 67 | Vec3 m_xsum; 68 | float m_besterror; 69 | #endif 70 | 71 | int m_order[16]; 72 | }; 73 | 74 | } // namespace squish 75 | 76 | #endif // ndef SQUISH_FASTCLUSTERFIT_H 77 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/rangefit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_RANGEFIT_H 27 | #define SQUISH_RANGEFIT_H 28 | 29 | #include 30 | #include "colourfit.h" 31 | #include "maths.h" 32 | 33 | namespace squish { 34 | 35 | class ColourSet; 36 | 37 | class RangeFit : public ColourFit 38 | { 39 | public: 40 | RangeFit( ColourSet const* colours, int flags ); 41 | 42 | private: 43 | virtual void Compress3( void* block ); 44 | virtual void Compress4( void* block ); 45 | 46 | Vec3 m_metric; 47 | Vec3 m_start; 48 | Vec3 m_end; 49 | float m_besterror; 50 | }; 51 | 52 | } // squish 53 | 54 | #endif // ndef SQUISH_RANGEFIT_H 55 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/simd.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef NV_SQUISH_SIMD_H 27 | #define NV_SQUISH_SIMD_H 28 | 29 | #include "maths.h" 30 | 31 | #ifdef __GNUC__ 32 | # define SQUISH_ALIGN_16 __attribute__ ((__aligned__ (16))) 33 | #else 34 | # define SQUISH_ALIGN_16 __declspec(align(16)) 35 | #endif 36 | 37 | #if SQUISH_USE_ALTIVEC 38 | #include "simd_ve.h" 39 | #endif 40 | 41 | #if SQUISH_USE_SSE 42 | #include "simd_sse.h" 43 | #endif 44 | 45 | #endif // ndef SQUISH_SIMD_H 46 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/singlechannelfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | Copyright (c) 2006 Ignacio Castano castanyo@yahoo.es 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included 15 | in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------- */ 26 | 27 | #ifndef SQUISH_SINGLECHANNELFIT_H 28 | #define SQUISH_SINGLECHANNELFIT_H 29 | 30 | #include 31 | #include "maths.h" 32 | #include "colourfit.h" 33 | 34 | namespace squish { 35 | 36 | class SingleChannelFit : public ColourFit 37 | { 38 | public: 39 | SingleChannelFit( ColourSet const* colours, int flags ); 40 | 41 | private: 42 | virtual void Compress3( void* block ); 43 | virtual void Compress4( void* block ); 44 | 45 | private: 46 | u8 m_greys[16]; 47 | int m_g_min; 48 | int m_g_max; 49 | }; 50 | 51 | } // namespace squish 52 | 53 | #endif // ndef SQUISH_SINGLECHANNELFIT_H 54 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/singlecolourfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------- */ 25 | 26 | #ifndef SQUISH_SINGLECOLOURFIT_H 27 | #define SQUISH_SINGLECOLOURFIT_H 28 | 29 | #include 30 | #include "colourfit.h" 31 | 32 | namespace squish { 33 | 34 | class ColourSet; 35 | struct SingleColourLookup; 36 | 37 | class SingleColourFit : public ColourFit 38 | { 39 | public: 40 | SingleColourFit( ColourSet const* colours, int flags ); 41 | 42 | private: 43 | virtual void Compress3( void* block ); 44 | virtual void Compress4( void* block ); 45 | 46 | void ComputeEndPoints( int count, SingleColourLookup const* const* lookups ); 47 | 48 | u8 m_colour[3]; 49 | Vec3 m_start; 50 | Vec3 m_end; 51 | u8 m_index; 52 | int m_error; 53 | int m_besterror; 54 | }; 55 | 56 | } // namespace squish 57 | 58 | #endif // ndef SQUISH_SINGLECOLOURFIT_H 59 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/squish/weightedclusterfit.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | 3 | Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 4 | Copyright (c) 2006 Ignacio Castano icastano@nvidia.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included 15 | in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------- */ 26 | 27 | #ifndef NV_SQUISH_WEIGHTEDCLUSTERFIT_H 28 | #define NV_SQUISH_WEIGHTEDCLUSTERFIT_H 29 | 30 | #include "squish.h" 31 | #include "maths.h" 32 | #include "simd.h" 33 | #include "colourfit.h" 34 | 35 | namespace nvsquish { 36 | 37 | class WeightedClusterFit : public ColourFit 38 | { 39 | public: 40 | WeightedClusterFit(); 41 | 42 | void SetColourSet( ColourSet const* colours, int flags ); 43 | 44 | void SetMetric(float r, float g, float b); 45 | float GetBestError() const; 46 | 47 | // Make them public 48 | virtual void Compress3( void* block ); 49 | virtual void Compress4( void* block ); 50 | 51 | private: 52 | 53 | Vec3 m_principle; 54 | 55 | #if SQUISH_USE_SIMD 56 | Vec4 m_weighted[16]; 57 | Vec4 m_metric; 58 | Vec4 m_metricSqr; 59 | Vec4 m_xxsum; 60 | Vec4 m_xsum; 61 | Vec4 m_besterror; 62 | #else 63 | Vec3 m_weighted[16]; 64 | float m_weights[16]; 65 | Vec3 m_metric; 66 | Vec3 m_metricSqr; 67 | Vec3 m_xxsum; 68 | Vec3 m_xsum; 69 | float m_wsum; 70 | float m_besterror; 71 | #endif 72 | 73 | int m_order[16]; 74 | }; 75 | 76 | } // namespace squish 77 | 78 | #endif // ndef SQUISH_WEIGHTEDCLUSTERFIT_H 79 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | ADD_EXECUTABLE(filtertest filtertest.cpp ../tools/cmdline.h) 3 | TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage nvtt) 4 | 5 | ADD_EXECUTABLE(nvtestsuite testsuite.cpp) 6 | TARGET_LINK_LIBRARIES(nvtestsuite nvcore nvmath nvimage nvtt) 7 | ADD_TEST(NVTT.TestSuite.Kodak.cuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 0 -out output-cuda-kodak) 8 | ADD_TEST(NVTT.TestSuite.Waterloo.cuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 1 -out output-cuda-waterloo) 9 | ADD_TEST(NVTT.TestSuite.Epic.cuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 2 -out output-cuda-epic) 10 | ADD_TEST(NVTT.TestSuite.Kodak.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 0 -nocuda -out output-nocuda-kodak) 11 | ADD_TEST(NVTT.TestSuite.Waterloo.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 1 -nocuda -out output-nocuda-waterloo) 12 | ADD_TEST(NVTT.TestSuite.Epic.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/testsuite -set 2 -nocuda -out output-nocuda-epic) 13 | 14 | IF (CUDA_FOUND) 15 | ADD_EXECUTABLE(driverapitest driverapi.cpp) 16 | TARGET_LINK_LIBRARIES(driverapitest nvcore nvmath nvimage nvtt) 17 | ENDIF (CUDA_FOUND) 18 | 19 | ADD_EXECUTABLE(imperativeapi imperativeapi.cpp) 20 | TARGET_LINK_LIBRARIES(imperativeapi nvcore nvmath nvimage nvtt) 21 | 22 | ADD_EXECUTABLE(process_alpha_map process_alpha_map.cpp) 23 | TARGET_LINK_LIBRARIES(process_alpha_map nvcore nvmath nvimage nvtt) 24 | 25 | ADD_EXECUTABLE(cubemaptest cubemaptest.cpp) 26 | TARGET_LINK_LIBRARIES(cubemaptest nvcore nvmath nvimage nvtt) 27 | 28 | ADD_EXECUTABLE(nvhdrtest hdrtest.cpp) 29 | TARGET_LINK_LIBRARIES(nvhdrtest nvcore nvimage nvtt bc6h nvmath) 30 | 31 | INSTALL(TARGETS nvtestsuite nvhdrtest DESTINATION bin) 32 | 33 | #include_directories("/usr/include/ffmpeg/") 34 | #ADD_EXECUTABLE(nvmpegenc tools/mpegenc.cpp tools/cmdline.h) 35 | #TARGET_LINK_LIBRARIES(nvmpegenc nvcore nvmath nvimage avcodec z) 36 | #INSTALL(TARGETS nvmpegenc DESTINATION bin) 37 | 38 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tests/ctest.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | int main(void) 8 | { 9 | NvttInputOptions inputOptions = 0; 10 | NvttOutputOptions outputOptions = 0; 11 | NvttCompressionOptions compressionOptions = 0; 12 | 13 | const unsigned int img[16*16]; 14 | 15 | memset(img, 0, sizeof(unsigned int) * 16 * 16); 16 | 17 | inputOptions = nvttCreateInputOptions(); 18 | nvttSetInputOptionsTextureLayout(inputOptions, NVTT_TextureType_2D, 16, 16, 1); 19 | nvttSetInputOptionsMipmapData(inputOptions, img, 16, 16, 1, 0, 0); 20 | 21 | outputOptions = nvttCreateOutputOptions(); 22 | nvttSetOutputOptionsFileName(outputOptions, "output.dds"); 23 | 24 | compressionOptions = nvttCreateCompressionOptions(); 25 | nvttSetCompressionOptionsFormat(compressionOptions, NVTT_Format_BC1); 26 | 27 | nvttCompress(inputOptions, outputOptions, compressionOptions); 28 | 29 | nvttDestroyCompressionOptions(compressionOptions); 30 | nvttDestroyOutputOptions(outputOptions); 31 | nvttDestroyInputOptions(inputOptions); 32 | 33 | return 0; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tests/filtertest.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "../tools/cmdline.h" 4 | 5 | #include 6 | 7 | using namespace nv; 8 | 9 | int main(void) 10 | { 11 | // MyAssertHandler assertHandler; 12 | MyMessageHandler messageHandler; 13 | 14 | BoxFilter box1(0.5); 15 | Kernel1 k1(box1, 2); 16 | k1.debugPrint(); nvDebug("\n"); 17 | 18 | BoxFilter box2(1); 19 | Kernel1 k2(box2, 2); 20 | k2.debugPrint(); nvDebug("\n"); 21 | 22 | BoxFilter boxr3(1); 23 | Kernel1 k3(boxr3, 2); 24 | k3.debugPrint(); nvDebug("\n"); 25 | 26 | KaiserFilter kai4(5); 27 | kai4.setParameters(4, 2); 28 | Kernel1 k4(kai4, 2); 29 | k4.debugPrint(); nvDebug("\n"); 30 | 31 | /* Kernel1 k3(3); 32 | Kernel1 k4(9); 33 | Kernel1 k5(10); 34 | 35 | // k3.initFilter(Filter::Box); 36 | // k4.initFilter(Filter::Box); 37 | // k5.initFilter(Filter::Box); 38 | 39 | // nvDebug("Box Filter:\n"); 40 | // k3.debugPrint(); nvDebug("\n"); 41 | // k4.debugPrint(); nvDebug("\n"); 42 | // k5.debugPrint(); nvDebug("\n"); 43 | 44 | k3.initSinc(0.75); 45 | k4.initSinc(0.75); 46 | k5.initSinc(0.75); 47 | 48 | nvDebug("Sinc Filter:\n"); 49 | k3.debugPrint(); nvDebug("\n"); 50 | k4.debugPrint(); nvDebug("\n"); 51 | k5.debugPrint(); nvDebug("\n"); 52 | 53 | k3.initKaiser(4, 1, 100); 54 | k4.initKaiser(4, 1, 100); 55 | k5.initKaiser(4, 1, 100); 56 | 57 | nvDebug("Kaiser Filter:\n"); 58 | k3.debugPrint(); nvDebug("\n"); 59 | k4.debugPrint(); nvDebug("\n"); 60 | k5.debugPrint(); nvDebug("\n"); 61 | 62 | k3.initKaiser(4, 1, 10); 63 | k4.initKaiser(4, 1, 10); 64 | k5.initKaiser(4, 1, 10); 65 | 66 | nvDebug("Kaiser Filter 2:\n"); 67 | k3.debugPrint(); nvDebug("\n"); 68 | k4.debugPrint(); nvDebug("\n"); 69 | k5.debugPrint(); nvDebug("\n"); 70 | */ 71 | int l_start = 4; 72 | int l_end = 2; 73 | 74 | BoxFilter filter; 75 | PolyphaseKernel kp(kai4, l_start, l_end); 76 | 77 | kp.debugPrint(); 78 | 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tools/compressdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "compressdialog.h" 2 | #include "ui_compressdialog.h" 3 | 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication app(argc, argv); 9 | 10 | CompressDialog dialog(""); 11 | 12 | return dialog.exec(); 13 | } 14 | 15 | 16 | 17 | CompressDialog::CompressDialog(const QString & fileName, QWidget *parent) : QDialog(parent) 18 | { 19 | ui.setupUi(this); 20 | } 21 | 22 | CompressDialog::~CompressDialog() 23 | { 24 | } 25 | 26 | 27 | void CompressDialog::openClicked() 28 | { 29 | // @@ What is openButton? 30 | } 31 | 32 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tools/compressdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPRESSDIALOG_H 2 | #define COMPRESSDIALOG_H 3 | 4 | #include 5 | 6 | #include "ui_compressdialog.h" 7 | 8 | 9 | class CompressDialog : public QDialog 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit CompressDialog(const QString & fileName, QWidget *parent = 0); 14 | ~CompressDialog(); 15 | 16 | protected slots: 17 | 18 | void openClicked(); 19 | 20 | 21 | private: 22 | Ui::CompressDialog ui; 23 | }; 24 | 25 | #endif // COMPRESSDIALOG_H 26 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tools/ddsinfo.cpp: -------------------------------------------------------------------------------- 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 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "cmdline.h" 31 | 32 | 33 | int main(int argc, char *argv[]) 34 | { 35 | MyAssertHandler assertHandler; 36 | MyMessageHandler messageHandler; 37 | 38 | if (argc != 2) 39 | { 40 | printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); 41 | printf("usage: nvddsinfo ddsfile\n\n"); 42 | return 1; 43 | } 44 | 45 | // Load surface. 46 | nv::DirectDrawSurface dds(argv[1]); 47 | if (!dds.isValid()) 48 | { 49 | printf("The file '%s' is not a valid DDS file.\n", argv[1]); 50 | return 1; 51 | } 52 | 53 | dds.printInfo(); 54 | 55 | return 0; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tools/nvtt-thumbnailer.schema.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /schemas/desktop/gnome/thumbnailers/image@x-dds/enable 5 | /desktop/gnome/thumbnailers/image@x-dds/enable 6 | nvtt-thumbnailer 7 | bool 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | /schemas/desktop/gnome/thumbnailers/image@x-dds/command 16 | /desktop/gnome/thumbnailers/image@x-dds/command 17 | nvtt-thumbnailer 18 | string 19 | @CMAKE_INSTALL_PREFIX@/bin/nv-gnome-thumbnailer -s %s %i %o 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tools/ui/configdialog.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 CONFIGDIALOG_H 25 | #define CONFIGDIALOG_H 26 | 27 | #include 28 | 29 | #include "ui_configdialog.h" 30 | 31 | #include 32 | 33 | 34 | class ConfigDialog : public QDialog 35 | { 36 | Q_OBJECT 37 | public: 38 | ConfigDialog(QWidget *parent = 0); 39 | ConfigDialog(const char * fileName, QWidget *parent = 0); 40 | 41 | protected slots: 42 | 43 | void openClicked(); 44 | void generateMipmapsChanged(int state); 45 | void mipmapFilterChanged(QString name); 46 | 47 | void colorWeightChanged(); 48 | void uniformWeightToggled(bool checked); 49 | void luminanceWeightToggled(bool checked); 50 | 51 | void normalMapModeChanged(bool checked); 52 | 53 | bool open(QString fileName); 54 | 55 | private: 56 | 57 | void init(); 58 | 59 | private: 60 | Ui::ConfigDialog ui; 61 | 62 | nvtt::InputOptions inputOptions; 63 | nvtt::CompressionOptions compressionOptions; 64 | nvtt::OutputOptions outputOptions; 65 | 66 | }; 67 | 68 | 69 | #endif // CONFIGDIALOG_H 70 | -------------------------------------------------------------------------------- /external/nvidia-texture-tools/src/nvtt/tools/ui/main.cpp: -------------------------------------------------------------------------------- 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 | #include 25 | #include "configdialog.h" 26 | 27 | int main(int argc, char *argv[]) 28 | { 29 | QApplication app(argc, argv); 30 | ConfigDialog dialog; 31 | return dialog.exec(); 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /include/common/header.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define AST_VERSION 1 6 | 7 | namespace ast 8 | { 9 | enum AssetType 10 | { 11 | ASSET_IMAGE = 0, 12 | ASSET_MESH = 1 13 | }; 14 | 15 | struct BINFileHeader 16 | { 17 | uint32_t magic; 18 | uint8_t version; 19 | uint8_t type; 20 | }; 21 | } // namespace ast 22 | -------------------------------------------------------------------------------- /include/common/image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace ast 8 | { 9 | enum CompressionType 10 | { 11 | COMPRESSION_NONE = 0, 12 | COMPRESSION_BC1 = 1, 13 | COMPRESSION_BC1a = 2, 14 | COMPRESSION_BC2 = 3, 15 | COMPRESSION_BC3 = 4, 16 | COMPRESSION_BC3n = 5, 17 | COMPRESSION_BC4 = 6, 18 | COMPRESSION_BC5 = 7, 19 | COMPRESSION_BC6 = 8, 20 | COMPRESSION_BC7 = 9, 21 | COMPRESSION_ETC1 = 10, 22 | COMPRESSION_ETC2 = 11, 23 | COMPRESSION_PVR = 12 24 | }; 25 | 26 | enum PixelType 27 | { 28 | PIXEL_TYPE_UNORM8 = 1, 29 | PIXEL_TYPE_FLOAT16 = 2, 30 | PIXEL_TYPE_FLOAT32 = 4 31 | }; 32 | 33 | struct BINImageHeader 34 | { 35 | uint8_t compression; 36 | uint8_t channel_size; 37 | uint8_t num_channels; 38 | uint16_t num_array_slices; 39 | uint8_t num_mip_slices; 40 | }; 41 | 42 | struct BINMipSliceHeader 43 | { 44 | uint16_t width; 45 | uint16_t height; 46 | int size; 47 | }; 48 | 49 | struct Image 50 | { 51 | template 52 | struct Pixel 53 | { 54 | T c[N]; 55 | }; 56 | 57 | struct Data 58 | { 59 | void* data; 60 | int width; 61 | int height; 62 | size_t size; 63 | }; 64 | 65 | int components; 66 | int mip_slices; 67 | int array_slices; 68 | Data data[16][16]; 69 | std::string name; 70 | PixelType type; 71 | CompressionType compression; 72 | 73 | Image(const PixelType& pixel_type = PIXEL_TYPE_UNORM8); 74 | ~Image(); 75 | Image& operator=(Image other); 76 | void allocate(const PixelType& pixel_type, 77 | const uint32_t& base_mip_width, 78 | const uint32_t& base_mip_height, 79 | const uint32_t& component_count, 80 | const uint32_t& array_slice_count, 81 | const uint32_t& mip_slice_count); 82 | void deallocate(); 83 | size_t size(int array_slice, int mip_slice) const; 84 | void to_bgra(int array_slice, int mip_slice); 85 | void argb_to_rgba(int array_slice, int mip_slice); 86 | bool to_rgba(Image& img, int array_slice, int mip_slice); 87 | }; 88 | } // namespace ast 89 | -------------------------------------------------------------------------------- /include/common/mesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace ast 7 | { 8 | struct Vertex 9 | { 10 | glm::vec3 position; 11 | glm::vec2 tex_coord; 12 | glm::vec3 normal; 13 | glm::vec3 tangent; 14 | glm::vec3 bitangent; 15 | }; 16 | 17 | struct SkeletalVertex 18 | { 19 | glm::vec3 position; 20 | glm::vec2 tex_coord; 21 | glm::vec3 normal; 22 | glm::vec3 tangent; 23 | glm::vec3 bitangent; 24 | glm::ivec4 bone_indices; 25 | glm::vec4 bone_weights; 26 | }; 27 | 28 | struct SubMesh 29 | { 30 | uint32_t material_index; 31 | uint32_t index_count; 32 | uint32_t vertex_count; 33 | uint32_t base_vertex; 34 | uint32_t base_index; 35 | glm::vec3 max_extents; 36 | glm::vec3 min_extents; 37 | char name[150]; 38 | }; 39 | 40 | struct Mesh 41 | { 42 | std::string name; 43 | std::vector vertices; 44 | std::vector skeletal_vertices; 45 | std::vector indices; 46 | std::vector submeshes; 47 | std::vector materials; 48 | glm::vec3 max_extents; 49 | glm::vec3 min_extents; 50 | }; 51 | 52 | // -------------------------------------------------------------------------------- 53 | // Mesh Import Result 54 | // -------------------------------------------------------------------------------- 55 | 56 | struct MeshImportResult 57 | { 58 | std::string name; 59 | std::vector vertices; 60 | std::vector skeletal_vertices; 61 | std::vector indices; 62 | std::vector submeshes; 63 | std::vector> materials; 64 | glm::vec3 max_extents; 65 | glm::vec3 min_extents; 66 | }; 67 | 68 | // -------------------------------------------------------------------------------- 69 | // Binary Assets 70 | // -------------------------------------------------------------------------------- 71 | 72 | struct BINMeshFileHeader 73 | { 74 | uint32_t mesh_count; 75 | uint32_t material_count; 76 | uint32_t vertex_count; 77 | uint32_t skeletal_vertex_count; 78 | uint32_t index_count; 79 | glm::vec3 max_extents; 80 | glm::vec3 min_extents; 81 | char name[150]; 82 | }; 83 | 84 | struct BINMeshMaterialJson 85 | { 86 | char material[150]; 87 | }; 88 | } // namespace ast 89 | -------------------------------------------------------------------------------- /include/common/scene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace ast 10 | { 11 | static const std::string kSceneNodeType[] = { 12 | "SCENE_NODE_MESH", 13 | "SCENE_NODE_CAMERA", 14 | "SCENE_NODE_DIRECTIONAL_LIGHT", 15 | "SCENE_NODE_SPOT_LIGHT", 16 | "SCENE_NODE_POINT_LIGHT", 17 | "SCENE_NODE_IBL", 18 | "SCENE_NODE_ROOT", 19 | "SCENE_NODE_CUSTOM" 20 | }; 21 | 22 | enum SceneNodeType 23 | { 24 | SCENE_NODE_MESH, 25 | SCENE_NODE_CAMERA, 26 | SCENE_NODE_DIRECTIONAL_LIGHT, 27 | SCENE_NODE_SPOT_LIGHT, 28 | SCENE_NODE_POINT_LIGHT, 29 | SCENE_NODE_IBL, 30 | SCENE_NODE_ROOT, 31 | SCENE_NODE_CUSTOM, 32 | SCENE_NODE_COUNT 33 | }; 34 | 35 | struct SceneNode 36 | { 37 | SceneNodeType type; 38 | std::string name; 39 | nlohmann::json custom_data; 40 | std::vector> children; 41 | 42 | virtual ~SceneNode() {} 43 | }; 44 | 45 | struct EnvironmentMapNode : public SceneNode 46 | { 47 | std::string environment_map; 48 | }; 49 | 50 | struct TransformNode : public SceneNode 51 | { 52 | glm::vec3 position; 53 | glm::vec3 rotation; 54 | glm::vec3 scale; 55 | }; 56 | 57 | struct MeshNode : public TransformNode 58 | { 59 | std::string mesh; 60 | std::string material_override; 61 | bool casts_shadow; 62 | }; 63 | 64 | struct DirectionalLightNode : public TransformNode 65 | { 66 | glm::vec3 color; 67 | float intensity; 68 | float area; 69 | bool casts_shadows; 70 | }; 71 | 72 | struct SpotLightNode : public TransformNode 73 | { 74 | glm::vec3 color; 75 | float inner_cone_angle; 76 | float outer_cone_angle; 77 | float area; 78 | float range; 79 | float intensity; 80 | bool casts_shadows; 81 | }; 82 | 83 | struct PointLightNode : public TransformNode 84 | { 85 | glm::vec3 color; 86 | float area; 87 | float range; 88 | float intensity; 89 | bool casts_shadows; 90 | }; 91 | 92 | struct CameraNode : public TransformNode 93 | { 94 | float near_plane; 95 | float far_plane; 96 | float fov; 97 | }; 98 | 99 | struct IBLNode : public SceneNode 100 | { 101 | std::string image; 102 | }; 103 | 104 | struct Scene 105 | { 106 | std::string name; 107 | std::shared_ptr scene_graph; 108 | }; 109 | } // namespace ast 110 | -------------------------------------------------------------------------------- /include/exporter/image_exporter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace ast 8 | { 9 | struct ImageExportOptions 10 | { 11 | std::string path; 12 | PixelType pixel_type = PIXEL_TYPE_UNORM8; 13 | CompressionType compression = COMPRESSION_NONE; 14 | bool normal_map = false; 15 | bool flip_green = false; 16 | #if defined(ENABLE_DEBUG_OUTPUT) 17 | bool debug_output = false; 18 | #endif 19 | int output_mips = 0; 20 | }; 21 | 22 | struct CubemapImageExportOptions 23 | { 24 | std::string path; 25 | CompressionType compression = COMPRESSION_NONE; 26 | int output_mips = 0; 27 | int force_cmp = 0; 28 | bool irradiance = false; 29 | bool radiance = false; 30 | #if defined(ENABLE_DEBUG_OUTPUT) 31 | bool debug_output = false; 32 | #endif 33 | }; 34 | 35 | extern bool export_image(Image& img, const ImageExportOptions& options); 36 | extern bool cubemap_from_latlong(Image& src, const CubemapImageExportOptions& options); 37 | extern bool cubemap_from_latlong(const std::string& input, const CubemapImageExportOptions& options); 38 | }; // namespace ast 39 | -------------------------------------------------------------------------------- /include/exporter/material_exporter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace ast 7 | { 8 | struct MaterialExportOptions 9 | { 10 | std::string output_root_folder_path_absolute; 11 | bool use_compression = true; 12 | bool normal_map_flip_green = false; 13 | }; 14 | 15 | extern bool export_material(const Material& desc, const MaterialExportOptions& options); 16 | } // namespace ast 17 | -------------------------------------------------------------------------------- /include/exporter/mesh_exporter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace ast 7 | { 8 | struct MeshExportOption 9 | { 10 | std::string output_root_folder_path; 11 | bool use_compression = true; 12 | bool normal_map_flip_green = false; 13 | bool output_metadata = false; 14 | }; 15 | 16 | extern bool export_mesh(const MeshImportResult& import_result, const MeshExportOption& options); 17 | } // namespace ast 18 | -------------------------------------------------------------------------------- /include/exporter/scene_exporter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace ast 6 | { 7 | extern bool export_scene(const Scene& scene, const std::string& path); 8 | } 9 | -------------------------------------------------------------------------------- /include/importer/image_importer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace ast 6 | { 7 | extern bool import_image(Image& img, const std::string& file, const PixelType& type = PIXEL_TYPE_UNORM8, int force_cmp = 0); 8 | } 9 | -------------------------------------------------------------------------------- /include/importer/mesh_importer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace ast 6 | { 7 | struct MeshImportOptions 8 | { 9 | bool displacement_as_normal = false; 10 | bool is_orca_mesh = false; 11 | }; 12 | 13 | extern bool import_mesh(const std::string& file, MeshImportResult& import_result, MeshImportOptions options = MeshImportOptions()); 14 | } // namespace ast -------------------------------------------------------------------------------- /include/loader/loader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace ast 9 | { 10 | bool load_image(const std::string& path, Image& image); 11 | bool load_mesh(const std::string& path, Mesh& mesh); 12 | bool load_material(const std::string& path, Material& material); 13 | bool load_scene(const std::string& path, Scene& scene); 14 | } // namespace ast 15 | -------------------------------------------------------------------------------- /src/brdf_lut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE BRDF_LUT_SOURCE ${PROJECT_SOURCE_DIR}/src/brdf_lut/*.cpp 8 | ${PROJECT_SOURCE_DIR}/src/brdf_lut/*.h) 9 | 10 | add_executable(brdf_lut ${BRDF_LUT_SOURCE}) 11 | 12 | set_property(TARGET brdf_lut PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$(Configuration)") 13 | 14 | target_link_libraries(brdf_lut AssetCoreImporter) 15 | target_link_libraries(brdf_lut AssetCoreExporter) 16 | target_link_libraries(brdf_lut AssetCoreLoader) -------------------------------------------------------------------------------- /src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE AST_COMMON_SOURCE ${PROJECT_SOURCE_DIR}/src/common/*.cpp 8 | ${PROJECT_SOURCE_DIR}/include/common/*.h) 9 | 10 | add_library(AssetCoreCommon ${AST_COMMON_SOURCE}) -------------------------------------------------------------------------------- /src/exporter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE AST_EXPORTER_SOURCE ${PROJECT_SOURCE_DIR}/src/exporter/*.cpp 8 | ${PROJECT_SOURCE_DIR}/include/exporter/*.h) 9 | 10 | add_library(AssetCoreExporter ${AST_EXPORTER_SOURCE}) 11 | 12 | target_link_libraries(AssetCoreExporter AssetCoreCommon) 13 | target_link_libraries(AssetCoreExporter nvtt) 14 | target_link_libraries(AssetCoreExporter cmft) 15 | target_link_libraries(AssetCoreExporter assimp) -------------------------------------------------------------------------------- /src/image_export/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE IMAGE_EXPORT_SOURCE ${PROJECT_SOURCE_DIR}/src/image_export/*.cpp 8 | ${PROJECT_SOURCE_DIR}/src/image_export/*.h) 9 | 10 | add_executable(image_export ${IMAGE_EXPORT_SOURCE}) 11 | 12 | set_property(TARGET image_export PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$(Configuration)") 13 | 14 | target_link_libraries(image_export AssetCoreImporter) 15 | target_link_libraries(image_export AssetCoreExporter) 16 | target_link_libraries(image_export AssetCoreLoader) -------------------------------------------------------------------------------- /src/importer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE AST_IMPORTER_SOURCE ${PROJECT_SOURCE_DIR}/src/importer/*.cpp 8 | ${PROJECT_SOURCE_DIR}/include/importer/*.h) 9 | 10 | add_library(AssetCoreImporter ${AST_IMPORTER_SOURCE}) 11 | 12 | target_link_libraries(AssetCoreImporter AssetCoreCommon) 13 | target_link_libraries(AssetCoreImporter nvtt) 14 | target_link_libraries(AssetCoreImporter cmft) 15 | target_link_libraries(AssetCoreImporter assimp) -------------------------------------------------------------------------------- /src/loader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE AST_LOADER_SOURCE ${PROJECT_SOURCE_DIR}/src/loader/*.cpp 8 | ${PROJECT_SOURCE_DIR}/include/loader/*.h) 9 | 10 | add_library(AssetCoreLoader ${AST_LOADER_SOURCE}) 11 | 12 | target_link_libraries(AssetCoreLoader AssetCoreCommon) -------------------------------------------------------------------------------- /src/mesh_export/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE MESH_EXPORT_SOURCE ${PROJECT_SOURCE_DIR}/src/mesh_export/*.cpp 8 | ${PROJECT_SOURCE_DIR}/src/mesh_export/*.h) 9 | 10 | add_executable(mesh_export ${MESH_EXPORT_SOURCE}) 11 | 12 | set_property(TARGET mesh_export PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$(Configuration)") 13 | 14 | target_link_libraries(mesh_export AssetCoreImporter) 15 | target_link_libraries(mesh_export AssetCoreExporter) -------------------------------------------------------------------------------- /src/sh_project/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8 FATAL_ERROR) 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE) 6 | 7 | file(GLOB_RECURSE SH_PROJECT_SOURCE ${PROJECT_SOURCE_DIR}/src/sh_project/*.cpp 8 | ${PROJECT_SOURCE_DIR}/src/sh_project/*.h) 9 | 10 | add_executable(sh_project ${SH_PROJECT_SOURCE}) 11 | 12 | set_property(TARGET sh_project PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$(Configuration)") 13 | 14 | target_link_libraries(sh_project AssetCoreImporter) 15 | target_link_libraries(sh_project AssetCoreExporter) 16 | target_link_libraries(sh_project AssetCoreLoader) 17 | --------------------------------------------------------------------------------