Merge remote-tracking branch 'github/master' into contrib
commit
bbd487308b
|
@ -2,7 +2,14 @@
|
||||||
*.cpp text eol=lf
|
*.cpp text eol=lf
|
||||||
*.h text eol=lf
|
*.h text eol=lf
|
||||||
*.c text eol=lf
|
*.c text eol=lf
|
||||||
|
*.cc text eol=lf
|
||||||
|
*.cpp text eol=lf
|
||||||
|
*.rc text eol=lf
|
||||||
*.hpp text eol=lf
|
*.hpp text eol=lf
|
||||||
*.txt text eol=lf
|
*.txt text eol=lf
|
||||||
*.cmake text eol=lf
|
*.cmake text eol=lf
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
|
CHANGES text eol=lf
|
||||||
|
CREDITS text eol=lf
|
||||||
|
LICENSE text eol=lf
|
||||||
|
Readme.md text eol=lf
|
||||||
|
|
378
CHANGES
378
CHANGES
|
@ -1,173 +1,205 @@
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
3.2.1 (2016-10-01)
|
3.3.1 (2016-07-08)
|
||||||
|
|
||||||
FEATURES:
|
FIXES/HOUSEKEEPING:
|
||||||
- Updated glTF exporter to meet 1.0 specification.
|
- Setup of default precision for 17 exporters
|
||||||
|
- Fix xcode project files
|
||||||
FIXES/HOUSEKEEPING:
|
- Fix BlenderTesselator: offsetof operator
|
||||||
- Fixed glTF Validator errors for exported glTF format.
|
- Invalid version in cmake file
|
||||||
|
- Update pstdint.h to latest greatest
|
||||||
ISSUES:
|
|
||||||
- Hard coded sampler setting for
|
|
||||||
- magFilter
|
3.3.0 (2016-07-05)
|
||||||
- minFilter
|
|
||||||
- void* in ExportData for accessor max and min.
|
FEATURES:
|
||||||
|
- C++11 support enabled
|
||||||
|
- New regression-test-UI
|
||||||
|
- Experimental glTF-importer support
|
||||||
3.2.0 (2015-11-03)
|
- OpenGEX: add support for cameras and lights
|
||||||
|
- C4D: update to latest Melange-SDK
|
||||||
FEATURES:
|
- Add a gitter channel
|
||||||
- OpenDDL-Parser is part of contrib-source.
|
- Coverity check enabled
|
||||||
- Experimental OpenGEX-support
|
- Switch to <...> include brackets for public headers
|
||||||
- CI-check for linux and windows
|
- Enable export by pyAssimp
|
||||||
- Coverity check added
|
- CI: check windows build
|
||||||
- New regression testsuite.
|
- Add functionality to perform a singlepost-processing step
|
||||||
|
- many more, just check the history
|
||||||
FIXES/HOUSEKEEPING:
|
|
||||||
- Hundreds of bugfixes in all parts of the library
|
FIXES/HOUSEKEEPING:
|
||||||
- Unified line endings
|
- Fix of many resource leaks in unittests and main lib
|
||||||
|
- Fix iOS-buildfor X64
|
||||||
|
- Choosing zlib manually for cmake
|
||||||
API COMPATIBILITY:
|
- many more, just check the history
|
||||||
- Removed precompiled header to increase build speed for linux
|
|
||||||
|
|
||||||
|
3.2.1 (2016-010-10)
|
||||||
3.1.1 (2014-06-15)
|
|
||||||
|
FEATURES:
|
||||||
FEATURES:
|
- Updated glTF exporter to meet 1.0 specification.
|
||||||
- Support for FBX 2013 and newer, binary and ASCII (this is partly
|
|
||||||
work from Google Summer of Code 2012)
|
FIXES/HOUSEKEEPING:
|
||||||
- Support for OGRE binary mesh and skeleton format
|
- Fixed glTF Validator errors for exported glTF format.
|
||||||
- Updated BLEND support for newer Blender versions
|
|
||||||
- Support for arbitrary meta data, used to hold FBX and DAE metadata
|
ISSUES:
|
||||||
- OBJ Export now produces smaller files
|
- Hard coded sampler setting for
|
||||||
- Meshes can now have names, this is supported by the major importers
|
- magFilter
|
||||||
- Improved IFC geometry generation
|
- minFilter
|
||||||
- M3 support has been removed
|
- void* in ExportData for accessor max and min.
|
||||||
|
|
||||||
FIXES/HOUSEKEEPING:
|
|
||||||
- Hundreds of bugfixes in all parts of the library
|
3.2.0 (2015-11-03)
|
||||||
- CMake is now the primary build system
|
|
||||||
|
FEATURES:
|
||||||
API COMPATIBILITY:
|
- OpenDDL-Parser is part of contrib-source.
|
||||||
- 3.1.1 is not binary compatible to 3.0 due to aiNode::mMetaData
|
- Experimental OpenGEX-support
|
||||||
and aiMesh::mName
|
- CI-check for linux and windows
|
||||||
- Export interface has been cleaned up and unified
|
- Coverity check added
|
||||||
- Other than that no relevant changes
|
- New regression testsuite.
|
||||||
|
|
||||||
|
FIXES/HOUSEKEEPING:
|
||||||
3.0 (2012-07-07)
|
- Hundreds of bugfixes in all parts of the library
|
||||||
|
- Unified line endings
|
||||||
FEATURES:
|
|
||||||
- new export interface similar to the import API.
|
|
||||||
- Supported export formats: Collada, OBJ, PLY and STL
|
API COMPATIBILITY:
|
||||||
- added new import formats: XGL/ZGL, M3 (experimental)
|
- Removed precompiled header to increase build speed for linux
|
||||||
- new postprocessing steps: Debone
|
|
||||||
- vastly improved IFC (Industry Foundation Classes) support
|
|
||||||
- introduced API to query importer meta information (such as supported
|
3.1.1 (2014-06-15)
|
||||||
format versions, full name, maintainer info).
|
|
||||||
- reworked Ogre XML import
|
FEATURES:
|
||||||
- C-API now supports per-import properties
|
- Support for FBX 2013 and newer, binary and ASCII (this is partly
|
||||||
|
work from Google Summer of Code 2012)
|
||||||
FIXES/HOUSEKEEPING:
|
- Support for OGRE binary mesh and skeleton format
|
||||||
|
- Updated BLEND support for newer Blender versions
|
||||||
- hundreds of bugfixes in all parts of the library
|
- Support for arbitrary meta data, used to hold FBX and DAE metadata
|
||||||
- unified naming and cleanup of public headers
|
- OBJ Export now produces smaller files
|
||||||
- improved CMake build system
|
- Meshes can now have names, this is supported by the major importers
|
||||||
- templatized math library
|
- Improved IFC geometry generation
|
||||||
- reduce dependency on boost.thread, only remaining spot
|
- M3 support has been removed
|
||||||
is synchronization for the C logging API
|
|
||||||
|
FIXES/HOUSEKEEPING:
|
||||||
API COMPATIBILITY:
|
- Hundreds of bugfixes in all parts of the library
|
||||||
- renamed headers, export interface, C API properties and meta data
|
- CMake is now the primary build system
|
||||||
prevent compatibility with code written for 2.0, but in
|
|
||||||
most cases these can be easily resolved
|
API COMPATIBILITY:
|
||||||
- Note: 3.0 is not binary compatible with 2.0
|
- 3.1.1 is not binary compatible to 3.0 due to aiNode::mMetaData
|
||||||
|
and aiMesh::mName
|
||||||
|
- Export interface has been cleaned up and unified
|
||||||
|
- Other than that no relevant changes
|
||||||
|
|
||||||
2.0 (2010-11-21)
|
|
||||||
|
3.0 (2012-07-07)
|
||||||
FEATURES:
|
|
||||||
- Add support for static Blender (*.blend) scenes
|
FEATURES:
|
||||||
- Add support for Q3BSP scenes
|
- new export interface similar to the import API.
|
||||||
- Add a windows-based OpenGL sample featuring texturing & basic materials
|
- Supported export formats: Collada, OBJ, PLY and STL
|
||||||
- Add an experimental progress feedback interface.
|
- added new import formats: XGL/ZGL, M3 (experimental)
|
||||||
- Vastly improved performance (up to 500%, depending on mesh size and
|
- new postprocessing steps: Debone
|
||||||
spatial structure) in some expensive postprocessing steps
|
- vastly improved IFC (Industry Foundation Classes) support
|
||||||
- AssimpView now uses a reworked layout which leaves more space
|
- introduced API to query importer meta information (such as supported
|
||||||
to the scene hierarchy window
|
format versions, full name, maintainer info).
|
||||||
|
- reworked Ogre XML import
|
||||||
- Add C# bindings ('Assimp.NET')
|
- C-API now supports per-import properties
|
||||||
- Keep BSD-licensed and otherwise free test files in separate
|
|
||||||
folders (./test/models and ./test/models-nonbsd).
|
FIXES/HOUSEKEEPING:
|
||||||
|
|
||||||
FIXES:
|
- hundreds of bugfixes in all parts of the library
|
||||||
- Many Collada bugfixes, improve fault tolerance
|
- unified naming and cleanup of public headers
|
||||||
- Fix possible crashes in the Obj loader
|
- improved CMake build system
|
||||||
- Improve the Ogre XML loader
|
- templatized math library
|
||||||
- OpenGL-sample now works with MinGW
|
- reduce dependency on boost.thread, only remaining spot
|
||||||
- Fix Importer::FindLoader failing on uppercase file extensions
|
is synchronization for the C logging API
|
||||||
- Fix flawed path handling when locating external files
|
|
||||||
- Limit the maximum number of vertices, faces, face indices and
|
API COMPATIBILITY:
|
||||||
weights that Assimp is able to handle. This is to avoid
|
- renamed headers, export interface, C API properties and meta data
|
||||||
crashes due to overflowing counters.
|
prevent compatibility with code written for 2.0, but in
|
||||||
|
most cases these can be easily resolved
|
||||||
- Updated XCode project files
|
- Note: 3.0 is not binary compatible with 2.0
|
||||||
- Further CMAKE build improvements
|
|
||||||
|
|
||||||
|
|
||||||
API CHANGES:
|
|
||||||
- Add data structures for vertex-based animations (These are not
|
2.0 (2010-11-21)
|
||||||
currently used, however ...)
|
|
||||||
- Some Assimp::Importer methods are const now.
|
FEATURES:
|
||||||
|
- Add support for static Blender (*.blend) scenes
|
||||||
|
- Add support for Q3BSP scenes
|
||||||
|
- Add a windows-based OpenGL sample featuring texturing & basic materials
|
||||||
|
- Add an experimental progress feedback interface.
|
||||||
|
- Vastly improved performance (up to 500%, depending on mesh size and
|
||||||
1.1 (2010-04-17)
|
spatial structure) in some expensive postprocessing steps
|
||||||
This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700).
|
- AssimpView now uses a reworked layout which leaves more space
|
||||||
|
to the scene hierarchy window
|
||||||
FEATURES:
|
|
||||||
- Vastly improved Collada support
|
- Add C# bindings ('Assimp.NET')
|
||||||
- Add MS3D (Milkshape 3D) support
|
- Keep BSD-licensed and otherwise free test files in separate
|
||||||
- Add support for Ogre XML static meshes
|
folders (./test/models and ./test/models-nonbsd).
|
||||||
- Add experimental COB (TrueSpace) support
|
|
||||||
- Automatic test suite to quickly locate regressions
|
FIXES:
|
||||||
- D bindings (`dAssimp`)
|
- Many Collada bugfixes, improve fault tolerance
|
||||||
- Python 2.n bindings (`PyAssimp`)
|
- Fix possible crashes in the Obj loader
|
||||||
- Add basic support for Unicode input files (utf8, utf16 and utf32)
|
- Improve the Ogre XML loader
|
||||||
- Add further utilities to the `assimp` tool (xml/binary dumps, quick file stats)
|
- OpenGL-sample now works with MinGW
|
||||||
- Switch to a CMAKE-based build system including an install target for unix'es
|
- Fix Importer::FindLoader failing on uppercase file extensions
|
||||||
- Automatic evaluation of subdivision surfaces for some formats.
|
- Fix flawed path handling when locating external files
|
||||||
- Add `Importer::ReadFileFromMemory` and the corresponding C-API `aiReadFileFromMemory`
|
- Limit the maximum number of vertices, faces, face indices and
|
||||||
- Expose further math utilities via the C-API (i.e. `aiMultiplyMatrix4`)
|
weights that Assimp is able to handle. This is to avoid
|
||||||
|
crashes due to overflowing counters.
|
||||||
- Move noboost files away from the public include directory
|
|
||||||
- Many, many bugfixes and improvements in existing loaders and postprocessing steps
|
- Updated XCode project files
|
||||||
- Documentation improved and clarified in many places.
|
- Further CMAKE build improvements
|
||||||
- Add a sample on using Assimp in conjunction with OpenGL
|
|
||||||
|
|
||||||
- Distribution/packaging: comfortable SDK installer for Windows
|
API CHANGES:
|
||||||
- Distribution/packaging: improved release packages for other architectures
|
- Add data structures for vertex-based animations (These are not
|
||||||
|
currently used, however ...)
|
||||||
CRITICAL FIXES:
|
- Some Assimp::Importer methods are const now.
|
||||||
- Resolve problems with clashing heap managers, STL ABIs and runtime libraries (win32)
|
|
||||||
- Fix automatic detection of file type if no file extension is given
|
|
||||||
- Improved exception safety and robustness, prevent leaking of exceptions through the C interface
|
|
||||||
- Fix possible heap corruption due to material properties pulled in incorrectly
|
|
||||||
- Avoid leaking in certain error scenarios
|
|
||||||
- Fix 64 bit compatibility problems in some loaders (i.e. MDL)
|
1.1 (2010-04-17)
|
||||||
|
This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700).
|
||||||
BREAKING API CHANGES:
|
|
||||||
- None -
|
FEATURES:
|
||||||
|
- Vastly improved Collada support
|
||||||
MINOR API BEHAVIOUR CHANGES:
|
- Add MS3D (Milkshape 3D) support
|
||||||
- Change quaternion orientation to suit to the more common convention (-w).
|
- Add support for Ogre XML static meshes
|
||||||
- aiString is utf8 now. Not yet consistent, however.
|
- Add experimental COB (TrueSpace) support
|
||||||
|
- Automatic test suite to quickly locate regressions
|
||||||
|
- D bindings (`dAssimp`)
|
||||||
|
- Python 2.n bindings (`PyAssimp`)
|
||||||
|
- Add basic support for Unicode input files (utf8, utf16 and utf32)
|
||||||
|
- Add further utilities to the `assimp` tool (xml/binary dumps, quick file stats)
|
||||||
|
- Switch to a CMAKE-based build system including an install target for unix'es
|
||||||
|
- Automatic evaluation of subdivision surfaces for some formats.
|
||||||
|
- Add `Importer::ReadFileFromMemory` and the corresponding C-API `aiReadFileFromMemory`
|
||||||
|
- Expose further math utilities via the C-API (i.e. `aiMultiplyMatrix4`)
|
||||||
|
|
||||||
|
- Move noboost files away from the public include directory
|
||||||
|
- Many, many bugfixes and improvements in existing loaders and postprocessing steps
|
||||||
|
- Documentation improved and clarified in many places.
|
||||||
|
- Add a sample on using Assimp in conjunction with OpenGL
|
||||||
|
|
||||||
|
- Distribution/packaging: comfortable SDK installer for Windows
|
||||||
|
- Distribution/packaging: improved release packages for other architectures
|
||||||
|
|
||||||
|
CRITICAL FIXES:
|
||||||
|
- Resolve problems with clashing heap managers, STL ABIs and runtime libraries (win32)
|
||||||
|
- Fix automatic detection of file type if no file extension is given
|
||||||
|
- Improved exception safety and robustness, prevent leaking of exceptions through the C interface
|
||||||
|
- Fix possible heap corruption due to material properties pulled in incorrectly
|
||||||
|
- Avoid leaking in certain error scenarios
|
||||||
|
- Fix 64 bit compatibility problems in some loaders (i.e. MDL)
|
||||||
|
|
||||||
|
BREAKING API CHANGES:
|
||||||
|
- None -
|
||||||
|
|
||||||
|
MINOR API BEHAVIOUR CHANGES:
|
||||||
|
- Change quaternion orientation to suit to the more common convention (-w).
|
||||||
|
- aiString is utf8 now. Not yet consistent, however.
|
||||||
|
|
|
@ -185,9 +185,9 @@ if (ASSIMP_COVERALLS)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
INCLUDE (FindPkgConfig)
|
|
||||||
INCLUDE_DIRECTORIES( include )
|
INCLUDE_DIRECTORIES( include )
|
||||||
|
|
||||||
|
INCLUDE (FindPkgMacros)
|
||||||
INCLUDE (PrecompiledHeader)
|
INCLUDE (PrecompiledHeader)
|
||||||
|
|
||||||
# If this is an in-source build (CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR),
|
# If this is an in-source build (CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR),
|
||||||
|
@ -255,9 +255,7 @@ ENDIF(NOT ZLIB_FOUND)
|
||||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
# Search for unzip
|
# Search for unzip
|
||||||
IF (PKG_CONFIG_FOUND)
|
use_pkgconfig(UNZIP minizip)
|
||||||
PKG_CHECK_MODULES(UNZIP minizip)
|
|
||||||
ENDIF (PKG_CONFIG_FOUND)
|
|
||||||
|
|
||||||
IF ( ASSIMP_NO_EXPORT )
|
IF ( ASSIMP_NO_EXPORT )
|
||||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
|
||||||
|
|
320
CREDITS
320
CREDITS
|
@ -1,160 +1,160 @@
|
||||||
===============================================================
|
===============================================================
|
||||||
Open Asset Import Library (Assimp)
|
Open Asset Import Library (Assimp)
|
||||||
Developers and Contributors
|
Developers and Contributors
|
||||||
===============================================================
|
===============================================================
|
||||||
|
|
||||||
The following is a non-exhaustive list of all constributors over the years.
|
The following is a non-exhaustive list of all constributors over the years.
|
||||||
If you think your name should be listed here, drop us a line and we'll add you.
|
If you think your name should be listed here, drop us a line and we'll add you.
|
||||||
|
|
||||||
- Alexander Gessler,
|
- Alexander Gessler,
|
||||||
3DS-, BLEND-, ASE-, DXF-, HMP-, MDL-, MD2-, MD3-, MD5-, MDC-, NFF-, PLY-, STL-, RAW-, OFF-, MS3D-, Q3D- and LWO-Loader, Assimp-Viewer, assimp-cmd, -noboost, Website (Design).
|
3DS-, BLEND-, ASE-, DXF-, HMP-, MDL-, MD2-, MD3-, MD5-, MDC-, NFF-, PLY-, STL-, RAW-, OFF-, MS3D-, Q3D- and LWO-Loader, Assimp-Viewer, assimp-cmd, -noboost, Website (Design).
|
||||||
|
|
||||||
- Thomas Schulze,
|
- Thomas Schulze,
|
||||||
X-, Collada-, BVH-Loader, Postprocessing framework. Data structure & Interface design, documentation.
|
X-, Collada-, BVH-Loader, Postprocessing framework. Data structure & Interface design, documentation.
|
||||||
|
|
||||||
- Kim Kulling,
|
- Kim Kulling,
|
||||||
Obj-, Q3BSD-, OpenGEX-Loader, Logging system, CMake-build-environment, Linux-build, Website ( Admin ), Coverity ( Admin ), Glitter ( Admin ).
|
Obj-, Q3BSD-, OpenGEX-Loader, Logging system, CMake-build-environment, Linux-build, Website ( Admin ), Coverity ( Admin ), Glitter ( Admin ).
|
||||||
|
|
||||||
- R.Schmidt,
|
- R.Schmidt,
|
||||||
Linux build, eclipse support.
|
Linux build, eclipse support.
|
||||||
|
|
||||||
- Matthias Gubisch,
|
- Matthias Gubisch,
|
||||||
Assimp.net
|
Assimp.net
|
||||||
Visual Studio 9 support, bugfixes.
|
Visual Studio 9 support, bugfixes.
|
||||||
|
|
||||||
- Mark Sibly
|
- Mark Sibly
|
||||||
B3D-Loader, Assimp testing
|
B3D-Loader, Assimp testing
|
||||||
|
|
||||||
- Jonathan Klein
|
- Jonathan Klein
|
||||||
Ogre Loader, VC2010 fixes and CMake fixes.
|
Ogre Loader, VC2010 fixes and CMake fixes.
|
||||||
|
|
||||||
- Sebastian Hempel,
|
- Sebastian Hempel,
|
||||||
PyAssimp (first version)
|
PyAssimp (first version)
|
||||||
Compile-Bugfixes for mingw, add environment for static library support in make.
|
Compile-Bugfixes for mingw, add environment for static library support in make.
|
||||||
|
|
||||||
- Jonathan Pokrass
|
- Jonathan Pokrass
|
||||||
Supplied a bugfix concerning the scaling in the md3 loader.
|
Supplied a bugfix concerning the scaling in the md3 loader.
|
||||||
|
|
||||||
- Andrew Galante,
|
- Andrew Galante,
|
||||||
Submitted patches to make Assimp compile with GCC-4, a makefile and the xcode3 workspace.
|
Submitted patches to make Assimp compile with GCC-4, a makefile and the xcode3 workspace.
|
||||||
|
|
||||||
- Andreas Nagel
|
- Andreas Nagel
|
||||||
First Assimp testing & verification under Windows Vista 64 Bit.
|
First Assimp testing & verification under Windows Vista 64 Bit.
|
||||||
|
|
||||||
- Marius Schr<68>der
|
- Marius Schr<68>der
|
||||||
Allowed us to use many of his models for screenshots and testing.
|
Allowed us to use many of his models for screenshots and testing.
|
||||||
|
|
||||||
- Christian Schubert
|
- Christian Schubert
|
||||||
Supplied various XFiles for testing purposes.
|
Supplied various XFiles for testing purposes.
|
||||||
|
|
||||||
- Tizian Wieland
|
- Tizian Wieland
|
||||||
Searched the web for hundreds of test models for internal use
|
Searched the web for hundreds of test models for internal use
|
||||||
|
|
||||||
- John Connors
|
- John Connors
|
||||||
Supplied patches for linux and SCons.
|
Supplied patches for linux and SCons.
|
||||||
|
|
||||||
- T. R.
|
- T. R.
|
||||||
The GUY who performed some of the CSM mocaps.
|
The GUY who performed some of the CSM mocaps.
|
||||||
|
|
||||||
- Andy Maloney
|
- Andy Maloney
|
||||||
Contributed fixes for the documentation and the doxygen markup
|
Contributed fixes for the documentation and the doxygen markup
|
||||||
|
|
||||||
- Zhao Lei
|
- Zhao Lei
|
||||||
Contributed several bugfixes fixing memory leaks and improving float parsing
|
Contributed several bugfixes fixing memory leaks and improving float parsing
|
||||||
|
|
||||||
- sueastside
|
- sueastside
|
||||||
Updated PyAssimp to the latest Assimp data structures and provided a script to keep the Python binding up-to-date.
|
Updated PyAssimp to the latest Assimp data structures and provided a script to keep the Python binding up-to-date.
|
||||||
|
|
||||||
- Tobias Rittig
|
- Tobias Rittig
|
||||||
Collada testing with Cinema 4D
|
Collada testing with Cinema 4D
|
||||||
|
|
||||||
- Brad Grantham
|
- Brad Grantham
|
||||||
Improvements in OpenGL-Sample.
|
Improvements in OpenGL-Sample.
|
||||||
|
|
||||||
- Robert Ramirez
|
- Robert Ramirez
|
||||||
Add group loading feature to Obj-Loader.
|
Add group loading feature to Obj-Loader.
|
||||||
|
|
||||||
- Chris Maiwald
|
- Chris Maiwald
|
||||||
Many bugreports, improving Assimp's portability, regular testing & feedback.
|
Many bugreports, improving Assimp's portability, regular testing & feedback.
|
||||||
|
|
||||||
- Stepan Hrbek
|
- Stepan Hrbek
|
||||||
Bugreport and fix for a obj-materialloader crash.
|
Bugreport and fix for a obj-materialloader crash.
|
||||||
|
|
||||||
- David Nadlinger
|
- David Nadlinger
|
||||||
D bindings, CMake install support.
|
D bindings, CMake install support.
|
||||||
|
|
||||||
- Dario Accornero
|
- Dario Accornero
|
||||||
Contributed several patches regarding Mac OS/XCode targets, bug reports.
|
Contributed several patches regarding Mac OS/XCode targets, bug reports.
|
||||||
|
|
||||||
- Martin Walser (Samhayne)
|
- Martin Walser (Samhayne)
|
||||||
Contributed the 'SimpleTexturedOpenGl' sample.
|
Contributed the 'SimpleTexturedOpenGl' sample.
|
||||||
|
|
||||||
- Matthias Fauconneau
|
- Matthias Fauconneau
|
||||||
Contributed a fix for the Q3-BSP loader.
|
Contributed a fix for the Q3-BSP loader.
|
||||||
|
|
||||||
- J<EFBFBD>rgen P. Tjern<72>
|
- Jørgen P. Tjernø
|
||||||
Contributed updated and improved xcode workspaces
|
Contributed updated and improved xcode workspaces
|
||||||
|
|
||||||
- drparallax
|
- drparallax
|
||||||
Contributed the /samples/SimpleAssimpViewX sample
|
Contributed the /samples/SimpleAssimpViewX sample
|
||||||
|
|
||||||
- Carsten Fuchs
|
- Carsten Fuchs
|
||||||
Contributed a fix for the Normalize method in aiQuaternion.
|
Contributed a fix for the Normalize method in aiQuaternion.
|
||||||
|
|
||||||
- dbburgess
|
- dbburgess
|
||||||
Contributes a Android-specific build issue: log the hardware architecture for ARM.
|
Contributes a Android-specific build issue: log the hardware architecture for ARM.
|
||||||
|
|
||||||
- alfiereinre7
|
- alfiereinre7
|
||||||
Contributes a obj-fileparser fix: missing tokens in the obj-token list.
|
Contributes a obj-fileparser fix: missing tokens in the obj-token list.
|
||||||
|
|
||||||
- Roman Kharitonov
|
- Roman Kharitonov
|
||||||
Contributes a fix for the configure script environment.
|
Contributes a fix for the configure script environment.
|
||||||
|
|
||||||
- Ed Diana
|
- Ed Diana
|
||||||
Contributed AssimpDelphi (/port/AssimpDelphi).
|
Contributed AssimpDelphi (/port/AssimpDelphi).
|
||||||
|
|
||||||
- rdb
|
- rdb
|
||||||
Contributes a bundle of fixes and improvements for the bsp-importer.
|
Contributes a bundle of fixes and improvements for the bsp-importer.
|
||||||
|
|
||||||
- Mick P
|
- Mick P
|
||||||
For contributing the De-bone postprocessing step and filing various bug reports.
|
For contributing the De-bone postprocessing step and filing various bug reports.
|
||||||
|
|
||||||
- Rosen Diankov
|
- Rosen Diankov
|
||||||
Contributed patches to build assimp debian packages using cmake.
|
Contributed patches to build assimp debian packages using cmake.
|
||||||
|
|
||||||
- Mark Page
|
- Mark Page
|
||||||
Contributed a patch to fix the VertexTriangleAdjacency postprocessing step.
|
Contributed a patch to fix the VertexTriangleAdjacency postprocessing step.
|
||||||
|
|
||||||
- IOhannes
|
- IOhannes
|
||||||
Contributed the Debian build fixes ( architecture macro ).
|
Contributed the Debian build fixes ( architecture macro ).
|
||||||
|
|
||||||
- gellule
|
- gellule
|
||||||
Several LWO and LWS fixes (pivoting).
|
Several LWO and LWS fixes (pivoting).
|
||||||
|
|
||||||
- Marcel Metz
|
- Marcel Metz
|
||||||
GCC/Linux fixes for the SimpleOpenGL sample.
|
GCC/Linux fixes for the SimpleOpenGL sample.
|
||||||
|
|
||||||
- Brian Miller
|
- Brian Miller
|
||||||
Bugfix for a compiler fix for iOS on arm.
|
Bugfix for a compiler fix for iOS on arm.
|
||||||
|
|
||||||
- S<EFBFBD>verin Lemaignan
|
- SĂ©verin Lemaignan
|
||||||
Rewrite of PyAssimp, distutils and Python3 support
|
Rewrite of PyAssimp, distutils and Python3 support
|
||||||
|
|
||||||
- albert-wang
|
- albert-wang
|
||||||
Bugfixes for the collada parser
|
Bugfixes for the collada parser
|
||||||
|
|
||||||
- Ya ping Jin
|
- Ya ping Jin
|
||||||
Bugfixes for uv-tanget calculation.
|
Bugfixes for uv-tanget calculation.
|
||||||
|
|
||||||
- Jonne Nauha
|
- Jonne Nauha
|
||||||
Ogre Binary format support
|
Ogre Binary format support
|
||||||
|
|
||||||
- Filip Wasil, Tieto Poland Sp. z o.o.
|
- Filip Wasil, Tieto Poland Sp. z o.o.
|
||||||
Android JNI asset extraction support
|
Android JNI asset extraction support
|
||||||
|
|
||||||
- Richard Steffen
|
- Richard Steffen
|
||||||
Contributed ExportProperties interface
|
Contributed ExportProperties interface
|
||||||
Contributed X File exporter
|
Contributed X File exporter
|
||||||
Contributed Step (stp) exporter
|
Contributed Step (stp) exporter
|
||||||
|
|
||||||
|
|
||||||
|
|
156
LICENSE
156
LICENSE
|
@ -1,78 +1,78 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2016, assimp team
|
Copyright (c) 2006-2016, assimp team
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
with or without modification, are permitted provided that the
|
with or without modification, are permitted provided that the
|
||||||
following conditions are met:
|
following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
* Redistributions of source code must retain the above
|
||||||
copyright notice, this list of conditions and the
|
copyright notice, this list of conditions and the
|
||||||
following disclaimer.
|
following disclaimer.
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
* Redistributions in binary form must reproduce the above
|
||||||
copyright notice, this list of conditions and the
|
copyright notice, this list of conditions and the
|
||||||
following disclaimer in the documentation and/or other
|
following disclaimer in the documentation and/or other
|
||||||
materials provided with the distribution.
|
materials provided with the distribution.
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
* Neither the name of the assimp team, nor the names of its
|
||||||
contributors may be used to endorse or promote products
|
contributors may be used to endorse or promote products
|
||||||
derived from this software without specific prior
|
derived from this software without specific prior
|
||||||
written permission of the assimp team.
|
written permission of the assimp team.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
|
|
||||||
AN EXCEPTION applies to all files in the ./test/models-nonbsd folder.
|
AN EXCEPTION applies to all files in the ./test/models-nonbsd folder.
|
||||||
These are 3d models for testing purposes, from various free sources
|
These are 3d models for testing purposes, from various free sources
|
||||||
on the internet. They are - unless otherwise stated - copyright of
|
on the internet. They are - unless otherwise stated - copyright of
|
||||||
their respective creators, which may impose additional requirements
|
their respective creators, which may impose additional requirements
|
||||||
on the use of their work. For any of these models, see
|
on the use of their work. For any of these models, see
|
||||||
<model-name>.source.txt for more legal information. Contact us if you
|
<model-name>.source.txt for more legal information. Contact us if you
|
||||||
are a copyright holder and believe that we credited you inproperly or
|
are a copyright holder and believe that we credited you inproperly or
|
||||||
if you don't want your files to appear in the repository.
|
if you don't want your files to appear in the repository.
|
||||||
|
|
||||||
|
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
|
|
||||||
Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
|
Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
|
||||||
http://code.google.com/p/poly2tri/
|
http://code.google.com/p/poly2tri/
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of Poly2Tri nor the names of its contributors may be
|
* Neither the name of Poly2Tri nor the names of its contributors may be
|
||||||
used to endorse or promote products derived from this software without specific
|
used to endorse or promote products derived from this software without specific
|
||||||
prior written permission.
|
prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
289
Readme.md
289
Readme.md
|
@ -1,142 +1,147 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
[](https://travis-ci.org/assimp/assimp)
|
[](https://travis-ci.org/assimp/assimp)
|
||||||
[](https://ci.appveyor.com/project/kimkulling/assimp)
|
[](https://ci.appveyor.com/project/kimkulling/assimp)
|
||||||
<a href="https://scan.coverity.com/projects/5607">
|
<a href="https://scan.coverity.com/projects/5607">
|
||||||
<img alt="Coverity Scan Build Status"
|
<img alt="Coverity Scan Build Status"
|
||||||
src="https://scan.coverity.com/projects/5607/badge.svg"/>
|
src="https://scan.coverity.com/projects/5607/badge.svg"/>
|
||||||
</a>
|
</a>
|
||||||
[](https://coveralls.io/github/assimp/assimp?branch=master)
|
[](https://coveralls.io/github/assimp/assimp?branch=master)
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
|
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
|
||||||
|
|
||||||
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
|
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
|
||||||
|
|
||||||
This is the development trunk containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [assimp.sf.net](http://assimp.sf.net) or from *nix package repositories.
|
This is the development trunk containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [assimp.sf.net](http://assimp.sf.net) or from *nix package repositories.
|
||||||
The current build status is:
|
The current build status is:
|
||||||
|
|
||||||
Gitter chat: [](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
|
Gitter chat: [](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
|
||||||
__[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.__
|
And we also have an IRC-channel at freenode: #assetimporterlib . You can easily join us via: [KiwiIRC/freenote](https://kiwiirc.com/client/irc.freenode.net), choose your nickname and type
|
||||||
|
> /join #assetimporterlib
|
||||||
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
|
|
||||||
|
<br>
|
||||||
#### Supported file formats ####
|
__[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.__
|
||||||
|
|
||||||
A full list [is here](http://assimp.org/main_features_formats.html).
|
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
|
||||||
__Importers__:
|
|
||||||
|
#### Supported file formats ####
|
||||||
- 3DS
|
|
||||||
- BLEND (Blender)
|
A full list [is here](http://assimp.org/main_features_formats.html).
|
||||||
- DAE/Collada
|
__Importers__:
|
||||||
- FBX
|
|
||||||
- IFC-STEP
|
- 3DS
|
||||||
- ASE
|
- BLEND (Blender)
|
||||||
- DXF
|
- DAE/Collada
|
||||||
- HMP
|
- FBX
|
||||||
- MD2
|
- IFC-STEP
|
||||||
- MD3
|
- ASE
|
||||||
- MD5
|
- DXF
|
||||||
- MDC
|
- HMP
|
||||||
- MDL
|
- MD2
|
||||||
- NFF
|
- MD3
|
||||||
- PLY
|
- MD5
|
||||||
- STL
|
- MDC
|
||||||
- X
|
- MDL
|
||||||
- OBJ
|
- NFF
|
||||||
- OpenGEX
|
- PLY
|
||||||
- SMD
|
- STL
|
||||||
- LWO
|
- X
|
||||||
- LXO
|
- OBJ
|
||||||
- LWS
|
- OpenGEX
|
||||||
- TER
|
- SMD
|
||||||
- AC3D
|
- LWO
|
||||||
- MS3D
|
- LXO
|
||||||
- COB
|
- LWS
|
||||||
- Q3BSP
|
- TER
|
||||||
- XGL
|
- AC3D
|
||||||
- CSM
|
- MS3D
|
||||||
- BVH
|
- COB
|
||||||
- B3D
|
- Q3BSP
|
||||||
- NDO
|
- XGL
|
||||||
- Ogre Binary
|
- CSM
|
||||||
- Ogre XML
|
- BVH
|
||||||
- Q3D
|
- B3D
|
||||||
- ASSBIN (Assimp custom format)
|
- NDO
|
||||||
- glTF (partial)
|
- Ogre Binary
|
||||||
- 3MF
|
- Ogre XML
|
||||||
|
- Q3D
|
||||||
Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default):
|
- ASSBIN (Assimp custom format)
|
||||||
|
- glTF (partial)
|
||||||
- C4D (https://github.com/acgessler/assimp-cinema4d)
|
- 3MF
|
||||||
|
|
||||||
__Exporters__:
|
Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default):
|
||||||
|
|
||||||
- DAE (Collada)
|
- C4D (https://github.com/acgessler/assimp-cinema4d)
|
||||||
- STL
|
|
||||||
- OBJ
|
__Exporters__:
|
||||||
- PLY
|
|
||||||
- X
|
- DAE (Collada)
|
||||||
- 3DS
|
- STL
|
||||||
- JSON (for WebGl, via https://github.com/acgessler/assimp2json)
|
- OBJ
|
||||||
- ASSBIN
|
- PLY
|
||||||
- STEP
|
- X
|
||||||
- glTF (partial)
|
- 3DS
|
||||||
|
- JSON (for WebGl, via https://github.com/acgessler/assimp2json)
|
||||||
### Building ###
|
- ASSBIN
|
||||||
Take a look into the `INSTALL` file. Our build system is CMake, if you used CMake before there is a good chance you know what to do.
|
- STEP
|
||||||
|
- glTF (partial)
|
||||||
### Ports ###
|
|
||||||
* [Android](port/AndroidJNI/README.md)
|
### Building ###
|
||||||
* [Python](port/PyAssimp/README.md)
|
Take a look into the `INSTALL` file. Our build system is CMake, if you used CMake before there is a good chance you know what to do.
|
||||||
* [.NET](port/AssimpNET/Readme.md)
|
|
||||||
* [Pascal](port/AssimpPascal/Readme.md)
|
### Ports ###
|
||||||
|
* [Android](port/AndroidJNI/README.md)
|
||||||
#### Repository structure ####
|
* [Python](port/PyAssimp/README.md)
|
||||||
Open Asset Import Library is implemented in C++. The directory structure is:
|
* [.NET](port/AssimpNET/Readme.md)
|
||||||
|
* [Pascal](port/AssimpPascal/Readme.md)
|
||||||
/code Source code
|
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
||||||
/contrib Third-party libraries
|
|
||||||
/doc Documentation (doxysource and pre-compiled docs)
|
#### Repository structure ####
|
||||||
/include Public header C and C++ header files
|
Open Asset Import Library is implemented in C++. The directory structure is:
|
||||||
/scripts Scripts used to generate the loading code for some formats
|
|
||||||
/port Ports to other languages and scripts to maintain those.
|
/code Source code
|
||||||
/test Unit- and regression tests, test suite of models
|
/contrib Third-party libraries
|
||||||
/tools Tools (old assimp viewer, command line `assimp`)
|
/doc Documentation (doxysource and pre-compiled docs)
|
||||||
/samples A small number of samples to illustrate possible
|
/include Public header C and C++ header files
|
||||||
use cases for Assimp
|
/scripts Scripts used to generate the loading code for some formats
|
||||||
/workspaces Build environments for vc,xcode,... (deprecated,
|
/port Ports to other languages and scripts to maintain those.
|
||||||
CMake has superseeded all legacy build options!)
|
/test Unit- and regression tests, test suite of models
|
||||||
|
/tools Tools (old assimp viewer, command line `assimp`)
|
||||||
|
/samples A small number of samples to illustrate possible
|
||||||
### Where to get help ###
|
use cases for Assimp
|
||||||
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
|
/workspaces Build environments for vc,xcode,... (deprecated,
|
||||||
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
|
CMake has superseeded all legacy build options!)
|
||||||
|
|
||||||
If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
|
|
||||||
|
### Where to get help ###
|
||||||
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
|
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
|
||||||
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
|
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
|
||||||
|
|
||||||
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
|
If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
|
||||||
|
|
||||||
And we also have a Gitter-channel:Gitter [](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
|
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
|
||||||
|
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
|
||||||
### Contributing ###
|
|
||||||
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
|
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
|
||||||
a pull request with your changes against the main repository's `master` branch.
|
|
||||||
|
And we also have a Gitter-channel:Gitter [](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
|
||||||
### Donate ###
|
|
||||||
If you like assimp, consider buying us a beer (or two):
|
### Contributing ###
|
||||||
[Donate](http://sourceforge.net/donate/index.php?group_id=226462)
|
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
|
||||||
|
a pull request with your changes against the main repository's `master` branch.
|
||||||
### License ###
|
|
||||||
Our license is based on the modified, __3-clause BSD__-License.
|
### Donate ###
|
||||||
|
If you like assimp, consider buying us a beer (or two):
|
||||||
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
|
[Donate](http://sourceforge.net/donate/index.php?group_id=226462)
|
||||||
and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you may link statically to Assimp.
|
|
||||||
For the legal details, see the `LICENSE` file.
|
### License ###
|
||||||
|
Our license is based on the modified, __3-clause BSD__-License.
|
||||||
### Why this name ###
|
|
||||||
Sorry, we're germans :-), no english native speakers ...
|
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
|
||||||
|
and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you may link statically to Assimp.
|
||||||
|
For the legal details, see the `LICENSE` file.
|
||||||
|
|
||||||
|
### Why this name ###
|
||||||
|
Sorry, we're germans :-), no english native speakers ...
|
||||||
|
|
|
@ -59,10 +59,13 @@ endmacro(clear_if_changed)
|
||||||
|
|
||||||
# Try to get some hints from pkg-config, if available
|
# Try to get some hints from pkg-config, if available
|
||||||
macro(use_pkgconfig PREFIX PKGNAME)
|
macro(use_pkgconfig PREFIX PKGNAME)
|
||||||
find_package(PkgConfig)
|
# Android does not support PKG_CONFIG so we disable it
|
||||||
if (PKG_CONFIG_FOUND)
|
IF ( NOT ANDROID )
|
||||||
pkg_check_modules(${PREFIX} ${PKGNAME})
|
find_package(PkgConfig)
|
||||||
endif ()
|
if (PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(${PREFIX} ${PKGNAME})
|
||||||
|
endif ()
|
||||||
|
ENDIF ( NOT ANDROID )
|
||||||
endmacro (use_pkgconfig)
|
endmacro (use_pkgconfig)
|
||||||
|
|
||||||
# Couple a set of release AND debug libraries (or frameworks)
|
# Couple a set of release AND debug libraries (or frameworks)
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Once done, this will define
|
# Once done, this will define
|
||||||
#
|
#
|
||||||
# ZLIB_FOUND - system has ZLIB
|
# ZLIB_FOUND - system has ZLIB
|
||||||
# ZLIB_INCLUDE_DIRS - the ZLIB include directories
|
# ZLIB_INCLUDE_DIRS - the ZLIB include directories
|
||||||
# ZLIB_LIBRARIES - link these to use ZLIB
|
# ZLIB_LIBRARIES - link these to use ZLIB
|
||||||
|
|
||||||
include(FindPkgMacros)
|
include(FindPkgMacros)
|
||||||
|
|
|
@ -261,11 +261,20 @@ std::string TextureConverted_ID;
|
||||||
size_t off_b = 0;
|
size_t off_b = 0;
|
||||||
|
|
||||||
// Calculate size of the target array and rule how data will be copied.
|
// Calculate size of the target array and rule how data will be copied.
|
||||||
if(!pID_R.empty()) { tex_size += src_texture[0]->Data.size(); step++, off_g++, off_b++; }
|
if ( nullptr != src_texture ) {
|
||||||
if(!pID_G.empty()) { tex_size += src_texture[1]->Data.size(); step++, off_b++; }
|
if(!pID_R.empty()) {
|
||||||
if(!pID_B.empty()) { tex_size += src_texture[2]->Data.size(); step++; }
|
tex_size += src_texture[0]->Data.size(); step++, off_g++, off_b++;
|
||||||
if(!pID_A.empty()) { tex_size += src_texture[3]->Data.size(); step++; }
|
}
|
||||||
|
if(!pID_G.empty()) {
|
||||||
|
tex_size += src_texture[1]->Data.size(); step++, off_b++;
|
||||||
|
}
|
||||||
|
if(!pID_B.empty()) {
|
||||||
|
tex_size += src_texture[2]->Data.size(); step++;
|
||||||
|
}
|
||||||
|
if(!pID_A.empty()) {
|
||||||
|
tex_size += src_texture[3]->Data.size(); step++;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Create target array.
|
// Create target array.
|
||||||
converted_texture.Data = new uint8_t[tex_size];
|
converted_texture.Data = new uint8_t[tex_size];
|
||||||
// And copy data
|
// And copy data
|
||||||
|
|
|
@ -1858,7 +1858,7 @@ void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh& mesh)
|
||||||
++filePtr;
|
++filePtr;
|
||||||
|
|
||||||
// Face entry
|
// Face entry
|
||||||
if (TokenMatch(filePtr,"MESH_CFACE" ,11))
|
if (TokenMatch(filePtr,"MESH_CFACE" ,10))
|
||||||
{
|
{
|
||||||
unsigned int aiValues[3];
|
unsigned int aiValues[3];
|
||||||
unsigned int iIndex = 0;
|
unsigned int iIndex = 0;
|
||||||
|
|
|
@ -96,8 +96,9 @@ static const aiImporterDesc blenderDesc = {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
BlenderImporter::BlenderImporter()
|
BlenderImporter::BlenderImporter()
|
||||||
: modifier_cache(new BlenderModifierShowcase())
|
: modifier_cache(new BlenderModifierShowcase()) {
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Destructor, private as well
|
// Destructor, private as well
|
||||||
|
@ -145,8 +146,7 @@ void BlenderImporter::SetupProperties(const Importer* /*pImp*/)
|
||||||
// nothing to be done for the moment
|
// nothing to be done for the moment
|
||||||
}
|
}
|
||||||
|
|
||||||
struct free_it
|
struct free_it {
|
||||||
{
|
|
||||||
free_it(void* free) : free(free) {}
|
free_it(void* free) : free(free) {}
|
||||||
~free_it() {
|
~free_it() {
|
||||||
::free(this->free);
|
::free(this->free);
|
||||||
|
@ -165,6 +165,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
|
||||||
free_it free_it_really(dest);
|
free_it free_it_really(dest);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
FileDatabase file;
|
FileDatabase file;
|
||||||
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
|
|
@ -522,7 +522,7 @@ template <> void Structure :: Convert<MVert> (
|
||||||
ReadFieldArray<ErrorPolicy_Fail>(dest.co,"co",db);
|
ReadFieldArray<ErrorPolicy_Fail>(dest.co,"co",db);
|
||||||
ReadFieldArray<ErrorPolicy_Fail>(dest.no,"no",db);
|
ReadFieldArray<ErrorPolicy_Fail>(dest.no,"no",db);
|
||||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||||
ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db);
|
//ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db);
|
||||||
ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
|
ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
|
||||||
|
|
||||||
db.reader->IncPtr(size);
|
db.reader->IncPtr(size);
|
||||||
|
|
|
@ -163,6 +163,7 @@ SET( Common_SRCS
|
||||||
RemoveComments.h
|
RemoveComments.h
|
||||||
Subdivision.cpp
|
Subdivision.cpp
|
||||||
Subdivision.h
|
Subdivision.h
|
||||||
|
scene.cpp
|
||||||
Vertex.h
|
Vertex.h
|
||||||
LineSplitter.h
|
LineSplitter.h
|
||||||
TinyFormatter.h
|
TinyFormatter.h
|
||||||
|
@ -173,6 +174,8 @@ SET( Common_SRCS
|
||||||
XMLTools.h
|
XMLTools.h
|
||||||
Version.cpp
|
Version.cpp
|
||||||
IOStreamBuffer.h
|
IOStreamBuffer.h
|
||||||
|
CreateAnimMesh.h
|
||||||
|
CreateAnimMesh.cpp
|
||||||
)
|
)
|
||||||
SOURCE_GROUP(Common FILES ${Common_SRCS})
|
SOURCE_GROUP(Common FILES ${Common_SRCS})
|
||||||
|
|
||||||
|
@ -184,10 +187,16 @@ IF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
|
||||||
SOURCE_GROUP( C4D FILES ${C4D_SRCS})
|
SOURCE_GROUP( C4D FILES ${C4D_SRCS})
|
||||||
ENDIF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
|
ENDIF ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER )
|
||||||
|
|
||||||
|
# if this variable is set to TRUE, the user can manually disable importers by setting
|
||||||
|
# ASSIMP_BUILD_XXX_IMPORTER to FALSE for each importer
|
||||||
|
# if this variable is set to FALSE, the user can manually enable importers by setting
|
||||||
|
# ASSIMP_BUILD_XXX_IMPORTER to TRUE for each importer
|
||||||
|
OPTION(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT "default value of all ASSIMP_BUILD_XXX_IMPORTER value" TRUE)
|
||||||
|
|
||||||
# macro to add the CMake Option ADD_ASSIMP_IMPORTER_<name> which enables compile of loader
|
# macro to add the CMake Option ADD_ASSIMP_IMPORTER_<name> which enables compile of loader
|
||||||
# this way selective loaders can be compiled (reduces filesize + compile time)
|
# this way selective loaders can be compiled (reduces filesize + compile time)
|
||||||
MACRO(ADD_ASSIMP_IMPORTER name)
|
MACRO(ADD_ASSIMP_IMPORTER name)
|
||||||
OPTION(ASSIMP_BUILD_${name}_IMPORTER "build the ${name} importer" TRUE)
|
OPTION(ASSIMP_BUILD_${name}_IMPORTER "build the ${name} importer" ${ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT})
|
||||||
IF(ASSIMP_BUILD_${name}_IMPORTER)
|
IF(ASSIMP_BUILD_${name}_IMPORTER)
|
||||||
LIST(APPEND ASSIMP_LOADER_SRCS ${ARGN})
|
LIST(APPEND ASSIMP_LOADER_SRCS ${ARGN})
|
||||||
SET(ASSIMP_IMPORTERS_ENABLED "${ASSIMP_IMPORTERS_ENABLED} ${name}")
|
SET(ASSIMP_IMPORTERS_ENABLED "${ASSIMP_IMPORTERS_ENABLED} ${name}")
|
||||||
|
|
|
@ -652,7 +652,7 @@ void ColladaExporter::WriteMaterials()
|
||||||
if( materialCountWithThisName == 0 ) {
|
if( materialCountWithThisName == 0 ) {
|
||||||
materials[a].name = name.C_Str();
|
materials[a].name = name.C_Str();
|
||||||
} else {
|
} else {
|
||||||
materials[a].name = std::string(name.C_Str()) + to_string(materialCountWithThisName);
|
materials[a].name = std::string(name.C_Str()) + to_string(materialCountWithThisName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
|
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
|
||||||
|
@ -809,8 +809,8 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
|
||||||
const std::string idstr = GetMeshId( pIndex);
|
const std::string idstr = GetMeshId( pIndex);
|
||||||
const std::string idstrEscaped = XMLEscape(idstr);
|
const std::string idstrEscaped = XMLEscape(idstr);
|
||||||
|
|
||||||
if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
|
if ( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// opening tag
|
// opening tag
|
||||||
mOutput << startstr << "<geometry id=\"" << idstrEscaped << "\" name=\"" << idstrEscaped << "_name\" >" << endstr;
|
mOutput << startstr << "<geometry id=\"" << idstrEscaped << "\" name=\"" << idstrEscaped << "_name\" >" << endstr;
|
||||||
|
@ -843,22 +843,10 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
// assemble vertex structure
|
// assemble vertex structure
|
||||||
|
// Only write input for POSITION since we will write other as shared inputs in polygon definition
|
||||||
mOutput << startstr << "<vertices id=\"" << idstrEscaped << "-vertices" << "\">" << endstr;
|
mOutput << startstr << "<vertices id=\"" << idstrEscaped << "-vertices" << "\">" << endstr;
|
||||||
PushTag();
|
PushTag();
|
||||||
mOutput << startstr << "<input semantic=\"POSITION\" source=\"#" << idstrEscaped << "-positions\" />" << endstr;
|
mOutput << startstr << "<input semantic=\"POSITION\" source=\"#" << idstrEscaped << "-positions\" />" << endstr;
|
||||||
if( mesh->HasNormals() )
|
|
||||||
mOutput << startstr << "<input semantic=\"NORMAL\" source=\"#" << idstrEscaped << "-normals\" />" << endstr;
|
|
||||||
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
|
||||||
{
|
|
||||||
if( mesh->HasTextureCoords(static_cast<unsigned int>(a)) )
|
|
||||||
mOutput << startstr << "<input semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" " /*<< "set=\"" << a << "\"" */ << " />" << endstr;
|
|
||||||
}
|
|
||||||
for( size_t a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
|
|
||||||
{
|
|
||||||
if( mesh->HasVertexColors(static_cast<unsigned int>(a) ) )
|
|
||||||
mOutput << startstr << "<input semantic=\"COLOR\" source=\"#" << idstrEscaped << "-color" << a << "\" " /*<< set=\"" << a << "\"" */ << " />" << endstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
PopTag();
|
PopTag();
|
||||||
mOutput << startstr << "</vertices>" << endstr;
|
mOutput << startstr << "</vertices>" << endstr;
|
||||||
|
|
||||||
|
@ -877,6 +865,19 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
|
||||||
mOutput << startstr << "<lines count=\"" << countLines << "\" material=\"defaultMaterial\">" << endstr;
|
mOutput << startstr << "<lines count=\"" << countLines << "\" material=\"defaultMaterial\">" << endstr;
|
||||||
PushTag();
|
PushTag();
|
||||||
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
|
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
|
||||||
|
if( mesh->HasNormals() )
|
||||||
|
mOutput << startstr << "<input semantic=\"NORMAL\" source=\"#" << idstrEscaped << "-normals\" />" << endstr;
|
||||||
|
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
||||||
|
{
|
||||||
|
if( mesh->HasTextureCoords(static_cast<unsigned int>(a)) )
|
||||||
|
mOutput << startstr << "<input semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" " << "set=\"" << a << "\"" << " />" << endstr;
|
||||||
|
}
|
||||||
|
for( size_t a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
|
||||||
|
{
|
||||||
|
if( mesh->HasVertexColors(static_cast<unsigned int>(a) ) )
|
||||||
|
mOutput << startstr << "<input semantic=\"COLOR\" source=\"#" << idstrEscaped << "-color" << a << "\" " << "set=\"" << a << "\"" << " />" << endstr;
|
||||||
|
}
|
||||||
|
|
||||||
mOutput << startstr << "<p>";
|
mOutput << startstr << "<p>";
|
||||||
for( size_t a = 0; a < mesh->mNumFaces; ++a )
|
for( size_t a = 0; a < mesh->mNumFaces; ++a )
|
||||||
{
|
{
|
||||||
|
@ -898,10 +899,17 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
|
||||||
mOutput << startstr << "<polylist count=\"" << countPoly << "\" material=\"defaultMaterial\">" << endstr;
|
mOutput << startstr << "<polylist count=\"" << countPoly << "\" material=\"defaultMaterial\">" << endstr;
|
||||||
PushTag();
|
PushTag();
|
||||||
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
|
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
|
||||||
|
if( mesh->HasNormals() )
|
||||||
|
mOutput << startstr << "<input offset=\"0\" semantic=\"NORMAL\" source=\"#" << idstrEscaped << "-normals\" />" << endstr;
|
||||||
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
||||||
{
|
{
|
||||||
if( mesh->HasTextureCoords(static_cast<unsigned int>(a) ) )
|
if( mesh->HasTextureCoords(static_cast<unsigned int>(a)) )
|
||||||
mOutput << startstr << "<input offset=\"0\" semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" set=\"" << a << "\" />" << endstr;
|
mOutput << startstr << "<input offset=\"0\" semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" " << "set=\"" << a << "\"" << " />" << endstr;
|
||||||
|
}
|
||||||
|
for( size_t a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
|
||||||
|
{
|
||||||
|
if( mesh->HasVertexColors(static_cast<unsigned int>(a) ) )
|
||||||
|
mOutput << startstr << "<input offset=\"0\" semantic=\"COLOR\" source=\"#" << idstrEscaped << "-color" << a << "\" " << "set=\"" << a << "\"" << " />" << endstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
mOutput << startstr << "<vcount>";
|
mOutput << startstr << "<vcount>";
|
||||||
|
|
|
@ -89,6 +89,21 @@ enum InputType
|
||||||
IT_Bitangent
|
IT_Bitangent
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Supported controller types */
|
||||||
|
enum ControllerType
|
||||||
|
{
|
||||||
|
Skin,
|
||||||
|
Morph
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Supported morph methods */
|
||||||
|
enum MorphMethod
|
||||||
|
{
|
||||||
|
Normalized,
|
||||||
|
Relative
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Contains all data for one of the different transformation types */
|
/** Contains all data for one of the different transformation types */
|
||||||
struct Transform
|
struct Transform
|
||||||
{
|
{
|
||||||
|
@ -380,6 +395,12 @@ enum PrimitiveType
|
||||||
/** A skeleton controller to deform a mesh with the use of joints */
|
/** A skeleton controller to deform a mesh with the use of joints */
|
||||||
struct Controller
|
struct Controller
|
||||||
{
|
{
|
||||||
|
// controller type
|
||||||
|
ControllerType mType;
|
||||||
|
|
||||||
|
// Morphing method if type is Morph
|
||||||
|
MorphMethod mMethod;
|
||||||
|
|
||||||
// the URL of the mesh deformed by the controller.
|
// the URL of the mesh deformed by the controller.
|
||||||
std::string mMeshId;
|
std::string mMeshId;
|
||||||
|
|
||||||
|
@ -402,6 +423,9 @@ struct Controller
|
||||||
|
|
||||||
// JointIndex-WeightIndex pairs for all vertices
|
// JointIndex-WeightIndex pairs for all vertices
|
||||||
std::vector< std::pair<size_t, size_t> > mWeights;
|
std::vector< std::pair<size_t, size_t> > mWeights;
|
||||||
|
|
||||||
|
std::string mMorphTarget;
|
||||||
|
std::string mMorphWeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A collada material. Pretty much the only member is a reference to an effect. */
|
/** A collada material. Pretty much the only member is a reference to an effect. */
|
||||||
|
@ -577,6 +601,12 @@ struct AnimationChannel
|
||||||
std::string mSourceTimes;
|
std::string mSourceTimes;
|
||||||
/** Source URL of the value values. Collada calls them "output". */
|
/** Source URL of the value values. Collada calls them "output". */
|
||||||
std::string mSourceValues;
|
std::string mSourceValues;
|
||||||
|
/** Source URL of the IN_TANGENT semantic values. */
|
||||||
|
std::string mInTanValues;
|
||||||
|
/** Source URL of the OUT_TANGENT semantic values. */
|
||||||
|
std::string mOutTanValues;
|
||||||
|
/** Source URL of the INTERPOLATION semantic values. */
|
||||||
|
std::string mInterpolationValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** An animation. Container for 0-x animation channels or 0-x animations */
|
/** An animation. Container for 0-x animation channels or 0-x animations */
|
||||||
|
@ -645,6 +675,7 @@ struct Animation
|
||||||
struct ChannelEntry
|
struct ChannelEntry
|
||||||
{
|
{
|
||||||
const Collada::AnimationChannel* mChannel; ///> the source channel
|
const Collada::AnimationChannel* mChannel; ///> the source channel
|
||||||
|
std::string mTargetId;
|
||||||
std::string mTransformId; // the ID of the transformation step of the node which is influenced
|
std::string mTransformId; // the ID of the transformation step of the node which is influenced
|
||||||
size_t mTransformIndex; // Index into the node's transform chain to apply the channel to
|
size_t mTransformIndex; // Index into the node's transform chain to apply the channel to
|
||||||
size_t mSubElement; // starting index inside the transform data
|
size_t mSubElement; // starting index inside the transform data
|
||||||
|
|
|
@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ParsingUtils.h"
|
#include "ParsingUtils.h"
|
||||||
#include "SkeletonMeshBuilder.h"
|
#include "SkeletonMeshBuilder.h"
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
|
#include "CreateAnimMesh.h"
|
||||||
|
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
@ -150,6 +151,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
|
||||||
mMeshIndexByID.clear();
|
mMeshIndexByID.clear();
|
||||||
mMaterialIndexByName.clear();
|
mMaterialIndexByName.clear();
|
||||||
mMeshes.clear();
|
mMeshes.clear();
|
||||||
|
mTargetMeshes.clear();
|
||||||
newMats.clear();
|
newMats.clear();
|
||||||
mLights.clear();
|
mLights.clear();
|
||||||
mCameras.clear();
|
mCameras.clear();
|
||||||
|
@ -571,6 +573,21 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// Find mesh from either meshes or morph target meshes
|
||||||
|
aiMesh *ColladaLoader::findMesh(std::string meshid)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < mMeshes.size(); i++)
|
||||||
|
if (std::string(mMeshes[i]->mName.data) == meshid)
|
||||||
|
return mMeshes[i];
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < mTargetMeshes.size(); i++)
|
||||||
|
if (std::string(mTargetMeshes[i]->mName.data) == meshid)
|
||||||
|
return mTargetMeshes[i];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh
|
// Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh
|
||||||
aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
|
aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
|
||||||
|
@ -656,8 +673,70 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
|
||||||
face.mIndices[b] = static_cast<unsigned int>(vertex++);
|
face.mIndices[b] = static_cast<unsigned int>(vertex++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create morph target meshes if any
|
||||||
|
std::vector<aiMesh*> targetMeshes;
|
||||||
|
std::vector<float> targetWeights;
|
||||||
|
Collada::MorphMethod method;
|
||||||
|
|
||||||
|
for(std::map<std::string, Collada::Controller>::const_iterator it = pParser.mControllerLibrary.begin();
|
||||||
|
it != pParser.mControllerLibrary.end(); it++)
|
||||||
|
{
|
||||||
|
const Collada::Controller &c = it->second;
|
||||||
|
const Collada::Mesh* baseMesh = pParser.ResolveLibraryReference( pParser.mMeshLibrary, c.mMeshId);
|
||||||
|
|
||||||
|
if (c.mType == Collada::Morph && baseMesh->mName == pSrcMesh->mName)
|
||||||
|
{
|
||||||
|
const Collada::Accessor& targetAccessor = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, c.mMorphTarget);
|
||||||
|
const Collada::Accessor& weightAccessor = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, c.mMorphWeight);
|
||||||
|
const Collada::Data& targetData = pParser.ResolveLibraryReference( pParser.mDataLibrary, targetAccessor.mSource);
|
||||||
|
const Collada::Data& weightData = pParser.ResolveLibraryReference( pParser.mDataLibrary, weightAccessor.mSource);
|
||||||
|
|
||||||
|
// take method
|
||||||
|
method = c.mMethod;
|
||||||
|
|
||||||
|
if (!targetData.mIsStringArray)
|
||||||
|
throw DeadlyImportError( "target data must contain id. ");
|
||||||
|
if (weightData.mIsStringArray)
|
||||||
|
throw DeadlyImportError( "target weight data must not be textual ");
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < targetData.mStrings.size(); ++i)
|
||||||
|
{
|
||||||
|
const Collada::Mesh* targetMesh = pParser.ResolveLibraryReference(pParser.mMeshLibrary, targetData.mStrings.at(i));
|
||||||
|
|
||||||
|
aiMesh *aimesh = findMesh(targetMesh->mName);
|
||||||
|
if (!aimesh)
|
||||||
|
{
|
||||||
|
if (targetMesh->mSubMeshes.size() > 1)
|
||||||
|
throw DeadlyImportError( "Morhing target mesh must be a single");
|
||||||
|
aimesh = CreateMesh(pParser, targetMesh, targetMesh->mSubMeshes.at(0), NULL, 0, 0);
|
||||||
|
mTargetMeshes.push_back(aimesh);
|
||||||
|
}
|
||||||
|
targetMeshes.push_back(aimesh);
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < weightData.mValues.size(); ++i)
|
||||||
|
targetWeights.push_back(weightData.mValues.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetMeshes.size() > 0 && targetWeights.size() == targetMeshes.size())
|
||||||
|
{
|
||||||
|
std::vector<aiAnimMesh*> animMeshes;
|
||||||
|
for (unsigned int i = 0; i < targetMeshes.size(); i++)
|
||||||
|
{
|
||||||
|
aiAnimMesh *animMesh = aiCreateAnimMesh(targetMeshes.at(i));
|
||||||
|
animMesh->mWeight = targetWeights[i];
|
||||||
|
animMeshes.push_back(animMesh);
|
||||||
|
}
|
||||||
|
dstMesh->mMethod = (method == Collada::Relative)
|
||||||
|
? aiMorphingMethod_MORPH_RELATIVE
|
||||||
|
: aiMorphingMethod_MORPH_NORMALIZED;
|
||||||
|
dstMesh->mAnimMeshes = new aiAnimMesh*[animMeshes.size()];
|
||||||
|
dstMesh->mNumAnimMeshes = animMeshes.size();
|
||||||
|
for (unsigned int i = 0; i < animMeshes.size(); i++)
|
||||||
|
dstMesh->mAnimMeshes[i] = animMeshes.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
// create bones if given
|
// create bones if given
|
||||||
if( pSrcController)
|
if( pSrcController && pSrcController->mType == Collada::Skin)
|
||||||
{
|
{
|
||||||
// refuse if the vertex count does not match
|
// refuse if the vertex count does not match
|
||||||
// if( pSrcController->mWeightCounts.size() != dstMesh->mNumVertices)
|
// if( pSrcController->mWeightCounts.size() != dstMesh->mNumVertices)
|
||||||
|
@ -956,6 +1035,68 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars
|
||||||
CreateAnimation( pScene, pParser, pSrcAnim, animName);
|
CreateAnimation( pScene, pParser, pSrcAnim, animName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct MorphTimeValues
|
||||||
|
{
|
||||||
|
float mTime;
|
||||||
|
struct key
|
||||||
|
{
|
||||||
|
float mWeight;
|
||||||
|
unsigned int mValue;
|
||||||
|
};
|
||||||
|
std::vector<key> mKeys;
|
||||||
|
};
|
||||||
|
|
||||||
|
void insertMorphTimeValue(std::vector<MorphTimeValues> &values, float time, float weight, unsigned int value)
|
||||||
|
{
|
||||||
|
MorphTimeValues::key k;
|
||||||
|
k.mValue = value;
|
||||||
|
k.mWeight = weight;
|
||||||
|
if (values.size() == 0 || time < values[0].mTime)
|
||||||
|
{
|
||||||
|
MorphTimeValues val;
|
||||||
|
val.mTime = time;
|
||||||
|
val.mKeys.push_back(k);
|
||||||
|
values.insert(values.begin(), val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (time > values.back().mTime)
|
||||||
|
{
|
||||||
|
MorphTimeValues val;
|
||||||
|
val.mTime = time;
|
||||||
|
val.mKeys.push_back(k);
|
||||||
|
values.insert(values.end(), val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < values.size(); i++)
|
||||||
|
{
|
||||||
|
if (std::abs(time - values[i].mTime) < 1e-6f)
|
||||||
|
{
|
||||||
|
values[i].mKeys.push_back(k);
|
||||||
|
return;
|
||||||
|
} else if (time > values[i].mTime && time < values[i+1].mTime)
|
||||||
|
{
|
||||||
|
MorphTimeValues val;
|
||||||
|
val.mTime = time;
|
||||||
|
val.mKeys.push_back(k);
|
||||||
|
values.insert(values.begin() + i, val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// should not get here
|
||||||
|
}
|
||||||
|
|
||||||
|
float getWeightAtKey(const std::vector<MorphTimeValues> &values, int key, unsigned int value)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < values[key].mKeys.size(); i++)
|
||||||
|
{
|
||||||
|
if (values[key].mKeys[i].mValue == value)
|
||||||
|
return values[key].mKeys[i].mWeight;
|
||||||
|
}
|
||||||
|
// no value at key found, try to interpolate if present at other keys. if not, return zero
|
||||||
|
// TODO: interpolation
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructs the animation for the given source anim
|
// Constructs the animation for the given source anim
|
||||||
void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName)
|
void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName)
|
||||||
|
@ -965,6 +1106,8 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
CollectNodes( pScene->mRootNode, nodes);
|
CollectNodes( pScene->mRootNode, nodes);
|
||||||
|
|
||||||
std::vector<aiNodeAnim*> anims;
|
std::vector<aiNodeAnim*> anims;
|
||||||
|
std::vector<aiMeshMorphAnim*> morphAnims;
|
||||||
|
|
||||||
for( std::vector<const aiNode*>::const_iterator nit = nodes.begin(); nit != nodes.end(); ++nit)
|
for( std::vector<const aiNode*>::const_iterator nit = nodes.begin(); nit != nodes.end(); ++nit)
|
||||||
{
|
{
|
||||||
// find all the collada anim channels which refer to the current node
|
// find all the collada anim channels which refer to the current node
|
||||||
|
@ -988,7 +1131,20 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
// find the slash that separates the node name - there should be only one
|
// find the slash that separates the node name - there should be only one
|
||||||
std::string::size_type slashPos = srcChannel.mTarget.find( '/');
|
std::string::size_type slashPos = srcChannel.mTarget.find( '/');
|
||||||
if( slashPos == std::string::npos)
|
if( slashPos == std::string::npos)
|
||||||
|
{
|
||||||
|
std::string::size_type targetPos = srcChannel.mTarget.find(srcNode->mID);
|
||||||
|
if (targetPos == std::string::npos)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// not node transform, but something else. store as unknown animation channel for now
|
||||||
|
entry.mChannel = &(*cit);
|
||||||
|
entry.mTargetId = srcChannel.mTarget.substr(targetPos + pSrcAnim->mName.length(),
|
||||||
|
srcChannel.mTarget.length() - targetPos - pSrcAnim->mName.length());
|
||||||
|
if (entry.mTargetId.front() == '-')
|
||||||
|
entry.mTargetId = entry.mTargetId.substr(1);
|
||||||
|
entries.push_back(entry);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if( srcChannel.mTarget.find( '/', slashPos+1) != std::string::npos)
|
if( srcChannel.mTarget.find( '/', slashPos+1) != std::string::npos)
|
||||||
continue;
|
continue;
|
||||||
std::string targetID = srcChannel.mTarget.substr( 0, slashPos);
|
std::string targetID = srcChannel.mTarget.substr( 0, slashPos);
|
||||||
|
@ -1068,8 +1224,14 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
if( srcNode->mTransforms[a].mID == entry.mTransformId)
|
if( srcNode->mTransforms[a].mID == entry.mTransformId)
|
||||||
entry.mTransformIndex = a;
|
entry.mTransformIndex = a;
|
||||||
|
|
||||||
if( entry.mTransformIndex == SIZE_MAX) {
|
if( entry.mTransformIndex == SIZE_MAX)
|
||||||
continue;
|
{
|
||||||
|
if (entry.mTransformId.find("morph-weights") != std::string::npos)
|
||||||
|
{
|
||||||
|
entry.mTargetId = entry.mTransformId;
|
||||||
|
entry.mTransformId = "";
|
||||||
|
} else
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.mChannel = &(*cit);
|
entry.mChannel = &(*cit);
|
||||||
|
@ -1213,49 +1375,125 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
// ai_assert( resultTrafos.size() > 0);
|
// ai_assert( resultTrafos.size() > 0);
|
||||||
|
|
||||||
// build an animation channel for the given node out of these trafo keys
|
// build an animation channel for the given node out of these trafo keys
|
||||||
if( !resultTrafos.empty() )
|
if( !resultTrafos.empty() )
|
||||||
{
|
{
|
||||||
aiNodeAnim* dstAnim = new aiNodeAnim;
|
aiNodeAnim* dstAnim = new aiNodeAnim;
|
||||||
dstAnim->mNodeName = nodeName;
|
dstAnim->mNodeName = nodeName;
|
||||||
dstAnim->mNumPositionKeys = static_cast<unsigned int>(resultTrafos.size());
|
dstAnim->mNumPositionKeys = resultTrafos.size();
|
||||||
dstAnim->mNumRotationKeys= static_cast<unsigned int>(resultTrafos.size());
|
dstAnim->mNumRotationKeys= resultTrafos.size();
|
||||||
dstAnim->mNumScalingKeys = static_cast<unsigned int>(resultTrafos.size());
|
dstAnim->mNumScalingKeys = resultTrafos.size();
|
||||||
dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()];
|
dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()];
|
||||||
dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()];
|
dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()];
|
||||||
dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()];
|
dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()];
|
||||||
|
|
||||||
for( size_t a = 0; a < resultTrafos.size(); ++a)
|
for( size_t a = 0; a < resultTrafos.size(); ++a)
|
||||||
{
|
{
|
||||||
aiMatrix4x4 mat = resultTrafos[a];
|
aiMatrix4x4 mat = resultTrafos[a];
|
||||||
double time = double( mat.d4); // remember? time is stored in mat.d4
|
double time = double( mat.d4); // remember? time is stored in mat.d4
|
||||||
mat.d4 = 1.0f;
|
mat.d4 = 1.0f;
|
||||||
|
|
||||||
dstAnim->mPositionKeys[a].mTime = time;
|
dstAnim->mPositionKeys[a].mTime = time;
|
||||||
dstAnim->mRotationKeys[a].mTime = time;
|
dstAnim->mRotationKeys[a].mTime = time;
|
||||||
dstAnim->mScalingKeys[a].mTime = time;
|
dstAnim->mScalingKeys[a].mTime = time;
|
||||||
mat.Decompose( dstAnim->mScalingKeys[a].mValue, dstAnim->mRotationKeys[a].mValue, dstAnim->mPositionKeys[a].mValue);
|
mat.Decompose( dstAnim->mScalingKeys[a].mValue, dstAnim->mRotationKeys[a].mValue, dstAnim->mPositionKeys[a].mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
anims.push_back( dstAnim);
|
anims.push_back( dstAnim);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn( "Collada loader: found empty animation channel, ignored. Please check your exporter.");
|
DefaultLogger::get()->warn( "Collada loader: found empty animation channel, ignored. Please check your exporter.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !entries.empty() && entries.front().mTimeAccessor->mCount > 0 )
|
||||||
|
{
|
||||||
|
std::vector<Collada::ChannelEntry> morphChannels;
|
||||||
|
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
|
||||||
|
{
|
||||||
|
Collada::ChannelEntry& e = *it;
|
||||||
|
|
||||||
|
// skip non-transform types
|
||||||
|
if (e.mTargetId.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (e.mTargetId.find("morph-weights") != std::string::npos)
|
||||||
|
morphChannels.push_back(e);
|
||||||
|
}
|
||||||
|
if (morphChannels.size() > 0)
|
||||||
|
{
|
||||||
|
// either 1) morph weight animation count should contain morph target count channels
|
||||||
|
// or 2) one channel with morph target count arrays
|
||||||
|
// assume first
|
||||||
|
|
||||||
|
aiMeshMorphAnim *morphAnim = new aiMeshMorphAnim;
|
||||||
|
morphAnim->mName.Set(nodeName);
|
||||||
|
|
||||||
|
std::vector<MorphTimeValues> morphTimeValues;
|
||||||
|
|
||||||
|
int morphAnimChannelIndex = 0;
|
||||||
|
for( std::vector<Collada::ChannelEntry>::iterator it = morphChannels.begin(); it != morphChannels.end(); ++it)
|
||||||
|
{
|
||||||
|
Collada::ChannelEntry& e = *it;
|
||||||
|
std::string::size_type apos = e.mTargetId.find('(');
|
||||||
|
std::string::size_type bpos = e.mTargetId.find(')');
|
||||||
|
if (apos == std::string::npos || bpos == std::string::npos)
|
||||||
|
// unknown way to specify weight -> ignore this animation
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// weight target can be in format Weight_M_N, Weight_N, WeightN, or some other way
|
||||||
|
// we ignore the name and just assume the channels are in the right order
|
||||||
|
for (unsigned int i = 0; i < e.mTimeData->mValues.size(); i++)
|
||||||
|
insertMorphTimeValue(morphTimeValues, e.mTimeData->mValues.at(i), e.mValueData->mValues.at(i), morphAnimChannelIndex);
|
||||||
|
|
||||||
|
++morphAnimChannelIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
morphAnim->mNumKeys = morphTimeValues.size();
|
||||||
|
morphAnim->mKeys = new aiMeshMorphKey[morphAnim->mNumKeys];
|
||||||
|
for (unsigned int key = 0; key < morphAnim->mNumKeys; key++)
|
||||||
|
{
|
||||||
|
morphAnim->mKeys[key].mNumValuesAndWeights = morphChannels.size();
|
||||||
|
morphAnim->mKeys[key].mValues = new unsigned int [morphChannels.size()];
|
||||||
|
morphAnim->mKeys[key].mWeights = new double [morphChannels.size()];
|
||||||
|
|
||||||
|
morphAnim->mKeys[key].mTime = morphTimeValues[key].mTime;
|
||||||
|
for (unsigned int valueIndex = 0; valueIndex < morphChannels.size(); valueIndex++)
|
||||||
|
{
|
||||||
|
morphAnim->mKeys[key].mValues[valueIndex] = valueIndex;
|
||||||
|
morphAnim->mKeys[key].mWeights[valueIndex] = getWeightAtKey(morphTimeValues, key, valueIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
morphAnims.push_back(morphAnim);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !anims.empty())
|
if( !anims.empty() || !morphAnims.empty())
|
||||||
{
|
{
|
||||||
aiAnimation* anim = new aiAnimation;
|
aiAnimation* anim = new aiAnimation;
|
||||||
anim->mName.Set( pName);
|
anim->mName.Set( pName);
|
||||||
anim->mNumChannels = static_cast<unsigned int>(anims.size());
|
anim->mNumChannels = anims.size();
|
||||||
anim->mChannels = new aiNodeAnim*[anims.size()];
|
if (anim->mNumChannels > 0)
|
||||||
std::copy( anims.begin(), anims.end(), anim->mChannels);
|
{
|
||||||
|
anim->mChannels = new aiNodeAnim*[anims.size()];
|
||||||
|
std::copy( anims.begin(), anims.end(), anim->mChannels);
|
||||||
|
}
|
||||||
|
anim->mNumMorphMeshChannels = morphAnims.size();
|
||||||
|
if (anim->mNumMorphMeshChannels > 0)
|
||||||
|
{
|
||||||
|
anim->mMorphMeshChannels = new aiMeshMorphAnim*[anim->mNumMorphMeshChannels];
|
||||||
|
std::copy( morphAnims.begin(), morphAnims.end(), anim->mMorphMeshChannels);
|
||||||
|
}
|
||||||
anim->mDuration = 0.0f;
|
anim->mDuration = 0.0f;
|
||||||
for( size_t a = 0; a < anims.size(); ++a)
|
for( size_t a = 0; a < anims.size(); ++a)
|
||||||
{
|
{
|
||||||
anim->mDuration = std::max( anim->mDuration, anims[a]->mPositionKeys[anims[a]->mNumPositionKeys-1].mTime);
|
anim->mDuration = std::max( anim->mDuration, anims[a]->mPositionKeys[anims[a]->mNumPositionKeys-1].mTime);
|
||||||
anim->mDuration = std::max( anim->mDuration, anims[a]->mRotationKeys[anims[a]->mNumRotationKeys-1].mTime);
|
anim->mDuration = std::max( anim->mDuration, anims[a]->mRotationKeys[anims[a]->mNumRotationKeys-1].mTime);
|
||||||
anim->mDuration = std::max( anim->mDuration, anims[a]->mScalingKeys[anims[a]->mNumScalingKeys-1].mTime);
|
anim->mDuration = std::max( anim->mDuration, anims[a]->mScalingKeys[anims[a]->mNumScalingKeys-1].mTime);
|
||||||
|
}
|
||||||
|
for (size_t a = 0; a < morphAnims.size(); ++a)
|
||||||
|
{
|
||||||
|
anim->mDuration = std::max(anim->mDuration, morphAnims[a]->mKeys[morphAnims[a]->mNumKeys-1].mTime);
|
||||||
}
|
}
|
||||||
anim->mTicksPerSecond = 1;
|
anim->mTicksPerSecond = 1;
|
||||||
mAnims.push_back( anim);
|
mAnims.push_back( anim);
|
||||||
|
|
|
@ -117,6 +117,8 @@ protected:
|
||||||
/** Builds meshes for the given node and references them */
|
/** Builds meshes for the given node and references them */
|
||||||
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
|
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
|
||||||
aiNode* pTarget);
|
aiNode* pTarget);
|
||||||
|
|
||||||
|
aiMesh *findMesh(std::string meshid);
|
||||||
|
|
||||||
/** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */
|
/** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */
|
||||||
aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
|
aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
|
||||||
|
@ -223,6 +225,9 @@ protected:
|
||||||
|
|
||||||
/** Accumulated meshes for the target scene */
|
/** Accumulated meshes for the target scene */
|
||||||
std::vector<aiMesh*> mMeshes;
|
std::vector<aiMesh*> mMeshes;
|
||||||
|
|
||||||
|
/** Accumulated morph target meshes */
|
||||||
|
std::vector<aiMesh*> mTargetMeshes;
|
||||||
|
|
||||||
/** Temporary material list */
|
/** Temporary material list */
|
||||||
std::vector<std::pair<Collada::Effect*, aiMaterial*> > newMats;
|
std::vector<std::pair<Collada::Effect*, aiMaterial*> > newMats;
|
||||||
|
|
|
@ -585,6 +585,12 @@ void ColladaParser::ReadAnimationSampler( Collada::AnimationChannel& pChannel)
|
||||||
pChannel.mSourceTimes = source;
|
pChannel.mSourceTimes = source;
|
||||||
else if( strcmp( semantic, "OUTPUT") == 0)
|
else if( strcmp( semantic, "OUTPUT") == 0)
|
||||||
pChannel.mSourceValues = source;
|
pChannel.mSourceValues = source;
|
||||||
|
else if( strcmp( semantic, "IN_TANGENT") == 0)
|
||||||
|
pChannel.mInTanValues = source;
|
||||||
|
else if( strcmp( semantic, "OUT_TANGENT") == 0)
|
||||||
|
pChannel.mOutTanValues = source;
|
||||||
|
else if( strcmp( semantic, "INTERPOLATION") == 0)
|
||||||
|
pChannel.mInterpolationValues = source;
|
||||||
|
|
||||||
if( !mReader->isEmptyElement())
|
if( !mReader->isEmptyElement())
|
||||||
SkipElement();
|
SkipElement();
|
||||||
|
@ -647,6 +653,9 @@ void ColladaParser::ReadControllerLibrary()
|
||||||
// Reads a controller into the given mesh structure
|
// Reads a controller into the given mesh structure
|
||||||
void ColladaParser::ReadController( Collada::Controller& pController)
|
void ColladaParser::ReadController( Collada::Controller& pController)
|
||||||
{
|
{
|
||||||
|
// initial values
|
||||||
|
pController.mType = Skin;
|
||||||
|
pController.mMethod = Normalized;
|
||||||
while( mReader->read())
|
while( mReader->read())
|
||||||
{
|
{
|
||||||
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
|
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
|
||||||
|
@ -654,8 +663,15 @@ void ColladaParser::ReadController( Collada::Controller& pController)
|
||||||
// two types of controllers: "skin" and "morph". Only the first one is relevant, we skip the other
|
// two types of controllers: "skin" and "morph". Only the first one is relevant, we skip the other
|
||||||
if( IsElement( "morph"))
|
if( IsElement( "morph"))
|
||||||
{
|
{
|
||||||
// should skip everything inside, so there's no danger of catching elements in between
|
pController.mType = Morph;
|
||||||
SkipElement();
|
int baseIndex = GetAttribute("source");
|
||||||
|
pController.mMeshId = mReader->getAttributeValue(baseIndex) + 1;
|
||||||
|
int methodIndex = GetAttribute("method");
|
||||||
|
if (methodIndex > 0) {
|
||||||
|
const char *method = mReader->getAttributeValue(methodIndex);
|
||||||
|
if (strcmp(method, "RELATIVE") == 0)
|
||||||
|
pController.mMethod = Relative;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( IsElement( "skin"))
|
else if( IsElement( "skin"))
|
||||||
{
|
{
|
||||||
|
@ -667,18 +683,18 @@ void ColladaParser::ReadController( Collada::Controller& pController)
|
||||||
else if( IsElement( "bind_shape_matrix"))
|
else if( IsElement( "bind_shape_matrix"))
|
||||||
{
|
{
|
||||||
// content is 16 floats to define a matrix... it seems to be important for some models
|
// content is 16 floats to define a matrix... it seems to be important for some models
|
||||||
const char* content = GetTextContent();
|
const char* content = GetTextContent();
|
||||||
|
|
||||||
// read the 16 floats
|
// read the 16 floats
|
||||||
for( unsigned int a = 0; a < 16; a++)
|
for( unsigned int a = 0; a < 16; a++)
|
||||||
{
|
{
|
||||||
// read a number
|
// read a number
|
||||||
content = fast_atoreal_move<ai_real>( content, pController.mBindShapeMatrix[a]);
|
content = fast_atoreal_move<ai_real>( content, pController.mBindShapeMatrix[a]);
|
||||||
// skip whitespace after it
|
// skip whitespace after it
|
||||||
SkipSpacesAndLineEnd( &content);
|
SkipSpacesAndLineEnd( &content);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestClosing( "bind_shape_matrix");
|
TestClosing( "bind_shape_matrix");
|
||||||
}
|
}
|
||||||
else if( IsElement( "source"))
|
else if( IsElement( "source"))
|
||||||
{
|
{
|
||||||
|
@ -693,6 +709,32 @@ void ColladaParser::ReadController( Collada::Controller& pController)
|
||||||
{
|
{
|
||||||
ReadControllerWeights( pController);
|
ReadControllerWeights( pController);
|
||||||
}
|
}
|
||||||
|
else if ( IsElement( "targets" ))
|
||||||
|
{
|
||||||
|
while (mReader->read()) {
|
||||||
|
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
|
||||||
|
if ( IsElement( "input")) {
|
||||||
|
int semanticsIndex = GetAttribute("semantic");
|
||||||
|
int sourceIndex = GetAttribute("source");
|
||||||
|
|
||||||
|
const char *semantics = mReader->getAttributeValue(semanticsIndex);
|
||||||
|
const char *source = mReader->getAttributeValue(sourceIndex);
|
||||||
|
if (strcmp(semantics, "MORPH_TARGET") == 0) {
|
||||||
|
pController.mMorphTarget = source + 1;
|
||||||
|
}
|
||||||
|
else if (strcmp(semantics, "MORPH_WEIGHT") == 0)
|
||||||
|
{
|
||||||
|
pController.mMorphWeight = source + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) {
|
||||||
|
if( strcmp( mReader->getNodeName(), "targets") == 0)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
ThrowException( "Expected end of <targets> element.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ignore the rest
|
// ignore the rest
|
||||||
|
@ -703,7 +745,7 @@ void ColladaParser::ReadController( Collada::Controller& pController)
|
||||||
{
|
{
|
||||||
if( strcmp( mReader->getNodeName(), "controller") == 0)
|
if( strcmp( mReader->getNodeName(), "controller") == 0)
|
||||||
break;
|
break;
|
||||||
else if( strcmp( mReader->getNodeName(), "skin") != 0)
|
else if( strcmp( mReader->getNodeName(), "skin") != 0 && strcmp( mReader->getNodeName(), "morph") != 0)
|
||||||
ThrowException( "Expected end of <controller> element.");
|
ThrowException( "Expected end of <controller> element.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1592,7 +1634,7 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler)
|
||||||
}
|
}
|
||||||
else if( IsElement( "texture"))
|
else if( IsElement( "texture"))
|
||||||
{
|
{
|
||||||
// get name of source textur/sampler
|
// get name of source texture/sampler
|
||||||
int attrTex = GetAttribute( "texture");
|
int attrTex = GetAttribute( "texture");
|
||||||
pSampler.mName = mReader->getAttributeValue( attrTex);
|
pSampler.mName = mReader->getAttributeValue( attrTex);
|
||||||
|
|
||||||
|
@ -2311,9 +2353,9 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
ThrowException( "Expected different index count in <p> element.");
|
ThrowException( "Expected different index count in <p> element.");
|
||||||
|
|
||||||
// find the data for all sources
|
// find the data for all sources
|
||||||
for( std::vector<InputChannel>::iterator it = pMesh->mPerVertexData.begin(); it != pMesh->mPerVertexData.end(); ++it)
|
for( std::vector<InputChannel>::iterator it = pMesh->mPerVertexData.begin(); it != pMesh->mPerVertexData.end(); ++it)
|
||||||
{
|
{
|
||||||
InputChannel& input = *it;
|
InputChannel& input = *it;
|
||||||
if( input.mResolved)
|
if( input.mResolved)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -2325,9 +2367,9 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
acc->mData = &ResolveLibraryReference( mDataLibrary, acc->mSource);
|
acc->mData = &ResolveLibraryReference( mDataLibrary, acc->mSource);
|
||||||
}
|
}
|
||||||
// and the same for the per-index channels
|
// and the same for the per-index channels
|
||||||
for( std::vector<InputChannel>::iterator it = pPerIndexChannels.begin(); it != pPerIndexChannels.end(); ++it)
|
for( std::vector<InputChannel>::iterator it = pPerIndexChannels.begin(); it != pPerIndexChannels.end(); ++it)
|
||||||
{
|
{
|
||||||
InputChannel& input = *it;
|
InputChannel& input = *it;
|
||||||
if( input.mResolved)
|
if( input.mResolved)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -2409,6 +2451,9 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
||||||
return numPrimitives;
|
return numPrimitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///@note This function willn't work correctly if both PerIndex and PerVertex channels have same channels.
|
||||||
|
///For example if TEXCOORD present in both <vertices> and <polylist> tags this function will create wrong uv coordinates.
|
||||||
|
///It's not clear from COLLADA documentation is this allowed or not. For now only exporter fixed to avoid such behavior
|
||||||
void ColladaParser::CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Mesh* pMesh, std::vector<InputChannel>& pPerIndexChannels, size_t currentPrimitive, const std::vector<size_t>& indices){
|
void ColladaParser::CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Mesh* pMesh, std::vector<InputChannel>& pPerIndexChannels, size_t currentPrimitive, const std::vector<size_t>& indices){
|
||||||
// calculate the base offset of the vertex whose attributes we ant to copy
|
// calculate the base offset of the vertex whose attributes we ant to copy
|
||||||
size_t baseOffset = currentPrimitive * numOffsets * numPoints + currentVertex * numOffsets;
|
size_t baseOffset = currentPrimitive * numOffsets * numPoints + currentVertex * numOffsets;
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
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.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CreateAnimMesh.h"
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
|
||||||
|
aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh)
|
||||||
|
{
|
||||||
|
aiAnimMesh *animesh = new aiAnimMesh;
|
||||||
|
animesh->mVertices = NULL;
|
||||||
|
animesh->mNormals = NULL;
|
||||||
|
animesh->mTangents = NULL;
|
||||||
|
animesh->mBitangents = NULL;
|
||||||
|
animesh->mNumVertices = mesh->mNumVertices;
|
||||||
|
if (mesh->mVertices) {
|
||||||
|
animesh->mVertices = new aiVector3D[animesh->mNumVertices];
|
||||||
|
std::memcpy(animesh->mVertices, mesh->mVertices, mesh->mNumVertices * sizeof(aiVector3D));
|
||||||
|
}
|
||||||
|
if (mesh->mNormals) {
|
||||||
|
animesh->mNormals = new aiVector3D[animesh->mNumVertices];
|
||||||
|
std::memcpy(animesh->mNormals, mesh->mNormals, mesh->mNumVertices * sizeof(aiVector3D));
|
||||||
|
}
|
||||||
|
if (mesh->mTangents) {
|
||||||
|
animesh->mTangents = new aiVector3D[animesh->mNumVertices];
|
||||||
|
std::memcpy(animesh->mTangents, mesh->mTangents, mesh->mNumVertices * sizeof(aiVector3D));
|
||||||
|
}
|
||||||
|
if (mesh->mBitangents) {
|
||||||
|
animesh->mBitangents = new aiVector3D[animesh->mNumVertices];
|
||||||
|
std::memcpy(animesh->mBitangents, mesh->mBitangents, mesh->mNumVertices * sizeof(aiVector3D));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < AI_MAX_NUMBER_OF_COLOR_SETS; ++i) {
|
||||||
|
if (mesh->mColors[i]) {
|
||||||
|
animesh->mColors[i] = new aiColor4D[animesh->mNumVertices];
|
||||||
|
std::memcpy(animesh->mColors[i], mesh->mColors[i], mesh->mNumVertices * sizeof(aiColor4D));
|
||||||
|
} else {
|
||||||
|
animesh->mColors[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||||
|
if (mesh->mTextureCoords[i]) {
|
||||||
|
animesh->mTextureCoords[i] = new aiVector3D[animesh->mNumVertices];
|
||||||
|
std::memcpy(animesh->mTextureCoords[i], mesh->mTextureCoords[i], mesh->mNumVertices * sizeof(aiVector3D));
|
||||||
|
} else {
|
||||||
|
animesh->mTextureCoords[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return animesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end of namespace Assimp
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
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 CreateAnimMesh.h
|
||||||
|
* Create AnimMesh from Mesh
|
||||||
|
*/
|
||||||
|
#ifndef INCLUDED_AI_CREATE_ANIM_MESH_H
|
||||||
|
#define INCLUDED_AI_CREATE_ANIM_MESH_H
|
||||||
|
|
||||||
|
#include <assimp/mesh.h>
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
|
||||||
|
/** Create aiAnimMesh from aiMesh. */
|
||||||
|
aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh);
|
||||||
|
|
||||||
|
} // end of namespace Assimp
|
||||||
|
#endif // INCLUDED_AI_CREATE_ANIM_MESH_H
|
||||||
|
|
|
@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "StringComparison.h"
|
#include "StringComparison.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -68,7 +67,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace D3MF {
|
namespace D3MF {
|
||||||
|
|
||||||
|
|
||||||
namespace XmlTag {
|
namespace XmlTag {
|
||||||
static const std::string model = "model";
|
static const std::string model = "model";
|
||||||
static const std::string metadata = "metadata";
|
static const std::string metadata = "metadata";
|
||||||
|
@ -229,9 +227,10 @@ private:
|
||||||
aiVector3D ReadVertex()
|
aiVector3D ReadVertex()
|
||||||
{
|
{
|
||||||
aiVector3D vertex;
|
aiVector3D vertex;
|
||||||
|
|
||||||
vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
|
vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
|
||||||
vertex.y = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr);
|
vertex.y = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr);
|
||||||
vertex.z = ai_strtof>(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr);
|
vertex.z = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr);
|
||||||
|
|
||||||
return vertex;
|
return vertex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ size_t DefaultIOStream::FileSize() const
|
||||||
if (0 != err)
|
if (0 != err)
|
||||||
return 0;
|
return 0;
|
||||||
mCachedSize = (size_t) (fileStat.st_size);
|
mCachedSize = (size_t) (fileStat.st_size);
|
||||||
#elif defined __GNUC__ || defined __APPLE__ || defined __MACH__
|
#elif defined __GNUC__ || defined __APPLE__ || defined __MACH__ || defined __FreeBSD__
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
int err = stat(mFilename.c_str(), &fileStat );
|
int err = stat(mFilename.c_str(), &fileStat );
|
||||||
if (0 != err)
|
if (0 != err)
|
||||||
|
|
|
@ -201,65 +201,48 @@ public:
|
||||||
std::vector<Exporter::ExportFormatEntry> mExporters;
|
std::vector<Exporter::ExportFormatEntry> mExporters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Exporter :: Exporter()
|
Exporter :: Exporter()
|
||||||
: pimpl(new ExporterPimpl())
|
: pimpl(new ExporterPimpl()) {
|
||||||
{
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Exporter :: ~Exporter()
|
Exporter::~Exporter() {
|
||||||
{
|
|
||||||
FreeBlob();
|
FreeBlob();
|
||||||
|
|
||||||
delete pimpl;
|
delete pimpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void Exporter :: SetIOHandler( IOSystem* pIOHandler)
|
void Exporter::SetIOHandler( IOSystem* pIOHandler) {
|
||||||
{
|
|
||||||
pimpl->mIsDefaultIOHandler = !pIOHandler;
|
pimpl->mIsDefaultIOHandler = !pIOHandler;
|
||||||
pimpl->mIOSystem.reset(pIOHandler);
|
pimpl->mIOSystem.reset(pIOHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
IOSystem* Exporter :: GetIOHandler() const
|
IOSystem* Exporter::GetIOHandler() const {
|
||||||
{
|
|
||||||
return pimpl->mIOSystem.get();
|
return pimpl->mIOSystem.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool Exporter :: IsDefaultIOHandler() const
|
bool Exporter::IsDefaultIOHandler() const {
|
||||||
{
|
|
||||||
return pimpl->mIsDefaultIOHandler;
|
return pimpl->mIsDefaultIOHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int, const ExportProperties* pProperties)
|
const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const char* pFormatId,
|
||||||
{
|
unsigned int, const ExportProperties* pProperties ) {
|
||||||
if (pimpl->blob) {
|
if (pimpl->blob) {
|
||||||
delete pimpl->blob;
|
delete pimpl->blob;
|
||||||
pimpl->blob = NULL;
|
pimpl->blob = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<IOSystem> old = pimpl->mIOSystem;
|
std::shared_ptr<IOSystem> old = pimpl->mIOSystem;
|
||||||
|
|
||||||
BlobIOSystem* blobio = new BlobIOSystem();
|
BlobIOSystem* blobio = new BlobIOSystem();
|
||||||
pimpl->mIOSystem = std::shared_ptr<IOSystem>( blobio );
|
pimpl->mIOSystem = std::shared_ptr<IOSystem>( blobio );
|
||||||
|
|
||||||
|
@ -274,10 +257,8 @@ const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const
|
||||||
return pimpl->blob;
|
return pimpl->blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool IsVerboseFormat(const aiMesh* mesh)
|
bool IsVerboseFormat(const aiMesh* mesh) {
|
||||||
{
|
|
||||||
// avoid slow vector<bool> specialization
|
// avoid slow vector<bool> specialization
|
||||||
std::vector<unsigned int> seen(mesh->mNumVertices,0);
|
std::vector<unsigned int> seen(mesh->mNumVertices,0);
|
||||||
for(unsigned int i = 0; i < mesh->mNumFaces; ++i) {
|
for(unsigned int i = 0; i < mesh->mNumFaces; ++i) {
|
||||||
|
@ -292,10 +273,8 @@ bool IsVerboseFormat(const aiMesh* mesh)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool IsVerboseFormat(const aiScene* pScene)
|
bool IsVerboseFormat(const aiScene* pScene) {
|
||||||
{
|
|
||||||
for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
||||||
if(!IsVerboseFormat(pScene->mMeshes[i])) {
|
if(!IsVerboseFormat(pScene->mMeshes[i])) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -304,10 +283,8 @@ bool IsVerboseFormat(const aiScene* pScene)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing, const ExportProperties* pProperties)
|
aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing, const ExportProperties* pProperties) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
// when they create scenes from scratch, users will likely create them not in verbose
|
// when they create scenes from scratch, users will likely create them not in verbose
|
||||||
|
@ -320,9 +297,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
|
||||||
for (size_t i = 0; i < pimpl->mExporters.size(); ++i) {
|
for (size_t i = 0; i < pimpl->mExporters.size(); ++i) {
|
||||||
const Exporter::ExportFormatEntry& exp = pimpl->mExporters[i];
|
const Exporter::ExportFormatEntry& exp = pimpl->mExporters[i];
|
||||||
if (!strcmp(exp.mDescription.id,pFormatId)) {
|
if (!strcmp(exp.mDescription.id,pFormatId)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Always create a full copy of the scene. We might optimize this one day,
|
// Always create a full copy of the scene. We might optimize this one day,
|
||||||
// but for now it is the most pragmatic way.
|
// but for now it is the most pragmatic way.
|
||||||
aiScene* scenecopy_tmp = NULL;
|
aiScene* scenecopy_tmp = NULL;
|
||||||
|
@ -341,18 +316,17 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
|
||||||
? (priv->mPPStepsApplied & ~nonIdempotentSteps)
|
? (priv->mPPStepsApplied & ~nonIdempotentSteps)
|
||||||
: 0u);
|
: 0u);
|
||||||
|
|
||||||
// If no extra postprocessing was specified, and we obtained this scene from an
|
// If no extra post-processing was specified, and we obtained this scene from an
|
||||||
// Assimp importer, apply the reverse steps automatically.
|
// Assimp importer, apply the reverse steps automatically.
|
||||||
// TODO: either drop this, or document it. Otherwise it is just a bad surprise.
|
// TODO: either drop this, or document it. Otherwise it is just a bad surprise.
|
||||||
//if (!pPreprocessing && priv) {
|
//if (!pPreprocessing && priv) {
|
||||||
// pp |= (nonIdempotentSteps & priv->mPPStepsApplied);
|
// pp |= (nonIdempotentSteps & priv->mPPStepsApplied);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// If the input scene is not in verbose format, but there is at least postprocessing step that relies on it,
|
// If the input scene is not in verbose format, but there is at least post-processing step that relies on it,
|
||||||
// we need to run the MakeVerboseFormat step first.
|
// we need to run the MakeVerboseFormat step first.
|
||||||
bool must_join_again = false;
|
bool must_join_again = false;
|
||||||
if (!is_verbose_format) {
|
if (!is_verbose_format) {
|
||||||
|
|
||||||
bool verbosify = false;
|
bool verbosify = false;
|
||||||
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
||||||
BaseProcess* const p = pimpl->mPostProcessingSteps[a];
|
BaseProcess* const p = pimpl->mPostProcessingSteps[a];
|
||||||
|
@ -423,8 +397,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
|
||||||
|
|
||||||
ExportProperties emptyProperties; // Never pass NULL ExportProperties so Exporters don't have to worry.
|
ExportProperties emptyProperties; // Never pass NULL ExportProperties so Exporters don't have to worry.
|
||||||
exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get(), pProperties ? pProperties : &emptyProperties);
|
exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get(), pProperties ? pProperties : &emptyProperties);
|
||||||
}
|
} catch (DeadlyExportError& err) {
|
||||||
catch (DeadlyExportError& err) {
|
|
||||||
pimpl->mError = err.what();
|
pimpl->mError = err.what();
|
||||||
return AI_FAILURE;
|
return AI_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -437,64 +410,53 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
|
||||||
return AI_FAILURE;
|
return AI_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const char* Exporter :: GetErrorString() const
|
const char* Exporter::GetErrorString() const {
|
||||||
{
|
|
||||||
return pimpl->mError.c_str();
|
return pimpl->mError.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void Exporter :: FreeBlob( )
|
void Exporter::FreeBlob() {
|
||||||
{
|
|
||||||
delete pimpl->blob;
|
delete pimpl->blob;
|
||||||
pimpl->blob = NULL;
|
pimpl->blob = NULL;
|
||||||
|
|
||||||
pimpl->mError = "";
|
pimpl->mError = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const aiExportDataBlob* Exporter :: GetBlob() const
|
const aiExportDataBlob* Exporter::GetBlob() const {
|
||||||
{
|
|
||||||
return pimpl->blob;
|
return pimpl->blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const aiExportDataBlob* Exporter :: GetOrphanedBlob() const
|
const aiExportDataBlob* Exporter::GetOrphanedBlob() const {
|
||||||
{
|
|
||||||
const aiExportDataBlob* tmp = pimpl->blob;
|
const aiExportDataBlob* tmp = pimpl->blob;
|
||||||
pimpl->blob = NULL;
|
pimpl->blob = NULL;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
size_t Exporter :: GetExportFormatCount() const
|
size_t Exporter::GetExportFormatCount() const {
|
||||||
{
|
|
||||||
return pimpl->mExporters.size();
|
return pimpl->mExporters.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex ) const
|
const aiExportFormatDesc* Exporter::GetExportFormatDescription( size_t index ) const {
|
||||||
{
|
if (index >= GetExportFormatCount()) {
|
||||||
if (pIndex >= GetExportFormatCount()) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return from static storage if the requested index is built-in.
|
// Return from static storage if the requested index is built-in.
|
||||||
if (pIndex < sizeof(gExporters) / sizeof(gExporters[0])) {
|
if (index < sizeof(gExporters) / sizeof(gExporters[0])) {
|
||||||
return &gExporters[pIndex].mDescription;
|
return &gExporters[index].mDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pimpl->mExporters[pIndex].mDescription;
|
return &pimpl->mExporters[index].mDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
|
aiReturn Exporter::RegisterExporter(const ExportFormatEntry& desc) {
|
||||||
{
|
|
||||||
for(const ExportFormatEntry& e : pimpl->mExporters) {
|
for(const ExportFormatEntry& e : pimpl->mExporters) {
|
||||||
if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
|
if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
|
||||||
return aiReturn_FAILURE;
|
return aiReturn_FAILURE;
|
||||||
|
@ -505,10 +467,8 @@ aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
|
||||||
return aiReturn_SUCCESS;
|
return aiReturn_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void Exporter :: UnregisterExporter(const char* id)
|
void Exporter::UnregisterExporter(const char* id) {
|
||||||
{
|
|
||||||
for(std::vector<ExportFormatEntry>::iterator it = pimpl->mExporters.begin(); it != pimpl->mExporters.end(); ++it) {
|
for(std::vector<ExportFormatEntry>::iterator it = pimpl->mExporters.begin(); it != pimpl->mExporters.end(); ++it) {
|
||||||
if (!strcmp((*it).mDescription.id,id)) {
|
if (!strcmp((*it).mDescription.id,id)) {
|
||||||
pimpl->mExporters.erase(it);
|
pimpl->mExporters.erase(it);
|
||||||
|
@ -517,29 +477,30 @@ void Exporter :: UnregisterExporter(const char* id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportProperties :: ExportProperties() {}
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
ExportProperties::ExportProperties() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
ExportProperties::ExportProperties(const ExportProperties &other)
|
ExportProperties::ExportProperties(const ExportProperties &other)
|
||||||
: mIntProperties(other.mIntProperties),
|
: mIntProperties(other.mIntProperties)
|
||||||
mFloatProperties(other.mFloatProperties),
|
, mFloatProperties(other.mFloatProperties)
|
||||||
mStringProperties(other.mStringProperties),
|
, mStringProperties(other.mStringProperties)
|
||||||
mMatrixProperties(other.mMatrixProperties)
|
, mMatrixProperties(other.mMatrixProperties) {
|
||||||
{
|
// empty
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Set a configuration property
|
// Set a configuration property
|
||||||
bool ExportProperties :: SetPropertyInteger(const char* szName, int iValue)
|
bool ExportProperties::SetPropertyInteger(const char* szName, int iValue) {
|
||||||
{
|
|
||||||
return SetGenericProperty<int>(mIntProperties, szName,iValue);
|
return SetGenericProperty<int>(mIntProperties, szName,iValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Set a configuration property
|
// Set a configuration property
|
||||||
bool ExportProperties :: SetPropertyFloat(const char* szName, ai_real iValue)
|
bool ExportProperties::SetPropertyFloat(const char* szName, ai_real iValue) {
|
||||||
{
|
|
||||||
return SetGenericProperty<ai_real>(mFloatProperties, szName,iValue);
|
return SetGenericProperty<ai_real>(mFloatProperties, szName,iValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ static const aiImporterDesc desc = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"ifc ifczip"
|
"ifc ifczip stp"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,11 +128,9 @@ IFCImporter::~IFCImporter()
|
||||||
bool IFCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
bool IFCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
||||||
{
|
{
|
||||||
const std::string& extension = GetExtension(pFile);
|
const std::string& extension = GetExtension(pFile);
|
||||||
if (extension == "ifc" || extension == "ifczip") {
|
if (extension == "ifc" || extension == "ifczip" || extension == "stp" ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if ((!extension.length() || checkSig) && pIOHandler) {
|
||||||
|
|
||||||
else if ((!extension.length() || checkSig) && pIOHandler) {
|
|
||||||
// note: this is the common identification for STEP-encoded files, so
|
// note: this is the common identification for STEP-encoded files, so
|
||||||
// it is only unambiguous as long as we don't support any further
|
// it is only unambiguous as long as we don't support any further
|
||||||
// file formats with STEP as their encoding.
|
// file formats with STEP as their encoding.
|
||||||
|
|
|
@ -46,6 +46,9 @@ directly (unless you are adding new loaders), instead use the
|
||||||
corresponding preprocessor flag to selectively disable formats.
|
corresponding preprocessor flag to selectively disable formats.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "BaseImporter.h"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importers
|
// Importers
|
||||||
// (include_new_importers_here)
|
// (include_new_importers_here)
|
||||||
|
|
|
@ -38,8 +38,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
#ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
|
#ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
|
||||||
|
|
||||||
|
@ -53,14 +51,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
namespace Assimp {
|
|
||||||
|
namespace Assimp {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Worker function for exporting a scene to Wavefront OBJ. Prototyped and registered in Exporter.cpp
|
// Worker function for exporting a scene to Wavefront OBJ. Prototyped and registered in Exporter.cpp
|
||||||
void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
|
void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) {
|
||||||
{
|
|
||||||
// invoke the exporter
|
// invoke the exporter
|
||||||
ObjExporter exporter(pFile, pScene);
|
ObjExporter exporter(pFile, pScene);
|
||||||
|
|
||||||
|
@ -86,11 +83,14 @@ void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
|
||||||
static const std::string MaterialExt = ".mtl";
|
static const std::string MaterialExt = ".mtl";
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ObjExporter :: ObjExporter(const char* _filename, const aiScene* pScene)
|
ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene)
|
||||||
: filename(_filename)
|
: filename(_filename)
|
||||||
, pScene(pScene)
|
, pScene(pScene)
|
||||||
, endl("\n")
|
, endl("\n")
|
||||||
{
|
, vp()
|
||||||
|
, vn()
|
||||||
|
, vt()
|
||||||
|
, vc() {
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
const std::locale& l = std::locale("C");
|
const std::locale& l = std::locale("C");
|
||||||
mOutput.imbue(l);
|
mOutput.imbue(l);
|
||||||
|
@ -102,6 +102,11 @@ ObjExporter :: ObjExporter(const char* _filename, const aiScene* pScene)
|
||||||
WriteMaterialFile();
|
WriteMaterialFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
ObjExporter::~ObjExporter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
std::string ObjExporter :: GetMaterialLibName()
|
std::string ObjExporter :: GetMaterialLibName()
|
||||||
{
|
{
|
||||||
|
@ -166,11 +171,17 @@ void ObjExporter::WriteMaterialFile()
|
||||||
if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_EMISSIVE,c)) {
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_EMISSIVE,c)) {
|
||||||
mOutputMat << "Ke " << c.r << " " << c.g << " " << c.b << endl;
|
mOutputMat << "Ke " << c.r << " " << c.g << " " << c.b << endl;
|
||||||
}
|
}
|
||||||
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_TRANSPARENT,c)) {
|
||||||
|
mOutputMat << "Tf " << c.r << " " << c.g << " " << c.b << endl;
|
||||||
|
}
|
||||||
|
|
||||||
ai_real o;
|
ai_real o;
|
||||||
if(AI_SUCCESS == mat->Get(AI_MATKEY_OPACITY,o)) {
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_OPACITY,o)) {
|
||||||
mOutputMat << "d " << o << endl;
|
mOutputMat << "d " << o << endl;
|
||||||
}
|
}
|
||||||
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_REFRACTI,o)) {
|
||||||
|
mOutputMat << "Ni " << o << endl;
|
||||||
|
}
|
||||||
|
|
||||||
if(AI_SUCCESS == mat->Get(AI_MATKEY_SHININESS,o) && o) {
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_SHININESS,o) && o) {
|
||||||
mOutputMat << "Ns " << o << endl;
|
mOutputMat << "Ns " << o << endl;
|
||||||
|
@ -206,8 +217,7 @@ void ObjExporter::WriteMaterialFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ObjExporter :: WriteGeometryFile()
|
void ObjExporter::WriteGeometryFile() {
|
||||||
{
|
|
||||||
WriteHeader(mOutput);
|
WriteHeader(mOutput);
|
||||||
mOutput << "mtllib " << GetMaterialLibName() << endl << endl;
|
mOutput << "mtllib " << GetMaterialLibName() << endl << endl;
|
||||||
|
|
||||||
|
@ -215,11 +225,21 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
aiMatrix4x4 mBase;
|
aiMatrix4x4 mBase;
|
||||||
AddNode(pScene->mRootNode, mBase);
|
AddNode(pScene->mRootNode, mBase);
|
||||||
|
|
||||||
// write vertex positions
|
// write vertex positions with colors, if any
|
||||||
vpMap.getVectors(vp);
|
vpMap.getVectors( vp );
|
||||||
mOutput << "# " << vp.size() << " vertex positions" << endl;
|
vcMap.getColors( vc );
|
||||||
for(const aiVector3D& v : vp) {
|
if ( vc.empty() ) {
|
||||||
mOutput << "v " << v.x << " " << v.y << " " << v.z << endl;
|
mOutput << "# " << vp.size() << " vertex positions" << endl;
|
||||||
|
for ( const aiVector3D& v : vp ) {
|
||||||
|
mOutput << "v " << v.x << " " << v.y << " " << v.z << endl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mOutput << "# " << vp.size() << " vertex positions and colors" << endl;
|
||||||
|
size_t colIdx = 0;
|
||||||
|
for ( const aiVector3D& v : vp ) {
|
||||||
|
mOutput << "v " << v.x << " " << v.y << " " << v.z << " " << vc[ colIdx ].r << " " << vc[ colIdx ].g << " " << vc[ colIdx ].b << endl;
|
||||||
|
colIdx++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mOutput << endl;
|
mOutput << endl;
|
||||||
|
|
||||||
|
@ -272,8 +292,7 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
int ObjExporter::vecIndexMap::getIndex(const aiVector3D& vec)
|
int ObjExporter::vecIndexMap::getIndex(const aiVector3D& vec) {
|
||||||
{
|
|
||||||
vecIndexMap::dataType::iterator vertIt = vecMap.find(vec);
|
vecIndexMap::dataType::iterator vertIt = vecMap.find(vec);
|
||||||
// vertex already exists, so reference it
|
// vertex already exists, so reference it
|
||||||
if(vertIt != vecMap.end()){
|
if(vertIt != vecMap.end()){
|
||||||
|
@ -286,8 +305,7 @@ int ObjExporter::vecIndexMap::getIndex(const aiVector3D& vec)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ObjExporter::vecIndexMap::getVectors( std::vector<aiVector3D>& vecs )
|
void ObjExporter::vecIndexMap::getVectors( std::vector<aiVector3D>& vecs ) {
|
||||||
{
|
|
||||||
vecs.resize(vecMap.size());
|
vecs.resize(vecMap.size());
|
||||||
for(vecIndexMap::dataType::iterator it = vecMap.begin(); it != vecMap.end(); ++it){
|
for(vecIndexMap::dataType::iterator it = vecMap.begin(); it != vecMap.end(); ++it){
|
||||||
vecs[it->second-1] = it->first;
|
vecs[it->second-1] = it->first;
|
||||||
|
@ -295,8 +313,29 @@ void ObjExporter::vecIndexMap::getVectors( std::vector<aiVector3D>& vecs )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat)
|
int ObjExporter::colIndexMap::getIndex( const aiColor4D& col ) {
|
||||||
{
|
colIndexMap::dataType::iterator vertIt = colMap.find( col );
|
||||||
|
// vertex already exists, so reference it
|
||||||
|
if ( vertIt != colMap.end() ) {
|
||||||
|
return vertIt->second;
|
||||||
|
}
|
||||||
|
colMap[ col ] = mNextIndex;
|
||||||
|
int ret = mNextIndex;
|
||||||
|
mNextIndex++;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ObjExporter::colIndexMap::getColors( std::vector<aiColor4D> &colors ) {
|
||||||
|
colors.resize( colMap.size() );
|
||||||
|
for ( colIndexMap::dataType::iterator it = colMap.begin(); it != colMap.end(); ++it ) {
|
||||||
|
colors[ it->second - 1 ] = it->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat) {
|
||||||
meshes.push_back(MeshInstance());
|
meshes.push_back(MeshInstance());
|
||||||
MeshInstance& mesh = meshes.back();
|
MeshInstance& mesh = meshes.back();
|
||||||
|
|
||||||
|
@ -330,15 +369,20 @@ void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4
|
||||||
if (m->mNormals) {
|
if (m->mNormals) {
|
||||||
aiVector3D norm = aiMatrix3x3(mat) * m->mNormals[idx];
|
aiVector3D norm = aiMatrix3x3(mat) * m->mNormals[idx];
|
||||||
face.indices[a].vn = vnMap.getIndex(norm);
|
face.indices[a].vn = vnMap.getIndex(norm);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
face.indices[a].vn = 0;
|
face.indices[a].vn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->mTextureCoords[0]) {
|
if ( nullptr != m->mColors[ 0 ] ) {
|
||||||
face.indices[a].vt = vtMap.getIndex(m->mTextureCoords[0][idx]);
|
aiColor4D col4 = m->mColors[ 0 ][ idx ];
|
||||||
|
face.indices[ a ].vc = vcMap.getIndex( col4 );
|
||||||
|
} else {
|
||||||
|
face.indices[ a ].vc = 0;
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
|
if ( m->mTextureCoords[ 0 ] ) {
|
||||||
|
face.indices[a].vt = vtMap.getIndex(m->mTextureCoords[0][idx]);
|
||||||
|
} else {
|
||||||
face.indices[a].vt = 0;
|
face.indices[a].vt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,40 +53,35 @@ struct aiScene;
|
||||||
struct aiNode;
|
struct aiNode;
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
/** Helper class to export a given scene to an OBJ file. */
|
/** Helper class to export a given scene to an OBJ file. */
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
class ObjExporter
|
class ObjExporter {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/// Constructor for a specific scene to export
|
/// Constructor for a specific scene to export
|
||||||
ObjExporter(const char* filename, const aiScene* pScene);
|
ObjExporter(const char* filename, const aiScene* pScene);
|
||||||
|
~ObjExporter();
|
||||||
public:
|
|
||||||
|
|
||||||
std::string GetMaterialLibName();
|
std::string GetMaterialLibName();
|
||||||
std::string GetMaterialLibFileName();
|
std::string GetMaterialLibFileName();
|
||||||
|
|
||||||
public:
|
/// public string-streams to write all output into
|
||||||
|
|
||||||
/// public stringstreams to write all output into
|
|
||||||
std::ostringstream mOutput, mOutputMat;
|
std::ostringstream mOutput, mOutputMat;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// intermediate data structures
|
// intermediate data structures
|
||||||
struct FaceVertex
|
struct FaceVertex {
|
||||||
{
|
|
||||||
FaceVertex()
|
FaceVertex()
|
||||||
: vp(),vn(),vt()
|
: vp()
|
||||||
{
|
, vn()
|
||||||
|
, vt()
|
||||||
|
, vc() {
|
||||||
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// one-based, 0 means: 'does not exist'
|
// one-based, 0 means: 'does not exist'
|
||||||
unsigned int vp,vn,vt;
|
unsigned int vp, vn, vt, vc;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Face {
|
struct Face {
|
||||||
|
@ -95,13 +90,11 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MeshInstance {
|
struct MeshInstance {
|
||||||
|
|
||||||
std::string name, matname;
|
std::string name, matname;
|
||||||
std::vector<Face> faces;
|
std::vector<Face> faces;
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteHeader(std::ostringstream& out);
|
void WriteHeader(std::ostringstream& out);
|
||||||
|
|
||||||
void WriteMaterialFile();
|
void WriteMaterialFile();
|
||||||
void WriteGeometryFile();
|
void WriteGeometryFile();
|
||||||
|
|
||||||
|
@ -111,17 +104,14 @@ private:
|
||||||
void AddNode(const aiNode* nd, const aiMatrix4x4& mParent);
|
void AddNode(const aiNode* nd, const aiMatrix4x4& mParent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const std::string filename;
|
const std::string filename;
|
||||||
const aiScene* const pScene;
|
const aiScene* const pScene;
|
||||||
|
|
||||||
std::vector<aiVector3D> vp, vn, vt;
|
std::vector<aiVector3D> vp, vn, vt;
|
||||||
|
std::vector<aiColor4D> vc;
|
||||||
|
|
||||||
|
struct aiVectorCompare {
|
||||||
struct aiVectorCompare
|
bool operator() (const aiVector3D& a, const aiVector3D& b) const {
|
||||||
{
|
|
||||||
bool operator() (const aiVector3D& a, const aiVector3D& b) const
|
|
||||||
{
|
|
||||||
if(a.x < b.x) return true;
|
if(a.x < b.x) return true;
|
||||||
if(a.x > b.x) return false;
|
if(a.x > b.x) return false;
|
||||||
if(a.y < b.y) return true;
|
if(a.y < b.y) return true;
|
||||||
|
@ -131,21 +121,52 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class vecIndexMap
|
struct aiColor4Compare {
|
||||||
{
|
bool operator() ( const aiColor4D& a, const aiColor4D& b ) const {
|
||||||
|
if ( a.r < b.r ) return true;
|
||||||
|
if ( a.r > b.r ) return false;
|
||||||
|
if ( a.g < b.g ) return true;
|
||||||
|
if ( a.g > b.g ) return false;
|
||||||
|
if ( a.b < b.b ) return true;
|
||||||
|
if ( a.b > b.b ) return false;
|
||||||
|
if ( a.a < b.a ) return true;
|
||||||
|
if ( a.a > b.a ) return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class vecIndexMap {
|
||||||
int mNextIndex;
|
int mNextIndex;
|
||||||
typedef std::map<aiVector3D, int, aiVectorCompare> dataType;
|
typedef std::map<aiVector3D, int, aiVectorCompare> dataType;
|
||||||
dataType vecMap;
|
dataType vecMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
vecIndexMap()
|
||||||
vecIndexMap():mNextIndex(1)
|
: mNextIndex(1) {
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
int getIndex(const aiVector3D& vec);
|
int getIndex(const aiVector3D& vec);
|
||||||
void getVectors( std::vector<aiVector3D>& vecs );
|
void getVectors( std::vector<aiVector3D>& vecs );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class colIndexMap {
|
||||||
|
int mNextIndex;
|
||||||
|
typedef std::map<aiColor4D, int, aiColor4Compare> dataType;
|
||||||
|
dataType colMap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
colIndexMap()
|
||||||
|
: mNextIndex( 1 ) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
int getIndex( const aiColor4D& col );
|
||||||
|
void getColors( std::vector<aiColor4D> &colors );
|
||||||
|
};
|
||||||
|
|
||||||
vecIndexMap vpMap, vnMap, vtMap;
|
vecIndexMap vpMap, vnMap, vtMap;
|
||||||
|
colIndexMap vcMap;
|
||||||
std::vector<MeshInstance> meshes;
|
std::vector<MeshInstance> meshes;
|
||||||
|
|
||||||
// this endl() doesn't flush() the stream
|
// this endl() doesn't flush() the stream
|
||||||
|
|
|
@ -178,6 +178,8 @@ struct Material {
|
||||||
int illumination_model;
|
int illumination_model;
|
||||||
//! Index of refraction
|
//! Index of refraction
|
||||||
ai_real ior;
|
ai_real ior;
|
||||||
|
//! Transparency color
|
||||||
|
aiColor3D transparent;
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
Material()
|
Material()
|
||||||
|
@ -185,7 +187,8 @@ struct Material {
|
||||||
, alpha (ai_real( 1.0 ) )
|
, alpha (ai_real( 1.0 ) )
|
||||||
, shineness ( ai_real( 0.0) )
|
, shineness ( ai_real( 0.0) )
|
||||||
, illumination_model (1)
|
, illumination_model (1)
|
||||||
, ior ( ai_real( 1.0 ) ) {
|
, ior ( ai_real( 1.0 ) )
|
||||||
|
, transparent( ai_real( 1.0), ai_real (1.0), ai_real(1.0)) {
|
||||||
// empty
|
// empty
|
||||||
for (size_t i = 0; i < TextureTypeCount; ++i) {
|
for (size_t i = 0; i < TextureTypeCount; ++i) {
|
||||||
clamp[ i ] = false;
|
clamp[ i ] = false;
|
||||||
|
|
|
@ -607,6 +607,7 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
|
||||||
mat->AddProperty( &pCurrentMaterial->emissive, 1, AI_MATKEY_COLOR_EMISSIVE );
|
mat->AddProperty( &pCurrentMaterial->emissive, 1, AI_MATKEY_COLOR_EMISSIVE );
|
||||||
mat->AddProperty( &pCurrentMaterial->shineness, 1, AI_MATKEY_SHININESS );
|
mat->AddProperty( &pCurrentMaterial->shineness, 1, AI_MATKEY_SHININESS );
|
||||||
mat->AddProperty( &pCurrentMaterial->alpha, 1, AI_MATKEY_OPACITY );
|
mat->AddProperty( &pCurrentMaterial->alpha, 1, AI_MATKEY_OPACITY );
|
||||||
|
mat->AddProperty( &pCurrentMaterial->transparent,1,AI_MATKEY_COLOR_TRANSPARENT);
|
||||||
|
|
||||||
// Adding refraction index
|
// Adding refraction index
|
||||||
mat->AddProperty( &pCurrentMaterial->ior, 1, AI_MATKEY_REFRACTI );
|
mat->AddProperty( &pCurrentMaterial->ior, 1, AI_MATKEY_REFRACTI );
|
||||||
|
|
|
@ -163,7 +163,17 @@ void ObjFileMtlImporter::load()
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'T':
|
||||||
|
{
|
||||||
|
++m_DataIt;
|
||||||
|
if (*m_DataIt == 'f') // Material transmission
|
||||||
|
{
|
||||||
|
++m_DataIt;
|
||||||
|
getColorRGBA( &m_pModel->m_pCurrentMaterial->transparent);
|
||||||
|
}
|
||||||
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
{
|
{
|
||||||
if( *(m_DataIt+1) == 'i' && *( m_DataIt + 2 ) == 's' && *( m_DataIt + 3 ) == 'p' ) {
|
if( *(m_DataIt+1) == 'i' && *( m_DataIt + 2 ) == 's' && *( m_DataIt + 3 ) == 'p' ) {
|
||||||
|
@ -292,6 +302,9 @@ void ObjFileMtlImporter::createMaterial()
|
||||||
// New Material created
|
// New Material created
|
||||||
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
||||||
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
|
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
|
||||||
|
if (m_pModel->m_pCurrentMesh) {
|
||||||
|
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = m_pModel->m_MaterialLib.size() - 1;
|
||||||
|
}
|
||||||
m_pModel->m_MaterialLib.push_back( name );
|
m_pModel->m_MaterialLib.push_back( name );
|
||||||
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
|
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -140,15 +140,13 @@ inline char_t getName( char_t it, char_t end, std::string &name )
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pStart = &( *it );
|
char *pStart = &( *it );
|
||||||
while( !isEndOfBuffer( it, end ) && !IsLineEnd( *it ) && !IsSpaceOrNewLine( *it ) ) {
|
while( !isEndOfBuffer( it, end ) && !IsLineEnd( *it )) {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*while( isEndOfBuffer( it, end ) || IsLineEnd( *it ) || IsSpaceOrNewLine( *it ) ) {
|
while(IsSpace( *it ) ) {
|
||||||
--it;
|
--it;
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
*/
|
|
||||||
// Get name
|
// Get name
|
||||||
// if there is no name, and the previous char is a separator, come back to start
|
// if there is no name, and the previous char is a separator, come back to start
|
||||||
while (&(*it) < pStart) {
|
while (&(*it) < pStart) {
|
||||||
|
|
|
@ -90,14 +90,16 @@ namespace
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
PLYImporter::PLYImporter()
|
PLYImporter::PLYImporter()
|
||||||
: mBuffer(),
|
: mBuffer()
|
||||||
pcDOM()
|
, pcDOM(){
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Destructor, private as well
|
// Destructor, private as well
|
||||||
PLYImporter::~PLYImporter()
|
PLYImporter::~PLYImporter() {
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the class can handle the format of the given file.
|
// Returns whether the class can handle the format of the given file.
|
||||||
|
@ -439,7 +441,7 @@ void PLYImporter::LoadTextureCoordinates(std::vector<aiVector2D>* pvOut)
|
||||||
PLY::ElementInstanceList* pcList = NULL;
|
PLY::ElementInstanceList* pcList = NULL;
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
|
|
||||||
// serach in the DOM for a vertex entry
|
// search in the DOM for a vertex entry
|
||||||
unsigned int _i = 0;
|
unsigned int _i = 0;
|
||||||
for (std::vector<PLY::Element>::const_iterator i = pcDOM->alElements.begin();
|
for (std::vector<PLY::Element>::const_iterator i = pcDOM->alElements.begin();
|
||||||
i != pcDOM->alElements.end();++i,++_i)
|
i != pcDOM->alElements.end();++i,++_i)
|
||||||
|
@ -653,7 +655,7 @@ void PLYImporter::LoadVertexColor(std::vector<aiColor4D>* pvOut)
|
||||||
unsigned int cnt = 0;
|
unsigned int cnt = 0;
|
||||||
PLY::ElementInstanceList* pcList = NULL;
|
PLY::ElementInstanceList* pcList = NULL;
|
||||||
|
|
||||||
// serach in the DOM for a vertex entry
|
// search in the DOM for a vertex entry
|
||||||
unsigned int _i = 0;
|
unsigned int _i = 0;
|
||||||
for (std::vector<PLY::Element>::const_iterator i = pcDOM->alElements.begin();
|
for (std::vector<PLY::Element>::const_iterator i = pcDOM->alElements.begin();
|
||||||
i != pcDOM->alElements.end();++i,++_i)
|
i != pcDOM->alElements.end();++i,++_i)
|
||||||
|
@ -752,13 +754,13 @@ void PLYImporter::LoadFaces(std::vector<PLY::Face>* pvOut)
|
||||||
// index of the vertex index list
|
// index of the vertex index list
|
||||||
unsigned int iProperty = 0xFFFFFFFF;
|
unsigned int iProperty = 0xFFFFFFFF;
|
||||||
PLY::EDataType eType = EDT_Char;
|
PLY::EDataType eType = EDT_Char;
|
||||||
bool bIsTristrip = false;
|
bool bIsTriStrip = false;
|
||||||
|
|
||||||
// index of the material index property
|
// index of the material index property
|
||||||
unsigned int iMaterialIndex = 0xFFFFFFFF;
|
unsigned int iMaterialIndex = 0xFFFFFFFF;
|
||||||
PLY::EDataType eType2 = EDT_Char;
|
PLY::EDataType eType2 = EDT_Char;
|
||||||
|
|
||||||
// serach in the DOM for a face entry
|
// search in the DOM for a face entry
|
||||||
unsigned int _i = 0;
|
unsigned int _i = 0;
|
||||||
for (std::vector<PLY::Element>::const_iterator i = pcDOM->alElements.begin();
|
for (std::vector<PLY::Element>::const_iterator i = pcDOM->alElements.begin();
|
||||||
i != pcDOM->alElements.end();++i,++_i)
|
i != pcDOM->alElements.end();++i,++_i)
|
||||||
|
@ -803,7 +805,7 @@ void PLYImporter::LoadFaces(std::vector<PLY::Face>* pvOut)
|
||||||
if (!(*a).bIsList)continue;
|
if (!(*a).bIsList)continue;
|
||||||
iProperty = _a;
|
iProperty = _a;
|
||||||
bOne = true;
|
bOne = true;
|
||||||
bIsTristrip = true;
|
bIsTriStrip = true;
|
||||||
eType = (*a).eType;
|
eType = (*a).eType;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +815,7 @@ void PLYImporter::LoadFaces(std::vector<PLY::Face>* pvOut)
|
||||||
// check whether we have at least one per-face information set
|
// check whether we have at least one per-face information set
|
||||||
if (pcList && bOne)
|
if (pcList && bOne)
|
||||||
{
|
{
|
||||||
if (!bIsTristrip)
|
if (!bIsTriStrip)
|
||||||
{
|
{
|
||||||
pvOut->reserve(pcList->alInstances.size());
|
pvOut->reserve(pcList->alInstances.size());
|
||||||
for (std::vector<ElementInstance>::const_iterator i = pcList->alInstances.begin();
|
for (std::vector<ElementInstance>::const_iterator i = pcList->alInstances.begin();
|
||||||
|
@ -957,7 +959,7 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial*>* pvOut)
|
||||||
unsigned int iOpacity = 0xFFFFFFFF;
|
unsigned int iOpacity = 0xFFFFFFFF;
|
||||||
PLY::EDataType eOpacity = EDT_Char;
|
PLY::EDataType eOpacity = EDT_Char;
|
||||||
|
|
||||||
// serach in the DOM for a vertex entry
|
// search in the DOM for a vertex entry
|
||||||
unsigned int _i = 0;
|
unsigned int _i = 0;
|
||||||
for (std::vector<PLY::Element>::const_iterator i = this->pcDOM->alElements.begin();
|
for (std::vector<PLY::Element>::const_iterator i = this->pcDOM->alElements.begin();
|
||||||
i != this->pcDOM->alElements.end();++i,++_i)
|
i != this->pcDOM->alElements.end();++i,++_i)
|
||||||
|
@ -1074,7 +1076,7 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial*>* pvOut)
|
||||||
pcHelper->AddProperty<aiColor4D>(&clrOut,1,AI_MATKEY_COLOR_AMBIENT);
|
pcHelper->AddProperty<aiColor4D>(&clrOut,1,AI_MATKEY_COLOR_AMBIENT);
|
||||||
|
|
||||||
// handle phong power and shading mode
|
// handle phong power and shading mode
|
||||||
int iMode;
|
int iMode = (int)aiShadingMode_Gouraud;
|
||||||
if (0xFFFFFFFF != iPhong) {
|
if (0xFFFFFFFF != iPhong) {
|
||||||
ai_real fSpec = PLY::PropertyInstance::ConvertTo<ai_real>(GetProperty((*i).alProperties, iPhong).avList.front(),ePhong);
|
ai_real fSpec = PLY::PropertyInstance::ConvertTo<ai_real>(GetProperty((*i).alProperties, iPhong).avList.front(),ePhong);
|
||||||
|
|
||||||
|
@ -1087,9 +1089,7 @@ void PLYImporter::LoadMaterial(std::vector<aiMaterial*>* pvOut)
|
||||||
|
|
||||||
iMode = (int)aiShadingMode_Phong;
|
iMode = (int)aiShadingMode_Phong;
|
||||||
}
|
}
|
||||||
else iMode = (int)aiShadingMode_Gouraud;
|
|
||||||
}
|
}
|
||||||
else iMode = (int)aiShadingMode_Gouraud;
|
|
||||||
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
|
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
|
||||||
|
|
||||||
// handle opacity
|
// handle opacity
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct aiNode;
|
||||||
struct aiMaterial;
|
struct aiMaterial;
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
|
||||||
using namespace PLY;
|
using namespace PLY;
|
||||||
|
|
|
@ -53,9 +53,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
PLY::EDataType PLY::Property::ParseDataType(const char* pCur,const char** pCurOut)
|
PLY::EDataType PLY::Property::ParseDataType(const char* pCur,const char** pCurOut) {
|
||||||
{
|
ai_assert( NULL != pCur );
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCurOut );
|
||||||
|
|
||||||
PLY::EDataType eOut = PLY::EDT_INVALID;
|
PLY::EDataType eOut = PLY::EDT_INVALID;
|
||||||
|
|
||||||
if (TokenMatch(pCur,"char",4) ||
|
if (TokenMatch(pCur,"char",4) ||
|
||||||
|
@ -100,33 +101,25 @@ PLY::EDataType PLY::Property::ParseDataType(const char* pCur,const char** pCurOu
|
||||||
DefaultLogger::get()->info("Found unknown data type in PLY file. This is OK");
|
DefaultLogger::get()->info("Found unknown data type in PLY file. This is OK");
|
||||||
}
|
}
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return eOut;
|
return eOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
PLY::ESemantic PLY::Property::ParseSemantic(const char* pCur,const char** pCurOut)
|
PLY::ESemantic PLY::Property::ParseSemantic(const char* pCur,const char** pCurOut) {
|
||||||
{
|
ai_assert (NULL != pCur );
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCurOut );
|
||||||
|
|
||||||
PLY::ESemantic eOut = PLY::EST_INVALID;
|
PLY::ESemantic eOut = PLY::EST_INVALID;
|
||||||
if (TokenMatch(pCur,"red",3))
|
if (TokenMatch(pCur,"red",3)) {
|
||||||
{
|
|
||||||
eOut = PLY::EST_Red;
|
eOut = PLY::EST_Red;
|
||||||
}
|
} else if (TokenMatch(pCur,"green",5)) {
|
||||||
else if (TokenMatch(pCur,"green",5))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_Green;
|
eOut = PLY::EST_Green;
|
||||||
}
|
} else if (TokenMatch(pCur,"blue",4)) {
|
||||||
else if (TokenMatch(pCur,"blue",4))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_Blue;
|
eOut = PLY::EST_Blue;
|
||||||
}
|
} else if (TokenMatch(pCur,"alpha",5)) {
|
||||||
else if (TokenMatch(pCur,"alpha",5))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_Alpha;
|
eOut = PLY::EST_Alpha;
|
||||||
}
|
} else if (TokenMatch(pCur,"vertex_index",12) || TokenMatch(pCur,"vertex_indices",14)) {
|
||||||
else if (TokenMatch(pCur,"vertex_index",12) || TokenMatch(pCur,"vertex_indices",14))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_VertexIndex;
|
eOut = PLY::EST_VertexIndex;
|
||||||
}
|
}
|
||||||
else if (TokenMatch(pCur,"material_index",14))
|
else if (TokenMatch(pCur,"material_index",14))
|
||||||
|
@ -213,29 +206,17 @@ PLY::ESemantic PLY::Property::ParseSemantic(const char* pCur,const char** pCurOu
|
||||||
else if (TokenMatch(pCur,"x",1))
|
else if (TokenMatch(pCur,"x",1))
|
||||||
{
|
{
|
||||||
eOut = PLY::EST_XCoord;
|
eOut = PLY::EST_XCoord;
|
||||||
}
|
} else if (TokenMatch(pCur,"y",1)) {
|
||||||
else if (TokenMatch(pCur,"y",1))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_YCoord;
|
eOut = PLY::EST_YCoord;
|
||||||
}
|
} else if (TokenMatch(pCur,"z",1)) {
|
||||||
else if (TokenMatch(pCur,"z",1))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_ZCoord;
|
eOut = PLY::EST_ZCoord;
|
||||||
}
|
} else if (TokenMatch(pCur,"nx",2)) {
|
||||||
else if (TokenMatch(pCur,"nx",2))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_XNormal;
|
eOut = PLY::EST_XNormal;
|
||||||
}
|
} else if (TokenMatch(pCur,"ny",2)) {
|
||||||
else if (TokenMatch(pCur,"ny",2))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_YNormal;
|
eOut = PLY::EST_YNormal;
|
||||||
}
|
} else if (TokenMatch(pCur,"nz",2)) {
|
||||||
else if (TokenMatch(pCur,"nz",2))
|
|
||||||
{
|
|
||||||
eOut = PLY::EST_ZNormal;
|
eOut = PLY::EST_ZNormal;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
DefaultLogger::get()->info("Found unknown property semantic in file. This is ok");
|
DefaultLogger::get()->info("Found unknown property semantic in file. This is ok");
|
||||||
SkipLine(&pCur);
|
SkipLine(&pCur);
|
||||||
}
|
}
|
||||||
|
@ -248,7 +229,8 @@ bool PLY::Property::ParseProperty (const char* pCur,
|
||||||
const char** pCurOut,
|
const char** pCurOut,
|
||||||
PLY::Property* pOut)
|
PLY::Property* pOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
|
||||||
// Forms supported:
|
// Forms supported:
|
||||||
// "property float x"
|
// "property float x"
|
||||||
|
@ -256,7 +238,9 @@ bool PLY::Property::ParseProperty (const char* pCur,
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
// skip leading spaces
|
// skip leading spaces
|
||||||
if (!SkipSpaces(pCur,&pCur))return false;
|
if (!SkipSpaces(pCur,&pCur)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// skip the "property" string at the beginning
|
// skip the "property" string at the beginning
|
||||||
if (!TokenMatch(pCur,"property",8))
|
if (!TokenMatch(pCur,"property",8))
|
||||||
|
@ -265,7 +249,9 @@ bool PLY::Property::ParseProperty (const char* pCur,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// get next word
|
// get next word
|
||||||
if (!SkipSpaces(pCur,&pCur))return false;
|
if (!SkipSpaces(pCur,&pCur)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (TokenMatch(pCur,"list",4))
|
if (TokenMatch(pCur,"list",4))
|
||||||
{
|
{
|
||||||
pOut->bIsList = true;
|
pOut->bIsList = true;
|
||||||
|
@ -313,6 +299,7 @@ bool PLY::Property::ParseProperty (const char* pCur,
|
||||||
|
|
||||||
SkipSpacesAndLineEnd(pCur,&pCur);
|
SkipSpacesAndLineEnd(pCur,&pCur);
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,6 +337,7 @@ PLY::EElementSemantic PLY::Element::ParseSemantic(const char* pCur,
|
||||||
eOut = PLY::EEST_Material;
|
eOut = PLY::EEST_Material;
|
||||||
}
|
}
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return eOut;
|
return eOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,13 +346,17 @@ bool PLY::Element::ParseElement (const char* pCur,
|
||||||
const char** pCurOut,
|
const char** pCurOut,
|
||||||
PLY::Element* pOut)
|
PLY::Element* pOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != pOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != pOut );
|
||||||
|
|
||||||
// Example format: "element vertex 8"
|
// Example format: "element vertex 8"
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
// skip leading spaces
|
// skip leading spaces
|
||||||
if (!SkipSpaces(&pCur))return false;
|
if (!SkipSpaces(&pCur)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// skip the "element" string at the beginning
|
// skip the "element" string at the beginning
|
||||||
if (!TokenMatch(pCur,"element",7))
|
if (!TokenMatch(pCur,"element",7))
|
||||||
|
@ -405,6 +397,7 @@ bool PLY::Element::ParseElement (const char* pCur,
|
||||||
pOut->alProperties.push_back(prop);
|
pOut->alProperties.push_back(prop);
|
||||||
}
|
}
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,30 +405,35 @@ bool PLY::Element::ParseElement (const char* pCur,
|
||||||
bool PLY::DOM::SkipComments (const char* pCur,
|
bool PLY::DOM::SkipComments (const char* pCur,
|
||||||
const char** pCurOut)
|
const char** pCurOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
// skip spaces
|
// skip spaces
|
||||||
if (!SkipSpaces(pCur,&pCur))return false;
|
if (!SkipSpaces(pCur,&pCur)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (TokenMatch(pCur,"comment",7))
|
if (TokenMatch(pCur,"comment",7))
|
||||||
{
|
{
|
||||||
if ( !IsLineEnd(pCur[-1]) )
|
if ( !IsLineEnd(pCur[-1]) )
|
||||||
{
|
{
|
||||||
SkipLine(pCur,&pCur);
|
SkipLine(pCur,&pCur);
|
||||||
}
|
}
|
||||||
SkipComments(pCur,&pCur);
|
SkipComments(pCur,&pCur);
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary)
|
bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary) {
|
||||||
{
|
ai_assert( NULL != pCur );
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCurOut );
|
||||||
|
|
||||||
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
|
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
|
||||||
|
|
||||||
// after ply and format line
|
// after ply and format line
|
||||||
|
@ -479,7 +477,8 @@ bool PLY::DOM::ParseElementInstanceLists (
|
||||||
const char* pCur,
|
const char* pCur,
|
||||||
const char** pCurOut)
|
const char** pCurOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
|
||||||
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin");
|
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin");
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
@ -507,7 +506,8 @@ bool PLY::DOM::ParseElementInstanceListsBinary (
|
||||||
const char** pCurOut,
|
const char** pCurOut,
|
||||||
bool p_bBE)
|
bool p_bBE)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut);
|
||||||
|
|
||||||
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin");
|
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin");
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
@ -532,7 +532,8 @@ bool PLY::DOM::ParseElementInstanceListsBinary (
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE)
|
bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin");
|
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin");
|
||||||
|
|
||||||
|
@ -580,7 +581,10 @@ bool PLY::ElementInstanceList::ParseInstanceList (
|
||||||
const PLY::Element* pcElement,
|
const PLY::Element* pcElement,
|
||||||
PLY::ElementInstanceList* p_pcOut)
|
PLY::ElementInstanceList* p_pcOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != pcElement && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != pcElement );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
if (EEST_INVALID == pcElement->eSemantic || pcElement->alProperties.empty())
|
if (EEST_INVALID == pcElement->eSemantic || pcElement->alProperties.empty())
|
||||||
{
|
{
|
||||||
|
@ -614,7 +618,10 @@ bool PLY::ElementInstanceList::ParseInstanceListBinary (
|
||||||
PLY::ElementInstanceList* p_pcOut,
|
PLY::ElementInstanceList* p_pcOut,
|
||||||
bool p_bBE /* = false */)
|
bool p_bBE /* = false */)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != pcElement && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != pcElement );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
// we can add special handling code for unknown element semantics since
|
// we can add special handling code for unknown element semantics since
|
||||||
// we can't skip it as a whole block (we don't know its exact size
|
// we can't skip it as a whole block (we don't know its exact size
|
||||||
|
@ -636,9 +643,14 @@ bool PLY::ElementInstance::ParseInstance (
|
||||||
const PLY::Element* pcElement,
|
const PLY::Element* pcElement,
|
||||||
PLY::ElementInstance* p_pcOut)
|
PLY::ElementInstance* p_pcOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != pcElement && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != pcElement );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
if (!SkipSpaces(pCur, &pCur))return false;
|
if (!SkipSpaces(pCur, &pCur)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// allocate enough storage
|
// allocate enough storage
|
||||||
p_pcOut->alProperties.resize(pcElement->alProperties.size());
|
p_pcOut->alProperties.resize(pcElement->alProperties.size());
|
||||||
|
@ -671,7 +683,10 @@ bool PLY::ElementInstance::ParseInstanceBinary (
|
||||||
PLY::ElementInstance* p_pcOut,
|
PLY::ElementInstance* p_pcOut,
|
||||||
bool p_bBE /* = false */)
|
bool p_bBE /* = false */)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != pcElement && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != pcElement );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
// allocate enough storage
|
// allocate enough storage
|
||||||
p_pcOut->alProperties.resize(pcElement->alProperties.size());
|
p_pcOut->alProperties.resize(pcElement->alProperties.size());
|
||||||
|
@ -696,12 +711,17 @@ bool PLY::ElementInstance::ParseInstanceBinary (
|
||||||
bool PLY::PropertyInstance::ParseInstance (const char* pCur,const char** pCurOut,
|
bool PLY::PropertyInstance::ParseInstance (const char* pCur,const char** pCurOut,
|
||||||
const PLY::Property* prop, PLY::PropertyInstance* p_pcOut)
|
const PLY::Property* prop, PLY::PropertyInstance* p_pcOut)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != prop && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != prop );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
// skip spaces at the beginning
|
// skip spaces at the beginning
|
||||||
if (!SkipSpaces(pCur, &pCur))return false;
|
if (!SkipSpaces(pCur, &pCur)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (prop->bIsList)
|
if (prop->bIsList)
|
||||||
{
|
{
|
||||||
|
@ -741,7 +761,10 @@ bool PLY::PropertyInstance::ParseInstanceBinary (
|
||||||
PLY::PropertyInstance* p_pcOut,
|
PLY::PropertyInstance* p_pcOut,
|
||||||
bool p_bBE)
|
bool p_bBE)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != prop && NULL != p_pcOut);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != prop );
|
||||||
|
ai_assert( NULL != p_pcOut );
|
||||||
|
|
||||||
if (prop->bIsList)
|
if (prop->bIsList)
|
||||||
{
|
{
|
||||||
|
@ -770,8 +793,7 @@ bool PLY::PropertyInstance::ParseInstanceBinary (
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
PLY::PropertyInstance::ValueUnion PLY::PropertyInstance::DefaultValue(
|
PLY::PropertyInstance::ValueUnion PLY::PropertyInstance::DefaultValue( PLY::EDataType eType )
|
||||||
PLY::EDataType eType)
|
|
||||||
{
|
{
|
||||||
PLY::PropertyInstance::ValueUnion out;
|
PLY::PropertyInstance::ValueUnion out;
|
||||||
|
|
||||||
|
@ -798,7 +820,9 @@ bool PLY::PropertyInstance::ParseValue(
|
||||||
PLY::EDataType eType,
|
PLY::EDataType eType,
|
||||||
PLY::PropertyInstance::ValueUnion* out)
|
PLY::PropertyInstance::ValueUnion* out)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != out);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != out );
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
@ -827,7 +851,6 @@ bool PLY::PropertyInstance::ParseValue(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDT_Double:
|
case EDT_Double:
|
||||||
|
|
||||||
double d;
|
double d;
|
||||||
pCur = fast_atoreal_move<double>(pCur,d);
|
pCur = fast_atoreal_move<double>(pCur,d);
|
||||||
out->fDouble = (double)d;
|
out->fDouble = (double)d;
|
||||||
|
@ -835,8 +858,10 @@ bool PLY::PropertyInstance::ParseValue(
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = false;
|
ret = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -848,7 +873,9 @@ bool PLY::PropertyInstance::ParseValueBinary(
|
||||||
PLY::PropertyInstance::ValueUnion* out,
|
PLY::PropertyInstance::ValueUnion* out,
|
||||||
bool p_bBE)
|
bool p_bBE)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pCur && NULL != pCurOut && NULL != out);
|
ai_assert( NULL != pCur );
|
||||||
|
ai_assert( NULL != pCurOut );
|
||||||
|
ai_assert( NULL != out );
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
switch (eType)
|
switch (eType)
|
||||||
|
@ -925,6 +952,7 @@ bool PLY::PropertyInstance::ParseValueBinary(
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
*pCurOut = pCur;
|
*pCurOut = pCur;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,12 +290,12 @@ private:
|
||||||
throw DeadlyImportError("End of file or stream limit was reached");
|
throw DeadlyImportError("End of file or stream limit was reached");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __arm__
|
///*#ifdef __arm__
|
||||||
T f;
|
T f;
|
||||||
::memcpy (&f, current, sizeof(T));
|
::memcpy (&f, current, sizeof(T));
|
||||||
#else
|
//#else*/
|
||||||
T f = *((const T*)current);
|
// T f = *((const T*)current);
|
||||||
#endif
|
//#endif
|
||||||
Intern :: Getter<SwapEndianess,T,RuntimeSwitch>() (&f,le);
|
Intern :: Getter<SwapEndianess,T,RuntimeSwitch>() (&f,le);
|
||||||
|
|
||||||
current += sizeof(T);
|
current += sizeof(T);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2016, assimp team
|
Copyright (c) 2006-2017, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
|
@ -1,80 +1,80 @@
|
||||||
// Microsoft Visual C++ generated resource script.
|
// Microsoft Visual C++ generated resource script.
|
||||||
//
|
//
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "..\..\revision.h"
|
#include "..\..\revision.h"
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
//
|
//
|
||||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Deutsch (Deutschland) resources
|
// Deutsch (Deutschland) resources
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||||
#pragma code_page(1252)
|
#pragma code_page(1252)
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Version
|
// Version
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,1,SVNRevision, 0
|
FILEVERSION 1,1,SVNRevision, 0
|
||||||
PRODUCTVERSION 1,1,SVNRevision,0
|
PRODUCTVERSION 1,1,SVNRevision,0
|
||||||
FILEFLAGSMASK 0x17L
|
FILEFLAGSMASK 0x17L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
#else
|
#else
|
||||||
FILEFLAGS 0x0L
|
FILEFLAGS 0x0L
|
||||||
#endif
|
#endif
|
||||||
FILEOS 0x4L
|
FILEOS 0x4L
|
||||||
FILETYPE 0x7L
|
FILETYPE 0x7L
|
||||||
FILESUBTYPE 0x0L
|
FILESUBTYPE 0x0L
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040704b0"
|
BLOCK "040704b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "Licensed under a 3-clause BSD license"
|
VALUE "Comments", "Licensed under a 3-clause BSD license"
|
||||||
VALUE "CompanyName", "assimp team"
|
VALUE "CompanyName", "assimp team"
|
||||||
VALUE "FileDescription", "Open Asset Import Library"
|
VALUE "FileDescription", "Open Asset Import Library"
|
||||||
VALUE "FileVersion", 1,1,SVNRevision,0
|
VALUE "FileVersion", 1,1,SVNRevision,0
|
||||||
VALUE "InternalName", "assimp "
|
VALUE "InternalName", "assimp "
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2006-2010"
|
VALUE "LegalCopyright", "Copyright (C) 2006-2010"
|
||||||
VALUE "OriginalFilename", "assimpNN.dll"
|
VALUE "OriginalFilename", "assimpNN.dll"
|
||||||
VALUE "ProductName", "Open Asset Import Library"
|
VALUE "ProductName", "Open Asset Import Library"
|
||||||
VALUE "ProductVersion", 1,1,SVNRevision,0
|
VALUE "ProductVersion", 1,1,SVNRevision,0
|
||||||
,0
|
,0
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x407, 1200
|
VALUE "Translation", 0x407, 1200
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // Deutsch (Deutschland) resources
|
#endif // Deutsch (Deutschland) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
#ifndef APSTUDIO_INVOKED
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Generated from the TEXTINCLUDE 3 resource.
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
//
|
//
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#endif // not APSTUDIO_INVOKED
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
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.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
|
aiNode::aiNode()
|
||||||
|
: mName("")
|
||||||
|
, mParent(NULL)
|
||||||
|
, mNumChildren(0)
|
||||||
|
, mChildren(NULL)
|
||||||
|
, mNumMeshes(0)
|
||||||
|
, mMeshes(NULL)
|
||||||
|
, mMetaData(NULL) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
aiNode::aiNode(const std::string& name)
|
||||||
|
: mName(name)
|
||||||
|
, mParent(NULL)
|
||||||
|
, mNumChildren(0)
|
||||||
|
, mChildren(NULL)
|
||||||
|
, mNumMeshes(0)
|
||||||
|
, mMeshes(NULL)
|
||||||
|
, mMetaData(NULL) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Destructor */
|
||||||
|
aiNode::~aiNode() {
|
||||||
|
// delete all children recursively
|
||||||
|
// to make sure we won't crash if the data is invalid ...
|
||||||
|
if (mChildren && mNumChildren)
|
||||||
|
{
|
||||||
|
for (unsigned int a = 0; a < mNumChildren; a++)
|
||||||
|
delete mChildren[a];
|
||||||
|
}
|
||||||
|
delete[] mChildren;
|
||||||
|
delete[] mMeshes;
|
||||||
|
delete mMetaData;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aiNode *aiNode::FindNode(const char* name) const {
|
||||||
|
if (nullptr == name) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (!::strcmp(mName.data, name)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < mNumChildren; ++i) {
|
||||||
|
const aiNode* const p = mChildren[i]->FindNode(name);
|
||||||
|
if (p) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// there is definitely no sub-node with this name
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
aiNode *aiNode::FindNode(const char* name) {
|
||||||
|
if (!::strcmp(mName.data, name))return this;
|
||||||
|
for (unsigned int i = 0; i < mNumChildren; ++i)
|
||||||
|
{
|
||||||
|
aiNode* const p = mChildren[i]->FindNode(name);
|
||||||
|
if (p) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// there is definitely no sub-node with this name
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void aiNode::addChildren(unsigned int numChildren, aiNode **children) {
|
||||||
|
if (nullptr == children || 0 == numChildren) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < numChildren; i++) {
|
||||||
|
aiNode *child = children[i];
|
||||||
|
if (nullptr != child) {
|
||||||
|
child->mParent = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mNumChildren > 0) {
|
||||||
|
aiNode **tmp = new aiNode*[mNumChildren];
|
||||||
|
::memcpy(tmp, mChildren, sizeof(aiNode*) * mNumChildren);
|
||||||
|
delete[] mChildren;
|
||||||
|
mChildren = new aiNode*[mNumChildren + numChildren];
|
||||||
|
::memcpy(mChildren, tmp, sizeof(aiNode*) * mNumChildren);
|
||||||
|
::memcpy(&mChildren[mNumChildren], children, sizeof(aiNode*)* numChildren);
|
||||||
|
mNumChildren += numChildren;
|
||||||
|
delete[] tmp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mChildren = new aiNode*[numChildren];
|
||||||
|
for (unsigned int i = 0; i < numChildren; i++) {
|
||||||
|
mChildren[i] = children[i];
|
||||||
|
}
|
||||||
|
mNumChildren = numChildren;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,72 +1,72 @@
|
||||||
/*
|
/*
|
||||||
* Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
|
* Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
|
||||||
* http://code.google.com/p/poly2tri/
|
* http://code.google.com/p/poly2tri/
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* * Neither the name of Poly2Tri nor the names of its contributors may be
|
* * Neither the name of Poly2Tri nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software without specific
|
* used to endorse or promote products derived from this software without specific
|
||||||
* prior written permission.
|
* prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include "cdt.h"
|
#include "cdt.h"
|
||||||
|
|
||||||
namespace p2t {
|
namespace p2t {
|
||||||
|
|
||||||
CDT::CDT(std::vector<Point*> polyline)
|
CDT::CDT(std::vector<Point*> polyline)
|
||||||
{
|
{
|
||||||
sweep_context_ = new SweepContext(polyline);
|
sweep_context_ = new SweepContext(polyline);
|
||||||
sweep_ = new Sweep;
|
sweep_ = new Sweep;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDT::AddHole(std::vector<Point*> polyline)
|
void CDT::AddHole(std::vector<Point*> polyline)
|
||||||
{
|
{
|
||||||
sweep_context_->AddHole(polyline);
|
sweep_context_->AddHole(polyline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDT::AddPoint(Point* point) {
|
void CDT::AddPoint(Point* point) {
|
||||||
sweep_context_->AddPoint(point);
|
sweep_context_->AddPoint(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDT::Triangulate()
|
void CDT::Triangulate()
|
||||||
{
|
{
|
||||||
sweep_->Triangulate(*sweep_context_);
|
sweep_->Triangulate(*sweep_context_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<p2t::Triangle*> CDT::GetTriangles()
|
std::vector<p2t::Triangle*> CDT::GetTriangles()
|
||||||
{
|
{
|
||||||
return sweep_context_->GetTriangles();
|
return sweep_context_->GetTriangles();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<p2t::Triangle*> CDT::GetMap()
|
std::list<p2t::Triangle*> CDT::GetMap()
|
||||||
{
|
{
|
||||||
return sweep_context_->GetMap();
|
return sweep_context_->GetMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
CDT::~CDT()
|
CDT::~CDT()
|
||||||
{
|
{
|
||||||
delete sweep_context_;
|
delete sweep_context_;
|
||||||
delete sweep_;
|
delete sweep_;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -296,8 +296,7 @@ protected:
|
||||||
ExporterPimpl* pimpl;
|
ExporterPimpl* pimpl;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ASSIMP_API ExportProperties
|
class ASSIMP_API ExportProperties {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
// Data type to store the key hash
|
// Data type to store the key hash
|
||||||
typedef unsigned int KeyType;
|
typedef unsigned int KeyType;
|
||||||
|
|
|
@ -58,7 +58,6 @@ namespace Assimp {
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// Public interface to Assimp
|
// Public interface to Assimp
|
||||||
class Importer;
|
class Importer;
|
||||||
class Exporter; // export.hpp
|
|
||||||
class IOStream;
|
class IOStream;
|
||||||
class IOSystem;
|
class IOSystem;
|
||||||
class ProgressHandler;
|
class ProgressHandler;
|
||||||
|
@ -77,7 +76,6 @@ namespace Assimp {
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// Holy stuff, only for members of the high council of the Jedi.
|
// Holy stuff, only for members of the high council of the Jedi.
|
||||||
class ImporterPimpl;
|
class ImporterPimpl;
|
||||||
class ExporterPimpl; // export.hpp
|
|
||||||
} //! namespace Assimp
|
} //! namespace Assimp
|
||||||
|
|
||||||
#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
|
#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
|
||||||
|
|
|
@ -190,6 +190,39 @@ struct aiMeshKey
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
/** Binds a morph anim mesh to a specific point in time. */
|
||||||
|
struct aiMeshMorphKey
|
||||||
|
{
|
||||||
|
/** The time of this key */
|
||||||
|
double mTime;
|
||||||
|
|
||||||
|
/** The values and weights at the time of this key */
|
||||||
|
unsigned int *mValues;
|
||||||
|
double *mWeights;
|
||||||
|
|
||||||
|
/** The number of values and weights */
|
||||||
|
unsigned int mNumValuesAndWeights;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
aiMeshMorphKey()
|
||||||
|
: mTime(0.0)
|
||||||
|
, mValues(NULL)
|
||||||
|
, mWeights(NULL)
|
||||||
|
, mNumValuesAndWeights(0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
~aiMeshMorphKey()
|
||||||
|
{
|
||||||
|
if (mNumValuesAndWeights && mValues && mWeights) {
|
||||||
|
delete [] mValues;
|
||||||
|
delete [] mWeights;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Defines how an animation channel behaves outside the defined time
|
/** Defines how an animation channel behaves outside the defined time
|
||||||
* range. This corresponds to aiNodeAnim::mPreState and
|
* range. This corresponds to aiNodeAnim::mPreState and
|
||||||
|
@ -340,6 +373,37 @@ struct aiMeshAnim
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
/** Describes a morphing animation of a given mesh. */
|
||||||
|
struct aiMeshMorphAnim
|
||||||
|
{
|
||||||
|
/** Name of the mesh to be animated. An empty string is not allowed,
|
||||||
|
* animated meshes need to be named (not necessarily uniquely,
|
||||||
|
* the name can basically serve as wildcard to select a group
|
||||||
|
* of meshes with similar animation setup)*/
|
||||||
|
C_STRUCT aiString mName;
|
||||||
|
|
||||||
|
/** Size of the #mKeys array. Must be 1, at least. */
|
||||||
|
unsigned int mNumKeys;
|
||||||
|
|
||||||
|
/** Key frames of the animation. May not be NULL. */
|
||||||
|
C_STRUCT aiMeshMorphKey* mKeys;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
aiMeshMorphAnim()
|
||||||
|
: mNumKeys()
|
||||||
|
, mKeys()
|
||||||
|
{}
|
||||||
|
|
||||||
|
~aiMeshMorphAnim()
|
||||||
|
{
|
||||||
|
delete[] mKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** An animation consists of key-frame data for a number of nodes. For
|
/** An animation consists of key-frame data for a number of nodes. For
|
||||||
* each node affected by the animation a separate series of data is given.*/
|
* each node affected by the animation a separate series of data is given.*/
|
||||||
|
@ -372,6 +436,14 @@ struct aiAnimation {
|
||||||
* The array is mNumMeshChannels in size. */
|
* The array is mNumMeshChannels in size. */
|
||||||
C_STRUCT aiMeshAnim** mMeshChannels;
|
C_STRUCT aiMeshAnim** mMeshChannels;
|
||||||
|
|
||||||
|
/** The number of mesh animation channels. Each channel affects
|
||||||
|
* a single mesh and defines morphing animation. */
|
||||||
|
unsigned int mNumMorphMeshChannels;
|
||||||
|
|
||||||
|
/** The morph mesh animation channels. Each channel affects a single mesh.
|
||||||
|
* The array is mNumMorphMeshChannels in size. */
|
||||||
|
C_STRUCT aiMeshMorphAnim **mMorphMeshChannels;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
aiAnimation()
|
aiAnimation()
|
||||||
: mDuration(-1.)
|
: mDuration(-1.)
|
||||||
|
@ -379,7 +451,9 @@ struct aiAnimation {
|
||||||
, mNumChannels(0)
|
, mNumChannels(0)
|
||||||
, mChannels(NULL)
|
, mChannels(NULL)
|
||||||
, mNumMeshChannels(0)
|
, mNumMeshChannels(0)
|
||||||
, mMeshChannels(NULL) {
|
, mMeshChannels(NULL)
|
||||||
|
, mNumMorphMeshChannels(0)
|
||||||
|
, mMorphMeshChannels(NULL) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +473,13 @@ struct aiAnimation {
|
||||||
|
|
||||||
delete [] mMeshChannels;
|
delete [] mMeshChannels;
|
||||||
}
|
}
|
||||||
|
if (mNumMorphMeshChannels && mMorphMeshChannels) {
|
||||||
|
for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) {
|
||||||
|
delete mMorphMeshChannels[a];
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] mMorphMeshChannels;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_COLOR4D_H_INC
|
#ifndef AI_COLOR4D_H_INC
|
||||||
#define AI_COLOR4D_H_INC
|
#define AI_COLOR4D_H_INC
|
||||||
|
|
||||||
#include "./Compiler/pushpack1.h"
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -89,7 +88,7 @@ public:
|
||||||
|
|
||||||
// Red, green, blue and alpha color values
|
// Red, green, blue and alpha color values
|
||||||
TReal r, g, b, a;
|
TReal r, g, b, a;
|
||||||
} PACK_STRUCT; // !struct aiColor4D
|
}; // !struct aiColor4D
|
||||||
|
|
||||||
typedef aiColor4t<ai_real> aiColor4D;
|
typedef aiColor4t<ai_real> aiColor4D;
|
||||||
|
|
||||||
|
@ -97,10 +96,8 @@ typedef aiColor4t<ai_real> aiColor4D;
|
||||||
|
|
||||||
struct aiColor4D {
|
struct aiColor4D {
|
||||||
ai_real r, g, b, a;
|
ai_real r, g, b, a;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#include "./Compiler/poppack1.h"
|
|
||||||
|
|
||||||
#endif // AI_COLOR4D_H_INC
|
#endif // AI_COLOR4D_H_INC
|
||||||
|
|
|
@ -76,12 +76,34 @@ AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator /= (TReal f)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
AI_FORCE_INLINE TReal aiColor4t<TReal>::operator[](unsigned int i) const {
|
AI_FORCE_INLINE TReal aiColor4t<TReal>::operator[](unsigned int i) const {
|
||||||
return *(&r + i);
|
//return *(&r + i);
|
||||||
|
switch ( i ) {
|
||||||
|
case 0:
|
||||||
|
return r;
|
||||||
|
case 1:
|
||||||
|
return g;
|
||||||
|
case 2:
|
||||||
|
return b;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
AI_FORCE_INLINE TReal& aiColor4t<TReal>::operator[](unsigned int i) {
|
AI_FORCE_INLINE TReal& aiColor4t<TReal>::operator[](unsigned int i) {
|
||||||
return *(&r + i);
|
// return *(&r + i);
|
||||||
|
switch ( i ) {
|
||||||
|
case 0:
|
||||||
|
return r;
|
||||||
|
case 1:
|
||||||
|
return g;
|
||||||
|
case 2:
|
||||||
|
return b;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
|
|
|
@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_MATRIX3X3_H_INC
|
#ifndef AI_MATRIX3X3_H_INC
|
||||||
#define AI_MATRIX3X3_H_INC
|
#define AI_MATRIX3X3_H_INC
|
||||||
|
|
||||||
#include "./Compiler/pushpack1.h"
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -153,7 +152,7 @@ public:
|
||||||
/** @brief A function for creating a rotation matrix that rotates a
|
/** @brief A function for creating a rotation matrix that rotates a
|
||||||
* vector called "from" into another vector called "to".
|
* vector called "from" into another vector called "to".
|
||||||
* Input : from[3], to[3] which both must be *normalized* non-zero vectors
|
* Input : from[3], to[3] which both must be *normalized* non-zero vectors
|
||||||
* Output: mtx[3][3] -- a 3x3 matrix in colum-major form
|
* Output: mtx[3][3] -- a 3x3 matrix in column-major form
|
||||||
* Authors: Tomas Möller, John Hughes
|
* Authors: Tomas Möller, John Hughes
|
||||||
* "Efficiently Building a Matrix to Rotate One Vector to Another"
|
* "Efficiently Building a Matrix to Rotate One Vector to Another"
|
||||||
* Journal of Graphics Tools, 4(4):1-4, 1999
|
* Journal of Graphics Tools, 4(4):1-4, 1999
|
||||||
|
@ -165,7 +164,7 @@ public:
|
||||||
TReal a1, a2, a3;
|
TReal a1, a2, a3;
|
||||||
TReal b1, b2, b3;
|
TReal b1, b2, b3;
|
||||||
TReal c1, c2, c3;
|
TReal c1, c2, c3;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
typedef aiMatrix3x3t<ai_real> aiMatrix3x3;
|
typedef aiMatrix3x3t<ai_real> aiMatrix3x3;
|
||||||
|
|
||||||
|
@ -175,10 +174,8 @@ struct aiMatrix3x3 {
|
||||||
ai_real a1, a2, a3;
|
ai_real a1, a2, a3;
|
||||||
ai_real b1, b2, b3;
|
ai_real b1, b2, b3;
|
||||||
ai_real c1, c2, c3;
|
ai_real c1, c2, c3;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#include "./Compiler/poppack1.h"
|
|
||||||
|
|
||||||
#endif // AI_MATRIX3X3_H_INC
|
#endif // AI_MATRIX3X3_H_INC
|
||||||
|
|
|
@ -101,16 +101,34 @@ inline aiMatrix3x3t<TReal> aiMatrix3x3t<TReal>::operator* (const aiMatrix3x3t<TR
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex)
|
inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) {
|
||||||
{
|
switch ( p_iIndex ) {
|
||||||
return &this->a1 + p_iIndex * 3;
|
case 0:
|
||||||
|
return &a1;
|
||||||
|
case 1:
|
||||||
|
return &b1;
|
||||||
|
case 2:
|
||||||
|
return &c1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return &a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const
|
inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const {
|
||||||
{
|
switch ( p_iIndex ) {
|
||||||
return &this->a1 + p_iIndex * 3;
|
case 0:
|
||||||
|
return &a1;
|
||||||
|
case 1:
|
||||||
|
return &b1;
|
||||||
|
case 2:
|
||||||
|
return &c1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return &a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define AI_MATRIX4X4_H_INC
|
#define AI_MATRIX4X4_H_INC
|
||||||
|
|
||||||
#include "vector3.h"
|
#include "vector3.h"
|
||||||
#include "./Compiler/pushpack1.h"
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -257,7 +256,7 @@ public:
|
||||||
TReal b1, b2, b3, b4;
|
TReal b1, b2, b3, b4;
|
||||||
TReal c1, c2, c3, c4;
|
TReal c1, c2, c3, c4;
|
||||||
TReal d1, d2, d3, d4;
|
TReal d1, d2, d3, d4;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
typedef aiMatrix4x4t<ai_real> aiMatrix4x4;
|
typedef aiMatrix4x4t<ai_real> aiMatrix4x4;
|
||||||
|
|
||||||
|
@ -268,11 +267,9 @@ struct aiMatrix4x4 {
|
||||||
ai_real b1, b2, b3, b4;
|
ai_real b1, b2, b3, b4;
|
||||||
ai_real c1, c2, c3, c4;
|
ai_real c1, c2, c3, c4;
|
||||||
ai_real d1, d2, d3, d4;
|
ai_real d1, d2, d3, d4;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#include "./Compiler/poppack1.h"
|
|
||||||
|
|
||||||
#endif // AI_MATRIX4X4_H_INC
|
#endif // AI_MATRIX4X4_H_INC
|
||||||
|
|
|
@ -243,9 +243,19 @@ inline TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) {
|
||||||
if (p_iIndex > 3) {
|
if (p_iIndex > 3) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
switch ( p_iIndex ) {
|
||||||
// XXX this is UB. Has been for years. The fact that it works now does not make it better.
|
case 0:
|
||||||
return &this->a1 + p_iIndex * 4;
|
return &a1;
|
||||||
|
case 1:
|
||||||
|
return &b1;
|
||||||
|
case 2:
|
||||||
|
return &c1;
|
||||||
|
case 3:
|
||||||
|
return &d1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return &a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
@ -255,8 +265,19 @@ inline const TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX same
|
switch ( p_iIndex ) {
|
||||||
return &this->a1 + p_iIndex * 4;
|
case 0:
|
||||||
|
return &a1;
|
||||||
|
case 1:
|
||||||
|
return &b1;
|
||||||
|
case 2:
|
||||||
|
return &c1;
|
||||||
|
case 3:
|
||||||
|
return &d1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return &a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -378,6 +378,9 @@ struct aiAnimMesh
|
||||||
*/
|
*/
|
||||||
unsigned int mNumVertices;
|
unsigned int mNumVertices;
|
||||||
|
|
||||||
|
/** Weight of the AnimMesh. */
|
||||||
|
float mWeight;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
aiAnimMesh()
|
aiAnimMesh()
|
||||||
|
@ -446,6 +449,27 @@ struct aiAnimMesh
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
/** @brief Enumerates the methods of mesh morphing supported by Assimp.
|
||||||
|
*/
|
||||||
|
enum aiMorphingMethod
|
||||||
|
{
|
||||||
|
/** Interpolation between morph targets */
|
||||||
|
aiMorphingMethod_VERTEX_BLEND = 0x1,
|
||||||
|
|
||||||
|
/** Normalized morphing between morph targets */
|
||||||
|
aiMorphingMethod_MORPH_NORMALIZED = 0x2,
|
||||||
|
|
||||||
|
/** Relative morphing between morph targets */
|
||||||
|
aiMorphingMethod_MORPH_RELATIVE = 0x3,
|
||||||
|
|
||||||
|
/** This value is not used. It is just here to force the
|
||||||
|
* compiler to map this enum to a 32 Bit integer.
|
||||||
|
*/
|
||||||
|
#ifndef SWIG
|
||||||
|
_aiMorphingMethod_Force32Bit = INT_MAX
|
||||||
|
#endif
|
||||||
|
}; //! enum aiMorphingMethod
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief A mesh represents a geometry or model with a single material.
|
/** @brief A mesh represents a geometry or model with a single material.
|
||||||
|
@ -600,15 +624,18 @@ struct aiMesh
|
||||||
C_STRUCT aiString mName;
|
C_STRUCT aiString mName;
|
||||||
|
|
||||||
|
|
||||||
/** NOT CURRENTLY IN USE. The number of attachment meshes */
|
/** The number of attachment meshes. Note! Currently only works with Collada loader. */
|
||||||
unsigned int mNumAnimMeshes;
|
unsigned int mNumAnimMeshes;
|
||||||
|
|
||||||
/** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.
|
/** Attachment meshes for this mesh, for vertex-based animation.
|
||||||
* Attachment meshes carry replacement data for some of the
|
* Attachment meshes carry replacement data for some of the
|
||||||
* mesh'es vertex components (usually positions, normals). */
|
* mesh'es vertex components (usually positions, normals).
|
||||||
|
* Note! Currently only works with Collada loader.*/
|
||||||
C_STRUCT aiAnimMesh** mAnimMeshes;
|
C_STRUCT aiAnimMesh** mAnimMeshes;
|
||||||
|
|
||||||
|
/** Method of morphing when animeshes are specified. */
|
||||||
|
unsigned int mMethod;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
//! Default constructor. Initializes all members to 0
|
//! Default constructor. Initializes all members to 0
|
||||||
|
@ -733,7 +760,6 @@ struct aiMesh
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif //! extern "C"
|
#endif //! extern "C"
|
||||||
|
|
|
@ -69,7 +69,7 @@ extern "C" {
|
||||||
* the imported scene does consist of only a single root node without children.
|
* the imported scene does consist of only a single root node without children.
|
||||||
*/
|
*/
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct aiNode
|
struct ASSIMP_API aiNode
|
||||||
{
|
{
|
||||||
/** The name of the node.
|
/** The name of the node.
|
||||||
*
|
*
|
||||||
|
@ -124,47 +124,13 @@ struct aiNode
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
aiNode()
|
aiNode();
|
||||||
// set all members to zero by default
|
|
||||||
: mName("")
|
|
||||||
, mParent(NULL)
|
|
||||||
, mNumChildren(0)
|
|
||||||
, mChildren(NULL)
|
|
||||||
, mNumMeshes(0)
|
|
||||||
, mMeshes(NULL)
|
|
||||||
, mMetaData(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Construction from a specific name */
|
/** Construction from a specific name */
|
||||||
explicit aiNode(const std::string& name)
|
explicit aiNode(const std::string& name);
|
||||||
// set all members to zero by default
|
|
||||||
: mName(name)
|
|
||||||
, mParent(NULL)
|
|
||||||
, mNumChildren(0)
|
|
||||||
, mChildren(NULL)
|
|
||||||
, mNumMeshes(0)
|
|
||||||
, mMeshes(NULL)
|
|
||||||
, mMetaData(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
~aiNode()
|
~aiNode();
|
||||||
{
|
|
||||||
// delete all children recursively
|
|
||||||
// to make sure we won't crash if the data is invalid ...
|
|
||||||
if (mChildren && mNumChildren)
|
|
||||||
{
|
|
||||||
for( unsigned int a = 0; a < mNumChildren; a++)
|
|
||||||
delete mChildren[a];
|
|
||||||
}
|
|
||||||
delete [] mChildren;
|
|
||||||
delete [] mMeshes;
|
|
||||||
delete mMetaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Searches for a node with a specific name, beginning at this
|
/** Searches for a node with a specific name, beginning at this
|
||||||
* nodes. Normally you will call this method on the root node
|
* nodes. Normally you will call this method on the root node
|
||||||
|
@ -173,46 +139,26 @@ struct aiNode
|
||||||
* @param name Name to search for
|
* @param name Name to search for
|
||||||
* @return NULL or a valid Node if the search was successful.
|
* @return NULL or a valid Node if the search was successful.
|
||||||
*/
|
*/
|
||||||
inline const aiNode* FindNode(const aiString& name) const
|
inline
|
||||||
{
|
const aiNode* FindNode(const aiString& name) const {
|
||||||
return FindNode(name.data);
|
return FindNode(name.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
inline aiNode* FindNode(const aiString& name)
|
aiNode* FindNode(const aiString& name) {
|
||||||
{
|
|
||||||
return FindNode(name.data);
|
return FindNode(name.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const aiNode* FindNode(const char* name) const;
|
||||||
|
|
||||||
inline const aiNode* FindNode(const char* name) const
|
aiNode* FindNode(const char* name);
|
||||||
{
|
|
||||||
if (!::strcmp( mName.data,name))return this;
|
|
||||||
for (unsigned int i = 0; i < mNumChildren;++i)
|
|
||||||
{
|
|
||||||
const aiNode* const p = mChildren[i]->FindNode(name);
|
|
||||||
if (p) {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// there is definitely no sub-node with this name
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline aiNode* FindNode(const char* name)
|
|
||||||
{
|
|
||||||
if (!::strcmp( mName.data,name))return this;
|
|
||||||
for (unsigned int i = 0; i < mNumChildren;++i)
|
|
||||||
{
|
|
||||||
aiNode* const p = mChildren[i]->FindNode(name);
|
|
||||||
if (p) {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// there is definitely no sub-node with this name
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Will add new children.
|
||||||
|
* @param numChildren Number of children to add.
|
||||||
|
* @param children The array with pointers showing to the children.
|
||||||
|
*/
|
||||||
|
void addChildren(unsigned int numChildren, aiNode **children);
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
# include <math.h>
|
# include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "./Compiler/pushpack1.h"
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -126,7 +125,7 @@ public:
|
||||||
const aiVector3t SymMul(const aiVector3t& o);
|
const aiVector3t SymMul(const aiVector3t& o);
|
||||||
|
|
||||||
TReal x, y, z;
|
TReal x, y, z;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef aiVector3t<ai_real> aiVector3D;
|
typedef aiVector3t<ai_real> aiVector3D;
|
||||||
|
@ -135,16 +134,12 @@ typedef aiVector3t<ai_real> aiVector3D;
|
||||||
|
|
||||||
struct aiVector3D {
|
struct aiVector3D {
|
||||||
ai_real x, y, z;
|
ai_real x, y, z;
|
||||||
} PACK_STRUCT;
|
};
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#include "./Compiler/poppack1.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // AI_VECTOR3D_H_INC
|
#endif // AI_VECTOR3D_H_INC
|
||||||
|
|
|
@ -141,12 +141,34 @@ AI_FORCE_INLINE aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatri
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const {
|
AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const {
|
||||||
return *(&x + i);
|
// return *(&x + i);
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
return x;
|
||||||
|
case 1:
|
||||||
|
return y;
|
||||||
|
case 2:
|
||||||
|
return z;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) {
|
AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) {
|
||||||
return *(&x + i);
|
// return *(&x + i);
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
return x;
|
||||||
|
case 1:
|
||||||
|
return y;
|
||||||
|
case 2:
|
||||||
|
return z;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
|
|
|
@ -46,7 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <android/api-level.h>
|
#include <android/api-level.h>
|
||||||
#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
|
#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
|
||||||
|
|
||||||
|
#include <libgen.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <android/asset_manager.h>
|
#include <android/asset_manager.h>
|
||||||
#include <android/asset_manager_jni.h>
|
#include <android/asset_manager_jni.h>
|
||||||
|
@ -100,6 +102,27 @@ void AndroidJNIIOSystem::AndroidActivityInit(ANativeActivity* activity)
|
||||||
mApkAssetManager = activity->assetManager;
|
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
|
// Extracts android asset
|
||||||
bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name)
|
bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name)
|
||||||
|
@ -131,6 +154,15 @@ bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name)
|
||||||
// Close
|
// Close
|
||||||
AAsset_close(asset);
|
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
|
// Prepare output buffer
|
||||||
std::ofstream assetExtracted(newPath.c_str(),
|
std::ofstream assetExtracted(newPath.c_str(),
|
||||||
std::ios::out | std::ios::binary);
|
std::ios::out | std::ios::binary);
|
||||||
|
|
|
@ -22,7 +22,7 @@ CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min)
|
||||||
CPP_DEV_TARGET=
|
CPP_DEV_TARGET=
|
||||||
CPP_STD_LIB_LIST=(libc++ libstdc++)
|
CPP_STD_LIB_LIST=(libc++ libstdc++)
|
||||||
CPP_STD_LIB=
|
CPP_STD_LIB=
|
||||||
CPP_STD_LIST=(c++03 c++11 c++14)
|
CPP_STD_LIST=(c++11 c++14)
|
||||||
CPP_STD=
|
CPP_STD=
|
||||||
|
|
||||||
function join { local IFS="$1"; shift; echo "$*"; }
|
function join { local IFS="$1"; shift; echo "$*"; }
|
||||||
|
|
|
@ -58,24 +58,16 @@ template_src = "BlenderScene.cpp.template"
|
||||||
# workaround for stackoverflowing when reading the linked list of scene objects
|
# workaround for stackoverflowing when reading the linked list of scene objects
|
||||||
# with the usual approach. See embedded notes for details.
|
# with the usual approach. See embedded notes for details.
|
||||||
Structure_Convert_Base_fullcode = """
|
Structure_Convert_Base_fullcode = """
|
||||||
template <> void Structure :: Convert<Base> (
|
template <> void Structure::Convert<Base>( Base& dest, const FileDatabase& db ) const {
|
||||||
Base& dest,
|
|
||||||
const FileDatabase& db
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
// note: as per https://github.com/assimp/assimp/issues/128,
|
// note: as per https://github.com/assimp/assimp/issues/128,
|
||||||
// reading the Object linked list recursively is prone to stack overflow.
|
// reading the Object linked list recursively is prone to stack overflow.
|
||||||
// This structure converter is therefore an hand-written exception that
|
// This structure converter is therefore an hand-written exception that
|
||||||
// does it iteratively.
|
// does it iteratively.
|
||||||
|
|
||||||
const int initial_pos = db.reader->GetCurrentPos();
|
const int initial_pos = db.reader->GetCurrentPos();
|
||||||
|
|
||||||
std::pair<Base*, int> todo = std::make_pair(&dest, initial_pos);
|
std::pair<Base*, int> todo = std::make_pair(&dest, initial_pos);
|
||||||
|
|
||||||
Base* saved_prev = NULL;
|
Base* saved_prev = NULL;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
Base& cur_dest = *todo.first;
|
Base& cur_dest = *todo.first;
|
||||||
db.reader->SetCurrentPos(todo.second);
|
db.reader->SetCurrentPos(todo.second);
|
||||||
|
|
||||||
|
@ -303,8 +295,3 @@ def main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ SET( TEST_SRCS
|
||||||
unit/utIssues.cpp
|
unit/utIssues.cpp
|
||||||
unit/utJoinVertices.cpp
|
unit/utJoinVertices.cpp
|
||||||
unit/utLimitBoneWeights.cpp
|
unit/utLimitBoneWeights.cpp
|
||||||
|
unit/utLWSImportExport.cpp
|
||||||
unit/utMaterialSystem.cpp
|
unit/utMaterialSystem.cpp
|
||||||
unit/utMatrix3x3.cpp
|
unit/utMatrix3x3.cpp
|
||||||
unit/utMatrix4x4.cpp
|
unit/utMatrix4x4.cpp
|
||||||
|
@ -103,6 +104,7 @@ SET( TEST_SRCS
|
||||||
unit/utSIBImporter.cpp
|
unit/utSIBImporter.cpp
|
||||||
unit/utObjImportExport.cpp
|
unit/utObjImportExport.cpp
|
||||||
unit/utPretransformVertices.cpp
|
unit/utPretransformVertices.cpp
|
||||||
|
unit/utPLYImportExport.cpp
|
||||||
unit/utRemoveComments.cpp
|
unit/utRemoveComments.cpp
|
||||||
unit/utRemoveComponent.cpp
|
unit/utRemoveComponent.cpp
|
||||||
unit/utRemoveRedundantMaterials.cpp
|
unit/utRemoveRedundantMaterials.cpp
|
||||||
|
@ -118,6 +120,7 @@ SET( TEST_SRCS
|
||||||
unit/utTypes.cpp
|
unit/utTypes.cpp
|
||||||
unit/utVertexTriangleAdjacency.cpp
|
unit/utVertexTriangleAdjacency.cpp
|
||||||
unit/utVersion.cpp
|
unit/utVersion.cpp
|
||||||
|
unit/utVector3.cpp
|
||||||
unit/utXImporterExporter.cpp
|
unit/utXImporterExporter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
g cube
|
||||||
|
|
||||||
|
v 0.0 0.0 0.0 124 110 120
|
||||||
|
v 0.0 0.0 1.0 24 0 121
|
||||||
|
v 0.0 1.0 0.0 4 0 44
|
||||||
|
v 0.0 1.0 1.0 224 0 10
|
||||||
|
v 1.0 0.0 0.0 24 200 25
|
||||||
|
v 1.0 0.0 1.0 124 10 56
|
||||||
|
v 1.0 1.0 0.0 78 10 50
|
||||||
|
v 1.0 1.0 1.0 23 0 200
|
||||||
|
|
||||||
|
vn 0.0 0.0 1.0
|
||||||
|
vn 0.0 0.0 -1.0
|
||||||
|
vn 0.0 1.0 0.0
|
||||||
|
vn 0.0 -1.0 0.0
|
||||||
|
vn 1.0 0.0 0.0
|
||||||
|
vn -1.0 0.0 0.0
|
||||||
|
|
||||||
|
f 1//2 7//2 5//2
|
||||||
|
f 1//2 3//2 7//2
|
||||||
|
f 1//6 4//6 3//6
|
||||||
|
f 1//6 2//6 4//6
|
||||||
|
f 3//3 8//3 7//3
|
||||||
|
f 3//3 4//3 8//3
|
||||||
|
f 5//5 7//5 8//5
|
||||||
|
f 5//5 8//5 6//5
|
||||||
|
f 1//4 5//4 6//4
|
||||||
|
f 1//4 6//4 2//4
|
||||||
|
f 2//1 6//1 8//1
|
||||||
|
f 2//1 8//1 4//1
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
||||||
|
ply
|
||||||
|
format ascii 1.0
|
||||||
|
comment VCGLIB generated
|
||||||
|
element vertex 3
|
||||||
|
property float x
|
||||||
|
property float y
|
||||||
|
property float z
|
||||||
|
property float red
|
||||||
|
property float green
|
||||||
|
property float blue
|
||||||
|
property float alpha
|
||||||
|
element face 1
|
||||||
|
property list uchar int vertex_indices
|
||||||
|
end_header
|
||||||
|
0.0 0.0 0.0 0 0 1 1
|
||||||
|
100.0 0.0 0.0 0 0 1 1
|
||||||
|
200.0 200.0 0.0 0 0 1 1
|
||||||
|
3 0 1 2
|
|
@ -46,4 +46,10 @@ class AbstractImportExportBase : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual ~AbstractImportExportBase();
|
virtual ~AbstractImportExportBase();
|
||||||
virtual bool importerTest() = 0;
|
virtual bool importerTest() = 0;
|
||||||
|
virtual bool exporterTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool AbstractImportExportBase::exporterTest() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F( utIFCImportExport, importHMPFromFileTest ) {
|
TEST_F( utIFCImportExport, importIFCFromFileTest ) {
|
||||||
EXPECT_TRUE( importerTest() );
|
EXPECT_TRUE( importerTest() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
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.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#include "UnitTestPCH.h"
|
||||||
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
|
#include <assimp/Importer.hpp>
|
||||||
|
|
||||||
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
||||||
|
class utLWSImportExport : public AbstractImportExportBase {
|
||||||
|
public:
|
||||||
|
virtual bool importerTest() {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/LWS/move_x.lws", 0 );
|
||||||
|
return nullptr != scene;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F( utLWSImportExport, importLWSFromFileTest ) {
|
||||||
|
EXPECT_TRUE( importerTest() );
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
using namespace ::Assimp;
|
using namespace ::Assimp;
|
||||||
|
|
||||||
class utMatrix3x3Test : public ::testing::Test {
|
class utMatrix3x3Test : public ::testing::Test {
|
||||||
|
// empty
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F( utMatrix3x3Test, FromToMatrixTest ) {
|
TEST_F( utMatrix3x3Test, FromToMatrixTest ) {
|
||||||
|
|
|
@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "UnitTestPCH.h"
|
#include "UnitTestPCH.h"
|
||||||
#include "SceneDiffer.h"
|
#include "SceneDiffer.h"
|
||||||
#include "AbstractImportExportBase.h"
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
#include <assimp/Importer.hpp>
|
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/Exporter.hpp>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -189,13 +189,27 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool importerTest() {
|
virtual bool importerTest() {
|
||||||
Assimp::Importer importer;
|
::Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", 0 );
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", 0 );
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
|
virtual bool exporterTest() {
|
||||||
|
::Assimp::Importer importer;
|
||||||
|
::Assimp::Exporter exporter;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", 0 );
|
||||||
|
EXPECT_NE( nullptr, scene );
|
||||||
|
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "obj", ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj" ) );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Assimp::Importer *m_im;
|
::Assimp::Importer *m_im;
|
||||||
aiScene *m_expectedScene;
|
aiScene *m_expectedScene;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,6 +217,14 @@ TEST_F( utObjImportExport, importObjFromFileTest ) {
|
||||||
EXPECT_TRUE( importerTest() );
|
EXPECT_TRUE( importerTest() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
|
TEST_F( utObjImportExport, exportObjFromFileTest ) {
|
||||||
|
EXPECT_TRUE( exporterTest() );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
TEST_F( utObjImportExport, obj_import_test ) {
|
TEST_F( utObjImportExport, obj_import_test ) {
|
||||||
const aiScene *scene = m_im->ReadFileFromMemory( (void*) ObjModel.c_str(), ObjModel.size(), 0 );
|
const aiScene *scene = m_im->ReadFileFromMemory( (void*) ObjModel.c_str(), ObjModel.size(), 0 );
|
||||||
aiScene *expected = createScene();
|
aiScene *expected = createScene();
|
||||||
|
@ -219,3 +241,14 @@ TEST_F( utObjImportExport, issue1111_no_mat_name_Test ) {
|
||||||
const aiScene *scene = m_im->ReadFileFromMemory( ( void* ) ObjModel_Issue1111.c_str(), ObjModel_Issue1111.size(), 0 );
|
const aiScene *scene = m_im->ReadFileFromMemory( ( void* ) ObjModel_Issue1111.c_str(), ObjModel_Issue1111.size(), 0 );
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F( utObjImportExport, issue809_vertex_color_Test ) {
|
||||||
|
::Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/cube_with_vertexcolors.obj", 0 );
|
||||||
|
EXPECT_NE( nullptr, scene );
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
|
::Assimp::Exporter exporter;
|
||||||
|
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "obj", ASSIMP_TEST_MODELS_DIR "/OBJ/test.obj" ) );
|
||||||
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#include "UnitTestPCH.h"
|
||||||
|
|
||||||
|
#include <assimp/Importer.hpp>
|
||||||
|
#include "AbstractImportExportBase.h"
|
||||||
|
|
||||||
|
using namespace ::Assimp;
|
||||||
|
|
||||||
|
class utPLYImportExport : public AbstractImportExportBase {
|
||||||
|
public:
|
||||||
|
virtual bool importerTest() {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", 0 );
|
||||||
|
return nullptr != scene;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F( utPLYImportExport, importTest ) {
|
||||||
|
EXPECT_TRUE( importerTest() );
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F( utPLYImportExport, vertexColorTest ) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/PLY/float-color.ply", 0 );
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
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.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#include "UnitTestPCH.h"
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
|
using namespace ::Assimp;
|
||||||
|
|
||||||
|
class utScene : public ::testing::Test {
|
||||||
|
// empty
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F( utScene, aiNode_addChildrenTest ) {
|
||||||
|
aiNode myNode;
|
||||||
|
|
||||||
|
static const size_t NumChildren = 10;
|
||||||
|
aiNode **childrenPtr = new aiNode*[ NumChildren ];
|
||||||
|
for ( unsigned int i = 0; i < NumChildren; i++ ) {
|
||||||
|
childrenPtr[ i ] = new aiNode;
|
||||||
|
}
|
||||||
|
myNode.addChildren( NumChildren, childrenPtr );
|
||||||
|
EXPECT_EQ( NumChildren, myNode.mNumChildren );
|
||||||
|
for ( unsigned int i = 0; i < NumChildren; i++ ) {
|
||||||
|
EXPECT_EQ( childrenPtr[ i ], myNode.mChildren[ i ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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.
|
||||||
|
-------------------------------------------------------------------------*/
|
||||||
|
#include "UnitTestPCH.h"
|
||||||
|
#include <assimp/vector3.h>
|
||||||
|
|
||||||
|
using namespace ::Assimp;
|
||||||
|
|
||||||
|
class utVector3 : public ::testing::Test {
|
||||||
|
// empty
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(utVector3, CreationTest) {
|
||||||
|
aiVector3D v0;
|
||||||
|
aiVector3D v1( 1.0f, 2.0f, 3.0f );
|
||||||
|
EXPECT_FLOAT_EQ (1.0f, v1[ 0 ] );
|
||||||
|
EXPECT_FLOAT_EQ( 2.0f, v1[ 1 ] );
|
||||||
|
EXPECT_FLOAT_EQ( 3.0f, v1[ 2 ] );
|
||||||
|
aiVector3D v2( 1 );
|
||||||
|
EXPECT_FLOAT_EQ( 1.0f, v2[ 0 ] );
|
||||||
|
EXPECT_FLOAT_EQ( 1.0f, v2[ 1 ] );
|
||||||
|
EXPECT_FLOAT_EQ( 1.0f, v2[ 2 ] );
|
||||||
|
aiVector3D v3( v1 );
|
||||||
|
EXPECT_FLOAT_EQ( v1[ 0 ], v3[ 0 ] );
|
||||||
|
EXPECT_FLOAT_EQ( v1[ 1 ], v3[ 1 ] );
|
||||||
|
EXPECT_FLOAT_EQ( v1[ 2 ], v3[ 2 ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F( utVector3, BracketOpTest ) {
|
||||||
|
aiVector3D v(1.0f, 2.0f, 3.0f);
|
||||||
|
EXPECT_FLOAT_EQ( 1.0f, v[ 0 ] );
|
||||||
|
EXPECT_FLOAT_EQ( 2.0f, v[ 1 ] );
|
||||||
|
EXPECT_FLOAT_EQ( 3.0f, v[ 2 ] );
|
||||||
|
}
|
|
@ -1,124 +0,0 @@
|
||||||
LOCAL_PATH := $(call my-dir)/../../../
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := assimp_static
|
|
||||||
ASSIMP_SRC_DIR = code
|
|
||||||
|
|
||||||
FILE_LIST := $(wildcard $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/*.cpp)
|
|
||||||
FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/openddlparser/code/*.cpp)
|
|
||||||
FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/unzip/*.c)
|
|
||||||
FILE_LIST += $(wildcard $(LOCAL_PATH)/contrib/poly2tri/poly2tri/*/*.cc)
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES += contrib/clipper/clipper.cpp \
|
|
||||||
contrib/ConvertUTF/ConvertUTF.c \
|
|
||||||
contrib/irrXML/irrXML.cpp
|
|
||||||
|
|
||||||
# enables -frtti and -fexceptions
|
|
||||||
LOCAL_CPP_FEATURES := exceptions
|
|
||||||
# identifier 'nullptr' will become a keyword in C++0x [-Wc++0x-compat]
|
|
||||||
# but next breaks blender and other importer
|
|
||||||
# LOCAL_CFLAGS += -std=c++11
|
|
||||||
|
|
||||||
# can't be disabled? rudamentary function?
|
|
||||||
# -DASSIMP_BUILD_NO_FLIPWINDING_PROCESS \
|
|
||||||
#
|
|
||||||
DontBuildProcess = \
|
|
||||||
-DASSIMP_BUILD_NO_FLIPUVS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_CALCTANGENTS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_DEBONE_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_FINDINSTANCES_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_GENFACENORMALS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_GENUVCOORDS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_JOINVERTICES_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_REMOVEVC_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_TRIANGULATE_PROCESS \
|
|
||||||
-DASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
|
||||||
|
|
||||||
DontBuildImporters = \
|
|
||||||
-DASSIMP_BUILD_NO_X_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_3DS_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_MD3_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_MDL_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_MD2_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_PLY_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_ASE_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_HMP_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_SMD_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_MDC_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_MD5_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_STL_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_LWO_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_DXF_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_NFF_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_RAW_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_OFF_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_AC_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_BVH_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_IRRMESH_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_IRR_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_Q3D_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_B3D_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_COLLADA_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_TERRAGEN_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_CSM_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_3D_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_LWS_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_OGRE_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_MS3D_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_COB_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_Q3BSP_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_NDO_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_IFC_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_XGL_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_FBX_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_C4D_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_OPENGEX_IMPORTER \
|
|
||||||
-DASSIMP_BUILD_NO_ASSBIN_IMPORTER
|
|
||||||
# -DASSIMP_BUILD_NO_BLEND_IMPORTER \
|
|
||||||
# -DASSIMP_BUILD_NO_GEO_IMPORTER
|
|
||||||
# -DASSIMP_BUILD_NO_OBJ_IMPORTER \
|
|
||||||
#
|
|
||||||
DontBuildImporters := -DASSIMP_BUILD_NO_IFC_IMPORTER -DASSIMP_BUILD_NO_IRRMESH_IMPORTER -DASSIMP_BUILD_NO_IRR_IMPORTER -DASSIMP_BUILD_NO_C4D_IMPORTER
|
|
||||||
|
|
||||||
ASSIMP_FLAGS_3_0 = -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_BUILD_BOOST_WORKAROUND -Dassimp_EXPORTS -fPIC -fvisibility=hidden -Wall
|
|
||||||
ASSIMP_FLAGS_3_1 = $(ASSIMP_FLAGS_3_0) # -DASSIMP_BUILD_BLENDER_DEBUG
|
|
||||||
|
|
||||||
LOCAL_CFLAGS += $(ASSIMP_FLAGS_3_1) -DASSIMP_BUILD_NO_EXPORT -DOPENDDL_NO_USE_CPP11 $(DontBuildImporters) # $(DontBuildProcess)
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround $(LOCAL_PATH)/contrib/openddlparser/include ./
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround
|
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := assimp
|
|
||||||
|
|
||||||
LOCAL_CFLAGS += -UASSIMP_BUILD_DLL_EXPORT
|
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES = assimp_static
|
|
||||||
|
|
||||||
LOCAL_LDLIBS := -lz
|
|
||||||
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/$(ASSIMP_SRC_DIR)/BoostWorkaround
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
|
|
||||||
-include $(LOCAL_PATH)/assimp_cmd.mk
|
|
||||||
|
|
||||||
# let it on original place
|
|
||||||
include $(LOCAL_PATH)/port/jassimp/jassimp-native/Android.mk
|
|
|
@ -1,8 +0,0 @@
|
||||||
ifeq ($(CC),clang)
|
|
||||||
NDK_TOOLCHAIN_VERSION := $(CC)
|
|
||||||
$(info "Use llvm Compiler")
|
|
||||||
endif
|
|
||||||
|
|
||||||
APP_ABI := armeabi-v7a
|
|
||||||
|
|
||||||
APP_STL := stlport_static
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +0,0 @@
|
||||||
The xcode project files in this directory are contributed by Andy Maloney and are not continuously updated.
|
|
||||||
Currently, it's for Assimp r352. If you're using a newer revision, watch out for missing files/includes/...
|
|
||||||
|
|
||||||
See Andy's description at
|
|
||||||
http://sourceforge.net/tracker/index.php?func=detail&aid=2659135&group_id=226462&atid=1067634 (Tracker item 2659135)
|
|
||||||
for more information.
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Workspace
|
|
||||||
version = "1.0">
|
|
||||||
<FileRef
|
|
||||||
location = "self:Assimp.xcodeproj">
|
|
||||||
</FileRef>
|
|
||||||
</Workspace>
|
|
|
@ -1,80 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "0700"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "7F79227F1AB43AC3005A8E5D"
|
|
||||||
BuildableName = "libassimp.a"
|
|
||||||
BlueprintName = "assimp"
|
|
||||||
ReferencedContainer = "container:workspaces/xcode6/Assimp.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "7F79227F1AB43AC3005A8E5D"
|
|
||||||
BuildableName = "libassimp.a"
|
|
||||||
BlueprintName = "assimp"
|
|
||||||
ReferencedContainer = "container:workspaces/xcode6/Assimp.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "7F79227F1AB43AC3005A8E5D"
|
|
||||||
BuildableName = "libassimp.a"
|
|
||||||
BlueprintName = "assimp"
|
|
||||||
ReferencedContainer = "container:workspaces/xcode6/Assimp.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
Loading…
Reference in New Issue