Pare down assimp thirdparty library
This commit is contained in:
parent
68f373bf69
commit
f95ba69047
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
|
||||
Project home page:
|
||||
http://assimp.sourceforge.net
|
||||
|
||||
Sourceforge.net project page:
|
||||
http://www.sourceforge.net/projects/assimp
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
|
||||
How to build the Assimp installer using Inno Setup
|
||||
|
||||
|
||||
1) Get MS VC 2008 SP1 redist packages for x86 and amd64 and copy 'em right here.
|
||||
|
||||
vcredist_x86.exe
|
||||
vcredist_x64.exe
|
||||
|
||||
2) Get D3DCompiler_NN.dll and D3DX9_NN.dll from a) your system32 folder and b) your SysWOW64 folder. Copy all 4 here. Rename the 64 bit files to <originalname>_x64.dll. NN is the D3DX version targeted by your DX SDK. If it is not 42, you need to update the Inno setup script (script.iss) as well. If you don't have a 64 bit Windows, get the DLLs from somebody else. Please don't ask google because many DLL downloads are infected.
|
||||
|
||||
3) Build assimp, assimpcmd and assimpview for the 'release-dll' target and both the Win32 and x64 architectures.
|
||||
|
||||
4) Get Inno Setup
|
||||
5) Compile, output is written to the 'out' folder.
|
||||
|
@ -1,23 +0,0 @@
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
Open Asset Import Library (Assimp) SDK Installer
|
||||
Release Notes
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
http://assimp.sf.net
|
||||
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
1. Missing d3dx9_(some-number).dll?
|
||||
Install the latest DirectX runtime or grab the file from somewhere (that's evil but mostly fine).
|
||||
|
||||
2. Application configuration not correct / missing msvcr***.dll?
|
||||
Reinstall Microsoft Visual C++ 2005 SP1 Redistributable (x86 or x64, depending on your system)
|
||||
|
||||
3. assimp.exe not in PATH
|
||||
Add it to PATH. That's not a bug, the installer does not alter the PATH.
|
||||
|
||||
4. Crashes immediately
|
||||
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.
|
@ -1,32 +0,0 @@
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
Open Asset Import Library (Assimp) Viewer Installer
|
||||
Release Notes
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
http://assimp.sf.net
|
||||
|
||||
Known Bugs & Limitations
|
||||
========================
|
||||
|
||||
Viewer
|
||||
|
||||
- Normals appear flipped from time to time when either of the normals-related menu items was hit.
|
||||
- Alpha-sorting is implemented, but still causes artifacts when models are moved quickly.
|
||||
- Several important texture file formats (such as GIF) are not supported.
|
||||
- HUD is blurred on the right side. ATI/AMD hardware only.
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
1. Missing d3dx9_(number).dll?
|
||||
Install the latest DirectX runtime or grab the file from somewhere (that's evil but mostly fine).
|
||||
|
||||
2. Application configuration not correct / missing msvcr***.dll?
|
||||
Reinstall Microsoft Visual C++ 2005 SP1 Redistributable (x86 or x64, depending on your system)
|
||||
|
||||
3. assimp.exe not in PATH
|
||||
Add it to PATH. That's not a bug, the installer does not alter the PATH.
|
||||
|
||||
4. Crashes immediately
|
||||
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.
|
@ -1,60 +0,0 @@
|
||||
; Setup script for use with Inno Setup.
|
||||
|
||||
[Setup]
|
||||
AppName=Open Asset Import Library - Viewer
|
||||
AppVerName=Open Asset Import Library - Viewer (v2.0)
|
||||
DefaultDirName={pf}\AssimpView
|
||||
DefaultGroupName=AssimpView
|
||||
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
||||
OutputDir=out_vieweronly
|
||||
AppCopyright=Assimp Development Team
|
||||
SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||
LicenseFile=License.rtf
|
||||
OutputBaseFileName=assimp-view-2.0-setup
|
||||
VersionInfoVersion=2.0.0.0
|
||||
VersionInfoTextVersion=2.0
|
||||
VersionInfoCompany=Assimp Development Team
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\stub\vcredist_x86.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2008 SP1 redistributable package (32 Bit)"; Check: not IsWin64
|
||||
Filename: "{app}\stub\vcredist_x64.exe"; Parameters: "/qb"; StatusMsg: "Installing VS2008 SP1 redistributable package (64 Bit)"; Check: IsWin64
|
||||
|
||||
[Files]
|
||||
|
||||
Source: "readme_installer_vieweronly.txt"; DestDir: "{app}"; Flags: isreadme
|
||||
|
||||
; Installer stub
|
||||
Source: "vcredist_x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64
|
||||
Source: "vcredist_x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64
|
||||
|
||||
; Common stuff
|
||||
Source: "..\..\CREDITS"; DestDir: "{app}"
|
||||
Source: "..\..\LICENSE"; DestDir: "{app}"
|
||||
Source: "..\..\README"; DestDir: "{app}"
|
||||
Source: "WEB"; DestDir: "{app}"
|
||||
|
||||
; x86 binaries
|
||||
Source: "..\..\bin\assimp_release-dll_Win32\Assimp32.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\assimpview_release-dll_Win32\assimp_view.exe"; DestDir: "{app}\bin\x86"
|
||||
Source: "D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "D3DX9_42.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\assimpcmd_release-dll_Win32\assimp.exe"; DestDir: "{app}\bin\x86"
|
||||
|
||||
; x64 binaries
|
||||
Source: "..\..\bin\assimp_release-dll_x64\Assimp64.dll"; DestDir: "{app}\bin\x64"
|
||||
Source: "..\..\bin\assimpview_release-dll_x64\assimp_view.exe"; DestDir: "{app}\bin\x64"
|
||||
Source: "D3DCompiler_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"
|
||||
Source: "D3DX9_42_x64.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"
|
||||
Source: "..\..\bin\assimpcmd_release-dll_x64\assimp.exe"; DestDir: "{app}\bin\x64"
|
||||
|
||||
; Documentation
|
||||
Source: "..\..\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm"; DestDir: "{app}\doc"
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\Assimp Command Line Manual"; Filename: "{app}\doc\AssimpCmdDoc.chm"
|
||||
Name: "{group}\AssimpView"; Filename: "{app}\bin\x64\assimp_view.exe"; Check: IsWin64
|
||||
Name: "{group}\AssimpView"; Filename: "{app}\bin\x86\assimp_view.exe"; Check: not IsWin64
|
@ -1,74 +0,0 @@
|
||||
; Setup script for use with Inno Setup.
|
||||
|
||||
[Setup]
|
||||
AppName=Open Asset Import Library - SDK
|
||||
AppVerName=Open Asset Import Library - SDK (v5.0.0)
|
||||
DefaultDirName={pf}\Assimp
|
||||
DefaultGroupName=Assimp
|
||||
UninstallDisplayIcon={app}\bin\x64\assimp.exe
|
||||
OutputDir=out
|
||||
AppCopyright=Assimp Development Team
|
||||
SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||
LicenseFile=License.rtf
|
||||
OutputBaseFileName=assimp-sdk-5.0.0-setup
|
||||
VersionInfoVersion=5.0.0.0
|
||||
VersionInfoTextVersion=5.0.0
|
||||
VersionInfoCompany=Assimp Development Team
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
[Types]
|
||||
Name: "full"; Description: "Full installation"
|
||||
Name: "compact"; Description: "Compact installation, no test models or language bindings"
|
||||
Name: "custom"; Description: "Custom installation"; Flags: iscustom
|
||||
|
||||
[Components]
|
||||
Name: "main"; Description: "Main Files ( 64 Bit )"; Types: full compact custom; Flags: fixed
|
||||
Name: "tools"; Description: "Asset Viewer & Command Line Tools (32 and 64 Bit)"; Types: full compact
|
||||
Name: "help"; Description: "Help Files"; Types: full compact
|
||||
Name: "samples"; Description: "Samples"; Types: full
|
||||
Name: "test"; Description: "Test Models (BSD-licensed)"; Types: full
|
||||
Name: "test_nonbsd"; Description: "Test Models (other (free) licenses)"; Types: full
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\stub\vc_redist.x64.exe"; Parameters: "/qb /passive /quiet"; StatusMsg: "Installing VS2017 redistributable package (64 Bit)"; Check: IsWin64
|
||||
|
||||
[Files]
|
||||
Source: "readme_installer.txt"; DestDir: "{app}"; Flags: isreadme
|
||||
|
||||
; Installer stub
|
||||
Source: "vc_redist.x64.exe"; DestDir: "{app}\stub\"; Check: IsWin64
|
||||
|
||||
; Common stuff
|
||||
Source: "..\..\CREDITS"; DestDir: "{app}"
|
||||
Source: "..\..\LICENSE"; DestDir: "{app}"
|
||||
Source: "..\..\README"; DestDir: "{app}"
|
||||
Source: "WEB"; DestDir: "{app}"
|
||||
|
||||
Source: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs
|
||||
|
||||
; x64 binaries
|
||||
Source: "..\..\bin\release\assimp-vc141-mt.dll"; DestDir: "{app}\bin\x64"
|
||||
Source: "..\..\bin\release\assimp_viewer.exe"; DestDir: "{app}\bin\x64"; Components: tools
|
||||
Source: "C:\Windows\SysWOW64\D3DCompiler_42.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DCompiler_42.dll"; Components: tools
|
||||
Source: "C:\Windows\SysWOW64\D3DX9_42.dll"; DestDir: "{app}\bin\x64"; DestName: "D3DX9_42.dll"; Components: tools
|
||||
Source: "..\..\bin\release\assimp.exe"; DestDir: "{app}\bin\x64"; Components: tools
|
||||
|
||||
; Import libraries
|
||||
Source: "..\..\lib\release\assimp-vc141-mt.lib"; DestDir: "{app}\lib\x64"
|
||||
|
||||
; Samples
|
||||
Source: "..\..\samples\*"; DestDir: "{app}\samples"; Flags: recursesubdirs; Components: samples
|
||||
|
||||
; Include files
|
||||
Source: "..\..\include\*"; DestDir: "{app}\include"; Flags: recursesubdirs
|
||||
|
||||
; CMake files
|
||||
Source: "..\..\cmake-modules\*"; DestDir: "{app}\cmake-modules"; Flags: recursesubdirs
|
||||
|
||||
[Icons]
|
||||
; Name: "{group}\Assimp Manual"; Filename: "{app}\doc\AssimpDoc.chm" ; Components: help
|
||||
; Name: "{group}\Assimp Command Line Manual"; Filename: "{app}\doc\AssimpCmdDoc.chm"; Components: help
|
||||
; Name: "{group}\AssimpView"; Filename: "{app}\bin\x64\assimp_view.exe"; Components: tools; Check: IsWin64
|
||||
; Name: "{group}\AssimpView"; Filename: "{app}\bin\x86\assimp_view.exe"; Components: tools; Check: not IsWin64
|
@ -1,75 +0,0 @@
|
||||
; Setup script for use with Inno Setup.
|
||||
|
||||
[Setup]
|
||||
AppName=Open Asset Import Library - SDK
|
||||
AppVerName=Open Asset Import Library - SDK (v5.0.0)
|
||||
DefaultDirName={pf}\Assimp
|
||||
DefaultGroupName=Assimp
|
||||
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
||||
OutputDir=out
|
||||
AppCopyright=Assimp Development Team
|
||||
SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||
LicenseFile=License.rtf
|
||||
OutputBaseFileName=assimp-sdk-5.0.0-setup
|
||||
VersionInfoVersion=4.1.0.0
|
||||
VersionInfoTextVersion=4.1.0
|
||||
VersionInfoCompany=Assimp Development Team
|
||||
;ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
[Types]
|
||||
Name: "full"; Description: "Full installation"
|
||||
Name: "compact"; Description: "Compact installation, no test models or language bindings"
|
||||
Name: "custom"; Description: "Custom installation"; Flags: iscustom
|
||||
|
||||
[Components]
|
||||
Name: "main"; Description: "Main Files (32 and 64 Bit)"; Types: full compact custom; Flags: fixed
|
||||
Name: "tools"; Description: "Asset Viewer & Command Line Tools (32 and 64 Bit)"; Types: full compact
|
||||
Name: "help"; Description: "Help Files"; Types: full compact
|
||||
Name: "samples"; Description: "Samples"; Types: full
|
||||
Name: "test"; Description: "Test Models (BSD-licensed)"; Types: full
|
||||
Name: "test_nonbsd"; Description: "Test Models (other (free) licenses)"; Types: full
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\stub\vc_redist.x86.exe"; Parameters: "/qb /passive /quiet"; StatusMsg: "Installing VS2017 redistributable package (32 Bit)"; Check: not IsWin64
|
||||
|
||||
[Files]
|
||||
Source: "readme_installer.txt"; DestDir: "{app}"; Flags: isreadme
|
||||
|
||||
; Installer stub
|
||||
Source: "vc_redist.x86.exe"; DestDir: "{app}\stub\"; Check: not IsWin64
|
||||
|
||||
; Common stuff
|
||||
Source: "..\..\CREDITS"; DestDir: "{app}"
|
||||
Source: "..\..\LICENSE"; DestDir: "{app}"
|
||||
Source: "..\..\README"; DestDir: "{app}"
|
||||
Source: "WEB"; DestDir: "{app}"
|
||||
|
||||
Source: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs
|
||||
|
||||
; x86 binaries
|
||||
Source: "..\..\bin\release\assimp-vc141-mt.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\release\assimp_viewer.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "C:\Windows\SysWOW64\D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "C:\Windows\SysWOW64\D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\release\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
|
||||
|
||||
; Import libraries
|
||||
Source: "..\..\lib\release\assimp-vc141-mt.lib"; DestDir: "{app}\lib\x86"
|
||||
|
||||
; Samples
|
||||
Source: "..\..\samples\*"; DestDir: "{app}\samples"; Flags: recursesubdirs; Components: samples
|
||||
|
||||
; Include files
|
||||
Source: "..\..\include\*"; DestDir: "{app}\include"; Flags: recursesubdirs
|
||||
|
||||
; CMake files
|
||||
Source: "..\..\cmake-modules\*"; DestDir: "{app}\cmake-modules"; Flags: recursesubdirs
|
||||
|
||||
[Icons]
|
||||
; Name: "{group}\Assimp Manual"; Filename: "{app}\doc\AssimpDoc.chm" ; Components: help
|
||||
; Name: "{group}\Assimp Command Line Manual"; Filename: "{app}\doc\AssimpCmdDoc.chm"; Components: help
|
||||
; Name: "{group}\AssimpView"; Filename: "{app}\bin\x64\assimp_view.exe"; Components: tools; Check: IsWin64
|
||||
; Name: "{group}\AssimpView"; Filename: "{app}\bin\x86\assimp_view.exe"; Components: tools; Check: not IsWin64
|
@ -1,29 +0,0 @@
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
Open Asset Import Library (Assimp) Tools/Binaries for Windows
|
||||
Release Notes
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Known Bugs & Limitations
|
||||
========================
|
||||
|
||||
Viewer
|
||||
|
||||
- For files more than one embedded texture, only the first is loaded.
|
||||
- Normals appear flipped from time to time when either of the normals-related menu items was hit.
|
||||
- Alpha-sorting is implemented, but still causes artifacts when models are moved quickly.
|
||||
- Several important texture file formats (such as GIF) are not supported.
|
||||
- HUD is blurred on the right side. ATI/AMD hardware only.
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
1. Missing d3dx9_42.dll?
|
||||
Install the latest DirectX runtime or grab the file from somewhere (that's evil but mostly fine).
|
||||
|
||||
2. Application configuration not correct / missing msv*** DLLs?
|
||||
(Re)install Microsoft Visual C++ 2005 SP1 Redistributable (x86 or x64, depending on your system)
|
||||
|
||||
3. Crashes immediately
|
||||
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.
|
@ -1,169 +0,0 @@
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Batch file to build zipped redist packages
|
||||
rem Two different packages are built:
|
||||
rem
|
||||
rem assimp--<revision>-bin.zip
|
||||
rem Binaries for x86 and x64
|
||||
rem Command line reference
|
||||
rem
|
||||
rem assimp--<revision>-sdk.zip
|
||||
rem Binaries for x86 and x64, Debug & Release
|
||||
rem Libs for DLL build, x86 & 64, Debug & Release
|
||||
rem Full SVN checkout exluding mkutil & port
|
||||
rem
|
||||
rem
|
||||
rem PREREQUISITES:
|
||||
rem -7za.exe (7zip standalone)
|
||||
rem Download from http://www.7-zip.org/download.html
|
||||
rem
|
||||
rem -svnversion.exe (Subversion revision getter)
|
||||
rem Download any command line SVN package
|
||||
rem
|
||||
rem -doxygen.exe (Doxygen client)
|
||||
rem Download from www.doxygen.com
|
||||
rem
|
||||
rem -svn client
|
||||
rem
|
||||
rem NOTES:
|
||||
rem ./bin must not have any local modifications
|
||||
rem
|
||||
rem -----------------------------------------------------
|
||||
|
||||
@echo off
|
||||
color 4e
|
||||
cls
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Setup file revision for build
|
||||
rem -----------------------------------------------------
|
||||
call mkrev.bat
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Build output file names
|
||||
rem -----------------------------------------------------
|
||||
|
||||
cd ..\..\bin
|
||||
svnversion > tmpfile.txt
|
||||
SET /p REVISIONBASE= < tmpfile.txt
|
||||
DEL /q tmpfile.txt
|
||||
cd ..\packaging\windows-mkzip
|
||||
|
||||
SET VERSIONBASE=2.0.%REVISIONBASE%
|
||||
|
||||
SET OUT_SDK=assimp--%VERSIONBASE%-sdk
|
||||
SET OUT_BIN=assimp--%VERSIONBASE%-bin
|
||||
|
||||
SET BINCFG_x86=release-dll_win32
|
||||
SET BINCFG_x64=release-dll_x64
|
||||
|
||||
SET BINCFG_x86_DEBUG=debug-dll_win32
|
||||
SET BINCFG_x64_DEBUG=debug-dll_x64
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Delete previous output directories
|
||||
rem -----------------------------------------------------
|
||||
RD /S /q final\
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Create output directories
|
||||
rem -----------------------------------------------------
|
||||
|
||||
mkdir final\%OUT_BIN%\x86
|
||||
mkdir final\%OUT_BIN%\x64
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Copy all executables to 'final-bin'
|
||||
rem -----------------------------------------------------
|
||||
|
||||
copy /Y ..\..\bin\assimpview_%BINCFG_x86%\assimp_view.exe "final\%OUT_BIN%\x86\assimp_view.exe"
|
||||
copy /Y ..\..\bin\assimpview_%BINCFG_x64%\assimp_view.exe "final\%OUT_BIN%\x64\assimp_view.exe"
|
||||
|
||||
copy /Y ..\..\bin\assimpcmd_%BINCFG_x86%\assimp.exe "final\%OUT_BIN%\x86\assimp.exe"
|
||||
copy /Y ..\..\bin\assimpcmd_%BINCFG_x64%\assimp.exe "final\%OUT_BIN%\x64\assimp.exe"
|
||||
|
||||
copy /Y ..\..\bin\assimp_%BINCFG_x86%\Assimp32.dll "final\%OUT_BIN%\x86\Assimp32.dll"
|
||||
copy /Y ..\..\bin\assimp_%BINCFG_x64%\Assimp64.dll "final\%OUT_BIN%\x64\Assimp64.dll"
|
||||
|
||||
copy ..\..\LICENSE final\%OUT_BIN%\LICENSE
|
||||
copy ..\..\CREDITS final\%OUT_BIN%\CREDITS
|
||||
copy bin_readme.txt final\%OUT_BIN%\README
|
||||
copy bin_readme.txt final\%OUT_BIN%\README
|
||||
|
||||
copy ..\..\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm final\%OUT_BIN%\CommandLine.chm
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Do a clean export of the repository and build SDK
|
||||
rem
|
||||
rem We take the current revision and remove some stuff
|
||||
rem that is nto yet ready to be published.
|
||||
rem -----------------------------------------------------
|
||||
|
||||
svn export .\..\..\ .\final\%OUT_SDK%
|
||||
|
||||
mkdir final\%OUT_SDK%\doc\assimp_html
|
||||
mkdir final\%OUT_SDK%\doc\assimpcmd_html
|
||||
copy .\..\..\doc\AssimpDoc_Html\* final\%OUT_SDK%\doc\assimp_html
|
||||
copy .\..\..\doc\AssimpCmdDoc_Html\* final\%OUT_SDK%\doc\assimpcmd_html
|
||||
del final\%OUT_SDK%\doc\assimpcmd_html\AssimpCmdDoc.chm
|
||||
del final\%OUT_SDK%\doc\assimp_html\AssimpDoc.chm
|
||||
|
||||
rem Copy doc to a suitable place
|
||||
move final\%OUT_SDK%\doc\AssimpDoc_Html\AssimpDoc.chm final\%OUT_SDK%\Documentation.chm
|
||||
move final\%OUT_SDK%\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm final\%OUT_SDK%\CommandLine.chm
|
||||
|
||||
rem Cleanup ./doc folder
|
||||
del /q final\%OUT_SDK%\doc\Preamble.txt
|
||||
RD /s /q final\%OUT_SDK%\doc\AssimpDoc_Html
|
||||
RD /s /q final\%OUT_SDK%\doc\AssimpCmdDoc_Html
|
||||
|
||||
rem Insert 'dummy' files into empty folders
|
||||
echo. > final\%OUT_SDK%\lib\dummy
|
||||
echo. > final\%OUT_SDK%\obj\dummy
|
||||
|
||||
|
||||
RD /s /q final\%OUT_SDK%\port\swig
|
||||
|
||||
rem Also, repackaging is not a must-have feature
|
||||
RD /s /q final\%OUT_SDK%\packaging
|
||||
|
||||
rem Copy prebuilt libs
|
||||
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x86%"
|
||||
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x64%"
|
||||
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x86_DEBUG%"
|
||||
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x64_DEBUG%"
|
||||
|
||||
copy /Y ..\..\lib\assimp_%BINCFG_x86%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x86%"
|
||||
copy /Y ..\..\lib\assimp_%BINCFG_x64%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x64%\"
|
||||
copy /Y ..\..\lib\assimp_%BINCFG_x86_DEBUG%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x86_DEBUG%\"
|
||||
copy /Y ..\..\lib\assimp_%BINCFG_x64_DEBUG%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x64_DEBUG%\"
|
||||
|
||||
rem Copy prebuilt DLLs
|
||||
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x86%"
|
||||
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x64%"
|
||||
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x86_DEBUG%"
|
||||
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x64_DEBUG%"
|
||||
|
||||
|
||||
copy /Y ..\..\bin\assimp_%BINCFG_x86%\Assimp32.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x86%\"
|
||||
copy /Y ..\..\bin\assimp_%BINCFG_x64%\Assimp64.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x64%\"
|
||||
copy /Y ..\..\bin\assimp_%BINCFG_x86_DEBUG%\Assimp32d.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x86_DEBUG%\"
|
||||
copy /Y ..\..\bin\assimp_%BINCFG_x64_DEBUG%\Assimp64d.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x64_DEBUG%\"
|
||||
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Make final-bin.zip and final-sdk.zip
|
||||
rem -----------------------------------------------------
|
||||
|
||||
IF NOT EXIST 7za.exe (
|
||||
cls
|
||||
echo You need to have 7zip standalone installed to
|
||||
echo build ZIP archives. Download: http://www.7-zip.org/download.html
|
||||
pause
|
||||
) else (
|
||||
7za.exe a -tzip "final\%OUT_BIN%.zip" ".\final\%OUT_BIN%"
|
||||
7za.exe a -tzip "final\%OUT_SDK%.zip" ".\final\%OUT_SDK%"
|
||||
)
|
||||
|
||||
rem OK. We should have the release packages now.
|
||||
|
@ -1,27 +0,0 @@
|
||||
@echo off
|
||||
|
||||
rem -----------------------------------------------------
|
||||
rem Tiny batch script to build the input file revision.h
|
||||
rem revision.h contains the revision number of the wc.
|
||||
rem It is included by assimp.rc.
|
||||
rem -----------------------------------------------------
|
||||
|
||||
rem This is not very elegant, but it works.
|
||||
rem ./bin shouldn't have any local modifications
|
||||
|
||||
svnversion > tmpfile.txt
|
||||
set /p addtext= < tmpfile.txt
|
||||
del /q tmpfile.txt
|
||||
|
||||
echo #define SVNRevision > tmpfile.txt
|
||||
|
||||
if exist ..\..\revision.h del /q ..\..\revision.h
|
||||
for /f "delims=" %%l in (tmpfile.txt) Do (
|
||||
for /f "delims=M:" %%r in ("%addtext%") Do (
|
||||
echo %%l %%r >> ..\..\revision.h
|
||||
)
|
||||
)
|
||||
del /q tmpfile.txt
|
||||
|
||||
|
||||
|
@ -1,207 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file Android extension of DefaultIOSystem using the standard C file functions */
|
||||
|
||||
|
||||
#include <assimp/config.h>
|
||||
#include <android/api-level.h>
|
||||
#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <android/log.h>
|
||||
#include <android/asset_manager.h>
|
||||
#include <android/asset_manager_jni.h>
|
||||
#include <android/native_activity.h>
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/port/AndroidJNI/AndroidJNIIOSystem.h>
|
||||
#include <assimp/DefaultIOStream.h>
|
||||
#include <fstream>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor.
|
||||
AndroidJNIIOSystem::AndroidJNIIOSystem(ANativeActivity* activity)
|
||||
{
|
||||
AndroidActivityInit(activity);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor.
|
||||
AndroidJNIIOSystem::~AndroidJNIIOSystem()
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Tests for the existence of a file at the given path.
|
||||
bool AndroidJNIIOSystem::Exists( const char* pFile) const
|
||||
{
|
||||
AAsset* asset = AAssetManager_open(mApkAssetManager, pFile,
|
||||
AASSET_MODE_UNKNOWN);
|
||||
FILE* file = ::fopen( (mApkWorkspacePath + getOsSeparator() + std::string(pFile)).c_str(), "rb");
|
||||
|
||||
if (!asset && !file)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Assimp", "Asset manager can not find: %s", pFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Assimp", "Asset exists");
|
||||
if (file)
|
||||
::fclose( file);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Inits Android extractor
|
||||
void AndroidJNIIOSystem::AndroidActivityInit(ANativeActivity* activity)
|
||||
{
|
||||
mApkWorkspacePath = activity->internalDataPath;
|
||||
mApkAssetManager = activity->assetManager;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Create the directory for the extracted resource
|
||||
static int mkpath(std::string path, mode_t mode)
|
||||
{
|
||||
if (mkdir(path.c_str(), mode) == -1) {
|
||||
switch(errno) {
|
||||
case ENOENT:
|
||||
if (mkpath(path.substr(0, path.find_last_of('/')), mode) == -1)
|
||||
return -1;
|
||||
else
|
||||
return mkdir(path.c_str(), mode);
|
||||
case EEXIST:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Extracts android asset
|
||||
bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name)
|
||||
{
|
||||
std::string newPath = mApkWorkspacePath + getOsSeparator() + name;
|
||||
|
||||
DefaultIOSystem io;
|
||||
|
||||
// Do not extract if extracted already
|
||||
if ( io.Exists(newPath.c_str()) ) {
|
||||
__android_log_print(ANDROID_LOG_DEFAULT, "Assimp", "Asset already extracted");
|
||||
return true;
|
||||
}
|
||||
// Open file
|
||||
AAsset* asset = AAssetManager_open(mApkAssetManager, name.c_str(),
|
||||
AASSET_MODE_UNKNOWN);
|
||||
std::vector<char> assetContent;
|
||||
|
||||
if (asset != NULL) {
|
||||
// Find size
|
||||
off_t assetSize = AAsset_getLength(asset);
|
||||
|
||||
// Prepare input buffer
|
||||
assetContent.resize(assetSize);
|
||||
|
||||
// Store input buffer
|
||||
AAsset_read(asset, &assetContent[0], assetSize);
|
||||
|
||||
// Close
|
||||
AAsset_close(asset);
|
||||
|
||||
// Prepare directory for output buffer
|
||||
std::string directoryNewPath = newPath;
|
||||
directoryNewPath = dirname(&directoryNewPath[0]);
|
||||
|
||||
if (mkpath(directoryNewPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "assimp",
|
||||
"Can not create the directory for the output file");
|
||||
}
|
||||
|
||||
// Prepare output buffer
|
||||
std::ofstream assetExtracted(newPath.c_str(),
|
||||
std::ios::out | std::ios::binary);
|
||||
if (!assetExtracted) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "assimp",
|
||||
"Can not open output file");
|
||||
}
|
||||
|
||||
// Write output buffer into a file
|
||||
assetExtracted.write(&assetContent[0], assetContent.size());
|
||||
assetExtracted.close();
|
||||
|
||||
__android_log_print(ANDROID_LOG_DEFAULT, "Assimp", "Asset extracted");
|
||||
} else {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "assimp", "Asset not found: %s", name.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Open a new file with a given path.
|
||||
IOStream* AndroidJNIIOSystem::Open( const char* strFile, const char* strMode)
|
||||
{
|
||||
ai_assert(NULL != strFile);
|
||||
ai_assert(NULL != strMode);
|
||||
|
||||
std::string fullPath(mApkWorkspacePath + getOsSeparator() + std::string(strFile));
|
||||
if (Exists(strFile))
|
||||
AndroidExtractAsset(std::string(strFile));
|
||||
|
||||
FILE* file = ::fopen( fullPath.c_str(), strMode);
|
||||
|
||||
if( NULL == file)
|
||||
return NULL;
|
||||
|
||||
__android_log_print(ANDROID_LOG_ERROR, "assimp", "AndroidIOSystem: file %s opened", fullPath.c_str());
|
||||
return new DefaultIOStream(file, fullPath);
|
||||
}
|
||||
|
||||
#undef PATHLIMIT
|
||||
#endif // __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
|
@ -1,6 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
include_directories(./)
|
||||
include_directories(./../../)
|
||||
add_library(android_jniiosystem STATIC AndroidJNIIOSystem.cpp)
|
||||
TARGET_LINK_LIBRARIES(android_jniiosystem android log)
|
27
thirdparty/assimp/port/AndroidJNI/README.md
vendored
27
thirdparty/assimp/port/AndroidJNI/README.md
vendored
@ -1,27 +0,0 @@
|
||||
Build Asset Importer Lib for Android
|
||||
====================================
|
||||
This module provides a facade for the io-stream-access to files behind the android-asset-management within
|
||||
an Android-native application.
|
||||
- It is built as a static library
|
||||
- It requires Android NDK with android API > 9 support.
|
||||
|
||||
### Building ###
|
||||
To use this module please provide following cmake defines:
|
||||
```
|
||||
-DASSIMP_ANDROID_JNIIOSYSTEM=ON
|
||||
-DCMAKE_TOOLCHAIN_FILE=$SOME_PATH/android.toolchain.cmake
|
||||
```
|
||||
|
||||
"SOME_PATH" is a path to your cmake android toolchain script.
|
||||
|
||||
### Code ###
|
||||
A small example how to wrap assimp for Android:
|
||||
```cpp
|
||||
#include <assimp/port/AndroidJNI/AndroidJNIIOSystem.h>
|
||||
|
||||
Assimp::Importer* importer = new Assimp::Importer();
|
||||
Assimp::AndroidJNIIOSystem *ioSystem = new Assimp::AndroidJNIIOSystem(app->activity);
|
||||
if ( nullptr != iosSystem ) {
|
||||
importer->SetIOHandler(ioSystem);
|
||||
}
|
||||
```
|
@ -1,6 +0,0 @@
|
||||
This is a set of Delphi units for using the Assimp C DLL. This was created for use with Delphi 7, but should be usable as-is or with minimal modifications with later Delphi versions.
|
||||
|
||||
This set of headers is enough to load and display a model with external textures. Since I'm not familiar with animated models and some of the other functionality of the assimp library, I did not convert the headers for those features.
|
||||
|
||||
See http://sourceforge.net/tracker/?func=detail&aid=3212646&group_id=226462&atid=1067634 for the original patch
|
||||
|
@ -1,17 +0,0 @@
|
||||
unit aiColor4D;
|
||||
|
||||
interface
|
||||
|
||||
const AI_MAX_NUMBER_OF_COLOR_SETS = $04;
|
||||
|
||||
type TaiColor4D = packed record
|
||||
r, g, b, a: single;
|
||||
end;
|
||||
type PaiColor4D = ^TaiColor4D;
|
||||
|
||||
type TaiColor4DArray = array[0..0] of TaiColor4D;
|
||||
type PTaiColor4DArray = ^TaiColor4DArray;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
153
thirdparty/assimp/port/AssimpDelphi/aiMaterial.pas
vendored
153
thirdparty/assimp/port/AssimpDelphi/aiMaterial.pas
vendored
@ -1,153 +0,0 @@
|
||||
unit aiMaterial;
|
||||
|
||||
interface
|
||||
|
||||
uses aiTypes, aiVector2D, aiVector3D;
|
||||
|
||||
{This following directive causes enums to be stored as double words (32bit), to be compatible with
|
||||
the assimp C Dll}
|
||||
{$Z4}
|
||||
|
||||
type TaiTextureOp = (
|
||||
aiTextureOp_Multiply = $0,
|
||||
aiTextureOp_Add = $1,
|
||||
aiTextureOp_Subtract = $2,
|
||||
aiTextureOp_Divide = $3,
|
||||
aiTextureOp_SmoothAdd = $4,
|
||||
aiTextureOp_SignedAdd = $5
|
||||
//_aiTextureOp_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
type TaiTextureMapMode = (
|
||||
aiTextureMapMode_Wrap = $0,
|
||||
aiTextureMapMode_Clamp = $1,
|
||||
aiTextureMapMode_Decal = $3,
|
||||
aiTextureMapMode_Mirror = $2
|
||||
//_aiTextureMapMode_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
type TaiTextureMapping = (
|
||||
aiTextureMapping_UV = $0,
|
||||
aiTextureMapping_SPHERE = $1,
|
||||
aiTextureMapping_CYLINDER = $2,
|
||||
aiTextureMapping_BOX = $3,
|
||||
aiTextureMapping_PLANE = $4,
|
||||
aiTextureMapping_OTHER = $5
|
||||
//_aiTextureMapping_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
type TaiTextureType = (
|
||||
aiTextureType_NONE = $0,
|
||||
aiTextureType_DIFFUSE = $1,
|
||||
aiTextureType_SPECULAR = $2,
|
||||
aiTextureType_AMBIENT = $3,
|
||||
aiTextureType_EMISSIVE = $4,
|
||||
aiTextureType_HEIGHT = $5,
|
||||
aiTextureType_NORMALS = $6,
|
||||
aiTextureType_SHININESS = $7,
|
||||
aiTextureType_OPACITY = $8,
|
||||
aiTextureType_DISPLACEMENT = $9,
|
||||
aiTextureType_LIGHTMAP = $A,
|
||||
aiTextureType_REFLECTION = $B,
|
||||
aiTextureType_UNKNOWN = $C
|
||||
//_aiTextureType_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
const AI_TEXTURE_TYPE_MAX = aiTextureType_UNKNOWN;
|
||||
|
||||
type TaiShadingMode = (
|
||||
aiShadingMode_Flat = $1,
|
||||
aiShadingMode_Gouraud = $2,
|
||||
aiShadingMode_Phong = $3,
|
||||
aiShadingMode_Blinn = $4,
|
||||
aiShadingMode_Toon = $5,
|
||||
aiShadingMode_OrenNayar = $6,
|
||||
aiShadingMode_Minnaert = $7,
|
||||
aiShadingMode_CookTorrance = $8,
|
||||
aiShadingMode_NoShading = $9,
|
||||
aiShadingMode_Fresnel = $A
|
||||
//_aiShadingMode_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
|
||||
type TaiTextureFlags = (
|
||||
aiTextureFlags_Invert = $1,
|
||||
aiTextureFlags_UseAlpha = $2,
|
||||
aiTextureFlags_IgnoreAlpha = $4
|
||||
//_aiTextureFlags_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
type TaiBlendMode = (
|
||||
aiBlendMode_Default = $0,
|
||||
aiBlendMode_Additive = $1
|
||||
//_aiBlendMode_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
type TaiUVTransform = packed record
|
||||
mTranslation: TaiVector2D;
|
||||
mScaling: TaiVector2D;
|
||||
mRotation: single;
|
||||
end;
|
||||
|
||||
type TaiPropertyTypeInfo = (
|
||||
aiPTI_Float = $1,
|
||||
aiPTI_String = $3,
|
||||
aiPTI_Integer = $4,
|
||||
aiPTI_Buffer = $5
|
||||
// _aiPTI_Force32Bit = 0x9fffffff
|
||||
);
|
||||
|
||||
type TaiMaterialProperty = packed record
|
||||
mKey: aiString;
|
||||
mSemantic: Cardinal;
|
||||
mIndex: Cardinal;
|
||||
mDataLength: Cardinal;
|
||||
mType: TaiPropertyTypeInfo;
|
||||
mData: PChar;
|
||||
end;
|
||||
type PaiMaterialProperty = ^TaiMaterialProperty;
|
||||
|
||||
type TaiMaterial = packed record
|
||||
mProperties: pointer;
|
||||
mNumProperties: Cardinal;
|
||||
mNumAllocated: Cardinal;
|
||||
end;
|
||||
type PaiMaterial = ^TaiMaterial;
|
||||
type PaiMaterialArray = array[0..0] of PaiMaterial;
|
||||
type PPaiMaterialArray = ^PaiMaterialArray;
|
||||
|
||||
const AI_MATKEY_NAME = '?mat.name';
|
||||
const AI_MATKEY_TWOSIDED = '$mat.twosided';
|
||||
const AI_MATKEY_SHADING_MODEL = '$mat.shadingm';
|
||||
const AI_MATKEY_ENABLE_WIREFRAME = '$mat.wireframe';
|
||||
const AI_MATKEY_BLEND_FUNC = '$mat.blend';
|
||||
const AI_MATKEY_OPACITY = '$mat.opacity';
|
||||
const AI_MATKEY_BUMPSCALING = '$mat.bumpscaling';
|
||||
const AI_MATKEY_SHININESS = '$mat.shininess';
|
||||
const AI_MATKEY_REFLECTIVITY = '$mat.reflectivity';
|
||||
const AI_MATKEY_SHININESS_STRENGTH = '$mat.shinpercent';
|
||||
const AI_MATKEY_REFRACTI = '$mat.refracti';
|
||||
const AI_MATKEY_COLOR_DIFFUSE = '$clr.diffuse';
|
||||
const AI_MATKEY_COLOR_AMBIENT = '$clr.ambient';
|
||||
const AI_MATKEY_COLOR_SPECULAR = '$clr.specular';
|
||||
const AI_MATKEY_COLOR_EMISSIVE = '$clr.emissive';
|
||||
const AI_MATKEY_COLOR_TRANSPARENT = '$clr.transparent';
|
||||
const AI_MATKEY_COLOR_REFLECTIVE = '$clr.reflective';
|
||||
const AI_MATKEY_GLOBAL_BACKGROUND_IMAGE = '?bg.global';
|
||||
|
||||
const _AI_MATKEY_TEXTURE_BASE = '$tex.file';
|
||||
const _AI_MATKEY_UVWSRC_BASE = '$tex.uvwsrc';
|
||||
const _AI_MATKEY_TEXOP_BASE = '$tex.op';
|
||||
const _AI_MATKEY_MAPPING_BASE = '$tex.mapping';
|
||||
const _AI_MATKEY_TEXBLEND_BASE = '$tex.blend';
|
||||
const _AI_MATKEY_MAPPINGMODE_U_BASE = '$tex.mapmodeu';
|
||||
const _AI_MATKEY_MAPPINGMODE_V_BASE = '$tex.mapmodev';
|
||||
const _AI_MATKEY_TEXMAP_AXIS_BASE = '$tex.mapaxis';
|
||||
const _AI_MATKEY_UVTRANSFORM_BASE = '$tex.uvtrafo';
|
||||
const _AI_MATKEY_TEXFLAGS_BASE = '$tex.flags';
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
@ -1,16 +0,0 @@
|
||||
unit aiMatrix3x3;
|
||||
|
||||
interface
|
||||
|
||||
type TaiMatrix3x3 = packed record
|
||||
a1, a2, a3, a4: single;
|
||||
b1, b2, b3, b4: single;
|
||||
c1, c2, c3, c4: single;
|
||||
end;
|
||||
PaiMatrix3x3 = ^TaiMatrix3x3;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
@ -1,16 +0,0 @@
|
||||
unit aiMatrix4x4;
|
||||
|
||||
interface
|
||||
|
||||
type TaiMatrix4x4 = packed record
|
||||
a1, a2, a3, a4: single;
|
||||
b1, b2, b3, b4: single;
|
||||
c1, c2, c3, c4: single;
|
||||
d1, d2, d3, d4: single;
|
||||
end;
|
||||
PaiMatrix4x4 = ^TaiMatrix4x4;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
71
thirdparty/assimp/port/AssimpDelphi/aiMesh.pas
vendored
71
thirdparty/assimp/port/AssimpDelphi/aiMesh.pas
vendored
@ -1,71 +0,0 @@
|
||||
unit aiMesh;
|
||||
|
||||
interface
|
||||
|
||||
uses aiTypes, aiMatrix4x4, aiVector3D, aiColor4D;
|
||||
|
||||
const
|
||||
AI_MAX_NUMBER_OF_COLOR_SETS = $4;
|
||||
AI_MAX_NUMBER_OF_TEXTURECOORDS = $4;
|
||||
|
||||
type TaiFace = packed record
|
||||
mNumIndicies: cardinal;
|
||||
mIndices: PCardinalArray;
|
||||
end;
|
||||
type PaiFace = ^TaiFace;
|
||||
type PaiFaceArray = array [0..0] of PaiFace;
|
||||
|
||||
type TaiFaceArray = array [0..0] of TaiFace;
|
||||
type PTaiFaceArray = ^TaiFaceArray;
|
||||
|
||||
type TaiVertexWeight = packed record
|
||||
mVertexId: cardinal;
|
||||
mWeight: single;
|
||||
end;
|
||||
|
||||
type TaiBone = packed record
|
||||
mName: aiString;
|
||||
mNumWeights: cardinal;
|
||||
mWeights: Pointer;
|
||||
mOffsetMatrix: TaiMatrix4x4;
|
||||
end;
|
||||
type PaiBone = ^TaiBone;
|
||||
|
||||
type TaiPrimitiveType =
|
||||
(
|
||||
aiPrimitiveType_POINT = $1,
|
||||
aiPrimitiveType_LINE = $2,
|
||||
aiPrimitiveType_TRIANGLE = $4,
|
||||
aiPrimitiveType_POLYGON = $8
|
||||
//,_aiPrimitiveType_Force32Bit = $9fffffff
|
||||
);
|
||||
|
||||
type TaiMesh = packed record
|
||||
mPrimitiveTypes: cardinal;
|
||||
mNumVertices: cardinal;
|
||||
mNumFaces: cardinal;
|
||||
mVertices: PTaiVector3DArray;
|
||||
mNormals: PTaiVector3DArray;
|
||||
mTangents: PaiVector3DArray;
|
||||
mBitangents: PaiVector3DArray;
|
||||
mColors: array[0..3] of PTaiColor4Darray; //array [0..3] of PaiColor4DArray; //array of 4
|
||||
mTextureCoords: array [0..3] of PTaiVector3DArray; //array of 4
|
||||
mNumUVComponents: array[0..AI_MAX_NUMBER_OF_TEXTURECOORDS -1] of cardinal;
|
||||
mFaces: PTaiFaceArray;
|
||||
mNumBones: cardinal;
|
||||
mBones: PaiBone;
|
||||
mMaterialIndex: cardinal;
|
||||
mName: aiString;
|
||||
mNumAniMeshes: cardinal;
|
||||
mAniMeshes: pointer;
|
||||
end;
|
||||
type PaiMesh = ^TaiMesh;
|
||||
type PPaiMesh = ^PaiMesh;
|
||||
type PaiMeshArray = array [0..0] of PaiMesh;
|
||||
type PPaiMeshArray = ^PaiMeshArray;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
@ -1,12 +0,0 @@
|
||||
unit aiQuaternion;
|
||||
|
||||
interface
|
||||
|
||||
type TaiQuaternion = packed record
|
||||
w, x, y, z: single;
|
||||
end;
|
||||
type PaiQuaternion = ^TaiQuaternion;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
46
thirdparty/assimp/port/AssimpDelphi/aiScene.pas
vendored
46
thirdparty/assimp/port/AssimpDelphi/aiScene.pas
vendored
@ -1,46 +0,0 @@
|
||||
unit aiScene;
|
||||
|
||||
interface
|
||||
|
||||
uses aiTypes, aiMatrix4x4, aiMesh, aiMaterial, aiTexture;
|
||||
|
||||
|
||||
type
|
||||
PaiNode = ^TaiNode;
|
||||
PPaiNode = ^PaiNode;
|
||||
PaiNodeArray = array[0..0] of PaiNode;
|
||||
PPaiNodeArray = ^PaiNodeArray;
|
||||
|
||||
TaiNode = packed record
|
||||
mName: aiString;
|
||||
mTransformation: TaiMatrix4x4;
|
||||
mParent: PPaiNode;
|
||||
mNumChildren: cardinal;
|
||||
mChildren: PPaiNodeArray;
|
||||
mNumMeshes: cardinal;
|
||||
mMeshes: PCardinalArray;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
type TaiScene = packed record
|
||||
mFlags: cardinal;
|
||||
mRootNode: PaiNode;
|
||||
mNumMeshes: Cardinal;
|
||||
mMeshes: PPaiMeshArray; //?
|
||||
mNumMaterials: Cardinal;
|
||||
mMaterials: PPaiMaterialArray;
|
||||
mNumAnimations: Cardinal;
|
||||
mAnimations: Pointer;
|
||||
mNumTextures: Cardinal;
|
||||
mTextures: PPaiTextureArray;
|
||||
mNumLights: Cardinal;
|
||||
mLights: Pointer;
|
||||
mNumCameras: Cardinal;
|
||||
mCameras: Pointer;
|
||||
end;
|
||||
type PaiScene = ^TaiScene;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
@ -1,26 +0,0 @@
|
||||
unit aiTexture;
|
||||
|
||||
interface
|
||||
|
||||
type TaiTexel = packed record
|
||||
b, g, r, a: byte;
|
||||
end;
|
||||
PaiTexel = ^TaiTexel;
|
||||
TaiTexelArray = array[0..0] of TaiTexel;
|
||||
PaiTexelArray = ^TaiTexelArray;
|
||||
|
||||
type TaiTexture = packed record
|
||||
mWidth: Cardinal; //width in pixels, OR total embedded file size if texture is a jpg/png/etc
|
||||
mHeight: Cardinal; //0 if texture is an embedded file
|
||||
achFormatHint: array[0..3] of byte;
|
||||
pcData: PaiTexelArray;
|
||||
end;
|
||||
PaiTexture = ^TaiTexture;
|
||||
PaiTextureArray = array [0..0] of PaiTexture;
|
||||
PPaiTextureArray = ^PaiTextureArray;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
53
thirdparty/assimp/port/AssimpDelphi/aiTypes.pas
vendored
53
thirdparty/assimp/port/AssimpDelphi/aiTypes.pas
vendored
@ -1,53 +0,0 @@
|
||||
unit aiTypes;
|
||||
|
||||
interface
|
||||
|
||||
//added for Delphi interface
|
||||
type
|
||||
TCardinalArray = array [0..0] of Cardinal;
|
||||
PCardinalArray = ^TCardinalArray;
|
||||
|
||||
TSingleArray = array[0..0] of Single;
|
||||
PSingleArray = ^TSingleArray;
|
||||
|
||||
type aiString = packed record
|
||||
length: Cardinal;
|
||||
data: array [0..1023] of char;
|
||||
end;
|
||||
type PaiString = ^aiString;
|
||||
|
||||
type aiReturn = (
|
||||
aiReturn_SUCCESS = $0,
|
||||
aiReturn_FAILURE = -$1,
|
||||
aiReturn_OUTOFMEMORY = -$3,
|
||||
_AI_ENFORCE_ENUM_SIZE = $7fffffff
|
||||
);
|
||||
|
||||
const AI_SUCCESS = aiReturn_SUCCESS;
|
||||
const AI_FAILURE = aiReturn_FAILURE;
|
||||
const AI_OUTOFMEMORY = aiReturn_OUTOFMEMORY;
|
||||
|
||||
|
||||
|
||||
|
||||
function aiStringToDelphiString( a: aiString): AnsiString;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
function aiStringToDelphiString( a: aiString): AnsiString;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
result := '';
|
||||
if a.length > 0 then
|
||||
begin
|
||||
SetLength( result, a.length);
|
||||
for i := 1 to a.length do
|
||||
begin
|
||||
result[i] := a.data[i-1];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
@ -1,13 +0,0 @@
|
||||
unit aiVector2D;
|
||||
|
||||
interface
|
||||
|
||||
type TaiVector2D = packed record
|
||||
x, y: single;
|
||||
end;
|
||||
type PaiVector2D = ^TaiVector2D;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
@ -1,16 +0,0 @@
|
||||
unit aiVector3D;
|
||||
|
||||
interface
|
||||
|
||||
type TaiVector3D = packed record
|
||||
x, y, z: single;
|
||||
end;
|
||||
type PaiVector3D = ^TaiVector3D;
|
||||
type PaiVector3DArray = array [0..0] of PaiVector3D;
|
||||
|
||||
type TaiVector3DArray = array[0..0] of TaiVector3D;
|
||||
type PTaiVector3DArray = ^TaiVector3DArray;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
58
thirdparty/assimp/port/AssimpDelphi/assimp.pas
vendored
58
thirdparty/assimp/port/AssimpDelphi/assimp.pas
vendored
@ -1,58 +0,0 @@
|
||||
unit assimp;
|
||||
|
||||
interface
|
||||
|
||||
uses aiTypes, aiMatrix4x4, aiMatrix3x3, aiMesh, aiScene, aiMaterial, aiColor4d, aiVector3D;
|
||||
|
||||
const ASSIMP_DLL = 'assimp32.dll';
|
||||
|
||||
function aiImportFile(filename: pchar; pFlags: integer): PaiScene; cdecl; external ASSIMP_DLL;
|
||||
procedure aiReleaseImport( pScene: pointer); cdecl; external ASSIMP_DLL;
|
||||
function aiGetErrorString(): PChar; cdecl; external ASSIMP_DLL;
|
||||
|
||||
//procedure aiDecomposeMatrix( var mat: TaiMatrix4x4; var scaling: TaiVector3D; var rotation: TaiQuaternion; var position: TaiVector3D); cdecl; external ASSIMP_DLL;
|
||||
procedure aiTransposeMatrix4( var mat: TaiMatrix4x4); cdecl; external ASSIMP_DLL;
|
||||
procedure aiTransposeMatrix3( var mat: TaiMatrix3x3); cdecl; external ASSIMP_DLL;
|
||||
procedure aiTransformVecByMatrix3( var vec: TaiVector3D; var mat: TaiMatrix3x3); cdecl; external ASSIMP_DLL;
|
||||
procedure aiTransformVecByMatrix4( var vec: TaiVector3D; var mat: TaiMatrix4x4); cdecl; external ASSIMP_DLL;
|
||||
|
||||
procedure aiMultiplyMatrix4(var dst: TaiMatrix4x4; var src: TaiMatrix4x4); cdecl; external ASSIMP_DLL;
|
||||
procedure aiMultiplyMatrix3(var dst: TaiMatrix3x3; var src: TaiMatrix3x3); cdecl; external ASSIMP_DLL;
|
||||
|
||||
|
||||
procedure aiIdentityMatrix3(var mat: TaiMatrix3x3); cdecl; external ASSIMP_DLL;
|
||||
procedure aiIdentityMatrix4(var mat: TaiMatrix4x4); cdecl; external ASSIMP_DLL;
|
||||
|
||||
|
||||
//----- from aiMaterial.h
|
||||
function aiGetMaterialProperty( pMat: PaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; pPropOut: pointer): aiReturn; cdecl; external ASSIMP_DLL;
|
||||
function aiGetMaterialFloatArray( var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Single; var pMax: Cardinal): aiReturn; cdecl; external ASSIMP_DLL;
|
||||
function aiGetMaterialFloat( var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Single): aiReturn;
|
||||
function aiGetMaterialIntegerArray(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Integer; var pMax: Cardinal): aiReturn; cdecl; external ASSIMP_DLL;
|
||||
function aiGetMaterialInteger(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Integer): aiReturn;
|
||||
function aiGetMaterialColor(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: TaiColor4d): aiReturn; cdecl; external ASSIMP_DLL;
|
||||
function aiGetMaterialString(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: aiString): aiReturn; cdecl; external ASSIMP_DLL;
|
||||
function aiGetMaterialTextureCount(var pMat: TaiMaterial; nType: TaiTextureType): Cardinal; cdecl; external ASSIMP_DLL;
|
||||
function aiGetMaterialTexture(var mat: TaiMaterial; nType: TaiTextureType; nIndex: Cardinal; var path: aiString; var mapping: TaiTextureMapping; var uvindex: Cardinal; var blend: single; var op: TaiTextureOp; var mapmode: TaiTextureMapMode; var flags: Cardinal): aiReturn; cdecl; external ASSIMP_DLL;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
function aiGetMaterialFloat( var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Single): aiReturn;
|
||||
var
|
||||
n: cardinal;
|
||||
begin
|
||||
n := 0;
|
||||
result := aiGetMaterialFloatArray( pMat, pKey, nType, nIndex, pOut, n);
|
||||
end;
|
||||
|
||||
function aiGetMaterialInteger(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: integer): aiReturn;
|
||||
var
|
||||
n: cardinal;
|
||||
begin
|
||||
n := 0;
|
||||
result := aiGetMaterialIntegerArray( pMat, pKey, nType, nIndex, pOut, n);
|
||||
end;
|
||||
|
||||
end.
|
1
thirdparty/assimp/port/AssimpNET/Readme.md
vendored
1
thirdparty/assimp/port/AssimpNET/Readme.md
vendored
@ -1 +0,0 @@
|
||||
Please check the following git-repo for the source: https://github.com/kebby/assimp-net
|
@ -1 +0,0 @@
|
||||
See the [AssimpPascal headers here](https://github.com/ev1313/Pascal-Assimp-Headers) (by Tim Blume / ev1313).
|
Binary file not shown.
Before Width: | Height: | Size: 50 KiB |
91
thirdparty/assimp/port/PyAssimp/README.md
vendored
91
thirdparty/assimp/port/PyAssimp/README.md
vendored
@ -1,91 +0,0 @@
|
||||
PyAssimp Readme
|
||||
===============
|
||||
|
||||
A simple Python wrapper for Assimp using `ctypes` to access the library.
|
||||
Requires Python >= 2.6.
|
||||
|
||||
Python 3 support is mostly here, but not well tested.
|
||||
|
||||
Note that pyassimp is not complete. Many ASSIMP features are missing.
|
||||
|
||||
USAGE
|
||||
-----
|
||||
|
||||
### Complete example: 3D viewer
|
||||
|
||||
`pyassimp` comes with a simple 3D viewer that shows how to load and display a 3D
|
||||
model using a shader-based OpenGL pipeline.
|
||||
|
||||
![Screenshot](3d_viewer_screenshot.png)
|
||||
|
||||
To use it, from within `/port/PyAssimp`:
|
||||
|
||||
```console
|
||||
$ cd scripts
|
||||
$ python ./3D-viewer <path to your model>
|
||||
```
|
||||
|
||||
You can use this code as starting point in your applications.
|
||||
|
||||
### Writing your own code
|
||||
|
||||
To get started with `pyassimp`, examine the simpler `sample.py` script in `scripts/`,
|
||||
which illustrates the basic usage. All Assimp data structures are wrapped using
|
||||
`ctypes`. All the data+length fields in Assimp's data structures (such as
|
||||
`aiMesh::mNumVertices`, `aiMesh::mVertices`) are replaced by simple python
|
||||
lists, so you can call `len()` on them to get their respective size and access
|
||||
members using `[]`.
|
||||
|
||||
For example, to load a file named `hello.3ds` and print the first
|
||||
vertex of the first mesh, you would do (proper error handling
|
||||
substituted by assertions ...):
|
||||
|
||||
```python
|
||||
|
||||
from pyassimp import *
|
||||
scene = load('hello.3ds')
|
||||
|
||||
assert len(scene.meshes)
|
||||
mesh = scene.meshes[0]
|
||||
|
||||
assert len(mesh.vertices)
|
||||
print(mesh.vertices[0])
|
||||
|
||||
# don't forget this one, or you will leak!
|
||||
release(scene)
|
||||
|
||||
```
|
||||
|
||||
Another example to list the 'top nodes' in a
|
||||
scene:
|
||||
|
||||
```python
|
||||
|
||||
from pyassimp import *
|
||||
scene = load('hello.3ds')
|
||||
|
||||
for c in scene.rootnode.children:
|
||||
print(str(c))
|
||||
|
||||
release(scene)
|
||||
|
||||
```
|
||||
|
||||
INSTALL
|
||||
-------
|
||||
|
||||
Install `pyassimp` by running:
|
||||
|
||||
```console
|
||||
$ python setup.py install
|
||||
```
|
||||
|
||||
PyAssimp requires a assimp dynamic library (`DLL` on windows,
|
||||
`.so` on linux, `.dynlib` on macOS) in order to work. The default search directories are:
|
||||
- the current directory
|
||||
- on linux additionally: `/usr/lib`, `/usr/local/lib`,
|
||||
`/usr/lib/x86_64-linux-gnu`
|
||||
|
||||
To build that library, refer to the Assimp master `INSTALL`
|
||||
instructions. To look in more places, edit `./pyassimp/helper.py`.
|
||||
There's an `additional_dirs` list waiting for your entries.
|
96
thirdparty/assimp/port/PyAssimp/README.rst
vendored
96
thirdparty/assimp/port/PyAssimp/README.rst
vendored
@ -1,96 +0,0 @@
|
||||
PyAssimp: Python bindings for libassimp
|
||||
=======================================
|
||||
|
||||
A simple Python wrapper for Assimp using ``ctypes`` to access the
|
||||
library. Requires Python >= 2.6.
|
||||
|
||||
Python 3 support is mostly here, but not well tested.
|
||||
|
||||
Note that pyassimp is not complete. Many ASSIMP features are missing.
|
||||
|
||||
USAGE
|
||||
-----
|
||||
|
||||
Complete example: 3D viewer
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
``pyassimp`` comes with a simple 3D viewer that shows how to load and
|
||||
display a 3D model using a shader-based OpenGL pipeline.
|
||||
|
||||
.. figure:: 3d_viewer_screenshot.png
|
||||
:alt: Screenshot
|
||||
|
||||
Screenshot
|
||||
|
||||
To use it, from within ``/port/PyAssimp``:
|
||||
|
||||
::
|
||||
|
||||
$ cd scripts
|
||||
$ python ./3D-viewer <path to your model>
|
||||
|
||||
You can use this code as starting point in your applications.
|
||||
|
||||
Writing your own code
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To get started with ``pyassimp``, examine the simpler ``sample.py``
|
||||
script in ``scripts/``, which illustrates the basic usage. All Assimp
|
||||
data structures are wrapped using ``ctypes``. All the data+length fields
|
||||
in Assimp's data structures (such as ``aiMesh::mNumVertices``,
|
||||
``aiMesh::mVertices``) are replaced by simple python lists, so you can
|
||||
call ``len()`` on them to get their respective size and access members
|
||||
using ``[]``.
|
||||
|
||||
For example, to load a file named ``hello.3ds`` and print the first
|
||||
vertex of the first mesh, you would do (proper error handling
|
||||
substituted by assertions ...):
|
||||
|
||||
.. code:: python
|
||||
|
||||
|
||||
from pyassimp import *
|
||||
scene = load('hello.3ds')
|
||||
|
||||
assert len(scene.meshes)
|
||||
mesh = scene.meshes[0]
|
||||
|
||||
assert len(mesh.vertices)
|
||||
print(mesh.vertices[0])
|
||||
|
||||
# don't forget this one, or you will leak!
|
||||
release(scene)
|
||||
|
||||
Another example to list the 'top nodes' in a scene:
|
||||
|
||||
.. code:: python
|
||||
|
||||
|
||||
from pyassimp import *
|
||||
scene = load('hello.3ds')
|
||||
|
||||
for c in scene.rootnode.children:
|
||||
print(str(c))
|
||||
|
||||
release(scene)
|
||||
|
||||
INSTALL
|
||||
-------
|
||||
|
||||
Install ``pyassimp`` by running:
|
||||
|
||||
::
|
||||
|
||||
$ python setup.py install
|
||||
|
||||
PyAssimp requires a assimp dynamic library (``DLL`` on windows, ``.so``
|
||||
on linux, ``.dynlib`` on macOS) in order to work. The default search
|
||||
directories are:
|
||||
|
||||
- the current directory
|
||||
- on linux additionally: ``/usr/lib``, ``/usr/local/lib``,
|
||||
``/usr/lib/x86_64-linux-gnu``
|
||||
|
||||
To build that library, refer to the Assimp master ``INSTALL``
|
||||
instructions. To look in more places, edit ``./pyassimp/helper.py``.
|
||||
There's an ``additional_dirs`` list waiting for your entries.
|
@ -1,96 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- Coding: UTF-8 -*-
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Open Asset Import Library (ASSIMP)
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this software in source and binary forms,
|
||||
# with or without modification, are permitted provided that the following
|
||||
# conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# * Neither the name of the ASSIMP team, nor the names of its
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior
|
||||
# written permission of the ASSIMP Development Team.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
"""Update PyAssimp's texture type constants C/C++ headers.
|
||||
|
||||
This script is meant to be executed in the source tree, directly from
|
||||
port/PyAssimp/gen
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
REenumTextureType = re.compile(r''
|
||||
r'enum\saiTextureType' # enum aiTextureType
|
||||
r'[^{]*?\{' # {
|
||||
r'(?P<code>.*?)' # code
|
||||
r'\};' # };
|
||||
, re.IGNORECASE + re.DOTALL + re.MULTILINE)
|
||||
|
||||
# Replace comments
|
||||
RErpcom = re.compile(r''
|
||||
r'\s*(/\*+\s|\*+/|\B\*\s?|///?!?)' # /**
|
||||
r'(?P<line>.*?)' # * line
|
||||
, re.IGNORECASE + re.DOTALL)
|
||||
|
||||
# Remove trailing commas
|
||||
RErmtrailcom = re.compile(r',$', re.IGNORECASE + re.DOTALL)
|
||||
|
||||
# Remove #ifdef __cplusplus
|
||||
RErmifdef = re.compile(r''
|
||||
r'#ifndef SWIG' # #ifndef SWIG
|
||||
r'(?P<code>.*)' # code
|
||||
r'#endif(\s*//\s*!?\s*SWIG)*' # #endif
|
||||
, re.IGNORECASE + re.DOTALL)
|
||||
|
||||
path = '../../../include/assimp'
|
||||
|
||||
files = os.listdir (path)
|
||||
enumText = ''
|
||||
for fileName in files:
|
||||
if fileName.endswith('.h'):
|
||||
text = open(os.path.join(path, fileName)).read()
|
||||
for enum in REenumTextureType.findall(text):
|
||||
enumText = enum
|
||||
|
||||
text = ''
|
||||
for line in enumText.split('\n'):
|
||||
line = line.lstrip().rstrip()
|
||||
line = RErmtrailcom.sub('', line)
|
||||
text += RErpcom.sub('# \g<line>', line) + '\n'
|
||||
text = RErmifdef.sub('', text)
|
||||
|
||||
file = open('material.py', 'w')
|
||||
file.write(text)
|
||||
file.close()
|
||||
|
||||
print("Generation done. You can now review the file 'material.py' and merge it.")
|
290
thirdparty/assimp/port/PyAssimp/gen/structsgen.py
vendored
290
thirdparty/assimp/port/PyAssimp/gen/structsgen.py
vendored
@ -1,290 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- Coding: UTF-8 -*-
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Open Asset Import Library (ASSIMP)
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this software in source and binary forms,
|
||||
# with or without modification, are permitted provided that the following
|
||||
# conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# * Neither the name of the ASSIMP team, nor the names of its
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior
|
||||
# written permission of the ASSIMP Development Team.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
"""Update PyAssimp's data structures to keep up with the
|
||||
C/C++ headers.
|
||||
|
||||
This script is meant to be executed in the source tree, directly from
|
||||
port/PyAssimp/gen
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
#==[regexps]=================================================
|
||||
|
||||
# Clean desc
|
||||
REdefine = re.compile(r''
|
||||
r'(?P<desc>)' # /** *desc */
|
||||
r'#\s*define\s(?P<name>[^(\n]+?)\s(?P<code>.+)$' # #define name value
|
||||
, re.MULTILINE)
|
||||
|
||||
# Get structs
|
||||
REstructs = re.compile(r''
|
||||
#r'//\s?[\-]*\s(?P<desc>.*?)\*/\s' # /** *desc */
|
||||
#r'//\s?[\-]*(?P<desc>.*?)\*/(?:.*?)' # garbage
|
||||
r'//\s?[\-]*\s(?P<desc>.*?)\*/\W*?' # /** *desc */
|
||||
r'struct\s(?:ASSIMP_API\s)?(?P<name>[a-z][a-z0-9_]\w+\b)' # struct name
|
||||
r'[^{]*?\{' # {
|
||||
r'(?P<code>.*?)' # code
|
||||
r'\}\s*(PACK_STRUCT)?;' # };
|
||||
, re.IGNORECASE + re.DOTALL + re.MULTILINE)
|
||||
|
||||
# Clean desc
|
||||
REdesc = re.compile(r''
|
||||
r'^\s*?([*]|/\*\*)(?P<line>.*?)' # * line
|
||||
, re.IGNORECASE + re.DOTALL + re.MULTILINE)
|
||||
|
||||
# Remove #ifdef __cplusplus
|
||||
RErmifdef = re.compile(r''
|
||||
r'#ifdef __cplusplus' # #ifdef __cplusplus
|
||||
r'(?P<code>.*)' # code
|
||||
r'#endif(\s*//\s*!?\s*__cplusplus)*' # #endif
|
||||
, re.IGNORECASE + re.DOTALL)
|
||||
|
||||
# Replace comments
|
||||
RErpcom = re.compile(r''
|
||||
r'\s*(/\*+\s|\*+/|\B\*\s|///?!?)' # /**
|
||||
r'(?P<line>.*?)' # * line
|
||||
, re.IGNORECASE + re.DOTALL)
|
||||
|
||||
# Restructure
|
||||
def GetType(type, prefix='c_'):
|
||||
t = type
|
||||
while t.endswith('*'):
|
||||
t = t[:-1]
|
||||
if t[:5] == 'const':
|
||||
t = t[5:]
|
||||
|
||||
# skip some types
|
||||
if t in skiplist:
|
||||
return None
|
||||
|
||||
t = t.strip()
|
||||
types = {'unsigned int':'uint', 'unsigned char':'ubyte',}
|
||||
if t in types:
|
||||
t = types[t]
|
||||
t = prefix + t
|
||||
while type.endswith('*'):
|
||||
t = "POINTER(" + t + ")"
|
||||
type = type[:-1]
|
||||
return t
|
||||
|
||||
def restructure( match ):
|
||||
type = match.group("type")
|
||||
if match.group("struct") == "":
|
||||
type = GetType(type)
|
||||
elif match.group("struct") == "C_ENUM ":
|
||||
type = "c_uint"
|
||||
else:
|
||||
type = GetType(type[2:], '')
|
||||
if type is None:
|
||||
return ''
|
||||
if match.group("index"):
|
||||
type = type + "*" + match.group("index")
|
||||
|
||||
result = ""
|
||||
for name in match.group("name").split(','):
|
||||
result += "(\"" + name.strip() + "\", "+ type + "),"
|
||||
|
||||
return result
|
||||
|
||||
RErestruc = re.compile(r''
|
||||
r'(?P<struct>C_STRUCT\s|C_ENUM\s|)' # [C_STRUCT]
|
||||
r'(?P<type>\w+\s?\w+?[*]*)\s' # type
|
||||
#r'(?P<name>\w+)' # name
|
||||
r'(?P<name>\w+|[a-z0-9_, ]+)' # name
|
||||
r'(:?\[(?P<index>\w+)\])?;' # []; (optional)
|
||||
, re.DOTALL)
|
||||
#==[template]================================================
|
||||
template = """
|
||||
class $NAME$(Structure):
|
||||
\"\"\"
|
||||
$DESCRIPTION$
|
||||
\"\"\"
|
||||
$DEFINES$
|
||||
_fields_ = [
|
||||
$FIELDS$
|
||||
]
|
||||
"""
|
||||
|
||||
templateSR = """
|
||||
class $NAME$(Structure):
|
||||
\"\"\"
|
||||
$DESCRIPTION$
|
||||
\"\"\"
|
||||
$DEFINES$
|
||||
|
||||
$NAME$._fields_ = [
|
||||
$FIELDS$
|
||||
]
|
||||
"""
|
||||
|
||||
skiplist = ("FileIO", "File", "locateFromAssimpHeap",'LogStream','MeshAnim','AnimMesh')
|
||||
|
||||
#============================================================
|
||||
def Structify(fileName):
|
||||
file = open(fileName, 'r')
|
||||
text = file.read()
|
||||
result = []
|
||||
|
||||
# Get defines.
|
||||
defs = REdefine.findall(text)
|
||||
# Create defines
|
||||
defines = "\n"
|
||||
for define in defs:
|
||||
# Clean desc
|
||||
desc = REdesc.sub('', define[0])
|
||||
# Replace comments
|
||||
desc = RErpcom.sub('#\g<line>', desc)
|
||||
defines += desc
|
||||
if len(define[2].strip()):
|
||||
# skip non-integral defines, we can support them right now
|
||||
try:
|
||||
int(define[2],0)
|
||||
except:
|
||||
continue
|
||||
defines += " "*4 + define[1] + " = " + define[2] + "\n"
|
||||
|
||||
|
||||
# Get structs
|
||||
rs = REstructs.finditer(text)
|
||||
|
||||
fileName = os.path.basename(fileName)
|
||||
print fileName
|
||||
for r in rs:
|
||||
name = r.group('name')[2:]
|
||||
desc = r.group('desc')
|
||||
|
||||
# Skip some structs
|
||||
if name in skiplist:
|
||||
continue
|
||||
|
||||
text = r.group('code')
|
||||
|
||||
# Clean desc
|
||||
desc = REdesc.sub('', desc)
|
||||
|
||||
desc = "See '"+ fileName +"' for details." #TODO
|
||||
|
||||
# Remove #ifdef __cplusplus
|
||||
text = RErmifdef.sub('', text)
|
||||
|
||||
# Whether the struct contains more than just POD
|
||||
primitive = text.find('C_STRUCT') == -1
|
||||
|
||||
# Restructure
|
||||
text = RErestruc.sub(restructure, text)
|
||||
# Replace comments
|
||||
text = RErpcom.sub('# \g<line>', text)
|
||||
text = text.replace("),#", "),\n#")
|
||||
text = text.replace("#", "\n#")
|
||||
text = "".join([l for l in text.splitlines(True) if not l.strip().endswith("#")]) # remove empty comment lines
|
||||
|
||||
# Whether it's selfreferencing: ex. struct Node { Node* parent; };
|
||||
selfreferencing = text.find('POINTER('+name+')') != -1
|
||||
|
||||
complex = name == "Scene"
|
||||
|
||||
# Create description
|
||||
description = ""
|
||||
for line in desc.split('\n'):
|
||||
description += " "*4 + line.strip() + "\n"
|
||||
description = description.rstrip()
|
||||
|
||||
# Create fields
|
||||
fields = ""
|
||||
for line in text.split('\n'):
|
||||
fields += " "*12 + line.strip() + "\n"
|
||||
fields = fields.strip()
|
||||
|
||||
if selfreferencing:
|
||||
templ = templateSR
|
||||
else:
|
||||
templ = template
|
||||
|
||||
# Put it all together
|
||||
text = templ.replace('$NAME$', name)
|
||||
text = text.replace('$DESCRIPTION$', description)
|
||||
text = text.replace('$FIELDS$', fields)
|
||||
|
||||
if ((name.lower() == fileName.split('.')[0][2:].lower()) and (name != 'Material')) or name == "String":
|
||||
text = text.replace('$DEFINES$', defines)
|
||||
else:
|
||||
text = text.replace('$DEFINES$', '')
|
||||
|
||||
|
||||
result.append((primitive, selfreferencing, complex, text))
|
||||
|
||||
return result
|
||||
|
||||
text = "#-*- coding: UTF-8 -*-\n\n"
|
||||
text += "from ctypes import POINTER, c_int, c_uint, c_size_t, c_char, c_float, Structure, c_char_p, c_double, c_ubyte\n\n"
|
||||
|
||||
structs1 = ""
|
||||
structs2 = ""
|
||||
structs3 = ""
|
||||
structs4 = ""
|
||||
|
||||
path = '../../../include/assimp'
|
||||
files = os.listdir (path)
|
||||
#files = ["aiScene.h", "aiTypes.h"]
|
||||
for fileName in files:
|
||||
if fileName.endswith('.h'):
|
||||
for struct in Structify(os.path.join(path, fileName)):
|
||||
primitive, sr, complex, struct = struct
|
||||
if primitive:
|
||||
structs1 += struct
|
||||
elif sr:
|
||||
structs2 += struct
|
||||
elif complex:
|
||||
structs4 += struct
|
||||
else:
|
||||
structs3 += struct
|
||||
|
||||
text += structs1 + structs2 + structs3 + structs4
|
||||
|
||||
file = open('structs.py', 'w')
|
||||
file.write(text)
|
||||
file.close()
|
||||
|
||||
print("Generation done. You can now review the file 'structs.py' and merge it.")
|
@ -1 +0,0 @@
|
||||
from .core import *
|
546
thirdparty/assimp/port/PyAssimp/pyassimp/core.py
vendored
546
thirdparty/assimp/port/PyAssimp/pyassimp/core.py
vendored
@ -1,546 +0,0 @@
|
||||
"""
|
||||
PyAssimp
|
||||
|
||||
This is the main-module of PyAssimp.
|
||||
"""
|
||||
|
||||
import sys
|
||||
if sys.version_info < (2,6):
|
||||
raise RuntimeError('pyassimp: need python 2.6 or newer')
|
||||
|
||||
# xrange was renamed range in Python 3 and the original range from Python 2 was removed.
|
||||
# To keep compatibility with both Python 2 and 3, xrange is set to range for version 3.0 and up.
|
||||
if sys.version_info >= (3,0):
|
||||
xrange = range
|
||||
|
||||
|
||||
try: import numpy
|
||||
except ImportError: numpy = None
|
||||
import logging
|
||||
import ctypes
|
||||
logger = logging.getLogger("pyassimp")
|
||||
# attach default null handler to logger so it doesn't complain
|
||||
# even if you don't attach another handler to logger
|
||||
logger.addHandler(logging.NullHandler())
|
||||
|
||||
from . import structs
|
||||
from . import helper
|
||||
from . import postprocess
|
||||
from .errors import AssimpError
|
||||
|
||||
class AssimpLib(object):
|
||||
"""
|
||||
Assimp-Singleton
|
||||
"""
|
||||
load, load_mem, export, export_blob, release, dll = helper.search_library()
|
||||
_assimp_lib = AssimpLib()
|
||||
|
||||
def make_tuple(ai_obj, type = None):
|
||||
res = None
|
||||
|
||||
#notes:
|
||||
# ai_obj._fields_ = [ ("attr", c_type), ... ]
|
||||
# getattr(ai_obj, e[0]).__class__ == float
|
||||
|
||||
if isinstance(ai_obj, structs.Matrix4x4):
|
||||
if numpy:
|
||||
res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]).reshape((4,4))
|
||||
#import pdb;pdb.set_trace()
|
||||
else:
|
||||
res = [getattr(ai_obj, e[0]) for e in ai_obj._fields_]
|
||||
res = [res[i:i+4] for i in xrange(0,16,4)]
|
||||
elif isinstance(ai_obj, structs.Matrix3x3):
|
||||
if numpy:
|
||||
res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]).reshape((3,3))
|
||||
else:
|
||||
res = [getattr(ai_obj, e[0]) for e in ai_obj._fields_]
|
||||
res = [res[i:i+3] for i in xrange(0,9,3)]
|
||||
else:
|
||||
if numpy:
|
||||
res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_])
|
||||
else:
|
||||
res = [getattr(ai_obj, e[0]) for e in ai_obj._fields_]
|
||||
|
||||
return res
|
||||
|
||||
# Returns unicode object for Python 2, and str object for Python 3.
|
||||
def _convert_assimp_string(assimp_string):
|
||||
if sys.version_info >= (3, 0):
|
||||
return str(assimp_string.data, errors='ignore')
|
||||
else:
|
||||
return unicode(assimp_string.data, errors='ignore')
|
||||
|
||||
# It is faster and more correct to have an init function for each assimp class
|
||||
def _init_face(aiFace):
|
||||
aiFace.indices = [aiFace.mIndices[i] for i in range(aiFace.mNumIndices)]
|
||||
assimp_struct_inits = { structs.Face : _init_face }
|
||||
|
||||
def call_init(obj, caller = None):
|
||||
if helper.hasattr_silent(obj,'contents'): #pointer
|
||||
_init(obj.contents, obj, caller)
|
||||
else:
|
||||
_init(obj,parent=caller)
|
||||
|
||||
def _is_init_type(obj):
|
||||
|
||||
if obj and helper.hasattr_silent(obj,'contents'): #pointer
|
||||
return _is_init_type(obj[0])
|
||||
# null-pointer case that arises when we reach a mesh attribute
|
||||
# like mBitangents which use mNumVertices rather than mNumBitangents
|
||||
# so it breaks the 'is iterable' check.
|
||||
# Basically:
|
||||
# FIXME!
|
||||
elif not bool(obj):
|
||||
return False
|
||||
tname = obj.__class__.__name__
|
||||
return not (tname[:2] == 'c_' or tname == 'Structure' \
|
||||
or tname == 'POINTER') and not isinstance(obj, (int, str, bytes))
|
||||
|
||||
def _init(self, target = None, parent = None):
|
||||
"""
|
||||
Custom initialize() for C structs, adds safely accessible member functionality.
|
||||
|
||||
:param target: set the object which receive the added methods. Useful when manipulating
|
||||
pointers, to skip the intermediate 'contents' deferencing.
|
||||
"""
|
||||
if not target:
|
||||
target = self
|
||||
|
||||
dirself = dir(self)
|
||||
for m in dirself:
|
||||
|
||||
if m.startswith("_"):
|
||||
continue
|
||||
|
||||
if m.startswith('mNum'):
|
||||
if 'm' + m[4:] in dirself:
|
||||
continue # will be processed later on
|
||||
else:
|
||||
name = m[1:].lower()
|
||||
|
||||
obj = getattr(self, m)
|
||||
setattr(target, name, obj)
|
||||
continue
|
||||
|
||||
if m == 'mName':
|
||||
target.name = str(_convert_assimp_string(self.mName))
|
||||
target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + getattr(x, 'name','') + ")"
|
||||
target.__class__.__str__ = lambda x: getattr(x, 'name', '')
|
||||
continue
|
||||
|
||||
name = m[1:].lower()
|
||||
|
||||
obj = getattr(self, m)
|
||||
|
||||
# Create tuples
|
||||
if isinstance(obj, structs.assimp_structs_as_tuple):
|
||||
setattr(target, name, make_tuple(obj))
|
||||
logger.debug(str(self) + ": Added array " + str(getattr(target, name)) + " as self." + name.lower())
|
||||
continue
|
||||
|
||||
if m.startswith('m'):
|
||||
|
||||
if name == "parent":
|
||||
setattr(target, name, parent)
|
||||
logger.debug("Added a parent as self." + name)
|
||||
continue
|
||||
|
||||
if helper.hasattr_silent(self, 'mNum' + m[1:]):
|
||||
|
||||
length = getattr(self, 'mNum' + m[1:])
|
||||
|
||||
# -> special case: properties are
|
||||
# stored as a dict.
|
||||
if m == 'mProperties':
|
||||
setattr(target, name, _get_properties(obj, length))
|
||||
continue
|
||||
|
||||
|
||||
if not length: # empty!
|
||||
setattr(target, name, [])
|
||||
logger.debug(str(self) + ": " + name + " is an empty list.")
|
||||
continue
|
||||
|
||||
|
||||
try:
|
||||
if obj._type_ in structs.assimp_structs_as_tuple:
|
||||
if numpy:
|
||||
setattr(target, name, numpy.array([make_tuple(obj[i]) for i in range(length)], dtype=numpy.float32))
|
||||
|
||||
logger.debug(str(self) + ": Added an array of numpy arrays (type "+ str(type(obj)) + ") as self." + name)
|
||||
else:
|
||||
setattr(target, name, [make_tuple(obj[i]) for i in range(length)])
|
||||
|
||||
logger.debug(str(self) + ": Added a list of lists (type "+ str(type(obj)) + ") as self." + name)
|
||||
|
||||
else:
|
||||
setattr(target, name, [obj[i] for i in range(length)]) #TODO: maybe not necessary to recreate an array?
|
||||
|
||||
logger.debug(str(self) + ": Added list of " + str(obj) + " " + name + " as self." + name + " (type: " + str(type(obj)) + ")")
|
||||
|
||||
# initialize array elements
|
||||
try:
|
||||
init = assimp_struct_inits[type(obj[0])]
|
||||
except KeyError:
|
||||
if _is_init_type(obj[0]):
|
||||
for e in getattr(target, name):
|
||||
call_init(e, target)
|
||||
else:
|
||||
for e in getattr(target, name):
|
||||
init(e)
|
||||
|
||||
|
||||
except IndexError:
|
||||
logger.error("in " + str(self) +" : mismatch between mNum" + name + " and the actual amount of data in m" + name + ". This may be due to version mismatch between libassimp and pyassimp. Quitting now.")
|
||||
sys.exit(1)
|
||||
|
||||
except ValueError as e:
|
||||
|
||||
logger.error("In " + str(self) + "->" + name + ": " + str(e) + ". Quitting now.")
|
||||
if "setting an array element with a sequence" in str(e):
|
||||
logger.error("Note that pyassimp does not currently "
|
||||
"support meshes with mixed triangles "
|
||||
"and quads. Try to load your mesh with"
|
||||
" a post-processing to triangulate your"
|
||||
" faces.")
|
||||
raise e
|
||||
|
||||
|
||||
|
||||
else: # starts with 'm' but not iterable
|
||||
setattr(target, name, obj)
|
||||
logger.debug("Added " + name + " as self." + name + " (type: " + str(type(obj)) + ")")
|
||||
|
||||
if _is_init_type(obj):
|
||||
call_init(obj, target)
|
||||
|
||||
if isinstance(self, structs.Mesh):
|
||||
_finalize_mesh(self, target)
|
||||
|
||||
if isinstance(self, structs.Texture):
|
||||
_finalize_texture(self, target)
|
||||
|
||||
if isinstance(self, structs.Metadata):
|
||||
_finalize_metadata(self, target)
|
||||
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def pythonize_assimp(type, obj, scene):
|
||||
""" This method modify the Assimp data structures
|
||||
to make them easier to work with in Python.
|
||||
|
||||
Supported operations:
|
||||
- MESH: replace a list of mesh IDs by reference to these meshes
|
||||
- ADDTRANSFORMATION: add a reference to an object's transformation taken from their associated node.
|
||||
|
||||
:param type: the type of modification to operate (cf above)
|
||||
:param obj: the input object to modify
|
||||
:param scene: a reference to the whole scene
|
||||
"""
|
||||
|
||||
if type == "MESH":
|
||||
meshes = []
|
||||
for i in obj:
|
||||
meshes.append(scene.meshes[i])
|
||||
return meshes
|
||||
|
||||
if type == "ADDTRANSFORMATION":
|
||||
def getnode(node, name):
|
||||
if node.name == name: return node
|
||||
for child in node.children:
|
||||
n = getnode(child, name)
|
||||
if n: return n
|
||||
|
||||
node = getnode(scene.rootnode, obj.name)
|
||||
if not node:
|
||||
raise AssimpError("Object " + str(obj) + " has no associated node!")
|
||||
setattr(obj, "transformation", node.transformation)
|
||||
|
||||
def recur_pythonize(node, scene):
|
||||
'''
|
||||
Recursively call pythonize_assimp on
|
||||
nodes tree to apply several post-processing to
|
||||
pythonize the assimp datastructures.
|
||||
'''
|
||||
node.meshes = pythonize_assimp("MESH", node.meshes, scene)
|
||||
for mesh in node.meshes:
|
||||
mesh.material = scene.materials[mesh.materialindex]
|
||||
for cam in scene.cameras:
|
||||
pythonize_assimp("ADDTRANSFORMATION", cam, scene)
|
||||
for c in node.children:
|
||||
recur_pythonize(c, scene)
|
||||
|
||||
def load(filename,
|
||||
file_type = None,
|
||||
processing = postprocess.aiProcess_Triangulate):
|
||||
'''
|
||||
Load a model into a scene. On failure throws AssimpError.
|
||||
|
||||
Arguments
|
||||
---------
|
||||
filename: Either a filename or a file object to load model from.
|
||||
If a file object is passed, file_type MUST be specified
|
||||
Otherwise Assimp has no idea which importer to use.
|
||||
This is named 'filename' so as to not break legacy code.
|
||||
processing: assimp postprocessing parameters. Verbose keywords are imported
|
||||
from postprocessing, and the parameters can be combined bitwise to
|
||||
generate the final processing value. Note that the default value will
|
||||
triangulate quad faces. Example of generating other possible values:
|
||||
processing = (pyassimp.postprocess.aiProcess_Triangulate |
|
||||
pyassimp.postprocess.aiProcess_OptimizeMeshes)
|
||||
file_type: string of file extension, such as 'stl'
|
||||
|
||||
Returns
|
||||
---------
|
||||
Scene object with model data
|
||||
'''
|
||||
|
||||
if hasattr(filename, 'read'):
|
||||
# This is the case where a file object has been passed to load.
|
||||
# It is calling the following function:
|
||||
# const aiScene* aiImportFileFromMemory(const char* pBuffer,
|
||||
# unsigned int pLength,
|
||||
# unsigned int pFlags,
|
||||
# const char* pHint)
|
||||
if file_type is None:
|
||||
raise AssimpError('File type must be specified when passing file objects!')
|
||||
data = filename.read()
|
||||
model = _assimp_lib.load_mem(data,
|
||||
len(data),
|
||||
processing,
|
||||
file_type)
|
||||
else:
|
||||
# a filename string has been passed
|
||||
model = _assimp_lib.load(filename.encode(sys.getfilesystemencoding()), processing)
|
||||
|
||||
if not model:
|
||||
raise AssimpError('Could not import file!')
|
||||
scene = _init(model.contents)
|
||||
recur_pythonize(scene.rootnode, scene)
|
||||
return scene
|
||||
|
||||
def export(scene,
|
||||
filename,
|
||||
file_type = None,
|
||||
processing = postprocess.aiProcess_Triangulate):
|
||||
'''
|
||||
Export a scene. On failure throws AssimpError.
|
||||
|
||||
Arguments
|
||||
---------
|
||||
scene: scene to export.
|
||||
filename: Filename that the scene should be exported to.
|
||||
file_type: string of file exporter to use. For example "collada".
|
||||
processing: assimp postprocessing parameters. Verbose keywords are imported
|
||||
from postprocessing, and the parameters can be combined bitwise to
|
||||
generate the final processing value. Note that the default value will
|
||||
triangulate quad faces. Example of generating other possible values:
|
||||
processing = (pyassimp.postprocess.aiProcess_Triangulate |
|
||||
pyassimp.postprocess.aiProcess_OptimizeMeshes)
|
||||
|
||||
'''
|
||||
|
||||
exportStatus = _assimp_lib.export(ctypes.pointer(scene), file_type.encode("ascii"), filename.encode(sys.getfilesystemencoding()), processing)
|
||||
|
||||
if exportStatus != 0:
|
||||
raise AssimpError('Could not export scene!')
|
||||
|
||||
def export_blob(scene,
|
||||
file_type = None,
|
||||
processing = postprocess.aiProcess_Triangulate):
|
||||
'''
|
||||
Export a scene and return a blob in the correct format. On failure throws AssimpError.
|
||||
|
||||
Arguments
|
||||
---------
|
||||
scene: scene to export.
|
||||
file_type: string of file exporter to use. For example "collada".
|
||||
processing: assimp postprocessing parameters. Verbose keywords are imported
|
||||
from postprocessing, and the parameters can be combined bitwise to
|
||||
generate the final processing value. Note that the default value will
|
||||
triangulate quad faces. Example of generating other possible values:
|
||||
processing = (pyassimp.postprocess.aiProcess_Triangulate |
|
||||
pyassimp.postprocess.aiProcess_OptimizeMeshes)
|
||||
Returns
|
||||
---------
|
||||
Pointer to structs.ExportDataBlob
|
||||
'''
|
||||
exportBlobPtr = _assimp_lib.export_blob(ctypes.pointer(scene), file_type.encode("ascii"), processing)
|
||||
|
||||
if exportBlobPtr == 0:
|
||||
raise AssimpError('Could not export scene to blob!')
|
||||
return exportBlobPtr
|
||||
|
||||
def release(scene):
|
||||
_assimp_lib.release(ctypes.pointer(scene))
|
||||
|
||||
def _finalize_texture(tex, target):
|
||||
setattr(target, "achformathint", tex.achFormatHint)
|
||||
if numpy:
|
||||
data = numpy.array([make_tuple(getattr(tex, "pcData")[i]) for i in range(tex.mWidth * tex.mHeight)])
|
||||
else:
|
||||
data = [make_tuple(getattr(tex, "pcData")[i]) for i in range(tex.mWidth * tex.mHeight)]
|
||||
setattr(target, "data", data)
|
||||
|
||||
def _finalize_mesh(mesh, target):
|
||||
""" Building of meshes is a bit specific.
|
||||
|
||||
We override here the various datasets that can
|
||||
not be process as regular fields.
|
||||
|
||||
For instance, the length of the normals array is
|
||||
mNumVertices (no mNumNormals is available)
|
||||
"""
|
||||
nb_vertices = getattr(mesh, "mNumVertices")
|
||||
|
||||
def fill(name):
|
||||
mAttr = getattr(mesh, name)
|
||||
if numpy:
|
||||
if mAttr:
|
||||
data = numpy.array([make_tuple(getattr(mesh, name)[i]) for i in range(nb_vertices)], dtype=numpy.float32)
|
||||
setattr(target, name[1:].lower(), data)
|
||||
else:
|
||||
setattr(target, name[1:].lower(), numpy.array([], dtype="float32"))
|
||||
else:
|
||||
if mAttr:
|
||||
data = [make_tuple(getattr(mesh, name)[i]) for i in range(nb_vertices)]
|
||||
setattr(target, name[1:].lower(), data)
|
||||
else:
|
||||
setattr(target, name[1:].lower(), [])
|
||||
|
||||
def fillarray(name):
|
||||
mAttr = getattr(mesh, name)
|
||||
|
||||
data = []
|
||||
for index, mSubAttr in enumerate(mAttr):
|
||||
if mSubAttr:
|
||||
data.append([make_tuple(getattr(mesh, name)[index][i]) for i in range(nb_vertices)])
|
||||
|
||||
if numpy:
|
||||
setattr(target, name[1:].lower(), numpy.array(data, dtype=numpy.float32))
|
||||
else:
|
||||
setattr(target, name[1:].lower(), data)
|
||||
|
||||
fill("mNormals")
|
||||
fill("mTangents")
|
||||
fill("mBitangents")
|
||||
|
||||
fillarray("mColors")
|
||||
fillarray("mTextureCoords")
|
||||
|
||||
# prepare faces
|
||||
if numpy:
|
||||
faces = numpy.array([f.indices for f in target.faces], dtype=numpy.int32)
|
||||
else:
|
||||
faces = [f.indices for f in target.faces]
|
||||
setattr(target, 'faces', faces)
|
||||
|
||||
def _init_metadata_entry(entry):
|
||||
entry.type = entry.mType
|
||||
if entry.type == structs.MetadataEntry.AI_BOOL:
|
||||
entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_bool)).contents.value
|
||||
elif entry.type == structs.MetadataEntry.AI_INT32:
|
||||
entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_int32)).contents.value
|
||||
elif entry.type == structs.MetadataEntry.AI_UINT64:
|
||||
entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_uint64)).contents.value
|
||||
elif entry.type == structs.MetadataEntry.AI_FLOAT:
|
||||
entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_float)).contents.value
|
||||
elif entry.type == structs.MetadataEntry.AI_DOUBLE:
|
||||
entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_double)).contents.value
|
||||
elif entry.type == structs.MetadataEntry.AI_AISTRING:
|
||||
assimp_string = ctypes.cast(entry.mData, ctypes.POINTER(structs.String)).contents
|
||||
entry.data = _convert_assimp_string(assimp_string)
|
||||
elif entry.type == structs.MetadataEntry.AI_AIVECTOR3D:
|
||||
assimp_vector = ctypes.cast(entry.mData, ctypes.POINTER(structs.Vector3D)).contents
|
||||
entry.data = make_tuple(assimp_vector)
|
||||
|
||||
return entry
|
||||
|
||||
def _finalize_metadata(metadata, target):
|
||||
""" Building the metadata object is a bit specific.
|
||||
|
||||
Firstly, there are two separate arrays: one with metadata keys and one
|
||||
with metadata values, and there are no corresponding mNum* attributes,
|
||||
so the C arrays are not converted to Python arrays using the generic
|
||||
code in the _init function.
|
||||
|
||||
Secondly, a metadata entry value has to be cast according to declared
|
||||
metadata entry type.
|
||||
"""
|
||||
length = metadata.mNumProperties
|
||||
setattr(target, 'keys', [str(_convert_assimp_string(metadata.mKeys[i])) for i in range(length)])
|
||||
setattr(target, 'values', [_init_metadata_entry(metadata.mValues[i]) for i in range(length)])
|
||||
|
||||
class PropertyGetter(dict):
|
||||
def __getitem__(self, key):
|
||||
semantic = 0
|
||||
if isinstance(key, tuple):
|
||||
key, semantic = key
|
||||
|
||||
return dict.__getitem__(self, (key, semantic))
|
||||
|
||||
def keys(self):
|
||||
for k in dict.keys(self):
|
||||
yield k[0]
|
||||
|
||||
def __iter__(self):
|
||||
return self.keys()
|
||||
|
||||
def items(self):
|
||||
for k, v in dict.items(self):
|
||||
yield k[0], v
|
||||
|
||||
|
||||
def _get_properties(properties, length):
|
||||
"""
|
||||
Convenience Function to get the material properties as a dict
|
||||
and values in a python format.
|
||||
"""
|
||||
result = {}
|
||||
#read all properties
|
||||
for p in [properties[i] for i in range(length)]:
|
||||
#the name
|
||||
p = p.contents
|
||||
key = str(_convert_assimp_string(p.mKey))
|
||||
key = (key.split('.')[1], p.mSemantic)
|
||||
|
||||
#the data
|
||||
if p.mType == 1:
|
||||
arr = ctypes.cast(p.mData,
|
||||
ctypes.POINTER(ctypes.c_float * int(p.mDataLength/ctypes.sizeof(ctypes.c_float)))
|
||||
).contents
|
||||
value = [x for x in arr]
|
||||
elif p.mType == 3: #string can't be an array
|
||||
value = _convert_assimp_string(ctypes.cast(p.mData, ctypes.POINTER(structs.MaterialPropertyString)).contents)
|
||||
|
||||
elif p.mType == 4:
|
||||
arr = ctypes.cast(p.mData,
|
||||
ctypes.POINTER(ctypes.c_int * int(p.mDataLength/ctypes.sizeof(ctypes.c_int)))
|
||||
).contents
|
||||
value = [x for x in arr]
|
||||
else:
|
||||
value = p.mData[:p.mDataLength]
|
||||
|
||||
if len(value) == 1:
|
||||
[value] = value
|
||||
|
||||
result[key] = value
|
||||
|
||||
return PropertyGetter(result)
|
||||
|
||||
def decompose_matrix(matrix):
|
||||
if not isinstance(matrix, structs.Matrix4x4):
|
||||
raise AssimpError("pyassimp.decompose_matrix failed: Not a Matrix4x4!")
|
||||
|
||||
scaling = structs.Vector3D()
|
||||
rotation = structs.Quaternion()
|
||||
position = structs.Vector3D()
|
||||
|
||||
_assimp_lib.dll.aiDecomposeMatrix(ctypes.pointer(matrix),
|
||||
ctypes.byref(scaling),
|
||||
ctypes.byref(rotation),
|
||||
ctypes.byref(position))
|
||||
return scaling._init(), rotation._init(), position._init()
|
||||
|
@ -1,11 +0,0 @@
|
||||
#-*- coding: UTF-8 -*-
|
||||
|
||||
"""
|
||||
All possible errors.
|
||||
"""
|
||||
|
||||
class AssimpError(BaseException):
|
||||
"""
|
||||
If an internal error occurs.
|
||||
"""
|
||||
pass
|
@ -1,41 +0,0 @@
|
||||
FORMATS = ["CSM",
|
||||
"LWS",
|
||||
"B3D",
|
||||
"COB",
|
||||
"PLY",
|
||||
"IFC",
|
||||
"OFF",
|
||||
"SMD",
|
||||
"IRRMESH",
|
||||
"3D",
|
||||
"DAE",
|
||||
"MDL",
|
||||
"HMP",
|
||||
"TER",
|
||||
"WRL",
|
||||
"XML",
|
||||
"NFF",
|
||||
"AC",
|
||||
"OBJ",
|
||||
"3DS",
|
||||
"STL",
|
||||
"IRR",
|
||||
"Q3O",
|
||||
"Q3D",
|
||||
"MS3D",
|
||||
"Q3S",
|
||||
"ZGL",
|
||||
"MD2",
|
||||
"X",
|
||||
"BLEND",
|
||||
"XGL",
|
||||
"MD5MESH",
|
||||
"MAX",
|
||||
"LXO",
|
||||
"DXF",
|
||||
"BVH",
|
||||
"LWO",
|
||||
"NDO"]
|
||||
|
||||
def available_formats():
|
||||
return FORMATS
|
281
thirdparty/assimp/port/PyAssimp/pyassimp/helper.py
vendored
281
thirdparty/assimp/port/PyAssimp/pyassimp/helper.py
vendored
@ -1,281 +0,0 @@
|
||||
#-*- coding: UTF-8 -*-
|
||||
|
||||
"""
|
||||
Some fancy helper functions.
|
||||
"""
|
||||
|
||||
import os
|
||||
import ctypes
|
||||
import operator
|
||||
|
||||
from distutils.sysconfig import get_python_lib
|
||||
import re
|
||||
import sys
|
||||
|
||||
try: import numpy
|
||||
except ImportError: numpy = None
|
||||
|
||||
import logging;logger = logging.getLogger("pyassimp")
|
||||
|
||||
from .errors import AssimpError
|
||||
|
||||
additional_dirs, ext_whitelist = [],[]
|
||||
|
||||
# populate search directories and lists of allowed file extensions
|
||||
# depending on the platform we're running on.
|
||||
if os.name=='posix':
|
||||
additional_dirs.append('./')
|
||||
additional_dirs.append('/usr/lib/')
|
||||
additional_dirs.append('/usr/lib/x86_64-linux-gnu/')
|
||||
additional_dirs.append('/usr/local/lib/')
|
||||
|
||||
if 'LD_LIBRARY_PATH' in os.environ:
|
||||
additional_dirs.extend([item for item in os.environ['LD_LIBRARY_PATH'].split(':') if item])
|
||||
|
||||
# check if running from anaconda.
|
||||
if "conda" or "continuum" in sys.version.lower():
|
||||
cur_path = get_python_lib()
|
||||
pattern = re.compile('.*\/lib\/')
|
||||
conda_lib = pattern.match(cur_path).group()
|
||||
logger.info("Adding Anaconda lib path:"+ conda_lib)
|
||||
additional_dirs.append(conda_lib)
|
||||
|
||||
# note - this won't catch libassimp.so.N.n, but
|
||||
# currently there's always a symlink called
|
||||
# libassimp.so in /usr/local/lib.
|
||||
ext_whitelist.append('.so')
|
||||
# libassimp.dylib in /usr/local/lib
|
||||
ext_whitelist.append('.dylib')
|
||||
|
||||
elif os.name=='nt':
|
||||
ext_whitelist.append('.dll')
|
||||
path_dirs = os.environ['PATH'].split(';')
|
||||
additional_dirs.extend(path_dirs)
|
||||
|
||||
def vec2tuple(x):
|
||||
""" Converts a VECTOR3D to a Tuple """
|
||||
return (x.x, x.y, x.z)
|
||||
|
||||
def transform(vector3, matrix4x4):
|
||||
""" Apply a transformation matrix on a 3D vector.
|
||||
|
||||
:param vector3: array with 3 elements
|
||||
:param matrix4x4: 4x4 matrix
|
||||
"""
|
||||
if numpy:
|
||||
return numpy.dot(matrix4x4, numpy.append(vector3, 1.))
|
||||
else:
|
||||
m0,m1,m2,m3 = matrix4x4; x,y,z = vector3
|
||||
return [
|
||||
m0[0]*x + m0[1]*y + m0[2]*z + m0[3],
|
||||
m1[0]*x + m1[1]*y + m1[2]*z + m1[3],
|
||||
m2[0]*x + m2[1]*y + m2[2]*z + m2[3],
|
||||
m3[0]*x + m3[1]*y + m3[2]*z + m3[3]
|
||||
]
|
||||
|
||||
def _inv(matrix4x4):
|
||||
m0,m1,m2,m3 = matrix4x4
|
||||
|
||||
det = m0[3]*m1[2]*m2[1]*m3[0] - m0[2]*m1[3]*m2[1]*m3[0] - \
|
||||
m0[3]*m1[1]*m2[2]*m3[0] + m0[1]*m1[3]*m2[2]*m3[0] + \
|
||||
m0[2]*m1[1]*m2[3]*m3[0] - m0[1]*m1[2]*m2[3]*m3[0] - \
|
||||
m0[3]*m1[2]*m2[0]*m3[1] + m0[2]*m1[3]*m2[0]*m3[1] + \
|
||||
m0[3]*m1[0]*m2[2]*m3[1] - m0[0]*m1[3]*m2[2]*m3[1] - \
|
||||
m0[2]*m1[0]*m2[3]*m3[1] + m0[0]*m1[2]*m2[3]*m3[1] + \
|
||||
m0[3]*m1[1]*m2[0]*m3[2] - m0[1]*m1[3]*m2[0]*m3[2] - \
|
||||
m0[3]*m1[0]*m2[1]*m3[2] + m0[0]*m1[3]*m2[1]*m3[2] + \
|
||||
m0[1]*m1[0]*m2[3]*m3[2] - m0[0]*m1[1]*m2[3]*m3[2] - \
|
||||
m0[2]*m1[1]*m2[0]*m3[3] + m0[1]*m1[2]*m2[0]*m3[3] + \
|
||||
m0[2]*m1[0]*m2[1]*m3[3] - m0[0]*m1[2]*m2[1]*m3[3] - \
|
||||
m0[1]*m1[0]*m2[2]*m3[3] + m0[0]*m1[1]*m2[2]*m3[3]
|
||||
|
||||
return[[( m1[2]*m2[3]*m3[1] - m1[3]*m2[2]*m3[1] + m1[3]*m2[1]*m3[2] - m1[1]*m2[3]*m3[2] - m1[2]*m2[1]*m3[3] + m1[1]*m2[2]*m3[3]) /det,
|
||||
( m0[3]*m2[2]*m3[1] - m0[2]*m2[3]*m3[1] - m0[3]*m2[1]*m3[2] + m0[1]*m2[3]*m3[2] + m0[2]*m2[1]*m3[3] - m0[1]*m2[2]*m3[3]) /det,
|
||||
( m0[2]*m1[3]*m3[1] - m0[3]*m1[2]*m3[1] + m0[3]*m1[1]*m3[2] - m0[1]*m1[3]*m3[2] - m0[2]*m1[1]*m3[3] + m0[1]*m1[2]*m3[3]) /det,
|
||||
( m0[3]*m1[2]*m2[1] - m0[2]*m1[3]*m2[1] - m0[3]*m1[1]*m2[2] + m0[1]*m1[3]*m2[2] + m0[2]*m1[1]*m2[3] - m0[1]*m1[2]*m2[3]) /det],
|
||||
[( m1[3]*m2[2]*m3[0] - m1[2]*m2[3]*m3[0] - m1[3]*m2[0]*m3[2] + m1[0]*m2[3]*m3[2] + m1[2]*m2[0]*m3[3] - m1[0]*m2[2]*m3[3]) /det,
|
||||
( m0[2]*m2[3]*m3[0] - m0[3]*m2[2]*m3[0] + m0[3]*m2[0]*m3[2] - m0[0]*m2[3]*m3[2] - m0[2]*m2[0]*m3[3] + m0[0]*m2[2]*m3[3]) /det,
|
||||
( m0[3]*m1[2]*m3[0] - m0[2]*m1[3]*m3[0] - m0[3]*m1[0]*m3[2] + m0[0]*m1[3]*m3[2] + m0[2]*m1[0]*m3[3] - m0[0]*m1[2]*m3[3]) /det,
|
||||
( m0[2]*m1[3]*m2[0] - m0[3]*m1[2]*m2[0] + m0[3]*m1[0]*m2[2] - m0[0]*m1[3]*m2[2] - m0[2]*m1[0]*m2[3] + m0[0]*m1[2]*m2[3]) /det],
|
||||
[( m1[1]*m2[3]*m3[0] - m1[3]*m2[1]*m3[0] + m1[3]*m2[0]*m3[1] - m1[0]*m2[3]*m3[1] - m1[1]*m2[0]*m3[3] + m1[0]*m2[1]*m3[3]) /det,
|
||||
( m0[3]*m2[1]*m3[0] - m0[1]*m2[3]*m3[0] - m0[3]*m2[0]*m3[1] + m0[0]*m2[3]*m3[1] + m0[1]*m2[0]*m3[3] - m0[0]*m2[1]*m3[3]) /det,
|
||||
( m0[1]*m1[3]*m3[0] - m0[3]*m1[1]*m3[0] + m0[3]*m1[0]*m3[1] - m0[0]*m1[3]*m3[1] - m0[1]*m1[0]*m3[3] + m0[0]*m1[1]*m3[3]) /det,
|
||||
( m0[3]*m1[1]*m2[0] - m0[1]*m1[3]*m2[0] - m0[3]*m1[0]*m2[1] + m0[0]*m1[3]*m2[1] + m0[1]*m1[0]*m2[3] - m0[0]*m1[1]*m2[3]) /det],
|
||||
[( m1[2]*m2[1]*m3[0] - m1[1]*m2[2]*m3[0] - m1[2]*m2[0]*m3[1] + m1[0]*m2[2]*m3[1] + m1[1]*m2[0]*m3[2] - m1[0]*m2[1]*m3[2]) /det,
|
||||
( m0[1]*m2[2]*m3[0] - m0[2]*m2[1]*m3[0] + m0[2]*m2[0]*m3[1] - m0[0]*m2[2]*m3[1] - m0[1]*m2[0]*m3[2] + m0[0]*m2[1]*m3[2]) /det,
|
||||
( m0[2]*m1[1]*m3[0] - m0[1]*m1[2]*m3[0] - m0[2]*m1[0]*m3[1] + m0[0]*m1[2]*m3[1] + m0[1]*m1[0]*m3[2] - m0[0]*m1[1]*m3[2]) /det,
|
||||
( m0[1]*m1[2]*m2[0] - m0[2]*m1[1]*m2[0] + m0[2]*m1[0]*m2[1] - m0[0]*m1[2]*m2[1] - m0[1]*m1[0]*m2[2] + m0[0]*m1[1]*m2[2]) /det]]
|
||||
|
||||
def get_bounding_box(scene):
|
||||
bb_min = [1e10, 1e10, 1e10] # x,y,z
|
||||
bb_max = [-1e10, -1e10, -1e10] # x,y,z
|
||||
inv = numpy.linalg.inv if numpy else _inv
|
||||
return get_bounding_box_for_node(scene.rootnode, bb_min, bb_max, inv(scene.rootnode.transformation))
|
||||
|
||||
def get_bounding_box_for_node(node, bb_min, bb_max, transformation):
|
||||
|
||||
if numpy:
|
||||
transformation = numpy.dot(transformation, node.transformation)
|
||||
else:
|
||||
t0,t1,t2,t3 = transformation
|
||||
T0,T1,T2,T3 = node.transformation
|
||||
transformation = [ [
|
||||
t0[0]*T0[0] + t0[1]*T1[0] + t0[2]*T2[0] + t0[3]*T3[0],
|
||||
t0[0]*T0[1] + t0[1]*T1[1] + t0[2]*T2[1] + t0[3]*T3[1],
|
||||
t0[0]*T0[2] + t0[1]*T1[2] + t0[2]*T2[2] + t0[3]*T3[2],
|
||||
t0[0]*T0[3] + t0[1]*T1[3] + t0[2]*T2[3] + t0[3]*T3[3]
|
||||
],[
|
||||
t1[0]*T0[0] + t1[1]*T1[0] + t1[2]*T2[0] + t1[3]*T3[0],
|
||||
t1[0]*T0[1] + t1[1]*T1[1] + t1[2]*T2[1] + t1[3]*T3[1],
|
||||
t1[0]*T0[2] + t1[1]*T1[2] + t1[2]*T2[2] + t1[3]*T3[2],
|
||||
t1[0]*T0[3] + t1[1]*T1[3] + t1[2]*T2[3] + t1[3]*T3[3]
|
||||
],[
|
||||
t2[0]*T0[0] + t2[1]*T1[0] + t2[2]*T2[0] + t2[3]*T3[0],
|
||||
t2[0]*T0[1] + t2[1]*T1[1] + t2[2]*T2[1] + t2[3]*T3[1],
|
||||
t2[0]*T0[2] + t2[1]*T1[2] + t2[2]*T2[2] + t2[3]*T3[2],
|
||||
t2[0]*T0[3] + t2[1]*T1[3] + t2[2]*T2[3] + t2[3]*T3[3]
|
||||
],[
|
||||
t3[0]*T0[0] + t3[1]*T1[0] + t3[2]*T2[0] + t3[3]*T3[0],
|
||||
t3[0]*T0[1] + t3[1]*T1[1] + t3[2]*T2[1] + t3[3]*T3[1],
|
||||
t3[0]*T0[2] + t3[1]*T1[2] + t3[2]*T2[2] + t3[3]*T3[2],
|
||||
t3[0]*T0[3] + t3[1]*T1[3] + t3[2]*T2[3] + t3[3]*T3[3]
|
||||
] ]
|
||||
|
||||
for mesh in node.meshes:
|
||||
for v in mesh.vertices:
|
||||
v = transform(v, transformation)
|
||||
bb_min[0] = min(bb_min[0], v[0])
|
||||
bb_min[1] = min(bb_min[1], v[1])
|
||||
bb_min[2] = min(bb_min[2], v[2])
|
||||
bb_max[0] = max(bb_max[0], v[0])
|
||||
bb_max[1] = max(bb_max[1], v[1])
|
||||
bb_max[2] = max(bb_max[2], v[2])
|
||||
|
||||
|
||||
for child in node.children:
|
||||
bb_min, bb_max = get_bounding_box_for_node(child, bb_min, bb_max, transformation)
|
||||
|
||||
return bb_min, bb_max
|
||||
|
||||
def try_load_functions(library_path, dll):
|
||||
'''
|
||||
Try to bind to aiImportFile and aiReleaseImport
|
||||
|
||||
Arguments
|
||||
---------
|
||||
library_path: path to current lib
|
||||
dll: ctypes handle to library
|
||||
|
||||
Returns
|
||||
---------
|
||||
If unsuccessful:
|
||||
None
|
||||
If successful:
|
||||
Tuple containing (library_path,
|
||||
load from filename function,
|
||||
load from memory function,
|
||||
export to filename function,
|
||||
export to blob function,
|
||||
release function,
|
||||
ctypes handle to assimp library)
|
||||
'''
|
||||
|
||||
try:
|
||||
load = dll.aiImportFile
|
||||
release = dll.aiReleaseImport
|
||||
load_mem = dll.aiImportFileFromMemory
|
||||
export = dll.aiExportScene
|
||||
export2blob = dll.aiExportSceneToBlob
|
||||
except AttributeError:
|
||||
#OK, this is a library, but it doesn't have the functions we need
|
||||
return None
|
||||
|
||||
# library found!
|
||||
from .structs import Scene, ExportDataBlob
|
||||
load.restype = ctypes.POINTER(Scene)
|
||||
load_mem.restype = ctypes.POINTER(Scene)
|
||||
export2blob.restype = ctypes.POINTER(ExportDataBlob)
|
||||
return (library_path, load, load_mem, export, export2blob, release, dll)
|
||||
|
||||
def search_library():
|
||||
'''
|
||||
Loads the assimp library.
|
||||
Throws exception AssimpError if no library_path is found
|
||||
|
||||
Returns: tuple, (load from filename function,
|
||||
load from memory function,
|
||||
export to filename function,
|
||||
export to blob function,
|
||||
release function,
|
||||
dll)
|
||||
'''
|
||||
#this path
|
||||
folder = os.path.dirname(__file__)
|
||||
|
||||
# silence 'DLL not found' message boxes on win
|
||||
try:
|
||||
ctypes.windll.kernel32.SetErrorMode(0x8007)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
candidates = []
|
||||
# test every file
|
||||
for curfolder in [folder]+additional_dirs:
|
||||
if os.path.isdir(curfolder):
|
||||
for filename in os.listdir(curfolder):
|
||||
# our minimum requirement for candidates is that
|
||||
# they should contain 'assimp' somewhere in
|
||||
# their name
|
||||
if filename.lower().find('assimp')==-1 :
|
||||
continue
|
||||
is_out=1
|
||||
for et in ext_whitelist:
|
||||
if et in filename.lower():
|
||||
is_out=0
|
||||
break
|
||||
if is_out:
|
||||
continue
|
||||
|
||||
library_path = os.path.join(curfolder, filename)
|
||||
logger.debug('Try ' + library_path)
|
||||
try:
|
||||
dll = ctypes.cdll.LoadLibrary(library_path)
|
||||
except Exception as e:
|
||||
logger.warning(str(e))
|
||||
# OK, this except is evil. But different OSs will throw different
|
||||
# errors. So just ignore any errors.
|
||||
continue
|
||||
# see if the functions we need are in the dll
|
||||
loaded = try_load_functions(library_path, dll)
|
||||
if loaded: candidates.append(loaded)
|
||||
|
||||
if not candidates:
|
||||
# no library found
|
||||
raise AssimpError("assimp library not found")
|
||||
else:
|
||||
# get the newest library_path
|
||||
candidates = map(lambda x: (os.lstat(x[0])[-2], x), candidates)
|
||||
res = max(candidates, key=operator.itemgetter(0))[1]
|
||||
logger.debug('Using assimp library located at ' + res[0])
|
||||
|
||||
# XXX: if there are 1000 dll/so files containing 'assimp'
|
||||
# in their name, do we have all of them in our address
|
||||
# space now until gc kicks in?
|
||||
|
||||
# XXX: take version postfix of the .so on linux?
|
||||
return res[1:]
|
||||
|
||||
def hasattr_silent(object, name):
|
||||
"""
|
||||
Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2)
|
||||
functionality of silently catching exceptions.
|
||||
|
||||
Returns the result of hasatter() or False if an exception was raised.
|
||||
"""
|
||||
|
||||
try:
|
||||
if not object:
|
||||
return False
|
||||
return hasattr(object, name)
|
||||
except AttributeError:
|
||||
return False
|
@ -1,89 +0,0 @@
|
||||
# Dummy value.
|
||||
#
|
||||
# No texture, but the value to be used as 'texture semantic'
|
||||
# (#aiMaterialProperty::mSemantic) for all material properties
|
||||
# # not* related to textures.
|
||||
#
|
||||
aiTextureType_NONE = 0x0
|
||||
|
||||
# The texture is combined with the result of the diffuse
|
||||
# lighting equation.
|
||||
#
|
||||
aiTextureType_DIFFUSE = 0x1
|
||||
|
||||
# The texture is combined with the result of the specular
|
||||
# lighting equation.
|
||||
#
|
||||
aiTextureType_SPECULAR = 0x2
|
||||
|
||||
# The texture is combined with the result of the ambient
|
||||
# lighting equation.
|
||||
#
|
||||
aiTextureType_AMBIENT = 0x3
|
||||
|
||||
# The texture is added to the result of the lighting
|
||||
# calculation. It isn't influenced by incoming light.
|
||||
#
|
||||
aiTextureType_EMISSIVE = 0x4
|
||||
|
||||
# The texture is a height map.
|
||||
#
|
||||
# By convention, higher gray-scale values stand for
|
||||
# higher elevations from the base height.
|
||||
#
|
||||
aiTextureType_HEIGHT = 0x5
|
||||
|
||||
# The texture is a (tangent space) normal-map.
|
||||
#
|
||||
# Again, there are several conventions for tangent-space
|
||||
# normal maps. Assimp does (intentionally) not
|
||||
# distinguish here.
|
||||
#
|
||||
aiTextureType_NORMALS = 0x6
|
||||
|
||||
# The texture defines the glossiness of the material.
|
||||
#
|
||||
# The glossiness is in fact the exponent of the specular
|
||||
# (phong) lighting equation. Usually there is a conversion
|
||||
# function defined to map the linear color values in the
|
||||
# texture to a suitable exponent. Have fun.
|
||||
#
|
||||
aiTextureType_SHININESS = 0x7
|
||||
|
||||
# The texture defines per-pixel opacity.
|
||||
#
|
||||
# Usually 'white' means opaque and 'black' means
|
||||
# 'transparency'. Or quite the opposite. Have fun.
|
||||
#
|
||||
aiTextureType_OPACITY = 0x8
|
||||
|
||||
# Displacement texture
|
||||
#
|
||||
# The exact purpose and format is application-dependent.
|
||||
# Higher color values stand for higher vertex displacements.
|
||||
#
|
||||
aiTextureType_DISPLACEMENT = 0x9
|
||||
|
||||
# Lightmap texture (aka Ambient Occlusion)
|
||||
#
|
||||
# Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
|
||||
# covered by this material property. The texture contains a
|
||||
# scaling value for the final color value of a pixel. Its
|
||||
# intensity is not affected by incoming light.
|
||||
#
|
||||
aiTextureType_LIGHTMAP = 0xA
|
||||
|
||||
# Reflection texture
|
||||
#
|
||||
# Contains the color of a perfect mirror reflection.
|
||||
# Rarely used, almost never for real-time applications.
|
||||
#
|
||||
aiTextureType_REFLECTION = 0xB
|
||||
|
||||
# Unknown texture
|
||||
#
|
||||
# A texture reference that does not match any of the definitions
|
||||
# above is considered to be 'unknown'. It is still imported
|
||||
# but is excluded from any further postprocessing.
|
||||
#
|
||||
aiTextureType_UNKNOWN = 0xC
|
@ -1,530 +0,0 @@
|
||||
# <hr>Calculates the tangents and bitangents for the imported meshes.
|
||||
#
|
||||
# Does nothing if a mesh does not have normals. You might want this post
|
||||
# processing step to be executed if you plan to use tangent space calculations
|
||||
# such as normal mapping applied to the meshes. There's a config setting,
|
||||
# <tt>#AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE<tt>, which allows you to specify
|
||||
# a maximum smoothing angle for the algorithm. However, usually you'll
|
||||
# want to leave it at the default value.
|
||||
#
|
||||
aiProcess_CalcTangentSpace = 0x1
|
||||
|
||||
## <hr>Identifies and joins identical vertex data sets within all
|
||||
# imported meshes.
|
||||
#
|
||||
# After this step is run, each mesh contains unique vertices,
|
||||
# so a vertex may be used by multiple faces. You usually want
|
||||
# to use this post processing step. If your application deals with
|
||||
# indexed geometry, this step is compulsory or you'll just waste rendering
|
||||
# time. <b>If this flag is not specified<b>, no vertices are referenced by
|
||||
# more than one face and <b>no index buffer is required<b> for rendering.
|
||||
#
|
||||
aiProcess_JoinIdenticalVertices = 0x2
|
||||
|
||||
## <hr>Converts all the imported data to a left-handed coordinate space.
|
||||
#
|
||||
# By default the data is returned in a right-handed coordinate space (which
|
||||
# OpenGL prefers). In this space, +X points to the right,
|
||||
# +Z points towards the viewer, and +Y points upwards. In the DirectX
|
||||
# coordinate space +X points to the right, +Y points upwards, and +Z points
|
||||
# away from the viewer.
|
||||
#
|
||||
# You'll probably want to consider this flag if you use Direct3D for
|
||||
# rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this
|
||||
# setting and bundles all conversions typically required for D3D-based
|
||||
# applications.
|
||||
#
|
||||
aiProcess_MakeLeftHanded = 0x4
|
||||
|
||||
## <hr>Triangulates all faces of all meshes.
|
||||
#
|
||||
# By default the imported mesh data might contain faces with more than 3
|
||||
# indices. For rendering you'll usually want all faces to be triangles.
|
||||
# This post processing step splits up faces with more than 3 indices into
|
||||
# triangles. Line and point primitives are #not# modified! If you want
|
||||
# 'triangles only' with no other kinds of primitives, try the following
|
||||
# solution:
|
||||
# <ul>
|
||||
# <li>Specify both #aiProcess_Triangulate and #aiProcess_SortByPType <li>
|
||||
# <li>Ignore all point and line meshes when you process assimp's output<li>
|
||||
# <ul>
|
||||
#
|
||||
aiProcess_Triangulate = 0x8
|
||||
|
||||
## <hr>Removes some parts of the data structure (animations, materials,
|
||||
# light sources, cameras, textures, vertex components).
|
||||
#
|
||||
# The components to be removed are specified in a separate
|
||||
# configuration option, <tt>#AI_CONFIG_PP_RVC_FLAGS<tt>. This is quite useful
|
||||
# if you don't need all parts of the output structure. Vertex colors
|
||||
# are rarely used today for example... Calling this step to remove unneeded
|
||||
# data from the pipeline as early as possible results in increased
|
||||
# performance and a more optimized output data structure.
|
||||
# This step is also useful if you want to force Assimp to recompute
|
||||
# normals or tangents. The corresponding steps don't recompute them if
|
||||
# they're already there (loaded from the source asset). By using this
|
||||
# step you can make sure they are NOT there.
|
||||
#
|
||||
# This flag is a poor one, mainly because its purpose is usually
|
||||
# misunderstood. Consider the following case: a 3D model has been exported
|
||||
# from a CAD app, and it has per-face vertex colors. Vertex positions can't be
|
||||
# shared, thus the #aiProcess_JoinIdenticalVertices step fails to
|
||||
# optimize the data because of these nasty little vertex colors.
|
||||
# Most apps don't even process them, so it's all for nothing. By using
|
||||
# this step, unneeded components are excluded as early as possible
|
||||
# thus opening more room for internal optimizations.
|
||||
#
|
||||
aiProcess_RemoveComponent = 0x10
|
||||
|
||||
## <hr>Generates normals for all faces of all meshes.
|
||||
#
|
||||
# This is ignored if normals are already there at the time this flag
|
||||
# is evaluated. Model importers try to load them from the source file, so
|
||||
# they're usually already there. Face normals are shared between all points
|
||||
# of a single face, so a single point can have multiple normals, which
|
||||
# forces the library to duplicate vertices in some cases.
|
||||
# #aiProcess_JoinIdenticalVertices is #senseless# then.
|
||||
#
|
||||
# This flag may not be specified together with #aiProcess_GenSmoothNormals.
|
||||
#
|
||||
aiProcess_GenNormals = 0x20
|
||||
|
||||
## <hr>Generates smooth normals for all vertices in the mesh.
|
||||
#
|
||||
# This is ignored if normals are already there at the time this flag
|
||||
# is evaluated. Model importers try to load them from the source file, so
|
||||
# they're usually already there.
|
||||
#
|
||||
# This flag may not be specified together with
|
||||
# #aiProcess_GenNormals. There's a configuration option,
|
||||
# <tt>#AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE<tt> which allows you to specify
|
||||
# an angle maximum for the normal smoothing algorithm. Normals exceeding
|
||||
# this limit are not smoothed, resulting in a 'hard' seam between two faces.
|
||||
# Using a decent angle here (e.g. 80 degrees) results in very good visual
|
||||
# appearance.
|
||||
#
|
||||
aiProcess_GenSmoothNormals = 0x40
|
||||
|
||||
## <hr>Splits large meshes into smaller sub-meshes.
|
||||
#
|
||||
# This is quite useful for real-time rendering, where the number of triangles
|
||||
# which can be maximally processed in a single draw-call is limited
|
||||
# by the video driverhardware. The maximum vertex buffer is usually limited
|
||||
# too. Both requirements can be met with this step: you may specify both a
|
||||
# triangle and vertex limit for a single mesh.
|
||||
#
|
||||
# The split limits can (and should!) be set through the
|
||||
# <tt>#AI_CONFIG_PP_SLM_VERTEX_LIMIT<tt> and <tt>#AI_CONFIG_PP_SLM_TRIANGLE_LIMIT<tt>
|
||||
# settings. The default values are <tt>#AI_SLM_DEFAULT_MAX_VERTICES<tt> and
|
||||
# <tt>#AI_SLM_DEFAULT_MAX_TRIANGLES<tt>.
|
||||
#
|
||||
# Note that splitting is generally a time-consuming task, but only if there's
|
||||
# something to split. The use of this step is recommended for most users.
|
||||
#
|
||||
aiProcess_SplitLargeMeshes = 0x80
|
||||
|
||||
## <hr>Removes the node graph and pre-transforms all vertices with
|
||||
# the local transformation matrices of their nodes.
|
||||
#
|
||||
# The output scene still contains nodes, however there is only a
|
||||
# root node with children, each one referencing only one mesh,
|
||||
# and each mesh referencing one material. For rendering, you can
|
||||
# simply render all meshes in order - you don't need to pay
|
||||
# attention to local transformations and the node hierarchy.
|
||||
# Animations are removed during this step.
|
||||
# This step is intended for applications without a scenegraph.
|
||||
# The step CAN cause some problems: if e.g. a mesh of the asset
|
||||
# contains normals and another, using the same material index, does not,
|
||||
# they will be brought together, but the first meshes's part of
|
||||
# the normal list is zeroed. However, these artifacts are rare.
|
||||
# @note The <tt>#AI_CONFIG_PP_PTV_NORMALIZE<tt> configuration property
|
||||
# can be set to normalize the scene's spatial dimension to the -1...1
|
||||
# range.
|
||||
#
|
||||
aiProcess_PreTransformVertices = 0x100
|
||||
|
||||
## <hr>Limits the number of bones simultaneously affecting a single vertex
|
||||
# to a maximum value.
|
||||
#
|
||||
# If any vertex is affected by more than the maximum number of bones, the least
|
||||
# important vertex weights are removed and the remaining vertex weights are
|
||||
# renormalized so that the weights still sum up to 1.
|
||||
# The default bone weight limit is 4 (defined as <tt>#AI_LMW_MAX_WEIGHTS<tt> in
|
||||
# config.h), but you can use the <tt>#AI_CONFIG_PP_LBW_MAX_WEIGHTS<tt> setting to
|
||||
# supply your own limit to the post processing step.
|
||||
#
|
||||
# If you intend to perform the skinning in hardware, this post processing
|
||||
# step might be of interest to you.
|
||||
#
|
||||
aiProcess_LimitBoneWeights = 0x200
|
||||
|
||||
## <hr>Validates the imported scene data structure.
|
||||
# This makes sure that all indices are valid, all animations and
|
||||
# bones are linked correctly, all material references are correct .. etc.
|
||||
#
|
||||
# It is recommended that you capture Assimp's log output if you use this flag,
|
||||
# so you can easily find out what's wrong if a file fails the
|
||||
# validation. The validator is quite strict and will find #all#
|
||||
# inconsistencies in the data structure... It is recommended that plugin
|
||||
# developers use it to debug their loaders. There are two types of
|
||||
# validation failures:
|
||||
# <ul>
|
||||
# <li>Error: There's something wrong with the imported data. Further
|
||||
# postprocessing is not possible and the data is not usable at all.
|
||||
# The import fails. #Importer::GetErrorString() or #aiGetErrorString()
|
||||
# carry the error message around.<li>
|
||||
# <li>Warning: There are some minor issues (e.g. 1000000 animation
|
||||
# keyframes with the same time), but further postprocessing and use
|
||||
# of the data structure is still safe. Warning details are written
|
||||
# to the log file, <tt>#AI_SCENE_FLAGS_VALIDATION_WARNING<tt> is set
|
||||
# in #aiScene::mFlags<li>
|
||||
# <ul>
|
||||
#
|
||||
# This post-processing step is not time-consuming. Its use is not
|
||||
# compulsory, but recommended.
|
||||
#
|
||||
aiProcess_ValidateDataStructure = 0x400
|
||||
|
||||
## <hr>Reorders triangles for better vertex cache locality.
|
||||
#
|
||||
# The step tries to improve the ACMR (average post-transform vertex cache
|
||||
# miss ratio) for all meshes. The implementation runs in O(n) and is
|
||||
# roughly based on the 'tipsify' algorithm (see <a href="
|
||||
# http:www.cs.princeton.edugfxpubsSander_2007_%3ETRtipsy.pdf">this
|
||||
# paper<a>).
|
||||
#
|
||||
# If you intend to render huge models in hardware, this step might
|
||||
# be of interest to you. The <tt>#AI_CONFIG_PP_ICL_PTCACHE_SIZE<tt>config
|
||||
# setting can be used to fine-tune the cache optimization.
|
||||
#
|
||||
aiProcess_ImproveCacheLocality = 0x800
|
||||
|
||||
## <hr>Searches for redundantunreferenced materials and removes them.
|
||||
#
|
||||
# This is especially useful in combination with the
|
||||
# #aiProcess_PretransformVertices and #aiProcess_OptimizeMeshes flags.
|
||||
# Both join small meshes with equal characteristics, but they can't do
|
||||
# their work if two meshes have different materials. Because several
|
||||
# material settings are lost during Assimp's import filters,
|
||||
# (and because many exporters don't check for redundant materials), huge
|
||||
# models often have materials which are are defined several times with
|
||||
# exactly the same settings.
|
||||
#
|
||||
# Several material settings not contributing to the final appearance of
|
||||
# a surface are ignored in all comparisons (e.g. the material name).
|
||||
# So, if you're passing additional information through the
|
||||
# content pipeline (probably using #magic# material names), don't
|
||||
# specify this flag. Alternatively take a look at the
|
||||
# <tt>#AI_CONFIG_PP_RRM_EXCLUDE_LIST<tt> setting.
|
||||
#
|
||||
aiProcess_RemoveRedundantMaterials = 0x1000
|
||||
|
||||
## <hr>This step tries to determine which meshes have normal vectors
|
||||
# that are facing inwards and inverts them.
|
||||
#
|
||||
# The algorithm is simple but effective:
|
||||
# the bounding box of all vertices + their normals is compared against
|
||||
# the volume of the bounding box of all vertices without their normals.
|
||||
# This works well for most objects, problems might occur with planar
|
||||
# surfaces. However, the step tries to filter such cases.
|
||||
# The step inverts all in-facing normals. Generally it is recommended
|
||||
# to enable this step, although the result is not always correct.
|
||||
#
|
||||
aiProcess_FixInfacingNormals = 0x2000
|
||||
|
||||
## <hr>This step splits meshes with more than one primitive type in
|
||||
# homogeneous sub-meshes.
|
||||
#
|
||||
# The step is executed after the triangulation step. After the step
|
||||
# returns, just one bit is set in aiMesh::mPrimitiveTypes. This is
|
||||
# especially useful for real-time rendering where point and line
|
||||
# primitives are often ignored or rendered separately.
|
||||
# You can use the <tt>#AI_CONFIG_PP_SBP_REMOVE<tt> option to specify which
|
||||
# primitive types you need. This can be used to easily exclude
|
||||
# lines and points, which are rarely used, from the import.
|
||||
#
|
||||
aiProcess_SortByPType = 0x8000
|
||||
|
||||
## <hr>This step searches all meshes for degenerate primitives and
|
||||
# converts them to proper lines or points.
|
||||
#
|
||||
# A face is 'degenerate' if one or more of its points are identical.
|
||||
# To have the degenerate stuff not only detected and collapsed but
|
||||
# removed, try one of the following procedures:
|
||||
# <br><b>1.<b> (if you support lines and points for rendering but don't
|
||||
# want the degenerates)<br>
|
||||
# <ul>
|
||||
# <li>Specify the #aiProcess_FindDegenerates flag.
|
||||
# <li>
|
||||
# <li>Set the <tt>AI_CONFIG_PP_FD_REMOVE<tt> option to 1. This will
|
||||
# cause the step to remove degenerate triangles from the import
|
||||
# as soon as they're detected. They won't pass any further
|
||||
# pipeline steps.
|
||||
# <li>
|
||||
# <ul>
|
||||
# <br><b>2.<b>(if you don't support lines and points at all)<br>
|
||||
# <ul>
|
||||
# <li>Specify the #aiProcess_FindDegenerates flag.
|
||||
# <li>
|
||||
# <li>Specify the #aiProcess_SortByPType flag. This moves line and
|
||||
# point primitives to separate meshes.
|
||||
# <li>
|
||||
# <li>Set the <tt>AI_CONFIG_PP_SBP_REMOVE<tt> option to
|
||||
# @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES
|
||||
# @endcode to cause SortByPType to reject point
|
||||
# and line meshes from the scene.
|
||||
# <li>
|
||||
# <ul>
|
||||
# @note Degenerate polygons are not necessarily evil and that's why
|
||||
# they're not removed by default. There are several file formats which
|
||||
# don't support lines or points, and some exporters bypass the
|
||||
# format specification and write them as degenerate triangles instead.
|
||||
#
|
||||
aiProcess_FindDegenerates = 0x10000
|
||||
|
||||
## <hr>This step searches all meshes for invalid data, such as zeroed
|
||||
# normal vectors or invalid UV coords and removesfixes them. This is
|
||||
# intended to get rid of some common exporter errors.
|
||||
#
|
||||
# This is especially useful for normals. If they are invalid, and
|
||||
# the step recognizes this, they will be removed and can later
|
||||
# be recomputed, i.e. by the #aiProcess_GenSmoothNormals flag.<br>
|
||||
# The step will also remove meshes that are infinitely small and reduce
|
||||
# animation tracks consisting of hundreds if redundant keys to a single
|
||||
# key. The <tt>AI_CONFIG_PP_FID_ANIM_ACCURACY<tt> config property decides
|
||||
# the accuracy of the check for duplicate animation tracks.
|
||||
#
|
||||
aiProcess_FindInvalidData = 0x20000
|
||||
|
||||
## <hr>This step converts non-UV mappings (such as spherical or
|
||||
# cylindrical mapping) to proper texture coordinate channels.
|
||||
#
|
||||
# Most applications will support UV mapping only, so you will
|
||||
# probably want to specify this step in every case. Note that Assimp is not
|
||||
# always able to match the original mapping implementation of the
|
||||
# 3D app which produced a model perfectly. It's always better to let the
|
||||
# modelling app compute the UV channels - 3ds max, Maya, Blender,
|
||||
# LightWave, and Modo do this for example.
|
||||
#
|
||||
# @note If this step is not requested, you'll need to process the
|
||||
# <tt>#AI_MATKEY_MAPPING<tt> material property in order to display all assets
|
||||
# properly.
|
||||
#
|
||||
aiProcess_GenUVCoords = 0x40000
|
||||
|
||||
## <hr>This step applies per-texture UV transformations and bakes
|
||||
# them into stand-alone vtexture coordinate channels.
|
||||
#
|
||||
# UV transformations are specified per-texture - see the
|
||||
# <tt>#AI_MATKEY_UVTRANSFORM<tt> material key for more information.
|
||||
# This step processes all textures with
|
||||
# transformed input UV coordinates and generates a new (pre-transformed) UV channel
|
||||
# which replaces the old channel. Most applications won't support UV
|
||||
# transformations, so you will probably want to specify this step.
|
||||
#
|
||||
# @note UV transformations are usually implemented in real-time apps by
|
||||
# transforming texture coordinates at vertex shader stage with a 3x3
|
||||
# (homogenous) transformation matrix.
|
||||
#
|
||||
aiProcess_TransformUVCoords = 0x80000
|
||||
|
||||
## <hr>This step searches for duplicate meshes and replaces them
|
||||
# with references to the first mesh.
|
||||
#
|
||||
# This step takes a while, so don't use it if speed is a concern.
|
||||
# Its main purpose is to workaround the fact that many export
|
||||
# file formats don't support instanced meshes, so exporters need to
|
||||
# duplicate meshes. This step removes the duplicates again. Please
|
||||
# note that Assimp does not currently support per-node material
|
||||
# assignment to meshes, which means that identical meshes with
|
||||
# different materials are currently #not# joined, although this is
|
||||
# planned for future versions.
|
||||
#
|
||||
aiProcess_FindInstances = 0x100000
|
||||
|
||||
## <hr>A postprocessing step to reduce the number of meshes.
|
||||
#
|
||||
# This will, in fact, reduce the number of draw calls.
|
||||
#
|
||||
# This is a very effective optimization and is recommended to be used
|
||||
# together with #aiProcess_OptimizeGraph, if possible. The flag is fully
|
||||
# compatible with both #aiProcess_SplitLargeMeshes and #aiProcess_SortByPType.
|
||||
#
|
||||
aiProcess_OptimizeMeshes = 0x200000
|
||||
|
||||
|
||||
## <hr>A postprocessing step to optimize the scene hierarchy.
|
||||
#
|
||||
# Nodes without animations, bones, lights or cameras assigned are
|
||||
# collapsed and joined.
|
||||
#
|
||||
# Node names can be lost during this step. If you use special 'tag nodes'
|
||||
# to pass additional information through your content pipeline, use the
|
||||
# <tt>#AI_CONFIG_PP_OG_EXCLUDE_LIST<tt> setting to specify a list of node
|
||||
# names you want to be kept. Nodes matching one of the names in this list won't
|
||||
# be touched or modified.
|
||||
#
|
||||
# Use this flag with caution. Most simple files will be collapsed to a
|
||||
# single node, so complex hierarchies are usually completely lost. This is not
|
||||
# useful for editor environments, but probably a very effective
|
||||
# optimization if you just want to get the model data, convert it to your
|
||||
# own format, and render it as fast as possible.
|
||||
#
|
||||
# This flag is designed to be used with #aiProcess_OptimizeMeshes for best
|
||||
# results.
|
||||
#
|
||||
# @note 'Crappy' scenes with thousands of extremely small meshes packed
|
||||
# in deeply nested nodes exist for almost all file formats.
|
||||
# #aiProcess_OptimizeMeshes in combination with #aiProcess_OptimizeGraph
|
||||
# usually fixes them all and makes them renderable.
|
||||
#
|
||||
aiProcess_OptimizeGraph = 0x400000
|
||||
|
||||
## <hr>This step flips all UV coordinates along the y-axis and adjusts
|
||||
# material settings and bitangents accordingly.
|
||||
#
|
||||
# <b>Output UV coordinate system:<b>
|
||||
# @code
|
||||
# 0y|0y ---------- 1x|0y
|
||||
# | |
|
||||
# | |
|
||||
# | |
|
||||
# 0x|1y ---------- 1x|1y
|
||||
# @endcode
|
||||
#
|
||||
# You'll probably want to consider this flag if you use Direct3D for
|
||||
# rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this
|
||||
# setting and bundles all conversions typically required for D3D-based
|
||||
# applications.
|
||||
#
|
||||
aiProcess_FlipUVs = 0x800000
|
||||
|
||||
## <hr>This step adjusts the output face winding order to be CW.
|
||||
#
|
||||
# The default face winding order is counter clockwise (CCW).
|
||||
#
|
||||
# <b>Output face order:<b>
|
||||
# @code
|
||||
# x2
|
||||
#
|
||||
# x0
|
||||
# x1
|
||||
# @endcode
|
||||
#
|
||||
aiProcess_FlipWindingOrder = 0x1000000
|
||||
|
||||
## <hr>This step splits meshes with many bones into sub-meshes so that each
|
||||
# su-bmesh has fewer or as many bones as a given limit.
|
||||
#
|
||||
aiProcess_SplitByBoneCount = 0x2000000
|
||||
|
||||
## <hr>This step removes bones losslessly or according to some threshold.
|
||||
#
|
||||
# In some cases (i.e. formats that require it) exporters are forced to
|
||||
# assign dummy bone weights to otherwise static meshes assigned to
|
||||
# animated meshes. Full, weight-based skinning is expensive while
|
||||
# animating nodes is extremely cheap, so this step is offered to clean up
|
||||
# the data in that regard.
|
||||
#
|
||||
# Use <tt>#AI_CONFIG_PP_DB_THRESHOLD<tt> to control this.
|
||||
# Use <tt>#AI_CONFIG_PP_DB_ALL_OR_NONE<tt> if you want bones removed if and
|
||||
# only if all bones within the scene qualify for removal.
|
||||
#
|
||||
aiProcess_Debone = 0x4000000
|
||||
|
||||
aiProcess_GenEntityMeshes = 0x100000
|
||||
aiProcess_OptimizeAnimations = 0x200000
|
||||
aiProcess_FixTexturePaths = 0x200000
|
||||
aiProcess_EmbedTextures = 0x10000000,
|
||||
|
||||
## @def aiProcess_ConvertToLeftHanded
|
||||
# @brief Shortcut flag for Direct3D-based applications.
|
||||
#
|
||||
# Supersedes the #aiProcess_MakeLeftHanded and #aiProcess_FlipUVs and
|
||||
# #aiProcess_FlipWindingOrder flags.
|
||||
# The output data matches Direct3D's conventions: left-handed geometry, upper-left
|
||||
# origin for UV coordinates and finally clockwise face order, suitable for CCW culling.
|
||||
#
|
||||
# @deprecated
|
||||
#
|
||||
aiProcess_ConvertToLeftHanded = ( \
|
||||
aiProcess_MakeLeftHanded | \
|
||||
aiProcess_FlipUVs | \
|
||||
aiProcess_FlipWindingOrder | \
|
||||
0 )
|
||||
|
||||
|
||||
## @def aiProcessPreset_TargetRealtimeUse_Fast
|
||||
# @brief Default postprocess configuration optimizing the data for real-time rendering.
|
||||
#
|
||||
# Applications would want to use this preset to load models on end-user PCs,
|
||||
# maybe for direct use in game.
|
||||
#
|
||||
# If you're using DirectX, don't forget to combine this value with
|
||||
# the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
|
||||
# in your application apply the #aiProcess_TransformUVCoords step, too.
|
||||
# @note Please take the time to read the docs for the steps enabled by this preset.
|
||||
# Some of them offer further configurable properties, while some of them might not be of
|
||||
# use for you so it might be better to not specify them.
|
||||
#
|
||||
aiProcessPreset_TargetRealtime_Fast = ( \
|
||||
aiProcess_CalcTangentSpace | \
|
||||
aiProcess_GenNormals | \
|
||||
aiProcess_JoinIdenticalVertices | \
|
||||
aiProcess_Triangulate | \
|
||||
aiProcess_GenUVCoords | \
|
||||
aiProcess_SortByPType | \
|
||||
0 )
|
||||
|
||||
## @def aiProcessPreset_TargetRealtime_Quality
|
||||
# @brief Default postprocess configuration optimizing the data for real-time rendering.
|
||||
#
|
||||
# Unlike #aiProcessPreset_TargetRealtime_Fast, this configuration
|
||||
# performs some extra optimizations to improve rendering speed and
|
||||
# to minimize memory usage. It could be a good choice for a level editor
|
||||
# environment where import speed is not so important.
|
||||
#
|
||||
# If you're using DirectX, don't forget to combine this value with
|
||||
# the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
|
||||
# in your application apply the #aiProcess_TransformUVCoords step, too.
|
||||
# @note Please take the time to read the docs for the steps enabled by this preset.
|
||||
# Some of them offer further configurable properties, while some of them might not be
|
||||
# of use for you so it might be better to not specify them.
|
||||
#
|
||||
aiProcessPreset_TargetRealtime_Quality = ( \
|
||||
aiProcess_CalcTangentSpace | \
|
||||
aiProcess_GenSmoothNormals | \
|
||||
aiProcess_JoinIdenticalVertices | \
|
||||
aiProcess_ImproveCacheLocality | \
|
||||
aiProcess_LimitBoneWeights | \
|
||||
aiProcess_RemoveRedundantMaterials | \
|
||||
aiProcess_SplitLargeMeshes | \
|
||||
aiProcess_Triangulate | \
|
||||
aiProcess_GenUVCoords | \
|
||||
aiProcess_SortByPType | \
|
||||
aiProcess_FindDegenerates | \
|
||||
aiProcess_FindInvalidData | \
|
||||
0 )
|
||||
|
||||
## @def aiProcessPreset_TargetRealtime_MaxQuality
|
||||
# @brief Default postprocess configuration optimizing the data for real-time rendering.
|
||||
#
|
||||
# This preset enables almost every optimization step to achieve perfectly
|
||||
# optimized data. It's your choice for level editor environments where import speed
|
||||
# is not important.
|
||||
#
|
||||
# If you're using DirectX, don't forget to combine this value with
|
||||
# the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
|
||||
# in your application, apply the #aiProcess_TransformUVCoords step, too.
|
||||
# @note Please take the time to read the docs for the steps enabled by this preset.
|
||||
# Some of them offer further configurable properties, while some of them might not be
|
||||
# of use for you so it might be better to not specify them.
|
||||
#
|
||||
aiProcessPreset_TargetRealtime_MaxQuality = ( \
|
||||
aiProcessPreset_TargetRealtime_Quality | \
|
||||
aiProcess_FindInstances | \
|
||||
aiProcess_ValidateDataStructure | \
|
||||
aiProcess_OptimizeMeshes | \
|
||||
0 )
|
||||
|
||||
|
1132
thirdparty/assimp/port/PyAssimp/pyassimp/structs.py
vendored
1132
thirdparty/assimp/port/PyAssimp/pyassimp/structs.py
vendored
File diff suppressed because it is too large
Load Diff
1318
thirdparty/assimp/port/PyAssimp/scripts/3d_viewer.py
vendored
1318
thirdparty/assimp/port/PyAssimp/scripts/3d_viewer.py
vendored
File diff suppressed because it is too large
Load Diff
1316
thirdparty/assimp/port/PyAssimp/scripts/3d_viewer_py3.py
vendored
1316
thirdparty/assimp/port/PyAssimp/scripts/3d_viewer_py3.py
vendored
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
||||
pyassimp examples
|
||||
=================
|
||||
|
||||
- `sample.py`: shows how to load a model with pyassimp, and display some statistics.
|
||||
- `3d_viewer.py`: an OpenGL 3D viewer that requires shaders
|
||||
- `fixed_pipeline_3d_viewer`: an OpenGL 3D viewer using the old fixed-pipeline.
|
||||
Only for illustration example. Base new projects on `3d_viewer.py`.
|
||||
|
||||
|
||||
Requirements for the 3D viewers:
|
||||
|
||||
- `pyopengl` (on Ubuntu/Debian, `sudo apt-get install python-opengl`)
|
||||
- `pygame` (on Ubuntu/Debian, `sudo apt-get install python-pygame`)
|
@ -1,372 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: UTF-8 -*-
|
||||
|
||||
""" This program demonstrates the use of pyassimp to load and
|
||||
render objects with OpenGL.
|
||||
|
||||
'c' cycles between cameras (if any available)
|
||||
'q' to quit
|
||||
|
||||
This example mixes 'old' OpenGL fixed-function pipeline with
|
||||
Vertex Buffer Objects.
|
||||
|
||||
Materials are supported but textures are currently ignored.
|
||||
|
||||
For a more advanced example (with shaders + keyboard/mouse
|
||||
controls), check scripts/sdl_viewer.py
|
||||
|
||||
Author: Séverin Lemaignan, 2012
|
||||
|
||||
This sample is based on several sources, including:
|
||||
- http://www.lighthouse3d.com/tutorials
|
||||
- http://www.songho.ca/opengl/gl_transform.html
|
||||
- http://code.activestate.com/recipes/325391/
|
||||
- ASSIMP's C++ SimpleOpenGL viewer
|
||||
"""
|
||||
|
||||
import sys
|
||||
from OpenGL.GLUT import *
|
||||
from OpenGL.GLU import *
|
||||
from OpenGL.GL import *
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger("pyassimp_opengl")
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
import math
|
||||
import numpy
|
||||
|
||||
import pyassimp
|
||||
from pyassimp.postprocess import *
|
||||
from pyassimp.helper import *
|
||||
|
||||
|
||||
name = 'pyassimp OpenGL viewer'
|
||||
height = 600
|
||||
width = 900
|
||||
|
||||
class GLRenderer():
|
||||
def __init__(self):
|
||||
|
||||
self.scene = None
|
||||
|
||||
self.using_fixed_cam = False
|
||||
self.current_cam_index = 0
|
||||
|
||||
# store the global scene rotation
|
||||
self.angle = 0.
|
||||
|
||||
# for FPS calculation
|
||||
self.prev_time = 0
|
||||
self.prev_fps_time = 0
|
||||
self.frames = 0
|
||||
|
||||
def prepare_gl_buffers(self, mesh):
|
||||
""" Creates 3 buffer objets for each mesh,
|
||||
to store the vertices, the normals, and the faces
|
||||
indices.
|
||||
"""
|
||||
|
||||
mesh.gl = {}
|
||||
|
||||
# Fill the buffer for vertex positions
|
||||
mesh.gl["vertices"] = glGenBuffers(1)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mesh.gl["vertices"])
|
||||
glBufferData(GL_ARRAY_BUFFER,
|
||||
mesh.vertices,
|
||||
GL_STATIC_DRAW)
|
||||
|
||||
# Fill the buffer for normals
|
||||
mesh.gl["normals"] = glGenBuffers(1)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mesh.gl["normals"])
|
||||
glBufferData(GL_ARRAY_BUFFER,
|
||||
mesh.normals,
|
||||
GL_STATIC_DRAW)
|
||||
|
||||
|
||||
# Fill the buffer for vertex positions
|
||||
mesh.gl["triangles"] = glGenBuffers(1)
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh.gl["triangles"])
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
|
||||
mesh.faces,
|
||||
GL_STATIC_DRAW)
|
||||
|
||||
# Unbind buffers
|
||||
glBindBuffer(GL_ARRAY_BUFFER,0)
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0)
|
||||
|
||||
def load_model(self, path, postprocess = None):
|
||||
logger.info("Loading model:" + path + "...")
|
||||
|
||||
if postprocess:
|
||||
self.scene = pyassimp.load(path, processing=postprocess)
|
||||
else:
|
||||
self.scene = pyassimp.load(path)
|
||||
logger.info("Done.")
|
||||
|
||||
scene = self.scene
|
||||
#log some statistics
|
||||
logger.info(" meshes: %d" % len(scene.meshes))
|
||||
logger.info(" total faces: %d" % sum([len(mesh.faces) for mesh in scene.meshes]))
|
||||
logger.info(" materials: %d" % len(scene.materials))
|
||||
self.bb_min, self.bb_max = get_bounding_box(self.scene)
|
||||
logger.info(" bounding box:" + str(self.bb_min) + " - " + str(self.bb_max))
|
||||
|
||||
self.scene_center = [(a + b) / 2. for a, b in zip(self.bb_min, self.bb_max)]
|
||||
|
||||
for index, mesh in enumerate(scene.meshes):
|
||||
self.prepare_gl_buffers(mesh)
|
||||
|
||||
# Finally release the model
|
||||
pyassimp.release(scene)
|
||||
|
||||
def cycle_cameras(self):
|
||||
self.current_cam_index
|
||||
if not self.scene.cameras:
|
||||
return None
|
||||
self.current_cam_index = (self.current_cam_index + 1) % len(self.scene.cameras)
|
||||
cam = self.scene.cameras[self.current_cam_index]
|
||||
logger.info("Switched to camera " + str(cam))
|
||||
return cam
|
||||
|
||||
def set_default_camera(self):
|
||||
|
||||
if not self.using_fixed_cam:
|
||||
glLoadIdentity()
|
||||
|
||||
gluLookAt(0.,0.,3.,
|
||||
0.,0.,-5.,
|
||||
0.,1.,0.)
|
||||
|
||||
|
||||
|
||||
def set_camera(self, camera):
|
||||
|
||||
if not camera:
|
||||
return
|
||||
|
||||
self.using_fixed_cam = True
|
||||
|
||||
znear = camera.clipplanenear
|
||||
zfar = camera.clipplanefar
|
||||
aspect = camera.aspect
|
||||
fov = camera.horizontalfov
|
||||
|
||||
glMatrixMode(GL_PROJECTION)
|
||||
glLoadIdentity()
|
||||
|
||||
# Compute gl frustrum
|
||||
tangent = math.tan(fov/2.)
|
||||
h = znear * tangent
|
||||
w = h * aspect
|
||||
|
||||
# params: left, right, bottom, top, near, far
|
||||
glFrustum(-w, w, -h, h, znear, zfar)
|
||||
# equivalent to:
|
||||
#gluPerspective(fov * 180/math.pi, aspect, znear, zfar)
|
||||
|
||||
glMatrixMode(GL_MODELVIEW)
|
||||
glLoadIdentity()
|
||||
|
||||
cam = transform(camera.position, camera.transformation)
|
||||
at = transform(camera.lookat, camera.transformation)
|
||||
gluLookAt(cam[0], cam[2], -cam[1],
|
||||
at[0], at[2], -at[1],
|
||||
0, 1, 0)
|
||||
|
||||
def fit_scene(self, restore = False):
|
||||
""" Compute a scale factor and a translation to fit and center
|
||||
the whole geometry on the screen.
|
||||
"""
|
||||
|
||||
x_max = self.bb_max[0] - self.bb_min[0]
|
||||
y_max = self.bb_max[1] - self.bb_min[1]
|
||||
tmp = max(x_max, y_max)
|
||||
z_max = self.bb_max[2] - self.bb_min[2]
|
||||
tmp = max(z_max, tmp)
|
||||
|
||||
if not restore:
|
||||
tmp = 1. / tmp
|
||||
|
||||
logger.info("Scaling the scene by %.03f" % tmp)
|
||||
glScalef(tmp, tmp, tmp)
|
||||
|
||||
# center the model
|
||||
direction = -1 if not restore else 1
|
||||
glTranslatef( direction * self.scene_center[0],
|
||||
direction * self.scene_center[1],
|
||||
direction * self.scene_center[2] )
|
||||
|
||||
return x_max, y_max, z_max
|
||||
|
||||
def apply_material(self, mat):
|
||||
""" Apply an OpenGL, using one OpenGL display list per material to cache
|
||||
the operation.
|
||||
"""
|
||||
|
||||
if not hasattr(mat, "gl_mat"): # evaluate once the mat properties, and cache the values in a glDisplayList.
|
||||
diffuse = numpy.array(mat.properties.get("diffuse", [0.8, 0.8, 0.8, 1.0]))
|
||||
specular = numpy.array(mat.properties.get("specular", [0., 0., 0., 1.0]))
|
||||
ambient = numpy.array(mat.properties.get("ambient", [0.2, 0.2, 0.2, 1.0]))
|
||||
emissive = numpy.array(mat.properties.get("emissive", [0., 0., 0., 1.0]))
|
||||
shininess = min(mat.properties.get("shininess", 1.0), 128)
|
||||
wireframe = mat.properties.get("wireframe", 0)
|
||||
twosided = mat.properties.get("twosided", 1)
|
||||
|
||||
setattr(mat, "gl_mat", glGenLists(1))
|
||||
glNewList(mat.gl_mat, GL_COMPILE)
|
||||
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse)
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular)
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient)
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emissive)
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE if wireframe else GL_FILL)
|
||||
glDisable(GL_CULL_FACE) if twosided else glEnable(GL_CULL_FACE)
|
||||
|
||||
glEndList()
|
||||
|
||||
glCallList(mat.gl_mat)
|
||||
|
||||
|
||||
|
||||
def do_motion(self):
|
||||
|
||||
gl_time = glutGet(GLUT_ELAPSED_TIME)
|
||||
|
||||
self.angle = (gl_time - self.prev_time) * 0.1
|
||||
|
||||
self.prev_time = gl_time
|
||||
|
||||
# Compute FPS
|
||||
self.frames += 1
|
||||
if gl_time - self.prev_fps_time >= 1000:
|
||||
current_fps = self.frames * 1000 / (gl_time - self.prev_fps_time)
|
||||
logger.info('%.0f fps' % current_fps)
|
||||
self.frames = 0
|
||||
self.prev_fps_time = gl_time
|
||||
|
||||
glutPostRedisplay()
|
||||
|
||||
def recursive_render(self, node):
|
||||
""" Main recursive rendering method.
|
||||
"""
|
||||
|
||||
# save model matrix and apply node transformation
|
||||
glPushMatrix()
|
||||
m = node.transformation.transpose() # OpenGL row major
|
||||
glMultMatrixf(m)
|
||||
|
||||
for mesh in node.meshes:
|
||||
self.apply_material(mesh.material)
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mesh.gl["vertices"])
|
||||
glEnableClientState(GL_VERTEX_ARRAY)
|
||||
glVertexPointer(3, GL_FLOAT, 0, None)
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mesh.gl["normals"])
|
||||
glEnableClientState(GL_NORMAL_ARRAY)
|
||||
glNormalPointer(GL_FLOAT, 0, None)
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh.gl["triangles"])
|
||||
glDrawElements(GL_TRIANGLES,len(mesh.faces) * 3, GL_UNSIGNED_INT, None)
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY)
|
||||
glDisableClientState(GL_NORMAL_ARRAY)
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0)
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)
|
||||
|
||||
for child in node.children:
|
||||
self.recursive_render(child)
|
||||
|
||||
glPopMatrix()
|
||||
|
||||
|
||||
def display(self):
|
||||
""" GLUT callback to redraw OpenGL surface
|
||||
"""
|
||||
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
|
||||
|
||||
glRotatef(self.angle,0.,1.,0.)
|
||||
self.recursive_render(self.scene.rootnode)
|
||||
|
||||
glutSwapBuffers()
|
||||
self.do_motion()
|
||||
return
|
||||
|
||||
####################################################################
|
||||
## GLUT keyboard and mouse callbacks ##
|
||||
####################################################################
|
||||
def onkeypress(self, key, x, y):
|
||||
if key == 'c':
|
||||
self.fit_scene(restore = True)
|
||||
self.set_camera(self.cycle_cameras())
|
||||
if key == 'q':
|
||||
sys.exit(0)
|
||||
|
||||
def render(self, filename=None, fullscreen = False, autofit = True, postprocess = None):
|
||||
"""
|
||||
|
||||
:param autofit: if true, scale the scene to fit the whole geometry
|
||||
in the viewport.
|
||||
"""
|
||||
|
||||
# First initialize the openGL context
|
||||
glutInit(sys.argv)
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
|
||||
if not fullscreen:
|
||||
glutInitWindowSize(width, height)
|
||||
glutCreateWindow(name)
|
||||
else:
|
||||
glutGameModeString("1024x768")
|
||||
if glutGameModeGet(GLUT_GAME_MODE_POSSIBLE):
|
||||
glutEnterGameMode()
|
||||
else:
|
||||
print("Fullscreen mode not available!")
|
||||
sys.exit(1)
|
||||
|
||||
self.load_model(filename, postprocess = postprocess)
|
||||
|
||||
|
||||
glClearColor(0.1,0.1,0.1,1.)
|
||||
#glShadeModel(GL_SMOOTH)
|
||||
|
||||
glEnable(GL_LIGHTING)
|
||||
|
||||
glEnable(GL_CULL_FACE)
|
||||
glEnable(GL_DEPTH_TEST)
|
||||
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE)
|
||||
glEnable(GL_NORMALIZE)
|
||||
glEnable(GL_LIGHT0)
|
||||
|
||||
glutDisplayFunc(self.display)
|
||||
|
||||
|
||||
glMatrixMode(GL_PROJECTION)
|
||||
glLoadIdentity()
|
||||
gluPerspective(35.0, width/float(height) , 0.10, 100.0)
|
||||
glMatrixMode(GL_MODELVIEW)
|
||||
self.set_default_camera()
|
||||
|
||||
if autofit:
|
||||
# scale the whole asset to fit into our view frustum·
|
||||
self.fit_scene()
|
||||
|
||||
glPushMatrix()
|
||||
|
||||
glutKeyboardFunc(self.onkeypress)
|
||||
glutIgnoreKeyRepeat(1)
|
||||
|
||||
glutMainLoop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if not len(sys.argv) > 1:
|
||||
print("Usage: " + __file__ + " <model>")
|
||||
sys.exit(0)
|
||||
|
||||
glrender = GLRenderer()
|
||||
glrender.render(sys.argv[1], fullscreen = False, postprocess = aiProcessPreset_TargetRealtime_MaxQuality)
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: UTF-8 -*-
|
||||
|
||||
"""
|
||||
This module uses the sample.py script to load all test models it finds.
|
||||
|
||||
Note: this is not an exhaustive test suite, it does not check the
|
||||
data structures in detail. It just verifies whether basic
|
||||
loading and querying of 3d models using pyassimp works.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Make the development (ie. GIT repo) version of PyAssimp available for import.
|
||||
sys.path.insert(0, '..')
|
||||
|
||||
import sample
|
||||
from pyassimp import errors
|
||||
|
||||
# Paths to model files.
|
||||
basepaths = [os.path.join('..', '..', '..', 'test', 'models'),
|
||||
os.path.join('..', '..', '..', 'test', 'models-nonbsd')]
|
||||
|
||||
# Valid extensions for 3D model files.
|
||||
extensions = ['.3ds', '.x', '.lwo', '.obj', '.md5mesh', '.dxf', '.ply', '.stl',
|
||||
'.dae', '.md5anim', '.lws', '.irrmesh', '.nff', '.off', '.blend']
|
||||
|
||||
|
||||
def run_tests():
|
||||
ok, err = 0, 0
|
||||
for path in basepaths:
|
||||
print("Looking for models in %s..." % path)
|
||||
for root, dirs, files in os.walk(path):
|
||||
for afile in files:
|
||||
base, ext = os.path.splitext(afile)
|
||||
if ext in extensions:
|
||||
try:
|
||||
sample.main(os.path.join(root, afile))
|
||||
ok += 1
|
||||
except errors.AssimpError as error:
|
||||
# Assimp error is fine; this is a controlled case.
|
||||
print(error)
|
||||
err += 1
|
||||
except Exception:
|
||||
print("Error encountered while loading <%s>"
|
||||
% os.path.join(root, afile))
|
||||
print('** Loaded %s models, got controlled errors for %s files'
|
||||
% (ok, err))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_tests()
|
@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: UTF-8 -*-
|
||||
|
||||
"""
|
||||
This module demonstrates the functionality of PyAssimp.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
import pyassimp
|
||||
import pyassimp.postprocess
|
||||
|
||||
def recur_node(node,level = 0):
|
||||
print(" " + "\t" * level + "- " + str(node))
|
||||
for child in node.children:
|
||||
recur_node(child, level + 1)
|
||||
|
||||
|
||||
def main(filename=None):
|
||||
|
||||
scene = pyassimp.load(filename, processing=pyassimp.postprocess.aiProcess_Triangulate)
|
||||
|
||||
#the model we load
|
||||
print("MODEL:" + filename)
|
||||
print
|
||||
|
||||
#write some statistics
|
||||
print("SCENE:")
|
||||
print(" meshes:" + str(len(scene.meshes)))
|
||||
print(" materials:" + str(len(scene.materials)))
|
||||
print(" textures:" + str(len(scene.textures)))
|
||||
print
|
||||
|
||||
print("NODES:")
|
||||
recur_node(scene.rootnode)
|
||||
|
||||
print
|
||||
print("MESHES:")
|
||||
for index, mesh in enumerate(scene.meshes):
|
||||
print(" MESH" + str(index+1))
|
||||
print(" material id:" + str(mesh.materialindex+1))
|
||||
print(" vertices:" + str(len(mesh.vertices)))
|
||||
print(" first 3 verts:\n" + str(mesh.vertices[:3]))
|
||||
if mesh.normals.any():
|
||||
print(" first 3 normals:\n" + str(mesh.normals[:3]))
|
||||
else:
|
||||
print(" no normals")
|
||||
print(" colors:" + str(len(mesh.colors)))
|
||||
tcs = mesh.texturecoords
|
||||
if tcs.any():
|
||||
for tc_index, tc in enumerate(tcs):
|
||||
print(" texture-coords "+ str(tc_index) + ":" + str(len(tcs[tc_index])) + "first3:" + str(tcs[tc_index][:3]))
|
||||
|
||||
else:
|
||||
print(" no texture coordinates")
|
||||
print(" uv-component-count:" + str(len(mesh.numuvcomponents)))
|
||||
print(" faces:" + str(len(mesh.faces)) + " -> first:\n" + str(mesh.faces[:3]))
|
||||
print(" bones:" + str(len(mesh.bones)) + " -> first:" + str([str(b) for b in mesh.bones[:3]]))
|
||||
print
|
||||
|
||||
print("MATERIALS:")
|
||||
for index, material in enumerate(scene.materials):
|
||||
print(" MATERIAL (id:" + str(index+1) + ")")
|
||||
for key, value in material.properties.items():
|
||||
print(" %s: %s" % (key, value))
|
||||
print
|
||||
|
||||
print("TEXTURES:")
|
||||
for index, texture in enumerate(scene.textures):
|
||||
print(" TEXTURE" + str(index+1))
|
||||
print(" width:" + str(texture.width))
|
||||
print(" height:" + str(texture.height))
|
||||
print(" hint:" + str(texture.achformathint))
|
||||
print(" data (size):" + str(len(texture.data)))
|
||||
|
||||
# Finally release the model
|
||||
pyassimp.release(scene)
|
||||
|
||||
def usage():
|
||||
print("Usage: sample.py <3d model>")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
usage()
|
||||
else:
|
||||
main(sys.argv[1])
|
File diff suppressed because it is too large
Load Diff
26
thirdparty/assimp/port/PyAssimp/setup.py
vendored
26
thirdparty/assimp/port/PyAssimp/setup.py
vendored
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
from distutils.core import setup
|
||||
|
||||
def readme():
|
||||
with open('README.rst') as f:
|
||||
return f.read()
|
||||
|
||||
setup(name='pyassimp',
|
||||
version='4.1.4',
|
||||
license='ISC',
|
||||
description='Python bindings for the Open Asset Import Library (ASSIMP)',
|
||||
long_description=readme(),
|
||||
url='https://github.com/assimp/assimp',
|
||||
author='ASSIMP developers',
|
||||
author_email='assimp-discussions@lists.sourceforge.net',
|
||||
maintainer='Séverin Lemaignan',
|
||||
maintainer_email='severin@guakamole.org',
|
||||
packages=['pyassimp'],
|
||||
data_files=[
|
||||
('share/pyassimp', ['README.rst']),
|
||||
('share/examples/pyassimp', ['scripts/' + f for f in os.listdir('scripts/')])
|
||||
],
|
||||
requires=['numpy']
|
||||
)
|
13
thirdparty/assimp/port/dAssimp/README
vendored
13
thirdparty/assimp/port/dAssimp/README
vendored
@ -1,13 +0,0 @@
|
||||
D bindings for the Assimp library (http://assimp.sf.net).
|
||||
---
|
||||
|
||||
These bindings provide access to Assimp's C API. They were directly created
|
||||
from the C header files.
|
||||
|
||||
You should be able to create sufficient DDoc documentation for the bindings
|
||||
using your favourite build tool (such as Rebuild). Please refer to the main
|
||||
(Doxygen-generated) documentation for general topics.
|
||||
|
||||
Please note that the bindings have only been tested on 32 bit systems, they have
|
||||
yet to be adapted for the different size of the integer types in 64 bit builds
|
||||
of Assimp.
|
240
thirdparty/assimp/port/dAssimp/assimp/animation.d
vendored
240
thirdparty/assimp/port/dAssimp/assimp/animation.d
vendored
@ -1,240 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The data structures which are used to store the imported animation data.
|
||||
*/
|
||||
module assimp.animation;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* A time-value pair specifying a certain 3D vector for the given time.
|
||||
*/
|
||||
struct aiVectorKey {
|
||||
/**
|
||||
* The time of this key.
|
||||
*/
|
||||
double mTime;
|
||||
|
||||
/**
|
||||
* The value of this key.
|
||||
*/
|
||||
aiVector3D mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* A time-value pair specifying a rotation for the given time. For joint
|
||||
* animations, the rotation is usually expressed using a quaternion.
|
||||
*/
|
||||
struct aiQuatKey {
|
||||
/**
|
||||
* The time of this key.
|
||||
*/
|
||||
double mTime;
|
||||
|
||||
/**
|
||||
* The value of this key.
|
||||
*/
|
||||
aiQuaternion mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how an animation channel behaves outside the defined time
|
||||
* range. This corresponds to <code>aiNodeAnim.mPreState</code> and
|
||||
* <code>aiNodeAnim.mPostState</code>.
|
||||
*/
|
||||
enum aiAnimBehaviour : uint {
|
||||
/**
|
||||
* The value from the default node transformation is used.
|
||||
*/
|
||||
DEFAULT = 0x0,
|
||||
|
||||
/**
|
||||
* The nearest key value is used without interpolation.
|
||||
*/
|
||||
CONSTANT = 0x1,
|
||||
|
||||
/**
|
||||
* The value of the nearest two keys is linearly extrapolated for the
|
||||
* current time value.
|
||||
*/
|
||||
LINEAR = 0x2,
|
||||
|
||||
/**
|
||||
* The animation is repeated.
|
||||
*
|
||||
* If the animation key go from n to m and the current time is t, use the
|
||||
* value at (t-n) % (|m-n|).
|
||||
*/
|
||||
REPEAT = 0x3
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the animation of a single node.
|
||||
*
|
||||
* The name specifies the bone/node which is affected by this animation
|
||||
* channel. The keyframes are given in three separate series of values, one
|
||||
* each for position, rotation and scaling. The transformation matrix
|
||||
* computed from these values replaces the node's original transformation
|
||||
* matrix at a specific time. This means all keys are absolute and not
|
||||
* relative to the bone default pose.
|
||||
*
|
||||
* The order in which the transformations are applied is –
|
||||
* as usual – scaling, rotation, translation.
|
||||
*
|
||||
* Note: All keys are returned in their correct, chronological order.
|
||||
* Duplicate keys don't pass the validation step. Most likely there will
|
||||
* be no negative time values, but they are not forbidden (so
|
||||
* implementations need to cope with them!).
|
||||
*/
|
||||
struct aiNodeAnim {
|
||||
/**
|
||||
* The name of the node affected by this animation. The node must exist
|
||||
* and it must be unique.
|
||||
*/
|
||||
aiString mNodeName;
|
||||
|
||||
/**
|
||||
* The number of position keys.
|
||||
*/
|
||||
uint mNumPositionKeys;
|
||||
|
||||
/**
|
||||
* The position keys of this animation channel. Positions are specified
|
||||
* as 3D vectors. The array is <code>mNumPositionKeys</code> in size.
|
||||
*
|
||||
* If there are position keys, there will also be at least one scaling
|
||||
* and one rotation key.
|
||||
*/
|
||||
aiVectorKey* mPositionKeys;
|
||||
|
||||
/**
|
||||
* The number of rotation keys.
|
||||
*/
|
||||
uint mNumRotationKeys;
|
||||
|
||||
/**
|
||||
* The rotation keys of this animation channel. Rotations are given as
|
||||
* quaternions. The array is <code>mNumRotationKeys</code> in size.
|
||||
*
|
||||
* If there are rotation keys, there will also be at least one scaling
|
||||
* and one position key.
|
||||
*/
|
||||
aiQuatKey* mRotationKeys;
|
||||
|
||||
|
||||
/**
|
||||
* The number of scaling keys.
|
||||
*/
|
||||
uint mNumScalingKeys;
|
||||
|
||||
/**
|
||||
* The scaling keys of this animation channel. Scalings are specified as
|
||||
* 3D vectors. The array is <code>mNumScalingKeys</code> in size.
|
||||
*
|
||||
* If there are scaling keys, there will also be at least one position
|
||||
* and one rotation key.
|
||||
*/
|
||||
aiVectorKey* mScalingKeys;
|
||||
|
||||
|
||||
/**
|
||||
* Defines how the animation behaves before the first key is encountered.
|
||||
*
|
||||
* The default value is <code>aiAnimBehaviour.DEFAULT</code> (the original
|
||||
* transformation matrix of the affected node is used).
|
||||
*/
|
||||
aiAnimBehaviour mPreState;
|
||||
|
||||
/**
|
||||
* Defines how the animation behaves after the last key was processed.
|
||||
*
|
||||
* The default value is <code>aiAnimBehaviour.DEFAULT</code> (the original
|
||||
* transformation matrix of the affected node is used).
|
||||
*/
|
||||
aiAnimBehaviour mPostState;
|
||||
}
|
||||
|
||||
/**
|
||||
* An animation consists of keyframe data for a number of nodes.
|
||||
*
|
||||
* For each node affected by the animation, a separate series of data is
|
||||
* given.
|
||||
*/
|
||||
struct aiAnimation {
|
||||
/**
|
||||
* The name of the animation.
|
||||
*
|
||||
* If the modeling package this data was
|
||||
* exported from does support only a single animation channel, this
|
||||
* name is usually empty (length is zero).
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* Duration of the animation in ticks.
|
||||
*/
|
||||
double mDuration;
|
||||
|
||||
/**
|
||||
* Ticks per second. 0 if not specified in the imported file.
|
||||
*/
|
||||
double mTicksPerSecond;
|
||||
|
||||
/**
|
||||
* The number of bone animation channels.
|
||||
*
|
||||
* Each channel affects a single node.
|
||||
*/
|
||||
uint mNumChannels;
|
||||
|
||||
/**
|
||||
* The node animation channels. The array is <code>mNumChannels</code>
|
||||
* in size.
|
||||
*
|
||||
* Each channel affects a single node.
|
||||
*/
|
||||
aiNodeAnim** mChannels;
|
||||
}
|
||||
}
|
686
thirdparty/assimp/port/dAssimp/assimp/api.d
vendored
686
thirdparty/assimp/port/dAssimp/assimp/api.d
vendored
@ -1,686 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The C-style interface to the Open Asset import library.
|
||||
*
|
||||
* All functions of the C API have been collected in this module as function
|
||||
* pointers, which are set by the dynamic library loader
|
||||
* (<code>assimp.loader</code>).
|
||||
*/
|
||||
module assimp.api;
|
||||
|
||||
import assimp.fileIO;
|
||||
import assimp.material;
|
||||
import assimp.math;
|
||||
import assimp.scene;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Reads the given file and returns its content.
|
||||
*
|
||||
* If the call succeeds, the imported data is returned in an <code>aiScene</code>
|
||||
* structure. The data is intended to be read-only, it stays property of the
|
||||
* Assimp library and will be stable until <code>aiReleaseImport()</code> is
|
||||
* called. After you're done with it, call <code>aiReleaseImport()</code> to
|
||||
* free the resources associated with this file.
|
||||
*
|
||||
* If an error is encountered, null is returned instead. Call
|
||||
* <code>aiGetErrorString()</code> to retrieve a human-readable error
|
||||
* description.
|
||||
*
|
||||
* Params:
|
||||
* pFile = Path and filename of the file to be imported,
|
||||
* expected to be a null-terminated C-string. null is not a valid value.
|
||||
* pFlags = Optional post processing steps to be executed after a
|
||||
* successful import. Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags. If you wish to inspect the
|
||||
* imported scene first in order to fine-tune your post-processing
|
||||
* setup, consider to use <code>aiApplyPostProcessing()</code>.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the imported data, null if the import failed.
|
||||
*/
|
||||
aiScene* function( char* pFile, uint pFile ) aiImportFile;
|
||||
|
||||
/**
|
||||
* Reads the given file using user-defined I/O functions and returns its
|
||||
* content.
|
||||
*
|
||||
* If the call succeeds, the imported data is returned in an <code>aiScene</code>
|
||||
* structure. The data is intended to be read-only, it stays property of the
|
||||
* Assimp library and will be stable until <code>aiReleaseImport()</code> is
|
||||
* called. After you're done with it, call <code>aiReleaseImport()</code> to
|
||||
* free the resources associated with this file.
|
||||
*
|
||||
* If an error is encountered, null is returned instead. Call
|
||||
* <code>aiGetErrorString()</code> to retrieve a human-readable error
|
||||
* description.
|
||||
*
|
||||
* Params:
|
||||
* pFile = Path and filename of the file to be imported,
|
||||
* expected to be a null-terminated C-string. null is not a valid value.
|
||||
* pFlags = Optional post processing steps to be executed after a
|
||||
* successful import. Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags. If you wish to inspect the
|
||||
* imported scene first in order to fine-tune your post-processing
|
||||
* setup, consider to use <code>aiApplyPostProcessing()</code>.
|
||||
* pFS = An aiFileIO which will be used to open the model file itself
|
||||
* and any other files the loader needs to open.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the imported data, null if the import failed.
|
||||
*/
|
||||
aiScene* function( char* pFile, uint pFlags, aiFileIO* pFS ) aiImportFileEx;
|
||||
|
||||
/**
|
||||
* Reads the scene from the given memory buffer.
|
||||
*
|
||||
* Reads the given file using user-defined I/O functions and returns its
|
||||
* content.
|
||||
*
|
||||
* If the call succeeds, the imported data is returned in an <code>aiScene</code>
|
||||
* structure. The data is intended to be read-only, it stays property of the
|
||||
* Assimp library and will be stable until <code>aiReleaseImport()</code> is
|
||||
* called. After you're done with it, call <code>aiReleaseImport()</code> to
|
||||
* free the resources associated with this file.
|
||||
*
|
||||
* If an error is encountered, null is returned instead. Call
|
||||
* <code>aiGetErrorString()</code> to retrieve a human-readable error
|
||||
* description.
|
||||
*
|
||||
* Params:
|
||||
* pBuffer = Pointer to the scene data.
|
||||
* pLength = Size of pBuffer in bytes.
|
||||
* pFlags = Optional post processing steps to be executed after a
|
||||
* successful import. Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags. If you wish to inspect the
|
||||
* imported scene first in order to fine-tune your post-processing
|
||||
* setup, consider to use <code>aiApplyPostProcessing()</code>.
|
||||
* pHint = An additional hint to the library. If this is a non empty
|
||||
* string, the library looks for a loader to support the file
|
||||
* extension specified and passes the file to the first matching
|
||||
* loader. If this loader is unable to complete the request, the
|
||||
* library continues and tries to determine the file format on its
|
||||
* own, a task that may or may not be successful.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the imported data, null if the import failed.
|
||||
*
|
||||
* Note:
|
||||
* This is a straightforward way to decode models from memory buffers,
|
||||
* but it doesn't handle model formats spreading their data across
|
||||
* multiple files or even directories. Examples include OBJ or MD3, which
|
||||
* outsource parts of their material stuff into external scripts. If you
|
||||
* need the full functionality, provide a custom IOSystem to make Assimp
|
||||
* find these files.
|
||||
*/
|
||||
aiScene* function(
|
||||
char* pBuffer,
|
||||
uint pLength,
|
||||
uint pFlags,
|
||||
char* pHint
|
||||
) aiImportFileFromMemory;
|
||||
|
||||
/**
|
||||
* Apply post-processing to an already-imported scene.
|
||||
*
|
||||
* This is strictly equivalent to calling <code>aiImportFile()</code> or
|
||||
* <code>aiImportFileEx()</code> with the same flags. However, you can use
|
||||
* this separate function to inspect the imported scene first to fine-tune
|
||||
* your post-processing setup.
|
||||
*
|
||||
* Params:
|
||||
* pScene = Scene to work on.
|
||||
* pFlags = Provide a bitwise combination of the
|
||||
* <code>aiPostProcessSteps</code> flags.
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to the post-processed data. Post processing is done in-place,
|
||||
* meaning this is still the same <code>aiScene</code> which you passed
|
||||
* for pScene. However, if post-processing failed, the scene could now be
|
||||
* null. That's quite a rare case, post processing steps are not really
|
||||
* designed to fail. To be exact, <code>aiProcess.ValidateDS</code> is
|
||||
* currently the only post processing step which can actually cause the
|
||||
* scene to be reset to null.
|
||||
*/
|
||||
aiScene* function( aiScene* pScene, uint pFlags ) aiApplyPostProcessing;
|
||||
|
||||
/**
|
||||
* Get one of the predefined log streams. This is the quick'n'easy solution
|
||||
* to access Assimp's log system. Attaching a log stream can slightly reduce
|
||||
* Assimp's overall import performance.
|
||||
*
|
||||
* Examples:
|
||||
* ---
|
||||
* aiLogStream stream = aiGetPredefinedLogStream(
|
||||
* aiDefaultLogStream.FILE, "assimp.log.txt" );
|
||||
* if ( stream.callback !is null ) {
|
||||
* aiAttachLogStream( &stream );
|
||||
* }
|
||||
* ---
|
||||
*
|
||||
* Params:
|
||||
* pStreams = The log stream destination.
|
||||
* file = Solely for the <code>aiDefaultLogStream.FILE</code> flag:
|
||||
* specifies the file to write to. Pass null for all other flags.
|
||||
*
|
||||
* Returns:
|
||||
* The log stream, null if something went wrong.
|
||||
*/
|
||||
aiLogStream function( aiDefaultLogStream pStreams, char* file ) aiGetPredefinedLogStream;
|
||||
|
||||
/**
|
||||
* Attach a custom log stream to the libraries' logging system.
|
||||
*
|
||||
* Attaching a log stream can slightly reduce Assimp's overall import
|
||||
* performance. Multiple log-streams can be attached.
|
||||
*
|
||||
* Params:
|
||||
* stream = Describes the new log stream.
|
||||
*
|
||||
* Note: To ensure proper destruction of the logging system, you need to
|
||||
* manually call <code>aiDetachLogStream()</code> on every single log
|
||||
* stream you attach. Alternatively, <code>aiDetachAllLogStreams()</code>
|
||||
* is provided.
|
||||
*/
|
||||
void function( aiLogStream* stream ) aiAttachLogStream;
|
||||
|
||||
/**
|
||||
* Enable verbose logging.
|
||||
*
|
||||
* Verbose logging includes debug-related stuff and detailed import
|
||||
* statistics. This can have severe impact on import performance and memory
|
||||
* consumption. However, it might be useful to find out why a file is not
|
||||
* read correctly.
|
||||
*
|
||||
* Param:
|
||||
* d = Whether verbose logging should be enabled.
|
||||
*/
|
||||
void function( aiBool d ) aiEnableVerboseLogging;
|
||||
|
||||
/**
|
||||
* Detach a custom log stream from the libraries' logging system.
|
||||
*
|
||||
* This is the counterpart of #aiAttachPredefinedLogStream. If you attached a stream,
|
||||
* don't forget to detach it again.
|
||||
*
|
||||
* Params:
|
||||
* stream = The log stream to be detached.
|
||||
*
|
||||
* Returns:
|
||||
* <code>aiReturn.SUCCESS</code> if the log stream has been detached
|
||||
* successfully.
|
||||
*
|
||||
* See: <code>aiDetachAllLogStreams</code>
|
||||
*/
|
||||
aiReturn function( aiLogStream* stream ) aiDetachLogStream;
|
||||
|
||||
/**
|
||||
* Detach all active log streams from the libraries' logging system.
|
||||
*
|
||||
* This ensures that the logging system is terminated properly and all
|
||||
* resources allocated by it are actually freed. If you attached a stream,
|
||||
* don't forget to detach it again.
|
||||
*
|
||||
* See: <code>aiAttachLogStream</code>, <code>aiDetachLogStream</code>
|
||||
*/
|
||||
void function() aiDetachAllLogStreams;
|
||||
|
||||
/**
|
||||
* Releases all resources associated with the given import process.
|
||||
*
|
||||
* Call this function after you're done with the imported data.
|
||||
*
|
||||
* Params:
|
||||
* pScene = The imported data to release. null is a valid value.
|
||||
*/
|
||||
void function( aiScene* pScene ) aiReleaseImport;
|
||||
|
||||
/**
|
||||
* Returns the error text of the last failed import process.
|
||||
*
|
||||
* Returns:
|
||||
* A textual description of the error that occurred at the last importing
|
||||
* process. null if there was no error. There can't be an error if you
|
||||
* got a non-null <code>aiScene</code> from
|
||||
* <code>aiImportFile()/aiImportFileEx()/aiApplyPostProcessing()</code>.
|
||||
*/
|
||||
char* function() aiGetErrorString;
|
||||
|
||||
/**
|
||||
* Returns whether a given file extension is supported by this Assimp build.
|
||||
*
|
||||
* Params:
|
||||
* szExtension = Extension for which to query support. Must include a
|
||||
* leading dot '.'. Example: ".3ds", ".md3"
|
||||
*
|
||||
* Returns:
|
||||
* <code>TRUE</code> if the file extension is supported.
|
||||
*/
|
||||
aiBool function( char* szExtension ) aiIsExtensionSupported;
|
||||
|
||||
/**
|
||||
* Gets a list of all file extensions supported by ASSIMP.
|
||||
*
|
||||
* Format of the list: "*.3ds;*.obj;*.dae".
|
||||
*
|
||||
* If a file extension is contained in the list this does, of course, not
|
||||
* mean that Assimp is able to load all files with this extension.
|
||||
*
|
||||
* Params:
|
||||
* szOut = String to receive the extension list. null is not a valid
|
||||
* parameter.
|
||||
*/
|
||||
void function( aiString* szOut ) aiGetExtensionList;
|
||||
|
||||
/**
|
||||
* Gets the storage required by an imported asset
|
||||
*
|
||||
* Params:
|
||||
* pIn = Asset to query storage size for.
|
||||
* info = Data structure to be filled.
|
||||
*/
|
||||
void function( aiScene* pIn, aiMemoryInfo* info ) aiGetMemoryRequirements;
|
||||
|
||||
/**
|
||||
* Sets an integer property.
|
||||
*
|
||||
* Properties are always shared by all imports. It is not possible to
|
||||
* specify them per import.
|
||||
*
|
||||
* Params:
|
||||
* szName = Name of the configuration property to be set. All supported
|
||||
* public properties are defined in the <code>config</code> module.
|
||||
* value = New value for the property.
|
||||
*/
|
||||
void function( char* szName, int value ) aiSetImportPropertyInteger;
|
||||
|
||||
/**
|
||||
* Sets a floating-point property.
|
||||
*
|
||||
* Properties are always shared by all imports. It is not possible to
|
||||
* specify them per import.
|
||||
*
|
||||
* Params:
|
||||
* szName = Name of the configuration property to be set. All supported
|
||||
* public properties are defined in the <code>config</code> module.
|
||||
* value = New value for the property.
|
||||
*/
|
||||
void function( char* szName, float value ) aiSetImportPropertyFloat;
|
||||
|
||||
/**
|
||||
* Sets a string property.
|
||||
*
|
||||
* Properties are always shared by all imports. It is not possible to
|
||||
* specify them per import.
|
||||
*
|
||||
* Params:
|
||||
* szName = Name of the configuration property to be set. All supported
|
||||
* public properties are defined in the <code>config</code> module.
|
||||
* st = New value for the property.
|
||||
*/
|
||||
void function( char* szName, aiString* st ) aiSetImportPropertyString;
|
||||
|
||||
|
||||
/*
|
||||
* Mathematical helper functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a quaternion from a 3x3 rotation matrix.
|
||||
*
|
||||
* Params:
|
||||
* quat = Receives the output quaternion.
|
||||
* mat = Matrix to 'quaternionize'.
|
||||
*/
|
||||
void function( aiQuaternion* quat, aiMatrix3x3* mat ) aiCreateQuaternionFromMatrix;
|
||||
|
||||
/**
|
||||
* Decomposes a transformation matrix into its rotational, translational and
|
||||
* scaling components.
|
||||
*
|
||||
* Params:
|
||||
* mat = Matrix to decompose.
|
||||
* scaling = Receives the scaling component.
|
||||
* rotation = Receives the rotational component.
|
||||
* position = Receives the translational component.
|
||||
*/
|
||||
void function(
|
||||
aiMatrix4x4* mat,
|
||||
aiVector3D* scaling,
|
||||
aiQuaternion* rotation,
|
||||
aiVector3D* position
|
||||
) aiDecomposeMatrix;
|
||||
|
||||
/**
|
||||
* Transposes a 4x4 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* mat = The matrix to be transposed.
|
||||
*/
|
||||
void function( aiMatrix4x4* mat ) aiTransposeMatrix4;
|
||||
|
||||
/**
|
||||
* Transposes a 3x3 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* mat = The matrix to be transposed.
|
||||
*/
|
||||
void function( aiMatrix3x3* mat ) aiTransposeMatrix3;
|
||||
|
||||
/**
|
||||
* Transforms a vector by a 3x3 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* vec = Vector to be transformed.
|
||||
* mat = Matrix to transform the vector with.
|
||||
*/
|
||||
void function( aiVector3D* vec, aiMatrix3x3* mat ) aiTransformVecByMatrix3;
|
||||
|
||||
/**
|
||||
* Transforms a vector by a 4x4 matrix (in-place).
|
||||
*
|
||||
* Params:
|
||||
* vec = Vector to be transformed.
|
||||
* mat = Matrix to transform the vector with.
|
||||
*/
|
||||
void function( aiVector3D* vec, aiMatrix4x4* mat ) aiTransformVecByMatrix4;
|
||||
|
||||
/**
|
||||
* Multiplies two 4x4 matrices.
|
||||
*
|
||||
* Params:
|
||||
* dst = First factor, receives result.
|
||||
* src = Matrix to be multiplied with 'dst'.
|
||||
*/
|
||||
void function( aiMatrix4x4* dst, aiMatrix4x4* src ) aiMultiplyMatrix4;
|
||||
|
||||
/**
|
||||
* Multiplies two 3x3 matrices.
|
||||
*
|
||||
* Params:
|
||||
* dst = First factor, receives result.
|
||||
* src = Matrix to be multiplied with 'dst'.
|
||||
*/
|
||||
void function( aiMatrix3x3* dst, aiMatrix3x3* src ) aiMultiplyMatrix3;
|
||||
|
||||
/**
|
||||
* Constructs a 3x3 identity matrix.
|
||||
*
|
||||
* Params:
|
||||
* mat = Matrix to receive its personal identity.
|
||||
*/
|
||||
void function( aiMatrix3x3* mat ) aiIdentityMatrix3;
|
||||
|
||||
/**
|
||||
* Constructs a 4x4 identity matrix.
|
||||
*
|
||||
* Params:
|
||||
* mat = Matrix to receive its personal identity.
|
||||
*/
|
||||
void function( aiMatrix4x4* mat ) aiIdentityMatrix4;
|
||||
|
||||
|
||||
/*
|
||||
* Material system functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieves a material property with a specific key from the material.
|
||||
*
|
||||
* Params:
|
||||
* pMat = Pointer to the input material. May not be null.
|
||||
* pKey = Key to search for. One of the <code>AI_MATKEY_XXX</code>
|
||||
* constants.
|
||||
* type = Specifies the <code>aiTextureType</code> of the texture to be
|
||||
* retrieved, 0 for non-texture properties.
|
||||
* index = Index of the texture to be retrieved,
|
||||
* 0 for non-texture properties.
|
||||
* pPropOut = Pointer to receive a pointer to a valid
|
||||
* <code>aiMaterialProperty</code> structure or null if the key has
|
||||
* not been found.
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
aiMaterialProperty** pPropOut
|
||||
) aiGetMaterialProperty;
|
||||
|
||||
/**
|
||||
* Retrieves a single float value or an array of float values from the
|
||||
* material.
|
||||
*
|
||||
* Examples:
|
||||
* ---
|
||||
* const FLOATS_IN_UV_TRANSFORM = ( aiUVTransform.sizeof / float.sizeof );
|
||||
* uint valuesRead = FLOATS_IN_UV_TRANSFORM;
|
||||
* bool success =
|
||||
* ( aiGetMaterialFloatArray( &material, AI_MATKEY_UVTRANSFORM,
|
||||
* aiTextureType.DIFFUSE, 0, cast( float* ) &trafo, &valuesRead ) ==
|
||||
* aiReturn.SUCCESS ) &&
|
||||
* ( valuesRead == FLOATS_IN_UV_TRANSFORM );
|
||||
* ---
|
||||
*
|
||||
* Params:
|
||||
* pMat = Pointer to the input material. May not be null.
|
||||
* pKey = Key to search for. One of the AI_MATKEY_XXX constants.
|
||||
* type = Specifies the <code>aiTextureType</code> of the texture to be
|
||||
* retrieved, 0 for non-texture properties.
|
||||
* index = Index of the texture to be retrieved,
|
||||
* 0 for non-texture properties.
|
||||
* pOut = Pointer to a buffer to receive the result.
|
||||
* pMax = Specifies the size of the given buffer in floats. Receives the
|
||||
* number of values (not bytes!) read. null to read a scalar property.
|
||||
*
|
||||
* Returns:
|
||||
* Specifies whether the key has been found. If not, the output arrays
|
||||
* remains unmodified and pMax is set to 0.
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
float* pOut,
|
||||
uint* pMax = null
|
||||
) aiGetMaterialFloatArray;
|
||||
|
||||
/**
|
||||
* Convenience alias for <code>aiGetMaterialFloatArray()</code>.
|
||||
*/
|
||||
alias aiGetMaterialFloatArray aiGetMaterialFloat;
|
||||
|
||||
/**
|
||||
* Retrieves a single integer value or an array of integer values from the
|
||||
* material.
|
||||
*
|
||||
* See: <code>aiGetMaterialFloatArray()</code>
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
int* pOut,
|
||||
uint* pMax = null
|
||||
) aiGetMaterialIntegerArray;
|
||||
|
||||
/**
|
||||
* Convenience alias for <code>aiGetMaterialIntegerArray()</code>.
|
||||
*/
|
||||
alias aiGetMaterialIntegerArray aiGetMaterialInteger;
|
||||
|
||||
/**
|
||||
* Retrieves a color value from the material.
|
||||
*
|
||||
* See: <code>aiGetMaterialFloatArray()</code>
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
aiColor4D* pOut
|
||||
) aiGetMaterialColor;
|
||||
|
||||
/**
|
||||
* Retrieves a string value from the material.
|
||||
*
|
||||
* See: <code>aiGetMaterialFloatArray()</code>
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* pMat,
|
||||
char* pKey,
|
||||
uint type,
|
||||
uint index,
|
||||
aiString* pOut
|
||||
) aiGetMaterialString;
|
||||
|
||||
/**
|
||||
* Get the number of textures for a particular texture type.
|
||||
*
|
||||
* Params:
|
||||
* pMat = Pointer to the input material. May not be NULL
|
||||
* type = Texture type to check for
|
||||
*
|
||||
* Returns:
|
||||
* Number of textures for this type.
|
||||
*/
|
||||
uint function( aiMaterial* pMat, aiTextureType type ) aiGetMaterialTextureCount;
|
||||
|
||||
/**
|
||||
* Helper function to get all values pertaining to a particular texture slot
|
||||
* from a material structure.
|
||||
*
|
||||
* This function is provided just for convenience. You could also read the
|
||||
* texture by parsing all of its properties manually. This function bundles
|
||||
* all of them in a huge function monster.
|
||||
*
|
||||
* Params:
|
||||
* mat = Pointer to the input material. May not be null.
|
||||
* type = Specifies the texture stack (<code>aiTextureType</code>) to
|
||||
* read from.
|
||||
* index = Index of the texture. The function fails if the requested
|
||||
* index is not available for this texture type.
|
||||
* <code>aiGetMaterialTextureCount()</code> can be used to determine
|
||||
* the number of textures in a particular texture stack.
|
||||
* path = Receives the output path. null is not a valid value.
|
||||
* mapping = Receives the texture mapping mode to be used.
|
||||
* Pass null if you are not interested in this information.
|
||||
* uvindex = For UV-mapped textures: receives the index of the UV source
|
||||
* channel. Unmodified otherwise. Pass null if you are not interested
|
||||
* in this information.
|
||||
* blend = Receives the blend factor for the texture.
|
||||
* Pass null if you are not interested in this information.
|
||||
* op = Receives the texture blend operation to be perform between this
|
||||
* texture and the previous texture. Pass null if you are not
|
||||
* interested in this information.
|
||||
* mapmode = Receives the mapping modes to be used for the texture. Pass
|
||||
* a pointer to an array of two aiTextureMapMode's (one for each axis,
|
||||
* UV order) or null if you are not interested in this information.
|
||||
*
|
||||
* Returns:
|
||||
* <code>aiReturn.SUCCESS</code> on success, otherwise something else.
|
||||
*/
|
||||
aiReturn function(
|
||||
aiMaterial* mat,
|
||||
aiTextureType type,
|
||||
uint index,
|
||||
aiString* path,
|
||||
aiTextureMapping* mapping = null,
|
||||
uint* uvindex = null,
|
||||
float* blend = null,
|
||||
aiTextureOp* op = null,
|
||||
aiTextureMapMode* mapmode = null
|
||||
) aiGetMaterialTexture;
|
||||
|
||||
|
||||
/*
|
||||
* Versioning functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a string with legal copyright and licensing information about
|
||||
* Assimp.
|
||||
*
|
||||
* The string may include multiple lines.
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to static string.
|
||||
*/
|
||||
char* function() aiGetLegalString;
|
||||
|
||||
/**
|
||||
* Returns the current minor version number of the Assimp library.
|
||||
*
|
||||
* Returns:
|
||||
* Minor version of the Assimp library.
|
||||
*/
|
||||
uint function() aiGetVersionMinor;
|
||||
|
||||
/**
|
||||
* Returns the current major version number of the Assimp library.
|
||||
*
|
||||
* Returns:
|
||||
* Major version of the Assimp library.
|
||||
*/
|
||||
uint function() aiGetVersionMajor;
|
||||
|
||||
/**
|
||||
* Returns the repository revision of the Assimp library.
|
||||
*
|
||||
* Returns:
|
||||
* SVN Repository revision number of the Assimp library.
|
||||
*/
|
||||
uint function() aiGetVersionRevision;
|
||||
|
||||
/**
|
||||
* Returns the flags Assimp was compiled with.
|
||||
*
|
||||
* Returns:
|
||||
* Any bitwise combination of the ASSIMP_CFLAGS_xxx constants.
|
||||
*/
|
||||
uint function() aiGetCompileFlags;
|
||||
}
|
63
thirdparty/assimp/port/dAssimp/assimp/assimp.d
vendored
63
thirdparty/assimp/port/dAssimp/assimp/assimp.d
vendored
@ -1,63 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include-all module provided for convenience.
|
||||
*/
|
||||
module assimp.assimp;
|
||||
|
||||
public {
|
||||
import assimp.animation;
|
||||
import assimp.api;
|
||||
import assimp.camera;
|
||||
import assimp.config;
|
||||
import assimp.fileIO;
|
||||
import assimp.light;
|
||||
import assimp.loader;
|
||||
import assimp.material;
|
||||
import assimp.math;
|
||||
import assimp.mesh;
|
||||
import assimp.postprocess;
|
||||
import assimp.scene;
|
||||
import assimp.texture;
|
||||
import assimp.types;
|
||||
import assimp.versionInfo;
|
||||
}
|
182
thirdparty/assimp/port/dAssimp/assimp/camera.d
vendored
182
thirdparty/assimp/port/dAssimp/assimp/camera.d
vendored
@ -1,182 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structure which is used to store the imported information
|
||||
* about the virtual cameras in the scene.
|
||||
*/
|
||||
module assimp.camera;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Helper structure to describe a virtual camera.
|
||||
*
|
||||
* Cameras have a representation in the node graph and can be animated.
|
||||
* An important aspect is that the camera itself is also part of the
|
||||
* scenegraph. This means, any values such as the look-at vector are not
|
||||
* absolute, they're <em>relative</em> to the coordinate system defined
|
||||
* by the node which corresponds to the camera. This allows for camera
|
||||
* animations. Static cameras parameters like the look-at or up vectors are
|
||||
* usually specified directly in the class members, but beware, they could
|
||||
* also be encoded in the node transformation. The following (pseudo)code
|
||||
* sample shows how to do it.
|
||||
*
|
||||
* Examples:
|
||||
* ---
|
||||
* // Get the camera matrix for a camera at a specific time
|
||||
* // if the node hierarchy for the camera does not contain
|
||||
* // at least one animated node this is a static computation
|
||||
* get-camera-matrix (node sceneRoot, camera cam) : matrix
|
||||
* {
|
||||
* node cnd = find-node-for-camera(cam)
|
||||
* matrix cmt = identity()
|
||||
*
|
||||
* // as usual - get the absolute camera transformation for this frame
|
||||
* for each node nd in hierarchy from sceneRoot to cnd
|
||||
* matrix cur
|
||||
* if (is-animated(nd))
|
||||
* cur = eval-animation(nd)
|
||||
* else cur = nd->mTransformation;
|
||||
* cmt = mult-matrices( cmt, cur )
|
||||
* end for
|
||||
*
|
||||
* // now multiply with the camera's own local transform
|
||||
* cam = mult-matrices (cam, get-camera-matrix(cmt) )
|
||||
* }
|
||||
* ---
|
||||
*
|
||||
* Note: Some file formats (such as 3DS, ASE) export a "target point" – the
|
||||
* point the camera is looking at (it can even be animated). Assimp
|
||||
* writes the target point as a subnode of the camera's main node, called
|
||||
* "<camName>.Target". However, this is just additional information; the
|
||||
* transformation applied to the main camera node already makes the
|
||||
* camera face the right direction.
|
||||
*/
|
||||
struct aiCamera {
|
||||
/**
|
||||
* The name of the camera.
|
||||
*
|
||||
* There must be a node in the scenegraph with the same name. This node
|
||||
* specifies the position of the camera in the scene hierarchy and can
|
||||
* be animated.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
|
||||
/**
|
||||
* Position of the camera relative to the coordinate space defined by the
|
||||
* corresponding node.
|
||||
*
|
||||
* The default value is 0|0|0.
|
||||
*/
|
||||
aiVector3D mPosition;
|
||||
|
||||
/**
|
||||
* Up vector of the camera coordinate system relative to the
|
||||
* coordinate space defined by the corresponding node.
|
||||
*
|
||||
* The right vector of the camera coordinate system is the cross
|
||||
* product of the up and lookAt vectors.
|
||||
*
|
||||
* The default value is 0|1|0. The vector may be normalized, but it
|
||||
* needn't.
|
||||
*/
|
||||
aiVector3D mUp;
|
||||
|
||||
/**
|
||||
* Look-at vector of the camera coordinate system relative to the
|
||||
* coordinate space defined by the corresponding node.
|
||||
*
|
||||
* This is the viewing direction of the user.
|
||||
*
|
||||
* The default value is 0|0|1. The vector may be normalized, but it
|
||||
* needn't.
|
||||
*/
|
||||
aiVector3D mLookAt;
|
||||
|
||||
|
||||
/**
|
||||
* Half horizontal field of view angle, in radians.
|
||||
*
|
||||
* The field of view angle is the angle between the center line of the
|
||||
* screen and the left or right border.
|
||||
*
|
||||
* The default value is PI/4.
|
||||
*/
|
||||
float mHorizontalFOV;
|
||||
|
||||
/**
|
||||
* Distance of the near clipping plane from the camera.
|
||||
*
|
||||
* The value may not be 0.f (for arithmetic reasons to prevent
|
||||
* a division through zero).
|
||||
*
|
||||
* The default value is 0.1f.
|
||||
*/
|
||||
float mClipPlaneNear;
|
||||
|
||||
/**
|
||||
* Distance of the far clipping plane from the camera.
|
||||
*
|
||||
* The far clipping plane must, of course, be further away than the
|
||||
* near clipping plane. The ratio between the near and the far plane
|
||||
* should not be too large (between 1000-10000 should be ok) to avoid
|
||||
* floating-point inaccuracies which could lead to z-fighting.
|
||||
*
|
||||
* The default value is 1000.f.
|
||||
*/
|
||||
float mClipPlaneFar;
|
||||
|
||||
/**
|
||||
* Screen aspect ratio.
|
||||
*
|
||||
* This is the ration between the width and the height of the
|
||||
* screen. Typical values are 4/3, 1/2 or 1/1. This value is
|
||||
* 0 if the aspect ratio is not defined in the source file.
|
||||
*
|
||||
* 0 is also the default value.
|
||||
*/
|
||||
float mAspect;
|
||||
}
|
||||
}
|
705
thirdparty/assimp/port/dAssimp/assimp/config.d
vendored
705
thirdparty/assimp/port/dAssimp/assimp/config.d
vendored
@ -1,705 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines constants for configurable properties for the library.
|
||||
*
|
||||
* These are set via <code>aiSetImportPropertyInteger()</code>,
|
||||
* <code>aiSetImportPropertyFloat()</code> and
|
||||
* <code>aiSetImportPropertyString()</code>.
|
||||
*/
|
||||
module assimp.config;
|
||||
|
||||
extern ( C ) {
|
||||
/*
|
||||
* Library settings.
|
||||
*
|
||||
* General, global settings.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enables time measurements.
|
||||
*
|
||||
* If enabled, measures the time needed for each part of the loading
|
||||
* process (i.e. IO time, importing, postprocessing, ..) and dumps these
|
||||
* timings to the DefaultLogger. See the performance page in the main
|
||||
* Assimp docs information on this topic.
|
||||
*
|
||||
* Property type: bool. Default value: false.
|
||||
*/
|
||||
const char* AI_CONFIG_GLOB_MEASURE_TIME = "GLOB_MEASURE_TIME";
|
||||
|
||||
version( none ) { // not implemented yet
|
||||
/**
|
||||
* Set Assimp's multithreading policy.
|
||||
*
|
||||
* This setting is ignored if Assimp was built without boost.thread support
|
||||
* (<code>ASSIMP_BUILD_NO_THREADING</code>, which is implied by
|
||||
* <code>ASSIMP_BUILD_BOOST_WORKAROUND</code>).
|
||||
*
|
||||
* Possible values are: -1 to let Assimp decide what to do, 0 to disable
|
||||
* multithreading entirely and any number larger than 0 to force a specific
|
||||
* number of threads. Assimp is always free to ignore this settings, which
|
||||
* is merely a hint. Usually, the default value (-1) will be fine. However,
|
||||
* if Assimp is used concurrently from multiple user threads, it might be
|
||||
* useful to limit each Importer instance to a specific number of cores.
|
||||
*
|
||||
* For more information, see the threading page in the main Assimp docs.
|
||||
*
|
||||
* Property type: int, default value: -1.
|
||||
*/
|
||||
const char* AI_CONFIG_GLOB_MULTITHREADING = "GLOB_MULTITHREADING";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Post processing settings.
|
||||
*
|
||||
* Various options to fine-tune the behavior of a specific post processing step.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specifies the maximum angle that may be between two vertex tangents that
|
||||
* their tangents and bitangents are smoothed.
|
||||
*
|
||||
* This applies to the <code>CalcTangentSpace</code> step. The angle is
|
||||
* specified in degrees, so 180 corresponds to PI radians.
|
||||
*
|
||||
* The default value is 45, the maximum value is 175.
|
||||
*
|
||||
* Property type: float.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE = "PP_CT_MAX_SMOOTHING_ANGLE";
|
||||
|
||||
/**
|
||||
* Specifies the maximum angle that may be between two face normals at the
|
||||
* same vertex position that their are smoothed together. Sometimes referred
|
||||
* to as 'crease angle'.
|
||||
*
|
||||
* This applies to the <code>GenSmoothNormals</code> step. The angle is
|
||||
* specified in degrees, so 180 corresponds to PI radians.
|
||||
*
|
||||
* The default value is 175 degrees (all vertex normals are smoothed), the
|
||||
* maximum value is 175, too.
|
||||
*
|
||||
* Property type: float.
|
||||
*
|
||||
* Warning:
|
||||
* Setting this option may cause a severe loss of performance. The
|
||||
* performance is unaffected if the <code>AI_CONFIG_FAVOUR_SPEED</code>
|
||||
* flag is set but the output quality may be reduced.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE = "PP_GSN_MAX_SMOOTHING_ANGLE";
|
||||
|
||||
/**
|
||||
* Sets the colormap (= palette) to be used to decode embedded textures in
|
||||
* MDL (Quake or 3DGS) files.
|
||||
*
|
||||
* This must be a valid path to a file. The file is 768 (256*3) bytes large
|
||||
* and contains RGB triplets for each of the 256 palette entries. The
|
||||
* default value is colormap.lmp. If the file is not found, a default
|
||||
* palette (from Quake 1) is used.
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MDL_COLORMAP = "IMPORT_MDL_COLORMAP";
|
||||
|
||||
/**
|
||||
* Configures the <code>RemoveRedundantMaterials</code> step to keep
|
||||
* materials matching a name in a given list.
|
||||
*
|
||||
* This is a list of 1 to n strings, ' ' serves as delimiter character.
|
||||
* Identifiers containing whitespaces must be enclosed in <em>single</em>
|
||||
* quotation marks. For example: <code>
|
||||
* "keep-me and_me_to anotherMaterialToBeKept \'name with whitespace\'"</code>.
|
||||
* Linefeeds, tabs or carriage returns are treated as whitespace.
|
||||
*
|
||||
* If a material matches on of these names, it will not be modified or
|
||||
* removed by the postprocessing step nor will other materials be replaced
|
||||
* by a reference to it.
|
||||
*
|
||||
* This option might be useful if you are using some magic material names
|
||||
* to pass additional semantics through the content pipeline. This ensures
|
||||
* they won't be optimized away, but a general optimization is still
|
||||
* performed for materials not contained in the list.
|
||||
*
|
||||
* Default value: n/a
|
||||
*
|
||||
* Property type: string.
|
||||
*
|
||||
* Note: Material names are case sensitive.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_RRM_EXCLUDE_LIST = "PP_RRM_EXCLUDE_LIST";
|
||||
|
||||
/**
|
||||
* Configures the <code>PretransformVertices</code> step to keep the scene
|
||||
* hierarchy. Meshes are moved to worldspace, but no optimization is
|
||||
* performed (meshes with equal materials are not joined, the total number
|
||||
* of meshes will not change).
|
||||
*
|
||||
* This option could be of use for you if the scene hierarchy contains
|
||||
* important additional information which you intend to parse.
|
||||
* For rendering, you can still render all meshes in the scene without
|
||||
* any transformations.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_PTV_KEEP_HIERARCHY = "PP_PTV_KEEP_HIERARCHY";
|
||||
|
||||
/**
|
||||
* Configures the <code>PretransformVertices</code> step to normalize all
|
||||
* vertex components into the -1...1 range. That is, a bounding box for the
|
||||
* whole scene is computed, the maximum component is taken and all meshes
|
||||
* are scaled appropriately (uniformly of course!).
|
||||
*
|
||||
* This might be useful if you don't know the spatial dimension of the input
|
||||
* data.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_PTV_NORMALIZE = "PP_PTV_NORMALIZE";
|
||||
|
||||
/**
|
||||
* Configures the <code>FindDegenerates</code> step to remove degenerated
|
||||
* primitives from the import – immediately.
|
||||
*
|
||||
* The default behaviour converts degenerated triangles to lines and
|
||||
* degenerated lines to points. See the documentation to the
|
||||
* <code>FindDegenerates</code> step for a detailed example of the various
|
||||
* ways to get rid of these lines and points if you don't want them.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_FD_REMOVE = "PP_FD_REMOVE";
|
||||
|
||||
/**
|
||||
* Configures the <code>OptimizeGraph</code> step to preserve nodes matching
|
||||
* a name in a given list.
|
||||
*
|
||||
* This is a list of 1 to n strings, ' ' serves as delimiter character.
|
||||
* Identifiers containing whitespaces must be enclosed in <em>single</em>
|
||||
* quotation marks. For example: <code>
|
||||
* "keep-me and_me_to anotherMaterialToBeKept \'name with whitespace\'"</code>.
|
||||
* Linefeeds, tabs or carriage returns are treated as whitespace.
|
||||
*
|
||||
* If a node matches on of these names, it will not be modified or
|
||||
* removed by the postprocessing step.
|
||||
*
|
||||
* This option might be useful if you are using some magic node names
|
||||
* to pass additional semantics through the content pipeline. This ensures
|
||||
* they won't be optimized away, but a general optimization is still
|
||||
* performed for nodes not contained in the list.
|
||||
*
|
||||
* Default value: n/a
|
||||
*
|
||||
* Property type: string.
|
||||
*
|
||||
* Note: Node names are case sensitive.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_OG_EXCLUDE_LIST = "PP_OG_EXCLUDE_LIST";
|
||||
|
||||
/**
|
||||
* Sets the maximum number of triangles in a mesh.
|
||||
*
|
||||
* This is used by the <code>SplitLargeMeshes</code> step to determine
|
||||
* whether a mesh must be split or not.
|
||||
*
|
||||
* Default value: AI_SLM_DEFAULT_MAX_TRIANGLES.
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_SLM_TRIANGLE_LIMIT = "PP_SLM_TRIANGLE_LIMIT";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_SLM_TRIANGLE_LIMIT setting.
|
||||
*/
|
||||
const AI_SLM_DEFAULT_MAX_TRIANGLES = 1000000;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of vertices in a mesh.
|
||||
*
|
||||
* This is used by the <code>SplitLargeMeshes</code> step to determine
|
||||
* whether a mesh must be split or not.
|
||||
*
|
||||
* Default value: AI_SLM_DEFAULT_MAX_VERTICES
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_SLM_VERTEX_LIMIT = "PP_SLM_VERTEX_LIMIT";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_SLM_VERTEX_LIMIT setting.
|
||||
*/
|
||||
const AI_SLM_DEFAULT_MAX_VERTICES = 1000000;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of bones affecting a single vertex.
|
||||
*
|
||||
* This is used by the <code>LimitBoneWeights</code> step.
|
||||
*
|
||||
* Default value: AI_LBW_MAX_WEIGHTS
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_LBW_MAX_WEIGHTS = "PP_LBW_MAX_WEIGHTS";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_LBW_MAX_WEIGHTS setting.
|
||||
*/
|
||||
const AI_LMW_MAX_WEIGHTS = 0x4;
|
||||
|
||||
/**
|
||||
* Sets the size of the post-transform vertex cache to optimize the
|
||||
* vertices for. This configures the <code>ImproveCacheLocality</code> step.
|
||||
*
|
||||
* The size is given in vertices. Of course you can't know how the vertex
|
||||
* format will exactly look like after the import returns, but you can still
|
||||
* guess what your meshes will probably have.
|
||||
*
|
||||
* The default value results in slight performance improvements for most
|
||||
* nVidia/AMD cards since 2002.
|
||||
*
|
||||
* Default value: PP_ICL_PTCACHE_SIZE
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_ICL_PTCACHE_SIZE = "PP_ICL_PTCACHE_SIZE";
|
||||
|
||||
/**
|
||||
* The default value for the AI_CONFIG_PP_ICL_PTCACHE_SIZE config option.
|
||||
*/
|
||||
const PP_ICL_PTCACHE_SIZE = 12;
|
||||
|
||||
/**
|
||||
* Components of the <code>aiScene</code> and <code>aiMesh</code> data
|
||||
* structures that can be excluded from the import by using the
|
||||
* <code>RemoveComponent</code> step.
|
||||
*
|
||||
* See the documentation to <code>RemoveComponent</code> for more details.
|
||||
*/
|
||||
enum aiComponent : uint {
|
||||
/**
|
||||
* Normal vectors.
|
||||
*/
|
||||
NORMALS = 0x2,
|
||||
|
||||
/**
|
||||
* Tangents and bitangents.
|
||||
*/
|
||||
TANGENTS_AND_BITANGENTS = 0x4,
|
||||
|
||||
/**
|
||||
* <em>All</em> color sets.
|
||||
*
|
||||
* Use aiComponent_COLORSn( N ) to specify the N'th set.
|
||||
*/
|
||||
COLORS = 0x8,
|
||||
|
||||
/**
|
||||
* <em>All</em> texture UV coordinate sets.
|
||||
*
|
||||
* Use aiComponent_TEXCOORDn( N ) to specify the N'th set.
|
||||
*/
|
||||
TEXCOORDS = 0x10,
|
||||
|
||||
/**
|
||||
* Bone weights from all meshes.
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
BONEWEIGHTS = 0x20,
|
||||
|
||||
/**
|
||||
* Node animations (<code>aiScene.mAnimations</code>).
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
ANIMATIONS = 0x40,
|
||||
|
||||
/**
|
||||
* Embedded textures (<code>aiScene.mTextures</code>).
|
||||
*/
|
||||
TEXTURES = 0x80,
|
||||
|
||||
/**
|
||||
* Light sources (<code>aiScene.mLights</code>).
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
LIGHTS = 0x100,
|
||||
|
||||
/**
|
||||
* Cameras (<code>aiScene.mCameras</code>).
|
||||
*
|
||||
* The corresponding scenegraph nodes are <em>not</em> removed. Use the
|
||||
* <code>OptimizeGraph</code> step to do this.
|
||||
*/
|
||||
CAMERAS = 0x200,
|
||||
|
||||
/**
|
||||
* Meshes (<code>aiScene.mMeshes</code>).
|
||||
*/
|
||||
MESHES = 0x400,
|
||||
|
||||
/** Materials.
|
||||
*
|
||||
* One default material will be generated, so
|
||||
* <code>aiScene.mNumMaterials</code> will be 1.
|
||||
*/
|
||||
MATERIALS = 0x800
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a certain color channel to remove.
|
||||
*/
|
||||
uint aiComponent_COLORSn( uint n ) { return 1u << ( n + 20u ); }
|
||||
|
||||
/**
|
||||
* Specifies a certain UV coordinate channel to remove.
|
||||
*/
|
||||
uint aiComponent_TEXCOORDSn( uint n ) { return 1u << ( n + 25u ); }
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>RemoveComponent</code> step:
|
||||
* Specifies the parts of the data structure to be removed.
|
||||
*
|
||||
* See the documentation to this step for further details.
|
||||
*
|
||||
* Default value: 0
|
||||
*
|
||||
* Property type: integer (bitwise combination of <code>aiComponent</code>
|
||||
* flags).
|
||||
*
|
||||
* Note: If no valid mesh is remaining after the step has been executed, the
|
||||
* import <em>fails</em>, because there is no data to work on anymore.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_RVC_FLAGS = "PP_RVC_FLAGS";
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>SortByPType</code> step:
|
||||
* Specifies which primitive types are removed by the step.
|
||||
*
|
||||
* This is a bitwise combination of the <code>aiPrimitiveType</code> flags.
|
||||
* Specifying all of them is illegal, of course. A typical use would be to
|
||||
* exclude all line and point meshes from the import.
|
||||
*
|
||||
* Default value: 0
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_SBP_REMOVE = "PP_SBP_REMOVE";
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>FindInvalidData</code> step:
|
||||
* Specifies the floating-point accuracy for animation values.
|
||||
*
|
||||
* The step checks for animation tracks where all frame values are
|
||||
* absolutely equal and removes them. This tweakable controls the epsilon
|
||||
* for floating-point comparisons – two keys are considered equal if the
|
||||
* invariant abs(n0-n1) > epsilon holds true for all vector respectively
|
||||
* quaternion components.
|
||||
*
|
||||
* Default value: 0 (exact comparison).
|
||||
*
|
||||
* Property type: float.
|
||||
*/
|
||||
const char* AI_CONFIG_PP_FID_ANIM_ACCURACY = "PP_FID_ANIM_ACCURACY";
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates UV scalings.
|
||||
*/
|
||||
const AI_UVTRAFO_SCALING = 0x1;
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates UV rotations.
|
||||
*/
|
||||
const AI_UVTRAFO_ROTATION = 0x2;
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates UV translation.
|
||||
*/
|
||||
const AI_UVTRAFO_TRANSLATION = 0x4;
|
||||
|
||||
/**
|
||||
* The <code>TransformUVCoords</code> step evaluates all UV translations.
|
||||
*/
|
||||
const AI_UVTRAFO_ALL =
|
||||
AI_UVTRAFO_SCALING
|
||||
| AI_UVTRAFO_ROTATION
|
||||
| AI_UVTRAFO_TRANSLATION;
|
||||
|
||||
/**
|
||||
* Input parameter to the <code>TransformUVCoords</code> step: Specifies
|
||||
* which UV transformations are evaluated.
|
||||
*
|
||||
* Default value: AI_UVTRAFO_ALL.
|
||||
*
|
||||
* Property type: integer (bitwise combination of the
|
||||
* <code>AI_UVTRAFO_XXX<code> flag).
|
||||
*/
|
||||
const char* AI_CONFIG_PP_TUV_EVALUATE = "PP_TUV_EVALUATE";
|
||||
|
||||
/**
|
||||
* A hint to assimp to favour speed against import quality.
|
||||
*
|
||||
* Enabling this option may result in faster loading, but it needn't.
|
||||
* It represents just a hint to loaders and post-processing steps to use
|
||||
* faster code paths, if possible.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_FAVOUR_SPEED = "FAVOUR_SPEED";
|
||||
|
||||
|
||||
/*
|
||||
* Importer settings.
|
||||
*
|
||||
* Various stuff to fine-tune the behaviour of specific importer plugins.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the vertex animation keyframe to be imported.
|
||||
*
|
||||
* Assimp does not support vertex keyframes (only bone animation is
|
||||
* supported). The library reads only one frame of models with vertex
|
||||
* animations.
|
||||
*
|
||||
* Default value: 0 (first frame).
|
||||
*
|
||||
* Property type: integer.
|
||||
*
|
||||
* Note: This option applies to all importers. However, it is also possible
|
||||
* to override the global setting for a specific loader. You can use the
|
||||
* AI_CONFIG_IMPORT_XXX_KEYFRAME options (where XXX is a placeholder for
|
||||
* the file format for which you want to override the global setting).
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_GLOBAL_KEYFRAME = "IMPORT_GLOBAL_KEYFRAME";
|
||||
|
||||
const char* AI_CONFIG_IMPORT_MD3_KEYFRAME = "IMPORT_MD3_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_MD2_KEYFRAME = "IMPORT_MD2_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_MDL_KEYFRAME = "IMPORT_MDL_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_MDC_KEYFRAME = "IMPORT_MDC_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_SMD_KEYFRAME = "IMPORT_SMD_KEYFRAME";
|
||||
const char* AI_CONFIG_IMPORT_UNREAL_KEYFRAME = "IMPORT_UNREAL_KEYFRAME";
|
||||
|
||||
|
||||
/**
|
||||
* Configures the AC loader to collect all surfaces which have the
|
||||
* "Backface cull" flag set in separate meshes.
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL = "IMPORT_AC_SEPARATE_BFCULL";
|
||||
|
||||
/**
|
||||
* Configures the UNREAL 3D loader to separate faces with different surface
|
||||
* flags (e.g. two-sided vs. single-sided).
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS = "UNREAL_HANDLE_FLAGS";
|
||||
|
||||
/**
|
||||
* Configures the terragen import plugin to compute uv's for terrains, if
|
||||
* not given. Furthermore, a default texture is assigned.
|
||||
*
|
||||
* UV coordinates for terrains are so simple to compute that you'll usually
|
||||
* want to compute them on your own, if you need them. This option is intended
|
||||
* for model viewers which want to offer an easy way to apply textures to
|
||||
* terrains.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_TER_MAKE_UVS = "IMPORT_TER_MAKE_UVS";
|
||||
|
||||
/**
|
||||
* Configures the ASE loader to always reconstruct normal vectors basing on
|
||||
* the smoothing groups loaded from the file.
|
||||
*
|
||||
* Many ASE files have invalid normals (they're not orthonormal).
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS = "IMPORT_ASE_RECONSTRUCT_NORMALS";
|
||||
|
||||
/**
|
||||
* Configures the M3D loader to detect and process multi-part Quake player
|
||||
* models.
|
||||
*
|
||||
* These models usually consist of three files, <code>lower.md3</code>,
|
||||
* <code>upper.md3</code> and <code>head.md3</code>. If this property is set
|
||||
* to true, Assimp will try to load and combine all three files if one of
|
||||
* them is loaded.
|
||||
*
|
||||
* Default value: true.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART = "IMPORT_MD3_HANDLE_MULTIPART";
|
||||
|
||||
/**
|
||||
* Tells the MD3 loader which skin files to load.
|
||||
*
|
||||
* When loading MD3 files, Assimp checks whether a file
|
||||
* <code><md3_file_name>_<skin_name>.skin</code> is existing. These files
|
||||
* are used by Quake 3 to be able to assign different skins (e.g. red and
|
||||
* blue team) to models. 'default', 'red', 'blue' are typical skin names.
|
||||
*
|
||||
* Default value: "default".
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD3_SKIN_NAME = "IMPORT_MD3_SKIN_NAME";
|
||||
|
||||
/**
|
||||
* Specify the Quake 3 shader file to be used for a particular MD3 file.
|
||||
* This can also be a search path.
|
||||
*
|
||||
* By default Assimp's behaviour is as follows: If a MD3 file
|
||||
* <code>[any_path]/models/[any_q3_subdir]/[model_name]/[file_name].md3</code>
|
||||
* is loaded, the library tries to locate the corresponding shader file in
|
||||
* <code>[any_path]/scripts/[model_name].shader</code>. This property
|
||||
* overrides this behaviour. It can either specify a full path to the shader
|
||||
* to be loaded or alternatively the path (relative or absolute) to the
|
||||
* directory where the shaders for all MD3s to be loaded reside. Assimp
|
||||
* attempts to open <code>[dir]/[model_name].shader</code> first,
|
||||
* <code>[dir]/[file_name].shader</code> is the fallback file. Note that
|
||||
* <code>[dir]</code> should have a terminal (back)slash.
|
||||
*
|
||||
* Default value: n/a.
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD3_SHADER_SRC = "IMPORT_MD3_SHADER_SRC";
|
||||
|
||||
/**
|
||||
* Configures the LWO loader to load just one layer from the model.
|
||||
*
|
||||
* LWO files consist of layers and in some cases it could be useful to load
|
||||
* only one of them. This property can be either a string – which specifies
|
||||
* the name of the layer – or an integer – the index of the layer. If the
|
||||
* property is not set the whole LWO model is loaded. Loading fails if the
|
||||
* requested layer is not available. The layer index is zero-based and the
|
||||
* layer name may not be empty.
|
||||
*
|
||||
* Default value: all layers are loaded.
|
||||
*
|
||||
* Property type: integer/string.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY = "IMPORT_LWO_ONE_LAYER_ONLY";
|
||||
|
||||
/**
|
||||
* Configures the MD5 loader to not load the MD5ANIM file for a MD5MESH file
|
||||
* automatically.
|
||||
*
|
||||
* The default strategy is to look for a file with the same name but the
|
||||
* MD5ANIM extension in the same directory. If it is found, it is loaded
|
||||
* and combined with the MD5MESH file. This configuration option can be
|
||||
* used to disable this behaviour.
|
||||
*
|
||||
* Default value: false.
|
||||
*
|
||||
* Property type: bool.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD = "IMPORT_MD5_NO_ANIM_AUTOLOAD";
|
||||
|
||||
/**
|
||||
* Defines the begin of the time range for which the LWS loader evaluates
|
||||
* animations and computes <code>aiNodeAnim</code>s.
|
||||
*
|
||||
* Assimp provides full conversion of LightWave's envelope system, including
|
||||
* pre and post conditions. The loader computes linearly subsampled animation
|
||||
* chanels with the frame rate given in the LWS file. This property defines
|
||||
* the start time. Note: animation channels are only generated if a node
|
||||
* has at least one envelope with more tan one key assigned. This property.
|
||||
* is given in frames, '0' is the first frame. By default, if this property
|
||||
* is not set, the importer takes the animation start from the input LWS
|
||||
* file ('FirstFrame' line).
|
||||
*
|
||||
* Default value: read from file.
|
||||
*
|
||||
* Property type: integer.
|
||||
*
|
||||
* See: <code>AI_CONFIG_IMPORT_LWS_ANIM_END</code> – end of the imported
|
||||
* time range
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_LWS_ANIM_START = "IMPORT_LWS_ANIM_START";
|
||||
const char* AI_CONFIG_IMPORT_LWS_ANIM_END = "IMPORT_LWS_ANIM_END";
|
||||
|
||||
/**
|
||||
* Defines the output frame rate of the IRR loader.
|
||||
*
|
||||
* IRR animations are difficult to convert for Assimp and there will always
|
||||
* be a loss of quality. This setting defines how many keys per second are
|
||||
* returned by the converter.
|
||||
*
|
||||
* Default value: 100.
|
||||
*
|
||||
* Property type: integer.
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_IRR_ANIM_FPS = "IMPORT_IRR_ANIM_FPS";
|
||||
|
||||
/**
|
||||
* Ogre Importer will try to load this material file.
|
||||
*
|
||||
* Ogre Mehs contain only the material name, not the material file. If there
|
||||
* is no material file with the same name as the material, Ogre Importer
|
||||
* will try to load this file and search the material in it.
|
||||
*
|
||||
* Property type: string. Default value: "Scene.material".
|
||||
*/
|
||||
const char* AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE = "IMPORT_OGRE_MATERIAL_FILE";
|
||||
}
|
140
thirdparty/assimp/port/dAssimp/assimp/fileIO.d
vendored
140
thirdparty/assimp/port/dAssimp/assimp/fileIO.d
vendored
@ -1,140 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The data structures necessary to use Assimip with a custom IO system.
|
||||
*/
|
||||
module assimp.fileIO;
|
||||
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
// aiFile callbacks
|
||||
alias size_t function( aiFile*, char*, size_t, size_t ) aiFileWriteProc;
|
||||
alias size_t function( aiFile*, char*, size_t, size_t ) aiFileReadProc;
|
||||
alias size_t function( aiFile* ) aiFileTellProc;
|
||||
alias void function( aiFile* ) aiFileFlushProc;
|
||||
alias aiReturn function( aiFile*, size_t, aiOrigin ) aiFileSeek;
|
||||
|
||||
// aiFileIO callbacks
|
||||
alias aiFile* function( aiFileIO*, char*, char* ) aiFileOpenProc;
|
||||
alias void function( aiFileIO*, aiFile* ) aiFileCloseProc;
|
||||
|
||||
/**
|
||||
* Represents user-defined data.
|
||||
*/
|
||||
alias char* aiUserData;
|
||||
|
||||
/**
|
||||
* File system callbacks.
|
||||
*
|
||||
* Provided are functions to open and close files. Supply a custom structure
|
||||
* to the import function. If you don't, a default implementation is used.
|
||||
* Use custom file systems to enable reading from other sources, such as
|
||||
* ZIPs or memory locations.
|
||||
*/
|
||||
struct aiFileIO {
|
||||
/**
|
||||
* Function used to open a new file
|
||||
*/
|
||||
aiFileOpenProc OpenProc;
|
||||
|
||||
/**
|
||||
* Function used to close an existing file
|
||||
*/
|
||||
aiFileCloseProc CloseProc;
|
||||
|
||||
/**
|
||||
* User-defined, opaque data.
|
||||
*/
|
||||
aiUserData UserData;
|
||||
}
|
||||
|
||||
/**
|
||||
* File callbacks.
|
||||
*
|
||||
* Actually, it's a data structure to wrap a set of <code>fXXXX</code>
|
||||
* (e.g <code>fopen()</code>) replacement functions.
|
||||
*
|
||||
* The default implementation of the functions utilizes the <code>fXXX</code>
|
||||
* functions from the CRT. However, you can supply a custom implementation
|
||||
* to Assimp by passing a custom <code>aiFileIO</code>. Use this to enable
|
||||
* reading from other sources such as ZIP archives or memory locations.
|
||||
*/
|
||||
struct aiFile {
|
||||
/**
|
||||
* Callback to read from a file.
|
||||
*/
|
||||
aiFileReadProc ReadProc;
|
||||
|
||||
/**
|
||||
* Callback to write to a file.
|
||||
*/
|
||||
aiFileWriteProc WriteProc;
|
||||
|
||||
/**
|
||||
* Callback to retrieve the current position of the file cursor
|
||||
* (<code>ftell()</code>).
|
||||
*/
|
||||
aiFileTellProc TellProc;
|
||||
|
||||
/**
|
||||
* Callback to retrieve the size of the file, in bytes.
|
||||
*/
|
||||
aiFileTellProc FileSizeProc;
|
||||
|
||||
/**
|
||||
* Callback to set the current position of the file cursor
|
||||
* (<code>fseek()</code>).
|
||||
*/
|
||||
aiFileSeek SeekProc;
|
||||
|
||||
/**
|
||||
* Callback to flush the file contents.
|
||||
*/
|
||||
aiFileFlushProc FlushProc;
|
||||
|
||||
/**
|
||||
* User-defined, opaque data.
|
||||
*/
|
||||
aiUserData UserData;
|
||||
}
|
||||
}
|
215
thirdparty/assimp/port/dAssimp/assimp/light.d
vendored
215
thirdparty/assimp/port/dAssimp/assimp/light.d
vendored
@ -1,215 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structures which are used to store the imported information
|
||||
* about the light sources in the scene.
|
||||
*/
|
||||
module assimp.light;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Enumerates all supported types of light sources.
|
||||
*/
|
||||
enum aiLightSourceType : uint {
|
||||
UNDEFINED = 0x0,
|
||||
|
||||
/**
|
||||
* A directional light source has a well-defined direction but is
|
||||
* infinitely far away. That's quite a good approximation for sun light.
|
||||
*/
|
||||
DIRECTIONAL = 0x1,
|
||||
|
||||
/**
|
||||
* A point light source has a well-defined position in space but no
|
||||
* direction – it emits light in all directions. A normal bulb is a point
|
||||
* light.
|
||||
*/
|
||||
POINT = 0x2,
|
||||
|
||||
/**
|
||||
* A spot light source emits light in a specific angle. It has a position
|
||||
* and a direction it is pointing to. A good example for a spot light is
|
||||
* a light spot in sport arenas.
|
||||
*/
|
||||
SPOT = 0x3
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper structure to describe a light source.
|
||||
*
|
||||
* Assimp supports multiple sorts of light sources, including directional,
|
||||
* point and spot lights. All of them are defined with just a single
|
||||
* structure and distinguished by their parameters.
|
||||
*
|
||||
* Note: Some file formats (such as 3DS, ASE) export a "target point" – the
|
||||
* point a spot light is looking at (it can even be animated). Assimp
|
||||
* writes the target point as a subnode of a spotlights's main node, called
|
||||
* <code>[spotName].Target</code>. However, this is just additional
|
||||
* information then, the transformation tracks of the main node make the
|
||||
* spot light already point in the right direction.
|
||||
*/
|
||||
struct aiLight {
|
||||
/**
|
||||
* The name of the light source.
|
||||
*
|
||||
* There must be a node in the scenegraph with the same name. This node
|
||||
* specifies the position of the light in the scenehierarchy and can be
|
||||
* animated.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* The type of the light source.
|
||||
*
|
||||
* <code>aiLightSource.UNDEFINED</code> is not a valid value for this
|
||||
* member.
|
||||
*/
|
||||
aiLightSourceType mType;
|
||||
|
||||
/**
|
||||
* Position of the light source in space. Relative to the transformation
|
||||
* of the node corresponding to the light.
|
||||
*
|
||||
* The position is undefined for directional lights.
|
||||
*/
|
||||
aiVector3D mPosition;
|
||||
|
||||
/**
|
||||
* Direction of the light source in space. Relative to the transformation
|
||||
* of the node corresponding to the light.
|
||||
*
|
||||
* The direction is undefined for point lights. The vector may be
|
||||
* normalized, but it needn't.
|
||||
*/
|
||||
aiVector3D mDirection;
|
||||
|
||||
/**
|
||||
* Constant light attenuation factor.
|
||||
*
|
||||
* The intensity of the light source at a given distance
|
||||
* <code>d</code> from the light's position is
|
||||
* <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
|
||||
* corresponds to the <code>att0</code> variable in the equation.
|
||||
*
|
||||
* Naturally undefined for directional lights.
|
||||
*/
|
||||
float mAttenuationConstant;
|
||||
|
||||
/**
|
||||
* Linear light attenuation factor.
|
||||
*
|
||||
* The intensity of the light source at a given distance
|
||||
* <code>d</code> from the light's position is
|
||||
* <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
|
||||
* corresponds to the <code>att1</code> variable in the equation.
|
||||
*
|
||||
* Naturally undefined for directional lights.
|
||||
*/
|
||||
float mAttenuationLinear;
|
||||
|
||||
/**
|
||||
* Quadratic light attenuation factor.
|
||||
*
|
||||
* The intensity of the light source at a given distance
|
||||
* <code>d</code> from the light's position is
|
||||
* <code>1/( att0 + att1 * d + att2 * d * d )</code>. This member
|
||||
* corresponds to the <code>att2</code> variable in the equation.
|
||||
*
|
||||
* Naturally undefined for directional lights.
|
||||
*/
|
||||
float mAttenuationQuadratic;
|
||||
|
||||
/**
|
||||
* Diffuse color of the light source
|
||||
*
|
||||
* The diffuse light color is multiplied with the diffuse material color
|
||||
* to obtain the final color that contributes to the diffuse shading term.
|
||||
*/
|
||||
aiColor3D mColorDiffuse;
|
||||
|
||||
/**
|
||||
* Specular color of the light source
|
||||
*
|
||||
* The specular light color is multiplied with the specular material
|
||||
* color to obtain the final color that contributes to the specular
|
||||
* shading term.
|
||||
*/
|
||||
aiColor3D mColorSpecular;
|
||||
|
||||
/**
|
||||
* Ambient color of the light source
|
||||
*
|
||||
* The ambient light color is multiplied with the ambient material color
|
||||
* to obtain the final color that contributes to the ambient shading term.
|
||||
*
|
||||
* Most renderers will ignore this value it, is just a remaining of the
|
||||
* fixed-function pipeline that is still supported by quite many file
|
||||
* formats.
|
||||
*/
|
||||
aiColor3D mColorAmbient;
|
||||
|
||||
/**
|
||||
* Inner angle of a spot light's light cone.
|
||||
*
|
||||
* The spot light has maximum influence on objects inside this angle. The
|
||||
* angle is given in radians. It is 2PI for point lights and undefined
|
||||
* for directional lights.
|
||||
*/
|
||||
float mAngleInnerCone;
|
||||
|
||||
/**
|
||||
* Outer angle of a spot light's light cone.
|
||||
*
|
||||
* The spot light does not affect objects outside this angle. The angle
|
||||
* is given in radians. It is 2PI for point lights and undefined for
|
||||
* directional lights. The outer angle must be greater than or equal to
|
||||
* the inner angle.
|
||||
*
|
||||
* It is assumed that the application uses a smooth interpolation between
|
||||
* the inner and the outer cone of the spot light.
|
||||
*/
|
||||
float mAngleOuterCone;
|
||||
}
|
||||
}
|
193
thirdparty/assimp/port/dAssimp/assimp/loader.d
vendored
193
thirdparty/assimp/port/dAssimp/assimp/loader.d
vendored
@ -1,193 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides facilities for dynamically loading the Assimp library.
|
||||
*
|
||||
* Currently requires Tango, but there is no reason why Phobos could not be
|
||||
* supported too.
|
||||
*/
|
||||
module assimp.loader;
|
||||
|
||||
import assimp.api;
|
||||
import tango.io.Stdout;
|
||||
import tango.sys.SharedLib;
|
||||
|
||||
const uint ASSIMP_BINDINGS_MAJOR = 2;
|
||||
const uint ASSIMP_BINDINGS_MINOR = 0;
|
||||
|
||||
/**
|
||||
* Loader class for dynamically loading the Assimp library.
|
||||
*
|
||||
* The library is »reference-counted«, meaning that the library is not
|
||||
* unloaded on a call to <code>unload()</code> if there are still other
|
||||
* references to it.
|
||||
*/
|
||||
struct Assimp {
|
||||
public:
|
||||
/**
|
||||
* Loads the library if it is not already loaded and increases the
|
||||
* reference counter.
|
||||
*
|
||||
* The library file (<code>libassimp.so</code> on POSIX systems,
|
||||
* <code>Assimp32.dll</code> on Win32) is loaded via Tango's SharedLib
|
||||
* class.
|
||||
*/
|
||||
static void load() {
|
||||
if ( m_sRefCount == 0 ) {
|
||||
version ( Posix ) {
|
||||
version ( OSX ) {
|
||||
m_sLibrary = SharedLib.load( "libassimp.dylib" );
|
||||
} else {
|
||||
m_sLibrary = SharedLib.load( "libassimp.so" );
|
||||
}
|
||||
}
|
||||
version ( Win32 ) {
|
||||
m_sLibrary = SharedLib.load( "Assimp32.dll" );
|
||||
}
|
||||
|
||||
// Versioning
|
||||
mixin( bindCode( "aiGetLegalString" ) );
|
||||
mixin( bindCode( "aiGetVersionMinor" ) );
|
||||
mixin( bindCode( "aiGetVersionMajor" ) );
|
||||
mixin( bindCode( "aiGetVersionRevision" ) );
|
||||
mixin( bindCode( "aiGetCompileFlags" ) );
|
||||
|
||||
// Check for version mismatch between the external, dynamically loaded
|
||||
// library and the version the bindings were created against.
|
||||
uint libMajor = aiGetVersionMajor();
|
||||
uint libMinor = aiGetVersionMinor();
|
||||
|
||||
if ( ( libMajor < ASSIMP_BINDINGS_MAJOR ) ||
|
||||
( libMinor < ASSIMP_BINDINGS_MINOR ) ) {
|
||||
Stdout.format(
|
||||
"WARNING: Assimp version too old (loaded library: {}.{}, " ~
|
||||
"bindings: {}.{})!",
|
||||
libMajor,
|
||||
libMinor,
|
||||
ASSIMP_BINDINGS_MAJOR,
|
||||
ASSIMP_BINDINGS_MINOR
|
||||
).newline;
|
||||
}
|
||||
|
||||
if ( libMajor > ASSIMP_BINDINGS_MAJOR ) {
|
||||
Stdout.format(
|
||||
"WARNING: Assimp version too new (loaded library: {}.{}, " ~
|
||||
"bindings: {}.{})!",
|
||||
libMajor,
|
||||
libMinor,
|
||||
ASSIMP_BINDINGS_MAJOR,
|
||||
ASSIMP_BINDINGS_MINOR
|
||||
).newline;
|
||||
}
|
||||
|
||||
// General API
|
||||
mixin( bindCode( "aiImportFile" ) );
|
||||
mixin( bindCode( "aiImportFileEx" ) );
|
||||
mixin( bindCode( "aiImportFileFromMemory" ) );
|
||||
mixin( bindCode( "aiApplyPostProcessing" ) );
|
||||
mixin( bindCode( "aiGetPredefinedLogStream" ) );
|
||||
mixin( bindCode( "aiAttachLogStream" ) );
|
||||
mixin( bindCode( "aiEnableVerboseLogging" ) );
|
||||
mixin( bindCode( "aiDetachLogStream" ) );
|
||||
mixin( bindCode( "aiDetachAllLogStreams" ) );
|
||||
mixin( bindCode( "aiReleaseImport" ) );
|
||||
mixin( bindCode( "aiGetErrorString" ) );
|
||||
mixin( bindCode( "aiIsExtensionSupported" ) );
|
||||
mixin( bindCode( "aiGetExtensionList" ) );
|
||||
mixin( bindCode( "aiGetMemoryRequirements" ) );
|
||||
mixin( bindCode( "aiSetImportPropertyInteger" ) );
|
||||
mixin( bindCode( "aiSetImportPropertyFloat" ) );
|
||||
mixin( bindCode( "aiSetImportPropertyString" ) );
|
||||
|
||||
// Mathematical functions
|
||||
mixin( bindCode( "aiCreateQuaternionFromMatrix" ) );
|
||||
mixin( bindCode( "aiDecomposeMatrix" ) );
|
||||
mixin( bindCode( "aiTransposeMatrix4" ) );
|
||||
mixin( bindCode( "aiTransposeMatrix3" ) );
|
||||
mixin( bindCode( "aiTransformVecByMatrix3" ) );
|
||||
mixin( bindCode( "aiTransformVecByMatrix4" ) );
|
||||
mixin( bindCode( "aiMultiplyMatrix4" ) );
|
||||
mixin( bindCode( "aiMultiplyMatrix3" ) );
|
||||
mixin( bindCode( "aiIdentityMatrix3" ) );
|
||||
mixin( bindCode( "aiIdentityMatrix4" ) );
|
||||
|
||||
// Material system
|
||||
mixin( bindCode( "aiGetMaterialProperty" ) );
|
||||
mixin( bindCode( "aiGetMaterialFloatArray" ) );
|
||||
mixin( bindCode( "aiGetMaterialIntegerArray" ) );
|
||||
mixin( bindCode( "aiGetMaterialColor" ) );
|
||||
mixin( bindCode( "aiGetMaterialString" ) );
|
||||
mixin( bindCode( "aiGetMaterialTextureCount" ) );
|
||||
mixin( bindCode( "aiGetMaterialTexture" ) );
|
||||
}
|
||||
++m_sRefCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decreases the reference counter and unloads the library if this was the
|
||||
* last reference.
|
||||
*/
|
||||
static void unload() {
|
||||
assert( m_sRefCount > 0 );
|
||||
--m_sRefCount;
|
||||
|
||||
if ( m_sRefCount == 0 ) {
|
||||
m_sLibrary.unload();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/// Current number of references to the library.
|
||||
static uint m_sRefCount;
|
||||
|
||||
/// Library handle.
|
||||
static SharedLib m_sLibrary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private helper function which constructs the bind command for a symbol to
|
||||
* keep the code DRY.
|
||||
*/
|
||||
private char[] bindCode( char[] symbol ) {
|
||||
return symbol ~ " = cast( typeof( " ~ symbol ~
|
||||
" ) )m_sLibrary.getSymbol( `" ~ symbol ~ "` );";
|
||||
}
|
641
thirdparty/assimp/port/dAssimp/assimp/material.d
vendored
641
thirdparty/assimp/port/dAssimp/assimp/material.d
vendored
@ -1,641 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the material system which stores the imported material information.
|
||||
*/
|
||||
module assimp.material;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Default material names for meshes without UV coordinates.
|
||||
*/
|
||||
const char* AI_DEFAULT_MATERIAL_NAME = "aiDefaultMat";
|
||||
|
||||
/**
|
||||
* Default material names for meshes with UV coordinates.
|
||||
*/
|
||||
const char* AI_DEFAULT_TEXTURED_MATERIAL_NAME = "TexturedDefaultMaterial";
|
||||
|
||||
/**
|
||||
* Defines how the Nth texture of a specific type is combined with the
|
||||
* result of all previous layers.
|
||||
*
|
||||
* Example (left: key, right: value):
|
||||
* <pre> DiffColor0 - gray
|
||||
* DiffTextureOp0 - aiTextureOpMultiply
|
||||
* DiffTexture0 - tex1.png
|
||||
* DiffTextureOp0 - aiTextureOpAdd
|
||||
* DiffTexture1 - tex2.png</pre>
|
||||
* Written as equation, the final diffuse term for a specific pixel would be:
|
||||
* <pre>diffFinal = DiffColor0 * sampleTex( DiffTexture0, UV0 ) +
|
||||
* sampleTex( DiffTexture1, UV0 ) * diffContrib;</pre>
|
||||
* where <code>diffContrib</code> is the intensity of the incoming light for
|
||||
* that pixel.
|
||||
*/
|
||||
enum aiTextureOp : uint {
|
||||
/**
|
||||
* <code>T = T1 * T2</code>
|
||||
*/
|
||||
Multiply = 0x0,
|
||||
|
||||
/**
|
||||
* <code>T = T1 + T2</code>
|
||||
*/
|
||||
Add = 0x1,
|
||||
|
||||
/**
|
||||
* <code>T = T1 - T2</code>
|
||||
*/
|
||||
Subtract = 0x2,
|
||||
|
||||
/**
|
||||
* <code>T = T1 / T2</code>
|
||||
*/
|
||||
Divide = 0x3,
|
||||
|
||||
/**
|
||||
* <code>T = ( T1 + T2 ) - ( T1 * T2 )</code>
|
||||
*/
|
||||
SmoothAdd = 0x4,
|
||||
|
||||
/**
|
||||
* <code>T = T1 + ( T2 - 0.5 )</code>
|
||||
*/
|
||||
SignedAdd = 0x5
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how UV coordinates outside the <code>[0..1]</code> range are
|
||||
* handled.
|
||||
*
|
||||
* Commonly referred to as 'wrapping mode'.
|
||||
*/
|
||||
enum aiTextureMapMode : uint {
|
||||
/**
|
||||
* A texture coordinate <code>u | v</code> is translated to
|
||||
* <code>(u%1) | (v%1)</code>.
|
||||
*/
|
||||
Wrap = 0x0,
|
||||
|
||||
/**
|
||||
* Texture coordinates are clamped to the nearest valid value.
|
||||
*/
|
||||
Clamp = 0x1,
|
||||
|
||||
/**
|
||||
* If the texture coordinates for a pixel are outside
|
||||
* <code>[0..1]</code>, the texture is not applied to that pixel.
|
||||
*/
|
||||
Decal = 0x3,
|
||||
|
||||
/**
|
||||
* A texture coordinate <code>u | v</code> becomes
|
||||
* <code>(u%1) | (v%1)</code> if <code>(u-(u%1))%2</code> is
|
||||
* zero and <code>(1-(u%1)) | (1-(v%1))</code> otherwise.
|
||||
*/
|
||||
Mirror = 0x2
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how the mapping coords for a texture are generated.
|
||||
*
|
||||
* Real-time applications typically require full UV coordinates, so the use of
|
||||
* the <code>aiProcess.GenUVCoords</code> step is highly recommended. It
|
||||
* generates proper UV channels for non-UV mapped objects, as long as an
|
||||
* accurate description how the mapping should look like (e.g spherical) is
|
||||
* given. See the <code>AI_MATKEY_MAPPING</code> property for more details.
|
||||
*/
|
||||
enum aiTextureMapping : uint {
|
||||
/**
|
||||
* The mapping coordinates are taken from an UV channel.
|
||||
*
|
||||
* The <code>AI_MATKEY_UVSRC</code> key specifies from which (remember,
|
||||
* meshes can have more than one UV channel).
|
||||
*/
|
||||
UV = 0x0,
|
||||
|
||||
/**
|
||||
* Spherical mapping.
|
||||
*/
|
||||
SPHERE = 0x1,
|
||||
|
||||
/**
|
||||
* Cylindrical mapping.
|
||||
*/
|
||||
CYLINDER = 0x2,
|
||||
|
||||
/**
|
||||
* Cubic mapping.
|
||||
*/
|
||||
BOX = 0x3,
|
||||
|
||||
/**
|
||||
* Planar mapping.
|
||||
*/
|
||||
PLANE = 0x4,
|
||||
|
||||
/**
|
||||
* Undefined mapping.
|
||||
*/
|
||||
OTHER = 0x5
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the purpose of a texture
|
||||
*
|
||||
* This is a very difficult topic. Different 3D packages support different
|
||||
* kinds of textures. For very common texture types, such as bumpmaps, the
|
||||
* rendering results depend on implementation details in the rendering
|
||||
* pipelines of these applications. Assimp loads all texture references from
|
||||
* the model file and tries to determine which of the predefined texture
|
||||
* types below is the best choice to match the original use of the texture
|
||||
* as closely as possible.
|
||||
*
|
||||
* In content pipelines you'll usually define how textures have to be
|
||||
* handled, and the artists working on models have to conform to this
|
||||
* specification, regardless which 3D tool they're using.
|
||||
*/
|
||||
enum aiTextureType : uint {
|
||||
/**
|
||||
* No texture, but the value to be used for
|
||||
* <code>aiMaterialProperty.mSemantic</code> for all material properties
|
||||
* <em>not</em> related to textures.
|
||||
*/
|
||||
NONE = 0x0,
|
||||
|
||||
/**
|
||||
* The texture is combined with the result of the diffuse lighting
|
||||
* equation.
|
||||
*/
|
||||
DIFFUSE = 0x1,
|
||||
|
||||
/**
|
||||
* The texture is combined with the result of the specular lighting
|
||||
* equation.
|
||||
*/
|
||||
SPECULAR = 0x2,
|
||||
|
||||
/**
|
||||
* The texture is combined with the result of the ambient lighting
|
||||
* equation.
|
||||
*/
|
||||
AMBIENT = 0x3,
|
||||
|
||||
/**
|
||||
* The texture is added to the result of the lighting calculation. It
|
||||
* isn't influenced by incoming light.
|
||||
*/
|
||||
EMISSIVE = 0x4,
|
||||
|
||||
/**
|
||||
* The texture is a height map.
|
||||
*
|
||||
* By convention, higher grey-scale values stand for higher elevations
|
||||
* from the base height.
|
||||
*/
|
||||
HEIGHT = 0x5,
|
||||
|
||||
/**
|
||||
* The texture is a (tangent space) normal-map.
|
||||
*
|
||||
* Again, there are several conventions for tangent-space normal maps.
|
||||
* Assimp does (intentionally) not differenciate here.
|
||||
*/
|
||||
NORMALS = 0x6,
|
||||
|
||||
/**
|
||||
* The texture defines the glossiness of the material.
|
||||
*
|
||||
* The glossiness is in fact the exponent of the specular (phong)
|
||||
* lighting equation. Usually there is a conversion function defined to
|
||||
* map the linear color values in the texture to a suitable exponent.
|
||||
*/
|
||||
SHININESS = 0x7,
|
||||
|
||||
/**
|
||||
* The texture defines per-pixel opacity.
|
||||
*
|
||||
* Usually white means opaque and black means transparent.
|
||||
*/
|
||||
OPACITY = 0x8,
|
||||
|
||||
/**
|
||||
* Displacement texture.
|
||||
*
|
||||
* The exact purpose and format is application-dependent. Higher color
|
||||
* values stand for higher vertex displacements.
|
||||
*/
|
||||
DISPLACEMENT = 0x9,
|
||||
|
||||
/**
|
||||
* Lightmap or ambient occlusion texture.
|
||||
*
|
||||
* Both lightmaps and dedicated ambient occlusion maps are covered by
|
||||
* this material property. The texture contains a scaling value for the
|
||||
* final color value of a pixel. Its intensity is not affected by
|
||||
* incoming light.
|
||||
*/
|
||||
LIGHTMAP = 0xA,
|
||||
|
||||
/**
|
||||
* Reflection texture.
|
||||
*
|
||||
* Contains the color of a perfect mirror reflection. Rarely used, almost
|
||||
* never for real-time applications.
|
||||
*/
|
||||
REFLECTION = 0xB,
|
||||
|
||||
/**
|
||||
* Unknown texture.
|
||||
*
|
||||
* A texture reference that does not match any of the definitions above is
|
||||
* considered to be 'unknown'. It is still imported, but is excluded from
|
||||
* any further postprocessing.
|
||||
*/
|
||||
UNKNOWN = 0xC
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines all shading models supported by the library
|
||||
*
|
||||
* The list of shading modes has been taken from Blender. See Blender
|
||||
* documentation for more information. The API does not distinguish between
|
||||
* "specular" and "diffuse" shaders (thus the specular term for diffuse
|
||||
* shading models like Oren-Nayar remains undefined).
|
||||
*
|
||||
* Again, this value is just a hint. Assimp tries to select the shader whose
|
||||
* most common implementation matches the original rendering results of the
|
||||
* 3D modeller which wrote a particular model as closely as possible.
|
||||
*/
|
||||
enum aiShadingMode : uint {
|
||||
/**
|
||||
* Flat shading.
|
||||
*
|
||||
* Shading is done on per-face base diffuse only. Also known as
|
||||
* »faceted shading«.
|
||||
*/
|
||||
Flat = 0x1,
|
||||
|
||||
/**
|
||||
* Simple Gouraud shading.
|
||||
*/
|
||||
Gouraud = 0x2,
|
||||
|
||||
/**
|
||||
* Phong-Shading.
|
||||
*/
|
||||
Phong = 0x3,
|
||||
|
||||
/**
|
||||
* Phong-Blinn-Shading.
|
||||
*/
|
||||
Blinn = 0x4,
|
||||
|
||||
/**
|
||||
* Per-pixel toon shading.
|
||||
*
|
||||
* Often referred to as »comic shading«.
|
||||
*/
|
||||
Toon = 0x5,
|
||||
|
||||
/**
|
||||
* Per-pixel Oren-Nayar shading.
|
||||
*
|
||||
* Extension to standard Lambertian shading, taking the roughness of the
|
||||
* material into account.
|
||||
*/
|
||||
OrenNayar = 0x6,
|
||||
|
||||
/**
|
||||
* Per-pixel Minnaert shading.
|
||||
*
|
||||
* Extension to standard Lambertian shading, taking the "darkness" of the
|
||||
* material into account.
|
||||
*/
|
||||
Minnaert = 0x7,
|
||||
|
||||
/**
|
||||
* Per-pixel Cook-Torrance shading.
|
||||
*
|
||||
* Special shader for metallic surfaces.
|
||||
*/
|
||||
CookTorrance = 0x8,
|
||||
|
||||
/**
|
||||
* No shading at all.
|
||||
*
|
||||
* Constant light influence of 1.
|
||||
*/
|
||||
NoShading = 0x9,
|
||||
|
||||
/**
|
||||
* Fresnel shading.
|
||||
*/
|
||||
Fresnel = 0xa
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines some mixed flags for a particular texture.
|
||||
*
|
||||
* Usually you'll instruct your cg artists how textures have to look like
|
||||
* and how they will be processed in your application. However, if you use
|
||||
* Assimp for completely generic loading purposes you might also need to
|
||||
* process these flags in order to display as many 'unknown' 3D models as
|
||||
* possible correctly.
|
||||
*
|
||||
* This corresponds to the <code>AI_MATKEY_TEXFLAGS</code> property.
|
||||
*/
|
||||
enum aiTextureFlags : uint {
|
||||
/**
|
||||
* The texture's color values have to be inverted (i.e. <code>1-n</code>
|
||||
* component-wise).
|
||||
*/
|
||||
Invert = 0x1,
|
||||
|
||||
/**
|
||||
* Explicit request to the application to process the alpha channel of the
|
||||
* texture.
|
||||
*
|
||||
* Mutually exclusive with <code>IgnoreAlpha</code>. These flags are
|
||||
* set if the library can say for sure that the alpha channel is used/is
|
||||
* not used. If the model format does not define this, it is left to the
|
||||
* application to decide whether the texture alpha channel – if any – is
|
||||
* evaluated or not.
|
||||
*/
|
||||
UseAlpha = 0x2,
|
||||
|
||||
/**
|
||||
* Explicit request to the application to ignore the alpha channel of the
|
||||
* texture.
|
||||
*
|
||||
* Mutually exclusive with <code>UseAlpha</code>.
|
||||
*/
|
||||
IgnoreAlpha = 0x4
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines alpha-blend flags.
|
||||
*
|
||||
* If you're familiar with OpenGL or D3D, these flags aren't new to you.
|
||||
* They define how the final color value of a pixel is computed, based on
|
||||
* the previous color at that pixel and the new color value from the
|
||||
* material.
|
||||
*
|
||||
* The basic blending formula is
|
||||
* <code>SourceColor * SourceBlend + DestColor * DestBlend</code>,
|
||||
* where <code>DestColor</code> is the previous color in the framebuffer at
|
||||
* this position and <code>SourceColor</code> is the material color before
|
||||
* the transparency calculation.
|
||||
*
|
||||
* This corresponds to the <code>AI_MATKEY_BLEND_FUNC</code> property.
|
||||
*/
|
||||
enum aiBlendMode :uint {
|
||||
/**
|
||||
* Formula:
|
||||
* <code>SourceColor * SourceAlpha + DestColor * (1 - SourceAlpha)</code>
|
||||
*/
|
||||
Default = 0x0,
|
||||
|
||||
/**
|
||||
* Additive blending.
|
||||
*
|
||||
* Formula: <code>SourceColor*1 + DestColor*1</code>
|
||||
*/
|
||||
Additive = 0x1
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines how an UV channel is transformed.
|
||||
*
|
||||
* This is just a helper structure for the <code>AI_MATKEY_UVTRANSFORM</code>
|
||||
* key. See its documentation for more details.
|
||||
*/
|
||||
struct aiUVTransform {
|
||||
align ( 1 ) :
|
||||
/**
|
||||
* Translation on the u and v axes.
|
||||
*
|
||||
* The default value is (0|0).
|
||||
*/
|
||||
aiVector2D mTranslation;
|
||||
|
||||
/**
|
||||
* Scaling on the u and v axes.
|
||||
*
|
||||
* The default value is (1|1).
|
||||
*/
|
||||
aiVector2D mScaling;
|
||||
|
||||
/**
|
||||
* Rotation - in counter-clockwise direction.
|
||||
*
|
||||
* The rotation angle is specified in radians. The rotation center is
|
||||
* 0.5|0.5. The default value is 0.
|
||||
*/
|
||||
float mRotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* A very primitive RTTI system to store the data type of a material
|
||||
* property.
|
||||
*/
|
||||
enum aiPropertyTypeInfo : uint {
|
||||
/**
|
||||
* Array of single-precision (32 bit) floats.
|
||||
*
|
||||
* It is possible to use <code>aiGetMaterialInteger[Array]()</code> to
|
||||
* query properties stored in floating-point format. The material system
|
||||
* performs the type conversion automatically.
|
||||
*/
|
||||
Float = 0x1,
|
||||
|
||||
/**
|
||||
* aiString property.
|
||||
*
|
||||
* Arrays of strings aren't possible, <code>aiGetMaterialString()</code>
|
||||
* must be used to query a string property.
|
||||
*/
|
||||
String = 0x3,
|
||||
|
||||
/**
|
||||
* Array of (32 bit) integers.
|
||||
*
|
||||
* It is possible to use <code>aiGetMaterialFloat[Array]()</code> to
|
||||
* query properties stored in integer format. The material system
|
||||
* performs the type conversion automatically.
|
||||
*/
|
||||
Integer = 0x4,
|
||||
|
||||
/**
|
||||
* Simple binary buffer, content undefined. Not convertible to anything.
|
||||
*/
|
||||
Buffer = 0x5
|
||||
}
|
||||
|
||||
/**
|
||||
* Data structure for a single material property.
|
||||
*
|
||||
* As an user, you'll probably never need to deal with this data structure.
|
||||
* Just use the provided <code>aiGetMaterialXXX()</code> functions to query
|
||||
* material properties easily. Processing them manually is faster, but it is
|
||||
* not the recommended way. It isn't worth the effort.
|
||||
*
|
||||
* Material property names follow a simple scheme:
|
||||
*
|
||||
* <code>$[name]</code>: A public property, there must be a corresponding
|
||||
* AI_MATKEY_XXX constant.
|
||||
*
|
||||
* <code>?[name]</code>: Also public, but ignored by the
|
||||
* <code>aiProcess.RemoveRedundantMaterials</code> post-processing step.
|
||||
*
|
||||
* <code>~[name]</code>: A temporary property for internal use.
|
||||
*/
|
||||
struct aiMaterialProperty {
|
||||
/**
|
||||
* Specifies the name of the property (key).
|
||||
*
|
||||
* Keys are generally case insensitive.
|
||||
*/
|
||||
aiString mKey;
|
||||
|
||||
/**
|
||||
* For texture properties, this specifies the exact usage semantic.
|
||||
*
|
||||
* For non-texture properties, this member is always 0 (or rather
|
||||
* <code>aiTextureType.NONE</code>).
|
||||
*/
|
||||
uint mSemantic;
|
||||
|
||||
/**
|
||||
* For texture properties, this specifies the index of the texture.
|
||||
*
|
||||
* For non-texture properties, this member is always 0.
|
||||
*/
|
||||
uint mIndex;
|
||||
|
||||
/**
|
||||
* Size of the buffer <code>mData</code> is pointing to (in bytes).
|
||||
*
|
||||
* This value may not be 0.
|
||||
*/
|
||||
uint mDataLength;
|
||||
|
||||
/**
|
||||
* Type information for the property.
|
||||
*
|
||||
* Defines the data layout inside the data buffer. This is used by the
|
||||
* library internally to perform debug checks and to utilize proper type
|
||||
* conversions.
|
||||
*/
|
||||
aiPropertyTypeInfo mType;
|
||||
|
||||
/**
|
||||
* Binary buffer to hold the property's value.
|
||||
*
|
||||
* The size of the buffer is always <code>mDataLength</code>.
|
||||
*/
|
||||
char* mData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data structure for a material
|
||||
*
|
||||
* Material data is stored using a key-value structure. A single key-value
|
||||
* pair is called a <em>material property</em>. The properties can be
|
||||
* queried using the <code>aiMaterialGetXXX</code> family of functions. The
|
||||
* library defines a set of standard keys (AI_MATKEY_XXX).
|
||||
*/
|
||||
struct aiMaterial {
|
||||
/**
|
||||
* List of all material properties loaded.
|
||||
*/
|
||||
aiMaterialProperty** mProperties;
|
||||
|
||||
/**
|
||||
* Number of properties loaded.
|
||||
*/
|
||||
uint mNumProperties;
|
||||
uint mNumAllocated; /// ditto
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard material property keys. Always pass 0 for texture type and index
|
||||
* when querying these keys.
|
||||
*/
|
||||
const char* AI_MATKEY_NAME = "?mat.name";
|
||||
const char* AI_MATKEY_TWOSIDED = "$mat.twosided"; /// ditto
|
||||
const char* AI_MATKEY_SHADING_MODEL = "$mat.shadingm"; /// ditto
|
||||
const char* AI_MATKEY_ENABLE_WIREFRAME = "$mat.wireframe"; /// ditto
|
||||
const char* AI_MATKEY_BLEND_FUNC = "$mat.blend"; /// ditto
|
||||
const char* AI_MATKEY_OPACITY = "$mat.opacity"; /// ditto
|
||||
const char* AI_MATKEY_BUMPSCALING = "$mat.bumpscaling"; /// ditto
|
||||
const char* AI_MATKEY_SHININESS = "$mat.shininess"; /// ditto
|
||||
const char* AI_MATKEY_REFLECTIVITY = "$mat.reflectivity"; /// ditto
|
||||
const char* AI_MATKEY_SHININESS_STRENGTH = "$mat.shinpercent"; /// ditto
|
||||
const char* AI_MATKEY_REFRACTI = "$mat.refracti"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_DIFFUSE = "$clr.diffuse"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_AMBIENT = "$clr.ambient"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_SPECULAR = "$clr.specular"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_EMISSIVE = "$clr.emissive"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_TRANSPARENT = "$clr.transparent"; /// ditto
|
||||
const char* AI_MATKEY_COLOR_REFLECTIVE = "$clr.reflective"; /// ditto
|
||||
const char* AI_MATKEY_GLOBAL_BACKGROUND_IMAGE = "?bg.global"; /// ditto
|
||||
|
||||
/**
|
||||
* Texture material property keys. Do not forget to specify texture type and
|
||||
* index for these keys.
|
||||
*/
|
||||
const char* AI_MATKEY_TEXTURE = "$tex.file";
|
||||
const char* AI_MATKEY_UVWSRC = "$tex.uvwsrc"; /// ditto
|
||||
const char* AI_MATKEY_TEXOP = "$tex.op"; /// ditto
|
||||
const char* AI_MATKEY_MAPPING = "$tex.mapping"; /// ditto
|
||||
const char* AI_MATKEY_TEXBLEND = "$tex.blend"; /// ditto
|
||||
const char* AI_MATKEY_MAPPINGMODE_U = "$tex.mapmodeu"; /// ditto
|
||||
const char* AI_MATKEY_MAPPINGMODE_V = "$tex.mapmodev"; /// ditto
|
||||
const char* AI_MATKEY_TEXMAP_AXIS = "$tex.mapaxis"; /// ditto
|
||||
const char* AI_MATKEY_UVTRANSFORM = "$tex.uvtrafo"; /// ditto
|
||||
const char* AI_MATKEY_TEXFLAGS = "$tex.flags"; /// ditto
|
||||
}
|
155
thirdparty/assimp/port/dAssimp/assimp/math.d
vendored
155
thirdparty/assimp/port/dAssimp/assimp/math.d
vendored
@ -1,155 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mathematical structures in which the imported data is stored.
|
||||
*/
|
||||
module assimp.math;
|
||||
|
||||
extern( C ) {
|
||||
/**
|
||||
* Represents a two-dimensional vector.
|
||||
*/
|
||||
struct aiVector2D {
|
||||
align ( 1 ):
|
||||
float x, y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a three-dimensional vector.
|
||||
*/
|
||||
struct aiVector3D {
|
||||
align ( 1 ):
|
||||
float x, y, z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a quaternion.
|
||||
*/
|
||||
struct aiQuaternion {
|
||||
float w, x, y, z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a row-major 3x3 matrix
|
||||
*
|
||||
* There is much confusion about matrix layouts (column vs. row order). This
|
||||
* is <em>always</em> a row-major matrix, even when using the
|
||||
* <code>ConvertToLeftHanded</code> post processing step.
|
||||
*/
|
||||
struct aiMatrix3x3 {
|
||||
float a1, a2, a3;
|
||||
float b1, b2, b3;
|
||||
float c1, c2, c3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a row-major 3x3 matrix
|
||||
*
|
||||
* There is much confusion about matrix layouts (column vs. row order). This
|
||||
* is <em>always</em> a row-major matrix, even when using the
|
||||
* <code>ConvertToLeftHanded</code> post processing step.
|
||||
*/
|
||||
struct aiMatrix4x4 {
|
||||
align ( 1 ):
|
||||
float a1, a2, a3, a4;
|
||||
float b1, b2, b3, b4;
|
||||
float c1, c2, c3, c4;
|
||||
float d1, d2, d3, d4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a plane in a three-dimensional, euclidean space
|
||||
*/
|
||||
struct aiPlane {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Coefficients of the plane equation (<code>ax + by + cz = d</code>).
|
||||
*/
|
||||
float a;
|
||||
float b; /// ditto
|
||||
float c; /// ditto
|
||||
float d; /// ditto
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a ray.
|
||||
*/
|
||||
struct aiRay {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Origin of the ray.
|
||||
*/
|
||||
aiVector3D pos;
|
||||
|
||||
/**
|
||||
* Direction of the ray.
|
||||
*/
|
||||
aiVector3D dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a color in RGB space.
|
||||
*/
|
||||
struct aiColor3D {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Red, green and blue values.
|
||||
*/
|
||||
float r;
|
||||
float g; /// ditto
|
||||
float b; /// ditto
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a color in RGB space including an alpha component.
|
||||
*/
|
||||
struct aiColor4D {
|
||||
align ( 1 ):
|
||||
/**
|
||||
* Red, green, blue and alpha values.
|
||||
*/
|
||||
float r;
|
||||
float g; /// ditto
|
||||
float b; /// ditto
|
||||
float a; /// ditto
|
||||
}
|
||||
}
|
465
thirdparty/assimp/port/dAssimp/assimp/mesh.d
vendored
465
thirdparty/assimp/port/dAssimp/assimp/mesh.d
vendored
@ -1,465 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structures in which the imported geometry is returned by
|
||||
* Assimp.
|
||||
*/
|
||||
module assimp.mesh;
|
||||
|
||||
import assimp.math;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/*
|
||||
* These limits are required to match the settings Assimp was compiled
|
||||
* against. Therefore, do not redefine them unless you build the library
|
||||
* from source using the same definitions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Maximum number of indices per face (polygon).
|
||||
*/
|
||||
const AI_MAX_FACE_INDICES = 0x7fff;
|
||||
|
||||
/**
|
||||
* Maximum number of indices per face (polygon).
|
||||
*/
|
||||
const AI_MAX_BONE_WEIGHTS = 0x7fffffff;
|
||||
|
||||
/**
|
||||
* Maximum number of vertices per mesh.
|
||||
*/
|
||||
const AI_MAX_VERTICES = 0x7fffffff;
|
||||
|
||||
/**
|
||||
* Maximum number of faces per mesh.
|
||||
*/
|
||||
const AI_MAX_FACES = 0x7fffffff;
|
||||
|
||||
/**
|
||||
* Supported number of vertex color sets per mesh.
|
||||
*/
|
||||
const AI_MAX_NUMBER_OF_COLOR_SETS = 0x4;
|
||||
|
||||
/**
|
||||
* Supported number of texture coord sets (UV(W) channels) per mesh.
|
||||
*/
|
||||
const AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x4;
|
||||
|
||||
|
||||
/**
|
||||
* A single face in a mesh, referring to multiple vertices.
|
||||
*
|
||||
* If <code>mNumIndices</code> is 3, we call the face <em>triangle</em>, for
|
||||
* for <code>mNumIndices > 3</code> it's called <em>polygon</em>.
|
||||
*
|
||||
* <code>aiMesh.mPrimitiveTypes</code> can be queried to quickly examine
|
||||
* which types of primitive are actually present in a mesh. The
|
||||
* <code>aiProcess.SortByPType</code> flag post-processing step splits
|
||||
* meshes containing different primitive types (e.g. lines and triangles) in
|
||||
* several "clean" submeshes.
|
||||
*
|
||||
* Furthermore, there is a configuration option
|
||||
* (<code>AI_CONFIG_PP_SBP_REMOVE</code>) to force <code>SortByPType</code>
|
||||
* to completely remove specific kinds of primitives from the imported scene.
|
||||
* In many cases you'll probably want to set this setting to
|
||||
* <code>aiPrimitiveType.LINE | aiPrimitiveType.POINT</code>. Together with
|
||||
* the <code>aiProcess.Triangulate</code> flag you can then be sure that
|
||||
* <code>mNumIndices</code> is always 3.
|
||||
*/
|
||||
struct aiFace {
|
||||
/**
|
||||
* Number of indices defining this face.
|
||||
*
|
||||
* The maximum value for this member is <code>AI_MAX_FACE_INDICES</code>.
|
||||
*/
|
||||
uint mNumIndices;
|
||||
|
||||
/**
|
||||
* Array of the indices defining the face.
|
||||
*
|
||||
* The size is given in <code>mNumIndices</code>.
|
||||
*/
|
||||
uint* mIndices;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single influence of a bone on a vertex.
|
||||
*/
|
||||
struct aiVertexWeight {
|
||||
/**
|
||||
* Index of the vertex which is influenced by the bone.
|
||||
*/
|
||||
uint mVertexId;
|
||||
|
||||
/**
|
||||
* The strength of the influence in the range <code>[0..1]</code>.
|
||||
*
|
||||
* The influence from all bones at one vertex sums up to 1.
|
||||
*/
|
||||
float mWeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single bone of a mesh.
|
||||
*
|
||||
* A bone has a name by which it can be found in the frame hierarchy and by
|
||||
* which it can be addressed by animations. In addition it has a number of
|
||||
* influences on vertices.
|
||||
*/
|
||||
struct aiBone {
|
||||
/**
|
||||
* The name of the bone.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* The number of vertices affected by this bone.
|
||||
*
|
||||
* The maximum value for this member is <code>AI_MAX_BONE_WEIGHTS</code>.
|
||||
*/
|
||||
uint mNumWeights;
|
||||
|
||||
/**
|
||||
* The vertices affected by this bone.
|
||||
*
|
||||
* This array is <code>mNumWeights</code> entries in size.
|
||||
*/
|
||||
aiVertexWeight* mWeights;
|
||||
|
||||
/**
|
||||
* Matrix that transforms from mesh space to bone space (in the bind
|
||||
* pose).
|
||||
*/
|
||||
aiMatrix4x4 mOffsetMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates the types of geometric primitives supported by Assimp.
|
||||
*
|
||||
* See: <code>aiFace</code>, <code>aiProcess.SortByPType</code>,
|
||||
* <code>aiProcess.Triangulate</code>,
|
||||
* <code>AI_CONFIG_PP_SBP_REMOVE</code>.
|
||||
*/
|
||||
enum aiPrimitiveType : uint {
|
||||
/** A point primitive.
|
||||
*
|
||||
* This is just a single vertex in the virtual world,
|
||||
* <code>aiFace</code> contains just one index for such a primitive.
|
||||
*/
|
||||
POINT = 0x1,
|
||||
|
||||
/** A line primitive.
|
||||
*
|
||||
* This is a line defined through a start and an end position.
|
||||
* <code>aiFace</code> contains exactly two indices for such a primitive.
|
||||
*/
|
||||
LINE = 0x2,
|
||||
|
||||
/** A triangular primitive.
|
||||
*
|
||||
* A triangle consists of three indices.
|
||||
*/
|
||||
TRIANGLE = 0x4,
|
||||
|
||||
/** A higher-level polygon with more than 3 edges.
|
||||
*
|
||||
* A triangle is a polygon, but in this context, polygon means
|
||||
* "all polygons that are not triangles". The <code>Triangulate</code>
|
||||
* post processing step is provided for your convenience, it splits all
|
||||
* polygons in triangles (which are much easier to handle).
|
||||
*/
|
||||
POLYGON = 0x8
|
||||
}
|
||||
|
||||
// Note: The AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) macro from the C headers is
|
||||
// missing since there is probably not much use for it when just reading
|
||||
// scene files.
|
||||
|
||||
/**
|
||||
* NOT CURRENTLY IN USE. An AnimMesh is an attachment to an #aiMesh stores
|
||||
* per-vertex animations for a particular frame.
|
||||
*
|
||||
* You may think of an <code>aiAnimMesh</code> as a `patch` for the host
|
||||
* mesh, which replaces only certain vertex data streams at a particular
|
||||
* time.
|
||||
*
|
||||
* Each mesh stores n attached attached meshes (<code>aiMesh.mAnimMeshes</code>).
|
||||
* The actual relationship between the time line and anim meshes is
|
||||
* established by #aiMeshAnim, which references singular mesh attachments
|
||||
* by their ID and binds them to a time offset.
|
||||
*/
|
||||
struct aiAnimMesh {
|
||||
/**
|
||||
* Replacement for aiMesh.mVertices.
|
||||
*
|
||||
* If this array is non-null, it *must* contain mNumVertices entries.
|
||||
* The corresponding array in the host mesh must be non-null as well -
|
||||
* animation meshes may neither add or nor remove vertex components (if
|
||||
* a replacement array is NULL and the corresponding source array is
|
||||
* not, the source data is taken instead).
|
||||
*/
|
||||
aiVector3D* mVertices;
|
||||
|
||||
/// Replacement for <code>aiMesh.mNormals</code>.
|
||||
aiVector3D* mNormals;
|
||||
|
||||
/// Replacement for <code>aiMesh.mTangents</code>.
|
||||
aiVector3D* mTangents;
|
||||
|
||||
/// Replacement for <code>aiMesh.mBitangents</code>.
|
||||
aiVector3D* mBitangents;
|
||||
|
||||
/// Replacement for <code>aiMesh.mColors</code>.
|
||||
aiColor4D* mColors[ AI_MAX_NUMBER_OF_COLOR_SETS ];
|
||||
|
||||
/// Replacement for <code>aiMesh.mTextureCoords</code>.
|
||||
aiVector3D* mTextureCoords[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||
|
||||
/**
|
||||
* The number of vertices in the aiAnimMesh, and thus the length of all
|
||||
* the member arrays.
|
||||
*
|
||||
* This has always the same value as the mNumVertices property in the
|
||||
* corresponding aiMesh. It is duplicated here merely to make the length
|
||||
* of the member arrays accessible even if the aiMesh is not known, e.g.
|
||||
* from language bindings.
|
||||
*/
|
||||
uint mNumVertices;
|
||||
}
|
||||
|
||||
/**
|
||||
* A mesh represents a geometry or model with a single material.
|
||||
*
|
||||
* It usually consists of a number of vertices and a series
|
||||
* primitives/faces referencing the vertices. In addition there might be a
|
||||
* series of bones, each of them addressing a number of vertices with a
|
||||
* certain weight. Vertex data is presented in channels with each channel
|
||||
* containing a single per-vertex information such as a set of texture
|
||||
* coords or a normal vector. If a data pointer is non-null, the
|
||||
* corresponding data stream is present.
|
||||
*
|
||||
* A mesh uses only a single material which is referenced by a material ID.
|
||||
*
|
||||
* Note: The <code>mPositions</code> member is usually not optional.
|
||||
* However, vertex positions <em>could</em> be missing if the
|
||||
* <code>AI_SCENE_FLAGS_INCOMPLETE</code> flag is set in
|
||||
* <code>aiScene.mFlags</code>.
|
||||
*/
|
||||
struct aiMesh {
|
||||
/**
|
||||
* Bitwise combination of <code>aiPrimitiveType</code> members.
|
||||
*
|
||||
* This specifies which types of primitives are present in the mesh.
|
||||
* The <code>SortByPrimitiveType</code> post processing step can be used
|
||||
* to make sure the output meshes consist of one primitive type each.
|
||||
*/
|
||||
uint mPrimitiveTypes;
|
||||
|
||||
/**
|
||||
* The number of vertices in this mesh.
|
||||
*
|
||||
* This is also the size of all of the per-vertex data arrays. The
|
||||
* maximum value for this member is <code>AI_MAX_VERTICES</code>.
|
||||
*/
|
||||
uint mNumVertices;
|
||||
|
||||
/**
|
||||
* The number of primitives (triangles, polygons, lines) in this mesh.
|
||||
*
|
||||
* This is also the size of the <code>mFaces</code> array. The maximum
|
||||
* value for this member is <code>AI_MAX_FACES</code>.
|
||||
*/
|
||||
uint mNumFaces;
|
||||
|
||||
/**
|
||||
* Vertex positions.
|
||||
*
|
||||
* This array is always present in a mesh. The array is
|
||||
* <code>mNumVertices</code> in size.
|
||||
*/
|
||||
aiVector3D* mVertices;
|
||||
|
||||
/**
|
||||
* Vertex normals.
|
||||
*
|
||||
* The array contains normalized vectors, null if not present.
|
||||
* The array is <code>mNumVertices</code> in size.
|
||||
*
|
||||
* Normals are undefined for point and line primitives. A mesh
|
||||
* consisting of points and lines only may not have normal vectors.
|
||||
* Meshes with mixed primitive types (i.e. lines and triangles) may have
|
||||
* normals, but the normals for vertices that are only referenced by
|
||||
* point or line primitives are undefined and set to <code>QNAN</code>.
|
||||
*
|
||||
* Note: Normal vectors computed by Assimp are always unit-length.
|
||||
* However, this needn't apply for normals that have been taken
|
||||
* directly from the model file.
|
||||
*/
|
||||
aiVector3D* mNormals;
|
||||
|
||||
/**
|
||||
* Vertex tangents.
|
||||
*
|
||||
* The tangent of a vertex points in the direction of the positive x
|
||||
* texture axis. The array contains normalized vectors, null if
|
||||
* not present. The array is <code>mNumVertices</code> in size.
|
||||
*
|
||||
* A mesh consisting of points and lines only may not have normal
|
||||
* vectors. Meshes with mixed primitive types (i.e. lines and triangles)
|
||||
* may have normals, but the normals for vertices that are only
|
||||
* referenced by point or line primitives are undefined and set to
|
||||
* <code>QNAN</code>.
|
||||
*
|
||||
* Note: If the mesh contains tangents, it automatically also contains
|
||||
* bitangents (the bitangent is just the cross product of tangent and
|
||||
* normal vectors).
|
||||
*/
|
||||
aiVector3D* mTangents;
|
||||
|
||||
/**
|
||||
* Vertex bitangents.
|
||||
*
|
||||
* The bitangent of a vertex points in the direction of the positive Y
|
||||
* texture axis. The array contains normalized vectors, null if not
|
||||
* present. The array is <code>mNumVertices</code> in size.
|
||||
*
|
||||
* Note: If the mesh contains tangents, it automatically also contains
|
||||
* bitangents.
|
||||
*/
|
||||
aiVector3D* mBitangents;
|
||||
|
||||
/**
|
||||
* Vertex color sets.
|
||||
*
|
||||
* A mesh may contain 0 to <code>AI_MAX_NUMBER_OF_COLOR_SETS</code>
|
||||
* vertex colors per vertex. null if not present.
|
||||
*
|
||||
* Each array is <code>mNumVertices</code> in size if present.
|
||||
*/
|
||||
aiColor4D* mColors[ AI_MAX_NUMBER_OF_COLOR_SETS ];
|
||||
|
||||
/**
|
||||
* Vertex texture coords, also known as UV channels.
|
||||
* A mesh may contain 0 to <code>AI_MAX_NUMBER_OF_TEXTURECOORDS</code>
|
||||
* per vertex. null if not present.
|
||||
*
|
||||
* Each array is <code>mNumVertices</code> in size.
|
||||
*/
|
||||
aiVector3D* mTextureCoords[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||
|
||||
/**
|
||||
* Specifies the number of components for a given UV channel.
|
||||
*
|
||||
* Up to three channels are supported (UVW, for accessing volume or cube
|
||||
* maps). If the value is 2 for a given channel <code>n</code>, the
|
||||
* component <code>p.z</code> of <code>mTextureCoords[n][p]</code> is set
|
||||
* to 0. If the value is 1 for a given channel, <code>p.y</code> is set
|
||||
* to 0, too. If this value is 0, 2 should be assumed.
|
||||
*
|
||||
* Note: 4D coords are not supported.
|
||||
*/
|
||||
uint mNumUVComponents[ AI_MAX_NUMBER_OF_TEXTURECOORDS ];
|
||||
|
||||
/**
|
||||
* The faces the mesh is contstructed from.
|
||||
*
|
||||
* Each face refers to a number of vertices by their indices.
|
||||
* This array is always present in a mesh, its size is given
|
||||
* in <code>mNumFaces</code>. If the
|
||||
* <code>AI_SCENE_FLAGS_NON_VERBOSE_FORMAT</code> is <em>not</em> set,
|
||||
* each face references an unique set of vertices.
|
||||
*/
|
||||
aiFace* mFaces;
|
||||
|
||||
/**
|
||||
* The number of bones this mesh contains.
|
||||
*
|
||||
* Can be 0, in which case the <code>mBones</code> array is null.
|
||||
*/
|
||||
uint mNumBones;
|
||||
|
||||
/**
|
||||
* The bones of this mesh.
|
||||
*
|
||||
* A bone consists of a name by which it can be found in the frame
|
||||
* hierarchy and a set of vertex weights.
|
||||
*/
|
||||
aiBone** mBones;
|
||||
|
||||
/**
|
||||
* The material used by this mesh.
|
||||
*
|
||||
* A mesh does use only a single material. If an imported model uses
|
||||
* multiple materials, the import splits up the mesh. Use this value as
|
||||
* index into the scene's material list.
|
||||
*/
|
||||
uint mMaterialIndex;
|
||||
|
||||
/**
|
||||
* Name of the mesh.
|
||||
*
|
||||
* Meshes can be named, but this is not a requirement and leaving this
|
||||
* field empty is totally fine.
|
||||
*
|
||||
* There are mainly three uses for mesh names:
|
||||
* - Some formats name nodes and meshes independently.
|
||||
* - Importers tend to split meshes up to meet the one-material-per-mesh
|
||||
* requirement. Assigning the same (dummy) name to each of the result
|
||||
* meshes aids the caller at recovering the original mesh partitioning.
|
||||
* - Vertex animations refer to meshes by their names.
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/// NOT CURRENTLY IN USE. The number of attachment meshes.
|
||||
uint mNumAnimMeshes;
|
||||
|
||||
/**
|
||||
* NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-
|
||||
* based animation.
|
||||
*
|
||||
* Attachment meshes carry replacement data for some of the mesh's
|
||||
* vertex components (usually positions, normals).
|
||||
*/
|
||||
aiAnimMesh** mAnimMeshes;
|
||||
}
|
||||
}
|
597
thirdparty/assimp/port/dAssimp/assimp/postprocess.d
vendored
597
thirdparty/assimp/port/dAssimp/assimp/postprocess.d
vendored
@ -1,597 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Definitions for import post processing steps.
|
||||
*/
|
||||
module assimp.postprocess;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Defines the flags for all possible post processing steps.
|
||||
*
|
||||
* See: <code>aiImportFile</code>, <code>aiImportFileEx</code>
|
||||
*/
|
||||
enum aiPostProcessSteps {
|
||||
/**
|
||||
* Calculates the tangents and bitangents for the imported meshes.
|
||||
*
|
||||
* Does nothing if a mesh does not have normals. You might want this post
|
||||
* processing step to be executed if you plan to use tangent space
|
||||
* calculations such as normal mapping applied to the meshes. There is a
|
||||
* config setting, <code>AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE</code>,
|
||||
* which allows you to specify a maximum smoothing angle for the
|
||||
* algorithm. However, usually you will want to use the default value.
|
||||
*/
|
||||
CalcTangentSpace = 0x1,
|
||||
|
||||
/**
|
||||
* Identifies and joins identical vertex data sets within all imported
|
||||
* meshes.
|
||||
*
|
||||
* After this step is run each mesh does contain only unique vertices
|
||||
* anymore, so a vertex is possibly used by multiple faces. You usually
|
||||
* want to use this post processing step. If your application deals with
|
||||
* indexed geometry, this step is compulsory or you will just waste
|
||||
* rendering time. <em>If this flag is not specified</em>, no vertices
|
||||
* are referenced by more than one face and <em>no index buffer is
|
||||
* required</em> for rendering.
|
||||
*/
|
||||
JoinIdenticalVertices = 0x2,
|
||||
|
||||
/**
|
||||
* Converts all the imported data to a left-handed coordinate space.
|
||||
*
|
||||
* By default the data is returned in a right-handed coordinate space
|
||||
* which for example OpenGL prefers. In this space, +X points to the
|
||||
* right, +Z points towards the viewer and and +Y points upwards. In the
|
||||
* DirectX coordinate space +X points to the right, +Y points upwards and
|
||||
* +Z points away from the viewer.
|
||||
*
|
||||
* You will probably want to consider this flag if you use Direct3D for
|
||||
* rendering. The <code>ConvertToLeftHanded</code> flag supersedes this
|
||||
* setting and bundles all conversions typically required for D3D-based
|
||||
* applications.
|
||||
*/
|
||||
MakeLeftHanded = 0x4,
|
||||
|
||||
/**
|
||||
* Triangulates all faces of all meshes.
|
||||
*
|
||||
* By default the imported mesh data might contain faces with more than 3
|
||||
* indices. For rendering you'll usually want all faces to be triangles.
|
||||
* This post processing step splits up all higher faces to triangles.
|
||||
* Line and point primitives are <em>not</em> modified!.
|
||||
*
|
||||
* If you want »triangles only« with no other kinds of primitives,
|
||||
* specify both <code>Triangulate</code> and <code>SortByPType</code> and
|
||||
* ignore all point and line meshes when you process Assimp's output.
|
||||
*/
|
||||
Triangulate = 0x8,
|
||||
|
||||
/**
|
||||
* Removes some parts of the data structure (animations, materials, light
|
||||
* sources, cameras, textures, vertex components).
|
||||
*
|
||||
* The components to be removed are specified in a separate configuration
|
||||
* option, <code>AI_CONFIG_PP_RVC_FLAGS</code>. This is quite useful if
|
||||
* you don't need all parts of the output structure. Especially vertex
|
||||
* colors are rarely used today.
|
||||
*
|
||||
* Calling this step to remove unrequired stuff from the pipeline as
|
||||
* early as possible results in an increased performance and a better
|
||||
* optimized output data structure.
|
||||
*
|
||||
* This step is also useful if you want to force Assimp to recompute
|
||||
* normals or tangents since the corresponding steps don't recompute them
|
||||
* if they have already been loaded from the source asset.
|
||||
*
|
||||
* This flag is a poor one, mainly because its purpose is usually
|
||||
* misunderstood. Consider the following case: a 3d model has been exported
|
||||
* from a CAD app, it has per-face vertex colors. Because of the vertex
|
||||
* colors (which are not even used by most apps),
|
||||
* <code>JoinIdenticalVertices</code> cannot join vertices at the same
|
||||
* position. By using this step, unneeded components are excluded as
|
||||
* early as possible thus opening more room for internal optimzations.
|
||||
*/
|
||||
RemoveComponent = 0x10,
|
||||
|
||||
/**
|
||||
* Generates normals for all faces of all meshes.
|
||||
*
|
||||
* This is ignored if normals are already there at the time where this
|
||||
* flag is evaluated. Model importers try to load them from the source
|
||||
* file, so they are usually already there. Face normals are shared
|
||||
* between all points of a single face, so a single point can have
|
||||
* multiple normals, which, in other words, enforces the library to
|
||||
* duplicate vertices in some cases. <code>JoinIdenticalVertices</code>
|
||||
* is <em>useless</em> then.
|
||||
*
|
||||
* This flag may not be specified together with
|
||||
* <code>GenSmoothNormals</code>.
|
||||
*/
|
||||
GenNormals = 0x20,
|
||||
|
||||
/**
|
||||
* Generates smooth normals for all vertices in the mesh.
|
||||
*
|
||||
* This is ignored if normals are already there at the time where this
|
||||
* flag is evaluated. Model importers try to load them from the source file, so
|
||||
* they are usually already there.
|
||||
*
|
||||
* There is a configuration option,
|
||||
* <code>AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE</code> which allows you to
|
||||
* specify an angle maximum for the normal smoothing algorithm. Normals
|
||||
* exceeding this limit are not smoothed, resulting in a »hard« seam
|
||||
* between two faces. Using a decent angle here (e.g. 80°) results in
|
||||
* very good visual appearance.
|
||||
*/
|
||||
GenSmoothNormals = 0x40,
|
||||
|
||||
/**
|
||||
* Splits large meshes into smaller submeshes.
|
||||
*
|
||||
* This is quite useful for realtime rendering where the number of triangles
|
||||
* which can be maximally processed in a single draw-call is usually limited
|
||||
* by the video driver/hardware. The maximum vertex buffer is usually limited,
|
||||
* too. Both requirements can be met with this step: you may specify both a
|
||||
* triangle and vertex limit for a single mesh.
|
||||
*
|
||||
* The split limits can (and should!) be set through the
|
||||
* <code>AI_CONFIG_PP_SLM_VERTEX_LIMIT</code> and
|
||||
* <code>AI_CONFIG_PP_SLM_TRIANGLE_LIMIT</code> settings. The default
|
||||
* values are <code>AI_SLM_DEFAULT_MAX_VERTICES</code> and
|
||||
* <code>AI_SLM_DEFAULT_MAX_TRIANGLES</code>.
|
||||
*
|
||||
* Note that splitting is generally a time-consuming task, but not if
|
||||
* there's nothing to split. The use of this step is recommended for most
|
||||
* users.
|
||||
*/
|
||||
SplitLargeMeshes = 0x80,
|
||||
|
||||
/**
|
||||
* Removes the node graph and pre-transforms all vertices with the local
|
||||
* transformation matrices of their nodes.
|
||||
*
|
||||
* The output scene does still contain nodes, however, there is only a
|
||||
* root node with children, each one referencing only one mesh, each
|
||||
* mesh referencing one material. For rendering, you can simply render
|
||||
* all meshes in order, you don't need to pay attention to local
|
||||
* transformations and the node hierarchy. Animations are removed during
|
||||
* this step.
|
||||
*
|
||||
* This step is intended for applications that have no scenegraph.
|
||||
*
|
||||
* The step <em>can</em> cause some problems: if e.g. a mesh of the asset
|
||||
* contains normals and another, using the same material index, does not,
|
||||
* they will be brought together, but the first meshes's part of the
|
||||
* normal list is zeroed. However, these artifacts are rare.
|
||||
*
|
||||
* Note: The <code>AI_CONFIG_PP_PTV_NORMALIZE</code> configuration
|
||||
* property can be set to normalize the scene's spatial dimension
|
||||
* to the -1...1 range.
|
||||
*/
|
||||
PreTransformVertices = 0x100,
|
||||
|
||||
/**
|
||||
* Limits the number of bones simultaneously affecting a single vertex to
|
||||
* a maximum value.
|
||||
*
|
||||
* If any vertex is affected by more than that number of bones, the least
|
||||
* important vertex weights are removed and the remaining vertex weights
|
||||
* are renormalized so that the weights still sum up to 1.
|
||||
*
|
||||
* The default bone weight limit is 4 (<code>AI_LMW_MAX_WEIGHTS</code>),
|
||||
* but you can use the <code>#AI_CONFIG_PP_LBW_MAX_WEIGHTS</code> setting
|
||||
* to supply your own limit to the post processing step.
|
||||
*
|
||||
* If you intend to perform the skinning in hardware, this post processing
|
||||
* step might be of interest for you.
|
||||
*/
|
||||
LimitBoneWeights = 0x200,
|
||||
|
||||
/**
|
||||
* Validates the imported scene data structure.
|
||||
*
|
||||
* This makes sure that all indices are valid, all animations and
|
||||
* bones are linked correctly, all material references are correct, etc.
|
||||
*
|
||||
* It is recommended to capture Assimp's log output if you use this flag,
|
||||
* so you can easily find ot what's actually wrong if a file fails the
|
||||
* validation. The validator is quite rude and will find <em>all</em>
|
||||
* inconsistencies in the data structure.
|
||||
*
|
||||
* Plugin developers are recommended to use it to debug their loaders.
|
||||
*
|
||||
* There are two types of validation failures:
|
||||
* <ul>
|
||||
* <li>Error: There's something wrong with the imported data. Further
|
||||
* postprocessing is not possible and the data is not usable at all.
|
||||
* The import fails, see <code>aiGetErrorString()</code> for the
|
||||
* error message.</li>
|
||||
* <li>Warning: There are some minor issues (e.g. 1000000 animation
|
||||
* keyframes with the same time), but further postprocessing and use
|
||||
* of the data structure is still safe. Warning details are written
|
||||
* to the log file, <code>AI_SCENE_FLAGS_VALIDATION_WARNING</code> is
|
||||
* set in <code>aiScene::mFlags</code></li>
|
||||
* </ul>
|
||||
*
|
||||
* This post-processing step is not time-consuming. It's use is not
|
||||
* compulsory, but recommended.
|
||||
*/
|
||||
ValidateDataStructure = 0x400,
|
||||
|
||||
/**
|
||||
* Reorders triangles for better vertex cache locality.
|
||||
*
|
||||
* The step tries to improve the ACMR (average post-transform vertex cache
|
||||
* miss ratio) for all meshes. The implementation runs in O(n) and is
|
||||
* roughly based on the 'tipsify' algorithm (see
|
||||
* <tt>http://www.cs.princeton.edu/gfx/pubs/Sander_2007_%3ETR/tipsy.pdf</tt>).
|
||||
*
|
||||
* If you intend to render huge models in hardware, this step might
|
||||
* be of interest for you. The <code>AI_CONFIG_PP_ICL_PTCACHE_SIZE</code>
|
||||
* config setting can be used to fine-tune the cache optimization.
|
||||
*/
|
||||
ImproveCacheLocality = 0x800,
|
||||
|
||||
/**
|
||||
* Searches for redundant/unreferenced materials and removes them.
|
||||
*
|
||||
* This is especially useful in combination with the
|
||||
* <code>PretransformVertices</code> and <code>OptimizeMeshes</code>
|
||||
* flags. Both join small meshes with equal characteristics, but they
|
||||
* can't do their work if two meshes have different materials. Because
|
||||
* several material settings are always lost during Assimp's import
|
||||
* filters, (and because many exporters don't check for redundant
|
||||
* materials), huge models often have materials which are are defined
|
||||
* several times with exactly the same settings.
|
||||
*
|
||||
* Several material settings not contributing to the final appearance of
|
||||
* a surface are ignored in all comparisons; the material name is one of
|
||||
* them. So, if you are passing additional information through the
|
||||
* content pipeline (probably using »magic« material names), don't
|
||||
* specify this flag. Alternatively take a look at the
|
||||
* <code>AI_CONFIG_PP_RRM_EXCLUDE_LIST</code> setting.
|
||||
*/
|
||||
RemoveRedundantMaterials = 0x1000,
|
||||
|
||||
/**
|
||||
* This step tries to determine which meshes have normal vectors that are
|
||||
* acing inwards.
|
||||
*
|
||||
* The algorithm is simple but effective: The bounding box of all
|
||||
* vertices and their normals is compared against the volume of the
|
||||
* bounding box of all vertices without their normals. This works well
|
||||
* for most objects, problems might occur with planar surfaces. However,
|
||||
* the step tries to filter such cases.
|
||||
*
|
||||
* The step inverts all in-facing normals. Generally it is recommended to
|
||||
* enable this step, although the result is not always correct.
|
||||
*/
|
||||
FixInfacingNormals = 0x2000,
|
||||
|
||||
/**
|
||||
* This step splits meshes with more than one primitive type in
|
||||
* homogeneous submeshes.
|
||||
*
|
||||
* The step is executed after the triangulation step. After the step
|
||||
* returns, just one bit is set in <code>aiMesh.mPrimitiveTypes</code>.
|
||||
* This is especially useful for real-time rendering where point and line
|
||||
* primitives are often ignored or rendered separately.
|
||||
*
|
||||
* You can use the <code>AI_CONFIG_PP_SBP_REMOVE</code> option to
|
||||
* specify which primitive types you need. This can be used to easily
|
||||
* exclude lines and points, which are rarely used, from the import.
|
||||
*/
|
||||
SortByPType = 0x8000,
|
||||
|
||||
/**
|
||||
* This step searches all meshes for degenerated primitives and converts
|
||||
* them to proper lines or points.
|
||||
*
|
||||
* A face is »degenerated« if one or more of its points are identical.
|
||||
* To have the degenerated stuff not only detected and collapsed but also
|
||||
* removed, try one of the following procedures:
|
||||
*
|
||||
* <b>1.</b> (if you support lines and points for rendering but don't
|
||||
* want the degenerates)
|
||||
* <ul>
|
||||
* <li>Specify the <code>FindDegenerates</code> flag.</li>
|
||||
* <li>Set the <code>AI_CONFIG_PP_FD_REMOVE</code> option to 1. This will
|
||||
* cause the step to remove degenerated triangles from the import
|
||||
* as soon as they're detected. They won't pass any further
|
||||
* pipeline steps.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <b>2.</b>(if you don't support lines and points at all ...)
|
||||
* <ul>
|
||||
* <li>Specify the <code>FindDegenerates</code> flag.</li>
|
||||
* <li>Specify the <code>SortByPType</code> flag. This moves line and
|
||||
* point primitives to separate meshes.</li>
|
||||
* <li>Set the <code>AI_CONFIG_PP_SBP_REMOVE</codet> option to
|
||||
* <code>aiPrimitiveType_POINTS | aiPrimitiveType_LINES</code>
|
||||
* to cause SortByPType to reject point and line meshes from the
|
||||
* scene.</li>
|
||||
* </ul>
|
||||
*
|
||||
* Note: Degenerated polygons are not necessarily bad and that's why
|
||||
* they're not removed by default. There are several file formats
|
||||
* which don't support lines or points. Some exporters bypass the
|
||||
* format specification and write them as degenerated triangle
|
||||
* instead.
|
||||
*/
|
||||
FindDegenerates = 0x10000,
|
||||
|
||||
/**
|
||||
* This step searches all meshes for invalid data, such as zeroed normal
|
||||
* vectors or invalid UV coords and removes/fixes them. This is intended
|
||||
* to get rid of some common exporter errors.
|
||||
*
|
||||
* This is especially useful for normals. If they are invalid, and the
|
||||
* step recognizes this, they will be removed and can later be
|
||||
* recomputed, e.g. by the <code>GenSmoothNormals</code> step.
|
||||
*
|
||||
* The step will also remove meshes that are infinitely small and reduce
|
||||
* animation tracks consisting of hundreds if redundant keys to a single
|
||||
* key. The <code>AI_CONFIG_PP_FID_ANIM_ACCURACY</code> config property
|
||||
* decides the accuracy of the check for duplicate animation tracks.
|
||||
*/
|
||||
FindInvalidData = 0x20000,
|
||||
|
||||
/**
|
||||
* This step converts non-UV mappings (such as spherical or cylindrical
|
||||
* mapping) to proper texture coordinate channels.
|
||||
*
|
||||
* Most applications will support UV mapping only, so you will probably
|
||||
* want to specify this step in every case. Note tha Assimp is not always
|
||||
* able to match the original mapping implementation of the 3d app which
|
||||
* produced a model perfectly. It's always better to let the father app
|
||||
* compute the UV channels, at least 3ds max, maja, blender, lightwave,
|
||||
* modo, ... are able to achieve this.
|
||||
*
|
||||
* Note: If this step is not requested, you'll need to process the
|
||||
* <code>AI_MATKEY_MAPPING</code> material property in order to
|
||||
* display all assets properly.
|
||||
*/
|
||||
GenUVCoords = 0x40000,
|
||||
|
||||
/**
|
||||
* This step applies per-texture UV transformations and bakes them to
|
||||
* stand-alone vtexture coordinate channelss.
|
||||
*
|
||||
* UV transformations are specified per-texture – see the
|
||||
* <code>AI_MATKEY_UVTRANSFORM</code> material key for more information.
|
||||
* This step processes all textures with transformed input UV coordinates
|
||||
* and generates new (pretransformed) UV channel which replace the old
|
||||
* channel. Most applications won't support UV transformations, so you
|
||||
* will probably want to specify this step.
|
||||
*
|
||||
* Note: UV transformations are usually implemented in realtime apps by
|
||||
* transforming texture coordinates at vertex shader stage with a 3x3
|
||||
* (homogenous) transformation matrix.
|
||||
*/
|
||||
TransformUVCoords = 0x80000,
|
||||
|
||||
/**
|
||||
* This step searches for duplicate meshes and replaces duplicates with
|
||||
* references to the first mesh.
|
||||
*
|
||||
* This step takes a while, don't use it if you have no time. Its main
|
||||
* purpose is to workaround the limitation that many export file formats
|
||||
* don't support instanced meshes, so exporters need to duplicate meshes.
|
||||
* This step removes the duplicates again. Please note that Assimp does
|
||||
* currently not support per-node material assignment to meshes, which
|
||||
* means that identical meshes with differnent materials are currently
|
||||
* <em>not</em> joined, although this is planned for future versions.
|
||||
*/
|
||||
FindInstances = 0x100000,
|
||||
|
||||
/**
|
||||
* A postprocessing step to reduce the number of meshes.
|
||||
*
|
||||
* In fact, it will reduce the number of drawcalls.
|
||||
*
|
||||
* This is a very effective optimization and is recommended to be used
|
||||
* together with <code>OptimizeGraph</code>, if possible. The flag is
|
||||
* fully compatible with both <code>SplitLargeMeshes</code> and
|
||||
* <code>SortByPType</code>.
|
||||
*/
|
||||
OptimizeMeshes = 0x200000,
|
||||
|
||||
/**
|
||||
* A postprocessing step to optimize the scene hierarchy.
|
||||
*
|
||||
* Nodes with no animations, bones, lights or cameras assigned are
|
||||
* collapsed and joined.
|
||||
*
|
||||
* Node names can be lost during this step. If you use special tag nodes
|
||||
* to pass additional information through your content pipeline, use the
|
||||
* <code>AI_CONFIG_PP_OG_EXCLUDE_LIST</code> setting to specify a list of
|
||||
* node names you want to be kept. Nodes matching one of the names in
|
||||
* this list won't be touched or modified.
|
||||
*
|
||||
* Use this flag with caution. Most simple files will be collapsed to a
|
||||
* single node, complex hierarchies are usually completely lost. That's
|
||||
* note the right choice for editor environments, but probably a very
|
||||
* effective optimization if you just want to get the model data, convert
|
||||
* it to your own format and render it as fast as possible.
|
||||
*
|
||||
* This flag is designed to be used with <code>OptimizeMeshes</code> for
|
||||
* best results.
|
||||
*
|
||||
* Note: »Crappy« scenes with thousands of extremely small meshes packed
|
||||
* in deeply nested nodes exist for almost all file formats.
|
||||
* <code>OptimizeMeshes</code> in combination with
|
||||
* <code>OptimizeGraph</code> usually fixes them all and makes them
|
||||
* renderable.
|
||||
*/
|
||||
OptimizeGraph = 0x400000,
|
||||
|
||||
/** This step flips all UV coordinates along the y-axis and adjusts
|
||||
* material settings and bitangents accordingly.
|
||||
*
|
||||
* Output UV coordinate system:
|
||||
* <pre> 0y|0y ---------- 1x|0y
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* 0x|1y ---------- 1x|1y</pre>
|
||||
* You'll probably want to consider this flag if you use Direct3D for
|
||||
* rendering. The <code>AI_PROCESS_CONVERT_TO_LEFT_HANDED</code> flag
|
||||
* supersedes this setting and bundles all conversions typically required
|
||||
* for D3D-based applications.
|
||||
*/
|
||||
FlipUVs = 0x800000,
|
||||
|
||||
/**
|
||||
* This step adjusts the output face winding order to be clockwise.
|
||||
*
|
||||
* The default face winding order is counter clockwise.
|
||||
*
|
||||
* Output face order:
|
||||
* <pre> x2
|
||||
*
|
||||
* x0
|
||||
* x1</pre>
|
||||
*/
|
||||
FlipWindingOrder = 0x1000000
|
||||
}
|
||||
|
||||
/**
|
||||
* Abbrevation for convenience.
|
||||
*/
|
||||
alias aiPostProcessSteps aiProcess;
|
||||
|
||||
/**
|
||||
* Shortcut flag for Direct3D-based applications.
|
||||
*
|
||||
* Combines the <code>MakeLeftHanded</code>, <code>FlipUVs</code> and
|
||||
* <code>FlipWindingOrder</code> flags. The output data matches Direct3D's
|
||||
* conventions: left-handed geometry, upper-left origin for UV coordinates
|
||||
* and clockwise face order, suitable for CCW culling.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_CONVERT_TO_LEFT_HANDED =
|
||||
aiProcess.MakeLeftHanded |
|
||||
aiProcess.FlipUVs |
|
||||
aiProcess.FlipWindingOrder;
|
||||
|
||||
/**
|
||||
* Default postprocess configuration optimizing the data for real-time rendering.
|
||||
*
|
||||
* Applications would want to use this preset to load models on end-user
|
||||
* PCs, maybe for direct use in game.
|
||||
*
|
||||
* If you're using DirectX, don't forget to combine this value with
|
||||
* the <code>ConvertToLeftHanded</code> step. If you don't support UV
|
||||
* transformations in your application, apply the
|
||||
* <code>TransformUVCoords</code> step, too.
|
||||
*
|
||||
* Note: Please take the time to read the doc for the steps enabled by this
|
||||
* preset. Some of them offer further configurable properties, some of
|
||||
* them might not be of use for you so it might be better to not specify
|
||||
* them.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_PRESET_TARGET_REALTIME_FAST =
|
||||
aiProcess.CalcTangentSpace |
|
||||
aiProcess.GenNormals |
|
||||
aiProcess.JoinIdenticalVertices |
|
||||
aiProcess.Triangulate |
|
||||
aiProcess.GenUVCoords |
|
||||
aiProcess.SortByPType;
|
||||
|
||||
/**
|
||||
* Default postprocess configuration optimizing the data for real-time
|
||||
* rendering.
|
||||
*
|
||||
* Unlike <code>AI_PROCESS_PRESET_TARGET_REALTIME_FAST</code>, this
|
||||
* configuration performs some extra optimizations to improve rendering
|
||||
* speed and to minimize memory usage. It could be a good choice for a
|
||||
* level editor environment where import speed is not so important.
|
||||
*
|
||||
* If you're using DirectX, don't forget to combine this value with
|
||||
* the <code>ConvertToLeftHanded</code> step. If you don't support UV
|
||||
* transformations in your application, apply the
|
||||
* <code>TransformUVCoords</code> step, too.
|
||||
*
|
||||
* Note: Please take the time to read the doc for the steps enabled by this
|
||||
* preset. Some of them offer further configurable properties, some of
|
||||
* them might not be of use for you so it might be better to not specify
|
||||
* them.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_PRESET_TARGET_REALTIME_QUALITY =
|
||||
aiProcess.CalcTangentSpace |
|
||||
aiProcess.GenSmoothNormals |
|
||||
aiProcess.JoinIdenticalVertices |
|
||||
aiProcess.ImproveCacheLocality |
|
||||
aiProcess.LimitBoneWeights |
|
||||
aiProcess.RemoveRedundantMaterials |
|
||||
aiProcess.SplitLargeMeshes |
|
||||
aiProcess.Triangulate |
|
||||
aiProcess.GenUVCoords |
|
||||
aiProcess.SortByPType |
|
||||
aiProcess.FindDegenerates |
|
||||
aiProcess.FindInvalidData;
|
||||
|
||||
/**
|
||||
* Default postprocess configuration optimizing the data for real-time
|
||||
* rendering.
|
||||
*
|
||||
* This preset enables almost every optimization step to achieve perfectly
|
||||
* optimized data. It's your choice for level editor environments where
|
||||
* import speed is not important.
|
||||
*
|
||||
* If you're using DirectX, don't forget to combine this value with
|
||||
* the <code>ConvertToLeftHanded</code> step. If you don't support UV
|
||||
* transformations in your application, apply the
|
||||
* <code>TransformUVCoords</code> step, too.
|
||||
*
|
||||
* Note: Please take the time to read the doc for the steps enabled by this
|
||||
* preset. Some of them offer further configurable properties, some of
|
||||
* them might not be of use for you so it might be better to not specify
|
||||
* them.
|
||||
*/
|
||||
const aiPostProcessSteps AI_PROCESS_PRESET_TARGET_REALTIME_MAX_QUALITY =
|
||||
AI_PROCESS_PRESET_TARGET_REALTIME_QUALITY |
|
||||
aiProcess.FindInstances |
|
||||
aiProcess.ValidateDataStructure |
|
||||
aiProcess.OptimizeMeshes;
|
||||
}
|
306
thirdparty/assimp/port/dAssimp/assimp/scene.d
vendored
306
thirdparty/assimp/port/dAssimp/assimp/scene.d
vendored
@ -1,306 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains the data structures which store the hierarchy fo the imported data.
|
||||
*/
|
||||
module assimp.scene;
|
||||
|
||||
import assimp.animation;
|
||||
import assimp.camera;
|
||||
import assimp.light;
|
||||
import assimp.math;
|
||||
import assimp.mesh;
|
||||
import assimp.material;
|
||||
import assimp.texture;
|
||||
import assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* A node in the imported hierarchy.
|
||||
*
|
||||
* Each node has name, a parent node (except for the root node), a
|
||||
* transformation relative to its parent and possibly several child nodes.
|
||||
* Simple file formats don't support hierarchical structures, for these
|
||||
* formats the imported scene does consist of only a single root node with
|
||||
* no childs.
|
||||
*/
|
||||
struct aiNode {
|
||||
/**
|
||||
* The name of the node.
|
||||
*
|
||||
* The name might be empty (length of zero) but all nodes which need to
|
||||
* be accessed afterwards by bones or animations are usually named.
|
||||
* Multiple nodes may have the same name, but nodes which are accessed
|
||||
* by bones (see <code>aiBone</code> and <code>aiMesh.mBones</code>)
|
||||
* <em>must</em> be unique.
|
||||
*
|
||||
* Cameras and lights are assigned to a specific node name – if there are
|
||||
* multiple nodes with this name, they are assigned to each of them.
|
||||
*
|
||||
* There are no limitations regarding the characters contained in this
|
||||
* string. You should be able to handle stuff like whitespace, tabs,
|
||||
* linefeeds, quotation marks, ampersands, …
|
||||
*/
|
||||
aiString mName;
|
||||
|
||||
/**
|
||||
* The transformation relative to the node's parent.
|
||||
*/
|
||||
aiMatrix4x4 mTransformation;
|
||||
|
||||
/**
|
||||
* Parent node.
|
||||
*
|
||||
* null if this node is the root node.
|
||||
*/
|
||||
aiNode* mParent;
|
||||
|
||||
/**
|
||||
* The number of child nodes of this node.
|
||||
*/
|
||||
uint mNumChildren;
|
||||
|
||||
/**
|
||||
* The child nodes of this node.
|
||||
*
|
||||
* null if <code>mNumChildren</code> is 0.
|
||||
*/
|
||||
aiNode** mChildren;
|
||||
|
||||
/**
|
||||
* The number of meshes of this node.
|
||||
*/
|
||||
int mNumMeshes;
|
||||
|
||||
/**
|
||||
* The meshes of this node.
|
||||
*
|
||||
* Each entry is an index for <code>aiScene.mMeshes</code>.
|
||||
*/
|
||||
uint* mMeshes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags which are combinated in <code>aiScene.mFlags</code> to store
|
||||
* auxiliary information about the imported scene.
|
||||
*/
|
||||
enum aiSceneFlags : uint {
|
||||
/**
|
||||
* Specifies that the scene data structure that was imported is not
|
||||
* complete.
|
||||
*
|
||||
* This flag bypasses some internal validations and allows the import of
|
||||
* animation skeletons, material libraries or camera animation paths
|
||||
* using Assimp. Most applications won't support such data.
|
||||
*/
|
||||
INCOMPLETE = 0x1,
|
||||
|
||||
/**
|
||||
* This flag is set by the validation post-processing step
|
||||
* (<code>aiProcess.ValidateDS</code>) if the validation was successful.
|
||||
*
|
||||
* In a validated scene you can be sure that any cross references in the
|
||||
* data structure (e.g. vertex indices) are valid.
|
||||
*/
|
||||
VALIDATED = 0x2,
|
||||
|
||||
/**
|
||||
* This flag is set by the validation post-processing step
|
||||
* (<code>aiProcess.ValidateDS</code>) if the validation is successful
|
||||
* but some issues have been found.
|
||||
*
|
||||
* This can for example mean that a texture that does not exist is
|
||||
* referenced by a material or that the bone weights for a vertex don't
|
||||
* sum to 1. In most cases you should still be able to use the import.
|
||||
*
|
||||
* This flag could be useful for applications which don't capture
|
||||
* Assimp's log output.
|
||||
*/
|
||||
VALIDATION_WARNING = 0x4,
|
||||
|
||||
/**
|
||||
* This flag is currently only set by the
|
||||
* <code>aiProcess.JoinIdenticalVertices</code> post-processing step. It
|
||||
* indicates that the vertices of the output meshes aren't in the
|
||||
* internal verbose format anymore. In the verbose format all vertices
|
||||
* are unique, no vertex is ever referenced by more than one face.
|
||||
*/
|
||||
NON_VERBOSE_FORMAT = 0x8,
|
||||
|
||||
/**
|
||||
* Denotes pure height-map terrain data. Pure terrains usually consist of
|
||||
* quads, sometimes triangles, in a regular grid. The x,y coordinates of
|
||||
* all vertex positions refer to the x,y coordinates on the terrain
|
||||
* height map, the z-axis stores the elevation at a specific point.
|
||||
*
|
||||
* TER (Terragen) and HMP (3D Game Studio) are height map formats.
|
||||
*
|
||||
* Note: Assimp is probably not the best choice for loading <em>huge</em>
|
||||
* terrains – fully triangulated data takes extremely much storage
|
||||
* space and should be avoided as long as possible (typically you will
|
||||
* perform the triangulation when you actually need to render it).
|
||||
*/
|
||||
FLAGS_TERRAIN = 0x10
|
||||
}
|
||||
|
||||
/**
|
||||
* The root structure of the imported data.
|
||||
*
|
||||
* Everything that was imported from the given file can be accessed from here.
|
||||
* Objects of this class are generally maintained and owned by Assimp, not
|
||||
* by the caller. You shouldn't want to instance it, nor should you ever try to
|
||||
* delete a given scene on your own.
|
||||
*/
|
||||
struct aiScene {
|
||||
/**
|
||||
* Any combination of the <code>aiSceneFlags</code>. By default, this
|
||||
* value is 0, no flags are set.
|
||||
*
|
||||
* Most applications will want to reject all scenes with the
|
||||
* <code>aiSceneFlags.INCOMPLETE</code> bit set.
|
||||
*/
|
||||
uint mFlags;
|
||||
|
||||
/**
|
||||
* The root node of the hierarchy.
|
||||
*
|
||||
* There will always be at least the root node if the import was
|
||||
* successful (and no special flags have been set). Presence of further
|
||||
* nodes depends on the format and contents of the imported file.
|
||||
*/
|
||||
aiNode* mRootNode;
|
||||
|
||||
/**
|
||||
* The number of meshes in the scene.
|
||||
*/
|
||||
uint mNumMeshes;
|
||||
|
||||
/**
|
||||
* The array of meshes.
|
||||
*
|
||||
* Use the indices given in the <code>aiNode</code> structure to access
|
||||
* this array. The array is <code>mNumMeshes</code> in size.
|
||||
*
|
||||
* If the <code>aiSceneFlags.INCOMPLETE</code> flag is not set, there
|
||||
* will always be at least one mesh.
|
||||
*/
|
||||
aiMesh** mMeshes;
|
||||
|
||||
/**
|
||||
* The number of materials in the scene.
|
||||
*/
|
||||
uint mNumMaterials;
|
||||
|
||||
/**
|
||||
* The array of meshes.
|
||||
*
|
||||
* Use the indices given in the <code>aiMesh</code> structure to access
|
||||
* this array. The array is <code>mNumMaterials</code> in size.
|
||||
*
|
||||
* If the <code>aiSceneFlags.INCOMPLETE</code> flag is not set, there
|
||||
* will always be at least one material.
|
||||
*/
|
||||
aiMaterial** mMaterials;
|
||||
|
||||
/**
|
||||
* The number of animations in the scene.
|
||||
*/
|
||||
uint mNumAnimations;
|
||||
|
||||
/**
|
||||
* The array of animations.
|
||||
*
|
||||
* All animations imported from the given file are listed here. The array
|
||||
* is <code>mNumAnimations</code> in size.
|
||||
*/
|
||||
aiAnimation** mAnimations;
|
||||
|
||||
/**
|
||||
* The number of textures embedded into the file.
|
||||
*/
|
||||
uint mNumTextures;
|
||||
|
||||
/**
|
||||
* The array of embedded textures.
|
||||
*
|
||||
* Not many file formats embed their textures into the file. An example
|
||||
* is Quake's <code>MDL</code> format (which is also used by some
|
||||
* GameStudio versions).
|
||||
*/
|
||||
aiTexture** mTextures;
|
||||
|
||||
/**
|
||||
* The number of light sources in the scene.
|
||||
*
|
||||
* Light sources are fully optional, in most cases this attribute will be
|
||||
* 0.
|
||||
*/
|
||||
uint mNumLights;
|
||||
|
||||
/**
|
||||
* The array of light sources.
|
||||
*
|
||||
* All light sources imported from the given file are listed here. The
|
||||
* array is <code>mNumLights</code> in size.
|
||||
*/
|
||||
aiLight** mLights;
|
||||
|
||||
/**
|
||||
* The number of cameras in the scene.
|
||||
*
|
||||
* Cameras are fully optional, in most cases this attribute
|
||||
* will be 0.
|
||||
*/
|
||||
uint mNumCameras;
|
||||
|
||||
/**
|
||||
* The array of cameras.
|
||||
*
|
||||
* All cameras imported from the given file are listed here. The array is
|
||||
* <code>mNumCameras</code> in size.
|
||||
*
|
||||
* The first camera in the array (if existing) is the default camera view
|
||||
* at the scene.
|
||||
*/
|
||||
aiCamera** mCameras;
|
||||
}
|
||||
}
|
122
thirdparty/assimp/port/dAssimp/assimp/texture.d
vendored
122
thirdparty/assimp/port/dAssimp/assimp/texture.d
vendored
@ -1,122 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains helper structures to handle textures in Assimp.
|
||||
*
|
||||
* Used for file formats which embed their textures into the model file.
|
||||
* Supported are both normal textures, which are stored as uncompressed pixels,
|
||||
* and "compressed" textures, which are stored in a file format such as PNG or
|
||||
* TGA.
|
||||
*/
|
||||
module assimp.texture;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Helper structure to represent a texel in a ARGB8888 format.
|
||||
*
|
||||
* Used by aiTexture.
|
||||
*/
|
||||
struct aiTexel {
|
||||
align ( 1 ):
|
||||
ubyte b, g, r, a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper structure to describe an embedded texture.
|
||||
*
|
||||
* Usually textures are contained in external files but some file formats
|
||||
* embed them directly in the model file. There are two types of
|
||||
* embedded textures:
|
||||
*
|
||||
* <em>1. Uncompressed textures</em>: The color data is given in an
|
||||
* uncompressed format.
|
||||
*
|
||||
* <em>2. Compressed textures</em> stored in a file format like PNG or JPEG.
|
||||
* The raw file bytes are given so the application must utilize an image
|
||||
* decoder (e.g. DevIL) to get access to the actual color data.
|
||||
*/
|
||||
struct aiTexture {
|
||||
/**
|
||||
* Width of the texture, in pixels.
|
||||
*
|
||||
* If <code>mHeight</code> is zero the texture is compressed in a format
|
||||
* like JPEG. In this case, this value specifies the size of the memory
|
||||
* area <code>pcData</code> is pointing to, in bytes.
|
||||
*/
|
||||
uint mWidth;
|
||||
|
||||
/**
|
||||
* Height of the texture, in pixels.
|
||||
*
|
||||
* If this value is zero, <code>pcData</code> points to an compressed
|
||||
* texture in any format (e.g. JPEG).
|
||||
*/
|
||||
uint mHeight;
|
||||
|
||||
/**
|
||||
* A hint from the loader to make it easier for applications to determine
|
||||
* the type of embedded compressed textures.
|
||||
*
|
||||
* If <code>mHeight</code> is not 0, this member is undefined. Otherwise
|
||||
* it is set set to '\0\0\0\0' if the loader has no additional
|
||||
* information about the texture file format used, or the file extension
|
||||
* of the format without a trailing dot. If there are multiple file
|
||||
* extensions for a format, the shortest extension is chosen (JPEG maps
|
||||
* to 'jpg', not to 'jpeg'). E.g. 'dds\0', 'pcx\0', 'jpg\0'. All
|
||||
* characters are lower-case. The fourth byte will always be '\0'.
|
||||
*/
|
||||
char achFormatHint[4];
|
||||
|
||||
/**
|
||||
* Data of the texture.
|
||||
*
|
||||
* Points to an array of <code>mWidth * mHeight</code>
|
||||
* <code>aiTexel</code>s. The format of the texture data is always
|
||||
* ARGB8888 to make the implementation for user of the library as easy as
|
||||
* possible.
|
||||
*
|
||||
* If <code>mHeight</code> is 0, this is a pointer to a memory buffer of
|
||||
* size <code>mWidth</code> containing the compressed texture data.
|
||||
*/
|
||||
aiTexel* pcData;
|
||||
}
|
||||
}
|
249
thirdparty/assimp/port/dAssimp/assimp/types.d
vendored
249
thirdparty/assimp/port/dAssimp/assimp/types.d
vendored
@ -1,249 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains miscellaneous types used in Assimp's C API.
|
||||
*/
|
||||
module assimp.types;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Our own C boolean type.
|
||||
*/
|
||||
enum aiBool : int {
|
||||
FALSE = 0,
|
||||
TRUE = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Type definition for log stream callback function pointers.
|
||||
*/
|
||||
alias void function( char* message, char* user ) aiLogStreamCallback;
|
||||
|
||||
/**
|
||||
* Represents a log stream. A log stream receives all log messages and
|
||||
* streams them somewhere.
|
||||
*
|
||||
* See: <code>aiGetPredefinedLogStream</code>,
|
||||
* <code>aiAttachLogStream</code> and <code>aiDetachLogStream</code>.
|
||||
*/
|
||||
struct aiLogStream {
|
||||
/**
|
||||
* Callback function to be called when a new message arrives.
|
||||
*/
|
||||
aiLogStreamCallback callback;
|
||||
|
||||
/**
|
||||
* User data to be passed to the callback.
|
||||
*/
|
||||
char* user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum dimension for <code>aiString</code>s.
|
||||
*
|
||||
* Assimp strings are zero terminated.
|
||||
*/
|
||||
const size_t MAXLEN = 1024;
|
||||
|
||||
/**
|
||||
* Represents an UTF-8 string, zero byte terminated.
|
||||
*
|
||||
* The length of such a string is limited to <code>MAXLEN</code> bytes
|
||||
* (excluding the terminal \0).
|
||||
*
|
||||
* The character set of an aiString is explicitly defined to be UTF-8. This
|
||||
* Unicode transformation was chosen in the belief that most strings in 3d
|
||||
* model files are limited to ASCII characters, thus the character set
|
||||
* needed to be ASCII compatible.
|
||||
*
|
||||
* Most text file loaders provide proper Unicode input file handling,
|
||||
* special unicode characters are correctly transcoded to UTF-8 and are kept
|
||||
* throughout the libraries' import pipeline.
|
||||
*
|
||||
* For most applications, it will be absolutely sufficient to interpret the
|
||||
* aiString as ASCII data and work with it as one would work with a plain
|
||||
* char[].
|
||||
*
|
||||
* To access an aiString from D you might want to use something like the
|
||||
* following piece of code:
|
||||
* ---
|
||||
* char[] importAiString( aiString* s ) {
|
||||
* return s.data[ 0 .. s.length ];
|
||||
* }
|
||||
* ---
|
||||
*/
|
||||
struct aiString {
|
||||
/**
|
||||
* Length of the string (excluding the terminal \0).
|
||||
*
|
||||
* This is <em>not</em> the logical length of strings containing UTF-8
|
||||
* multibyte sequences, but the number of bytes from the beginning of the
|
||||
* string to its end.
|
||||
*/
|
||||
size_t length;
|
||||
|
||||
/**
|
||||
* String buffer.
|
||||
*
|
||||
* Size limit is <code>MAXLEN</code>.
|
||||
*/
|
||||
char data[ MAXLEN ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard return type for some library functions.
|
||||
*/
|
||||
enum aiReturn : uint {
|
||||
/**
|
||||
* Indicates that a function was successful.
|
||||
*/
|
||||
SUCCESS = 0x0,
|
||||
|
||||
/**
|
||||
* Indicates that a function failed.
|
||||
*/
|
||||
FAILURE = -0x1,
|
||||
|
||||
/**
|
||||
* Indicates that not enough memory was available to perform the
|
||||
* requested operation.
|
||||
*/
|
||||
OUTOFMEMORY = -0x3
|
||||
}
|
||||
|
||||
/**
|
||||
* Seek origins (for the virtual file system API).
|
||||
*/
|
||||
enum aiOrigin : uint {
|
||||
/**
|
||||
* Beginning of the file.
|
||||
*/
|
||||
SET = 0x0,
|
||||
|
||||
/**
|
||||
* Current position of the file pointer.
|
||||
*/
|
||||
CUR = 0x1,
|
||||
|
||||
/**
|
||||
* End of the file.
|
||||
*
|
||||
* Offsets must be negative.
|
||||
*/
|
||||
END = 0x2
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates predefined log streaming destinations.
|
||||
*
|
||||
* Logging to these streams can be enabled with a single call to
|
||||
* <code>aiAttachPredefinedLogStream()</code>.
|
||||
*/
|
||||
enum aiDefaultLogStream :uint {
|
||||
/**
|
||||
* Stream the log to a file.
|
||||
*/
|
||||
FILE = 0x1,
|
||||
|
||||
/**
|
||||
* Stream the log to standard output.
|
||||
*/
|
||||
STDOUT = 0x2,
|
||||
|
||||
/**
|
||||
* Stream the log to standard error.
|
||||
*/
|
||||
STDERR = 0x4,
|
||||
|
||||
/**
|
||||
* MSVC only: Stream the log the the debugger (this relies on
|
||||
* <code>OutputDebugString</code> from the Win32 SDK).
|
||||
*/
|
||||
DEBUGGER = 0x8
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the memory requirements for different components (e.g. meshes,
|
||||
* materials, animations) of an import. All sizes are in bytes.
|
||||
*/
|
||||
struct aiMemoryInfo {
|
||||
/**
|
||||
* Storage allocated for texture data.
|
||||
*/
|
||||
uint textures;
|
||||
|
||||
/**
|
||||
* Storage allocated for material data.
|
||||
*/
|
||||
uint materials;
|
||||
|
||||
/**
|
||||
* Storage allocated for mesh data.
|
||||
*/
|
||||
uint meshes;
|
||||
|
||||
/**
|
||||
* Storage allocated for node data.
|
||||
*/
|
||||
uint nodes;
|
||||
|
||||
/**
|
||||
* Storage allocated for animation data.
|
||||
*/
|
||||
uint animations;
|
||||
|
||||
/**
|
||||
* Storage allocated for camera data.
|
||||
*/
|
||||
uint cameras;
|
||||
|
||||
/**
|
||||
* Storage allocated for light data.
|
||||
*/
|
||||
uint lights;
|
||||
|
||||
/**
|
||||
* Total storage allocated for the full import.
|
||||
*/
|
||||
uint total;
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (ASSIMP)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2009, ASSIMP Development Team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Flags returned by <code>aiGetCompileFlags()</code>.
|
||||
*/
|
||||
module assimp.versionInfo;
|
||||
|
||||
extern ( C ) {
|
||||
/**
|
||||
* Assimp was compiled as a shared object (Windows: DLL).
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_SHARED = 0x1;
|
||||
|
||||
/**
|
||||
* Assimp was compiled against STLport.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_STLPORT = 0x2;
|
||||
|
||||
/**
|
||||
* Assimp was compiled as a debug build.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_DEBUG = 0x4;
|
||||
|
||||
/**
|
||||
* Assimp was compiled with ASSIMP_BUILD_BOOST_WORKAROUND defined.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_NOBOOST = 0x8;
|
||||
|
||||
/**
|
||||
* Assimp was compiled with ASSIMP_BUILD_SINGLETHREADED defined.
|
||||
*/
|
||||
const uint ASSIMP_CFLAGS_SINGLETHREADED = 0x10;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "arm64e")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "armv6")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "armv7s")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "i386")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneSimulator)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,17 +0,0 @@
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneSimulator)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
39
thirdparty/assimp/port/iOS/README.md
vendored
39
thirdparty/assimp/port/iOS/README.md
vendored
@ -1,39 +0,0 @@
|
||||
# assimp for iOS
|
||||
(deployment target 6.0+, 32/64bit)
|
||||
|
||||
Builds assimp libraries for several iOS CPU architectures at once, and outputs a fat binary from the result.
|
||||
|
||||
Run the **build.sh** script from the ```./port/iOS/``` directory. See **./build.sh --help** for information about command line options.
|
||||
|
||||
```bash
|
||||
shadeds-Mac:iOS arul$ ./build.sh --help
|
||||
[!] ./build.sh - assimp iOS build script
|
||||
- don't build fat library (--no-fat)
|
||||
- supported architectures(--archs): armv7, armv7s, arm64, i386, x86_64
|
||||
- supported C++ STD libs.(--stdlib): libc++, libstdc++
|
||||
```
|
||||
Example:
|
||||
```bash
|
||||
cd ./port/iOS/
|
||||
./build.sh --stdlib=libc++ --archs="armv7 arm64 i386"
|
||||
```
|
||||
Supported architectures/devices:
|
||||
|
||||
### Simulator
|
||||
- i386
|
||||
- x86_64
|
||||
|
||||
### Device
|
||||
- ~~ARMv6 (dropped after iOS 6.0)~~
|
||||
- ARMv7
|
||||
- ARMv7-s
|
||||
- ARM64
|
||||
|
||||
### Building with older iOS SDK versions
|
||||
The script should work out of the box for the iOS 8.x SDKs and probably newer releases as well.
|
||||
If you are using SDK version 7.x or older, you need to specify the exact SDK version inside **build.sh**, for example:
|
||||
```
|
||||
IOS_SDK_VERSION=7.1
|
||||
```
|
||||
### Optimization
|
||||
By default, no compiler optimizations are specified inside the build script. For an optimized build, add the corresponding flags to the CFLAGS definition inside **build.sh**.
|
205
thirdparty/assimp/port/iOS/build.sh
vendored
205
thirdparty/assimp/port/iOS/build.sh
vendored
@ -1,205 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Written and maintained by the.arul@gmail.com (2014)
|
||||
#
|
||||
|
||||
BUILD_DIR="./lib/iOS"
|
||||
|
||||
###################################
|
||||
# SDK Version
|
||||
###################################
|
||||
IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]')
|
||||
###################################
|
||||
|
||||
###################################
|
||||
# BUILD Configuration
|
||||
###################################
|
||||
|
||||
BUILD_SHARED_LIBS=OFF
|
||||
BUILD_TYPE=Release
|
||||
|
||||
################################################
|
||||
# Minimum iOS deployment target version
|
||||
################################################
|
||||
MIN_IOS_VERSION="6.0"
|
||||
|
||||
IOS_SDK_TARGET=$MIN_IOS_VERSION
|
||||
XCODE_ROOT_DIR=$(xcode-select --print-path)
|
||||
TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain
|
||||
|
||||
CMAKE_C_COMPILER=$(xcrun -find cc)
|
||||
CMAKE_CXX_COMPILER=$(xcrun -find c++)
|
||||
|
||||
BUILD_ARCHS_DEVICE="arm64e arm64 armv7s armv7"
|
||||
BUILD_ARCHS_SIMULATOR="x86_64 i386"
|
||||
BUILD_ARCHS_ALL=($BUILD_ARCHS_DEVICE $BUILD_ARCHS_SIMULATOR)
|
||||
|
||||
CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min)
|
||||
CPP_DEV_TARGET=
|
||||
CPP_STD_LIB_LIST=(libc++ libstdc++)
|
||||
CPP_STD_LIB=
|
||||
CPP_STD_LIST=(c++11 c++14)
|
||||
CPP_STD=c++11
|
||||
|
||||
function join { local IFS="$1"; shift; echo "$*"; }
|
||||
|
||||
build_arch()
|
||||
{
|
||||
IOS_SDK_DEVICE=iPhoneOS
|
||||
CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[0]}
|
||||
|
||||
if [[ "$BUILD_ARCHS_SIMULATOR" =~ "$1" ]]
|
||||
then
|
||||
echo '[!] Target SDK set to SIMULATOR.'
|
||||
IOS_SDK_DEVICE=iPhoneSimulator
|
||||
CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[1]}
|
||||
else
|
||||
echo '[!] Target SDK set to DEVICE.'
|
||||
fi
|
||||
|
||||
unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS CMAKE_CLI_INPUT
|
||||
|
||||
#export CC="$(xcrun -sdk iphoneos -find clang)"
|
||||
#export CPP="$CC -E"
|
||||
export DEVROOT=$XCODE_ROOT_DIR/Platforms/$IOS_SDK_DEVICE.platform/Developer
|
||||
export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk
|
||||
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET"
|
||||
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
|
||||
export CFLAGS="$CFLAGS -Og"
|
||||
else
|
||||
export CFLAGS="$CFLAGS -O3"
|
||||
fi
|
||||
export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/"
|
||||
export CPPFLAGS="$CFLAGS"
|
||||
export CXXFLAGS="$CFLAGS -std=$CPP_STD"
|
||||
|
||||
rm CMakeCache.txt
|
||||
|
||||
CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS"
|
||||
|
||||
echo "[!] Running CMake with -G 'Unix Makefiles' $CMAKE_CLI_INPUT"
|
||||
|
||||
cmake -G 'Unix Makefiles' ${CMAKE_CLI_INPUT}
|
||||
|
||||
echo "[!] Building $1 library"
|
||||
|
||||
xcrun -run make clean
|
||||
xcrun -run make assimp -j 8 -l
|
||||
|
||||
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||
echo "[!] Moving built dynamic libraries into: $BUILD_DIR/$1/"
|
||||
mv ./lib/*.dylib $BUILD_DIR/$1/
|
||||
fi
|
||||
|
||||
echo "[!] Moving built static libraries into: $BUILD_DIR/$1/"
|
||||
mv ./lib/*.a $BUILD_DIR/$1/
|
||||
}
|
||||
|
||||
echo "[!] $0 - assimp iOS build script"
|
||||
|
||||
CPP_STD_LIB=${CPP_STD_LIB_LIST[0]}
|
||||
CPP_STD=${CPP_STD_LIST[0]}
|
||||
DEPLOY_ARCHS=${BUILD_ARCHS_ALL[*]}
|
||||
DEPLOY_FAT=1
|
||||
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-s=*|--std=*)
|
||||
CPP_STD=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||
echo "[!] Selecting c++ standard: $CPP_STD"
|
||||
;;
|
||||
-l=*|--stdlib=*)
|
||||
CPP_STD_LIB=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||
echo "[!] Selecting c++ std lib: $CPP_STD_LIB"
|
||||
;;
|
||||
-a=*|--archs=*)
|
||||
DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||
echo "[!] Selecting architectures: $DEPLOY_ARCHS"
|
||||
;;
|
||||
--debug)
|
||||
BUILD_TYPE=Debug
|
||||
echo "[!] Selecting build type: Debug"
|
||||
;;
|
||||
--shared-lib)
|
||||
BUILD_SHARED_LIBS=ON
|
||||
echo "[!] Will generate dynamic libraries"
|
||||
;;
|
||||
-n|--no-fat)
|
||||
DEPLOY_FAT=0
|
||||
echo "[!] Fat binary will not be created."
|
||||
;;
|
||||
-h|--help)
|
||||
echo " - don't build fat library (--no-fat)."
|
||||
echo " - Include debug information and symbols, no compiler optimizations (--debug)."
|
||||
echo " - generate dynamic libraries rather than static ones (--shared-lib)."
|
||||
echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')"
|
||||
echo " - supported C++ STD libs (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')"
|
||||
echo " - supported C++ standards (--std): $(echo $(join , ${CPP_STD_LIST[*]}) | sed 's/,/, /g')"
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd ../../
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||
echo "Creating folder: $BUILD_DIR/$ARCH_TARGET"
|
||||
mkdir -p $BUILD_DIR/$ARCH_TARGET
|
||||
echo "Building for arc: $ARCH_TARGET"
|
||||
build_arch $ARCH_TARGET
|
||||
#rm ./lib/libassimp.a
|
||||
done
|
||||
|
||||
|
||||
make_fat_static_or_shared_binary()
|
||||
{
|
||||
LIB_NAME=$1
|
||||
LIPO_ARGS=''
|
||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.dylib "
|
||||
else
|
||||
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a "
|
||||
fi
|
||||
done
|
||||
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||
LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.dylib"
|
||||
else
|
||||
LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.a"
|
||||
fi
|
||||
lipo $LIPO_ARGS
|
||||
}
|
||||
|
||||
make_fat_static_binary()
|
||||
{
|
||||
LIB_NAME=$1
|
||||
LIPO_ARGS=''
|
||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a "
|
||||
done
|
||||
LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.a"
|
||||
lipo $LIPO_ARGS
|
||||
}
|
||||
|
||||
if [[ "$DEPLOY_FAT" -eq 1 ]]; then
|
||||
echo '[+] Creating fat binaries ...'
|
||||
|
||||
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
|
||||
make_fat_static_or_shared_binary 'libassimpd'
|
||||
make_fat_static_binary 'libIrrXMLd'
|
||||
make_fat_static_binary 'libzlibstaticd'
|
||||
else
|
||||
make_fat_static_or_shared_binary 'libassimp'
|
||||
make_fat_static_binary 'libIrrXML'
|
||||
make_fat_static_binary 'libzlibstatic'
|
||||
fi
|
||||
|
||||
echo "[!] Done! The fat binaries can be found at $BUILD_DIR"
|
||||
fi
|
||||
|
||||
|
||||
|
56
thirdparty/assimp/port/jassimp/README
vendored
56
thirdparty/assimp/port/jassimp/README
vendored
@ -1,56 +0,0 @@
|
||||
jassimp
|
||||
-------
|
||||
|
||||
Java binding for assimp.
|
||||
|
||||
The class model used by jassimp is not a one-to-one mapping of assimps class/
|
||||
structure model (due to performance considerations). Please read the javadoc
|
||||
descriptions of AiMesh and AiWrapperProvider.
|
||||
|
||||
The jassimp.lwjgl package contains a LWJGL specific wrapper provider and some
|
||||
application examples using this wrapper
|
||||
|
||||
|
||||
|
||||
How To Build
|
||||
------------
|
||||
|
||||
I) native library, for example by issuing this command in jassimp-native/src:
|
||||
|
||||
$ gcc jassimp.cpp -I/usr/lib/jvm/default/include/ \
|
||||
-I/usr/lib/jvm/default/include/linux -lassimp -shared -fPIC -o libjassimp.so
|
||||
|
||||
libjassimp.so is required at runtime and must be located in java.library.path.
|
||||
|
||||
II) Java binding
|
||||
The java library is built using ant. Executing "ant" in the port/jassimp
|
||||
directory should be sufficient to build the library including docs. You
|
||||
still need to build the native library separately, see above
|
||||
|
||||
The java build is configured to create java 1.6 classes
|
||||
|
||||
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
Not all data imports have been tested yet, especially the countless texture
|
||||
parameters. If you find bugs please report them.
|
||||
|
||||
jassimp supports most of assimps features. Current limitations are
|
||||
* only importing scenes is supported. There are some methods that allow a
|
||||
modification of the returned objects, but these should be considered as
|
||||
work in progress. Full blown export support is planned for a future release
|
||||
* no support for mesh animations
|
||||
* no support for embedded textures
|
||||
* no support for importer configurations
|
||||
* some texture related material properties are not exposed via the API but only
|
||||
accessible by traversing the list of properties. However this limitation is
|
||||
also present in the c-API ...
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The license for jassimp is the same as the main Assimp license.
|
||||
|
54
thirdparty/assimp/port/jassimp/build.xml
vendored
54
thirdparty/assimp/port/jassimp/build.xml
vendored
@ -1,54 +0,0 @@
|
||||
<project name="jassimp" basedir="." default="all">
|
||||
<property name="native-src.dir" value="jassimp-native/src" />
|
||||
<property name="src.dir" value="jassimp/src" />
|
||||
<property name="jassimp.lwjgl-src.dir" value="jassimp.lwjgl/src" />
|
||||
<property name="build.dir" value="jassimp/bin" />
|
||||
<property name="dist.dir" value="dist" />
|
||||
<property name="doc.dir" value="doc" />
|
||||
<property environment="env"/>
|
||||
<property name="ndk.dir" value="${env.NDK_HOME}" />
|
||||
<property name="my.dir" value="${env.PWD}" />
|
||||
|
||||
<path id="classpath">
|
||||
</path>
|
||||
|
||||
<target name="compile">
|
||||
<delete dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
<javac classpathref="classpath" destdir="${build.dir}" srcdir="${src.dir}"
|
||||
source="1.6" target="1.6" includeantruntime="false">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="jni_header">
|
||||
<mkdir dir="${native-src.dir}" />
|
||||
<javah outputfile="${native-src.dir}/jassimp.h" force="yes">
|
||||
<classpath>
|
||||
<pathelement path="${build.dir}" />
|
||||
</classpath>
|
||||
<class name="jassimp.Jassimp" />
|
||||
</javah>
|
||||
</target>
|
||||
|
||||
<target name="ndk-jni" depends="package">
|
||||
<exec executable="${ndk.dir}/ndk-build">
|
||||
<arg line="all NDK_PROJECT_PATH=${my.dir}/workspaces/Android-NDK"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="package" depends="compile">
|
||||
<jar destfile="${dist.dir}/jassimp.jar" basedir="${build.dir}">
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="doc">
|
||||
<delete dir="${doc.dir}" />
|
||||
<javadoc access="public" author="false" destdir="${doc.dir}"
|
||||
sourcepath="${src.dir}">
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
<target name="all" depends="package, doc">
|
||||
</target>
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := jassimp
|
||||
LOCAL_SRC_FILES := src/jassimp.cpp
|
||||
|
||||
LOCAL_CFLAGS += -DJNI_LOG
|
||||
|
||||
#LOCAL_STATIC_LIBRARIES := assimp_static
|
||||
LOCAL_SHARED_LIBRARIES := assimp
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
File diff suppressed because it is too large
Load Diff
@ -1,47 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
#include <stdlib.h>
|
||||
/* Header for class jassimp_Jassimp */
|
||||
|
||||
#ifndef _Included_jassimp_Jassimp
|
||||
#define _Included_jassimp_Jassimp
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getVKeysize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getQKeysize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getV3Dsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getfloatsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getintsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getuintsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getdoublesize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getlongsize
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: jassimp_Jassimp
|
||||
* Method: getErrorString
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_jassimp_Jassimp_getErrorString
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: jassimp_Jassimp
|
||||
* Method: aiImportFile
|
||||
* Signature: (Ljava/lang/String;J)Ljassimp/AiScene;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_jassimp_Jassimp_aiImportFile
|
||||
(JNIEnv *, jclass, jstring, jlong, jobject, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* Defines how an animation channel behaves outside the defined time range.
|
||||
*/
|
||||
public enum AiAnimBehavior {
|
||||
/**
|
||||
* The value from the default node transformation is taken.
|
||||
*/
|
||||
DEFAULT(0x0),
|
||||
|
||||
|
||||
/**
|
||||
* The nearest key value is used without interpolation.
|
||||
*/
|
||||
CONSTANT(0x1),
|
||||
|
||||
|
||||
/**
|
||||
* The value of the nearest two keys is linearly extrapolated for the
|
||||
* current time value.
|
||||
*/
|
||||
LINEAR(0x2),
|
||||
|
||||
|
||||
/**
|
||||
* The animation is repeated.<p>
|
||||
*
|
||||
* If the animation key go from n to m and the current time is t, use the
|
||||
* value at (t-n) % (|m-n|).
|
||||
*/
|
||||
REPEAT(0x3);
|
||||
|
||||
|
||||
/**
|
||||
* Utility method for converting from c/c++ based integer enums to java
|
||||
* enums.<p>
|
||||
*
|
||||
* This method is intended to be used from JNI and my change based on
|
||||
* implementation needs.
|
||||
*
|
||||
* @param rawValue an integer based enum value (as defined by assimp)
|
||||
* @return the enum value corresponding to rawValue
|
||||
*/
|
||||
static AiAnimBehavior fromRawValue(int rawValue) {
|
||||
for (AiAnimBehavior type : AiAnimBehavior.values()) {
|
||||
if (type.m_rawValue == rawValue) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("unexptected raw value: " +
|
||||
rawValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param rawValue maps java enum to c/c++ integer enum values
|
||||
*/
|
||||
private AiAnimBehavior(int rawValue) {
|
||||
m_rawValue = rawValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The mapped c/c++ integer enum value.
|
||||
*/
|
||||
private final int m_rawValue;
|
||||
}
|
@ -1,175 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An animation.<p>
|
||||
*
|
||||
* An animation consists of keyframe data for a number of nodes. For
|
||||
* each node affected by the animation a separate series of data is given.<p>
|
||||
*
|
||||
* Like {@link AiMesh}, the animation related classes offer a Buffer API, a
|
||||
* Direct API and a wrapped API. Please consult the documentation of
|
||||
* {@link AiMesh} for a description and comparison of these APIs.
|
||||
*/
|
||||
public final class AiAnimation {
|
||||
/**
|
||||
* Name.
|
||||
*/
|
||||
private final String m_name;
|
||||
|
||||
/**
|
||||
* Duration.
|
||||
*/
|
||||
private final double m_duration;
|
||||
|
||||
/**
|
||||
* Ticks per second.
|
||||
*/
|
||||
private final double m_ticksPerSecond;
|
||||
|
||||
/**
|
||||
* Bone animation channels.
|
||||
*/
|
||||
private final List<AiNodeAnim> m_nodeAnims = new ArrayList<AiNodeAnim>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param name name
|
||||
* @param duration duration
|
||||
* @param ticksPerSecond ticks per second
|
||||
*/
|
||||
AiAnimation(String name, double duration, double ticksPerSecond) {
|
||||
m_name = name;
|
||||
m_duration = duration;
|
||||
m_ticksPerSecond = ticksPerSecond;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of the animation.<p>
|
||||
*
|
||||
* If the modeling package this data was exported from does support only
|
||||
* a single animation channel, this name is usually empty (length is zero).
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the duration of the animation in ticks.
|
||||
*
|
||||
* @return the duration
|
||||
*/
|
||||
public double getDuration() {
|
||||
return m_duration;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ticks per second.<p>
|
||||
*
|
||||
* 0 if not specified in the imported file
|
||||
*
|
||||
* @return the number of ticks per second
|
||||
*/
|
||||
public double getTicksPerSecond() {
|
||||
return m_ticksPerSecond;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of bone animation channels.<p>
|
||||
*
|
||||
* Each channel affects a single node. This method will return the same
|
||||
* value as <code>getChannels().size()</code>
|
||||
*
|
||||
* @return the number of bone animation channels
|
||||
*/
|
||||
public int getNumChannels() {
|
||||
return m_nodeAnims.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the list of bone animation channels.<p>
|
||||
*
|
||||
* Each channel affects a single node. The array is mNumChannels in size.
|
||||
*
|
||||
* @return the list of bone animation channels
|
||||
*/
|
||||
public List<AiNodeAnim> getChannels() {
|
||||
return m_nodeAnims;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of mesh animation channels.<p>
|
||||
*
|
||||
* Each channel affects a single mesh and defines vertex-based animation.
|
||||
* This method will return the same value as
|
||||
* <code>getMeshChannels().size()</code>
|
||||
*
|
||||
* @return the number of mesh animation channels
|
||||
*/
|
||||
public int getNumMeshChannels() {
|
||||
throw new UnsupportedOperationException("not implemented yet");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the list of mesh animation channels.<p>
|
||||
*
|
||||
* Each channel affects a single mesh.
|
||||
*
|
||||
* @return the list of mesh animation channels
|
||||
*/
|
||||
public List<AiMeshAnim> getMeshChannels() {
|
||||
throw new UnsupportedOperationException("not implemented yet");
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* Defines alpha-blend flags.<p>
|
||||
*
|
||||
* If you're familiar with OpenGL or D3D, these flags aren't new to you.
|
||||
* They define *how* the final color value of a pixel is computed, basing
|
||||
* on the previous color at that pixel and the new color value from the
|
||||
* material. The blend formula is:
|
||||
* <br><code>
|
||||
* SourceColor * SourceBlend + DestColor * DestBlend
|
||||
* </code><br>
|
||||
* where <code>DestColor</code> is the previous color in the framebuffer at
|
||||
* this position and <code>SourceColor</code> is the material color before the
|
||||
* transparency calculation.
|
||||
*/
|
||||
public enum AiBlendMode {
|
||||
/**
|
||||
* Default blending.<p>
|
||||
*
|
||||
* Formula:
|
||||
* <code>
|
||||
* SourceColor*SourceAlpha + DestColor*(1-SourceAlpha)
|
||||
* </code>
|
||||
*/
|
||||
DEFAULT(0x0),
|
||||
|
||||
|
||||
/**
|
||||
* Additive blending.<p>
|
||||
*
|
||||
* Formula:
|
||||
* <code>
|
||||
* SourceColor*1 + DestColor*1
|
||||
* </code>
|
||||
*/
|
||||
ADDITIVE(0x1);
|
||||
|
||||
|
||||
/**
|
||||
* Utility method for converting from c/c++ based integer enums to java
|
||||
* enums.<p>
|
||||
*
|
||||
* This method is intended to be used from JNI and my change based on
|
||||
* implementation needs.
|
||||
*
|
||||
* @param rawValue an integer based enum value (as defined by assimp)
|
||||
* @return the enum value corresponding to rawValue
|
||||
*/
|
||||
static AiBlendMode fromRawValue(int rawValue) {
|
||||
for (AiBlendMode type : AiBlendMode.values()) {
|
||||
if (type.m_rawValue == rawValue) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("unexptected raw value: " +
|
||||
rawValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param rawValue maps java enum to c/c++ integer enum values
|
||||
*/
|
||||
private AiBlendMode(int rawValue) {
|
||||
m_rawValue = rawValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The mapped c/c++ integer enum value.
|
||||
*/
|
||||
private final int m_rawValue;
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* A single bone of a mesh.<p>
|
||||
*
|
||||
* A bone has a name by which it can be found in the frame hierarchy and by
|
||||
* which it can be addressed by animations. In addition it has a number of
|
||||
* influences on vertices.<p>
|
||||
*
|
||||
* This class is designed to be mutable, i.e., the returned collections are
|
||||
* writable and may be modified.
|
||||
*/
|
||||
public final class AiBone {
|
||||
/**
|
||||
* Name of the bone.
|
||||
*/
|
||||
private String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Bone weights.
|
||||
*/
|
||||
private final List<AiBoneWeight> m_boneWeights =
|
||||
new ArrayList<AiBoneWeight>();
|
||||
|
||||
|
||||
/**
|
||||
* Offset matrix.
|
||||
*/
|
||||
private Object m_offsetMatrix;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
AiBone() {
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of the bone.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of bone weights.<p>
|
||||
*
|
||||
* This method exists for compatibility with the native assimp API.
|
||||
* The returned value is identical to <code>getBoneWeights().size()</code>
|
||||
*
|
||||
* @return the number of weights
|
||||
*/
|
||||
public int getNumWeights() {
|
||||
return m_boneWeights.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of bone weights.
|
||||
*
|
||||
* @return the bone weights
|
||||
*/
|
||||
public List<AiBoneWeight> getBoneWeights() {
|
||||
return m_boneWeights;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the offset matrix.<p>
|
||||
*
|
||||
* The offset matrix is a 4x4 matrix that transforms from mesh space to
|
||||
* bone space in bind pose.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
*
|
||||
* @return the offset matrix
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> M4 getOffsetMatrix(
|
||||
AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) {
|
||||
|
||||
return (M4) m_offsetMatrix;
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* A single influence of a bone on a vertex.
|
||||
*/
|
||||
public final class AiBoneWeight {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
AiBoneWeight() {
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index of the vertex which is influenced by the bone.
|
||||
*
|
||||
* @return the vertex index
|
||||
*/
|
||||
public int getVertexId() {
|
||||
return m_vertexId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The strength of the influence in the range (0...1).<p>
|
||||
*
|
||||
* The influence from all bones at one vertex amounts to 1
|
||||
*
|
||||
* @return the influence
|
||||
*/
|
||||
public float getWeight() {
|
||||
return m_weight;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Vertex index.
|
||||
*/
|
||||
private int m_vertexId;
|
||||
|
||||
|
||||
/**
|
||||
* Influence of bone on vertex.
|
||||
*/
|
||||
private float m_weight;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper provider using jassimp built in types.
|
||||
*/
|
||||
public final class AiBuiltInWrapperProvider implements AiWrapperProvider<
|
||||
AiVector, AiMatrix4f, AiColor, AiNode, AiQuaternion> {
|
||||
|
||||
@Override
|
||||
public AiVector wrapVector3f(ByteBuffer buffer, int offset,
|
||||
int numComponents) {
|
||||
|
||||
return new AiVector(buffer, offset, numComponents);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AiMatrix4f wrapMatrix4f(float[] data) {
|
||||
return new AiMatrix4f(data);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AiColor wrapColor(ByteBuffer buffer, int offset) {
|
||||
return new AiColor(buffer, offset);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AiNode wrapSceneNode(Object parent, Object matrix,
|
||||
int[] meshReferences, String name) {
|
||||
|
||||
return new AiNode((AiNode) parent, matrix, meshReferences, name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AiQuaternion wrapQuaternion(ByteBuffer buffer, int offset) {
|
||||
return new AiQuaternion(buffer, offset);
|
||||
}
|
||||
}
|
@ -1,303 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* Helper structure to describe a virtual camera.<p>
|
||||
*
|
||||
* Cameras have a representation in the node graph and can be animated.
|
||||
* An important aspect is that the camera itself is also part of the
|
||||
* scenegraph. This means, any values such as the look-at vector are not
|
||||
* *absolute*, they're <b>relative</b> to the coordinate system defined
|
||||
* by the node which corresponds to the camera. This allows for camera
|
||||
* animations. For static cameras parameters like the 'look-at' or 'up' vectors
|
||||
* are usually specified directly in aiCamera, but beware, they could also
|
||||
* be encoded in the node transformation. The following (pseudo)code sample
|
||||
* shows how to do it: <p>
|
||||
* <code><pre>
|
||||
* // Get the camera matrix for a camera at a specific time
|
||||
* // if the node hierarchy for the camera does not contain
|
||||
* // at least one animated node this is a static computation
|
||||
* get-camera-matrix (node sceneRoot, camera cam) : matrix
|
||||
* {
|
||||
* node cnd = find-node-for-camera(cam)
|
||||
* matrix cmt = identity()
|
||||
*
|
||||
* // as usual - get the absolute camera transformation for this frame
|
||||
* for each node nd in hierarchy from sceneRoot to cnd
|
||||
* matrix cur
|
||||
* if (is-animated(nd))
|
||||
* cur = eval-animation(nd)
|
||||
* else cur = nd->mTransformation;
|
||||
* cmt = mult-matrices( cmt, cur )
|
||||
* end for
|
||||
*
|
||||
* // now multiply with the camera's own local transform
|
||||
* cam = mult-matrices (cam, get-camera-matrix(cmt) )
|
||||
* }
|
||||
* </pre></code>
|
||||
*
|
||||
* <b>Note:</b> some file formats (such as 3DS, ASE) export a "target point" -
|
||||
* the point the camera is looking at (it can even be animated). Assimp
|
||||
* writes the target point as a subnode of the camera's main node,
|
||||
* called "<camName>.Target". However this is just additional information
|
||||
* then the transformation tracks of the camera main node make the
|
||||
* camera already look in the right direction.
|
||||
*/
|
||||
public final class AiCamera {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param name name
|
||||
* @param position position
|
||||
* @param up up vector
|
||||
* @param lookAt look-at vector
|
||||
* @param horizontalFOV field of view
|
||||
* @param clipNear near clip plane
|
||||
* @param clipFar far clip plane
|
||||
* @param aspect aspect ratio
|
||||
*/
|
||||
AiCamera(String name, Object position, Object up, Object lookAt,
|
||||
float horizontalFOV, float clipNear, float clipFar, float aspect) {
|
||||
|
||||
m_name = name;
|
||||
m_position = position;
|
||||
m_up = up;
|
||||
m_lookAt = lookAt;
|
||||
m_horizontalFOV = horizontalFOV;
|
||||
m_clipNear = clipNear;
|
||||
m_clipFar = clipFar;
|
||||
m_aspect = aspect;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of the camera.<p>
|
||||
*
|
||||
* There must be a node in the scenegraph with the same name.
|
||||
* This node specifies the position of the camera in the scene
|
||||
* hierarchy and can be animated.
|
||||
*/
|
||||
public String getName() {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the position of the camera.<p>
|
||||
*
|
||||
* The returned position is relative to the coordinate space defined by the
|
||||
* corresponding node.<p>
|
||||
*
|
||||
* The default value is 0|0|0.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built-in behavior is to return a {@link AiVector}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the position vector
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> V3 getPosition(AiWrapperProvider<V3, M4, C, N, Q>
|
||||
wrapperProvider) {
|
||||
|
||||
return (V3) m_position;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the 'Up' - vector of the camera coordinate system.
|
||||
*
|
||||
* The returned vector is relative to the coordinate space defined by the
|
||||
* corresponding node.<p>
|
||||
*
|
||||
* The 'right' vector of the camera coordinate system is the cross product
|
||||
* of the up and lookAt vectors. The default value is 0|1|0. The vector
|
||||
* may be normalized, but it needn't.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built-in behavior is to return a {@link AiVector}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the 'Up' vector
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> V3 getUp(AiWrapperProvider<V3, M4, C, N, Q>
|
||||
wrapperProvider) {
|
||||
|
||||
return (V3) m_up;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the 'LookAt' - vector of the camera coordinate system.<p>
|
||||
*
|
||||
* The returned vector is relative to the coordinate space defined by the
|
||||
* corresponding node.<p>
|
||||
*
|
||||
* This is the viewing direction of the user. The default value is 0|0|1.
|
||||
* The vector may be normalized, but it needn't.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built-in behavior is to return a {@link AiVector}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the 'LookAt' vector
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> V3 getLookAt(AiWrapperProvider<V3, M4, C, N, Q>
|
||||
wrapperProvider) {
|
||||
|
||||
return (V3) m_lookAt;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the half horizontal field of view angle, in radians.<p>
|
||||
*
|
||||
* The field of view angle is the angle between the center line of the
|
||||
* screen and the left or right border. The default value is 1/4PI.
|
||||
*
|
||||
* @return the half horizontal field of view angle
|
||||
*/
|
||||
public float getHorizontalFOV() {
|
||||
return m_horizontalFOV;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the distance of the near clipping plane from the camera.<p>
|
||||
*
|
||||
* The value may not be 0.f (for arithmetic reasons to prevent a division
|
||||
* through zero). The default value is 0.1f.
|
||||
*
|
||||
* @return the distance of the near clipping plane
|
||||
*/
|
||||
public float getClipPlaneNear() {
|
||||
return m_clipNear;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the distance of the far clipping plane from the camera.<p>
|
||||
*
|
||||
* The far clipping plane must, of course, be further away than the
|
||||
* near clipping plane. The default value is 1000.0f. The ratio
|
||||
* between the near and the far plane should not be too
|
||||
* large (between 1000-10000 should be ok) to avoid floating-point
|
||||
* inaccuracies which could lead to z-fighting.
|
||||
*
|
||||
* @return the distance of the far clipping plane
|
||||
*/
|
||||
public float getClipPlaneFar() {
|
||||
return m_clipFar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the screen aspect ratio.<p>
|
||||
*
|
||||
* This is the ration between the width and the height of the
|
||||
* screen. Typical values are 4/3, 1/2 or 1/1. This value is
|
||||
* 0 if the aspect ratio is not defined in the source file.
|
||||
* 0 is also the default value.
|
||||
*
|
||||
* @return the screen aspect ratio
|
||||
*/
|
||||
public float getAspect() {
|
||||
return m_aspect;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*/
|
||||
private final String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Position.
|
||||
*/
|
||||
private final Object m_position;
|
||||
|
||||
|
||||
/**
|
||||
* Up vector.
|
||||
*/
|
||||
private final Object m_up;
|
||||
|
||||
|
||||
/**
|
||||
* Look-At vector.
|
||||
*/
|
||||
private final Object m_lookAt;
|
||||
|
||||
|
||||
/**
|
||||
* FOV.
|
||||
*/
|
||||
private final float m_horizontalFOV;
|
||||
|
||||
|
||||
/**
|
||||
* Near clipping plane.
|
||||
*/
|
||||
private final float m_clipNear;
|
||||
|
||||
|
||||
/**
|
||||
* Far clipping plane.
|
||||
*/
|
||||
private final float m_clipFar;
|
||||
|
||||
|
||||
/**
|
||||
* Aspect ratio.
|
||||
*/
|
||||
private final float m_aspect;
|
||||
}
|
@ -1,153 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* IOSystem based on the Java classloader.<p>
|
||||
*
|
||||
* This IOSystem allows loading models directly from the
|
||||
* classpath. No extraction to the file system is
|
||||
* necessary.
|
||||
*
|
||||
* @author Jesper Smith
|
||||
*
|
||||
*/
|
||||
public class AiClassLoaderIOSystem implements AiIOSystem<AiInputStreamIOStream>
|
||||
{
|
||||
private final Class<?> clazz;
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
/**
|
||||
* Construct a new AiClassLoaderIOSystem.<p>
|
||||
*
|
||||
* This constructor uses a ClassLoader to resolve
|
||||
* resources.
|
||||
*
|
||||
* @param classLoader classLoader to resolve resources.
|
||||
*/
|
||||
public AiClassLoaderIOSystem(ClassLoader classLoader) {
|
||||
this.clazz = null;
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new AiClassLoaderIOSystem.<p>
|
||||
*
|
||||
* This constructor uses a Class to resolve
|
||||
* resources.
|
||||
*
|
||||
* @param class<?> class to resolve resources.
|
||||
*/
|
||||
public AiClassLoaderIOSystem(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
this.classLoader = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AiInputStreamIOStream open(String filename, String ioMode) {
|
||||
try {
|
||||
|
||||
InputStream is;
|
||||
|
||||
if(clazz != null) {
|
||||
is = clazz.getResourceAsStream(filename);
|
||||
}
|
||||
else if (classLoader != null) {
|
||||
is = classLoader.getResourceAsStream(filename);
|
||||
}
|
||||
else {
|
||||
System.err.println("[" + getClass().getSimpleName() +
|
||||
"] No class or classLoader provided to resolve " + filename);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(is != null) {
|
||||
return new AiInputStreamIOStream(is);
|
||||
}
|
||||
else {
|
||||
System.err.println("[" + getClass().getSimpleName() +
|
||||
"] Cannot find " + filename);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(AiInputStreamIOStream file) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(String path)
|
||||
{
|
||||
URL url = null;
|
||||
if(clazz != null) {
|
||||
url = clazz.getResource(path);
|
||||
}
|
||||
else if (classLoader != null) {
|
||||
url = classLoader.getResource(path);
|
||||
}
|
||||
|
||||
|
||||
if(url == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getOsSeparator()
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper for colors.<p>
|
||||
*
|
||||
* The wrapper is writable, i.e., changes performed via the set-methods will
|
||||
* modify the underlying mesh.
|
||||
*/
|
||||
public final class AiColor {
|
||||
/**
|
||||
* Wrapped buffer.
|
||||
*/
|
||||
private final ByteBuffer m_buffer;
|
||||
|
||||
/**
|
||||
* Offset into m_buffer.
|
||||
*/
|
||||
private final int m_offset;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param buffer the buffer to wrap
|
||||
* @param offset offset into buffer
|
||||
*/
|
||||
public AiColor(ByteBuffer buffer, int offset) {
|
||||
m_buffer = buffer;
|
||||
m_offset = offset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the red color component.
|
||||
*
|
||||
* @return the red component
|
||||
*/
|
||||
public float getRed() {
|
||||
return m_buffer.getFloat(m_offset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the green color component.
|
||||
*
|
||||
* @return the green component
|
||||
*/
|
||||
public float getGreen() {
|
||||
return m_buffer.getFloat(m_offset + 4);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the blue color component.
|
||||
*
|
||||
* @return the blue component
|
||||
*/
|
||||
public float getBlue() {
|
||||
return m_buffer.getFloat(m_offset + 8);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the alpha color component.
|
||||
*
|
||||
* @return the alpha component
|
||||
*/
|
||||
public float getAlpha() {
|
||||
return m_buffer.getFloat(m_offset + 12);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the red color component.
|
||||
*
|
||||
* @param red the new value
|
||||
*/
|
||||
public void setRed(float red) {
|
||||
m_buffer.putFloat(m_offset, red);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the green color component.
|
||||
*
|
||||
* @param green the new value
|
||||
*/
|
||||
public void setGreen(float green) {
|
||||
m_buffer.putFloat(m_offset + 4, green);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the blue color component.
|
||||
*
|
||||
* @param blue the new value
|
||||
*/
|
||||
public void setBlue(float blue) {
|
||||
m_buffer.putFloat(m_offset + 8, blue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the alpha color component.
|
||||
*
|
||||
* @param alpha the new value
|
||||
*/
|
||||
public void setAlpha(float alpha) {
|
||||
m_buffer.putFloat(m_offset + 12, alpha);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + getRed() + ", " + getGreen() + ", " + getBlue() + ", " +
|
||||
getAlpha() + "]";
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* Configuration interface for assimp importer.<p>
|
||||
*
|
||||
* This class is work-in-progress
|
||||
*/
|
||||
public class AiConfig {
|
||||
|
||||
}
|
@ -1,663 +0,0 @@
|
||||
/*
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* Lists all possible configuration options.<p>
|
||||
*
|
||||
* This class is work-in-progress
|
||||
*/
|
||||
public enum AiConfigOptions {
|
||||
/**
|
||||
* Maximum bone count per mesh for the SplitbyBoneCount step.<p>
|
||||
*
|
||||
* Meshes are split until the maximum number of bones is reached. The
|
||||
* default value is AI_SBBC_DEFAULT_MAX_BONES, which may be altered at
|
||||
* compile-time. This limit is imposed by the native jassimp library
|
||||
* and typically is 60.<p>
|
||||
*
|
||||
* Property data type: integer.
|
||||
*/
|
||||
PP_SBBC_MAX_BONES("PP_SBBC_MAX_BONES"),
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the maximum angle that may be between two vertex tangents
|
||||
* that their tangents and bi-tangents are smoothed.<p>
|
||||
*
|
||||
* This applies to the CalcTangentSpace-Step. The angle is specified
|
||||
* in degrees. The maximum value is 175.<p>
|
||||
*
|
||||
* Property type: float. Default value: 45 degrees
|
||||
*/
|
||||
PP_CT_MAX_SMOOTHING_ANGLE("PP_CT_MAX_SMOOTHING_ANGLE"),
|
||||
|
||||
|
||||
/**
|
||||
* Source UV channel for tangent space computation.<p>
|
||||
*
|
||||
* The specified channel must exist or an error will be raised.<p>
|
||||
*
|
||||
* Property type: integer. Default value: 0
|
||||
*/
|
||||
PP_CT_TEXTURE_CHANNEL_INDEX("PP_CT_TEXTURE_CHANNEL_INDEX"),
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the maximum angle that may be between two face normals
|
||||
* at the same vertex position that their are smoothed together.<p>
|
||||
*
|
||||
* Sometimes referred to as 'crease angle'. This applies to the
|
||||
* GenSmoothNormals-Step. The angle is specified in degrees, so 180 is PI.
|
||||
* The default value is 175 degrees (all vertex normals are smoothed). The
|
||||
* maximum value is 175, too.<p>
|
||||
*
|
||||
* Property type: float.<p>
|
||||
*
|
||||
* Warning: setting this option may cause a severe loss of performance. The
|
||||
* performance is unaffected if the {@link #CONFIG_FAVOUR_SPEED} flag is
|
||||
* set but the output quality may be reduced.
|
||||
*/
|
||||
PP_GSN_MAX_SMOOTHING_ANGLE("PP_GSN_MAX_SMOOTHING_ANGLE"),
|
||||
|
||||
|
||||
/**
|
||||
* Sets the colormap (= palette) to be used to decode embedded textures in
|
||||
* MDL (Quake or 3DGS) files.<p>
|
||||
*
|
||||
* This must be a valid path to a file. The file is 768 (256*3) bytes
|
||||
* large and contains RGB triplets for each of the 256 palette entries.
|
||||
* The default value is colormap.lmp. If the file is not found,
|
||||
* a default palette (from Quake 1) is used.<p>
|
||||
*
|
||||
* Property type: string.
|
||||
*/
|
||||
IMPORT_MDL_COLORMAP("IMPORT_MDL_COLORMAP"),
|
||||
|
||||
|
||||
/**
|
||||
* Configures the #aiProcess_RemoveRedundantMaterials step to keep
|
||||
* materials matching a name in a given list.<p>
|
||||
*
|
||||
* This is a list of 1 to n strings, ' ' serves as delimiter character.
|
||||
* Identifiers containing whitespaces must be enclosed in *single*
|
||||
* quotation marks. For example:<tt>
|
||||
* "keep-me and_me_to anotherMaterialToBeKept \'name with whitespace\'"</tt>.
|
||||
* If a material matches on of these names, it will not be modified or
|
||||
* removed by the postprocessing step nor will other materials be replaced
|
||||
* by a reference to it.<p>
|
||||
*
|
||||
* This option might be useful if you are using some magic material names
|
||||
* to pass additional semantics through the content pipeline. This ensures
|
||||
* they won't be optimized away, but a general optimization is still
|
||||
* performed for materials not contained in the list.<p>
|
||||
*
|
||||
* Property type: String. Default value: n/a<p>
|
||||
*
|
||||
* <b>Note:</b>Linefeeds, tabs or carriage returns are treated as
|
||||
* whitespace. Material names are case sensitive.
|
||||
*/
|
||||
PP_RRM_EXCLUDE_LIST("PP_RRM_EXCLUDE_LIST"),
|
||||
|
||||
|
||||
/**
|
||||
* Configures the {@link AiPostProcessSteps#PRE_TRANSFORM_VERTICES} step
|
||||
* to keep the scene hierarchy. Meshes are moved to worldspace, but no
|
||||
* optimization is performed (read: meshes with equal materials are not
|
||||
* joined. The total number of meshes won't change).<p>
|
||||
*
|
||||
* This option could be of use for you if the scene hierarchy contains
|
||||
* important additional information which you intend to parse.
|
||||
* For rendering, you can still render all meshes in the scene without
|
||||
* any transformations.<p>
|
||||
*
|
||||
* Property type: bool. Default value: false.
|
||||
*/
|
||||
PP_PTV_KEEP_HIERARCHY("PP_PTV_KEEP_HIERARCHY"),
|
||||
|
||||
|
||||
/**
|
||||
* Configures the {@link AiPostProcessSteps#PRE_TRANSFORM_VERTICES} step
|
||||
* to normalize all vertex components into the [-1,1] range.<p>
|
||||
*
|
||||
* That is, a bounding box for the whole scene is computed, the maximum
|
||||
* component is taken and all meshes are scaled appropriately (uniformly
|
||||
* of course!). This might be useful if you don't know the spatial
|
||||
* dimension of the input data.<p>
|
||||
*
|
||||
* Property type: bool. Default value: false.
|
||||
*/
|
||||
PP_PTV_NORMALIZE("PP_PTV_NORMALIZE"),
|
||||
|
||||
|
||||
/**
|
||||
* Configures the {@link AiPostProcessSteps#FIND_DEGENERATES} step to
|
||||
* remove degenerated primitives from the import - immediately.<p>
|
||||
*
|
||||
* The default behaviour converts degenerated triangles to lines and
|
||||
* degenerated lines to points. See the documentation to the
|
||||
* {@link AiPostProcessSteps#FIND_DEGENERATES} step for a detailed example
|
||||
* of the various ways to get rid of these lines and points if you don't
|
||||
* want them.<p>
|
||||
*
|
||||
* Property type: bool. Default value: false.
|
||||
*/
|
||||
PP_FD_REMOVE("PP_FD_REMOVE")
|
||||
|
||||
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the #aiProcess_OptimizeGraph step to preserve nodes
|
||||
// * matching a name in a given list.
|
||||
// *
|
||||
// * This is a list of 1 to n strings, ' ' serves as delimiter character.
|
||||
// * Identifiers containing whitespaces must be enclosed in *single*
|
||||
// * quotation marks. For example:<tt>
|
||||
// * "keep-me and_me_to anotherNodeToBeKept \'name with whitespace\'"</tt>.
|
||||
// * If a node matches on of these names, it will not be modified or
|
||||
// * removed by the postprocessing step.<br>
|
||||
// * This option might be useful if you are using some magic node names
|
||||
// * to pass additional semantics through the content pipeline. This ensures
|
||||
// * they won't be optimized away, but a general optimization is still
|
||||
// * performed for nodes not contained in the list.
|
||||
// * Property type: String. Default value: n/a
|
||||
// * @note Linefeeds, tabs or carriage returns are treated as whitespace.
|
||||
// * Node names are case sensitive.
|
||||
// */
|
||||
// #define AI_CONFIG_PP_OG_EXCLUDE_LIST \
|
||||
// "PP_OG_EXCLUDE_LIST"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Set the maximum number of triangles in a mesh.
|
||||
// *
|
||||
// * This is used by the "SplitLargeMeshes" PostProcess-Step to determine
|
||||
// * whether a mesh must be split or not.
|
||||
// * @note The default value is AI_SLM_DEFAULT_MAX_TRIANGLES
|
||||
// * Property type: integer.
|
||||
// */
|
||||
// #define AI_CONFIG_PP_SLM_TRIANGLE_LIMIT \
|
||||
// "PP_SLM_TRIANGLE_LIMIT"
|
||||
//
|
||||
// // default value for AI_CONFIG_PP_SLM_TRIANGLE_LIMIT
|
||||
// #if (!defined AI_SLM_DEFAULT_MAX_TRIANGLES)
|
||||
// # define AI_SLM_DEFAULT_MAX_TRIANGLES 1000000
|
||||
// #endif
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Set the maximum number of vertices in a mesh.
|
||||
// *
|
||||
// * This is used by the "SplitLargeMeshes" PostProcess-Step to determine
|
||||
// * whether a mesh must be split or not.
|
||||
// * @note The default value is AI_SLM_DEFAULT_MAX_VERTICES
|
||||
// * Property type: integer.
|
||||
// */
|
||||
// #define AI_CONFIG_PP_SLM_VERTEX_LIMIT \
|
||||
// "PP_SLM_VERTEX_LIMIT"
|
||||
//
|
||||
// // default value for AI_CONFIG_PP_SLM_VERTEX_LIMIT
|
||||
// #if (!defined AI_SLM_DEFAULT_MAX_VERTICES)
|
||||
// # define AI_SLM_DEFAULT_MAX_VERTICES 1000000
|
||||
// #endif
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Set the maximum number of bones affecting a single vertex
|
||||
// *
|
||||
// * This is used by the #aiProcess_LimitBoneWeights PostProcess-Step.
|
||||
// * @note The default value is AI_LBW_MAX_WEIGHTS
|
||||
// * Property type: integer.*/
|
||||
// #define AI_CONFIG_PP_LBW_MAX_WEIGHTS \
|
||||
// "PP_LBW_MAX_WEIGHTS"
|
||||
//
|
||||
// // default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS
|
||||
// #if (!defined AI_LMW_MAX_WEIGHTS)
|
||||
// # define AI_LMW_MAX_WEIGHTS 0x4
|
||||
// #endif // !! AI_LMW_MAX_WEIGHTS
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Lower the deboning threshold in order to remove more bones.
|
||||
// *
|
||||
// * This is used by the #aiProcess_Debone PostProcess-Step.
|
||||
// * @note The default value is AI_DEBONE_THRESHOLD
|
||||
// * Property type: float.*/
|
||||
// #define AI_CONFIG_PP_DB_THRESHOLD \
|
||||
// "PP_DB_THRESHOLD"
|
||||
//
|
||||
// // default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS
|
||||
// #if (!defined AI_DEBONE_THRESHOLD)
|
||||
// # define AI_DEBONE_THRESHOLD 1.0f
|
||||
// #endif // !! AI_DEBONE_THRESHOLD
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Require all bones qualify for deboning before removing any
|
||||
// *
|
||||
// * This is used by the #aiProcess_Debone PostProcess-Step.
|
||||
// * @note The default value is 0
|
||||
// * Property type: bool.*/
|
||||
// #define AI_CONFIG_PP_DB_ALL_OR_NONE \
|
||||
// "PP_DB_ALL_OR_NONE"
|
||||
//
|
||||
// /** @brief Default value for the #AI_CONFIG_PP_ICL_PTCACHE_SIZE property
|
||||
// */
|
||||
// #ifndef PP_ICL_PTCACHE_SIZE
|
||||
// # define PP_ICL_PTCACHE_SIZE 12
|
||||
// #endif
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Set the size of the post-transform vertex cache to optimize the
|
||||
// * vertices for. This configures the #aiProcess_ImproveCacheLocality step.
|
||||
// *
|
||||
// * The size is given in vertices. Of course you can't know how the vertex
|
||||
// * format will exactly look like after the import returns, but you can still
|
||||
// * guess what your meshes will probably have.
|
||||
// * @note The default value is #PP_ICL_PTCACHE_SIZE. That results in slight
|
||||
// * performance improvements for most nVidia/AMD cards since 2002.
|
||||
// * Property type: integer.
|
||||
// */
|
||||
// #define AI_CONFIG_PP_ICL_PTCACHE_SIZE "PP_ICL_PTCACHE_SIZE"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Enumerates components of the aiScene and aiMesh data structures
|
||||
// * that can be excluded from the import using the #aiPrpcess_RemoveComponent step.
|
||||
// *
|
||||
// * See the documentation to #aiProcess_RemoveComponent for more details.
|
||||
// */
|
||||
// enum aiComponent
|
||||
// {
|
||||
// /** Normal vectors */
|
||||
// #ifdef SWIG
|
||||
// aiComponent_NORMALS = 0x2,
|
||||
// #else
|
||||
// aiComponent_NORMALS = 0x2u,
|
||||
// #endif
|
||||
//
|
||||
// /** Tangents and bitangents go always together ... */
|
||||
// #ifdef SWIG
|
||||
// aiComponent_TANGENTS_AND_BITANGENTS = 0x4,
|
||||
// #else
|
||||
// aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,
|
||||
// #endif
|
||||
//
|
||||
// /** ALL color sets
|
||||
// * Use aiComponent_COLORn(N) to specify the N'th set */
|
||||
// aiComponent_COLORS = 0x8,
|
||||
//
|
||||
// /** ALL texture UV sets
|
||||
// * aiComponent_TEXCOORDn(N) to specify the N'th set */
|
||||
// aiComponent_TEXCOORDS = 0x10,
|
||||
//
|
||||
// /** Removes all bone weights from all meshes.
|
||||
// * The scenegraph nodes corresponding to the bones are NOT removed.
|
||||
// * use the #aiProcess_OptimizeGraph step to do this */
|
||||
// aiComponent_BONEWEIGHTS = 0x20,
|
||||
//
|
||||
// /** Removes all node animations (aiScene::mAnimations).
|
||||
// * The corresponding scenegraph nodes are NOT removed.
|
||||
// * use the #aiProcess_OptimizeGraph step to do this */
|
||||
// aiComponent_ANIMATIONS = 0x40,
|
||||
//
|
||||
// /** Removes all embedded textures (aiScene::mTextures) */
|
||||
// aiComponent_TEXTURES = 0x80,
|
||||
//
|
||||
// /** Removes all light sources (aiScene::mLights).
|
||||
// * The corresponding scenegraph nodes are NOT removed.
|
||||
// * use the #aiProcess_OptimizeGraph step to do this */
|
||||
// aiComponent_LIGHTS = 0x100,
|
||||
//
|
||||
// /** Removes all light sources (aiScene::mCameras).
|
||||
// * The corresponding scenegraph nodes are NOT removed.
|
||||
// * use the #aiProcess_OptimizeGraph step to do this */
|
||||
// aiComponent_CAMERAS = 0x200,
|
||||
//
|
||||
// /** Removes all meshes (aiScene::mMeshes). */
|
||||
// aiComponent_MESHES = 0x400,
|
||||
//
|
||||
// /** Removes all materials. One default material will
|
||||
// * be generated, so aiScene::mNumMaterials will be 1. */
|
||||
// aiComponent_MATERIALS = 0x800,
|
||||
//
|
||||
//
|
||||
// /** This value is not used. It is just there to force the
|
||||
// * compiler to map this enum to a 32 Bit integer. */
|
||||
// #ifndef SWIG
|
||||
// _aiComponent_Force32Bit = 0x9fffffff
|
||||
// #endif
|
||||
// };
|
||||
//
|
||||
// // Remove a specific color channel 'n'
|
||||
// #define aiComponent_COLORSn(n) (1u << (n+20u))
|
||||
//
|
||||
// // Remove a specific UV channel 'n'
|
||||
// #define aiComponent_TEXCOORDSn(n) (1u << (n+25u))
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Input parameter to the #aiProcess_RemoveComponent step:
|
||||
// * Specifies the parts of the data structure to be removed.
|
||||
// *
|
||||
// * See the documentation to this step for further details. The property
|
||||
// * is expected to be an integer, a bitwise combination of the
|
||||
// * #aiComponent flags defined above in this header. The default
|
||||
// * value is 0. Important: if no valid mesh is remaining after the
|
||||
// * step has been executed (e.g you thought it was funny to specify ALL
|
||||
// * of the flags defined above) the import FAILS. Mainly because there is
|
||||
// * no data to work on anymore ...
|
||||
// */
|
||||
// #define AI_CONFIG_PP_RVC_FLAGS \
|
||||
// "PP_RVC_FLAGS"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Input parameter to the #aiProcess_SortByPType step:
|
||||
// * Specifies which primitive types are removed by the step.
|
||||
// *
|
||||
// * This is a bitwise combination of the aiPrimitiveType flags.
|
||||
// * Specifying all of them is illegal, of course. A typical use would
|
||||
// * be to exclude all line and point meshes from the import. This
|
||||
// * is an integer property, its default value is 0.
|
||||
// */
|
||||
// #define AI_CONFIG_PP_SBP_REMOVE \
|
||||
// "PP_SBP_REMOVE"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Input parameter to the #aiProcess_FindInvalidData step:
|
||||
// * Specifies the floating-point accuracy for animation values. The step
|
||||
// * checks for animation tracks where all frame values are absolutely equal
|
||||
// * and removes them. This tweakable controls the epsilon for floating-point
|
||||
// * comparisons - two keys are considered equal if the invariant
|
||||
// * abs(n0-n1)>epsilon holds true for all vector respectively quaternion
|
||||
// * components. The default value is 0.f - comparisons are exact then.
|
||||
// */
|
||||
// #define AI_CONFIG_PP_FID_ANIM_ACCURACY \
|
||||
// "PP_FID_ANIM_ACCURACY"
|
||||
//
|
||||
//
|
||||
// // TransformUVCoords evaluates UV scalings
|
||||
// #define AI_UVTRAFO_SCALING 0x1
|
||||
//
|
||||
// // TransformUVCoords evaluates UV rotations
|
||||
// #define AI_UVTRAFO_ROTATION 0x2
|
||||
//
|
||||
// // TransformUVCoords evaluates UV translation
|
||||
// #define AI_UVTRAFO_TRANSLATION 0x4
|
||||
//
|
||||
// // Everything baked together -> default value
|
||||
// #define AI_UVTRAFO_ALL (AI_UVTRAFO_SCALING | AI_UVTRAFO_ROTATION | AI_UVTRAFO_TRANSLATION)
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Input parameter to the #aiProcess_TransformUVCoords step:
|
||||
// * Specifies which UV transformations are evaluated.
|
||||
// *
|
||||
// * This is a bitwise combination of the AI_UVTRAFO_XXX flags (integer
|
||||
// * property, of course). By default all transformations are enabled
|
||||
// * (AI_UVTRAFO_ALL).
|
||||
// */
|
||||
// #define AI_CONFIG_PP_TUV_EVALUATE \
|
||||
// "PP_TUV_EVALUATE"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief A hint to assimp to favour speed against import quality.
|
||||
// *
|
||||
// * Enabling this option may result in faster loading, but it needn't.
|
||||
// * It represents just a hint to loaders and post-processing steps to use
|
||||
// * faster code paths, if possible.
|
||||
// * This property is expected to be an integer, != 0 stands for true.
|
||||
// * The default value is 0.
|
||||
// */
|
||||
// #define AI_CONFIG_FAVOUR_SPEED \
|
||||
// "FAVOUR_SPEED"
|
||||
//
|
||||
//
|
||||
// // ###########################################################################
|
||||
// // IMPORTER SETTINGS
|
||||
// // Various stuff to fine-tune the behaviour of specific importer plugins.
|
||||
// // ###########################################################################
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Set the vertex animation keyframe to be imported
|
||||
// *
|
||||
// * ASSIMP does not support vertex keyframes (only bone animation is supported).
|
||||
// * The library reads only one frame of models with vertex animations.
|
||||
// * By default this is the first frame.
|
||||
// * \note The default value is 0. This option applies to all importers.
|
||||
// * However, it is also possible to override the global setting
|
||||
// * for a specific loader. You can use the AI_CONFIG_IMPORT_XXX_KEYFRAME
|
||||
// * options (where XXX is a placeholder for the file format for which you
|
||||
// * want to override the global setting).
|
||||
// * Property type: integer.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_GLOBAL_KEYFRAME "IMPORT_GLOBAL_KEYFRAME"
|
||||
//
|
||||
// #define AI_CONFIG_IMPORT_MD3_KEYFRAME "IMPORT_MD3_KEYFRAME"
|
||||
// #define AI_CONFIG_IMPORT_MD2_KEYFRAME "IMPORT_MD2_KEYFRAME"
|
||||
// #define AI_CONFIG_IMPORT_MDL_KEYFRAME "IMPORT_MDL_KEYFRAME"
|
||||
// #define AI_CONFIG_IMPORT_MDC_KEYFRAME "IMPORT_MDC_KEYFRAME"
|
||||
// #define AI_CONFIG_IMPORT_SMD_KEYFRAME "IMPORT_SMD_KEYFRAME"
|
||||
// #define AI_CONFIG_IMPORT_UNREAL_KEYFRAME "IMPORT_UNREAL_KEYFRAME"
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the AC loader to collect all surfaces which have the
|
||||
// * "Backface cull" flag set in separate meshes.
|
||||
// *
|
||||
// * Property type: bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL \
|
||||
// "IMPORT_AC_SEPARATE_BFCULL"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures whether the AC loader evaluates subdivision surfaces (
|
||||
// * indicated by the presence of the 'subdiv' attribute in the file). By
|
||||
// * default, Assimp performs the subdivision using the standard
|
||||
// * Catmull-Clark algorithm
|
||||
// *
|
||||
// * * Property type: bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_AC_EVAL_SUBDIVISION \
|
||||
// "IMPORT_AC_EVAL_SUBDIVISION"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the UNREAL 3D loader to separate faces with different
|
||||
// * surface flags (e.g. two-sided vs. single-sided).
|
||||
// *
|
||||
// * * Property type: bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS \
|
||||
// "UNREAL_HANDLE_FLAGS"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the terragen import plugin to compute uv's for
|
||||
// * terrains, if not given. Furthermore a default texture is assigned.
|
||||
// *
|
||||
// * UV coordinates for terrains are so simple to compute that you'll usually
|
||||
// * want to compute them on your own, if you need them. This option is intended
|
||||
// * for model viewers which want to offer an easy way to apply textures to
|
||||
// * terrains.
|
||||
// * * Property type: bool. Default value: false.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_TER_MAKE_UVS \
|
||||
// "IMPORT_TER_MAKE_UVS"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the ASE loader to always reconstruct normal vectors
|
||||
// * basing on the smoothing groups loaded from the file.
|
||||
// *
|
||||
// * Some ASE files have carry invalid normals, other don't.
|
||||
// * * Property type: bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS \
|
||||
// "IMPORT_ASE_RECONSTRUCT_NORMALS"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the M3D loader to detect and process multi-part
|
||||
// * Quake player models.
|
||||
// *
|
||||
// * These models usually consist of 3 files, lower.md3, upper.md3 and
|
||||
// * head.md3. If this property is set to true, Assimp will try to load and
|
||||
// * combine all three files if one of them is loaded.
|
||||
// * Property type: bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART \
|
||||
// "IMPORT_MD3_HANDLE_MULTIPART"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Tells the MD3 loader which skin files to load.
|
||||
// *
|
||||
// * When loading MD3 files, Assimp checks whether a file
|
||||
// * <md3_file_name>_<skin_name>.skin is existing. These files are used by
|
||||
// * Quake III to be able to assign different skins (e.g. red and blue team)
|
||||
// * to models. 'default', 'red', 'blue' are typical skin names.
|
||||
// * Property type: String. Default value: "default".
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_MD3_SKIN_NAME \
|
||||
// "IMPORT_MD3_SKIN_NAME"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Specify the Quake 3 shader file to be used for a particular
|
||||
// * MD3 file. This can also be a search path.
|
||||
// *
|
||||
// * By default Assimp's behaviour is as follows: If a MD3 file
|
||||
// * <tt><any_path>/models/<any_q3_subdir>/<model_name>/<file_name>.md3</tt> is
|
||||
// * loaded, the library tries to locate the corresponding shader file in
|
||||
// * <tt><any_path>/scripts/<model_name>.shader</tt>. This property overrides this
|
||||
// * behaviour. It can either specify a full path to the shader to be loaded
|
||||
// * or alternatively the path (relative or absolute) to the directory where
|
||||
// * the shaders for all MD3s to be loaded reside. Assimp attempts to open
|
||||
// * <tt><dir>/<model_name>.shader</tt> first, <tt><dir>/<file_name>.shader</tt>
|
||||
// * is the fallback file. Note that <dir> should have a terminal (back)slash.
|
||||
// * Property type: String. Default value: n/a.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_MD3_SHADER_SRC \
|
||||
// "IMPORT_MD3_SHADER_SRC"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the LWO loader to load just one layer from the model.
|
||||
// *
|
||||
// * LWO files consist of layers and in some cases it could be useful to load
|
||||
// * only one of them. This property can be either a string - which specifies
|
||||
// * the name of the layer - or an integer - the index of the layer. If the
|
||||
// * property is not set the whole LWO model is loaded. Loading fails if the
|
||||
// * requested layer is not available. The layer index is zero-based and the
|
||||
// * layer name may not be empty.<br>
|
||||
// * Property type: Integer. Default value: all layers are loaded.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY \
|
||||
// "IMPORT_LWO_ONE_LAYER_ONLY"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Configures the MD5 loader to not load the MD5ANIM file for
|
||||
// * a MD5MESH file automatically.
|
||||
// *
|
||||
// * The default strategy is to look for a file with the same name but the
|
||||
// * MD5ANIM extension in the same directory. If it is found, it is loaded
|
||||
// * and combined with the MD5MESH file. This configuration option can be
|
||||
// * used to disable this behaviour.
|
||||
// *
|
||||
// * * Property type: bool. Default value: false.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD \
|
||||
// "IMPORT_MD5_NO_ANIM_AUTOLOAD"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Defines the begin of the time range for which the LWS loader
|
||||
// * evaluates animations and computes aiNodeAnim's.
|
||||
// *
|
||||
// * Assimp provides full conversion of LightWave's envelope system, including
|
||||
// * pre and post conditions. The loader computes linearly subsampled animation
|
||||
// * chanels with the frame rate given in the LWS file. This property defines
|
||||
// * the start time. Note: animation channels are only generated if a node
|
||||
// * has at least one envelope with more tan one key assigned. This property.
|
||||
// * is given in frames, '0' is the first frame. By default, if this property
|
||||
// * is not set, the importer takes the animation start from the input LWS
|
||||
// * file ('FirstFrame' line)<br>
|
||||
// * Property type: Integer. Default value: taken from file.
|
||||
// *
|
||||
// * @see AI_CONFIG_IMPORT_LWS_ANIM_END - end of the imported time range
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_LWS_ANIM_START \
|
||||
// "IMPORT_LWS_ANIM_START"
|
||||
// #define AI_CONFIG_IMPORT_LWS_ANIM_END \
|
||||
// "IMPORT_LWS_ANIM_END"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Defines the output frame rate of the IRR loader.
|
||||
// *
|
||||
// * IRR animations are difficult to convert for Assimp and there will
|
||||
// * always be a loss of quality. This setting defines how many keys per second
|
||||
// * are returned by the converter.<br>
|
||||
// * Property type: integer. Default value: 100
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_IRR_ANIM_FPS \
|
||||
// "IMPORT_IRR_ANIM_FPS"
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Ogre Importer will try to load this Materialfile.
|
||||
// *
|
||||
// * Ogre Meshes contain only the MaterialName, not the MaterialFile. If there
|
||||
// * is no material file with the same name as the material, Ogre Importer will
|
||||
// * try to load this file and search the material in it.
|
||||
// * <br>
|
||||
// * Property type: String. Default value: guessed.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE "IMPORT_OGRE_MATERIAL_FILE"
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Ogre Importer detect the texture usage from its filename
|
||||
// *
|
||||
// * Normally, a texture is loaded as a colormap, if no target is specified in the
|
||||
// * materialfile. Is this switch is enabled, texture names ending with _n, _l, _s
|
||||
// * are used as normalmaps, lightmaps or specularmaps.
|
||||
// * <br>
|
||||
// * Property type: Bool. Default value: false.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME"
|
||||
//
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Specifies whether the IFC loader skips over IfcSpace elements.
|
||||
// *
|
||||
// * IfcSpace elements (and their geometric representations) are used to
|
||||
// * represent, well, free space in a building storey.<br>
|
||||
// * Property type: Bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS "IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS"
|
||||
//
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Specifies whether the IFC loader skips over
|
||||
// * shape representations of type 'Curve2D'.
|
||||
// *
|
||||
// * A lot of files contain both a faceted mesh representation and a outline
|
||||
// * with a presentation type of 'Curve2D'. Currently Assimp doesn't convert those,
|
||||
// * so turning this option off just clutters the log with errors.<br>
|
||||
// * Property type: Bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS "IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS"
|
||||
//
|
||||
// // ---------------------------------------------------------------------------
|
||||
// /** @brief Specifies whether the IFC loader will use its own, custom triangulation
|
||||
// * algorithm to triangulate wall and floor meshes.
|
||||
// *
|
||||
// * If this property is set to false, walls will be either triangulated by
|
||||
// * #aiProcess_Triangulate or will be passed through as huge polygons with
|
||||
// * faked holes (i.e. holes that are connected with the outer boundary using
|
||||
// * a dummy edge). It is highly recommended to set this property to true
|
||||
// * if you want triangulated data because #aiProcess_Triangulate is known to
|
||||
// * have problems with the kind of polygons that the IFC loader spits out for
|
||||
// * complicated meshes.
|
||||
// * Property type: Bool. Default value: true.
|
||||
// */
|
||||
// #define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION"
|
||||
//
|
||||
;
|
||||
|
||||
private AiConfigOptions(String name) {
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
|
||||
private final String m_name;
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
/**
|
||||
* Interface to allow custom resource loaders for jassimp.<p>
|
||||
*
|
||||
* The design is based on passing the file wholly in memory,
|
||||
* because Java inputstreams do not have to support seek. <p>
|
||||
*
|
||||
* Writing files from Java is unsupported.
|
||||
*
|
||||
*
|
||||
* @author Jesper Smith
|
||||
*
|
||||
*/
|
||||
public interface AiIOStream
|
||||
{
|
||||
|
||||
/**
|
||||
* Read all data into buffer. <p>
|
||||
*
|
||||
* The whole stream should be read into the buffer.
|
||||
* No support is provided for partial reads.
|
||||
*
|
||||
* @param buffer Target buffer for the model data
|
||||
*
|
||||
* @return true if successful, false if an error occurred.
|
||||
*/
|
||||
boolean read(ByteBuffer buffer);
|
||||
|
||||
/**
|
||||
* The total size of this stream. <p>
|
||||
*
|
||||
* @return total size of this stream
|
||||
*/
|
||||
int getFileSize();
|
||||
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
public interface AiIOSystem <T extends AiIOStream>
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Open a new file with a given path.
|
||||
* When the access to the file is finished, call close() to release all associated resources
|
||||
*
|
||||
* @param path Path to the file
|
||||
* @param ioMode file I/O mode. Required are: "wb", "w", "wt", "rb", "r", "rt".
|
||||
*
|
||||
* @return AiIOStream or null if an error occurred
|
||||
*/
|
||||
public T open(String path, String ioMode);
|
||||
|
||||
|
||||
/**
|
||||
* Tests for the existence of a file at the given path.
|
||||
*
|
||||
* @param path path to the file
|
||||
* @return true if there is a file with this path, else false.
|
||||
*/
|
||||
public boolean exists(String path);
|
||||
|
||||
/**
|
||||
* Returns the system specific directory separator.<p>
|
||||
*
|
||||
* @return System specific directory separator
|
||||
*/
|
||||
public char getOsSeparator();
|
||||
|
||||
/**
|
||||
* Closes the given file and releases all resources associated with it.
|
||||
*
|
||||
* @param file The file instance previously created by Open().
|
||||
*/
|
||||
public void close(T file);
|
||||
}
|
@ -1,127 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of AiIOStream reading from a InputStream
|
||||
*
|
||||
* @author Jesper Smith
|
||||
*
|
||||
*/
|
||||
public class AiInputStreamIOStream implements AiIOStream
|
||||
{
|
||||
private final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
public AiInputStreamIOStream(URI uri) throws IOException {
|
||||
this(uri.toURL());
|
||||
}
|
||||
|
||||
public AiInputStreamIOStream(URL url) throws IOException {
|
||||
this(url.openStream());
|
||||
}
|
||||
|
||||
public AiInputStreamIOStream(InputStream is) throws IOException {
|
||||
int read;
|
||||
byte[] data = new byte[1024];
|
||||
while((read = is.read(data, 0, data.length)) != -1) {
|
||||
os.write(data, 0, read);
|
||||
}
|
||||
os.flush();
|
||||
|
||||
is.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFileSize() {
|
||||
return os.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean read(ByteBuffer buffer) {
|
||||
ByteBufferOutputStream bos = new ByteBufferOutputStream(buffer);
|
||||
try
|
||||
{
|
||||
os.writeTo(bos);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal helper class to copy the contents of an OutputStream
|
||||
* into a ByteBuffer. This avoids a copy.
|
||||
*
|
||||
*/
|
||||
private static class ByteBufferOutputStream extends OutputStream {
|
||||
|
||||
private final ByteBuffer buffer;
|
||||
|
||||
public ByteBufferOutputStream(ByteBuffer buffer) {
|
||||
this.buffer = buffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException
|
||||
{
|
||||
buffer.put((byte) b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
buffer.put(b, off, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,387 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* Describes a light source.<p>
|
||||
*
|
||||
* Assimp supports multiple sorts of light sources, including
|
||||
* directional, point and spot lights. All of them are defined with just
|
||||
* a single structure and distinguished by their parameters.
|
||||
* Note - some file formats (such as 3DS, ASE) export a "target point" -
|
||||
* the point a spot light is looking at (it can even be animated). Assimp
|
||||
* writes the target point as a subnode of a spotlights's main node,
|
||||
* called "<spotName>.Target". However, this is just additional
|
||||
* information then, the transformation tracks of the main node make the
|
||||
* spot light already point in the right direction.
|
||||
*/
|
||||
public final class AiLight {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param name
|
||||
* @param type
|
||||
* @param position
|
||||
* @param direction
|
||||
* @param attenuationConstant
|
||||
* @param attenuationLinear
|
||||
* @param attenuationQuadratic
|
||||
* @param diffuse
|
||||
* @param specular
|
||||
* @param ambient
|
||||
* @param innerCone
|
||||
* @param outerCone
|
||||
*/
|
||||
AiLight(String name, int type, Object position, Object direction,
|
||||
float attenuationConstant, float attenuationLinear,
|
||||
float attenuationQuadratic, Object diffuse, Object specular,
|
||||
Object ambient, float innerCone, float outerCone) {
|
||||
|
||||
m_name = name;
|
||||
m_type = AiLightType.fromRawValue(type);
|
||||
m_position = position;
|
||||
m_direction = direction;
|
||||
m_attenuationConstant = attenuationConstant;
|
||||
m_attenuationLinear = attenuationLinear;
|
||||
m_attenuationQuadratic = attenuationQuadratic;
|
||||
m_diffuse = diffuse;
|
||||
m_specular = specular;
|
||||
m_ambient = ambient;
|
||||
m_innerCone = innerCone;
|
||||
m_outerCone = outerCone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of the light source.<p>
|
||||
*
|
||||
* There must be a node in the scenegraph with the same name.
|
||||
* This node specifies the position of the light in the scene
|
||||
* hierarchy and can be animated.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns The type of the light source.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public AiLightType getType() {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the position of the light.<p>
|
||||
*
|
||||
* The position is relative to the transformation of the scene graph node
|
||||
* corresponding to the light. The position is undefined for directional
|
||||
* lights.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built in behavior is to return an {@link AiVector}.
|
||||
*
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
*
|
||||
* @return the position
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> V3 getPosition(AiWrapperProvider<V3, M4, C, N, Q>
|
||||
wrapperProvider) {
|
||||
|
||||
return (V3) m_position;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the direction of the light.<p>
|
||||
*
|
||||
* The direction is relative to the transformation of the scene graph node
|
||||
* corresponding to the light. The direction is undefined for point lights.
|
||||
* The vector may be normalized, but it needn't..<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built in behavior is to return an {@link AiVector}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the position
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> V3 getDirection(AiWrapperProvider<V3, M4, C, N, Q>
|
||||
wrapperProvider) {
|
||||
|
||||
return (V3) m_direction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant light attenuation factor.<p>
|
||||
*
|
||||
* The intensity of the light source at a given distance 'd' from
|
||||
* the light's position is
|
||||
* <code>Atten = 1/( att0 + att1 * d + att2 * d*d)</code>
|
||||
* This member corresponds to the att0 variable in the equation.
|
||||
* Naturally undefined for directional lights.
|
||||
*
|
||||
* @return the constant light attenuation factor
|
||||
*/
|
||||
public float getAttenuationConstant() {
|
||||
return m_attenuationConstant;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Linear light attenuation factor.<p>
|
||||
*
|
||||
* The intensity of the light source at a given distance 'd' from
|
||||
* the light's position is
|
||||
* <code>Atten = 1/( att0 + att1 * d + att2 * d*d)</code>
|
||||
* This member corresponds to the att1 variable in the equation.
|
||||
* Naturally undefined for directional lights.
|
||||
*
|
||||
* @return the linear light attenuation factor
|
||||
*/
|
||||
public float getAttenuationLinear() {
|
||||
return m_attenuationLinear;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Quadratic light attenuation factor.<p>
|
||||
*
|
||||
* The intensity of the light source at a given distance 'd' from
|
||||
* the light's position is
|
||||
* <code>Atten = 1/( att0 + att1 * d + att2 * d*d)</code>
|
||||
* This member corresponds to the att2 variable in the equation.
|
||||
* Naturally undefined for directional lights.
|
||||
*
|
||||
* @return the quadratic light attenuation factor
|
||||
*/
|
||||
public float getAttenuationQuadratic() {
|
||||
return m_attenuationQuadratic;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Diffuse color of the light source.<p>
|
||||
*
|
||||
* The diffuse light color is multiplied with the diffuse
|
||||
* material color to obtain the final color that contributes
|
||||
* to the diffuse shading term.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built in behavior is to return an {@link AiColor}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the diffuse color (alpha will be 1)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> C getColorDiffuse(
|
||||
AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) {
|
||||
|
||||
return (C) m_diffuse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specular color of the light source.<p>
|
||||
*
|
||||
* The specular light color is multiplied with the specular
|
||||
* material color to obtain the final color that contributes
|
||||
* to the specular shading term.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built in behavior is to return an {@link AiColor}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the specular color (alpha will be 1)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> C getColorSpecular(
|
||||
AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) {
|
||||
|
||||
return (C) m_specular;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ambient color of the light source.<p>
|
||||
*
|
||||
* The ambient light color is multiplied with the ambient
|
||||
* material color to obtain the final color that contributes
|
||||
* to the ambient shading term. Most renderers will ignore
|
||||
* this value it, is just a remaining of the fixed-function pipeline
|
||||
* that is still supported by quite many file formats.<p>
|
||||
*
|
||||
* This method is part of the wrapped API (see {@link AiWrapperProvider}
|
||||
* for details on wrappers).<p>
|
||||
*
|
||||
* The built in behavior is to return an {@link AiColor}.
|
||||
*
|
||||
* @param wrapperProvider the wrapper provider (used for type inference)
|
||||
* @return the ambient color (alpha will be 1)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V3, M4, C, N, Q> C getColorAmbient(
|
||||
AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) {
|
||||
|
||||
return (C) m_ambient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inner angle of a spot light's light cone.<p>
|
||||
*
|
||||
* The spot light has maximum influence on objects inside this
|
||||
* angle. The angle is given in radians. It is 2PI for point
|
||||
* lights and undefined for directional lights.
|
||||
*
|
||||
* @return the inner angle
|
||||
*/
|
||||
public float getAngleInnerCone() {
|
||||
return m_innerCone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Outer angle of a spot light's light cone.<p>
|
||||
*
|
||||
* The spot light does not affect objects outside this angle.
|
||||
* The angle is given in radians. It is 2PI for point lights and
|
||||
* undefined for directional lights. The outer angle must be
|
||||
* greater than or equal to the inner angle.
|
||||
* It is assumed that the application uses a smooth
|
||||
* interpolation between the inner and the outer cone of the
|
||||
* spot light.
|
||||
*
|
||||
* @return the outer angle
|
||||
*/
|
||||
public float getAngleOuterCone() {
|
||||
return m_outerCone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*/
|
||||
private final String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Type.
|
||||
*/
|
||||
private final AiLightType m_type;
|
||||
|
||||
|
||||
/**
|
||||
* Position.
|
||||
*/
|
||||
private final Object m_position;
|
||||
|
||||
|
||||
/**
|
||||
* Direction.
|
||||
*/
|
||||
private final Object m_direction;
|
||||
|
||||
|
||||
/**
|
||||
* Constant attenuation.
|
||||
*/
|
||||
private final float m_attenuationConstant;
|
||||
|
||||
|
||||
/**
|
||||
* Linear attenuation.
|
||||
*/
|
||||
private final float m_attenuationLinear;
|
||||
|
||||
|
||||
/**
|
||||
* Quadratic attenuation.
|
||||
*/
|
||||
private final float m_attenuationQuadratic;
|
||||
|
||||
|
||||
/**
|
||||
* Diffuse color.
|
||||
*/
|
||||
private final Object m_diffuse;
|
||||
|
||||
|
||||
/**
|
||||
* Specular color.
|
||||
*/
|
||||
private final Object m_specular;
|
||||
|
||||
|
||||
/**
|
||||
* Ambient color.
|
||||
*/
|
||||
private final Object m_ambient;
|
||||
|
||||
|
||||
/**
|
||||
* Inner cone of spotlight.
|
||||
*/
|
||||
private final float m_innerCone;
|
||||
|
||||
|
||||
/**
|
||||
* Outer cone of spotlight.
|
||||
*/
|
||||
private final float m_outerCone;
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
|
||||
/**
|
||||
* List of light types supported by {@link AiLight}.
|
||||
*/
|
||||
public enum AiLightType {
|
||||
/**
|
||||
* A directional light source.<p>
|
||||
*
|
||||
* A directional light has a well-defined direction but is infinitely far
|
||||
* away. That's quite a good approximation for sun light.
|
||||
*/
|
||||
DIRECTIONAL(0x1),
|
||||
|
||||
|
||||
/**
|
||||
* A point light source.<p>
|
||||
*
|
||||
* A point light has a well-defined position in space but no direction -
|
||||
* it emits light in all directions. A normal bulb is a point light.
|
||||
*/
|
||||
POINT(0x2),
|
||||
|
||||
|
||||
/**
|
||||
* A spot light source.<p>
|
||||
*
|
||||
* A spot light emits light in a specific angle. It has a position and a
|
||||
* direction it is pointing to. A good example for a spot light is a light
|
||||
* spot in sport arenas.
|
||||
*/
|
||||
SPOT(0x3),
|
||||
|
||||
|
||||
/**
|
||||
* The generic light level of the world, including the bounces of all other
|
||||
* lightsources. <p>
|
||||
*
|
||||
* Typically, there's at most one ambient light in a scene.
|
||||
* This light type doesn't have a valid position, direction, or
|
||||
* other properties, just a color.
|
||||
*/
|
||||
AMBIENT(0x4);
|
||||
|
||||
|
||||
/**
|
||||
* Utility method for converting from c/c++ based integer enums to java
|
||||
* enums.<p>
|
||||
*
|
||||
* This method is intended to be used from JNI and my change based on
|
||||
* implementation needs.
|
||||
*
|
||||
* @param rawValue an integer based enum value (as defined by assimp)
|
||||
* @return the enum value corresponding to rawValue
|
||||
*/
|
||||
static AiLightType fromRawValue(int rawValue) {
|
||||
for (AiLightType type : AiLightType.values()) {
|
||||
if (type.m_rawValue == rawValue) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("unexptected raw value: " +
|
||||
rawValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param rawValue maps java enum to c/c++ integer enum values
|
||||
*/
|
||||
private AiLightType(int rawValue) {
|
||||
m_rawValue = rawValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The mapped c/c++ integer enum value.
|
||||
*/
|
||||
private final int m_rawValue;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,133 +0,0 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library - Java Binding (jassimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
package jassimp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
/**
|
||||
* Simple 4x4 matrix of floats.
|
||||
*/
|
||||
public final class AiMatrix4f {
|
||||
/**
|
||||
* Wraps the given array of floats as matrix.
|
||||
* <p>
|
||||
*
|
||||
* The array must have exactly 16 entries. The data in the array must be in
|
||||
* row-major order.
|
||||
*
|
||||
* @param data
|
||||
* the array to wrap, may not be null
|
||||
*/
|
||||
public AiMatrix4f(float[] data) {
|
||||
if (data == null) {
|
||||
throw new IllegalArgumentException("data may not be null");
|
||||
}
|
||||
if (data.length != 16) {
|
||||
throw new IllegalArgumentException("array length is not 16");
|
||||
}
|
||||
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an element of the matrix.
|
||||
*
|
||||
* @param row
|
||||
* the row
|
||||
* @param col
|
||||
* the column
|
||||
* @return the element at the given position
|
||||
*/
|
||||
public float get(int row, int col) {
|
||||
if (row < 0 || row > 3) {
|
||||
throw new IndexOutOfBoundsException("Index: " + row + ", Size: 4");
|
||||
}
|
||||
if (col < 0 || col > 3) {
|
||||
throw new IndexOutOfBoundsException("Index: " + col + ", Size: 4");
|
||||
}
|
||||
|
||||
return m_data[row * 4 + col];
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the matrix in a new direct ByteBuffer with native byte order.
|
||||
* <p>
|
||||
*
|
||||
* The returned buffer can be passed to rendering APIs such as LWJGL, e.g.,
|
||||
* as parameter for <code>GL20.glUniformMatrix4()</code>. Be sure to set
|
||||
* <code>transpose</code> to <code>true</code> in this case, as OpenGL
|
||||
* expects the matrix in column order.
|
||||
*
|
||||
* @return a new native order, direct ByteBuffer
|
||||
*/
|
||||
public FloatBuffer toByteBuffer() {
|
||||
ByteBuffer bbuf = ByteBuffer.allocateDirect(16 * 4);
|
||||
bbuf.order(ByteOrder.nativeOrder());
|
||||
FloatBuffer fbuf = bbuf.asFloatBuffer();
|
||||
fbuf.put(m_data);
|
||||
fbuf.flip();
|
||||
|
||||
return fbuf;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
for (int row = 0; row < 4; row++) {
|
||||
for (int col = 0; col < 4; col++) {
|
||||
buf.append(m_data[row * 4 + col]).append(" ");
|
||||
}
|
||||
buf.append("\n");
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Data buffer.
|
||||
*/
|
||||
private final float[] m_data;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user