Merge branch 'master' into adsk-contrib-fix-std-stream-overflow
commit
7c8e8e04fa
|
@ -13,3 +13,10 @@ CHANGES text eol=lf
|
|||
CREDITS text eol=lf
|
||||
LICENSE text eol=lf
|
||||
Readme.md text eol=lf
|
||||
# make sure that repo-specific settings (.gitignore, CI-setup,...)
|
||||
# are excluded from the source-package generated via 'git archive'
|
||||
.git* export-ignore
|
||||
/.travis* export-ignore
|
||||
/.coveralls* export-ignore
|
||||
appveyor.yml export-ignore
|
||||
|
||||
|
|
31
.travis.sh
31
.travis.sh
|
@ -1,11 +1,38 @@
|
|||
function generate()
|
||||
{
|
||||
cmake -G "Unix Makefiles" -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -DBUILD_SHARED_LIBS=$SHARED_BUILD -DASSIMP_COVERALLS=$ENABLE_COVERALLS
|
||||
OPTIONS="-DASSIMP_WERROR=ON"
|
||||
|
||||
if [ "$DISABLE_EXPORTERS" = "YES" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=YES"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"
|
||||
fi
|
||||
|
||||
if [ "$SHARED_BUILD" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DBUILD_SHARED_LIBS=ON"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DBUILD_SHARED_LIBS=OFF"
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_COVERALLS" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_COVERALLS=ON"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DASSIMP_COVERALLS=OFF"
|
||||
fi
|
||||
|
||||
if [ "$ASAN" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_ASAN=ON"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DASSIMP_ASAN=OFF"
|
||||
fi
|
||||
|
||||
cmake -G "Unix Makefiles" $OPTIONS
|
||||
}
|
||||
|
||||
if [ $ANDROID ]; then
|
||||
ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni
|
||||
else
|
||||
fi
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
generate \
|
||||
&& make -j4 \
|
||||
&& sudo make install \
|
||||
|
|
73
.travis.yml
73
.travis.yml
|
@ -1,58 +1,69 @@
|
|||
sudo: required
|
||||
language: cpp
|
||||
|
||||
cache: ccache
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install cmake
|
||||
- sudo apt-get install cmake python3
|
||||
- if [ $LINUX ]; then sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq && sudo apt-get install cmake && sudo apt-get install cmake python3 && sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; fi
|
||||
- 'if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
if brew ls --versions cmake > /dev/null; then
|
||||
echo cmake already installed.;
|
||||
else
|
||||
brew install cmake;
|
||||
fi;
|
||||
brew install python3;
|
||||
brew install homebrew/x11/freeglut;
|
||||
fi'
|
||||
- echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h
|
||||
# install latest LCOV (1.9 was failing)
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
- wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
|
||||
- tar xf lcov_1.11.orig.tar.gz
|
||||
- sudo make -C lcov-1.11/ install
|
||||
- gem install coveralls-lcov
|
||||
- lcov --version
|
||||
- g++ --version
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz && tar xf lcov_1.11.orig.tar.gz && sudo make -C lcov-1.11/ install && gem install coveralls-lcov && lcov --version && g++ --version ; fi
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc="
|
||||
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
|
||||
matrix:
|
||||
- LINUX=1 TRAVIS_NO_EXPORT=YES ENABLE_COVERALLS=ON
|
||||
- LINUX=1 TRAVIS_NO_EXPORT=NO ENABLE_COVERALLS=OFF
|
||||
- LINUX=1 SHARED_BUILD=ON ENABLE_COVERALLS=OFF
|
||||
- LINUX=1 SHARED_BUILD=OFF ENABLE_COVERALLS=OFF
|
||||
- ANDROID=1
|
||||
os:
|
||||
- linux
|
||||
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
env:
|
||||
global:
|
||||
# COVERITY_SCAN_TOKEN
|
||||
- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc="
|
||||
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: DISABLE_EXPORTERS=YES ENABLE_COVERALLS=ON
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: SHARED_BUILD=ON
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ASAN=ON
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: SHARED_BUILD=ON
|
||||
|
||||
install:
|
||||
- if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi
|
||||
|
||||
before_script:
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
# init coverage to 0 (optional)
|
||||
- lcov --directory . --zerocounters
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && lcov --directory . --zerocounters ; fi
|
||||
|
||||
script:
|
||||
- export COVERALLS_SERVICE_NAME=travis-ci
|
||||
- export COVERALLS_REPO_TOKEN=abc12345
|
||||
- . ./.travis.sh
|
||||
|
||||
|
||||
after_success:
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
- lcov --directory . --capture --output-file coverage.info
|
||||
- lcov --remove coverage.info '/usr/*' 'contrib/*' 'test/*' --output-file coverage.info
|
||||
- lcov --list coverage.info
|
||||
- coveralls-lcov --source-encoding=ISO-8859-1 --repo-token=${COVERALLS_TOKEN} coverage.info
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && lcov --directory . --capture --output-file coverage.info && lcov --remove coverage.info '/usr/*' 'contrib/*' 'test/*' --output-file coverage.info && lcov --list coverage.info && coveralls-lcov --source-encoding=ISO-8859-1 --repo-token=${COVERALLS_TOKEN} coverage.info ; fi
|
||||
|
||||
addons:
|
||||
coverity_scan:
|
||||
|
|
156
CHANGES
156
CHANGES
|
@ -1,6 +1,155 @@
|
|||
----------------------------------------------------------------------
|
||||
CHANGELOG
|
||||
----------------------------------------------------------------------
|
||||
4.0.1 (2017-07-28)
|
||||
- FIXES/HOUSEKEEPING:
|
||||
- fix version test.
|
||||
- Not compiling when using ASSIMP_DOUBLE_PRECISION
|
||||
- Added support for python3
|
||||
- Check if cmake is installed with brew
|
||||
- Low performance in OptimizeMeshesProcess::ProcessNode with huge numbers of meshes
|
||||
- Elapsed seconds not shown correctly
|
||||
- StreamReader: fix out-of-range exception
|
||||
- PPdPmdParser: fix compilation for clang
|
||||
|
||||
|
||||
4.0.0 (2017-07-18)
|
||||
|
||||
FEATURES:
|
||||
- Double precision support provided ( available via cmake option )
|
||||
- QT-Widget based assimp-viewer ( works for windows, linux, osx )
|
||||
- Open3DGC codec supported by glFT-importer
|
||||
- glTF: Read and write transparency values
|
||||
- Add Triangulate post-processing step to glTF exporters
|
||||
- Update rapidjson to v1.0.2
|
||||
- Added method to append new metadata to structure
|
||||
- Unittests: intoduce a prototype model differ
|
||||
- X3D support
|
||||
- AMF support
|
||||
- Lugdunum3D support
|
||||
- Obj-Importer: obj-homogeneous_coords support
|
||||
- Obj-Importer: new streaming handling
|
||||
- Added support for 64 bit version header introduced in FbxSdk2016
|
||||
- Travis: enable coverall support.
|
||||
- PyAssimp: New version of the pyASSIMP 3D viewer, with much improved 3D controls
|
||||
- Morph animation support for collada
|
||||
- Added support for parameters Ni and Tf in OBJ/MTL file format
|
||||
- aiScene: add method to add children
|
||||
- Added new option to IFC importer to control tessellation angle + removed unused IFC option
|
||||
- aiMetaData: introduce aiMetaData::Dealloc
|
||||
- Samples: add a DX11 example
|
||||
- travis ci: test on OXS ( XCode 6.3 ) as well
|
||||
- travis ci: enable sudo support.
|
||||
- openddlparser: integrate release v0.4.0
|
||||
- aiMetaData: Added support for metadata in assbin format
|
||||
|
||||
FIXES/HOUSEKEEPING:
|
||||
- Introduce usage of #pragma statement
|
||||
- Put cmake-scripts into their own folder
|
||||
- Fix install pathes ( issue 938 )
|
||||
- Fix object_compare in blender importer( issue 946 )
|
||||
- Fix OSX compilation error
|
||||
- Fix unzip path when no other version was found ( issue 967 )
|
||||
- Set _FILE_OFFSET_BITS=64 for 32-bit linux ( issue 975 )
|
||||
- Fix constructor for radjson on OSX
|
||||
- Use Assimp namespace to fix build for big-endian architectures
|
||||
- Add -fPIC to C Flags for 64bit linux Shared Object builds
|
||||
- MDLLoader: fix resource leak.
|
||||
- MakeVerboseFormat: fix invalid delete statement
|
||||
- IFC: fix possible use after free access bug
|
||||
- ComputeUVMappingprocess: add missing initialization for scalar value
|
||||
- Fix invalid release of mat + mesh
|
||||
- IrrImporter: Fix release functions
|
||||
- Split mesh before exporting gltf ( issue 995 )
|
||||
- 3MFImporter: add source group for visual studio
|
||||
- IFC: Switch generated file to 2 files to fix issue related to <mingw4.9 ( Thanks Qt! )
|
||||
- ObjImporter: fix test for vertices import
|
||||
- export scene combiner ( issues177 )
|
||||
- FBX: make lookup test less strict ( issues 994 )
|
||||
- OpenGEX-Importer: add import of vertex colors ( issue 954 )
|
||||
- fix bug when exporting mRotationKeys data
|
||||
- fix mingw build (mingw supports stat64 nowadays)
|
||||
- cfileio: fix leaks by not closing files in the destructor
|
||||
- Fix OBJ parser mtllib statement parsing bug.
|
||||
- Q3BSP-Importer: remove dead code
|
||||
- Fix BlenderDNA for clang cross compiler.
|
||||
- ScenePreprocessor: fix invalid index counter.
|
||||
- Fix compiler warnings ( issue 957 )
|
||||
- Fix obj .mtl file loading
|
||||
- Fixed a compile error on MSVC14 x64 caused by the /bigobj flag failing to be set for the 1 and 2-suffixed versions introduced in commit 0a25b076b8968b7ea2aa96d7d1b4381be2d72ce6
|
||||
- Fixed build warnings on MSVC14 x64
|
||||
- Remove scaling of specular exponent in OBJFileImporter.cpp
|
||||
- use ai_assert instead of assert ( issue 1076 )
|
||||
- Added a preprocessor definition for MSVC to silence safety warnings regarding C library functions. This addresses all warnings for MSVC x86 and x64 when building zlib, tools and viewer as a static lib
|
||||
- fix parsing of texture name ( issue 899 )
|
||||
- add warning when detecting invalid mat definition ( issue 1111 )
|
||||
- copy aiTexture type declaration instead of using decltype for declaration to fix iOS build( issue 1101 )
|
||||
- FBX: Add additional material properties
|
||||
- FBX: Correct camera position and clip planes
|
||||
- FBX: Add correct light locations and falloff values
|
||||
- fix typo ( issue 1141 )
|
||||
- Fix collada export. Don't duplicate TEXCOORD/NORMALS/COLORS in <vertices> and <polylist> ( issue 1084 )
|
||||
- OBJParser: set material index when changing current material
|
||||
- OBJ: check for null mesh before updating material index
|
||||
- add vertex color export support ( issue 809 )
|
||||
- Fix memory leak in Collada importer ( issue 1169 )
|
||||
- add stp to the list of supported extensions for step-files ( issue 1183 )
|
||||
- fix clang build ( Issue-1169 )
|
||||
- fix for FreeBSD
|
||||
- Import FindPkgMacros to main CMake Configuration
|
||||
- Extended support for tessellation parameter to more IFC shapes
|
||||
- defensice handling of utf-8 decode issues ( issue 1211 )
|
||||
- Fixed compiler error on clang 4.0 running on OSX
|
||||
- use test extension for exported test files ( issue 1228 )
|
||||
- Set UVW index material properties for OBJ files
|
||||
- Fixed no member named 'atop' in global namespace issue for Android NDK compilation
|
||||
- Apply mechanism to decide use for IrrXML external or internal
|
||||
- Fix static init ordering bug in OpenGEX importer
|
||||
- GLTF exporter: ensure animation accessors have same count
|
||||
- GLTF exporter: convert animation time from ticks to seconds
|
||||
- Add support for reading texture coordinates from PLY meshes with properties named 'texture_u' and 'texture_v'
|
||||
- Added TokensForSearch in BlenderLoader to allow CanRead return true for in-memory files.
|
||||
- fix wrong delete ( issue 1266 )
|
||||
- OpenGEX: fix invalid handling with color4 token ( issue 1262 )
|
||||
- LWOLoader: fix link in loader description
|
||||
- Fix error when custom CMAKE_C_FLAGS is specified
|
||||
- Fast-atof: log overflow errors
|
||||
- Obj-Importer: do not break when detecting an overflow ( issue 1244 )
|
||||
- Obj-Importer: fix parsing of multible line data definitions
|
||||
- Fixed bug where IFC models with multiple IFCSite only loaded 1 site instead of the complete model
|
||||
- PLYImporter: - optimize memory and speed on ply importer / change parser to use a file stream - manage texture path in ply
|
||||
import - manage texture coords on faces in ply import - correction on point cloud faces generation
|
||||
- Utf8: integrate new lib ( issue 1158 )
|
||||
- fixed CMAKE_MODULE_PATH overwriting previous values
|
||||
- OpenGEX: Fixed bug in material color processing ( issue 1271 )
|
||||
- SceneCombiner: move header for scenecombiner to public folder.
|
||||
- GLTF exporter: ensure buffer view byte offsets are correctly aligned
|
||||
- X3D importer: Added EXPORT and IMPORT to the list of ignored XML tags
|
||||
- X3D Exporter: fixed missing attributes
|
||||
- X3D importer: Fixed import of normals for the single index / normal per vertex case
|
||||
- X3D importer: Fixed handling of inlined files
|
||||
- X3D importer: fixed whitespace handling (issue 1202)
|
||||
- X3D importer: Fixed iterator on MSVC 2015
|
||||
- X3D importer: Fixed problems with auto, override and regex on older compilers
|
||||
- X3D importer: Fixed missing header file
|
||||
- X3D importer: Fixed path handling
|
||||
- X3D importer: Implemented support for binary X3D files
|
||||
- fix build without 3DS ( issue 1319 )
|
||||
- pyassimp: Fixed indices for IndexedTriangleFanSet, IndexedTriangleSet and IndexedTriangleStripSet
|
||||
- Fixes parameters to pyassimp.load
|
||||
- Obj-Importe: Fixed texture bug due simultaneously using 'usemtl' and 'usemap' attributes
|
||||
- check if all exporters are disabled ( issue 1320 )
|
||||
- Remove std functions deprecated by C++11.
|
||||
- X-Importer: make it deal with lines
|
||||
- use correct path for compilers ( issue 1335 )
|
||||
- Collada: add workaround to deal with polygon with holes
|
||||
- update python readme
|
||||
- Use unique node names when loading Collada files
|
||||
- Fixed many FBX bugs
|
||||
|
||||
API COMPATIBILITY:
|
||||
- Changed ABI-compatibility to v3.3.1, please rebuild your precompiled libraries ( see issue 1182 )
|
||||
- VS2010 outdated
|
||||
|
||||
3.3.1 (2016-07-08)
|
||||
|
||||
|
@ -121,8 +270,6 @@ API COMPATIBILITY:
|
|||
- Note: 3.0 is not binary compatible with 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
2.0 (2010-11-21)
|
||||
|
||||
FEATURES:
|
||||
|
@ -159,10 +306,7 @@ API CHANGES:
|
|||
currently used, however ...)
|
||||
- Some Assimp::Importer methods are const now.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1.1 (2010-04-17)
|
||||
This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700).
|
||||
|
||||
|
|
202
CMakeLists.txt
202
CMakeLists.txt
|
@ -34,7 +34,7 @@
|
|||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#----------------------------------------------------------------------
|
||||
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
|
||||
cmake_minimum_required( VERSION 2.8 )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
PROJECT( Assimp )
|
||||
|
||||
# All supported options ###############################################
|
||||
|
@ -62,11 +62,11 @@ OPTION( ASSIMP_BUILD_ZLIB
|
|||
"Build your own zlib"
|
||||
OFF
|
||||
)
|
||||
option( ASSIMP_BUILD_ASSIMP_TOOLS
|
||||
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
|
||||
"If the supplementary tools for Assimp are built in addition to the library."
|
||||
ON
|
||||
)
|
||||
option ( ASSIMP_BUILD_SAMPLES
|
||||
OPTION ( ASSIMP_BUILD_SAMPLES
|
||||
"If the official samples are built as well (needs Glut)."
|
||||
OFF
|
||||
)
|
||||
|
@ -75,12 +75,32 @@ OPTION ( ASSIMP_BUILD_TESTS
|
|||
ON
|
||||
)
|
||||
OPTION ( ASSIMP_COVERALLS
|
||||
"Eańable this to measure test coverage."
|
||||
OFF
|
||||
"Enable this to measure test coverage."
|
||||
OFF
|
||||
)
|
||||
OPTION ( ASSIMP_WERROR
|
||||
"Treat warnings as errors."
|
||||
OFF
|
||||
)
|
||||
OPTION ( ASSIMP_ASAN
|
||||
"Enable AddressSanitizer."
|
||||
OFF
|
||||
)
|
||||
OPTION ( SYSTEM_IRRXML
|
||||
"Use system installed Irrlicht/IrrXML library."
|
||||
OFF
|
||||
)
|
||||
OPTION ( BUILD_DOCS
|
||||
"Build documentation using Doxygen."
|
||||
OFF
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||
endif()
|
||||
|
||||
IF(MSVC)
|
||||
set (CMAKE_PREFIX_PATH "D:\\libs\\devil")
|
||||
SET (CMAKE_PREFIX_PATH "D:\\libs\\devil")
|
||||
OPTION( ASSIMP_INSTALL_PDB
|
||||
"Install MSVC debug files."
|
||||
ON
|
||||
|
@ -88,21 +108,24 @@ IF(MSVC)
|
|||
ENDIF(MSVC)
|
||||
|
||||
IF(NOT BUILD_SHARED_LIBS)
|
||||
MESSAGE(STATUS "Shared libraries disabled")
|
||||
SET(LINK_SEARCH_START_STATIC TRUE)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Shared libraries enabled")
|
||||
ENDIF(NOT BUILD_SHARED_LIBS)
|
||||
|
||||
# Define here the needed parameters
|
||||
SET (ASSIMP_VERSION_MAJOR 3)
|
||||
SET (ASSIMP_VERSION_MINOR 3)
|
||||
SET (ASSIMP_VERSION_PATCH 1) # subversion revision?
|
||||
SET (ASSIMP_VERSION_MAJOR 4)
|
||||
SET (ASSIMP_VERSION_MINOR 0)
|
||||
SET (ASSIMP_VERSION_PATCH 1)
|
||||
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
|
||||
SET (ASSIMP_SOVERSION 3)
|
||||
SET (ASSIMP_SOVERSION 4)
|
||||
SET (PROJECT_VERSION "${ASSIMP_VERSION}")
|
||||
|
||||
SET(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources")
|
||||
SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )
|
||||
|
||||
# Needed for openddl_parser config, no use of c++11 at this moment
|
||||
add_definitions( -DOPENDDL_NO_USE_CPP11 )
|
||||
ADD_DEFINITIONS( -DOPENDDL_NO_USE_CPP11 )
|
||||
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
|
||||
|
||||
# Get the current working branch
|
||||
|
@ -124,66 +147,92 @@ EXECUTE_PROCESS(
|
|||
)
|
||||
|
||||
IF(NOT GIT_COMMIT_HASH)
|
||||
SET(GIT_COMMIT_HASH 0)
|
||||
SET(GIT_COMMIT_HASH 0)
|
||||
ENDIF(NOT GIT_COMMIT_HASH)
|
||||
|
||||
IF(ASSIMP_DOUBLE_PRECISION)
|
||||
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
|
||||
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
|
||||
ENDIF(ASSIMP_DOUBLE_PRECISION)
|
||||
|
||||
configure_file(
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/revision.h
|
||||
)
|
||||
|
||||
configure_file(
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
|
||||
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
INCLUDE_DIRECTORIES(
|
||||
./
|
||||
include
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
|
||||
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
|
||||
SET(LIBASSIMP_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}" )
|
||||
SET(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev" )
|
||||
SET(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
|
||||
SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
|
||||
|
||||
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit linux
|
||||
IF( UNIX )
|
||||
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit linux
|
||||
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit linux
|
||||
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW)
|
||||
IF (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
ENDIF()
|
||||
# Use GNUInstallDirs for Unix predefined directories
|
||||
INCLUDE(GNUInstallDirs)
|
||||
ENDIF( UNIX )
|
||||
|
||||
|
||||
# Grouped compiler settings
|
||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
||||
# hide all not-exported symbols
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -Wall -std=c++0x" )
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -std=c++0x")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
ELSEIF(MSVC)
|
||||
# enable multi-core compilation with MSVC
|
||||
add_compile_options(/MP)
|
||||
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
|
||||
|
||||
# disable "elements of array '' will be default initialized" warning on MSVC2013
|
||||
IF(MSVC12)
|
||||
add_compile_options(/wd4351)
|
||||
ENDIF()
|
||||
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -Wno-long-long -std=c++11" )
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
ELSEIF( CMAKE_COMPILER_IS_MINGW )
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
|
||||
add_definitions( -U__STRICT_ANSI__ )
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -std=c++11" )
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
ADD_DEFINITIONS( -U__STRICT_ANSI__ )
|
||||
ENDIF()
|
||||
|
||||
if (ASSIMP_COVERALLS)
|
||||
include(Coveralls)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
MESSAGE(STATUS "Coveralls enabled")
|
||||
INCLUDE(Coveralls)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES( include )
|
||||
if (ASSIMP_WERROR)
|
||||
MESSAGE(STATUS "Treating warnings as errors")
|
||||
IF (MSVC)
|
||||
add_compile_options(/WX)
|
||||
ELSE()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
if (ASSIMP_ASAN)
|
||||
MESSAGE(STATUS "AddressSanitizer enabled")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
||||
endif()
|
||||
|
||||
INCLUDE (FindPkgMacros)
|
||||
INCLUDE (PrecompiledHeader)
|
||||
|
@ -215,20 +264,25 @@ ENDIF()
|
|||
# Only generate this target if no higher-level project already has
|
||||
IF (NOT TARGET uninstall)
|
||||
# add make uninstall capability
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
||||
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
ENDIF()
|
||||
|
||||
# cmake configuration files
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
||||
|
||||
FIND_PACKAGE( DirectX )
|
||||
|
||||
IF( CMAKE_COMPILER_IS_GNUCXX )
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
|
||||
IF( BUILD_DOCS )
|
||||
add_subdirectory(doc)
|
||||
ENDIF( BUILD_DOCS )
|
||||
|
||||
# Look for system installed irrXML
|
||||
IF ( SYSTEM_IRRXML )
|
||||
find_package( IrrXML REQUIRED )
|
||||
ENDIF( SYSTEM_IRRXML )
|
||||
|
||||
# Search for external dependencies, and build them from source if not found
|
||||
# Search for zlib
|
||||
|
@ -238,9 +292,9 @@ ENDIF( NOT ASSIMP_BUILD_ZLIB )
|
|||
|
||||
IF( NOT ZLIB_FOUND )
|
||||
message(STATUS "compiling zlib from souces")
|
||||
include(CheckIncludeFile)
|
||||
include(CheckTypeSize)
|
||||
include(CheckFunctionExists)
|
||||
INCLUDE(CheckIncludeFile)
|
||||
INCLUDE(CheckTypeSize)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
# compile from sources
|
||||
add_subdirectory(contrib/zlib)
|
||||
SET(ZLIB_FOUND 1)
|
||||
|
@ -324,6 +378,8 @@ ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
||||
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
|
||||
ADD_SUBDIRECTORY(contrib)
|
||||
|
||||
ADD_SUBDIRECTORY( code/ )
|
||||
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||
IF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
||||
|
@ -427,29 +483,41 @@ IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
|||
ENDIF()
|
||||
|
||||
if(WIN32)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
|
||||
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
|
||||
elseif()
|
||||
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/")
|
||||
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/")
|
||||
ENDIF()
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
|
||||
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
|
||||
elseif()
|
||||
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/")
|
||||
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/")
|
||||
ENDIF()
|
||||
|
||||
if(MSVC12)
|
||||
SET(ASSIMP_MSVC_VERSION "vc120")
|
||||
elseif(MSVC14)
|
||||
SET(ASSIMP_MSVC_VERSION "vc140")
|
||||
ENDIF(MSVC12)
|
||||
if(MSVC12)
|
||||
SET(ASSIMP_MSVC_VERSION "vc120")
|
||||
elseif(MSVC14)
|
||||
SET(ASSIMP_MSVC_VERSION "vc140")
|
||||
ENDIF(MSVC12)
|
||||
|
||||
if(MSVC12 OR MSVC14)
|
||||
add_custom_target(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ENDIF(MSVC12 OR MSVC14)
|
||||
if(MSVC12 OR MSVC14)
|
||||
add_custom_target(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)
|
||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ELSE()
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ENDIF()
|
||||
ENDIF(MSVC12 OR MSVC14)
|
||||
ENDIF (WIN32)
|
||||
|
|
2
CREDITS
2
CREDITS
|
@ -157,4 +157,4 @@ Contributed ExportProperties interface
|
|||
Contributed X File exporter
|
||||
Contributed Step (stp) exporter
|
||||
|
||||
|
||||
For a more detailed list just check: https://github.com/assimp/assimp/network/members
|
||||
|
|
110
Readme.md
110
Readme.md
|
@ -1,6 +1,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
==================================
|
||||
|
||||
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
|
||||
### Current build status ###
|
||||
[![Linux Build Status](https://travis-ci.org/assimp/assimp.svg)](https://travis-ci.org/assimp/assimp)
|
||||
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/tmo433wax6u6cjp4?svg=true)](https://ci.appveyor.com/project/kimkulling/assimp)
|
||||
<a href="https://scan.coverity.com/projects/5607">
|
||||
|
@ -8,22 +9,24 @@ Open Asset Import Library (assimp)
|
|||
src="https://scan.coverity.com/projects/5607/badge.svg"/>
|
||||
</a>
|
||||
[![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master)
|
||||
[![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
<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.
|
||||
|
||||
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.
|
||||
The current build status is:
|
||||
This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases).
|
||||
|
||||
Gitter chat: [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
|
||||
|
||||
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
|
||||
Monthly donations via Patreon:
|
||||
<br>[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/assimp)
|
||||
|
||||
<br>
|
||||
|
||||
One-off donations via PayPal:
|
||||
<br>[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4)
|
||||
|
||||
<br>
|
||||
__[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.__
|
||||
|
||||
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
|
||||
|
||||
|
@ -31,50 +34,67 @@ Please check our Wiki as well: https://github.com/assimp/assimp/wiki
|
|||
|
||||
A full list [is here](http://assimp.org/main_features_formats.html).
|
||||
__Importers__:
|
||||
|
||||
- 3D
|
||||
- 3DS
|
||||
- BLEND (Blender)
|
||||
- DAE/Collada
|
||||
- FBX
|
||||
- IFC-STEP
|
||||
- 3MF
|
||||
- AC
|
||||
- AC3D
|
||||
- ACC
|
||||
- AMJ
|
||||
- ASE
|
||||
- ASK
|
||||
- B3D;
|
||||
- BLEND (Blender)
|
||||
- BVH
|
||||
- COB
|
||||
- CMS
|
||||
- DAE/Collada
|
||||
- DXF
|
||||
- HMP
|
||||
- ENFF
|
||||
- FBX
|
||||
- glTF 1.0 + GLB
|
||||
- glTF 2.0
|
||||
- HMB
|
||||
- IFC-STEP
|
||||
- IRR / IRRMESH
|
||||
- LWO
|
||||
- LWS
|
||||
- LXO
|
||||
- MD2
|
||||
- MD3
|
||||
- MD5
|
||||
- MDC
|
||||
- MDL
|
||||
- NFF
|
||||
- PLY
|
||||
- STL
|
||||
- X
|
||||
- OBJ
|
||||
- OpenGEX
|
||||
- SMD
|
||||
- LWO
|
||||
- LXO
|
||||
- LWS
|
||||
- TER
|
||||
- AC3D
|
||||
- MESH / MESH.XML
|
||||
- MOT
|
||||
- MS3D
|
||||
- COB
|
||||
- Q3BSP
|
||||
- XGL
|
||||
- CSM
|
||||
- BVH
|
||||
- B3D
|
||||
- NDO
|
||||
- Ogre Binary
|
||||
- Ogre XML
|
||||
- Q3D
|
||||
- ASSBIN (Assimp custom format)
|
||||
- glTF (partial)
|
||||
- 3MF
|
||||
- NFF
|
||||
- OBJ
|
||||
- OFF
|
||||
- OGEX
|
||||
- PLY
|
||||
- PMX
|
||||
- PRJ
|
||||
- Q3O
|
||||
- Q3S
|
||||
- RAW
|
||||
- SCN
|
||||
- SIB
|
||||
- SMD
|
||||
- STL
|
||||
- STP
|
||||
- TER
|
||||
- UC
|
||||
- VTA
|
||||
- X
|
||||
- X3D
|
||||
- XGL
|
||||
- ZGL
|
||||
|
||||
Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default):
|
||||
|
||||
- C4D (https://github.com/acgessler/assimp-cinema4d)
|
||||
- C4D (https://github.com/assimp/assimp/wiki/Cinema4D-&-Melange)
|
||||
|
||||
__Exporters__:
|
||||
|
||||
|
@ -87,7 +107,8 @@ __Exporters__:
|
|||
- JSON (for WebGl, via https://github.com/acgessler/assimp2json)
|
||||
- ASSBIN
|
||||
- STEP
|
||||
- glTF (partial)
|
||||
- glTF 1.0 (partial)
|
||||
- glTF 2.0 (partial)
|
||||
|
||||
### Building ###
|
||||
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.
|
||||
|
@ -98,6 +119,11 @@ Take a look into the `INSTALL` file. Our build system is CMake, if you used CMak
|
|||
* [.NET](port/AssimpNET/Readme.md)
|
||||
* [Pascal](port/AssimpPascal/Readme.md)
|
||||
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
||||
* [Unity 3d Plugin] (https://www.assetstore.unity3d.com/en/#!/content/91777)
|
||||
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (currently supported obj, ply, stl, ~collada)
|
||||
|
||||
### Other tools ###
|
||||
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
|
||||
|
||||
#### Repository structure ####
|
||||
Open Asset Import Library is implemented in C++. The directory structure is:
|
||||
|
@ -133,10 +159,6 @@ And we also have a Gitter-channel:Gitter [![Join the chat at https://gitter.im/a
|
|||
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.
|
||||
|
||||
### Donate ###
|
||||
You can get a patron of Asset-Importer-Lib:
|
||||
<a href="https://www.patreon.com/bePatron?u=2790590" data-patreon-widget-type="become-patron-button">Become a Patron!</a><script async src="https://cdn6.patreon.com/becomePatronButton.bundle.js"></script>
|
||||
|
||||
### License ###
|
||||
Our license is based on the modified, __3-clause BSD__-License.
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ install:
|
|||
|
||||
build_script:
|
||||
- cd c:\projects\assimp
|
||||
- if "%platform%" equ "x64" (cmake CMakeLists.txt -G "Visual Studio %Configuration% Win64")
|
||||
- if "%platform%" equ "x86" (cmake CMakeLists.txt -G "Visual Studio %Configuration%")
|
||||
- if "%platform%" equ "x64" (cmake CMakeLists.txt -DASSIMP_WERROR=ON -G "Visual Studio %Configuration% Win64")
|
||||
- if "%platform%" equ "x86" (cmake CMakeLists.txt -DASSIMP_WERROR=ON -G "Visual Studio %Configuration%")
|
||||
- if "%platform%" equ "x64" (msbuild /m /p:Configuration=Release /p:Platform="x64" Assimp.sln)
|
||||
- if "%platform%" equ "x86" (msbuild /m /p:Configuration=Release /p:Platform="Win32" Assimp.sln)
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindDevIL
|
||||
# ---------
|
||||
#
|
||||
#
|
||||
#
|
||||
# This module locates the developer's image library.
|
||||
# http://openil.sourceforge.net/
|
||||
#
|
||||
# This module sets:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# IL_LIBRARIES - the name of the IL library. These include the full path to
|
||||
# the core DevIL library. This one has to be linked into the
|
||||
# application.
|
||||
# ILU_LIBRARIES - the name of the ILU library. Again, the full path. This
|
||||
# library is for filters and effects, not actual loading. It
|
||||
# doesn't have to be linked if the functionality it provides
|
||||
# is not used.
|
||||
# ILUT_LIBRARIES - the name of the ILUT library. Full path. This part of the
|
||||
# library interfaces with OpenGL. It is not strictly needed
|
||||
# in applications.
|
||||
# IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files.
|
||||
# IL_FOUND - this is set to TRUE if all the above variables were set.
|
||||
# This will be set to false if ILU or ILUT are not found,
|
||||
# even if they are not needed. In most systems, if one
|
||||
# library is found all the others are as well. That's the
|
||||
# way the DevIL developers release it.
|
||||
|
||||
# TODO: Add version support.
|
||||
# Tested under Linux and Windows (MSVC)
|
||||
|
||||
#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(IL_INCLUDE_DIR il.h
|
||||
PATH_SUFFIXES include IL
|
||||
DOC "The path to the directory that contains il.h"
|
||||
)
|
||||
|
||||
#message("IL_INCLUDE_DIR is ${IL_INCLUDE_DIR}")
|
||||
|
||||
find_library(IL_LIBRARIES
|
||||
NAMES IL DEVIL
|
||||
PATH_SUFFIXES lib64 lib lib32
|
||||
DOC "The file that corresponds to the base il library."
|
||||
)
|
||||
|
||||
#message("IL_LIBRARIES is ${IL_LIBRARIES}")
|
||||
|
||||
find_library(ILUT_LIBRARIES
|
||||
NAMES ILUT
|
||||
PATH_SUFFIXES lib64 lib lib32
|
||||
DOC "The file that corresponds to the il (system?) utility library."
|
||||
)
|
||||
|
||||
#message("ILUT_LIBRARIES is ${ILUT_LIBRARIES}")
|
||||
|
||||
find_library(ILU_LIBRARIES
|
||||
NAMES ILU
|
||||
PATH_SUFFIXES lib64 lib lib32
|
||||
DOC "The file that corresponds to the il utility library."
|
||||
)
|
||||
|
||||
#message("ILU_LIBRARIES is ${ILU_LIBRARIES}")
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG
|
||||
IL_LIBRARIES IL_INCLUDE_DIR)
|
|
@ -0,0 +1,17 @@
|
|||
# Find IrrXMl from irrlicht project
|
||||
#
|
||||
# Find LibIrrXML headers and library
|
||||
#
|
||||
# IRRXML_FOUND - IrrXML found
|
||||
# IRRXML_INCLUDE_DIR - Headers location
|
||||
# IRRXML_LIBRARY - IrrXML main library
|
||||
|
||||
find_path(IRRXML_INCLUDE_DIR irrXML.h
|
||||
PATH_SUFFIXES include/irrlicht include/irrxml)
|
||||
find_library(IRRXML_LIBRARY IrrXML)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(IrrXML REQUIRED_VARS IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
|
||||
|
||||
|
||||
mark_as_advanced(IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -55,18 +56,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace Assimp;
|
||||
|
||||
static const unsigned int NotSet = 0xcdcdcdcd;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Setup final material indices, generae a default material if necessary
|
||||
void Discreet3DSImporter::ReplaceDefaultMaterial()
|
||||
{
|
||||
|
||||
// Try to find an existing material that matches the
|
||||
// typical default material setting:
|
||||
// - no textures
|
||||
// - diffuse color (in grey!)
|
||||
// NOTE: This is here to workaround the fact that some
|
||||
// exporters are writing a default material, too.
|
||||
unsigned int idx = 0xcdcdcdcd;
|
||||
unsigned int idx( NotSet );
|
||||
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
|
||||
{
|
||||
std::string s = mScene->mMaterials[i].mName;
|
||||
|
@ -92,7 +94,9 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
|
|||
}
|
||||
idx = i;
|
||||
}
|
||||
if (0xcdcdcdcd == idx)idx = (unsigned int)mScene->mMaterials.size();
|
||||
if ( NotSet == idx ) {
|
||||
idx = ( unsigned int )mScene->mMaterials.size();
|
||||
}
|
||||
|
||||
// now iterate through all meshes and through all faces and
|
||||
// find all faces that are using the default material
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -45,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "3DSExporter.h"
|
||||
#include "3DSLoader.h"
|
||||
#include "3DSHelper.h"
|
||||
#include "SceneCombiner.h"
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include "SplitLargeMeshes.h"
|
||||
#include "StringComparison.h"
|
||||
#include <assimp/IOSystem.hpp>
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -1380,7 +1381,7 @@ void Discreet3DSImporter::ParseColorChunk( aiColor3D* out, bool acceptPercent )
|
|||
bGamma = true;
|
||||
|
||||
case Discreet3DS::CHUNK_RGBF:
|
||||
if (sizeof(ai_real) * 3 > diff) {
|
||||
if (sizeof(float) * 3 > diff) {
|
||||
*out = clrError;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -59,18 +60,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/// \class CAMFImporter_NodeElement
|
||||
/// Base class for elements of nodes.
|
||||
class CAMFImporter_NodeElement
|
||||
{
|
||||
/***********************************************/
|
||||
/******************** Types ********************/
|
||||
/***********************************************/
|
||||
class CAMFImporter_NodeElement {
|
||||
|
||||
public:
|
||||
|
||||
/// \enum EType
|
||||
/// Define what data type contain node element.
|
||||
enum EType
|
||||
{
|
||||
enum EType {
|
||||
ENET_Color, ///< Color element: <color>.
|
||||
ENET_Constellation,///< Grouping element: <constellation>.
|
||||
ENET_Coordinates, ///< Coordinates element: <coordinates>.
|
||||
|
@ -91,52 +85,37 @@ public:
|
|||
ENET_Invalid ///< Element has invalid type and possible contain invalid data.
|
||||
};
|
||||
|
||||
/***********************************************/
|
||||
/****************** Constants ******************/
|
||||
/***********************************************/
|
||||
|
||||
public:
|
||||
|
||||
const EType Type;///< Type of element.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
public:
|
||||
|
||||
std::string ID;///< ID of element.
|
||||
CAMFImporter_NodeElement* Parent;///< Parrent element. If nullptr then this node is root.
|
||||
CAMFImporter_NodeElement* Parent;///< Parent element. If nullptr then this node is root.
|
||||
std::list<CAMFImporter_NodeElement*> Child;///< Child elements.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
public: /// Destructor, virtual..
|
||||
virtual ~CAMFImporter_NodeElement() {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CAMFImporter_NodeElement(const CAMFImporter_NodeElement& pNodeElement)
|
||||
/// Disabled copy constructor.
|
||||
CAMFImporter_NodeElement(const CAMFImporter_NodeElement& pNodeElement);
|
||||
|
||||
/// \fn CAMFImporter_NodeElement& operator=(const CAMFImporter_NodeElement& pNodeElement)
|
||||
/// Disabled assign operator.
|
||||
CAMFImporter_NodeElement& operator=(const CAMFImporter_NodeElement& pNodeElement);
|
||||
|
||||
/// \fn CAMFImporter_NodeElement()
|
||||
/// Disabled default constructor.
|
||||
CAMFImporter_NodeElement();
|
||||
|
||||
protected:
|
||||
|
||||
/// \fn CAMFImporter_NodeElement(const EType pType, CAMFImporter_NodeElement* pParent)
|
||||
/// In constructor inheritor must set element type.
|
||||
/// \param [in] pType - element type.
|
||||
/// \param [in] pParent - parent element.
|
||||
CAMFImporter_NodeElement(const EType pType, CAMFImporter_NodeElement* pParent)
|
||||
: Type(pType), Parent(pParent)
|
||||
{}
|
||||
|
||||
: Type(pType)
|
||||
, ID()
|
||||
, Parent(pParent)
|
||||
, Child() {
|
||||
// empty
|
||||
}
|
||||
};// class IAMFImporter_NodeElement
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Constellation
|
||||
|
@ -399,25 +378,23 @@ struct CAMFImporter_NodeElement_Triangle : public CAMFImporter_NodeElement
|
|||
|
||||
};// struct CAMFImporter_NodeElement_Triangle
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Texture
|
||||
/// Structure that define texture node.
|
||||
struct CAMFImporter_NodeElement_Texture : public CAMFImporter_NodeElement
|
||||
{
|
||||
/****************** Variables ******************/
|
||||
|
||||
struct CAMFImporter_NodeElement_Texture : public CAMFImporter_NodeElement {
|
||||
size_t Width, Height, Depth;///< Size of the texture.
|
||||
std::vector<uint8_t> Data;///< Data of the texture.
|
||||
bool Tiled;
|
||||
|
||||
/****************** Functions ******************/
|
||||
|
||||
/// \fn CAMFImporter_NodeElement_Texture(CAMFImporter_NodeElement* pParent)
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CAMFImporter_NodeElement_Texture(CAMFImporter_NodeElement* pParent)
|
||||
: CAMFImporter_NodeElement(ENET_Texture, pParent)
|
||||
{}
|
||||
|
||||
: CAMFImporter_NodeElement(ENET_Texture, pParent)
|
||||
, Width( 0 )
|
||||
, Height( 0 )
|
||||
, Depth( 0 )
|
||||
, Data()
|
||||
, Tiled( false ){
|
||||
// empty
|
||||
}
|
||||
};// struct CAMFImporter_NodeElement_Texture
|
||||
|
||||
#endif // INCLUDED_AI_AMF_IMPORTER_NODE_H
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -49,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "AMFImporter.hpp"
|
||||
|
||||
// Header files, Assimp.
|
||||
#include "SceneCombiner.h"
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include "StandardShapes.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
|
@ -260,21 +261,20 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string&
|
|||
size_t off_b = 0;
|
||||
|
||||
// Calculate size of the target array and rule how data will be copied.
|
||||
if ( nullptr != src_texture ) {
|
||||
if(!pID_R.empty()) {
|
||||
tex_size += src_texture[0]->Data.size(); step++, off_g++, off_b++;
|
||||
}
|
||||
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++;
|
||||
}
|
||||
if(!pID_R.empty() && nullptr != src_texture[ 0 ] ) {
|
||||
tex_size += src_texture[0]->Data.size(); step++, off_g++, off_b++;
|
||||
}
|
||||
// Create target array.
|
||||
if(!pID_G.empty() && nullptr != src_texture[ 1 ] ) {
|
||||
tex_size += src_texture[1]->Data.size(); step++, off_b++;
|
||||
}
|
||||
if(!pID_B.empty() && nullptr != src_texture[ 2 ] ) {
|
||||
tex_size += src_texture[2]->Data.size(); step++;
|
||||
}
|
||||
if(!pID_A.empty() && nullptr != src_texture[ 3 ] ) {
|
||||
tex_size += src_texture[3]->Data.size(); step++;
|
||||
}
|
||||
|
||||
// Create target array.
|
||||
converted_texture.Data = new uint8_t[tex_size];
|
||||
// And copy data
|
||||
auto CopyTextureData = [&](const std::string& pID, const size_t pOffset, const size_t pStep, const uint8_t pSrcTexNum) -> void
|
||||
|
@ -686,7 +686,6 @@ std::list<unsigned int> mesh_idx;
|
|||
tmesh->mNumVertices = static_cast<unsigned int>(vert_arr.size());
|
||||
tmesh->mVertices = new aiVector3D[tmesh->mNumVertices];
|
||||
tmesh->mColors[0] = new aiColor4D[tmesh->mNumVertices];
|
||||
tmesh->mFaces = new aiFace[face_list_cur.size()];
|
||||
|
||||
memcpy(tmesh->mVertices, vert_arr.data(), tmesh->mNumVertices * sizeof(aiVector3D));
|
||||
memcpy(tmesh->mColors[0], col_arr.data(), tmesh->mNumVertices * sizeof(aiColor4D));
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -45,6 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "ASELoader.h"
|
||||
#include "StringComparison.h"
|
||||
|
@ -1319,4 +1322,6 @@ bool ASEImporter::GenerateNormals(ASE::Mesh& mesh) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -52,6 +53,7 @@ struct aiNode;
|
|||
|
||||
namespace Assimp {
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Importer class for the 3DS ASE ASCII format.
|
||||
|
@ -62,9 +64,6 @@ public:
|
|||
ASEImporter();
|
||||
~ASEImporter();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns whether the class can handle the format of the given file.
|
||||
* See BaseImporter::CanRead() for details.
|
||||
|
@ -200,6 +199,9 @@ protected:
|
|||
bool noSkeletonMesh;
|
||||
};
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
||||
|
||||
#endif // AI_3DSIMPORTER_H_INC
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -45,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "TextureTransform.h"
|
||||
|
@ -2150,4 +2152,6 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut)
|
|||
iOut = strtoul10(filePtr,&filePtr);
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -48,6 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/mesh.h>
|
||||
#include <assimp/anim.h>
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
// for some helper routines like IsSpace()
|
||||
#include "ParsingUtils.h"
|
||||
#include "qnan.h"
|
||||
|
@ -661,4 +664,6 @@ public:
|
|||
} // Namespace ASE
|
||||
} // Namespace ASSIMP
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
#endif // !! include guard
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -138,6 +139,17 @@ inline size_t Write<aiVector3D>(IOStream * stream, const aiVector3D& v)
|
|||
return t;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Serialize a color value
|
||||
template <>
|
||||
inline size_t Write<aiColor3D>(IOStream * stream, const aiColor3D& v)
|
||||
{
|
||||
size_t t = Write<float>(stream,v.r);
|
||||
t += Write<float>(stream,v.g);
|
||||
t += Write<float>(stream,v.b);
|
||||
return t;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Serialize a color value
|
||||
template <>
|
||||
|
@ -324,10 +336,13 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
|
|||
{
|
||||
AssbinChunkWriter chunk( container, ASSBIN_CHUNK_AINODE );
|
||||
|
||||
unsigned int nb_metadata = (node->mMetaData != NULL ? node->mMetaData->mNumProperties : 0);
|
||||
|
||||
Write<aiString>(&chunk,node->mName);
|
||||
Write<aiMatrix4x4>(&chunk,node->mTransformation);
|
||||
Write<unsigned int>(&chunk,node->mNumChildren);
|
||||
Write<unsigned int>(&chunk,node->mNumMeshes);
|
||||
Write<unsigned int>(&chunk,nb_metadata);
|
||||
|
||||
for (unsigned int i = 0; i < node->mNumMeshes;++i) {
|
||||
Write<unsigned int>(&chunk,node->mMeshes[i]);
|
||||
|
@ -336,6 +351,44 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
|
|||
for (unsigned int i = 0; i < node->mNumChildren;++i) {
|
||||
WriteBinaryNode( &chunk, node->mChildren[i] );
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < nb_metadata; ++i) {
|
||||
const aiString& key = node->mMetaData->mKeys[i];
|
||||
aiMetadataType type = node->mMetaData->mValues[i].mType;
|
||||
void* value = node->mMetaData->mValues[i].mData;
|
||||
|
||||
Write<aiString>(&chunk, key);
|
||||
Write<uint16_t>(&chunk, type);
|
||||
|
||||
switch (type) {
|
||||
case AI_BOOL:
|
||||
Write<bool>(&chunk, *((bool*) value));
|
||||
break;
|
||||
case AI_INT32:
|
||||
Write<int32_t>(&chunk, *((int32_t*) value));
|
||||
break;
|
||||
case AI_UINT64:
|
||||
Write<uint64_t>(&chunk, *((uint64_t*) value));
|
||||
break;
|
||||
case AI_FLOAT:
|
||||
Write<float>(&chunk, *((float*) value));
|
||||
break;
|
||||
case AI_DOUBLE:
|
||||
Write<double>(&chunk, *((double*) value));
|
||||
break;
|
||||
case AI_AISTRING:
|
||||
Write<aiString>(&chunk, *((aiString*) value));
|
||||
break;
|
||||
case AI_AIVECTOR3D:
|
||||
Write<aiVector3D>(&chunk, *((aiVector3D*) value));
|
||||
break;
|
||||
#ifdef SWIG
|
||||
case FORCE_32BIT:
|
||||
#endif // SWIG
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
@ -597,9 +650,9 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
|
|||
Write<float>(&chunk,l->mAttenuationQuadratic);
|
||||
}
|
||||
|
||||
Write<aiVector3D>(&chunk,(const aiVector3D&)l->mColorDiffuse);
|
||||
Write<aiVector3D>(&chunk,(const aiVector3D&)l->mColorSpecular);
|
||||
Write<aiVector3D>(&chunk,(const aiVector3D&)l->mColorAmbient);
|
||||
Write<aiColor3D>(&chunk,l->mColorDiffuse);
|
||||
Write<aiColor3D>(&chunk,l->mColorSpecular);
|
||||
Write<aiColor3D>(&chunk,l->mColorAmbient);
|
||||
|
||||
if (l->mType == aiLightSource_SPOT) {
|
||||
Write<float>(&chunk,l->mAngleInnerCone);
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -197,8 +198,7 @@ template <typename T> void ReadBounds( IOStream * stream, T* /*p*/, unsigned int
|
|||
stream->Seek( sizeof(T) * n, aiOrigin_CUR );
|
||||
}
|
||||
|
||||
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
|
||||
{
|
||||
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node, aiNode* parent ) {
|
||||
uint32_t chunkID = Read<uint32_t>(stream);
|
||||
ai_assert(chunkID == ASSBIN_CHUNK_AINODE);
|
||||
/*uint32_t size =*/ Read<uint32_t>(stream);
|
||||
|
@ -209,23 +209,65 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
|
|||
(*node)->mTransformation = Read<aiMatrix4x4>(stream);
|
||||
(*node)->mNumChildren = Read<unsigned int>(stream);
|
||||
(*node)->mNumMeshes = Read<unsigned int>(stream);
|
||||
unsigned int nb_metadata = Read<unsigned int>(stream);
|
||||
|
||||
if ((*node)->mNumMeshes)
|
||||
{
|
||||
if(parent) {
|
||||
(*node)->mParent = parent;
|
||||
}
|
||||
|
||||
if ((*node)->mNumMeshes) {
|
||||
(*node)->mMeshes = new unsigned int[(*node)->mNumMeshes];
|
||||
for (unsigned int i = 0; i < (*node)->mNumMeshes; ++i) {
|
||||
(*node)->mMeshes[i] = Read<unsigned int>(stream);
|
||||
}
|
||||
}
|
||||
|
||||
if ((*node)->mNumChildren)
|
||||
{
|
||||
if ((*node)->mNumChildren) {
|
||||
(*node)->mChildren = new aiNode*[(*node)->mNumChildren];
|
||||
for (unsigned int i = 0; i < (*node)->mNumChildren; ++i) {
|
||||
ReadBinaryNode( stream, &(*node)->mChildren[i] );
|
||||
ReadBinaryNode( stream, &(*node)->mChildren[i], *node );
|
||||
}
|
||||
}
|
||||
|
||||
if ( nb_metadata > 0 ) {
|
||||
(*node)->mMetaData = aiMetadata::Alloc(nb_metadata);
|
||||
for (unsigned int i = 0; i < nb_metadata; ++i) {
|
||||
(*node)->mMetaData->mKeys[i] = Read<aiString>(stream);
|
||||
(*node)->mMetaData->mValues[i].mType = (aiMetadataType) Read<uint16_t>(stream);
|
||||
void* data( nullptr );
|
||||
|
||||
switch ((*node)->mMetaData->mValues[i].mType) {
|
||||
case AI_BOOL:
|
||||
data = new bool(Read<bool>(stream));
|
||||
break;
|
||||
case AI_INT32:
|
||||
data = new int32_t(Read<int32_t>(stream));
|
||||
break;
|
||||
case AI_UINT64:
|
||||
data = new uint64_t(Read<uint64_t>(stream));
|
||||
break;
|
||||
case AI_FLOAT:
|
||||
data = new float(Read<float>(stream));
|
||||
break;
|
||||
case AI_DOUBLE:
|
||||
data = new double(Read<double>(stream));
|
||||
break;
|
||||
case AI_AISTRING:
|
||||
data = new aiString(Read<aiString>(stream));
|
||||
break;
|
||||
case AI_AIVECTOR3D:
|
||||
data = new aiVector3D(Read<aiVector3D>(stream));
|
||||
break;
|
||||
#ifndef SWIG
|
||||
case FORCE_32BIT:
|
||||
#endif // SWIG
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
(*node)->mMetaData->mValues[i].mData = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
@ -570,7 +612,7 @@ void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene )
|
|||
|
||||
// Read node graph
|
||||
scene->mRootNode = new aiNode[1];
|
||||
ReadBinaryNode( stream, &scene->mRootNode );
|
||||
ReadBinaryNode( stream, &scene->mRootNode, (aiNode*)NULL );
|
||||
|
||||
// Read all meshes
|
||||
if (scene->mNumMeshes)
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -70,7 +71,6 @@ class AssbinImporter : public BaseImporter
|
|||
private:
|
||||
bool shortened;
|
||||
bool compressed;
|
||||
protected:
|
||||
|
||||
public:
|
||||
virtual bool CanRead(
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
IOSystem* pIOHandler
|
||||
);
|
||||
void ReadBinaryScene( IOStream * stream, aiScene* pScene );
|
||||
void ReadBinaryNode( IOStream * stream, aiNode** mRootNode );
|
||||
void ReadBinaryNode( IOStream * stream, aiNode** mRootNode, aiNode* parent );
|
||||
void ReadBinaryMesh( IOStream * stream, aiMesh* mesh );
|
||||
void ReadBinaryBone( IOStream * stream, aiBone* bone );
|
||||
void ReadBinaryMaterial(IOStream * stream, aiMaterial* mat);
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -65,8 +66,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
using namespace Assimp;
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
// underlying structure for aiPropertyStore
|
||||
typedef BatchLoader::PropertyMap PropertyMap;
|
||||
|
||||
|
@ -109,12 +109,11 @@ static std::mutex gLogStreamMutex;
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Custom LogStream implementation for the C-API
|
||||
class LogToCallbackRedirector : public LogStream
|
||||
{
|
||||
class LogToCallbackRedirector : public LogStream {
|
||||
public:
|
||||
explicit LogToCallbackRedirector(const aiLogStream& s)
|
||||
: stream (s) {
|
||||
ai_assert(NULL != s.callback);
|
||||
: stream (s) {
|
||||
ai_assert(NULL != s.callback);
|
||||
}
|
||||
|
||||
~LogToCallbackRedirector() {
|
||||
|
@ -145,8 +144,7 @@ private:
|
|||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ReportSceneNotFoundError()
|
||||
{
|
||||
void ReportSceneNotFoundError() {
|
||||
DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. "
|
||||
"The C-API does not accept scenes produced by the C++ API and vice versa");
|
||||
|
||||
|
@ -155,22 +153,18 @@ void ReportSceneNotFoundError()
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Reads the given file and returns its content.
|
||||
const aiScene* aiImportFile( const char* pFile, unsigned int pFlags)
|
||||
{
|
||||
const aiScene* aiImportFile( const char* pFile, unsigned int pFlags) {
|
||||
return aiImportFileEx(pFile,pFlags,NULL);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO* pFS)
|
||||
{
|
||||
const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO* pFS) {
|
||||
return aiImportFileExWithProperties(pFile, pFlags, pFS, NULL);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags,
|
||||
aiFileIO* pFS,
|
||||
const aiPropertyStore* props)
|
||||
{
|
||||
const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags,
|
||||
aiFileIO* pFS, const aiPropertyStore* props) {
|
||||
ai_assert(NULL != pFile);
|
||||
|
||||
const aiScene* scene = NULL;
|
||||
|
@ -189,7 +183,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl
|
|||
pimpl->mMatrixProperties = pp->matrices;
|
||||
}
|
||||
// setup a custom IO system if necessary
|
||||
if (pFS) {
|
||||
if (pFS) {
|
||||
imp->SetIOHandler( new CIOSystemWrapper (pFS) );
|
||||
}
|
||||
|
||||
|
@ -200,8 +194,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl
|
|||
if( scene) {
|
||||
ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) );
|
||||
priv->mOrigImporter = imp;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// if failed, extract error code and destroy the import
|
||||
gLastErrorString = imp->GetErrorString();
|
||||
delete imp;
|
||||
|
@ -209,6 +202,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl
|
|||
|
||||
// return imported data. If the import failed the pointer is NULL anyways
|
||||
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -44,8 +45,9 @@ Assimp C export interface. See Exporter.cpp for some notes.
|
|||
*/
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
#include "CInterfaceIOWrapper.h"
|
||||
#include "SceneCombiner.h"
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include "ScenePrivate.h"
|
||||
#include <assimp/Exporter.hpp>
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -81,6 +82,20 @@ static const aiImporterDesc desc = {
|
|||
|
||||
//#define DEBUG_B3D
|
||||
|
||||
template<typename T>
|
||||
void DeleteAllBarePointers(std::vector<T>& x)
|
||||
{
|
||||
for(auto p : x)
|
||||
{
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
B3DImporter::~B3DImporter()
|
||||
{
|
||||
DeleteAllBarePointers(_animations);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool B3DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const{
|
||||
|
||||
|
@ -557,13 +572,19 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
|
|||
void B3DImporter::ReadBB3D( aiScene *scene ){
|
||||
|
||||
_textures.clear();
|
||||
|
||||
_materials.clear();
|
||||
|
||||
_vertices.clear();
|
||||
|
||||
_meshes.clear();
|
||||
|
||||
DeleteAllBarePointers(_nodes);
|
||||
_nodes.clear();
|
||||
|
||||
_nodeAnims.clear();
|
||||
|
||||
DeleteAllBarePointers(_animations);
|
||||
_animations.clear();
|
||||
|
||||
string t=ReadChunk();
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -58,6 +59,8 @@ namespace Assimp{
|
|||
|
||||
class B3DImporter : public BaseImporter{
|
||||
public:
|
||||
B3DImporter() = default;
|
||||
virtual ~B3DImporter();
|
||||
|
||||
virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -302,24 +303,13 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
|
|||
return false;
|
||||
}
|
||||
|
||||
#include "../contrib/ConvertUTF/ConvertUTF.h"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ReportResult(ConversionResult res)
|
||||
{
|
||||
if(res == sourceExhausted) {
|
||||
DefaultLogger::get()->error("Source ends with incomplete character sequence, transformation to UTF-8 fails");
|
||||
}
|
||||
else if(res == sourceIllegal) {
|
||||
DefaultLogger::get()->error("Source contains illegal character sequence, transformation to UTF-8 fails");
|
||||
}
|
||||
}
|
||||
#include "../contrib/utf8cpp/source/utf8.h"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Convert to UTF8 data
|
||||
void BaseImporter::ConvertToUTF8(std::vector<char>& data)
|
||||
{
|
||||
ConversionResult result;
|
||||
//ConversionResult result;
|
||||
if(data.size() < 8) {
|
||||
throw DeadlyImportError("File is too small");
|
||||
}
|
||||
|
@ -332,7 +322,8 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
|
|||
data.resize(data.size()-3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// UTF 32 BE with BOM
|
||||
if(*((uint32_t*)&data.front()) == 0xFFFE0000) {
|
||||
|
||||
|
@ -346,21 +337,10 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
|
|||
if(*((uint32_t*)&data.front()) == 0x0000FFFE) {
|
||||
DefaultLogger::get()->debug("Found UTF-32 BOM ...");
|
||||
|
||||
const uint32_t* sstart = (uint32_t*)&data.front()+1, *send = (uint32_t*)&data.back()+1;
|
||||
char* dstart,*dend;
|
||||
std::vector<char> output;
|
||||
do {
|
||||
output.resize(output.size()?output.size()*3/2:data.size()/2);
|
||||
dstart = &output.front(),dend = &output.back()+1;
|
||||
|
||||
result = ConvertUTF32toUTF8((const UTF32**)&sstart,(const UTF32*)send,(UTF8**)&dstart,(UTF8*)dend,lenientConversion);
|
||||
} while(result == targetExhausted);
|
||||
|
||||
ReportResult(result);
|
||||
|
||||
// copy to output buffer.
|
||||
const size_t outlen = (size_t)(dstart-&output.front());
|
||||
data.assign(output.begin(),output.begin()+outlen);
|
||||
int *ptr = (int*)&data[ 0 ];
|
||||
int *end = ptr + ( data.size() / sizeof(int) ) +1;
|
||||
utf8::utf32to8( ptr, end, back_inserter(output));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -377,21 +357,8 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
|
|||
if(*((uint16_t*)&data.front()) == 0xFEFF) {
|
||||
DefaultLogger::get()->debug("Found UTF-16 BOM ...");
|
||||
|
||||
const uint16_t* sstart = (uint16_t*)&data.front()+1, *send = (uint16_t*)(&data.back()+1);
|
||||
char* dstart,*dend;
|
||||
std::vector<char> output;
|
||||
do {
|
||||
output.resize(output.size()?output.size()*3/2:data.size()*3/4);
|
||||
dstart = &output.front(),dend = &output.back()+1;
|
||||
|
||||
result = ConvertUTF16toUTF8((const UTF16**)&sstart,(const UTF16*)send,(UTF8**)&dstart,(UTF8*)dend,lenientConversion);
|
||||
} while(result == targetExhausted);
|
||||
|
||||
ReportResult(result);
|
||||
|
||||
// copy to output buffer.
|
||||
const size_t outlen = (size_t)(dstart-&output.front());
|
||||
data.assign(output.begin(),output.begin()+outlen);
|
||||
std::vector<unsigned char> output;
|
||||
utf8::utf16to8(data.begin(), data.end(), back_inserter(output));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -60,7 +61,6 @@ class BaseProcess;
|
|||
class SharedPostProcessInfo;
|
||||
class IOStream;
|
||||
|
||||
|
||||
// utility to do char4 to uint32 in a portable manner
|
||||
#define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \
|
||||
(string[1] << 16) + (string[2] << 8) + string[3]))
|
||||
|
@ -193,14 +193,11 @@ public:
|
|||
const Importer* pImp
|
||||
);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Called by #Importer::GetImporterInfo to get a description of
|
||||
* some loader features. Importers must provide this information. */
|
||||
virtual const aiImporterDesc* GetInfo() const = 0;
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Called by #Importer::GetExtensionList for each loaded importer.
|
||||
* Take the extension list contained in the structure returned by
|
||||
|
@ -316,7 +313,7 @@ public: // static utilities
|
|||
* @param Size of one token, in bytes. Maximally 16 bytes.
|
||||
* @return true if one of the given tokens was found
|
||||
*
|
||||
* @note For convinence, the check is also performed for the
|
||||
* @note For convenience, the check is also performed for the
|
||||
* byte-swapped variant of all tokens (big endian). Only for
|
||||
* tokens of size 2,4.
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -52,7 +52,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace Assimp
|
||||
{
|
||||
template< > const std::string LogFunctions< BlenderBMeshConverter >::log_prefix = "BLEND_BMESH: ";
|
||||
template< > const char* LogFunctions< BlenderBMeshConverter >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_BMESH: ";
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace Assimp;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -252,10 +253,7 @@ public:
|
|||
* a compiler complain is the result.
|
||||
* @param dest Destination value to be written
|
||||
* @param db File database, including input stream. */
|
||||
template <typename T> inline void Convert (T& dest,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
|
||||
template <typename T> void Convert (T& dest, const FileDatabase& db) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
// generic converter
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -73,7 +74,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
template<> const std::string LogFunctions<BlenderImporter>::log_prefix = "BLEND: ";
|
||||
template<> const char* LogFunctions<BlenderImporter>::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND: ";
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace Assimp;
|
||||
|
@ -109,6 +114,7 @@ BlenderImporter::~BlenderImporter()
|
|||
}
|
||||
|
||||
static const char* Tokens[] = { "BLENDER" };
|
||||
static const char* TokensForSearch[] = { "blender" };
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
|
@ -121,7 +127,7 @@ bool BlenderImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, b
|
|||
|
||||
else if ((!extension.length() || checkSig) && pIOHandler) {
|
||||
// note: this won't catch compressed files
|
||||
return SearchFileHeaderForToken(pIOHandler,pFile, Tokens,1);
|
||||
return SearchFileHeaderForToken(pIOHandler,pFile, TokensForSearch,1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -42,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
* @brief Implementation of some blender modifiers (i.e subdivision, mirror).
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
|
||||
#include "BlenderModifier.h"
|
||||
#include "SceneCombiner.h"
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include "Subdivision.h"
|
||||
#include <assimp/scene.h>
|
||||
#include <memory>
|
||||
|
@ -265,7 +266,7 @@ void BlenderModifier_Mirror :: DoIt(aiNode& out, ConversionData& conv_data, co
|
|||
|
||||
std::copy(out.mMeshes,out.mMeshes+out.mNumMeshes,nind);
|
||||
std::transform(out.mMeshes,out.mMeshes+out.mNumMeshes,nind+out.mNumMeshes,
|
||||
std::bind1st(std::plus< unsigned int >(),out.mNumMeshes));
|
||||
[&out](unsigned int n) { return out.mNumMeshes + n; });
|
||||
|
||||
delete[] out.mMeshes;
|
||||
out.mMeshes = nind;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -638,6 +639,7 @@ struct Base : ElemBase {
|
|||
|
||||
Base()
|
||||
: ElemBase()
|
||||
, prev( nullptr )
|
||||
, next()
|
||||
, object() {
|
||||
// empty
|
||||
|
@ -784,10 +786,12 @@ struct Tex : ElemBase {
|
|||
//char use_nodes;
|
||||
|
||||
Tex()
|
||||
: ElemBase() {
|
||||
: ElemBase()
|
||||
, imaflag( ImageFlags_INTERPOL )
|
||||
, type( Type_CLOUDS )
|
||||
, ima() {
|
||||
// empty
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -58,7 +59,11 @@ static const unsigned int BLEND_TESS_MAGIC = 0x83ed9ac3;
|
|||
|
||||
namspace Assimp
|
||||
{
|
||||
template< > const std::string LogFunctions< BlenderTessellatorGL >::log_prefix = "BLEND_TESS_GL: ";
|
||||
template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_TESS_GL: ";
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace Assimp;
|
||||
|
@ -251,7 +256,11 @@ void BlenderTessellatorGL::TessellateError( GLenum errorCode, void* )
|
|||
|
||||
namespace Assimp
|
||||
{
|
||||
template< > const std::string LogFunctions< BlenderTessellatorP2T >::log_prefix = "BLEND_TESS_P2T: ";
|
||||
template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_TESS_P2T: ";
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace Assimp;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -393,7 +393,7 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
aiMesh* C4DImporter::ReadMesh(BaseObject* object)
|
||||
{
|
||||
assert(object != NULL && object->GetType() == Opolygon);
|
||||
ai_assert(object != NULL && object->GetType() == Opolygon);
|
||||
|
||||
// based on Melange sample code
|
||||
PolygonObject* const polyObject = dynamic_cast<PolygonObject*>(object);
|
||||
|
@ -635,7 +635,7 @@ unsigned int C4DImporter::ResolveMaterial(PolygonObject* obj)
|
|||
TextureTag& ttag = dynamic_cast<TextureTag&>(*tag);
|
||||
|
||||
BaseMaterial* const mat = ttag.GetMaterial();
|
||||
assert(mat != NULL);
|
||||
ai_assert(mat != NULL);
|
||||
|
||||
const MaterialMap::const_iterator it = material_mapping.find(mat);
|
||||
if(it == material_mapping.end()) {
|
||||
|
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "BaseImporter.h"
|
||||
#include "LogAux.h"
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
struct aiNode;
|
||||
struct aiMesh;
|
||||
struct aiMaterial;
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Open Asset Import Library (assimp)
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006-2016, assimp team
|
||||
# Copyright (c) 2006-2017, assimp team
|
||||
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this software in source and binary forms,
|
||||
|
@ -58,8 +59,9 @@ SET( PUBLIC_HEADERS
|
|||
${HEADER_PATH}/camera.h
|
||||
${HEADER_PATH}/color4.h
|
||||
${HEADER_PATH}/color4.inl
|
||||
${HEADER_PATH}/config.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../include/assimp/config.h
|
||||
${HEADER_PATH}/defs.h
|
||||
${HEADER_PATH}/Defines.h
|
||||
${HEADER_PATH}/cfileio.h
|
||||
${HEADER_PATH}/light.h
|
||||
${HEADER_PATH}/material.h
|
||||
|
@ -95,6 +97,7 @@ SET( PUBLIC_HEADERS
|
|||
${HEADER_PATH}/Exporter.hpp
|
||||
${HEADER_PATH}/DefaultIOStream.h
|
||||
${HEADER_PATH}/DefaultIOSystem.h
|
||||
${HEADER_PATH}/SceneCombiner.h
|
||||
)
|
||||
|
||||
SET( Core_SRCS
|
||||
|
@ -147,7 +150,6 @@ SET( Common_SRCS
|
|||
SpatialSort.cpp
|
||||
SpatialSort.h
|
||||
SceneCombiner.cpp
|
||||
SceneCombiner.h
|
||||
ScenePreprocessor.cpp
|
||||
ScenePreprocessor.h
|
||||
SkeletonMeshBuilder.cpp
|
||||
|
@ -569,6 +571,9 @@ SET( PostProcessing_SRCS
|
|||
)
|
||||
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
|
||||
|
||||
SET( IrrXML_SRCS irrXMLWrapper.h )
|
||||
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
||||
|
||||
ADD_ASSIMP_IMPORTER( Q3D
|
||||
Q3DLoader.cpp
|
||||
Q3DLoader.h
|
||||
|
@ -643,6 +648,9 @@ ADD_ASSIMP_IMPORTER(X3D
|
|||
X3DImporter_Rendering.cpp
|
||||
X3DImporter_Shape.cpp
|
||||
X3DImporter_Texturing.cpp
|
||||
FIReader.hpp
|
||||
FIReader.cpp
|
||||
X3DVocabulary.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( GLTF
|
||||
|
@ -654,6 +662,14 @@ ADD_ASSIMP_IMPORTER( GLTF
|
|||
glTFImporter.h
|
||||
glTFExporter.h
|
||||
glTFExporter.cpp
|
||||
glTF2Asset.h
|
||||
glTF2Asset.inl
|
||||
glTF2AssetWriter.h
|
||||
glTF2AssetWriter.inl
|
||||
glTF2Importer.cpp
|
||||
glTF2Importer.h
|
||||
glTF2Exporter.h
|
||||
glTF2Exporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( 3MF
|
||||
|
@ -663,6 +679,16 @@ ADD_ASSIMP_IMPORTER( 3MF
|
|||
D3MFOpcPackage.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( MMD
|
||||
MMDCpp14.h
|
||||
MMDImporter.cpp
|
||||
MMDImporter.h
|
||||
MMDPmdParser.h
|
||||
MMDPmxParser.h
|
||||
MMDPmxParser.cpp
|
||||
MMDVmdParser.h
|
||||
)
|
||||
|
||||
SET( Step_SRCS
|
||||
StepExporter.h
|
||||
StepExporter.cpp
|
||||
|
@ -681,23 +707,6 @@ SET( Extra_SRCS
|
|||
)
|
||||
SOURCE_GROUP( Extra FILES ${Extra_SRCS})
|
||||
|
||||
SET( IrrXML_SRCS
|
||||
irrXMLWrapper.h
|
||||
../contrib/irrXML/CXMLReaderImpl.h
|
||||
../contrib/irrXML/heapsort.h
|
||||
../contrib/irrXML/irrArray.h
|
||||
../contrib/irrXML/irrString.h
|
||||
../contrib/irrXML/irrTypes.h
|
||||
../contrib/irrXML/irrXML.cpp
|
||||
../contrib/irrXML/irrXML.h
|
||||
)
|
||||
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
||||
|
||||
SET( ConvertUTF_SRCS
|
||||
../contrib/ConvertUTF/ConvertUTF.h
|
||||
../contrib/ConvertUTF/ConvertUTF.c
|
||||
)
|
||||
SOURCE_GROUP( ConvertUTF FILES ${ConvertUTF_SRCS})
|
||||
|
||||
SET( Clipper_SRCS
|
||||
../contrib/clipper/clipper.hpp
|
||||
|
@ -735,10 +744,12 @@ SET ( openddl_parser_SRCS
|
|||
../contrib/openddlparser/code/OpenDDLCommon.cpp
|
||||
../contrib/openddlparser/code/OpenDDLExport.cpp
|
||||
../contrib/openddlparser/code/Value.cpp
|
||||
../contrib/openddlparser/code/OpenDDLStream.cpp
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLParser.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLCommon.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLExport.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLStream.h
|
||||
../contrib/openddlparser/include/openddlparser/DDLNode.h
|
||||
../contrib/openddlparser/include/openddlparser/Value.h
|
||||
)
|
||||
|
@ -833,7 +844,6 @@ SET( assimp_src
|
|||
|
||||
# Third-party libraries
|
||||
${IrrXML_SRCS}
|
||||
${ConvertUTF_SRCS}
|
||||
${unzip_compile_SRCS}
|
||||
${Poly2Tri_SRCS}
|
||||
${Clipper_SRCS}
|
||||
|
@ -848,7 +858,8 @@ SET( assimp_src
|
|||
ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD )
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
../contrib/openddlparser/include
|
||||
${IRRXML_INCLUDE_DIR}
|
||||
../contrib/openddlparser/include
|
||||
)
|
||||
|
||||
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
|
@ -858,7 +869,7 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|||
|
||||
ADD_LIBRARY( assimp ${assimp_src} )
|
||||
|
||||
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} )
|
||||
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
||||
|
||||
if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||
set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI)
|
||||
|
@ -932,14 +943,25 @@ if (ASSIMP_ANDROID_JNIIOSYSTEM)
|
|||
endif(ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||
|
||||
if(MSVC AND ASSIMP_INSTALL_PDB)
|
||||
install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
CONFIGURATIONS Debug
|
||||
)
|
||||
install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp${LIBRARY_SUFFIX}.pdb
|
||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
)
|
||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
||||
install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
CONFIGURATIONS Debug
|
||||
)
|
||||
install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp${LIBRARY_SUFFIX}.pdb
|
||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
)
|
||||
ELSE()
|
||||
install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
CONFIGURATIONS Debug
|
||||
)
|
||||
install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}.pdb
|
||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
)
|
||||
ENDIF()
|
||||
endif ()
|
||||
|
||||
if (ASSIMP_COVERALLS)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -941,20 +941,22 @@ void COBImporter::UnsupportedChunk_Binary( StreamReaderLE& reader, const ChunkIn
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// tiny utility guard to aid me at staying within chunk boundaries.
|
||||
class chunk_guard {
|
||||
|
||||
public:
|
||||
|
||||
chunk_guard(const COB::ChunkInfo& nfo, StreamReaderLE& reader)
|
||||
: nfo(nfo)
|
||||
, reader(reader)
|
||||
, cur(reader.GetCurrentPos())
|
||||
{
|
||||
: nfo(nfo)
|
||||
, reader(reader)
|
||||
, cur(reader.GetCurrentPos()) {
|
||||
}
|
||||
|
||||
~chunk_guard() {
|
||||
// don't do anything if the size is not given
|
||||
if(nfo.size != static_cast<unsigned int>(-1)) {
|
||||
reader.IncPtr(static_cast<int>(nfo.size)-reader.GetCurrentPos()+cur);
|
||||
try {
|
||||
reader.IncPtr( static_cast< int >( nfo.size ) - reader.GetCurrentPos() + cur );
|
||||
} catch ( DeadlyImportError e ) {
|
||||
// out of limit so correct the value
|
||||
reader.IncPtr( reader.GetReadLimit() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -44,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "ColladaExporter.h"
|
||||
#include "Bitmap.h"
|
||||
#include "fast_atof.h"
|
||||
#include "SceneCombiner.h"
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include "StringUtils.h"
|
||||
#include "XMLTools.h"
|
||||
#include <assimp/DefaultIOSystem.h>
|
||||
|
@ -57,6 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <memory>
|
||||
#include <ctime>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -135,6 +138,7 @@ void ColladaExporter::WriteFile()
|
|||
WriteLightsLibrary();
|
||||
WriteMaterials();
|
||||
WriteGeometryLibrary();
|
||||
WriteControllerLibrary();
|
||||
|
||||
WriteSceneLibrary();
|
||||
|
||||
|
@ -552,7 +556,7 @@ void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::strin
|
|||
std::stringstream imageUrlEncoded;
|
||||
for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it )
|
||||
{
|
||||
if( isalnum_C( (unsigned char) *it) || *it == ':' || *it == '_' || *it == '.' || *it == '/' || *it == '\\' )
|
||||
if( isalnum_C( (unsigned char) *it) || *it == ':' || *it == '_' || *it == '-' || *it == '.' || *it == '/' || *it == '\\' )
|
||||
imageUrlEncoded << *it;
|
||||
else
|
||||
imageUrlEncoded << '%' << std::hex << size_t( (unsigned char) *it) << std::dec;
|
||||
|
@ -694,7 +698,6 @@ void ColladaExporter::WriteMaterials()
|
|||
|
||||
materials[a].shininess.exist = mat->Get( AI_MATKEY_SHININESS, materials[a].shininess.value) == aiReturn_SUCCESS;
|
||||
materials[a].transparency.exist = mat->Get( AI_MATKEY_OPACITY, materials[a].transparency.value) == aiReturn_SUCCESS;
|
||||
materials[a].transparency.value = materials[a].transparency.value;
|
||||
materials[a].index_refraction.exist = mat->Get( AI_MATKEY_REFRACTI, materials[a].index_refraction.value) == aiReturn_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -789,6 +792,177 @@ void ColladaExporter::WriteMaterials()
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Writes the controller library
|
||||
void ColladaExporter::WriteControllerLibrary()
|
||||
{
|
||||
mOutput << startstr << "<library_controllers>" << endstr;
|
||||
PushTag();
|
||||
|
||||
for( size_t a = 0; a < mScene->mNumMeshes; ++a)
|
||||
WriteController( a);
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</library_controllers>" << endstr;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Writes a skin controller of the given mesh
|
||||
void ColladaExporter::WriteController( size_t pIndex)
|
||||
{
|
||||
const aiMesh* mesh = mScene->mMeshes[pIndex];
|
||||
const std::string idstr = GetMeshId( pIndex);
|
||||
const std::string idstrEscaped = XMLEscape(idstr);
|
||||
|
||||
if ( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
|
||||
return;
|
||||
|
||||
if ( mesh->mNumBones == 0 )
|
||||
return;
|
||||
|
||||
mOutput << startstr << "<controller id=\"" << idstrEscaped << "-skin\" ";
|
||||
mOutput << "name=\"skinCluster" << pIndex << "\">"<< endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<skin source=\"#" << idstrEscaped << "\">" << endstr;
|
||||
PushTag();
|
||||
|
||||
// bind pose matrix
|
||||
mOutput << startstr << "<bind_shape_matrix>" << endstr;
|
||||
PushTag();
|
||||
|
||||
// I think it is identity in general cases.
|
||||
aiMatrix4x4 mat;
|
||||
mOutput << startstr << mat.a1 << " " << mat.a2 << " " << mat.a3 << " " << mat.a4 << endstr;
|
||||
mOutput << startstr << mat.b1 << " " << mat.b2 << " " << mat.b3 << " " << mat.b4 << endstr;
|
||||
mOutput << startstr << mat.c1 << " " << mat.c2 << " " << mat.c3 << " " << mat.c4 << endstr;
|
||||
mOutput << startstr << mat.d1 << " " << mat.d2 << " " << mat.d3 << " " << mat.d4 << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</bind_shape_matrix>" << endstr;
|
||||
|
||||
mOutput << startstr << "<source id=\"" << idstrEscaped << "-skin-joints\" name=\"" << idstrEscaped << "-skin-joints\">" << endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<Name_array id=\"" << idstrEscaped << "-skin-joints-array\" count=\"" << mesh->mNumBones << "\">";
|
||||
|
||||
for( size_t i = 0; i < mesh->mNumBones; ++i )
|
||||
mOutput << XMLEscape(mesh->mBones[i]->mName.C_Str()) << " ";
|
||||
|
||||
mOutput << "</Name_array>" << endstr;
|
||||
|
||||
mOutput << startstr << "<technique_common>" << endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<accessor source=\"#" << idstrEscaped << "-skin-joints-array\" count=\"" << mesh->mNumBones << "\" stride=\"" << 1 << "\">" << endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<param name=\"JOINT\" type=\"Name\"></param>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</accessor>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</technique_common>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</source>" << endstr;
|
||||
|
||||
std::vector<ai_real> bind_poses;
|
||||
bind_poses.reserve(mesh->mNumBones * 16);
|
||||
for(unsigned int i = 0; i < mesh->mNumBones; ++i)
|
||||
for( unsigned int j = 0; j < 4; ++j)
|
||||
bind_poses.insert(bind_poses.end(), mesh->mBones[i]->mOffsetMatrix[j], mesh->mBones[i]->mOffsetMatrix[j] + 4);
|
||||
|
||||
WriteFloatArray( idstr + "-skin-bind_poses", FloatType_Mat4x4, (const ai_real*) bind_poses.data(), bind_poses.size() / 16);
|
||||
|
||||
bind_poses.clear();
|
||||
|
||||
std::vector<ai_real> skin_weights;
|
||||
skin_weights.reserve(mesh->mNumVertices * mesh->mNumBones);
|
||||
for( size_t i = 0; i < mesh->mNumBones; ++i)
|
||||
for( size_t j = 0; j < mesh->mBones[i]->mNumWeights; ++j)
|
||||
skin_weights.push_back(mesh->mBones[i]->mWeights[j].mWeight);
|
||||
|
||||
WriteFloatArray( idstr + "-skin-weights", FloatType_Weight, (const ai_real*) skin_weights.data(), skin_weights.size());
|
||||
|
||||
skin_weights.clear();
|
||||
|
||||
mOutput << startstr << "<joints>" << endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<input semantic=\"JOINT\" source=\"#" << idstrEscaped << "-skin-joints\"></input>" << endstr;
|
||||
mOutput << startstr << "<input semantic=\"INV_BIND_MATRIX\" source=\"#" << idstrEscaped << "-skin-bind_poses\"></input>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</joints>" << endstr;
|
||||
|
||||
mOutput << startstr << "<vertex_weights count=\"" << mesh->mNumVertices << "\">" << endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<input semantic=\"JOINT\" source=\"#" << idstrEscaped << "-skin-joints\" offset=\"0\"></input>" << endstr;
|
||||
mOutput << startstr << "<input semantic=\"WEIGHT\" source=\"#" << idstrEscaped << "-skin-weights\" offset=\"1\"></input>" << endstr;
|
||||
|
||||
mOutput << startstr << "<vcount>";
|
||||
|
||||
std::vector<ai_uint> num_influences(mesh->mNumVertices, (ai_uint)0);
|
||||
for( size_t i = 0; i < mesh->mNumBones; ++i)
|
||||
for( size_t j = 0; j < mesh->mBones[i]->mNumWeights; ++j)
|
||||
++num_influences[mesh->mBones[i]->mWeights[j].mVertexId];
|
||||
|
||||
for( size_t i = 0; i < mesh->mNumVertices; ++i)
|
||||
mOutput << num_influences[i] << " ";
|
||||
|
||||
mOutput << "</vcount>" << endstr;
|
||||
|
||||
mOutput << startstr << "<v>";
|
||||
|
||||
ai_uint joint_weight_indices_length = 0;
|
||||
std::vector<ai_uint> accum_influences;
|
||||
accum_influences.reserve(num_influences.size());
|
||||
for( size_t i = 0; i < num_influences.size(); ++i)
|
||||
{
|
||||
accum_influences.push_back(joint_weight_indices_length);
|
||||
joint_weight_indices_length += num_influences[i];
|
||||
}
|
||||
|
||||
ai_uint weight_index = 0;
|
||||
std::vector<ai_int> joint_weight_indices(2 * joint_weight_indices_length, (ai_int)-1);
|
||||
for( unsigned int i = 0; i < mesh->mNumBones; ++i)
|
||||
for( unsigned j = 0; j < mesh->mBones[i]->mNumWeights; ++j)
|
||||
{
|
||||
unsigned int vId = mesh->mBones[i]->mWeights[j].mVertexId;
|
||||
for( ai_uint k = 0; k < num_influences[vId]; ++k)
|
||||
{
|
||||
if (joint_weight_indices[2 * (accum_influences[vId] + k)] == -1)
|
||||
{
|
||||
joint_weight_indices[2 * (accum_influences[vId] + k)] = i;
|
||||
joint_weight_indices[2 * (accum_influences[vId] + k) + 1] = weight_index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
++weight_index;
|
||||
}
|
||||
|
||||
for( size_t i = 0; i < joint_weight_indices.size(); ++i)
|
||||
mOutput << joint_weight_indices[i] << " ";
|
||||
|
||||
num_influences.clear();
|
||||
accum_influences.clear();
|
||||
joint_weight_indices.clear();
|
||||
|
||||
mOutput << "</v>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</vertex_weights>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</skin>" << endstr;
|
||||
|
||||
PopTag();
|
||||
mOutput << startstr << "</controller>" << endstr;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Writes the geometry library
|
||||
void ColladaExporter::WriteGeometryLibrary()
|
||||
|
@ -953,6 +1127,8 @@ void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataTy
|
|||
case FloatType_TexCoord2: floatsPerElement = 2; break;
|
||||
case FloatType_TexCoord3: floatsPerElement = 3; break;
|
||||
case FloatType_Color: floatsPerElement = 3; break;
|
||||
case FloatType_Mat4x4: floatsPerElement = 16; break;
|
||||
case FloatType_Weight: floatsPerElement = 1; break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -1021,6 +1197,14 @@ void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataTy
|
|||
mOutput << startstr << "<param name=\"G\" type=\"float\" />" << endstr;
|
||||
mOutput << startstr << "<param name=\"B\" type=\"float\" />" << endstr;
|
||||
break;
|
||||
|
||||
case FloatType_Mat4x4:
|
||||
mOutput << startstr << "<param name=\"TRANSFORM\" type=\"float4x4\" />" << endstr;
|
||||
break;
|
||||
|
||||
case FloatType_Weight:
|
||||
mOutput << startstr << "<param name=\"WEIGHT\" type=\"float\" />" << endstr;
|
||||
break;
|
||||
}
|
||||
|
||||
PopTag();
|
||||
|
@ -1082,16 +1266,24 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
|
|||
// If the node is associated with a bone, it is a joint node (JOINT)
|
||||
// otherwise it is a normal node (NODE)
|
||||
const char * node_type;
|
||||
bool is_joint, is_skeleton_root = false;
|
||||
if (NULL == findBone(pScene, pNode->mName.C_Str())) {
|
||||
node_type = "NODE";
|
||||
is_joint = false;
|
||||
} else {
|
||||
node_type = "JOINT";
|
||||
is_joint = true;
|
||||
if(!pNode->mParent || NULL == findBone(pScene, pNode->mParent->mName.C_Str()))
|
||||
is_skeleton_root = true;
|
||||
}
|
||||
|
||||
const std::string node_name_escaped = XMLEscape(pNode->mName.data);
|
||||
mOutput << startstr
|
||||
<< "<node id=\"" << node_name_escaped
|
||||
<< "\" name=\"" << node_name_escaped
|
||||
<< "<node ";
|
||||
if(is_skeleton_root)
|
||||
mOutput << "id=\"" << "skeleton_root" << "\" "; // For now, only support one skeleton in a scene.
|
||||
mOutput << (is_joint ? "s" : "") << "id=\"" << node_name_escaped;
|
||||
mOutput << "\" name=\"" << node_name_escaped
|
||||
<< "\" type=\"" << node_type
|
||||
<< "\">" << endstr;
|
||||
PushTag();
|
||||
|
@ -1099,7 +1291,7 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
|
|||
// write transformation - we can directly put the matrix there
|
||||
// TODO: (thom) decompose into scale - rot - quad to allow addressing it by animations afterwards
|
||||
const aiMatrix4x4& mat = pNode->mTransformation;
|
||||
mOutput << startstr << "<matrix>";
|
||||
mOutput << startstr << "<matrix sid=\"transform\">";
|
||||
mOutput << mat.a1 << " " << mat.a2 << " " << mat.a3 << " " << mat.a4 << " ";
|
||||
mOutput << mat.b1 << " " << mat.b2 << " " << mat.b3 << " " << mat.b4 << " ";
|
||||
mOutput << mat.c1 << " " << mat.c2 << " " << mat.c3 << " " << mat.c4 << " ";
|
||||
|
@ -1127,33 +1319,50 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
|
|||
for( size_t a = 0; a < pNode->mNumMeshes; ++a )
|
||||
{
|
||||
const aiMesh* mesh = mScene->mMeshes[pNode->mMeshes[a]];
|
||||
// do not instanciate mesh if empty. I wonder how this could happen
|
||||
if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
|
||||
continue;
|
||||
mOutput << startstr << "<instance_geometry url=\"#" << XMLEscape(GetMeshId( pNode->mMeshes[a])) << "\">" << endstr;
|
||||
PushTag();
|
||||
mOutput << startstr << "<bind_material>" << endstr;
|
||||
PushTag();
|
||||
mOutput << startstr << "<technique_common>" << endstr;
|
||||
PushTag();
|
||||
mOutput << startstr << "<instance_material symbol=\"defaultMaterial\" target=\"#" << XMLEscape(materials[mesh->mMaterialIndex].name) << "\">" << endstr;
|
||||
PushTag();
|
||||
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
||||
{
|
||||
if( mesh->HasTextureCoords( static_cast<unsigned int>(a) ) )
|
||||
// semantic as in <texture texcoord=...>
|
||||
// input_semantic as in <input semantic=...>
|
||||
// input_set as in <input set=...>
|
||||
mOutput << startstr << "<bind_vertex_input semantic=\"CHANNEL" << a << "\" input_semantic=\"TEXCOORD\" input_set=\"" << a << "\"/>" << endstr;
|
||||
}
|
||||
PopTag();
|
||||
mOutput << startstr << "</instance_material>" << endstr;
|
||||
PopTag();
|
||||
mOutput << startstr << "</technique_common>" << endstr;
|
||||
PopTag();
|
||||
mOutput << startstr << "</bind_material>" << endstr;
|
||||
PopTag();
|
||||
mOutput << startstr << "</instance_geometry>" << endstr;
|
||||
// do not instanciate mesh if empty. I wonder how this could happen
|
||||
if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
|
||||
continue;
|
||||
|
||||
if( mesh->mNumBones == 0 )
|
||||
{
|
||||
mOutput << startstr << "<instance_geometry url=\"#" << XMLEscape(GetMeshId( pNode->mMeshes[a])) << "\">" << endstr;
|
||||
PushTag();
|
||||
}
|
||||
else
|
||||
{
|
||||
mOutput << startstr
|
||||
<< "<instance_controller url=\"#" << XMLEscape(GetMeshId( pNode->mMeshes[a])) << "-skin\">"
|
||||
<< endstr;
|
||||
PushTag();
|
||||
|
||||
mOutput << startstr << "<skeleton>#skeleton_root</skeleton>" << endstr;
|
||||
}
|
||||
mOutput << startstr << "<bind_material>" << endstr;
|
||||
PushTag();
|
||||
mOutput << startstr << "<technique_common>" << endstr;
|
||||
PushTag();
|
||||
mOutput << startstr << "<instance_material symbol=\"defaultMaterial\" target=\"#" << XMLEscape(materials[mesh->mMaterialIndex].name) << "\">" << endstr;
|
||||
PushTag();
|
||||
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
||||
{
|
||||
if( mesh->HasTextureCoords( static_cast<unsigned int>(a) ) )
|
||||
// semantic as in <texture texcoord=...>
|
||||
// input_semantic as in <input semantic=...>
|
||||
// input_set as in <input set=...>
|
||||
mOutput << startstr << "<bind_vertex_input semantic=\"CHANNEL" << a << "\" input_semantic=\"TEXCOORD\" input_set=\"" << a << "\"/>" << endstr;
|
||||
}
|
||||
PopTag();
|
||||
mOutput << startstr << "</instance_material>" << endstr;
|
||||
PopTag();
|
||||
mOutput << startstr << "</technique_common>" << endstr;
|
||||
PopTag();
|
||||
mOutput << startstr << "</bind_material>" << endstr;
|
||||
|
||||
PopTag();
|
||||
if( mesh->mNumBones == 0)
|
||||
mOutput << startstr << "</instance_geometry>" << endstr;
|
||||
else
|
||||
mOutput << startstr << "</instance_controller>" << endstr;
|
||||
}
|
||||
|
||||
// recurse into subnodes
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -101,13 +102,19 @@ protected:
|
|||
void WriteSpotLight(const aiLight *const light);
|
||||
void WriteAmbienttLight(const aiLight *const light);
|
||||
|
||||
/// Writes the controller library
|
||||
void WriteControllerLibrary();
|
||||
|
||||
/// Writes a skin controller of the given mesh
|
||||
void WriteController( size_t pIndex);
|
||||
|
||||
/// Writes the geometry library
|
||||
void WriteGeometryLibrary();
|
||||
|
||||
/// Writes the given mesh
|
||||
void WriteGeometry( size_t pIndex);
|
||||
|
||||
enum FloatDataType { FloatType_Vector, FloatType_TexCoord2, FloatType_TexCoord3, FloatType_Color };
|
||||
enum FloatDataType { FloatType_Vector, FloatType_TexCoord2, FloatType_TexCoord3, FloatType_Color, FloatType_Mat4x4, FloatType_Weight };
|
||||
|
||||
/// Writes a float array of the given type
|
||||
void WriteFloatArray( const std::string& pIdString, FloatDataType pType, const ai_real* pData, size_t pElementCount);
|
||||
|
@ -121,7 +128,10 @@ protected:
|
|||
/// Enters a new xml element, which increases the indentation
|
||||
void PushTag() { startstr.append( " "); }
|
||||
/// Leaves an element, decreasing the indentation
|
||||
void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); }
|
||||
void PopTag() {
|
||||
ai_assert( startstr.length() > 1);
|
||||
startstr.erase( startstr.length() - 2);
|
||||
}
|
||||
|
||||
/// Creates a mesh ID for the given mesh
|
||||
std::string GetMeshId( size_t pIndex) const {
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -118,7 +119,7 @@ bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, boo
|
|||
* might be NULL and it's our duty to return true here.
|
||||
*/
|
||||
if (!pIOHandler)return true;
|
||||
const char* tokens[] = {"collada"};
|
||||
const char* tokens[] = {"<collada"};
|
||||
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
|
||||
}
|
||||
return false;
|
||||
|
@ -131,7 +132,6 @@ void ColladaLoader::SetupProperties(const Importer* pImp)
|
|||
ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Get file extension list
|
||||
const aiImporterDesc* ColladaLoader::GetInfo () const
|
||||
|
@ -674,7 +674,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
|
|||
// create morph target meshes if any
|
||||
std::vector<aiMesh*> targetMeshes;
|
||||
std::vector<float> targetWeights;
|
||||
Collada::MorphMethod method;
|
||||
Collada::MorphMethod method = Collada::Normalized;
|
||||
|
||||
for(std::map<std::string, Collada::Controller>::const_iterator it = pParser.mControllerLibrary.begin();
|
||||
it != pParser.mControllerLibrary.end(); it++)
|
||||
|
@ -728,7 +728,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
|
|||
? aiMorphingMethod_MORPH_RELATIVE
|
||||
: aiMorphingMethod_MORPH_NORMALIZED;
|
||||
dstMesh->mAnimMeshes = new aiAnimMesh*[animMeshes.size()];
|
||||
dstMesh->mNumAnimMeshes = animMeshes.size();
|
||||
dstMesh->mNumAnimMeshes = static_cast<unsigned int>(animMeshes.size());
|
||||
for (unsigned int i = 0; i < animMeshes.size(); i++)
|
||||
dstMesh->mAnimMeshes[i] = animMeshes.at(i);
|
||||
}
|
||||
|
@ -1377,9 +1377,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
|||
{
|
||||
aiNodeAnim* dstAnim = new aiNodeAnim;
|
||||
dstAnim->mNodeName = nodeName;
|
||||
dstAnim->mNumPositionKeys = resultTrafos.size();
|
||||
dstAnim->mNumRotationKeys= resultTrafos.size();
|
||||
dstAnim->mNumScalingKeys = resultTrafos.size();
|
||||
dstAnim->mNumPositionKeys = static_cast<unsigned int>(resultTrafos.size());
|
||||
dstAnim->mNumRotationKeys = static_cast<unsigned int>(resultTrafos.size());
|
||||
dstAnim->mNumScalingKeys = static_cast<unsigned int>(resultTrafos.size());
|
||||
dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()];
|
||||
dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()];
|
||||
dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()];
|
||||
|
@ -1445,11 +1445,11 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
|||
++morphAnimChannelIndex;
|
||||
}
|
||||
|
||||
morphAnim->mNumKeys = morphTimeValues.size();
|
||||
morphAnim->mNumKeys = static_cast<unsigned int>(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].mNumValuesAndWeights = static_cast<unsigned int>(morphChannels.size());
|
||||
morphAnim->mKeys[key].mValues = new unsigned int [morphChannels.size()];
|
||||
morphAnim->mKeys[key].mWeights = new double [morphChannels.size()];
|
||||
|
||||
|
@ -1470,13 +1470,13 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
|||
{
|
||||
aiAnimation* anim = new aiAnimation;
|
||||
anim->mName.Set( pName);
|
||||
anim->mNumChannels = anims.size();
|
||||
anim->mNumChannels = static_cast<unsigned int>(anims.size());
|
||||
if (anim->mNumChannels > 0)
|
||||
{
|
||||
anim->mChannels = new aiNodeAnim*[anims.size()];
|
||||
std::copy( anims.begin(), anims.end(), anim->mChannels);
|
||||
}
|
||||
anim->mNumMorphMeshChannels = morphAnims.size();
|
||||
anim->mNumMorphMeshChannels = static_cast<unsigned int>(morphAnims.size());
|
||||
if (anim->mNumMorphMeshChannels > 0)
|
||||
{
|
||||
anim->mMorphMeshChannels = new aiMeshMorphAnim*[anim->mNumMorphMeshChannels];
|
||||
|
@ -1725,6 +1725,8 @@ void ColladaLoader::BuildMaterials( ColladaParser& pParser, aiScene* /*pScene*/)
|
|||
aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pParser,
|
||||
const Collada::Effect& pEffect, const std::string& pName)
|
||||
{
|
||||
aiString result;
|
||||
|
||||
// recurse through the param references until we end up at an image
|
||||
std::string name = pName;
|
||||
while( 1)
|
||||
|
@ -1743,11 +1745,17 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
|
|||
ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name);
|
||||
if( imIt == pParser.mImageLibrary.end())
|
||||
{
|
||||
throw DeadlyImportError( format() <<
|
||||
"Collada: Unable to resolve effect texture entry \"" << pName << "\", ended up at ID \"" << name << "\"." );
|
||||
}
|
||||
//missing texture should not stop the conversion
|
||||
//throw DeadlyImportError( format() <<
|
||||
// "Collada: Unable to resolve effect texture entry \"" << pName << "\", ended up at ID \"" << name << "\"." );
|
||||
|
||||
aiString result;
|
||||
DefaultLogger::get()->warn("Collada: Unable to resolve effect texture entry \"" + pName + "\", ended up at ID \"" + name + "\".");
|
||||
|
||||
//set default texture file name
|
||||
result.Set(name + ".jpg");
|
||||
ConvertPath(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// if this is an embedded texture image setup an aiTexture for it
|
||||
if (imIt->second.mFileName.empty())
|
||||
|
@ -1895,14 +1903,13 @@ const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, c
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Finds a proper name for a node derived from the collada-node's properties
|
||||
// Finds a proper unique name for a node derived from the collada-node's properties.
|
||||
// The name must be unique for proper node-bone association.
|
||||
std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
|
||||
{
|
||||
// now setup the name of the node. We take the name if not empty, otherwise the collada ID
|
||||
// FIX: Workaround for XSI calling the instanced visual scene 'untitled' by default.
|
||||
if (!pNode->mName.empty() && pNode->mName != "untitled")
|
||||
return pNode->mName;
|
||||
else if (!pNode->mID.empty())
|
||||
// Now setup the name of the assimp node. The collada name might not be
|
||||
// unique, so we use the collada ID.
|
||||
if (!pNode->mID.empty())
|
||||
return pNode->mID;
|
||||
else if (!pNode->mSID.empty())
|
||||
return pNode->mSID;
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -43,7 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
* @brief Implementation of the Collada parser helper
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
|
||||
|
||||
#include <sstream>
|
||||
|
@ -1865,7 +1865,7 @@ void ColladaParser::ReadMesh( Mesh* pMesh)
|
|||
ReadIndexData( pMesh);
|
||||
} else
|
||||
{
|
||||
// ignore the rest
|
||||
// ignore the restf
|
||||
SkipElement();
|
||||
}
|
||||
}
|
||||
|
@ -2215,8 +2215,9 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
|
|||
else if (IsElement("extra"))
|
||||
{
|
||||
SkipElement("extra");
|
||||
} else
|
||||
{
|
||||
} else if ( IsElement("ph")) {
|
||||
SkipElement("ph");
|
||||
} else {
|
||||
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <" << elementName << ">" );
|
||||
}
|
||||
}
|
||||
|
@ -2230,7 +2231,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
|
|||
}
|
||||
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
if (primType != Prim_TriFans && primType != Prim_TriStrips &&
|
||||
if (primType != Prim_TriFans && primType != Prim_TriStrips && primType != Prim_LineStrip &&
|
||||
primType != Prim_Lines) { // this is ONLY to workaround a bug in SketchUp 15.3.331 where it writes the wrong 'count' when it writes out the 'lines'.
|
||||
ai_assert(actualPrimitives == numPrimitives);
|
||||
}
|
||||
|
@ -2399,6 +2400,10 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
|||
size_t numberOfVertices = indices.size() / numOffsets;
|
||||
numPrimitives = numberOfVertices - 2;
|
||||
}
|
||||
if (pPrimType == Prim_LineStrip) {
|
||||
size_t numberOfVertices = indices.size() / numOffsets;
|
||||
numPrimitives = numberOfVertices - 1;
|
||||
}
|
||||
|
||||
pMesh->mFaceSize.reserve( numPrimitives);
|
||||
pMesh->mFacePosIndices.reserve( indices.size() / numOffsets);
|
||||
|
@ -2415,6 +2420,11 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
|||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||
CopyVertex(currentVertex, numOffsets, numPoints, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
||||
break;
|
||||
case Prim_LineStrip:
|
||||
numPoints = 2;
|
||||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||
CopyVertex(currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
|
||||
break;
|
||||
case Prim_Triangles:
|
||||
numPoints = 3;
|
||||
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -87,28 +88,36 @@ namespace XmlTag {
|
|||
static const std::string transform = "transform";
|
||||
}
|
||||
|
||||
class XmlSerializer {
|
||||
|
||||
class XmlSerializer
|
||||
{
|
||||
public:
|
||||
XmlSerializer(XmlReader* xmlReader)
|
||||
: xmlReader(xmlReader) {
|
||||
// empty
|
||||
: xmlReader(xmlReader)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
void ImportXml(aiScene* scene) {
|
||||
scene->mRootNode = new aiNode();
|
||||
std::vector<aiNode*> children;
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::model)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::object) {
|
||||
while(ReadToEndElement(D3MF::XmlTag::model))
|
||||
{
|
||||
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::object)
|
||||
{
|
||||
children.push_back(ReadObject(scene));
|
||||
} else if(xmlReader->getNodeName() == D3MF::XmlTag::build) {
|
||||
// ???
|
||||
}
|
||||
else if(xmlReader->getNodeName() == D3MF::XmlTag::build)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( scene->mRootNode->mName.length == 0 ) {
|
||||
scene->mRootNode->mName.Set( "3MF" );
|
||||
}
|
||||
if(scene->mRootNode->mName.length == 0)
|
||||
scene->mRootNode->mName.Set("3MF");
|
||||
|
||||
|
||||
scene->mNumMeshes = static_cast<unsigned int>(meshes.size());
|
||||
scene->mMeshes = new aiMesh*[scene->mNumMeshes]();
|
||||
|
@ -119,10 +128,12 @@ public:
|
|||
scene->mRootNode->mChildren = new aiNode*[scene->mRootNode->mNumChildren]();
|
||||
|
||||
std::copy(children.begin(), children.end(), scene->mRootNode->mChildren);
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
aiNode* ReadObject(aiScene* scene) {
|
||||
aiNode* ReadObject(aiScene* scene)
|
||||
{
|
||||
ScopeGuard<aiNode> node(new aiNode());
|
||||
|
||||
std::vector<unsigned long> meshIds;
|
||||
|
@ -143,14 +154,17 @@ private:
|
|||
|
||||
size_t meshIdx = meshes.size();
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::object)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::mesh) {
|
||||
while(ReadToEndElement(D3MF::XmlTag::object))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::mesh)
|
||||
{
|
||||
auto mesh = ReadMesh();
|
||||
|
||||
mesh->mName.Set(name);
|
||||
meshes.push_back(mesh);
|
||||
meshIds.push_back(static_cast<unsigned long>(meshIdx));
|
||||
meshIdx++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,35 +175,49 @@ private:
|
|||
std::copy(meshIds.begin(), meshIds.end(), node->mMeshes);
|
||||
|
||||
return node.dismiss();
|
||||
|
||||
}
|
||||
|
||||
aiMesh* ReadMesh() {
|
||||
aiMesh* ReadMesh()
|
||||
{
|
||||
aiMesh* mesh = new aiMesh();
|
||||
while(ReadToEndElement(D3MF::XmlTag::mesh)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertices) {
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::mesh))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertices)
|
||||
{
|
||||
ImportVertices(mesh);
|
||||
} else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles) {
|
||||
}
|
||||
else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles)
|
||||
{
|
||||
ImportTriangles(mesh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void ImportVertices(aiMesh* mesh) {
|
||||
void ImportVertices(aiMesh* mesh)
|
||||
{
|
||||
std::vector<aiVector3D> vertices;
|
||||
|
||||
while ( ReadToEndElement(D3MF::XmlTag::vertices) ) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertex) {
|
||||
while(ReadToEndElement(D3MF::XmlTag::vertices))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::vertex)
|
||||
{
|
||||
vertices.push_back(ReadVertex());
|
||||
}
|
||||
}
|
||||
mesh->mNumVertices = static_cast<unsigned int>(vertices.size());
|
||||
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
||||
std::copy(vertices.begin(), vertices.end(), mesh->mVertices);
|
||||
}
|
||||
|
||||
aiVector3D ReadVertex() {
|
||||
std::copy(vertices.begin(), vertices.end(), mesh->mVertices);
|
||||
|
||||
}
|
||||
aiVector3D ReadVertex()
|
||||
{
|
||||
aiVector3D vertex;
|
||||
|
||||
vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
|
||||
|
@ -199,11 +227,15 @@ private:
|
|||
return vertex;
|
||||
}
|
||||
|
||||
void ImportTriangles(aiMesh* mesh) {
|
||||
void ImportTriangles(aiMesh* mesh)
|
||||
{
|
||||
std::vector<aiFace> faces;
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::triangles)) {
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::triangle) {
|
||||
|
||||
while(ReadToEndElement(D3MF::XmlTag::triangles))
|
||||
{
|
||||
if(xmlReader->getNodeName() == D3MF::XmlTag::triangle)
|
||||
{
|
||||
faces.push_back(ReadTriangle());
|
||||
}
|
||||
}
|
||||
|
@ -212,12 +244,13 @@ private:
|
|||
mesh->mFaces = new aiFace[mesh->mNumFaces];
|
||||
mesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
||||
|
||||
|
||||
std::copy(faces.begin(), faces.end(), mesh->mFaces);
|
||||
}
|
||||
|
||||
aiFace ReadTriangle() {
|
||||
aiFace ReadTriangle()
|
||||
{
|
||||
aiFace face;
|
||||
|
||||
face.mNumIndices = 3;
|
||||
face.mIndices = new unsigned int[face.mNumIndices];
|
||||
face.mIndices[0] = static_cast<unsigned int>(std::atoi(xmlReader->getAttributeValue(D3MF::XmlTag::v1.c_str())));
|
||||
|
@ -228,25 +261,35 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
bool ReadToStartElement(const std::string& startTag) {
|
||||
while(xmlReader->read()) {
|
||||
if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT && xmlReader->getNodeName() == startTag) {
|
||||
|
||||
bool ReadToStartElement(const std::string& startTag)
|
||||
{
|
||||
while(xmlReader->read())
|
||||
{
|
||||
if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT && xmlReader->getNodeName() == startTag)
|
||||
{
|
||||
return true;
|
||||
} else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END &&
|
||||
xmlReader->getNodeName() == startTag) {
|
||||
}
|
||||
else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END &&
|
||||
xmlReader->getNodeName() == startTag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
|
||||
//DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadToEndElement(const std::string& closeTag) {
|
||||
while(xmlReader->read()) {
|
||||
bool ReadToEndElement(const std::string& closeTag)
|
||||
{
|
||||
while(xmlReader->read())
|
||||
{
|
||||
if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT) {
|
||||
return true;
|
||||
} else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END
|
||||
&& xmlReader->getNodeName() == closeTag) {
|
||||
}
|
||||
else if (xmlReader->getNodeType() == irr::io::EXN_ELEMENT_END
|
||||
&& xmlReader->getNodeName() == closeTag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -254,6 +297,7 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector<aiMesh*> meshes;
|
||||
XmlReader* xmlReader;
|
||||
|
@ -261,6 +305,7 @@ private:
|
|||
|
||||
} //namespace D3MF
|
||||
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
"3mf Importer",
|
||||
"",
|
||||
|
@ -274,15 +319,19 @@ static const aiImporterDesc desc = {
|
|||
"3mf"
|
||||
};
|
||||
|
||||
D3MFImporter::D3MFImporter() {
|
||||
// empty
|
||||
|
||||
D3MFImporter::D3MFImporter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
D3MFImporter::~D3MFImporter() {
|
||||
// empty
|
||||
D3MFImporter::~D3MFImporter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const {
|
||||
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
|
||||
{
|
||||
const std::string extension = GetExtension(pFile);
|
||||
if(extension == "3mf") {
|
||||
return true;
|
||||
|
@ -295,15 +344,18 @@ bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool
|
|||
return false;
|
||||
}
|
||||
|
||||
void D3MFImporter::SetupProperties(const Importer *pImp) {
|
||||
// empty
|
||||
void D3MFImporter::SetupProperties(const Importer *pImp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const aiImporterDesc *D3MFImporter::GetInfo() const {
|
||||
const aiImporterDesc *D3MFImporter::GetInfo() const
|
||||
{
|
||||
return &desc;
|
||||
}
|
||||
|
||||
void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
|
||||
{
|
||||
D3MF::D3MFOpcPackage opcPackage(pIOHandler, pFile);
|
||||
|
||||
std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(opcPackage.RootStream()));
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -48,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/ai_assert.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
@ -227,7 +229,7 @@ ZipFile::~ZipFile() {
|
|||
|
||||
size_t ZipFile::Read(void* pvBuffer, size_t pSize, size_t pCount) {
|
||||
const size_t size = pSize * pCount;
|
||||
assert(size <= m_Size);
|
||||
ai_assert(size <= m_Size);
|
||||
|
||||
std::memcpy(pvBuffer, m_Buffer, size);
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -252,8 +253,8 @@ void DefaultLogger::kill()
|
|||
// Debug message
|
||||
void DefaultLogger::OnDebug( const char* message )
|
||||
{
|
||||
if ( m_Severity == Logger::NORMAL )
|
||||
return;
|
||||
if ( m_Severity == Logger::NORMAL )
|
||||
return;
|
||||
|
||||
static const size_t Size = MAX_LOG_MESSAGE_LENGTH + 16;
|
||||
char msg[Size];
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -53,7 +54,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
|
|||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
#include "BlobIOSystem.h"
|
||||
#include "SceneCombiner.h"
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include "BaseProcess.h"
|
||||
#include "Importer.h" // need this for GetPostProcessingStepInstanceList()
|
||||
|
||||
|
@ -89,6 +90,7 @@ void ExportScenePlyBinary(const char*, IOSystem*, const aiScene*, const ExportPr
|
|||
void ExportScene3DS(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
void ExportSceneGLTF(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
void ExportSceneGLB(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
void ExportSceneGLTF2(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
void ExportSceneAssbin(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
void ExportSceneAssxml(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
void ExportSceneX3D(const char*, IOSystem*, const aiScene*, const ExportProperties*);
|
||||
|
@ -143,6 +145,8 @@ Exporter::ExportFormatEntry gExporters[] =
|
|||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
|
||||
Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
|
||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
|
||||
Exporter::ExportFormatEntry( "gltf2", "GL Transmission Format v. 2", "gltf2", &ExportSceneGLTF2,
|
||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
|
||||
#endif
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
|
||||
|
@ -171,8 +175,10 @@ public:
|
|||
GetPostProcessingStepInstanceList(mPostProcessingSteps);
|
||||
|
||||
// grab all built-in exporters
|
||||
mExporters.resize(ASSIMP_NUM_EXPORTERS);
|
||||
std::copy(gExporters,gExporters+ASSIMP_NUM_EXPORTERS,mExporters.begin());
|
||||
if ( 0 != ( ASSIMP_NUM_EXPORTERS ) ) {
|
||||
mExporters.resize( ASSIMP_NUM_EXPORTERS );
|
||||
std::copy( gExporters, gExporters + ASSIMP_NUM_EXPORTERS, mExporters.begin() );
|
||||
}
|
||||
}
|
||||
|
||||
~ExporterPimpl()
|
||||
|
@ -186,7 +192,6 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
|
||||
aiExportDataBlob* blob;
|
||||
std::shared_ptr< Assimp::IOSystem > mIOSystem;
|
||||
bool mIsDefaultIOHandler;
|
||||
|
@ -407,6 +412,7 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c
|
|||
|
||||
pimpl->mError = std::string("Found no exporter to handle this file format: ") + pFormatId;
|
||||
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
||||
|
||||
return AI_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -491,7 +497,6 @@ ExportProperties::ExportProperties(const ExportProperties &other)
|
|||
// empty
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Set a configuration property
|
||||
bool ExportProperties::SetPropertyInteger(const char* szName, int iValue) {
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -49,12 +50,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "FBXDocument.h"
|
||||
#include "FBXImporter.h"
|
||||
#include "FBXDocumentUtil.h"
|
||||
#include "FBXProperties.h"
|
||||
|
||||
namespace Assimp {
|
||||
namespace FBX {
|
||||
|
||||
using namespace Util;
|
||||
using namespace Util;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& /*doc*/)
|
||||
|
@ -87,17 +87,16 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::s
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurve::~AnimationCurve()
|
||||
{
|
||||
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc,
|
||||
const char* const * target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/)
|
||||
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name,
|
||||
const Document& doc, const char* const * target_prop_whitelist /*= NULL*/,
|
||||
size_t whitelist_size /*= 0*/)
|
||||
: Object(id, element, name)
|
||||
, target()
|
||||
, doc(doc)
|
||||
|
@ -154,18 +153,16 @@ AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, cons
|
|||
props = GetPropertyTable(doc,"AnimationCurveNode.FbxAnimCurveNode",element,sc,false);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurveNode::~AnimationCurveNode()
|
||||
{
|
||||
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const AnimationCurveMap& AnimationCurveNode::Curves() const
|
||||
{
|
||||
if(curves.empty()) {
|
||||
if ( curves.empty() ) {
|
||||
// resolve attached animation curves
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
|
||||
|
||||
|
@ -195,7 +192,6 @@ const AnimationCurveMap& AnimationCurveNode::Curves() const
|
|||
return curves;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationLayer::AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc)
|
||||
: Object(id, element, name)
|
||||
|
@ -207,14 +203,12 @@ AnimationLayer::AnimationLayer(uint64_t id, const Element& element, const std::s
|
|||
props = GetPropertyTable(doc,"AnimationLayer.FbxAnimLayer",element,sc, true);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationLayer::~AnimationLayer()
|
||||
{
|
||||
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whitelist /*= NULL*/,
|
||||
size_t whitelist_size /*= 0*/) const
|
||||
|
@ -298,14 +292,13 @@ AnimationStack::AnimationStack(uint64_t id, const Element& element, const std::s
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationStack::~AnimationStack()
|
||||
{
|
||||
|
||||
// empty
|
||||
}
|
||||
|
||||
} //!FBX
|
||||
} //!Assimp
|
||||
|
||||
#endif
|
||||
#endif // ASSIMP_BUILD_NO_FBX_IMPORTER
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue