Compare commits

...

514 Commits
v3.2 ... v3.3

Author SHA1 Message Date
Kim Kulling
19769eef8b Version: prepare 3.3 version. 2016-07-05 18:43:16 +02:00
Kim Kulling
f8c3ca5941 Merge pull request #933 from liedtkeInTUM/master
[Fix] Remove  CMake Warning (dev) in external/assimp/CMakeLists.txt
2016-07-05 15:57:53 +02:00
Sven Liedtke
e16a383999 [Fix] Remove CMake Warning (dev) in external/assimp/CMakeLists.txt with mis-matching arguments for logical block 2016-07-05 10:21:29 +02:00
Kim Kulling
7c63208515 Fix resource leaks in unit tests. 2016-07-04 22:15:23 +02:00
Kim Kulling
ebb209a0d6 Merge branch 'master' of https://github.com/assimp/assimp 2016-07-04 20:19:37 +02:00
Kim Kulling
32e8c80c24 Fix resource leak. 2016-07-04 20:19:24 +02:00
Kim Kulling
614096ddb1 Merge pull request #931 from cmdrf/update-melange-sdk
C4D Support: Update to Newest Melange SDK
2016-07-04 15:06:58 +02:00
Kim Kulling
a62ea5497d Merge pull request #932 from r-chris/make-zlib-optional
Allowing to enable building of zlib manually through CMake option.
2016-07-04 15:00:13 +02:00
Fabian Herb
7b08233ef2 Fix identation 2016-07-01 17:08:28 +02:00
Fabian Herb
3c7dd2b302 More whitespace consistency 2016-07-01 17:02:54 +02:00
Fabian Herb
616aa022a7 CMake: whitespace consistency, variable naming 2016-07-01 16:57:45 +02:00
cmdrf
9c7de7b2a8 Update to latest Melange SDK 2016-07-01 14:50:46 +02:00
Kim Kulling
e7acd82b8c Merge pull request #929 from assimp/feature/issue_922
CMake: use CMAKE_CURRENT_LIST_DIR instead of CmakeSourceDir.
2016-06-30 01:02:32 +02:00
Kim Kulling
93caa17371 CMake: use CMAKE_CURRENT_LIST_DIR instead of CmakeSourceDir. 2016-06-30 00:42:08 +02:00
Kim Kulling
41eeacefab Merge pull request #923 from tgoulart/fix_ios_build
Fix compilation of iOS static libraries
2016-06-28 22:48:58 +02:00
Kim Kulling
886cea2933 Merge pull request #927 from royshil/obj_color_vertices_support
adding support for per-vertex colors in OBJ files.
2016-06-28 22:08:59 +02:00
Kim Kulling
19ba6448f0 OpenDDLParser: latest greatest. 2016-06-28 13:13:08 +02:00
Kim Kulling
072a9e77ad Unittests: diable broken test. 2016-06-28 11:59:20 +02:00
Kim Kulling
975cfd8f95 another try. 2016-06-28 11:30:48 +02:00
Kim Kulling
353c1efe1d Fix line break 2016-06-28 11:29:51 +02:00
Kim Kulling
428e9d60f9 Gitter-badge: fix format of the readme-file. 2016-06-28 11:28:52 +02:00
Kim Kulling
5a4b81ca63 Merge branch 'gitter-badger-gitter-badge' 2016-06-28 11:27:41 +02:00
Kim Kulling
dadbea940b README: put link to gitter badge to right place. 2016-06-28 11:26:54 +02:00
Kim Kulling
5321072007 Static code analysis: fix minor finding. 2016-06-28 11:25:04 +02:00
The Gitter Badger
87747fe5a7 Add Gitter badge 2016-06-28 09:15:04 +00:00
Roy Shilkrot
7d98643bcf adding support for per-vertex colors. 2016-06-27 20:08:22 -04:00
Thiago Goulart
867063d8c3 Fix compilation of iOS static libraries.
1. Building for any targets using clang-703.0.31 failed with multiple errors. Using c++11 or c++14 as -std builds successfully.
2. Building for arm64 failed compilation due to duplicate constructors in rapidjson's document.h.
2016-06-24 02:24:11 -07:00
Chris Russ
2c6c19d656 allowing to enable building of zlib manually 2016-06-22 17:38:10 +10:00
Kim Kulling
9b6de15b74 closes https://github.com/assimp/assimp/issues/904: add ai_strtof for
VS2012.
2016-06-20 20:30:29 +02:00
Kim Kulling
447a9642c2 closes https://github.com/assimp/assimp/issues/918: use correct lib
install name for macos.
2016-06-17 20:42:19 +02:00
Kim Kulling
b01e424476 Merge pull request #917 from assimp/feature/new_includes
Feature/new includes
2016-06-14 22:54:56 +02:00
Kim Kulling
62e07a8af0 closes https://github.com/assimp/assimp/issues/911: use correct include
path for unzip, when detected.
2016-06-14 20:27:40 +02:00
Kim Kulling
f19dadbe97 Disable regression test suite: shall be run on a separate branch. 2016-06-14 20:27:16 +02:00
Kim Kulling
334ac9a7d0 Merge pull request #908 from Adjective-Object/master
Added 'joint' node type to Collada export
2016-06-13 11:35:11 +02:00
Kim Kulling
e834d5a50a Merge pull request #916 from likangning93/gltfErrors
Fixed some gltf errors
2016-06-13 11:34:34 +02:00
Kim Kulling
950eb7ef9a Add project root to include. 2016-06-11 01:14:25 +02:00
Kangning Li
f15b6177f7 glTFExporter fixes: spaces to tabs 2016-06-10 13:41:59 -04:00
Kangning Li
32d9ef042a Merge branch 'master' into gltfErrors 2016-06-10 09:51:35 -04:00
Kangning Li
c98e77907c fixed some small bugs in the gltf exporter: byteOffsets in accessors/bufferViews, logic problem with bufferView targets 2016-06-10 09:49:04 -04:00
Kim Kulling
dbcb30f7cf Merge pull request #909 from assimp/feature/new_includes
Use new include bracktes.
2016-06-07 21:57:42 +02:00
Kim Kulling
81773b4e4e Update fast_atof.h
Fix include brackets.
2016-06-07 11:51:09 +02:00
Kim Kulling
7207e5117c Use new include bracktes. 2016-06-06 22:04:29 +02:00
Kim Kulling
4e3baf7cb7 Update regression tests. 2016-06-06 21:38:01 +02:00
Maxwell Huang-Hobbs
d23439451a Added 'joint' node type to Collada export 2016-06-05 21:04:02 -04:00
Kim Kulling
d64006b6b3 Merge pull request #907 from assimp/bugfix/issue_888
Closes issue888: fix compiler warnings for using a gnu-extension
2016-06-05 22:31:31 +02:00
Kim Kulling
398595225e Closes issue888: fix compiler warnings for using a gnu-extension (
anonymous structs ).
2016-06-05 21:06:05 +02:00
Kim Kulling
814d2e7821 Merge branch 'master' of https://github.com/assimp/assimp 2016-06-04 19:04:06 +02:00
Kim Kulling
0a1dda22b2 ColladaParser: add warning when empty semantic will be parsed. 2016-06-04 17:53:51 +02:00
Kim Kulling
bc0393669b Update setup.py
Update url of asset importer lib repo home.
2016-05-27 10:56:37 +02:00
Kim Kulling
d67c8c29b6 Merge pull request #898 from turol/cxx11-refactor
Use C++11 range-based for loops
2016-05-26 16:56:07 +02:00
Kim Kulling
f6ee819a42 Update regression test results. 2016-05-26 01:18:37 +02:00
Kim Kulling
8fa0071d16 closes https://github.com/assimp/assimp/issues/892: add own to_string
implementation.
2016-05-26 00:44:29 +02:00
Kim Kulling
4e982c0538 Merge branch 'master' of https://github.com/assimp/assimp 2016-05-26 00:41:48 +02:00
Kim Kulling
2cbbc3da09 OpenGEX-Importer: remove dead code. 2016-05-26 00:41:31 +02:00
Kim Kulling
0f1a625be7 Update .travis.yml
Disable osx temporary, I need more time to learn.
2016-05-25 11:57:55 +02:00
Kim Kulling
abad093d09 Update OpenGEXImporter.cpp
Fix compiler warning: remove unused variables.
2016-05-25 10:18:24 +02:00
Kim Kulling
5463146688 Add std::string header. 2016-05-25 00:58:05 +02:00
Kim Kulling
f9f493d017 Merge branch 'master' of https://github.com/assimp/assimp 2016-05-25 00:27:16 +02:00
Kim Kulling
037fec275c std::to_string: add replacement for android build chain. 2016-05-25 00:26:41 +02:00
Turo Lamminen
381f87507f SplitLargeMeshes: Use C++11 range-based for loop 2016-05-23 17:33:52 +03:00
Turo Lamminen
896ab8eee2 Unreal: Use C++11 range-based for loop 2016-05-23 17:33:52 +03:00
Turo Lamminen
d238597459 Raw: Use C++11 range-based for loop 2016-05-23 17:33:52 +03:00
Turo Lamminen
6c9c040419 Q3BSP: Use C++11 range-based for loop 2016-05-23 17:33:51 +03:00
Turo Lamminen
a09a6a40c0 OpenGEX: Use C++11 range-based for loop 2016-05-23 17:33:49 +03:00
Turo Lamminen
32e4dd0bd1 Ogre: Use C++11 range-based for loop 2016-05-23 17:30:48 +03:00
Turo Lamminen
3eb9b8e91b NFF: Use C++11 range-based for loop 2016-05-23 17:30:47 +03:00
Turo Lamminen
ac676d4d3c MD5: Use C++11 range-based for loop 2016-05-23 17:30:47 +03:00
Turo Lamminen
b9fbfbc18a LWO: Use C++11 range-based for loop 2016-05-23 17:30:42 +03:00
Kim Kulling
610cea8649 Update .travis.yml
Try to enable osx-builds for travis.
2016-05-23 15:12:29 +02:00
Alexander Gessler
cd4f212b5f Merge pull request #891 from ciechowoj/blender_materials
Blender materials
2016-05-22 14:39:45 +02:00
Turo Lamminen
3031470ec1 IRR: Use C++11 range-based for loop 2016-05-22 13:57:13 +03:00
Turo Lamminen
c7c756d344 FBX: Use C++11 range-based for loop 2016-05-22 13:57:13 +03:00
Turo Lamminen
8566b9aa90 D3MF: Use C++11 range-based for loop 2016-05-22 13:57:13 +03:00
Turo Lamminen
52405bbe1b Collada: Use C++11 range-based for loop 2016-05-22 13:57:11 +03:00
Turo Lamminen
f0ebb40f19 ASE: Use C++11 range-based for loop 2016-05-22 13:57:09 +03:00
Turo Lamminen
b345f79d45 3DS: Use C++11 range-based for loop 2016-05-22 13:57:06 +03:00
Kim Kulling
38ce71d5a0 Update glTFAsset.inl
closes https://github.com/assimp/assimp/issues/893: fix invalid memcpy usage.
2016-05-19 09:10:56 +02:00
Kim Kulling
c9c6fda28e Merge pull request #889 from ciechowoj/area_lights
Adds support for area lights.
2016-05-18 00:11:05 -07:00
Kim Kulling
84b9df3182 Merge pull request #890 from WroughtIronGames/master
Add fix for IRR vs IRRMESH importer registry issue
2016-05-17 14:35:42 -07:00
ciechowoj
c554b55f97 Merge branch 'blender_materials'
Conflicts:
	test/CMakeLists.txt
2016-05-17 22:52:18 +02:00
ciechowoj
c4a542a994 Adds blender material loading. 2016-05-17 21:17:51 +02:00
Kim Kulling
5168a6c8ca Regression tests: update database. 2016-05-17 07:46:51 -07:00
Richard Selneck
fc5464eb38 Pull from upstream, 5/17/2016 2016-05-17 08:44:38 -04:00
ciechowoj
913f26475d Adds importing blender material. 2016-05-16 21:17:58 +02:00
ciechowoj
25d84a6aff Adds support for area lights. 2016-05-16 13:04:43 +02:00
Kim Kulling
560e1eebc1 fix for https://github.com/assimp/assimp/issues/887: add missing define. 2016-05-16 11:24:04 +02:00
Kim Kulling
1acd24e0ae iSIBImporter: fix possible dereferncing of a null pointer. 2016-05-15 19:56:29 +02:00
Kim Kulling
6575696459 OpenGEX: fix coverity findings. 2016-05-15 18:57:10 +02:00
Kim Kulling
e1084b5314 Merge branch 'feature/opengex_missing_features' 2016-05-14 10:36:46 +02:00
Kim Kulling
71c2b91b98 Merge branch 'master' of https://github.com/assimp/assimp 2016-05-14 10:10:33 +02:00
Kim Kulling
210182b17a OpenGEX: fix coverity findings. 2016-05-14 10:10:05 +02:00
Kim Kulling
142901fbc0 Merge pull request #885 from otgerrogla/master
Fixed GLTF bugs, and added a few test models
2016-05-10 23:38:54 +02:00
Otger
159af06524 Fixed GLTF bugs, and added a few test models 2016-05-10 16:25:15 +02:00
Richard Selneck
86a636fbbf Add in IRRMESH option 2016-05-09 18:26:18 -04:00
Kim Kulling
d6ecc8b621 Regression test suite: add ogex-files to database. 2016-05-09 23:55:55 +02:00
Kim Kulling
a55e31bc72 Merge pull request #881 from assimp/feature/opengex_missing_features
Feature/opengex missing features
2016-05-09 21:19:09 +02:00
Kim Kulling
2323320df8 OpenGEX: new camra model. 2016-05-09 20:50:22 +02:00
Kim Kulling
e9085097f3 OpenGEX: add light impl and add examples. 2016-05-09 20:43:22 +02:00
Kim Kulling
0d5eb30a28 CameraObj: load camera data in the correct way. 2016-05-08 22:31:16 +02:00
Kim Kulling
9e63b769a5 Merge branch 'master' of https://github.com/assimp/assimp 2016-05-08 12:23:02 +02:00
Alexander Gessler
d1e355add2 Add STEP to list of exporters 2016-05-08 11:56:15 +02:00
Alexander Gessler
644e06d4a7 Add 3MF to readme, mark glTF as partial support 2016-05-08 11:55:18 +02:00
Kim Kulling
82f73b6d03 OpenGEX: fix invalid access to textures. Next steps to camera and light. 2016-05-08 11:09:53 +02:00
Kim Kulling
513576616c Merge branch 'master' of https://github.com/assimp/assimp 2016-05-07 18:01:21 +02:00
Kim Kulling
896e139470 Merge pull request #879 from gorilux/master
Added 3MF importer
2016-05-07 18:00:13 +02:00
Gorilux
00b574d746 Fixed compile issue for travis-ci 2016-05-07 15:36:05 +02:00
Gorilux
753b63c526 Removed override keywords so compilation success on gcc 4.6 2016-05-07 15:15:00 +02:00
Gorilux
89320bab46 Merge branch 'master' of https://github.com/assimp/assimp 2016-05-07 14:18:17 +02:00
Gorilux
8f4f0047fb Added 3MF importer 2016-05-07 14:16:33 +02:00
Kim Kulling
301b6798c5 aiLight: fix a typo. 2016-05-07 11:16:33 +02:00
Alexander Gessler
a931d2bac6 Merge pull request #877 from assimp/followups
Followups
2016-05-05 20:40:54 +02:00
Alexander Gessler
0b79d1ebda Revert previous glTF fix (e5233283ef) because it breaks ODR as pointed out by @turol, instead just make importer depend on the necessary definitions. 2016-05-05 19:11:33 +02:00
Alexander Gessler
f5327a99ba Add using namespace std on top of assxml exporter so vsnprintf is found no matter where it lives. 2016-05-05 19:05:02 +02:00
Alexander Gessler
92b1431be3 Merge pull request #876 from assimp/travisfix
Fix travis compile: glTFImporter chokes on unavailability of WriteLaz…
2016-05-05 17:59:04 +02:00
Alexander Gessler
c80fe16323 Update regression test suite.
gltf could be a regression, left a question here: https://github.com/assimp/assimp/pull/697
2016-05-05 16:59:26 +02:00
Alexander Gessler
e5233283ef Fix travis compile: glTFImporter chokes on unavailability of WriteLazyDict<T>. It does not use it directly, but instantiation of LazyDict<T> creates a reference.
My understanding is that compilers were correct in rejecting this, but I may be missing some detail of C++' template instantiation rules.
2016-05-05 16:37:55 +02:00
Alexander Gessler
174a598759 Merge pull request #875 from assimp/acgmay16
MSVC11 fixes
2016-05-05 16:04:10 +02:00
Alexander Gessler
896120b76a Assimp mostly uses unsigned int where it perhaps should've used size_t, nonetheless SPBC insisted on size_t, causing lots of noisy compile warnings. 2016-05-05 15:41:50 +02:00
Alexander Gessler
167bc579c5 Fix MSVC11 compile error in AssxmlExporter.cpp -- vsnprintf is not in std. 2016-05-05 15:41:12 +02:00
Alexander Gessler
1daae7b7b9 STEPFile.h: delete deleted copy ctor and move ctors. Class has a const member, so implicit creation is off anyway. Enables pre cpp11 compilation. 2016-05-05 15:40:36 +02:00
Alexander Gessler
e7fd168114 Merge pull request #854 from tomacd/fix_scene_combiner
fix SceneCombiner copy of aiNode not setting mParent field
2016-05-05 15:07:09 +02:00
Kim Kulling
e9b93788ca Merge pull request #863 from mpersano/master
Fix texture coords exporting on binary PLY files
2016-05-03 21:55:17 +02:00
Richard Selneck
12613720ff Fix macro used for detecting IRR support 2016-05-02 18:24:26 -04:00
Kim Kulling
8449afad71 Merge pull request #868 from otgerrogla/master
Fixed a few GLTF importer/exporter bugs
2016-04-28 22:56:41 +02:00
Otger
11e52dc3d7 Removed rogue comma 2016-04-28 21:34:31 +02:00
Otger
2fe401fc54 Fixed gcc compilation error 2016-04-28 21:22:01 +02:00
Otger
64f78e003f Fixed crashes when files were not found, and fixed some warnings 2016-04-28 20:50:01 +02:00
Kim Kulling
46e7ae5dc0 OpenGEX: prepare light- and camera-node and object. 2016-04-28 20:20:40 +02:00
Otger
d9b365eb90 Fixed a few GLTF importer/exporter bugs 2016-04-28 18:44:47 +02:00
Kim Kulling
97145a7f20 Replace std:.endl by backslash n. 2016-04-27 17:59:12 +02:00
Kim Kulling
5192b837da Replace std::endl by using backslash n. 2016-04-27 17:58:40 +02:00
Kim Kulling
7468ca5c35 VS2015-code analysis: fix finding ( index var type too small ). 2016-04-23 09:43:20 +02:00
Kim Kulling
fcd1f21231 Merge branch 'master' of https://github.com/assimp/assimp 2016-04-23 09:42:57 +02:00
Kim Kulling
388694e349 cmake build env: add missing license info. 2016-04-23 09:42:27 +02:00
Kim Kulling
829e56df0c cmake env: add license info. 2016-04-23 09:42:05 +02:00
mpersano
473d2ca052 Fix texture coords exporting on binary PLY files 2016-04-22 16:09:45 -03:00
Kim Kulling
2a3c2e3a21 Merge pull request #861 from v4hn/no-locallib
only check a library folder if it actually exists
2016-04-22 11:54:40 +02:00
Michael Görner
f1a984bd3b only check a library folder if it actually exists
otherwise this breaks for no reason if /usr/local/lib is missing.
2016-04-22 11:35:44 +02:00
Kim Kulling
f905f5700f regression ui: add default editor for linux. 2016-04-21 19:19:06 +02:00
Kim Kulling
af75390f8d travis: fix a typo. 2016-04-21 18:21:32 +02:00
Kim Kulling
f9cba1c4ea regression test suite: fix usage of run. 2016-04-21 17:24:01 +02:00
Kim Kulling
53263953c5 travis: fix usage of runner script for regression testsuite. 2016-04-21 17:14:54 +02:00
Kim Kulling
b120454bdd Merge pull request #860 from Squareys/fix-pi
Fix Mistake in last Pullrequest
2016-04-21 17:07:27 +02:00
Squareys
6bc36eb2b6 Fix mistake while switching to new PI constants
From previous pullrequest (https://github.com/assimp/assimp/pull/859),
commit 7c0e40a3f4 introduced the error.

Thanks @mosra for catching it!

Signed-off-by: Squareys <Squareys@googlemail.com>
2016-04-21 15:23:14 +02:00
Kim Kulling
6107ead295 Merge pull request #859 from Squareys/fix-pi
Add definition for PI and PI_2
2016-04-21 10:58:10 +02:00
Squareys
7c0e40a3f4 Add definition for PI and PI_2
M_PI and M_PI_2 are not C++ standard and are therefore not present, in
MinGW-w64 gcc 5.1.0 for example. We therefore replace it with an own
definition.

Since math.h was only included for M_PI and M_PI_2 makros, we can now
remove it.

Signed-off-by: Squareys <Squareys@googlemail.com>
2016-04-21 08:17:06 +02:00
Kim Kulling
019226c119 CMake build: enabme c++11 for mingw. 2016-04-21 00:02:28 +02:00
Kim Kulling
2f9c33e3e9 closes https://github.com/assimp/assimp/issues/857 2016-04-20 23:27:59 +02:00
Kim Kulling
69ac97d709 Update run.py
resolve conflict.
2016-04-20 12:37:48 +02:00
Kim Kulling
c122bb2def Regression test suite: update run. 2016-04-20 00:04:26 +02:00
Kim Kulling
3659570292 regression ui: add missing functionalities for setup, version and update. 2016-04-19 16:01:21 +02:00
Kim Kulling
0ec1e91722 Regression Testsuite: update database. 2016-04-19 08:49:14 +02:00
Kim Kulling
22dc22778d Assxml exporter: Make some local functions static. 2016-04-19 08:48:37 +02:00
Kim Kulling
1b94b8969f Blender Importer: fix review findings. 2016-04-19 08:45:04 +02:00
Kim Kulling
e74425dbc3 Regression ui: add functionality to open the log. 2016-04-18 16:13:18 +02:00
tomacd
5a8c15d826 fix SceneCombiner copy of aiNode not setting mParent field 2016-04-18 11:28:21 +02:00
Kim Kulling
de39c49c4c assxml export: make local functions static. 2016-04-17 23:29:46 +02:00
Kim Kulling
a6e7938696 Assxml io function: use vsprintf for var-argument list. 2016-04-17 21:33:11 +02:00
Kim Kulling
dec93efc92 AssxmlExporter: fix crash in writing header info in VS2015. 2016-04-16 18:42:49 +02:00
Kim Kulling
fe60654c1a Update run.py
Regression: fix typo.
2016-04-16 15:16:35 +02:00
Kim Kulling
3893c593de Regression test suite: fix typo. 2016-04-16 08:41:31 +02:00
Kim Kulling
1cce8426c6 Update run.py
Regression tests: fix python2.7-style logs via print
2016-04-13 09:21:26 +02:00
Kim Kulling
9e922582c0 Regression tests: fix invalid log statement. 2016-04-12 23:18:08 +02:00
Kim Kulling
69aa4655ad Regression tests: reenable support for travis. 2016-04-12 18:47:42 +02:00
Kim Kulling
dc22871aef Regression test suite: fix typo. 2016-04-12 18:46:32 +02:00
Kim Kulling
9105fac560 test: add pk3 to blacklist for regression 2016-04-12 00:02:31 +02:00
Kim Kulling
dd5781027e LWS: remove broken model. 2016-04-08 19:23:24 +02:00
Kim Kulling
b42b974282 Regression test suite: remove broken model. 2016-04-08 18:55:33 +02:00
Kim Kulling
6b243230b2 C++11-Support: remove boost. 2016-04-07 21:31:04 +02:00
Kim Kulling
632b58f27e Merge pull request #850 from mensinda/no-boost
Replaced boost with c++11 features
2016-04-06 21:16:23 +02:00
Kim Kulling
90c8af4cd2 Update appveyor.yml
Stop support for VS2010
2016-04-06 21:15:48 +02:00
mensinda
b045a1ec5c Deleted move constructor of LazyObject 2016-04-06 21:03:54 +02:00
mensinda
dd1ab0778c Fixed AnimEvaluator.cpp 2016-04-06 17:28:09 +02:00
mensinda
3eafc7e746 Renamed Math.h --> MathFunctions.h 2016-04-06 16:54:03 +02:00
mensinda
f59cba13eb Try fixing clang builds 2016-04-06 11:10:12 +02:00
mensinda
726b004806 Removed boost/noncopyable.hpp 2016-04-06 10:51:18 +02:00
mensinda
ce5908e4ec Removed boost from CMakeLists.txt 2016-04-06 10:29:41 +02:00
mensinda
51c80ecb80 Moved gcd and lcm implemetation 2016-04-06 10:21:59 +02:00
mensinda
cc0fce8568 Replaced boost::timer with std::chrono 2016-04-06 10:13:02 +02:00
mensinda
ae99f99b99 Replaced boost::tuple with std::tuple 2016-04-06 00:17:21 +02:00
mensinda
b37e25cd7d Replaced boost::format with internal formater 2016-04-06 00:03:05 +02:00
mensinda
5dacda0a08 replaced boost smart pointers with c++11 smart pointers 2016-04-05 23:23:53 +02:00
mensinda
cff5b0d1a0 Replaced depreacated std::auto_ptr with std::unique_ptr 2016-04-05 22:56:11 +02:00
mensinda
18843fe5e1 Replaced BOOST_FOREACH with c++11 ranged for loops 2016-04-05 22:53:54 +02:00
mensinda
4836a2993e Replaced boost::thread with std::thread 2016-04-05 22:28:21 +02:00
Kim Kulling
20630e950a Regression test suite: add ui for simpler text execution. 2016-04-05 22:02:02 +02:00
Kim Kulling
8a3b6523f2 Update CMakeLists.txt
CMake for debian package: fix home url of asset importer lib.
2016-04-05 16:30:56 +02:00
Kim Kulling
a2d9cbef7e Update STEPFileReader.cpp
StepFileReadder: initialize var with nullptr.
2016-04-04 12:52:22 +02:00
Kim Kulling
f2d5921252 Update FBXConverter.cpp
FBXConverter: initialize aiNodeAnim with nullptr.
2016-04-04 12:48:53 +02:00
Kim Kulling
001eede34c Merge pull request #847 from stevenjt/python-scene-export
Added ability to export scenes with PyAssimp
2016-04-03 17:43:05 +02:00
Kim Kulling
8efe292d4e Merge pull request #846 from 1ace/master
Fix spelling mistakes
2016-04-03 14:08:19 +02:00
Steven Thompson
06e262f892 Added ability to export scenes with PyAssimp 2016-04-03 13:03:16 +01:00
Eric Engestrom
87e7cf00a2 Fix spelling mistakes 2016-04-03 01:38:00 +01:00
Kim Kulling
d094dfc3a1 Merge pull request #800 from pkholland/master
Can't add integer to string pointer
2016-04-01 10:01:23 +02:00
Kim Kulling
49d60dc856 Merge pull request #832 from assimp/no-boost
Removed usage of Boost static assert.
2016-03-31 15:42:53 +02:00
Kim Kulling
b573676a1b Update CMakeLists.txt
Enable c++11 support manually by using the compiler flags.
2016-03-31 11:26:38 +02:00
Kim Kulling
c53903ff0b Update CMakeLists.txt
Enable c++11 support for this branch.
2016-03-31 11:11:55 +02:00
Kim Kulling
1d8dba13d5 Merge pull request #837 from stevenjt/python3-xrange-fix
Python 3 compatibility fix for xrange in PyAssimp
2016-03-30 00:12:14 +02:00
Kim Kulling
0a002986e2 Merge pull request #839 from boxdot/master
Import reflectance factor from Blender.
2016-03-30 00:11:38 +02:00
boxdot
0d44479399 Import reflectance factor from Blender. 2016-03-29 21:16:26 +02:00
Steven Thompson
2c3bbe041a Set xrange to range for Python 3.0 and above 2016-03-27 20:12:22 +01:00
Kim Kulling
1592a18210 PLYLoader: fix review comments. 2016-03-25 00:09:56 +01:00
Kim Kulling
42d29b1bfe Merge branch 'master' of https://github.com/assimp/assimp 2016-03-24 19:54:33 +01:00
Kim Kulling
7c71f0b7a9 PLYLoader: improve readability by refactorings. 2016-03-24 19:53:15 +01:00
Kim Kulling
6be4d82a6b Merge pull request #835 from robertliebo/VCS-1030/ObjMtlFilenameFallback
Vcs 1030/obj mtl filename fallback
2016-03-22 20:35:41 +01:00
Kim Kulling
23892a6ded FBX: add debugging tool to log class type + info. 2016-03-22 20:30:25 +01:00
Kim Kulling
ca0fa2ba69 FBX-Importer: put debug printf into comments. 2016-03-22 20:25:29 +01:00
Robert Liebo
124fc9ae27 [VCS-1030] add log info about .mtl fallback 2016-03-22 18:39:52 +01:00
Robert Liebo
abb3e6b854 [VCS-1030] fallback for non-found .mtl file: try file name of original obj with just the file extension replaced by "mtl" 2016-03-22 18:38:28 +01:00
Sherief Farouk
397fa374a3 Removed usage of Boost static assert. 2016-03-18 17:02:39 -07:00
Kim Kulling
76e4e82ecb FBX: fix https://github.com/assimp/assimp/issues/782 2016-03-16 20:26:33 +01:00
Kim Kulling
644d6a9a67 Collada: refactorings. 2016-03-15 21:17:38 +01:00
Kim Kulling
d89e7943ad FBX Close issue-806: support version 7400. 2016-03-15 21:16:47 +01:00
Kim Kulling
29067c0dfc Merge branch 'master' of https://github.com/assimp/assimp 2016-03-15 19:29:14 +01:00
Kim Kulling
e3d7ca264c Collada: reset workaround. 2016-03-15 19:28:57 +01:00
Kim Kulling
2dd71acdfd Merge pull request #821 from Wietse/build-with-nmake-fix
Update CMakeLists.txt
2016-03-15 00:30:03 +01:00
Wietse
8314a20c56 Update CMakeLists.txt
Changed "add_definitions" to "add_compile_options" to fix building with NMake.
Using "add_definitions" adds "/MP" to the resource compiler options which results in a fatal error when run with NMake.
2016-03-14 23:14:31 +01:00
Kim Kulling
3a7c3a5698 Test for issue-731: possible overflow. 2016-03-14 21:00:08 +01:00
Kim Kulling
7e9fe2d654 OpenGEX: use correct number of uv-coordinates for texture coordinates. 2016-03-13 20:22:36 +01:00
Kim Kulling
193f6059cf Merge pull request #820 from turol/master
Fix some crashes on malformed input
2016-03-13 19:58:04 +01:00
Turo Lamminen
555f533777 MD3: Check file is big enough to contain all the advertised surfaces 2016-03-13 00:57:08 +02:00
Turo Lamminen
da0b180901 MD3: Fix crash on invalid vertex index 2016-03-13 00:57:08 +02:00
Turo Lamminen
b0f453dba8 MD2: Check file is big enough to contain all the advertised frames 2016-03-13 00:57:08 +02:00
Turo Lamminen
8d2af995de MD2: Fix integer overflows on malformed input 2016-03-13 00:57:08 +02:00
Turo Lamminen
e2361bf209 MDL: Fix read past end of buffer on malformed input 2016-03-12 22:35:54 +02:00
Kim Kulling
6ee5fdf567 OpenGEX: fix review finding. 2016-03-12 20:55:11 +01:00
Kim Kulling
b4b303ab55 OpenGEX: fix alloc for texture coordinates. 2016-03-12 13:22:09 +01:00
Kim Kulling
8872e96183 Merge pull request #819 from emvivre/master
PlyParser: fix invalid loading when comment is empty.
2016-03-11 13:40:27 +01:00
emvivre
93be0f69da PlyParser: fix invalid loading when comment is empty. 2016-03-10 17:47:07 +01:00
Kim Kulling
98ba2d2310 Update Readme.md
Readme: fix typo
2016-03-04 16:45:40 +01:00
Kim Kulling
80f4e69938 Merge pull request #813 from tgoulart/obj_loader_leak
Fix memory leak in OBJ loader when a mesh has no faces.
2016-03-04 16:41:57 +01:00
Kim Kulling
f774bde20b Merge pull request #814 from tgoulart/xcode6_builds_again
Add missing files  so that xcode6 project builds successfully
2016-03-04 16:40:50 +01:00
Thiago Goulart
3c9e57fd73 Fix memory leak in OBJ loader when a mesh has no faces. 2016-03-04 03:40:47 -08:00
Thiago Goulart
1e5632b3b8 Add missing files (and required includes) so that xcode6 project builds succesfully. 2016-03-04 03:39:10 -08:00
Kim Kulling
072e38403e Update Readme.md
README: move donate to a special chapter.
2016-03-04 11:13:07 +01:00
Kim Kulling
f51f5f8291 Update Readme.md
README: Add link to donate page.
2016-03-04 11:12:11 +01:00
Kim Kulling
53370d0d31 FBXImporter: some refactorings to increase readability. 2016-03-03 18:38:50 +01:00
Kim Kulling
26fba14aaf Merge branch 'master' of https://github.com/assimp/assimp 2016-03-03 15:20:22 +01:00
Kim Kulling
2b09199f4a FBXImporter: move MeshGeometry declaration into its own header 2016-03-03 15:19:38 +01:00
Kim Kulling
e7c3a733b6 Merge pull request #812 from tgoulart/fix_switch_warning
Fix warning when compiling using -Wswitch-enum
2016-03-02 21:16:42 +01:00
Thiago Goulart
17f0e09bd1 Fix warning when compiling using -Wswitch-enum 2016-03-02 00:07:17 -08:00
Kim Kulling
3079b90622 Importer: when the right importer was found log this info. 2016-02-29 15:57:47 +01:00
Kim Kulling
e9f47b08c5 FBXImporter: fx build. 2016-02-28 20:56:11 +01:00
Kim Kulling
28d327b7ea FBXImporter: fix build. 2016-02-28 20:27:31 +01:00
Kim Kulling
2496e8a0a3 Lib: reduce number of header files included. 2016-02-28 17:30:11 +01:00
Kim Kulling
58fc3940f2 Obj Importer: add missing semicolon to fix the build. 2016-02-25 19:04:13 +01:00
Kim Kulling
e5f07dc96c License info: fix dates 2016-02-25 18:22:59 +01:00
Kim Kulling
b09d9bdfe2 Merge branch 'master' of https://github.com/assimp/assimp 2016-02-25 18:01:33 +01:00
Kim Kulling
99f00834ec closes ssues/804: add statement to take care of emissive texture, new
version.
2016-02-25 18:00:09 +01:00
Kim Kulling
23eab0dfab Merge pull request #798 from boxdot/master
Fix special case in aiMatrix3x3t::FromToMatrix.
2016-02-23 21:21:47 +01:00
Alexander Gessler
13ee28bcf6 Merge pull request #803 from akazantsev/master
Resolves #802
2016-02-22 23:21:57 +01:00
Andrey Kazantsev
b8fbf3ad29 Resolves #802 2016-02-22 22:24:03 +02:00
Kim Kulling
ff7deaa091 appveyor: add libs to build artifacts. 2016-02-20 11:14:22 +01:00
Kim Kulling
5c13b89724 appveyor: change path to build artifact. 2016-02-19 20:42:56 +01:00
Kim Kulling
767e8e0b6e appveyor: fix typo. 2016-02-19 18:40:21 +01:00
Kim Kulling
9df73a3f7d appveyor: define build artifacts. 2016-02-19 18:32:16 +01:00
Kim Kulling
6f429a63ed appveyor: remove VS 2012 from CI. 2016-02-19 16:30:20 +01:00
Kim Kulling
1558db0722 appveyor: remove buggy quotes. 2016-02-19 11:44:02 +01:00
Kim Kulling
8375cfe1ed anveyor: enable verbose output. 2016-02-19 11:07:17 +01:00
Kim Kulling
acf8bf7325 Appveyor: use correct names for project generators. 2016-02-19 10:45:00 +01:00
Kim Kulling
122d93d013 Appveyor: fix path in setup. 2016-02-19 10:31:26 +01:00
Paul Holland
f20a5afcf0 can't add integer to string pointer 2016-02-18 12:17:47 -08:00
Paul Holland
fe68765df9 Merge remote-tracking branch 'upstream/master' 2016-02-18 12:11:57 -08:00
Kim Kulling
166d5d1d13 appveyor: Fix invalid path. 2016-02-18 18:29:25 +01:00
Alexander Gessler
38d462f0b3 Merge pull request #764 from rmitton/sib_import
Validation fix for empty SIB scenes.
2016-02-18 11:58:26 +01:00
Alexander Gessler
88fee56cce Merge pull request #790 from ov/safe-normalizing-in-smoothing-groups
use NormalizeSafe to prevent NaN when normalizing zero vectors
2016-02-18 11:53:57 +01:00
Kim Kulling
909c5d5152 CI: Remove erroreous platform spec from appveyor file. 2016-02-17 15:17:55 +01:00
Kim Kulling
03af4b3dd4 Appveyor: add compiler setup script. 2016-02-17 13:44:33 +01:00
boxdot
6de709410f Fix special case in aiMatrix3x3t::FromToMatrix. 2016-02-15 20:53:39 +01:00
Kim Kulling
d393ab11ec Appveyor: add support for VS2010. 2016-02-15 10:20:34 +01:00
Kim Kulling
cb3454a3b5 Merge pull request #796 from afiskon/master
Update pstdint.h to version 0.1.12 ( solve #795 )
2016-02-15 10:07:41 +01:00
afiskon
bf74a5a662 Update pstdint.h to version 0.1.12 ( solve #795 ) 2016-02-14 22:39:37 +03:00
Alexander Gessler
4866191b21 Merge pull request #794 from turol/master
LWO: Fix division by zero
2016-02-13 22:51:54 +01:00
Turo Lamminen
b71bd3df84 LWO: Fix division by zero 2016-02-13 23:37:08 +02:00
Kim Kulling
322c959424 Merge pull request #791 from trond/collada_animation_clip
Collada animation clip support
2016-02-11 22:11:27 +01:00
Kim Kulling
f0717b1d7c Merge pull request #793 from AlexBobkov/master
Fixed installing pdb file
2016-02-11 22:10:21 +01:00
Kim Kulling
55f285961e Merge pull request #792 from rdb/patch-1
Fix loading of pk3 q3bsp maps
2016-02-11 17:08:56 +01:00
Alexander Bobkov
a5f9d0d3fc Fixed installing pdb file 2016-02-11 16:24:26 +03:00
rdb
7d4a713a86 Fix loading of pk3 q3bsp maps
This fixes loading of pk3 maps.  The pk3 files contain directory entries with a size of 0, which triggered an assertion.
2016-02-11 14:10:49 +01:00
Trond Abusdal
ccd9f92533 Fixed a couple of nested template brackets that wasn't spaced out correctly. 2016-02-11 01:00:03 +01:00
Trond Abusdal
14e5cf380c Added regression test file for <library_animation_clips> support. Generated from Blender using 'Better Collada Exporter' from Godot team. 2016-02-11 00:22:32 +01:00
Vitaly Ovchinnikov
4d5df6dc9a use NormalizeSafe to prevent NaN when normalizing zero vectors 2016-02-11 12:19:06 +13:00
Trond Abusdal
7e58a47ba0 * Combining single-channel animations like the previous code did, except now it has been deferred until after all nodes have been read. This makes the regression tests pass for a database created before these code changes.
* Changed name of ColladaParser::RebuildRootAnimationsFromClips to ColladaParser::PostProcessRootAnimations as it now does more than it did before.
2016-02-10 23:57:29 +01:00
Kim Kulling
d9017299a8 iObjParser: refactorings. 2016-02-10 10:40:39 +01:00
Kim Kulling
8681abe845 Obj_Importer: remove dead code. 2016-02-09 17:50:08 +01:00
Kim Kulling
1550191256 Closes https://github.com/assimp/assimp/issues/777: fix invalid skipping
of line during face defintion parsing.
2016-02-08 18:07:00 +01:00
Trond Abusdal
c34717639e Collada: Importer generates animations from <library_animation_clips>, if the node is present. 2016-02-07 23:36:49 +01:00
rmitton
72b5ed50e9 Bump just to get AppVeyor to re-test it. 2016-02-07 13:21:58 -08:00
Kim Kulling
2466ae6c2e Merge pull request #789 from assimp/revert-771-obj_load_forever_fix
Revert "Fix issue: OBJ import takes forever (#759) (attempt 2)"
2016-02-07 20:03:38 +01:00
Kim Kulling
37a3976b30 Revert "Fix issue: OBJ import takes forever (#759) (attempt 2)" 2016-02-07 20:03:24 +01:00
Kim Kulling
c084a47c5d Merge pull request #771 from andrewparlane/obj_load_forever_fix
Fix issue: OBJ import takes forever (#759) (attempt 2)
2016-02-07 20:00:03 +01:00
Kim Kulling
a998055cbd OpenDDLParser: add missing files. 2016-02-07 17:59:56 +01:00
Kim Kulling
522f4e0882 Closes https://github.com/assimp/assimp/issues/786:
- fix invalid value get for index data.
- update OpenDDL-library
2016-02-07 17:58:28 +01:00
Kim Kulling
7961c22c55 Closes https://github.com/assimp/assimp/issues/787: Update CHANGES. 2016-02-06 20:54:47 +01:00
Kim Kulling
dfbae1294f JoinVerticesProcess: iAdd test for possible null pointer access. 2016-02-05 18:53:23 +01:00
Kim Kulling
51c9a9f80c Unittests: add test if export is disabled. 2016-02-05 18:31:19 +01:00
Kim Kulling
f7d979c46e Merge pull request #783 from snikulov/gtest_upd
updated gtest repository to github
2016-02-05 18:04:01 +01:00
Sergei Nikulov
982d597acf updated gtest to github 2016-02-05 13:11:40 +03:00
Kim Kulling
a74b321ed1 Add unittests for defect reproduction. 2016-02-04 20:43:02 +01:00
Kim Kulling
699aa9c583 Closes https://github.com/assimp/assimp/issues/754: use correct index
token.
2016-02-03 21:09:20 +01:00
Kim Kulling
2dc6ea85ec Merge branch 'master' of https://github.com/assimp/assimp 2016-02-03 20:20:16 +01:00
Kim Kulling
aff932cd9c Fix license date. 2016-02-03 20:19:59 +01:00
Kim Kulling
aef69ffe91 Merge pull request #779 from turol/master
SIBImporter: Properly fix C++11 issues for Clang
2016-02-02 20:40:52 +01:00
Turo Lamminen
0e06404ec1 SIBImporter: Properly fix C++11 issues for Clang
C-style cast has a higher precedence than & -operator so this was getting
parsed differently than Kim assumed. Thou shalt not use C-style casts.
2016-02-02 20:29:40 +02:00
Kim Kulling
d9f133edec Doc: add missing ports to start README page. 2016-02-02 17:48:23 +01:00
Kim Kulling
b77228c7ea Android build doc: reformatting. 2016-02-02 11:00:28 +01:00
Kim Kulling
219bf32efe Rename android renameRename android rename. 2016-02-02 10:59:07 +01:00
Kim Kulling
7233aedac3 DOC: add link to ports in global readme. 2016-02-02 10:58:15 +01:00
Kim Kulling
72d720ecfb Doc: use markup format for android build instructions. 2016-02-02 10:52:28 +01:00
Kim Kulling
59ece7b9fa Datatypes: add missing unions for vector + color types. 2016-02-02 00:59:47 +01:00
Kim Kulling
aaec1656f3 Closes https://github.com/assimp/assimp/issues/43 : provide different
matrix scheme via union.
2016-02-01 16:16:48 +01:00
Kim Kulling
a1bd83d797 ai_assert: split 2 checks in one macro to 2 separate ai_assert tests. 2016-02-01 16:16:09 +01:00
Kim Kulling
f1666d22ce Closes https://github.com/assimp/assimp/issues/778: export android system. 2016-01-31 13:44:15 +01:00
Kim Kulling
9f9f69d6cc AndroidJNIIOSystem: update license info to 2016. 2016-01-31 13:43:05 +01:00
Kim Kulling
16fffb2ab1 Merge branch 'master' of https://github.com/assimp/assimp 2016-01-31 00:42:02 +01:00
Kim Kulling
a37ea18f09 SIBImporter: fix c++14 compilation issue for clang. 2016-01-31 00:41:14 +01:00
Kim Kulling
bcd38707c5 3DSConverter: fix level 4 compiler warning. 2016-01-29 21:22:41 +01:00
Paul Holland
c571b92dd7 bug fix 2016-01-28 08:06:52 -08:00
Kim Kulling
bac6067869 gltf: make code more radable and check against one possible null ptr
access.
2016-01-27 20:26:38 +01:00
Kim Kulling
0e7446af83 Merge branch 'master' of https://github.com/assimp/assimp 2016-01-27 18:49:26 +01:00
Kim Kulling
8bbd55a790 PostProcessing: first prototype of customized post processing. 2016-01-27 18:49:01 +01:00
Kim Kulling
f473b17c99 Merge pull request #773 from boxdot/master
Import mClipPlane{Near,Far} and mHorizontalFOV from Blender.
2016-01-27 17:20:26 +01:00
Kim Kulling
ce9ae0ae53 Merge pull request #772 from abma/master
fix new / delete missmatch
2016-01-27 17:19:52 +01:00
boxdot
13ec11bca8 Import mClipPlane{Near,Far} and mHorizontalFOV from Blender. 2016-01-27 02:12:15 +01:00
abma
b3b08728fa fix new / delete missmatch 2016-01-26 22:47:50 +01:00
Andrew Parlane
109f6feb6e ObjFileParser: Moved the parsing of line continuations (backslashes) to the parsing code.
Rather than removing all backslashes followed by newlines from the buffer,
and then parsing it. Handle removing the backslashes as we go. This means
we don't need to erase the backslashes from the buffer (which is O(n))
instead we just skip those characters as we parse the buffer line by line.

This time I've fixed the order of evaluation bug in the call to getFace().
2016-01-25 20:44:31 -04:00
Andrew Parlane
c7d86e97cc ObjTools: Update getName() to work with const iterators.
Ther's no need to convert the input parameter to a char * when we can just
leave it as it is.
2016-01-25 20:43:34 -04:00
Kim Kulling
11d0085f4d Merge pull request #770 from assimp/revert-765-master
Revert "Fix issue: OBJ import takes forever (#759)"
2016-01-26 00:14:27 +01:00
Kim Kulling
4633266c31 Revert "Fix issue: OBJ import takes forever (#759)" 2016-01-25 23:53:59 +01:00
rmitton
f23285a1ce Fixed whitespace to match coding standard. 2016-01-25 13:45:08 -08:00
rmitton
94a35dfdd2 Fixed NULL pointers to match coding standards. 2016-01-25 13:42:30 -08:00
Kim Kulling
d58f5613dd Merge pull request #765 from andrewparlane/master
Fix issue: OBJ import takes forever (#759)
2016-01-24 19:36:18 +01:00
Andrew Parlane
9969167c2a ObjFileParser: Moved the parsing of line continuations (backslashes) to the parsing code.
Rather than removing all backslashes followed by newlines from the buffer,
and then parsing it. Handle removing the backslashes as we go. This means
we don't need to erase the backslashes from the buffer (which is O(n))
instead we just skip those characters as we parse the buffer line by line.
2016-01-23 20:01:44 -04:00
Andrew Parlane
ce64dfb3fd ObjTools: Update getName() to work with const iterators.
Ther's no need to convert the input parameter to a char * when we can just
leave it as it is.
2016-01-23 20:01:44 -04:00
rmitton
ae2cce0899 Validation fix for empty scenes.
The validator requires empty scenes to have NULL pointers.
2016-01-23 15:22:48 -08:00
Kim Kulling
0e4cf64a45 Merge pull request #763 from andrewparlane/mtlFix
ObjFileMtlImporter: Fixed a segfault due to NULL ptr access.
2016-01-23 19:51:49 +01:00
Andrew Parlane
3c4e06c23f ObjFileMtlImporter: Fixed a segfault due to NULL ptr access.
We don't handle reflection textures during MTL import. This allowed a NULL
ptr to be used. Simply return in the case of a reflection texture.
2016-01-23 13:11:47 -04:00
Kim Kulling
a3a42fd08b Merge pull request #756 from StepanHrbek/master
Collada exporter: improve compatibility when exported path contains ':'.
2016-01-22 22:32:40 +01:00
Stepan Hrbek
c062eb0db4 Collada exporter: improve compatibility when exported path contains ':'.
Old code exported "c:/foo.jpg" path as "c%3a/foo.jpg".
Replacing : with %3a was probably legal, but it made paths unreadable for existing Max importers.
2016-01-21 22:35:44 +01:00
Kim Kulling
df9bb8b915 Update license date. 2016-01-21 19:53:25 +01:00
Kim Kulling
c02a1dd11a closes assimp/assimp/issues/710: use correct include for importerdesc in
cimport.h
2016-01-20 21:25:47 +01:00
Kim Kulling
ded37e8307 Merge pull request #736 from StepanHrbek/collada-unicode
Collada exporter: fix unicode.
2016-01-19 16:35:48 +01:00
Kim Kulling
9e6f22b913 Merge pull request #753 from wise86-android/ValgrinFree
Valgrin free
2016-01-19 16:34:58 +01:00
Stepan Hrbek
24f03141d6 Reimplement isalnum(c,C locale) because I can't make AppVeyor see satndard version. 2016-01-18 10:10:49 +01:00
wise86Android
c7f69e151e fix memory leak 2016-01-17 15:18:12 +01:00
wise86Android
4af9632269 fix memory leak 2016-01-17 00:00:43 +01:00
wise86Android
bd032488e4 remove read unitilize memory 2016-01-16 23:42:43 +01:00
wise86Android
d51c2e6435 free the allocated import 2016-01-16 23:37:24 +01:00
wise86Android
f0fca826db remove initialization warnings 2016-01-16 23:28:52 +01:00
wise86Android
01a5035920 remove initialization warnings 2016-01-16 23:26:46 +01:00
Kim Kulling
8c13c8a558 PLYExporter: forbit copying + add empty destructor. 2016-01-14 20:44:09 +01:00
Kim Kulling
8f70830103 Closes https://github.com/assimp/assimp/issues/84: add another search path
for XCode framework paths for IPhones.
2016-01-13 18:55:47 +01:00
Kim Kulling
18c0e41d8f Colladaloader: fix usage of floorf. 2016-01-13 10:04:24 +01:00
Kim Kulling
42c1f9d3ba Closes https://github.com/assimp/assimp/issues/630: fix mis-merge. 2016-01-12 20:22:37 +01:00
Kim Kulling
d3ddabbd3e Merge branch 'master' of https://github.com/assimp/assimp 2016-01-11 21:16:17 +01:00
Kim Kulling
36668aa31a ASEParser: fix invalid size of buffer for log writing. 2016-01-11 21:15:30 +01:00
Kim Kulling
48eed0d2c6 Merge pull request #749 from andrewparlane/master
ObjImporter: Added better progress reporting during file import.
2016-01-11 20:39:09 +01:00
Andrew Parlane
1632f1fbb9 ObjImporter: Added better progress reporting during file import.
There are two stages to this:
1) Processing '\'s - this accounts for 1/3rd of the file import progress.
2) Parsing the file data - this accounts for the other 2/3rds.
2016-01-11 12:21:24 -04:00
Kim Kulling
bd268bd864 coverity scan: add missing initialization. 2016-01-10 20:25:01 +01:00
Kim Kulling
ec32da512b coverity scan: fix not initialized member in copy constructor. 2016-01-10 20:21:32 +01:00
Kim Kulling
3033d8c847 ColladaLoader: add missing .f 2016-01-09 18:09:52 +01:00
Kim Kulling
d18f978178 ColladaLoader: add missing members to initializer list. 2016-01-09 18:09:10 +01:00
Kim Kulling
1f356e87a8 appveyor: enable x86 build as well. 2016-01-09 12:13:39 +01:00
Kim Kulling
3d2140afee coverity finding: get latest openddlparser to get fix against possible nullptr access. 2016-01-08 16:55:31 +01:00
Kim Kulling
114d76765e OpenDDLParser: latest greatest to get fix for coverity finding ( dereferenfing possible null ptr ). 2016-01-08 16:46:13 +01:00
Kim Kulling
430b614a69 coverity scan: make place of false positive more understandable. 2016-01-08 16:18:32 +01:00
Kim Kulling
7ef579674d GenVertexNormalsProcess: use initalizer list instead of setting the earch angle in the constructor. 2016-01-07 15:03:10 +01:00
Kim Kulling
346bf9375b ai_assert: add missing license info. 2016-01-07 15:02:41 +01:00
Kim Kulling
54ac680400 fix merge conflict. 2016-01-06 22:19:07 +01:00
Kim Kulling
56a77b2429 snprintf-replacement: fix invalid preprocessor defines for compiler
detection on windows for older vs-versions
2016-01-06 19:55:04 +01:00
Kim Kulling
d43a083dc1 snprintf replacement: fix usage of ai_snprintf when snprintf is available. 2016-01-06 19:25:35 +01:00
Kim Kulling
6bfdeb6a12 sprintf replacement: introduce au_snprintf to support snprintf for v2013
and earier ( closes https://github.com/assimp/assimp/issues/743 )
2016-01-06 15:35:25 +01:00
Kim Kulling
67c258e75d snprintf: change next couple of sprintf to snprintf. 2016-01-05 11:38:06 +01:00
Kim Kulling
c3d4be1dce sprintf: replace more sprintf by snprintf. 2016-01-04 22:24:25 +01:00
Kim Kulling
c9d00beab8 sprintf: replace sprintf by snprintf. 2016-01-04 20:24:51 +01:00
Kim Kulling
f4d3d15bbb UnrealLoader: replace sprintf by snprintf. 2016-01-04 20:22:46 +01:00
Kim Kulling
847644ca75 DefaultLogger: fix missing sprintf calls. 2016-01-03 23:29:37 +01:00
Kim Kulling
d26187714d Merge branch 'master' of https://github.com/assimp/assimp 2016-01-03 20:00:28 +01:00
Kim Kulling
540c9f3e9f Fix assimp/assimp/issues/737: use snprintf instead of sprintf. 2016-01-02 21:29:46 +01:00
Kim Kulling
51bdc6c9bf Merge pull request #739 from dankex/fix_mac
Fix compilation error for Mac OS X and 64-bit architecture
2016-01-02 11:35:27 +01:00
Danke Xie
b2760abeb2 Fix compilation error for Mac OS X and 64-bit architecture
For a 64-bit architecture, unsigned long and size_t are the same.
This causes a compilation error due to duplicate constructors in document.h.
2016-01-02 01:29:47 -08:00
Kim Kulling
b6673c3fca Update license info in public headers 2016-01-01 21:08:28 +01:00
Kim Kulling
1191d03405 Update license info. 2016-01-01 21:07:24 +01:00
Kim Kulling
189340a99f License file: update to 2016 2016-01-01 20:24:10 +01:00
Kim Kulling
912cf63b71 Merge branch 'master' of https://github.com/assimp/assimp 2015-12-31 19:49:37 +01:00
Kim Kulling
4e9ee4e406 coverity findings: add missing initialization. 2015-12-31 16:00:19 +01:00
Stepan Hrbek
39ab716e11 Collada exporter: Fix unicode filenames.
Although existing code uses "C" locale partially, both calls to isalnum() clearly did not use it.
So for example character "ä" was written to .dae as is, rather than converted to %e4, generated .dae was unreadable to many parsers.
2015-12-31 03:22:25 +01:00
Stepan Hrbek
15d84825d9 Collada exporter: Fix isalnum(negative number) assert.
isalnum(negative number) asserts in MSVC.
It was first visible problem when exporting unicode filenames.
2015-12-31 03:18:11 +01:00
Kim Kulling
217ec76dfb coverity findings: fix possible derefencing of null pointer. 2015-12-30 21:56:24 +01:00
Kim Kulling
e02a7cdb3c Merge pull request #732 from StepanHrbek/collada-export
Collada exporter: bind uv channel numbers with <bind_vertex_input>.
2015-12-30 21:31:29 +01:00
Kim Kulling
68b12ac0c4 Merge pull request #735 from JLouis-B/master
Fix a crash issue in XFileExporter
2015-12-30 21:26:34 +01:00
Kim Kulling
043fef6d21 coverity findings: fix resource leak in MakeVerboseFormat. 2015-12-30 20:39:58 +01:00
Kim Kulling
56e9a9168c coverity findings: add missing initializations. 2015-12-30 20:04:16 +01:00
Kim Kulling
1ea1f6dcfa coverity findings: add missind intialization in STEPFile. 2015-12-30 20:02:35 +01:00
Kim Kulling
e1818d8ab6 coverity findings: initialize lookup table for materials. 2015-12-30 19:43:57 +01:00
JLouis-B
a02cc6c98e Fix a crash issue in XFileExporter 2015-12-30 19:01:04 +01:00
Kim Kulling
0f1874d954 coverity findings: initialize index counter in line splitter. 2015-12-30 16:33:54 +01:00
Kim Kulling
7c3475c002 Coverity findings: fix resource leak in PlyLoader.cpp. 2015-12-30 15:38:30 +01:00
Kim Kulling
0c1b5355f4 Coverity finding: remove not used function. 2015-12-30 15:35:26 +01:00
Kim Kulling
8d07e34336 travis config: remove coverity config from master branch. 2015-12-29 20:46:41 +01:00
Kim Kulling
da21306f85 travis config: still fighting with tabs. 2015-12-29 20:17:20 +01:00
Kim Kulling
288b81ff7b travis config: fix more invalid tabs and one typo. 2015-12-29 20:09:26 +01:00
Kim Kulling
0cc5e50443 travis config: remove erroreous tab intention. 2015-12-29 20:06:33 +01:00
Stepan Hrbek
ad55e769bf Collada exporter: bind uv channels with <bind_vertex_input>.
When there are multiple uv channels used by multiple textures, <bind_vertex_input> specifies what channels to use. Without <bind_vertex_input>, at least some importers are unable to match channels to textures.
2015-12-29 17:08:16 +01:00
Kim Kulling
5ff3e0dd15 coverity: enable automatic coverity scan. 2015-12-29 16:19:42 +01:00
Kim Kulling
43be58bbfe rapidjson: add apple-specific constructor with size_t. 2015-12-28 13:02:04 +01:00
Kim Kulling
22f7f60ba0 glTF: usage of (hopefully) correct data type for size types: closes https://github.com/assimp/assimp/issues/723 2015-12-27 20:36:54 +01:00
Kim Kulling
9409ce3b56 https://github.com/assimp/assimp/issues/714: fix null pointer access with
unknown texture.
2015-12-27 00:19:11 +01:00
Kim Kulling
a148f1e28c Fix typo. 2015-12-27 00:15:14 +01:00
Kim Kulling
04832218a1 https://github.com/assimp/assimp/issues/728: XCode fix. 2015-12-27 00:07:37 +01:00
Kim Kulling
9af4747fa8 github.com/assimp/assimp/issues/730: use correct define check 2015-12-26 21:02:32 +01:00
Kim Kulling
59c856fcf3 Travis: disable regression test suite. 2015-12-20 20:23:16 +01:00
Alexander Gessler
5847576f41 Merge pull request #703 from terziman/master
Improvement of collada transparency handling
2015-12-20 15:59:42 +01:00
Alexander Gessler
7e85f45abc Merge pull request #713 from ov/normalize-safe
GenVertexNormalsProcess produces invalid results for specific input
2015-12-20 00:06:58 +01:00
Alexander Gessler
891411514b Merge pull request #721 from luho383/fbx_file_import
Fix for FBX Files that do not have a Comma on a new line in a data block
2015-12-20 00:06:02 +01:00
Alexander Gessler
3b10f69f7e Merge pull request #719 from luho383/master
FBX Import fix
2015-12-20 00:04:45 +01:00
Alexander Gessler
b929b04715 Merge pull request #726 from dankex/localref
Use SmartLocalRef to automatically release localrefs in jassimp.cpp
2015-12-20 00:03:42 +01:00
Danke Xie
b0148641e9 Make SmartLocalRef non-copyable 2015-12-19 09:13:28 -08:00
Danke Xie
2e831604e9 Use SmartLocalRef to automatically release localrefs in jassimp.cpp
- Add SmartLocalRef class
- Use it to automatically delete localrefs of Java objects, generated
  by FindClass, createInstance, getField, NewStringUTF, etc.
- Tested with models with more than 512 nodes.
2015-12-19 01:30:02 -08:00
Kim Kulling
8a037124a8 Merge pull request #725 from coderextreme/master
Added GenericValue(unsigned long) to document.h
2015-12-18 13:16:02 +01:00
carlsonsolutiondesign
dd89bd3703 Only test for __APPLE__ here to avoid conflicts with Linux (and maybe Windows) 2015-12-17 17:02:06 -05:00
carlsonsolutiondesign
fa0427ca28 Copies the GenericValue(uint64_t) to a GenericValue(unsigned long) for compilation on Mac OS X 10.11.2. Not compiled on Windows yet. Will have to reboot and install Visual Studio or equivalent to compile, so I'm hoping someone else can look at the code and merge for Windows and Linux. Thanks! 2015-12-17 12:16:25 -05:00
John Carlson
0ebab2ef23 Merge pull request #1 from assimp/master
Pull from master 12-17-2015
2015-12-17 09:53:56 -05:00
lutz.hoeren
90ddb93940 Fix for FBX Files that do not have a Comma on a new line in a data block 2015-12-17 11:48:44 +01:00
lutz.hoeren
7e02b34090 Merge branch 'master' of https://github.com/luho383/assimp 2015-12-16 15:26:10 +01:00
lutz.hoeren
e8a02ef890 Only read Element Data when there is a valid Mapping Information 2015-12-16 15:25:33 +01:00
Kim Kulling
f75b919d42 Merge branch 'ov-issue-707' 2015-12-14 18:49:46 +01:00
Kim Kulling
3d6e1483d8 Update readme. 2015-12-14 18:42:31 +01:00
Kim Kulling
6b297b8960 New obj regression data. 2015-12-14 18:39:32 +01:00
Kim Kulling
6dfc99aa3d New db.zip. 2015-12-14 18:38:01 +01:00
Kim Kulling
e0015b8610 Regression: updated test db. 2015-12-14 18:12:14 +01:00
Kim Kulling
87b3af4c3b Merge branch 'issue-707' of https://github.com/ov/assimp into ov-issue-707 2015-12-14 17:46:54 +01:00
Kim Kulling
b60f57ece7 Merge pull request #716 from rmitton/empty_objmtl
Added support for empty .MTL files.
2015-12-14 09:29:31 +01:00
Kim Kulling
40272b4d26 Merge pull request #715 from rmitton/doc_fixes
Tiny misc fixes for documentation
2015-12-14 09:12:17 +01:00
Kim Kulling
db96007f77 Merge pull request #717 from rmitton/sib_import
Importer for Nevercenter Silo SIB files.
2015-12-14 09:09:52 +01:00
rmitton
d952823ffd Importer for Silo SIB files.
Wrote an importer for Nevercenter Silo's binary SIB model format
2015-12-13 22:14:19 -08:00
rmitton
b9a4e99607 Added support for empty .MTL files.
Some programs such as Silo export an empty .MTL file if you export a
.OBJ that doesn't use any materials. This patch allows the loading of
such files.
2015-12-13 22:13:25 -08:00
rmitton
957426ed72 Tiny misc fixes for documentation 2015-12-13 22:12:25 -08:00
Vitaly Ovchinnikov
6e2b0b4fd1 a speedup 2015-12-14 15:37:27 +13:00
Vitaly Ovchinnikov
b6f14eb917 Normalize() is replaced with NormalizeSafe() to prevent invalid vectors generation 2015-12-14 15:31:49 +13:00
Vitaly Ovchinnikov
af40c99a6a trimming spaces around material names 2015-12-14 08:32:09 +13:00
Vitaly Ovchinnikov
c9ef6132a8 a small fix 2015-12-13 23:10:31 +13:00
Vitaly Ovchinnikov
6214fbfbbe this patch fixes multiple objects generation in OBJ reader if faces are prepended with 'usemtl' line 2015-12-13 22:54:50 +13:00
Kim Kulling
078dd0c08b Merge pull request #705 from Vertexwahn/master
Added custom target that copies generated libs and bin files to lib32/lib64 and bin32/64 folder
2015-12-11 14:09:59 +01:00
Vertexwahn
270355f326 Improved Findassimp.cmake to support VS2013. Added deployment of VS2013 libs and dll files. 2015-12-11 10:33:47 +01:00
Alexander Gessler
5fc66d6c43 Merge pull request #706 from expipiplus1/spelling
Correct spelling
2015-12-10 21:49:24 +01:00
Vertexwahn
1fd66df37d Improved Findassimp.cmake to support VS2015. 2015-12-10 17:58:55 +01:00
Joe Hermaszewski
210764a6ff Correct spelling 2015-12-10 16:19:33 +00:00
Vertexwahn
c6d1fcca74 Added custom target that copies generated libs and bin files to lib32/lib64 and bin32/64 folder 2015-12-10 17:15:27 +01:00
Vertexwahn
cbafae9e49 Merge pull request #1 from assimp/master
Merge
2015-12-10 16:52:03 +01:00
Kim Kulling
b440f67aae Merge pull request #704 from Vertexwahn/master
Added missing DLL suffix for VS2015 build.
2015-12-09 23:52:15 +01:00
Kim Kulling
9a6049d98d Merge branch 'master' of https://github.com/assimp/assimp 2015-12-09 23:50:00 +01:00
Kim Kulling
35fafe3a6f ColladaParser: use initializer lists again. 2015-12-09 23:49:03 +01:00
Vertexwahn
3013b6b62f Added missing DLL suffix for VS2015 build. 2015-12-09 21:58:29 +01:00
Kim Kulling
bf4ca8162d Update ColladaParser.cpp
Introduce workaround again to fix the build.
2015-12-09 15:07:58 +01:00
Kim Kulling
9ae7d438f0 Update ColladaParser.cpp
Try to close resource leak.
2015-12-09 12:10:31 +01:00
Kim Kulling
bcff6210b3 Regression test: fix deprecated python print call. 2015-12-08 21:33:08 +01:00
Kim Kulling
b694bfd021 fix build 2015-12-08 20:36:31 +01:00
Léo Terziman
6eebf8455a Merge remote-tracking branch 'official/master' into contrib 2015-12-08 15:25:13 +01:00
Léo Terziman
445ae1fec3 In collada: implemented all missing transparency features from standard (ie RGB_ZERO, RGB_ONE and A_ZERO)
+ removed user option to invert transparency as it does not seem to be needed anymore
+ fixed bug in default reflectivity value
2015-12-08 15:24:07 +01:00
lutz.hoeren
2f3c47cab6 Only read Element Data when there is a valid Mapping Information 2015-12-08 12:26:41 +01:00
Kim Kulling
0a6788d56f try to fix build. 2015-12-07 20:43:01 +01:00
Kim Kulling
f5e13874e0 glTF: check if exporter option has broke someting. 2015-12-06 16:49:10 +01:00
Kim Kulling
99b51eb456 Merge branch 'master' of https://github.com/assimp/assimp 2015-12-06 12:20:11 +01:00
Kim Kulling
6641188a8e assimp/issues/702: fix resource leak and use initializer list for all
attributes of the loader instance.
2015-12-06 12:18:33 +01:00
Kim Kulling
a972397196 Merge pull request #699 from otgerp/master
glTF exporter + improved the importer (and code refactor)
2015-12-03 13:19:38 +01:00
Otger
ffdcc78d91 Merge 2015-12-02 21:06:22 +01:00
Kim Kulling
8736907009 Importer: fix overflowImporter: fix overflow. 2015-12-02 19:58:43 +01:00
Kim Kulling
f839232938 Uinittests: add missing license info headers. 2015-12-02 14:54:29 +01:00
Kim Kulling
1ef84a962f README: add glTF to readme.md 2015-12-01 19:34:54 +01:00
Kim Kulling
f896c3329a Build: remove deprecated third party lib from cmake 2015-11-30 12:52:49 +01:00
Otger
166ff63af9 Updated CMAKE - removed removed package inclusion 2015-11-29 21:20:31 +01:00
Otger
c5cb7f7b73 Merge branch 'master' of git://github.com/assimp/assimp 2015-11-29 21:17:05 +01:00
Otger
f2c49a69ba Fixing gcc errors - second attempt 2015-11-29 21:13:35 +01:00
Kim Kulling
714630cc11 Contrib: remove deprecated pacakgeContrib: remove deprecated pacakge.. 2015-11-29 20:37:05 +01:00
Otger
d72443d6b0 Fixed gcc warnings and errors 2015-11-29 20:17:06 +01:00
Otger
4f757cdf5a Implemented basic glTF exporter and improved the importer (plus some code refactor) 2015-11-29 19:13:51 +01:00
Kim Kulling
91a6ff7f0e Importer: fix doxygen comment style to default. 2015-11-28 12:05:55 +01:00
Kim Kulling
ba35c97e9d assimp/assimp/issues/698: Increase upper limits for hints. 2015-11-28 10:06:26 +01:00
Kim Kulling
75f7d93434 Merge pull request #697 from otgerp/master
Basic glTF support (experimental)
2015-11-27 08:54:32 +01:00
Otger
5942d60aea Fixed gcc errors 2015-11-27 02:31:18 +01:00
Otger
526027999b Merge 2015-11-27 01:44:06 +01:00
Otger
b307ec643d Created exporter class and fixed a few bugs 2015-11-27 01:16:48 +01:00
Kim Kulling
fc6f35dab2 Merge branch 'master' of https://github.com/assimp/assimp 2015-11-26 20:53:41 +01:00
Kim Kulling
502d9f17b6 glTF: add importer to registry and try to parse json. 2015-11-26 20:49:00 +01:00
Kim Kulling
a655467b59 Merge pull request #692 from dankex/instance_image
instance_image support for sample2D in Collada 1.5
2015-11-26 14:06:09 +01:00
Kim Kulling
398c1361d3 Merge pull request #674 from suikki/master
FBX import: If animation is not defining keys for all vector components (x, y and z), use the node transform as the default value.
2015-11-26 13:50:34 +01:00
Otger
148a20a703 Experimental support for glTF 2015-11-26 02:36:22 +01:00
Otger
64a020965f Added RapidJSON to contrib 2015-11-26 02:33:39 +01:00
Kim Kulling
702ef1a513 glTF: add missing attribute buffer for text streams. 2015-11-25 22:31:23 +01:00
Kim Kulling
db8845d2b2 glTF: add jsn reader + example model to work on. 2015-11-25 22:03:39 +01:00
Kim Kulling
65d366dad0 Merge pull request #694 from OtgerRP/master
Support for FBX embedded textures
2015-11-24 21:26:34 +01:00
Otger
a51d9a3884 Ignore FBX 'PP' type connections (they were stopping the file parsing) 2015-11-24 17:51:11 +01:00
Otger
3c358a8e34 Updated dumps for FBX files 2015-11-24 16:33:31 +01:00
Kim Kulling
1daeef42ad Merge pull request #696 from yig/patch-1
aiGetExportFormatDescription() no longer uses free'd memory
2015-11-24 09:10:03 +01:00
Yotam Gingold
da013350f9 aiGetExportFormatDescription() no longer uses free'd memory
aiGetExportFormatDescription() now creates an Exporter object at the beginning of the function, so that a call to `GetExportFormatDescription()` doesn't access free'd memory.
2015-11-23 23:50:25 -05:00
Otger
c876dce82b Fixed crashes for Video with no content 2015-11-23 21:46:55 +01:00
Kim Kulling
032fbe3fe5 Merge branch 'master' of https://github.com/assimp/assimp 2015-11-23 21:29:51 +01:00
Kim Kulling
70540616ce issue 693: add missing release call in c-export interface. 2015-11-23 21:28:35 +01:00
Otger
f94bc8d66e Initial support for FBX embedded textures 2015-11-23 19:49:54 +01:00
Danke Xie
24b68b1e3d Support instance_image in Collada 1.5 files
The <instance_image> tag in sampler2D elements is not expected by
ColladaParser. This patch parses the instance_image element and
gets the image ID.
2015-11-19 17:36:23 -08:00
Kim Kulling
916cfb9d53 Merge pull request #690 from dankex/light
Add new light type 'ambient' to match light.h
2015-11-16 23:01:40 +01:00
Kim Kulling
9721759da4 Merge pull request #691 from dankex/androidjni
Fix AndroidJNI header path in CMakelists.txt
2015-11-16 13:40:44 +01:00
Danke Xie
57d7085fb8 Fix AndroidJNI header path in CMakelists.txt 2015-11-15 22:53:11 -08:00
Danke Xie
40ee575322 Add new light type 'ambient' to match light.h 2015-11-15 16:49:39 -08:00
Kim Kulling
7cc90c106f Merge pull request #689 from umlaeute/debian-fixes-3.2
Debian fixes 3.2
2015-11-15 09:59:23 +01:00
IOhannes m zmölnig
7806e991d9 Convert Windows-1252 charset to UTF-8
Windows-1252, seriously?
(this hard-to-detect weirdo charset really makes some problems with some
cmdline text-tool)
2015-11-13 23:01:49 +01:00
IOhannes m zmölnig
989e8af3fb fix argument check for assimp cmdline tool
`assimp cmpdump` expects two files as arguments.
so we need to check for at least 2 extra arguments (rather than only check
for !<1 and access both)
2015-11-13 22:33:53 +01:00
IOhannes m zmölnig
756cfd4f74 fix compilation on BigEndian
cannot pass a function by reference where an lvalue is expected
(only applies to bigendian, where a macro expands to a byteswap function)

Closes https://github.com/assimp/assimp/issues/613
2015-11-13 22:33:20 +01:00
Kim Kulling
e6ac1ed66a glTF-Importer: add files. 2015-11-08 20:29:05 +01:00
Kim Kulling
02ad376631 assimp/issues/685: add test for correct usage. 2015-11-07 10:00:55 +01:00
Olli Kallioinen
12ed07a939 FBX import: If animation is not defining keys for all vector components
(x, y and z), use the node transform as the default value.
2015-10-27 21:03:24 +02:00
Léo Terziman
d1e21045dc Merge remote-tracking branch 'official/master' into contrib 2015-09-07 11:49:41 +02:00
Léo Terziman
81be291ae0 Merge remote-tracking branch 'official/master' into contrib 2015-06-02 17:39:06 +02:00
580 changed files with 38371 additions and 9738 deletions

12
.gitignore vendored
View File

@@ -60,3 +60,15 @@ test/gtest/src/gtest-stamp/gtest-gitclone-lastrun.txt
Assimp.opensdf
contrib/zlib/CTestTestfile.cmake
ipch/assimp_viewer-44bbbcd1/assimp_viewerd-ccc45335.ipch
bin64/assimp-vc140-mt.dll
bin64/assimp-vc140-mtd.dll
lib64/assimp-vc140-mt.exp
lib64/assimp-vc140-mtd.exp
lib64/assimp-vc140-mtd.ilk
lib64/assimp-vc140-mtd.pdb
bin64/assimp-vc120-mt.dll
bin64/assimp-vc120-mtd.dll
lib64/assimp-vc120-mtd.pdb
lib64/assimp-vc120-mtd.ilk
lib64/assimp-vc120-mtd.exp
lib64/assimp-vc120-mt.exp

View File

@@ -3,7 +3,7 @@ function generate()
cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -DBUILD_SHARED_LIBS=$SHARED_BUILD
}
if [ $ANDROID ]; then
if [ $ANDROID ]; then
ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni
else
generate \
@@ -11,6 +11,6 @@ else
&& sudo make install \
&& sudo ldconfig \
&& (cd test/unit; ../../bin/unit) \
&& (cd test/regression; chmod 755 run.py; ./run.py; \
chmod 755 result_checker.py; ./result_checker.py)
#&& (cd test/regression; chmod 755 run.py; ./run.py ../../bin/assimp; \
# chmod 755 result_checker.py; ./result_checker.py)
fi

View File

@@ -19,7 +19,7 @@ env:
- ANDROID=1
language: cpp
compiler:
- gcc
- clang

42
CHANGES
View File

@@ -2,6 +2,24 @@
CHANGELOG
----------------------------------------------------------------------
3.2.0 (2015-11-03)
FEATURES:
- OpenDDL-Parser is part of contrib-source.
- Experimental OpenGEX-support
- CI-check for linux and windows
- Coverity check added
- New regression testsuite.
FIXES/HOUSEKEEPING:
- Hundreds of bugfixes in all parts of the library
- Unified line endings
API COMPATIBILITY:
- Removed precompiled header to increase build speed for linux
3.1.1 (2014-06-15)
FEATURES:
@@ -18,18 +36,18 @@ FEATURES:
FIXES/HOUSEKEEPING:
- Hundreds of bugfixes in all parts of the library
- CMake is now the primary build system
API COMPATIBILITY:
- 3.1.1 is not binary compatible to 3.0 due to aiNode::mMetaData
and aiMesh::mName
- Export interface has been cleaned up and unified
- Other than that no relevant changes
3.0 (2012-07-07)
FEATURES:
- new export interface similar to the import API.
- new export interface similar to the import API.
- Supported export formats: Collada, OBJ, PLY and STL
- added new import formats: XGL/ZGL, M3 (experimental)
- new postprocessing steps: Debone
@@ -46,11 +64,11 @@ FIXES/HOUSEKEEPING:
- improved CMake build system
- templatized math library
- reduce dependency on boost.thread, only remaining spot
is synchronization for the C logging API
is synchronization for the C logging API
API COMPATIBILITY:
- renamed headers, export interface, C API properties and meta data
prevent compatibility with code written for 2.0, but in
prevent compatibility with code written for 2.0, but in
most cases these can be easily resolved
- Note: 3.0 is not binary compatible with 2.0
@@ -68,9 +86,9 @@ FEATURES:
spatial structure) in some expensive postprocessing steps
- AssimpView now uses a reworked layout which leaves more space
to the scene hierarchy window
- Add C# bindings ('Assimp.NET')
- Keep BSD-licensed and otherwise free test files in separate
- Keep BSD-licensed and otherwise free test files in separate
folders (./test/models and ./test/models-nonbsd).
FIXES:
@@ -80,20 +98,20 @@ FIXES:
- OpenGL-sample now works with MinGW
- Fix Importer::FindLoader failing on uppercase file extensions
- Fix flawed path handling when locating external files
- Limit the maximum number of vertices, faces, face indices and
- Limit the maximum number of vertices, faces, face indices and
weights that Assimp is able to handle. This is to avoid
crashes due to overflowing counters.
- Updated XCode project files
- Further CMAKE build improvements
API CHANGES:
- Add data structures for vertex-based animations (These are not
currently used, however ...)
- Some Assimp::Importer methods are const now.

View File

@@ -1,28 +1,65 @@
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
#
# Copyright (c) 2006-2016, assimp team
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the
# following conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# * Neither the name of the assimp team, nor the names of its
# contributors may be used to endorse or promote products
# derived from this software without specific prior
# written permission of the assimp team.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#----------------------------------------------------------------------
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
cmake_minimum_required( VERSION 2.8 )
PROJECT( Assimp )
option(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
if(NOT BUILD_SHARED_LIBS)
#set(CMAKE_EXE_LINKER_FLAGS "-static")
set(LINK_SEARCH_START_STATIC TRUE)
endif(NOT BUILD_SHARED_LIBS)
OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
IF(NOT BUILD_SHARED_LIBS)
SET(LINK_SEARCH_START_STATIC TRUE)
ENDIF(NOT BUILD_SHARED_LIBS)
# Define here the needed parameters
set (ASSIMP_VERSION_MAJOR 3)
set (ASSIMP_VERSION_MINOR 2)
set (ASSIMP_VERSION_PATCH 0) # subversion revision?
set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
set (ASSIMP_SOVERSION 3)
set (PROJECT_VERSION "${ASSIMP_VERSION}")
SET (ASSIMP_VERSION_MAJOR 3)
SET (ASSIMP_VERSION_MINOR 2)
SET (ASSIMP_VERSION_PATCH 0) # subversion revision?
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
SET (ASSIMP_SOVERSION 3)
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 )
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
# Get the current working branch
execute_process(
EXECUTE_PROCESS(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
@@ -31,7 +68,7 @@ execute_process(
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
EXECUTE_PROCESS(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
@@ -39,41 +76,49 @@ execute_process(
ERROR_QUIET
)
if(NOT GIT_COMMIT_HASH)
set(GIT_COMMIT_HASH 0)
endif(NOT GIT_COMMIT_HASH)
IF(NOT GIT_COMMIT_HASH)
SET(GIT_COMMIT_HASH 0)
ENDIF(NOT GIT_COMMIT_HASH)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
# ${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/revision.h
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(
./
${CMAKE_CURRENT_BINARY_DIR}
)
option(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
set(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")
OPTION(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
SET(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")
option(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF)
OPTION(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF)
# Workaround to be able to deal with compiler bug "Too many sections" with mingw.
if( CMAKE_COMPILER_IS_MINGW )
IF( CMAKE_COMPILER_IS_MINGW )
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER )
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")
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")
ENDIF()
# hide all not-exported symbols
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall" )
elseif(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -std=c++0x" )
ELSEIF(MSVC)
# enable multi-core compilation with MSVC
add_definitions(/MP)
endif()
add_compile_options(/MP)
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
ELSEIF( CMAKE_COMPILER_IS_MINGW )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
ENDIF()
INCLUDE (FindPkgConfig)
INCLUDE_DIRECTORIES( include )
@@ -98,10 +143,10 @@ SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH
"Path the tool executables are installed to." )
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Debug Postfix for lib, samples and tools")
ELSE()
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfix for lib, samples and tools")
ELSE()
SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Debug Postfix for lib, samples and tools")
ENDIF()
# Only generate this target if no higher-level project already has
@@ -111,32 +156,7 @@ IF (NOT TARGET uninstall)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
# Globally enable Boost resp. the Boost workaround it is also needed by the
# tools which include the Assimp headers.
option ( ASSIMP_ENABLE_BOOST_WORKAROUND
"If a simple implementation of the used Boost functions is used. Slightly reduces functionality, but enables builds without Boost available."
ON
)
IF ( ASSIMP_ENABLE_BOOST_WORKAROUND )
INCLUDE_DIRECTORIES( code/BoostWorkaround )
ADD_DEFINITIONS( -DASSIMP_BUILD_BOOST_WORKAROUND )
MESSAGE( STATUS "Building a non-boost version of Assimp." )
ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND )
SET( Boost_DETAILED_FAILURE_MSG ON )
IF ( NOT Boost_ADDITIONAL_VERSIONS )
SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0" "1.50" "1.50.0" "1.51" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55" "1.55.0" "1.56" "1.56.0" "1.57" "1.57.0" "1.58" "1.58.0" "1.59" "1.59.0")
ENDIF ( NOT Boost_ADDITIONAL_VERSIONS )
FIND_PACKAGE( Boost )
IF ( NOT Boost_FOUND )
MESSAGE( FATAL_ERROR
"Boost libraries (http://www.boost.org/) not found. "
"You can build a non-boost version of Assimp with slightly reduced "
"functionality by specifying -DASSIMP_ENABLE_BOOST_WORKAROUND=ON."
)
ENDIF ( NOT Boost_FOUND )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
ENDIF ( ASSIMP_ENABLE_BOOST_WORKAROUND )
# cmake configuration files
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
@@ -145,38 +165,46 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C
FIND_PACKAGE( DirectX )
option ( ASSIMP_NO_EXPORT
OPTION ( ASSIMP_NO_EXPORT
"Disable Assimp's export functionality."
OFF
)
if( CMAKE_COMPILER_IS_GNUCXX )
set(LIBSTDC++_LIBRARIES -lstdc++)
endif( CMAKE_COMPILER_IS_GNUCXX )
IF( CMAKE_COMPILER_IS_GNUCXX )
SET(LIBSTDC++_LIBRARIES -lstdc++)
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
# Search for external dependencies, and build them from source if not found
# Search for zlib
find_package(ZLIB)
if( NOT ZLIB_FOUND )
OPTION(ASSIMP_BUILD_ZLIB
"Build your own zlib"
OFF
)
IF ( NOT ASSIMP_BUILD_ZLIB )
find_package(ZLIB)
ENDIF( NOT ASSIMP_BUILD_ZLIB )
IF( NOT ZLIB_FOUND )
message(STATUS "compiling zlib from souces")
include(CheckIncludeFile)
include(CheckTypeSize)
include(CheckFunctionExists)
# compile from sources
add_subdirectory(contrib/zlib)
set(ZLIB_FOUND 1)
set(ZLIB_LIBRARIES zlibstatic)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib)
SET(ZLIB_FOUND 1)
SET(ZLIB_LIBRARIES zlibstatic)
SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib)
else(NOT ZLIB_FOUND)
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
set(ZLIB_LIBRARIES_LINKED -lz)
endif(NOT ZLIB_FOUND)
SET(ZLIB_LIBRARIES_LINKED -lz)
ENDIF(NOT ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
# Search for unzip
if (PKG_CONFIG_FOUND)
IF (PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(UNZIP minizip)
endif (PKG_CONFIG_FOUND)
ENDIF (PKG_CONFIG_FOUND)
IF ( ASSIMP_NO_EXPORT )
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
@@ -204,59 +232,64 @@ MARK_AS_ADVANCED ( ASSIMP_BUILD_ARCHITECTURE ASSIMP_BUILD_COMPILER )
SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
"Build the C4D importer, which relies on the non-free Melange SDK."
"Build the C4D importer, which relies on the non-free Melange SDK."
)
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
IF ( MSVC )
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/includes")
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/includes")
# pick the correct prebuilt library
IF(MSVC11)
SET(C4D_LIB_POSTFIX "_2012md")
IF(MSVC14)
SET(C4D_LIB_POSTFIX "_2015")
ELSEIF(MSVC12)
SET(C4D_LIB_POSTFIX "_2013")
ELSEIF(MSVC11)
SET(C4D_LIB_POSTFIX "_2012")
ELSEIF(MSVC10)
SET(C4D_LIB_POSTFIX "_2010md")
ELSEIF(MSVC90)
SET(C4D_LIB_POSTFIX "_2008md")
SET(C4D_LIB_POSTFIX "_2010")
ELSE()
MESSAGE( FATAL_ERROR
"C4D is currently only supported with MSVC 9, 10, 11"
MESSAGE( FATAL_ERROR
"C4D is currently only supported with MSVC 10, 11, 12, 14"
)
ENDIF()
IF(CMAKE_CL_64)
SET(C4D_LIB_ARCH_POSTFIX "_x64")
ELSE()
SET(C4D_LIB_ARCH_POSTFIX "")
ENDIF()
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/lib/WIN")
SET(C4D_DEBUG_LIBRARY "${C4D_LIB_BASE_PATH}/debug/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
SET(C4D_RELEASE_LIBRARY "${C4D_LIB_BASE_PATH}/release/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/libraries/win")
SET(C4D_DEBUG_LIBRARIES
"${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_debug.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_debug.lib"
)
SET(C4D_RELEASE_LIBRARIES
"${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_release.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_release.lib"
)
# winsock and winmm are necessary dependencies of melange (this is undocumented, but true.)
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
ELSE ()
MESSAGE( FATAL_ERROR
MESSAGE( FATAL_ERROR
"C4D is currently only available on Windows with melange SDK installed in contrib/Melange"
)
ENDIF ( MSVC )
else (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ADD_SUBDIRECTORY( code/ )
option ( ASSIMP_BUILD_ASSIMP_TOOLS
"If the supplementary tools for Assimp are built in addition to the library."
ON
)
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
IF ( WIN32 AND DirectX_FOUND )
ADD_SUBDIRECTORY( tools/assimp_view/ )
ENDIF ( WIN32 AND DirectX_FOUND )
IF ( WIN32 )
option ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
ADD_SUBDIRECTORY( tools/assimp_view/ )
ENDIF ( ASSIMP_BUILD_ASSIMP_VIEW )
ENDIF ( WIN32 )
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
@@ -272,7 +305,7 @@ IF ( ASSIMP_BUILD_SAMPLES)
ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
ENDIF ( ASSIMP_BUILD_SAMPLES )
option ( ASSIMP_BUILD_TESTS
OPTION ( ASSIMP_BUILD_TESTS
"If the test suite for Assimp is built in addition to the library."
ON
)
@@ -282,7 +315,7 @@ IF ( ASSIMP_BUILD_TESTS )
ENDIF ( ASSIMP_BUILD_TESTS )
IF(MSVC)
option ( ASSIMP_INSTALL_PDB
OPTION ( ASSIMP_INSTALL_PDB
"Install MSVC debug files."
ON
)
@@ -292,51 +325,79 @@ ENDIF(MSVC)
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
if(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
# Packing information
set(CPACK_PACKAGE_NAME "assimp{ASSIMP_VERSION_MAJOR}")
set(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.")
set(CPACK_PACKAGE_VENDOR "http://assimp.sourceforge.net/")
set(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library ${ASSIMP_VERSION}")
set(CPACK_PACKAGE_VERSION "${ASSIMP_VERSION}.${ASSIMP_PACKAGE_VERSION}" )
set(CPACK_PACKAGE_VERSION_MAJOR "${ASSIMP_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${ASSIMP_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${ASSIMP_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "assimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_NAME "assimp{ASSIMP_VERSION_MAJOR}")
SET(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.")
SET(CPACK_PACKAGE_VENDOR "https://github.com/assimp")
SET(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library ${ASSIMP_VERSION}")
SET(CPACK_PACKAGE_VERSION "${ASSIMP_VERSION}.${ASSIMP_PACKAGE_VERSION}" )
SET(CPACK_PACKAGE_VERSION_MAJOR "${ASSIMP_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${ASSIMP_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${ASSIMP_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "assimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
string(TOUPPER ${LIBASSIMP_COMPONENT} "LIBASSIMP_COMPONENT_UPPER")
string(TOUPPER ${LIBASSIMP-DEV_COMPONENT} "LIBASSIMP-DEV_COMPONENT_UPPER")
set(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools")
set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS "${LIBASSIMP_COMPONENT}" )
set(CPACK_COMPONENT_${LIBASSIMP_COMPONENT_UPPER}_DISPLAY_NAME "libraries")
set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DISPLAY_NAME "common headers and installs")
set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" )
set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" )
set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" )
set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake libboost-dev libboost-thread-dev libboost-math-dev zlib1g-dev pkg-config)
SET(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools")
SET(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS "${LIBASSIMP_COMPONENT}" )
SET(CPACK_COMPONENT_${LIBASSIMP_COMPONENT_UPPER}_DISPLAY_NAME "libraries")
SET(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DISPLAY_NAME "common headers and installs")
SET(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" )
SET(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" )
SET(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" )
SET(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake zlib1g-dev pkg-config)
# debian
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_CMAKE_OPTIONS "-DBUILD_ASSIMP_SAMPLES:BOOL=${ASSIMP_BUILD_SAMPLES}")
set(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
set(CPACK_DEBIAN_PACKAGE_SUGGESTS)
set(CPACK_DEBIAN_PACKAGE_NAME "assimp")
set(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/cppunit-1.12.1 contrib/cppunit_note.txt contrib/zlib workspaces test doc obj samples packaging)
set(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
set(CPACK_DEBIAN_CHANGELOG)
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_CMAKE_OPTIONS "-DBUILD_ASSIMP_SAMPLES:BOOL=${ASSIMP_BUILD_SAMPLES}")
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS)
SET(CPACK_DEBIAN_PACKAGE_NAME "assimp")
SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/cppunit-1.12.1 contrib/cppunit_note.txt contrib/zlib workspaces test doc obj samples packaging)
SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
SET(CPACK_DEBIAN_CHANGELOG)
execute_process(COMMAND lsb_release -is
OUTPUT_VARIABLE _lsb_distribution OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _lsb_release_failed)
set(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton")
string(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME)
if( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" )
set(CPACK_DEBIAN_DISTRIBUTION_RELEASES lucid maverick natty oneiric precise CACHE STRING "Release code-names of the distrubiton release")
endif()
set(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources")
SET(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton")
STRING(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME)
IF( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" )
SET(CPACK_DEBIAN_DISTRIBUTION_RELEASES lucid maverick natty oneiric precise CACHE STRING "Release code-names of the distrubiton release")
ENDIF()
SET(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources")
include(CPack)
include(DebSourcePPA)
endif()
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(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)
ENDIF (WIN32)

View File

@@ -30,7 +30,7 @@ Ogre Loader, VC2010 fixes and CMake fixes.
- Sebastian Hempel,
PyAssimp (first version)
Compile-Bugfixes for mingw, add enviroment for static library support in make.
Compile-Bugfixes for mingw, add environment for static library support in make.
- Jonathan Pokrass
Supplied a bugfix concerning the scaling in the md3 loader.
@@ -114,7 +114,7 @@ Contributes a fix for the configure script environment.
Contributed AssimpDelphi (/port/AssimpDelphi).
- rdb
Contributes a bundle of fixes and improvments for the bsp-importer.
Contributes a bundle of fixes and improvements for the bsp-importer.
- Mick P
For contributing the De-bone postprocessing step and filing various bug reports.

30
LICENSE
View File

@@ -1,10 +1,10 @@
Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
@@ -21,16 +21,16 @@ following conditions are met:
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -41,9 +41,9 @@ AN EXCEPTION applies to all files in the ./test/models-nonbsd folder.
These are 3d models for testing purposes, from various free sources
on the internet. They are - unless otherwise stated - copyright of
their respective creators, which may impose additional requirements
on the use of their work. For any of these models, see
on the use of their work. For any of these models, see
<model-name>.source.txt for more legal information. Contact us if you
are a copyright holder and believe that we credited you inproperly or
are a copyright holder and believe that we credited you inproperly or
if you don't want your files to appear in the repository.
@@ -76,9 +76,3 @@ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,7 +1,5 @@
Open Asset Import Library (assimp)
========
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
Open Asset Import Library (assimp)
==================================
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.
@@ -16,7 +14,8 @@ Coverity<a href="https://scan.coverity.com/projects/5607">
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/5607/badge.svg"/>
</a>
Gitter [![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>
__[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.__
#### Supported file formats ####
@@ -28,28 +27,28 @@ __Importers__:
- BLEND (Blender)
- DAE/Collada
- FBX
- IFC-STEP
- IFC-STEP
- ASE
- DXF
- HMP
- MD2
- MD3
- MD3
- MD5
- MDC
- MDL
- NFF
- PLY
- STL
- X
- X
- OBJ
- OpenGEX
- SMD
- LWO
- LXO
- LWO
- LXO
- LWS
- TER
- AC3D
- MS3D
- TER
- AC3D
- MS3D
- COB
- Q3BSP
- XGL
@@ -61,7 +60,9 @@ __Importers__:
- Ogre XML
- Q3D
- ASSBIN (Assimp custom format)
- glTF (partial)
- 3MF
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)
@@ -76,16 +77,19 @@ __Exporters__:
- 3DS
- JSON (for WebGl, via https://github.com/acgessler/assimp2json)
- ASSBIN
- STEP
- glTF (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.
### Ports ###
* [Android](port/AndroidJNI/README.md)
* [Python](port/PyAssimp/README.md)
* [.NET](port/AssimpNET/Readme.md)
* [Pascal](port/AssimpPascal/Readme.md)
#### Repository structure ####
Open Asset Import Library is implemented in C++. The directory structure is:
/code Source code
@@ -96,39 +100,40 @@ Open Asset Import Library is implemented in C++. The directory structure is:
/port Ports to other languages and scripts to maintain those.
/test Unit- and regression tests, test suite of models
/tools Tools (old assimp viewer, command line `assimp`)
/samples A small number of samples to illustrate possible
/samples A small number of samples to illustrate possible
use cases for Assimp
/workspaces Build enviroments for vc,xcode,... (deprecated,
/workspaces Build environments for vc,xcode,... (deprecated,
CMake has superseeded all legacy build options!)
### Where to get help ###
For more information, visit [our website](http://assimp.sourceforge.net/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
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
### Contributing ###
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
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 ###
If you like assimp, consider buying us a beer (or two):
[Donate](http://sourceforge.net/donate/index.php?group_id=226462)
### License ###
Our license is based on the modified, __3-clause BSD__-License.
Our license is based on the modified, __3-clause BSD__-License.
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you may link statically to Assimp.
For the legal details, see the `LICENSE` file.
For the legal details, see the `LICENSE` file.
### Why this name ###
Sorry, we're germans :-), no english native speakers ...

View File

@@ -10,12 +10,31 @@ branches:
only:
- master
platform: x64
configuration: Release
platform:
- x86
- x64
build:
configuration:
- 14 2015
- 12 2013
#- MinGW
#- 10 2010 # only works for x86
init:
- if "%platform%" EQU "x64" ( for %%a in (2008 2010 MinGW) do ( if "%Configuration%"=="%%a" (echo "Skipping unsupported configuration" && exit /b 1 ) ) )
install:
# Make compiler command line tools available
- call c:\projects\assimp\scripts\appveyor\compiler_setup.bat
build_script:
- cd c:\projects\assimp
- cmake CMakeLists.txt -G "Visual Studio 11"
- cmake CMakeLists.txt -G "Visual Studio %Configuration%"
- msbuild /m /p:Configuration=Release /p:Platform="Win32" Assimp.sln
after_build:
- 7z a assimp.7z c:\projects\assimp\bin\release\* c:\projects\assimp\lib\release\*
artifacts:
- path: assimp.7z
name: assimp_lib

View File

@@ -29,8 +29,10 @@ if( MSVC )
set(MSVC_PREFIX "vc110")
elseif( MSVC12 )
set(MSVC_PREFIX "vc120")
elseif( MSVC14 )
set(MSVC_PREFIX "vc140")
else()
set(MSVC_PREFIX "vc130")
set(MSVC_PREFIX "vc150")
endif()
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE)
else()
@@ -62,7 +64,7 @@ set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@CMAKE_DEBUG_POSTFIX@)
# the boost version assimp was compiled with
set( ASSIMP_Boost_VERSION "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@")
# for compatibility wiht pkg-config
# for compatibility with pkg-config
set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}")
set(ASSIMP_LDFLAGS_OTHER "${ASSIMP_LINK_FLAGS}")

View File

@@ -10,6 +10,9 @@ endif()
if (MSVC)
set(RELEASE_LIB_DIR ReleaseLibs)
set(DEBUG_LIB_DIR DebugLibs)
elseif(XCODE_VERSION)
set(RELEASE_LIB_DIR Release)
set(DEBUG_LIB_DIR Debug)
else()
set(RELEASE_LIB_DIR "")
set(DEBUG_LIB_DIR "")
@@ -18,7 +21,8 @@ endif()
set(GTEST_CMAKE_ARGS
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-Dgtest_force_shared_crt=ON"
"-Dgtest_disable_pthreads:BOOL=${DISABLE_PTHREADS}")
"-Dgtest_disable_pthreads:BOOL=${DISABLE_PTHREADS}"
"-DBUILD_GTEST=ON")
set(GTEST_RELEASE_LIB_DIR "")
set(GTEST_DEBUGLIB_DIR "")
if (MSVC)
@@ -38,7 +42,7 @@ else(NOT GIT_FOUND)
set(AddGTest_FOUND true CACHE BOOL "Was gtest setup correctly?")
ExternalProject_Add(gtest
GIT_REPOSITORY https://chromium.googlesource.com/external/googletest
GIT_REPOSITORY https://github.com/google/googletest.git
TIMEOUT 10
PREFIX "${GTEST_PREFIX}"
CMAKE_ARGS "${GTEST_CMAKE_ARGS}"
@@ -53,10 +57,10 @@ else(NOT GIT_FOUND)
set(LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(GTEST_LOCATION "${GTEST_PREFIX}/src/gtest-build")
set(GTEST_DEBUG_LIBRARIES
"${GTEST_LOCATION}/${DEBUG_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}")
SET(GTEST_RELEASE_LIBRARIES
"${GTEST_LOCATION}/${RELEASE_LIB_DIR}/${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${LIB_PREFIX}gtest${LIB_SUFFIX}"
"${CMAKE_THREAD_LIBS_INIT}")
if(MSVC_VERSION EQUAL 1700)
@@ -64,9 +68,11 @@ else(NOT GIT_FOUND)
endif()
ExternalProject_Get_Property(gtest source_dir)
include_directories(${source_dir}/include)
include_directories(${source_dir}/googletest/include)
include_directories(${source_dir}/gtest/include)
ExternalProject_Get_Property(gtest binary_dir)
link_directories(${binary_dir})
link_directories(${binary_dir}/googlemock/gtest)
link_directories(${binary_dir}/googlemock/gtest/${RELEASE_LIB_DIR})
link_directories(${binary_dir}/googlemock/gtest/${DEBUG_LIB_DIR})
endif(NOT GIT_FOUND)

View File

@@ -85,7 +85,7 @@ macro(get_debug_names PREFIX)
endforeach(i)
endmacro(get_debug_names)
# Add the parent dir from DIR to VAR
# Add the parent dir from DIR to VAR
macro(add_parent_dir VAR DIR)
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
@@ -127,6 +127,7 @@ MACRO(findpkg_framework fwk)
/System/Library/Frameworks
/Network/Library/Frameworks
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
)
FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
SET(fwkpath ${dir}/${fwk}.framework)

View File

@@ -1,25 +1,81 @@
FIND_PATH(
assimp_INCLUDE_DIRS
NAMES postprocess.h scene.h version.h config.h cimport.h
PATHS /usr/local/include/
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ASSIMP_ARCHITECTURE "64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ASSIMP_ARCHITECTURE "32")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(WIN32)
set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory")
FIND_LIBRARY(
assimp_LIBRARIES
NAMES assimp
PATHS /usr/local/lib/
)
# Find path of each library
find_path(ASSIMP_INCLUDE_DIR
NAMES
assimp/anim.h
HINTS
${ASSIMP_ROOT_DIR}/include
)
IF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
SET(assimp_FOUND TRUE)
ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
if(MSVC12)
set(ASSIMP_MSVC_VERSION "vc120")
elseif(MSVC14)
set(ASSIMP_MSVC_VERSION "vc140")
endif(MSVC12)
if(MSVC12 OR MSVC14)
find_path(ASSIMP_LIBRARY_DIR
NAMES
assimp-${ASSIMP_MSVC_VERSION}-mt.lib
HINTS
${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}
)
find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib PATHS ${ASSIMP_LIBRARY_DIR})
find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib PATHS ${ASSIMP_LIBRARY_DIR})
set(ASSIMP_LIBRARY
optimized ${ASSIMP_LIBRARY_RELEASE}
debug ${ASSIMP_LIBRARY_DEBUG}
)
set(ASSIMP_LIBRARIES "ASSIMP_LIBRARY_RELEASE" "ASSIMP_LIBRARY_DEBUG")
FUNCTION(ASSIMP_COPY_BINARIES TargetDirectory)
ADD_CUSTOM_TARGET(AssimpCopyBinaries
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll
COMMENT "Copying Assimp binaries to '${TargetDirectory}'"
VERBATIM)
ENDFUNCTION(ASSIMP_COPY_BINARIES)
endif()
else(WIN32)
IF (assimp_FOUND)
IF (NOT assimp_FIND_QUIETLY)
MESSAGE(STATUS "Found asset importer library: ${assimp_LIBRARIES}")
ENDIF (NOT assimp_FIND_QUIETLY)
ELSE (assimp_FOUND)
IF (assimp_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find asset importer library")
ENDIF (assimp_FIND_REQUIRED)
ENDIF (assimp_FOUND)
find_path(
assimp_INCLUDE_DIRS
NAMES postprocess.h scene.h version.h config.h cimport.h
PATHS /usr/local/include/
)
find_library(
assimp_LIBRARIES
NAMES assimp
PATHS /usr/local/lib/
)
if (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
SET(assimp_FOUND TRUE)
ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
if (assimp_FOUND)
if (NOT assimp_FIND_QUIETLY)
message(STATUS "Found asset importer library: ${assimp_LIBRARIES}")
endif (NOT assimp_FIND_QUIETLY)
else (assimp_FOUND)
if (assimp_FIND_REQUIRED)
message(FATAL_ERROR "Could not find asset importer library")
endif (assimp_FIND_REQUIRED)
endif (assimp_FOUND)
endif(WIN32)

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -47,10 +47,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers
#include "3DSLoader.h"
#include "TargetAnimation.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include "StringComparison.h"
#include <boost/scoped_array.hpp>
#include <memory>
#include <cctype>
using namespace Assimp;
@@ -70,8 +70,9 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
{
std::string s = mScene->mMaterials[i].mName;
for (std::string::iterator it = s.begin(); it != s.end(); ++it)
*it = ::tolower(*it);
for ( std::string::iterator it = s.begin(); it != s.end(); ++it ) {
*it = static_cast< char >( ::tolower( *it ) );
}
if (std::string::npos == s.find("default"))continue;
@@ -358,7 +359,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene* pcOut)
// we need to split all meshes by their materials
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(); i != mScene->mMeshes.end();++i) {
boost::scoped_array< std::vector<unsigned int> > aiSplit(new std::vector<unsigned int>[mScene->mMaterials.size()]);
std::unique_ptr< std::vector<unsigned int>[] > aiSplit(new std::vector<unsigned int>[mScene->mMaterials.size()]);
name.length = ASSIMP_itoa10(name.data,num++);
@@ -663,14 +664,14 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
nda->mRotationKeys = new aiQuatKey[nda->mNumRotationKeys];
// Rotations are quaternion offsets
aiQuaternion abs;
aiQuaternion abs1;
for (unsigned int n = 0; n < nda->mNumRotationKeys;++n)
{
const aiQuatKey& q = pcIn->aRotationKeys[n];
abs = (n ? abs * q.mValue : q.mValue);
abs1 = (n ? abs1 * q.mValue : q.mValue);
nda->mRotationKeys[n].mTime = q.mTime;
nda->mRotationKeys[n].mValue = abs.Normalize();
nda->mRotationKeys[n].mValue = abs1.Normalize();
}
}
@@ -757,7 +758,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
pcNode->mNumMeshes = 1;
// Build a name for the node
pcNode->mName.length = sprintf(pcNode->mName.data,"3DSMesh_%u",i);
pcNode->mName.length = ai_snprintf(pcNode->mName.data, MAXLEN, "3DSMesh_%u",i);
}
// Build dummy nodes for all cameras

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SceneCombiner.h"
#include "SplitLargeMeshes.h"
#include "StringComparison.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Exporter.hpp"
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Exporter.hpp>
#include <memory>
using namespace Assimp;
@@ -150,7 +150,7 @@ namespace {
// Worker function for exporting a scene to 3DS. Prototyped and registered in Exporter.cpp
void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
{
boost::shared_ptr<IOStream> outfile (pIOSystem->Open(pFile, "wb"));
std::shared_ptr<IOStream> outfile (pIOSystem->Open(pFile, "wb"));
if(!outfile) {
throw DeadlyExportError("Could not open output .3ds file: " + std::string(pFile));
}
@@ -164,7 +164,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen
// in |Exporter::ExportFormatEntry|.
aiScene* scenecopy_tmp;
SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
std::auto_ptr<aiScene> scenecopy(scenecopy_tmp);
std::unique_ptr<aiScene> scenecopy(scenecopy_tmp);
SplitLargeMeshesProcess_Triangle tri_splitter;
tri_splitter.SetLimit(0xffff);
@@ -181,7 +181,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen
} // end of namespace Assimp
// ------------------------------------------------------------------------------------------------
Discreet3DSExporter:: Discreet3DSExporter(boost::shared_ptr<IOStream> outfile, const aiScene* scene)
Discreet3DSExporter:: Discreet3DSExporter(std::shared_ptr<IOStream> outfile, const aiScene* scene)
: scene(scene)
, writer(outfile)
{

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_3DSEXPORTER_H_INC
#include <map>
#include <boost/shared_ptr.hpp>
#include <memory>
#include "StreamWriter.h"
#include "./../include/assimp/material.h"
@@ -64,7 +64,7 @@ namespace Assimp
class Discreet3DSExporter
{
public:
Discreet3DSExporter(boost::shared_ptr<IOStream> outfile, const aiScene* pScene);
Discreet3DSExporter(std::shared_ptr<IOStream> outfile, const aiScene* pScene);
private:

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SpatialSort.h"
#include "SmoothingGroups.h"
#include "StringUtils.h"
#include "qnan.h"
#include "./../include/assimp/material.h"
#include "./../include/assimp/camera.h"
@@ -379,7 +380,7 @@ struct Material
static int iCnt = 0;
char szTemp[128];
sprintf(szTemp,"UNNAMED_%i",iCnt++);
ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
}
@@ -435,7 +436,7 @@ struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
// Generate a default name for the mesh
char szTemp[128];
::sprintf(szTemp,"UNNAMED_%i",iCnt++);
ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
}
@@ -484,18 +485,18 @@ struct aiFloatKey
/** Helper structure to represent a 3ds file node */
struct Node
{
Node()
: mParent()
, mInstanceNumber()
, mHierarchyPos (0)
, mHierarchyIndex (0)
, mInstanceCount (1)
Node():
mParent(NULL)
, mInstanceNumber(0)
, mHierarchyPos (0)
, mHierarchyIndex (0)
, mInstanceCount (1)
{
static int iCnt = 0;
// Generate a default name for the node
char szTemp[128];
::sprintf(szTemp,"UNNAMED_%i",iCnt++);
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
aRotationKeys.reserve (20);

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -51,9 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers
#include "3DSLoader.h"
#include "Macros.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include "StringComparison.h"
using namespace Assimp;
@@ -86,8 +86,8 @@ static const aiImporterDesc desc = {
int chunkSize = chunk.Size-sizeof(Discreet3DS::Chunk); \
if(chunkSize <= 0) \
continue; \
const int oldReadLimit = stream->GetReadLimit(); \
stream->SetReadLimit(stream->GetCurrentPos() + chunkSize); \
const unsigned int oldReadLimit = stream->SetReadLimit( \
stream->GetCurrentPos() + chunkSize); \
// ------------------------------------------------------------------------------------------------
@@ -186,18 +186,17 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
// internal verbose representation. Finally compute normal
// vectors from the smoothing groups we read from the
// file.
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(),
end = mScene->mMeshes.end(); i != end;++i) {
if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0) {
for (auto &mesh : mScene->mMeshes) {
if (mesh.mFaces.size() > 0 && mesh.mPositions.size() == 0) {
delete mScene;
throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile);
}
CheckIndices(*i);
MakeUnique (*i);
ComputeNormalsWithSmoothingsGroups<D3DS::Face>(*i);
CheckIndices(mesh);
MakeUnique (mesh);
ComputeNormalsWithSmoothingsGroups<D3DS::Face>(mesh);
}
// Replace all occurences of the default material with a
// Replace all occurrences of the default material with a
// valid material. Generate it if no material containing
// DEFAULT in its name has been found in the file
ReplaceDefaultMaterial();

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_3DSIMPORTER_H_INC
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER

View File

@@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -53,14 +53,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Subdivision.h"
#include "Importer.h"
#include "BaseImporter.h"
#include "../include/assimp/Importer.hpp"
#include "../include/assimp/light.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/material.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/config.h"
#include "../include/assimp/IOSystem.hpp"
#include <boost/scoped_ptr.hpp>
#include <assimp/Importer.hpp>
#include <assimp/light.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/material.h>
#include <assimp/scene.h>
#include <assimp/config.h>
#include <assimp/IOSystem.hpp>
#include <memory>
using namespace Assimp;
@@ -211,7 +211,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
// Generate a default name for both the light source and the node
// FIXME - what's the right way to print a size_t? Is 'zu' universally available? stick with the safe version.
light->mName.length = ::sprintf(light->mName.data,"ACLight_%i",static_cast<unsigned int>(mLights->size())-1);
light->mName.length = ::ai_snprintf(light->mName.data, MAXLEN, "ACLight_%i",static_cast<unsigned int>(mLights->size())-1);
obj.name = std::string( light->mName.data );
DefaultLogger::get()->debug("AC3D: Light source encountered");
@@ -708,7 +708,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
// collect all meshes using the same material group.
if (object.subDiv) {
if (configEvalSubdivision) {
boost::scoped_ptr<Subdivider> div(Subdivider::Create(Subdivider::CATMULL_CLARKE));
std::unique_ptr<Subdivider> div(Subdivider::Create(Subdivider::CATMULL_CLARKE));
DefaultLogger::get()->info("AC3D: Evaluating subdivision surface: "+object.name);
std::vector<aiMesh*> cpy(meshes.size()-oldm,NULL);
@@ -733,18 +733,18 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
switch (object.type)
{
case Object::Group:
node->mName.length = ::sprintf(node->mName.data,"ACGroup_%i",groups++);
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACGroup_%i",groups++);
break;
case Object::Poly:
node->mName.length = ::sprintf(node->mName.data,"ACPoly_%i",polys++);
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACPoly_%i",polys++);
break;
case Object::Light:
node->mName.length = ::sprintf(node->mName.data,"ACLight_%i",lights++);
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACLight_%i",lights++);
break;
// there shouldn't be more than one world, but we don't care
case Object::World:
node->mName.length = ::sprintf(node->mName.data,"ACWorld_%i",worlds++);
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACWorld_%i",worlds++);
break;
}
}
@@ -787,7 +787,7 @@ void AC3DImporter::SetupProperties(const Importer* pImp)
void AC3DImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file
if( file.get() == NULL)
@@ -884,7 +884,7 @@ void AC3DImporter::InternReadFile( const std::string& pFile,
// copy meshes
if (meshes.empty())
{
throw DeadlyImportError("An unknown error occured during converting");
throw DeadlyImportError("An unknown error occurred during converting");
}
pScene->mNumMeshes = (unsigned int)meshes.size();
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
struct aiNode;
struct aiMesh;

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -50,12 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StringComparison.h"
#include "SkeletonMeshBuilder.h"
#include "TargetAnimation.h"
#include "../include/assimp/Importer.hpp"
#include <boost/scoped_ptr.hpp>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/Importer.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include <memory>
// utilities
#include "fast_atof.h"
@@ -130,7 +130,7 @@ void ASEImporter::SetupProperties(const Importer* pImp)
void ASEImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file
if( file.get() == NULL) {
@@ -225,17 +225,13 @@ void ASEImporter::InternReadFile( const std::string& pFile,
+ mParser->m_vCameras.size() + mParser->m_vDummies.size());
// Lights
for (std::vector<ASE::Light>::iterator it = mParser->m_vLights.begin(),
end = mParser->m_vLights.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &light : mParser->m_vLights)nodes.push_back(&light);
// Cameras
for (std::vector<ASE::Camera>::iterator it = mParser->m_vCameras.begin(),
end = mParser->m_vCameras.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &camera : mParser->m_vCameras)nodes.push_back(&camera);
// Meshes
for (std::vector<ASE::Mesh>::iterator it = mParser->m_vMeshes.begin(),
end = mParser->m_vMeshes.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &mesh : mParser->m_vMeshes)nodes.push_back(&mesh);
// Dummies
for (std::vector<ASE::Dummy>::iterator it = mParser->m_vDummies.begin(),
end = mParser->m_vDummies.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &dummy : mParser->m_vDummies)nodes.push_back(&dummy);
// build the final node graph
BuildNodes(nodes);
@@ -657,8 +653,8 @@ void ASEImporter::BuildNodes(std::vector<BaseNode*>& nodes) {
ch->mParent = root;
// Change the transformation matrix of all nodes
for (std::vector<BaseNode*>::iterator it = nodes.begin(), end = nodes.end();it != end; ++it) {
aiMatrix4x4& m = (*it)->mTransform;
for (BaseNode *node : nodes) {
aiMatrix4x4& m = node->mTransform;
m.Transpose(); // row-order vs column-order
}

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_ASELOADER_H_INCLUDED
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
struct aiNode;
#include "ASEParser.h"

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ASELoader.h"
#include "MaterialSystem.h"
#include "fast_atof.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;
using namespace Assimp::ASE;
@@ -143,9 +143,9 @@ void Parser::LogWarning(const char* szWarn)
char szTemp[1024];
#if _MSC_VER >= 1400
sprintf_s(szTemp,"Line %u: %s",iLineNumber,szWarn);
sprintf_s(szTemp, "Line %u: %s",iLineNumber,szWarn);
#else
snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
ai_snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
#endif
// output the warning to the logger ...
@@ -161,7 +161,7 @@ void Parser::LogInfo(const char* szWarn)
#if _MSC_VER >= 1400
sprintf_s(szTemp,"Line %u: %s",iLineNumber,szWarn);
#else
snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
ai_snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
#endif
// output the information to the logger ...
@@ -177,7 +177,7 @@ AI_WONT_RETURN void Parser::LogError(const char* szWarn)
#if _MSC_VER >= 1400
sprintf_s(szTemp,"Line %u: %s",iLineNumber,szWarn);
#else
snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
ai_snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
#endif
// throw an exception
@@ -825,7 +825,7 @@ bool Parser::ParseString(std::string& out,const char* szName)
if (!SkipSpaces(&filePtr))
{
sprintf(szBuffer,"Unable to parse %s block: Unexpected EOL",szName);
ai_snprintf(szBuffer, 1024, "Unable to parse %s block: Unexpected EOL",szName);
LogWarning(szBuffer);
return false;
}
@@ -833,7 +833,7 @@ bool Parser::ParseString(std::string& out,const char* szName)
if ('\"' != *filePtr)
{
sprintf(szBuffer,"Unable to parse %s block: Strings are expected "
ai_snprintf(szBuffer, 1024, "Unable to parse %s block: Strings are expected "
"to be enclosed in double quotation marks",szName);
LogWarning(szBuffer);
return false;
@@ -845,7 +845,7 @@ bool Parser::ParseString(std::string& out,const char* szName)
if ('\"' == *sz)break;
else if ('\0' == *sz)
{
sprintf(szBuffer,"Unable to parse %s block: Strings are expected to "
ai_snprintf(szBuffer, 1024, "Unable to parse %s block: Strings are expected to "
"be enclosed in double quotation marks but EOF was reached before "
"a closing quotation mark was encountered",szName);
LogWarning(szBuffer);
@@ -1134,7 +1134,7 @@ void Parser::ParseLV3ScaleAnimationBlock(ASE::Animation& anim)
bool b = false;
// For the moment we're just reading the three floats -
// we ignore the ádditional information for bezier's and TCBs
// we ignore the <EFBFBD>dditional information for bezier's and TCBs
// simple scaling keyframe
if (TokenMatch(filePtr,"CONTROL_SCALE_SAMPLE" ,20))
@@ -1180,7 +1180,7 @@ void Parser::ParseLV3PosAnimationBlock(ASE::Animation& anim)
bool b = false;
// For the moment we're just reading the three floats -
// we ignore the ádditional information for bezier's and TCBs
// we ignore the <EFBFBD>dditional information for bezier's and TCBs
// simple scaling keyframe
if (TokenMatch(filePtr,"CONTROL_POS_SAMPLE" ,18))
@@ -1226,7 +1226,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim)
bool b = false;
// For the moment we're just reading the floats -
// we ignore the ádditional information for bezier's and TCBs
// we ignore the <EFBFBD>dditional information for bezier's and TCBs
// simple scaling keyframe
if (TokenMatch(filePtr,"CONTROL_ROT_SAMPLE" ,18))

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -43,15 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_ASEFILEHELPER_H_INC
#define AI_ASEFILEHELPER_H_INC
// STL/CRT headers
#include <string>
#include <vector>
#include <list>
// public ASSIMP headers
#include "../include/assimp/types.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/anim.h"
#include <assimp/types.h>
#include <assimp/mesh.h>
#include <assimp/anim.h>
// for some helper routines like IsSpace()
#include "ParsingUtils.h"
@@ -133,7 +128,7 @@ struct Bone
// Generate a default name for the bone
char szTemp[128];
::sprintf(szTemp,"UNNAMED_%i",iCnt++);
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
}
@@ -223,7 +218,7 @@ struct BaseNode
// generate a default name for the node
static int iCnt = 0;
char szTemp[128]; // should be sufficiently large
::sprintf(szTemp,"UNNAMED_%i",iCnt++);
::ai_snprintf(szTemp, 128, "UNNAMED_%i",iCnt++);
mName = szTemp;
// Set mTargetPosition to qnan
@@ -609,7 +604,7 @@ private:
//! \param out Output string
//! \param szName Name of the enclosing element -> used in error
//! messages.
//! \return false if an error occured
//! \return false if an error occurred
bool ParseString(std::string& out,const char* szName);
public:

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -41,13 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ASSBIN exporter main code
*/
#include "assbin_chunks.h"
#include "../include/assimp/version.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include <assimp/version.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#include "ProcessHelper.h"
#include "Exceptional.h"
#include <boost/static_assert.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h>
@@ -103,7 +102,7 @@ inline size_t Write<unsigned int>(IOStream * stream, const unsigned int& w)
template <>
inline size_t Write<uint16_t>(IOStream * stream, const uint16_t& w)
{
BOOST_STATIC_ASSERT(sizeof(uint16_t)==2);
static_assert(sizeof(uint16_t)==2, "sizeof(uint16_t)==2");
stream->Write(&w,2,1);
return 2;
}
@@ -113,7 +112,7 @@ inline size_t Write<uint16_t>(IOStream * stream, const uint16_t& w)
template <>
inline size_t Write<float>(IOStream * stream, const float& f)
{
BOOST_STATIC_ASSERT(sizeof(float)==4);
static_assert(sizeof(float)==4, "sizeof(float)==4");
stream->Write(&f,4,1);
return 4;
}
@@ -123,7 +122,7 @@ inline size_t Write<float>(IOStream * stream, const float& f)
template <>
inline size_t Write<double>(IOStream * stream, const double& f)
{
BOOST_STATIC_ASSERT(sizeof(double)==8);
static_assert(sizeof(double)==8, "sizeof(double)==8");
stream->Write(&f,8,1);
return 8;
}
@@ -472,7 +471,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
uint32_t tmp = f.mNumIndices;
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
for (unsigned int i = 0; i < f.mNumIndices; ++i) {
BOOST_STATIC_ASSERT(AI_MAX_VERTICES <= 0xffffffff);
static_assert(AI_MAX_VERTICES <= 0xffffffff, "AI_MAX_VERTICES <= 0xffffffff");
tmp = static_cast<uint32_t>( f.mIndices[i] );
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
}
@@ -486,7 +485,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
const aiFace& f = mesh->mFaces[i];
BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff);
static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
Write<uint16_t>(&chunk,f.mNumIndices);
for (unsigned int a = 0; a < f.mNumIndices;++a) {
@@ -702,7 +701,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
#if _MSC_VER >= 1400
sprintf_s(s,"ASSIMP.binary-dump.%s",asctime(p));
#else
snprintf(s,64,"ASSIMP.binary-dump.%s",asctime(p));
ai_snprintf(s,64,"ASSIMP.binary-dump.%s",asctime(p));
#endif
out->Write( s, 44, 1 );
// == 44 bytes

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -51,15 +51,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AssbinLoader.h"
#include "assbin_chunks.h"
#include "MemoryIOWrapper.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include <boost/static_assert.hpp>
#include <assimp/mesh.h>
#include <assimp/anim.h>
#include <assimp/scene.h>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h>
#else
# include "../contrib/zlib/zlib.h"
# include <contrib/zlib/zlib.h>
#endif
using namespace Assimp;
@@ -351,7 +350,7 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
aiFace& f = mesh->mFaces[i];
BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff);
static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
f.mNumIndices = Read<uint16_t>(stream);
f.mIndices = new unsigned int[f.mNumIndices];

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_ASSBINIMPORTER_H_INC
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
struct aiMesh;
struct aiNode;

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -59,8 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ------------------------------------------------------------------------------------------------
#ifndef ASSIMP_BUILD_SINGLETHREADED
# include <boost/thread/thread.hpp>
# include <boost/thread/mutex.hpp>
# include <thread>
# include <mutex>
#endif
// ------------------------------------------------------------------------------------------------
using namespace Assimp;
@@ -96,12 +96,14 @@ namespace Assimp
/** will return all registered importers. */
void GetImporterInstanceList(std::vector< BaseImporter* >& out);
/** will delete all registered importers. */
void DeleteImporterInstanceList(std::vector< BaseImporter* >& out);
} // namespace assimp
#ifndef ASSIMP_BUILD_SINGLETHREADED
/** Global mutex to manage the access to the logstream map */
static boost::mutex gLogStreamMutex;
/** Global mutex to manage the access to the log-stream map */
static std::mutex gLogStreamMutex;
#endif
@@ -117,7 +119,7 @@ public:
~LogToCallbackRedirector() {
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
std::lock_guard<std::mutex> lock(gLogStreamMutex);
#endif
// (HACK) Check whether the 'stream.user' pointer points to a
// custom LogStream allocated by #aiGetPredefinedLogStream.
@@ -228,7 +230,8 @@ const aiScene* aiImportFileFromMemoryWithProperties(
const char* pHint,
const aiPropertyStore* props)
{
ai_assert(NULL != pBuffer && 0 != pLength);
ai_assert( NULL != pBuffer );
ai_assert( 0 != pLength );
const aiScene* scene = NULL;
ASSIMP_BEGIN_EXCEPTION_REGION();
@@ -317,10 +320,38 @@ ASSIMP_API const aiScene* aiApplyPostProcessing(const aiScene* pScene,
return sc;
}
// ------------------------------------------------------------------------------------------------
ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene,
BaseProcess* process,
bool requestValidation ) {
const aiScene* sc( NULL );
ASSIMP_BEGIN_EXCEPTION_REGION();
// find the importer associated with this data
const ScenePrivateData* priv = ScenePriv( scene );
if ( NULL == priv || NULL == priv->mOrigImporter ) {
ReportSceneNotFoundError();
return NULL;
}
sc = priv->mOrigImporter->ApplyCustomizedPostProcessing( process, requestValidation );
if ( !sc ) {
aiReleaseImport( scene );
return NULL;
}
ASSIMP_END_EXCEPTION_REGION( const aiScene* );
return sc;
}
// ------------------------------------------------------------------------------------------------
void CallbackToLogRedirector (const char* msg, char* dt)
{
ai_assert(NULL != msg && NULL != dt);
ai_assert( NULL != msg );
ai_assert( NULL != dt );
LogStream* s = (LogStream*)dt;
s->write(msg);
@@ -352,7 +383,7 @@ ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
std::lock_guard<std::mutex> lock(gLogStreamMutex);
#endif
LogStream* lg = new LogToCallbackRedirector(*stream);
@@ -371,9 +402,9 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
std::lock_guard<std::mutex> lock(gLogStreamMutex);
#endif
// find the logstream associated with this data
// find the log-stream associated with this data
LogStreamMap::iterator it = gActiveLogStreams.find( *stream);
// it should be there... else the user is playing fools with us
if( it == gActiveLogStreams.end()) {
@@ -396,14 +427,20 @@ ASSIMP_API void aiDetachAllLogStreams(void)
{
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
std::lock_guard<std::mutex> lock(gLogStreamMutex);
#endif
Logger *logger( DefaultLogger::get() );
if ( NULL == logger ) {
return;
}
for (LogStreamMap::iterator it = gActiveLogStreams.begin(); it != gActiveLogStreams.end(); ++it) {
DefaultLogger::get()->detatchStream( it->second );
logger->detatchStream( it->second );
delete it->second;
}
gActiveLogStreams.clear();
DefaultLogger::kill();
ASSIMP_END_EXCEPTION_REGION(void);
}
@@ -437,7 +474,6 @@ size_t aiGetImportFormatCount(void)
return Importer().GetImporterCount();
}
// ------------------------------------------------------------------------------------------------
// Returns the error text of the last failed import process.
aiBool aiIsExtensionSupported(const char* szExtension)
@@ -492,7 +528,6 @@ ASSIMP_API aiPropertyStore* aiCreatePropertyStore(void)
return reinterpret_cast<aiPropertyStore*>( new PropertyMap() );
}
// ------------------------------------------------------------------------------------------------
ASSIMP_API void aiReleasePropertyStore(aiPropertyStore* p)
{
@@ -551,7 +586,8 @@ ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName
// Rotation matrix to quaternion
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
{
ai_assert(NULL != quat && NULL != mat);
ai_assert( NULL != quat );
ai_assert( NULL != mat );
*quat = aiQuaternion(*mat);
}
@@ -561,7 +597,10 @@ ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat,aiVector3D* scaling,
aiQuaternion* rotation,
aiVector3D* position)
{
ai_assert(NULL != rotation && NULL != position && NULL != scaling && NULL != mat);
ai_assert( NULL != rotation );
ai_assert( NULL != position );
ai_assert( NULL != scaling );
ai_assert( NULL != mat );
mat->Decompose(*scaling,*rotation,*position);
}
@@ -585,7 +624,8 @@ ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
const aiMatrix3x3* mat)
{
ai_assert(NULL != mat && NULL != vec);
ai_assert( NULL != mat );
ai_assert( NULL != vec);
*vec *= (*mat);
}
@@ -593,7 +633,9 @@ ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
const aiMatrix4x4* mat)
{
ai_assert(NULL != mat && NULL != vec);
ai_assert( NULL != mat );
ai_assert( NULL != vec );
*vec *= (*mat);
}
@@ -603,7 +645,8 @@ ASSIMP_API void aiMultiplyMatrix4(
aiMatrix4x4* dst,
const aiMatrix4x4* src)
{
ai_assert(NULL != dst && NULL != src);
ai_assert( NULL != dst );
ai_assert( NULL != src );
*dst = (*dst) * (*src);
}
@@ -612,7 +655,8 @@ ASSIMP_API void aiMultiplyMatrix3(
aiMatrix3x3* dst,
const aiMatrix3x3* src)
{
ai_assert(NULL != dst && NULL != src);
ai_assert( NULL != dst );
ai_assert( NULL != src );
*dst = (*dst) * (*src);
}
@@ -648,6 +692,8 @@ ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extensi
}
}
DeleteImporterInstanceList(out);
return desc;
}

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -47,7 +47,7 @@ Assimp C export interface. See Exporter.cpp for some notes.
#include "CInterfaceIOWrapper.h"
#include "SceneCombiner.h"
#include "ScenePrivate.h"
#include "../include/assimp/Exporter.hpp"
#include <assimp/Exporter.hpp>
using namespace Assimp;
@@ -59,13 +59,38 @@ ASSIMP_API size_t aiGetExportFormatCount(void)
// ------------------------------------------------------------------------------------------------
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex)
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index)
{
// Note: this is valid as the index always pertains to a builtin exporter,
// Note: this is valid as the index always pertains to a built-in exporter,
// for which the returned structure is guaranteed to be of static storage duration.
return Exporter().GetExportFormatDescription(pIndex);
Exporter exporter;
const aiExportFormatDesc* orig( exporter.GetExportFormatDescription( index ) );
if (NULL == orig) {
return NULL;
}
aiExportFormatDesc *desc = new aiExportFormatDesc;
desc->description = new char[ strlen( orig->description ) + 1 ];
::strncpy( (char*) desc->description, orig->description, strlen( orig->description ) );
desc->fileExtension = new char[ strlen( orig->fileExtension ) + 1 ];
::strncpy( ( char* ) desc->fileExtension, orig->fileExtension, strlen( orig->fileExtension ) );
desc->id = new char[ strlen( orig->id ) + 1 ];
::strncpy( ( char* ) desc->id, orig->id, strlen( orig->id ) );
return desc;
}
// ------------------------------------------------------------------------------------------------
ASSIMP_API void aiReleaseExportFormatDescription( const aiExportFormatDesc *desc ) {
if (NULL == desc) {
return;
}
delete [] desc->description;
delete [] desc->fileExtension;
delete [] desc->id;
delete desc;
}
// ------------------------------------------------------------------------------------------------
ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -43,14 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include "./../include/assimp/version.h"
#include "ProcessHelper.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h>
#else
# include "../contrib/zlib/zlib.h"
# include <contrib/zlib/zlib.h>
#endif
#include <time.h>
@@ -65,13 +65,21 @@ namespace Assimp {
namespace AssxmlExport {
int ioprintf( IOStream * io, const char * format, ... )
{
char sz[4096];
// -----------------------------------------------------------------------------------
static int ioprintf( IOStream * io, const char *format, ... ) {
using namespace std;
if ( nullptr == io ) {
return -1;
}
static const size_t Size = 4096;
char sz[ Size ];
size_t len( strlen( format ) );
::memset( sz, '\0', Size );
va_list va;
va_start( va, format );
int nSize = vsnprintf( sz, 4096, format, va );
ai_assert( nSize < 4096 );
int nSize = vsnprintf( sz, Size-1, format, va );
ai_assert( nSize < Size );
va_end( va );
io->Write( sz, sizeof(char), nSize );
@@ -81,8 +89,7 @@ int ioprintf( IOStream * io, const char * format, ... )
// -----------------------------------------------------------------------------------
// Convert a name to standard XML format
void ConvertName(aiString& out, const aiString& in)
{
static void ConvertName(aiString& out, const aiString& in) {
out.length = 0;
for (unsigned int i = 0; i < in.length; ++i) {
switch (in.data[i]) {
@@ -105,8 +112,7 @@ void ConvertName(aiString& out, const aiString& in)
// -----------------------------------------------------------------------------------
// Write a single node as text dump
void WriteNode(const aiNode* node, IOStream * io, unsigned int depth)
{
static void WriteNode(const aiNode* node, IOStream * io, unsigned int depth) {
char prefix[512];
for (unsigned int i = 0; i < depth;++i)
prefix[i] = '\t';
@@ -156,47 +162,46 @@ void WriteNode(const aiNode* node, IOStream * io, unsigned int depth)
// Some chuncks of text will need to be encoded for XML
// http://stackoverflow.com/questions/5665231/most-efficient-way-to-escape-xml-html-in-c-string#5665377
static std::string encodeXML(const std::string& data) {
std::string buffer;
buffer.reserve(data.size());
for(size_t pos = 0; pos != data.size(); ++pos) {
switch(data[pos]) {
case '&': buffer.append("&amp;"); break;
case '\"': buffer.append("&quot;"); break;
case '\'': buffer.append("&apos;"); break;
case '<': buffer.append("&lt;"); break;
case '>': buffer.append("&gt;"); break;
default: buffer.append(&data[pos], 1); break;
}
}
return buffer;
std::string buffer;
buffer.reserve(data.size());
for(size_t pos = 0; pos != data.size(); ++pos) {
switch(data[pos]) {
case '&': buffer.append("&amp;"); break;
case '\"': buffer.append("&quot;"); break;
case '\'': buffer.append("&apos;"); break;
case '<': buffer.append("&lt;"); break;
case '>': buffer.append("&gt;"); break;
default: buffer.append(&data[pos], 1); break;
}
}
return buffer;
}
// -----------------------------------------------------------------------------------
// Write a text model dump
void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
{
time_t tt = ::time(NULL);
tm* p = ::gmtime(&tt);
aiString name;
static
void WriteDump(const aiScene* scene, IOStream* io, bool shortened) {
time_t tt = ::time( NULL );
tm* p = ::gmtime( &tt );
ai_assert( nullptr != p );
// write header
ioprintf(io,
std::string header(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<ASSIMP format_id=\"1\">\n\n"
"<!-- XML Model dump produced by assimp dump\n"
" Library version: %i.%i.%i\n"
" %s\n"
"-->"
" \n\n"
"<Scene flags=\"%i\" postprocessing=\"%i\">\n",
"<Scene flags=\"%d\" postprocessing=\"%i\">\n"
);
aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),asctime(p),
scene->mFlags,
0 /*globalImporter->GetEffectivePostProcessing()*/);
const unsigned int majorVersion( aiGetVersionMajor() );
const unsigned int minorVersion( aiGetVersionMinor() );
const unsigned int rev( aiGetVersionRevision() );
const char *curtime( asctime( p ) );
ioprintf( io, header.c_str(), majorVersion, minorVersion, rev, curtime, scene->mFlags, 0 );
// write the node graph
WriteNode(scene->mRootNode, io, 0);
@@ -266,6 +271,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
ioprintf(io,"\t</Light>\n");
}
#endif
aiString name;
// write textures
if (scene->mNumTextures) {
@@ -301,9 +307,10 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
unsigned int r = tx->r,g=tx->g,b=tx->b,a=tx->a;
ioprintf(io,"\t\t\t%2x %2x %2x %2x",r,g,b,a);
// group by four for readibility
if (0 == (x+y*tex->mWidth) % 4)
ioprintf(io,"\n");
// group by four for readability
if ( 0 == ( x + y*tex->mWidth ) % 4 ) {
ioprintf( io, "\n" );
}
}
}
}

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -3,12 +3,12 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
@@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
@@ -50,11 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "B3DImporter.h"
#include "TextureTransform.h"
#include "ConvertToLHProcess.h"
#include <boost/scoped_ptr.hpp>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "StringUtils.h"
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/anim.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;
@@ -70,11 +71,11 @@ static const aiImporterDesc desc = {
0,
0,
0,
"b3d"
"b3d"
};
// (fixme, Aramis) quick workaround to get rid of all those signed to unsigned warnings
#ifdef _MSC_VER
#ifdef _MSC_VER
# pragma warning (disable: 4018)
#endif
@@ -113,7 +114,7 @@ void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
cout<<"Hello world from the B3DImporter!"<<endl;
#endif
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
// Check whether we can read from the file
if( file.get() == NULL)
@@ -279,12 +280,12 @@ void B3DImporter::ReadBRUS(){
aiMaterial *mat=new aiMaterial;
_materials.push_back( mat );
// Name
aiString ainame( name );
mat->AddProperty( &ainame,AI_MATKEY_NAME );
// Diffuse color
// Diffuse color
mat->AddProperty( &color,1,AI_MATKEY_COLOR_DIFFUSE );
// Opacity
@@ -293,16 +294,16 @@ void B3DImporter::ReadBRUS(){
// Specular color
aiColor3D speccolor( shiny,shiny,shiny );
mat->AddProperty( &speccolor,1,AI_MATKEY_COLOR_SPECULAR );
// Specular power
float specpow=shiny*128;
mat->AddProperty( &specpow,1,AI_MATKEY_SHININESS );
// Double sided
if( fx & 0x10 ){
int i=1;
int i=1;
mat->AddProperty( &i,1,AI_MATKEY_TWOSIDED );
}
}
//Textures
for( int i=0;i<n_texs;++i ){
@@ -568,10 +569,10 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
string t=ReadChunk();
if( t=="BB3D" ){
int version=ReadInt();
if (!DefaultLogger::isNullLogger()) {
char dmp[128];
sprintf(dmp,"B3D file format version: %i",version);
ai_snprintf(dmp, 128, "B3D file format version: %i",version);
DefaultLogger::get()->info(dmp);
}
@@ -668,7 +669,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
}
scene->mNumMaterials=_materials.size();
scene->mMaterials=to_array( _materials );
//meshes
scene->mNumMeshes=_meshes.size();
scene->mMeshes=to_array( _meshes );

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -43,9 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_B3DIMPORTER_H_INC
#define AI_B3DIMPORTER_H_INC
#include "../include/assimp/types.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include <assimp/types.h>
#include <assimp/mesh.h>
#include <assimp/material.h>
#include "BaseImporter.h"
#include <string>

View File

@@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -46,13 +46,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BVHLoader.h"
#include "fast_atof.h"
#include "SkeletonMeshBuilder.h"
#include "../include/assimp/Importer.hpp"
#include <boost/scoped_ptr.hpp>
#include <boost/format.hpp>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include <assimp/Importer.hpp>
#include <memory>
#include "TinyFormatter.h"
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
using namespace Assimp;
using namespace Assimp::Formatter;
static const aiImporterDesc desc = {
"BVH Importer (MoCap)",
@@ -118,7 +119,7 @@ void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSys
mFileName = pFile;
// read file into memory
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
if( file.get() == NULL)
throw DeadlyImportError( "Failed to open file " + pFile + ".");
@@ -179,12 +180,12 @@ aiNode* BVHLoader::ReadNode()
// first token is name
std::string nodeName = GetNextToken();
if( nodeName.empty() || nodeName == "{")
ThrowException( boost::str( boost::format( "Expected node name, but found \"%s\".") % nodeName));
ThrowException( format() << "Expected node name, but found \"" << nodeName << "\"." );
// then an opening brace should follow
std::string openBrace = GetNextToken();
if( openBrace != "{")
ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace));
ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\"." );
// Create a node
aiNode* node = new aiNode( nodeName);
@@ -216,7 +217,7 @@ aiNode* BVHLoader::ReadNode()
// The real symbol is "End Site". Second part comes in a separate token
std::string siteToken = GetNextToken();
if( siteToken != "Site")
ThrowException( boost::str( boost::format( "Expected \"End Site\" keyword, but found \"%s %s\".") % token % siteToken));
ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." );
aiNode* child = ReadEndSite( nodeName);
child->mParent = node;
@@ -229,7 +230,7 @@ aiNode* BVHLoader::ReadNode()
} else
{
// everything else is a parse error
ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token));
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
}
}
@@ -252,7 +253,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
// check opening brace
std::string openBrace = GetNextToken();
if( openBrace != "{")
ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace));
ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\".");
// Create a node
aiNode* node = new aiNode( "EndSite_" + pParentName);
@@ -274,7 +275,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
} else
{
// everything else is a parse error
ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token));
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
}
}
@@ -321,7 +322,7 @@ void BVHLoader::ReadNodeChannels( BVHLoader::Node& pNode)
else if( channelToken == "Zrotation")
pNode.mChannels.push_back( Channel_RotationZ);
else
ThrowException( boost::str( boost::format( "Invalid channel specifier \"%s\".") % channelToken));
ThrowException( format() << "Invalid channel specifier \"" << channelToken << "\"." );
}
}
@@ -332,7 +333,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
// Read number of frames
std::string tokenFrames = GetNextToken();
if( tokenFrames != "Frames:")
ThrowException( boost::str( boost::format( "Expected frame count \"Frames:\", but found \"%s\".") % tokenFrames));
ThrowException( format() << "Expected frame count \"Frames:\", but found \"" << tokenFrames << "\".");
float numFramesFloat = GetNextTokenAsFloat();
mAnimNumFrames = (unsigned int) numFramesFloat;
@@ -341,7 +342,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
std::string tokenDuration1 = GetNextToken();
std::string tokenDuration2 = GetNextToken();
if( tokenDuration1 != "Frame" || tokenDuration2 != "Time:")
ThrowException( boost::str( boost::format( "Expected frame duration \"Frame Time:\", but found \"%s %s\".") % tokenDuration1 % tokenDuration2));
ThrowException( format() << "Expected frame duration \"Frame Time:\", but found \"" << tokenDuration1 << " " << tokenDuration2 << "\"." );
mAnimTickDuration = GetNextTokenAsFloat();
@@ -368,7 +369,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
// Retrieves the next token
std::string BVHLoader::GetNextToken()
{
// skip any preceeding whitespace
// skip any preceding whitespace
while( mReader != mBuffer.end())
{
if( !isspace( *mReader))
@@ -414,7 +415,7 @@ float BVHLoader::GetNextTokenAsFloat()
ctoken = fast_atoreal_move<float>( ctoken, result);
if( ctoken != token.c_str() + token.length())
ThrowException( boost::str( boost::format( "Expected a floating point number, but found \"%s\".") % token));
ThrowException( format() << "Expected a floating point number, but found \"" << token << "\"." );
return result;
}
@@ -423,7 +424,7 @@ float BVHLoader::GetNextTokenAsFloat()
// Aborts the file reading with an exception
AI_WONT_RETURN void BVHLoader::ThrowException( const std::string& pError)
{
throw DeadlyImportError( boost::str( boost::format( "%s:%d - %s") % mFileName % mLine % pError));
throw DeadlyImportError( format() << mFileName << ":" << mLine << " - " << pError);
}
// ------------------------------------------------------------------------------------------------

View File

@@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -47,13 +47,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FileSystemFilter.h"
#include "Importer.h"
#include "ByteSwapper.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/Importer.hpp"
#include "../include/assimp/postprocess.h"
#include <assimp/scene.h>
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <ios>
#include <list>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <memory>
#include <sstream>
#include <cctype>
@@ -149,10 +148,10 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
if (!pIOHandler)
return false;
boost::scoped_ptr<IOStream> pStream (pIOHandler->Open(pFile));
std::unique_ptr<IOStream> pStream (pIOHandler->Open(pFile));
if (pStream.get() ) {
// read 200 characters from the file
boost::scoped_array<char> _buffer (new char[searchBytes+1 /* for the '\0' */]);
std::unique_ptr<char[]> _buffer (new char[searchBytes+1 /* for the '\0' */]);
char* buffer = _buffer.get();
if( NULL == buffer ) {
return false;
@@ -256,7 +255,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
const uint32_t* magic_u32;
};
magic = reinterpret_cast<const char*>(_magic);
boost::scoped_ptr<IOStream> pStream (pIOHandler->Open(pFile));
std::unique_ptr<IOStream> pStream (pIOHandler->Open(pFile));
if (pStream.get() ) {
// skip to offset
@@ -336,7 +335,7 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 32 BE with BOM
if(*((uint32_t*)&data.front()) == 0xFFFE0000) {
// swap the endianess ..
// swap the endianness ..
for(uint32_t* p = (uint32_t*)&data.front(), *end = (uint32_t*)&data.back(); p <= end; ++p) {
AI_SWAP4P(p);
}
@@ -367,7 +366,7 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 16 BE with BOM
if(*((uint16_t*)&data.front()) == 0xFFFE) {
// swap the endianess ..
// swap the endianness ..
for(uint16_t* p = (uint16_t*)&data.front(), *end = (uint16_t*)&data.back(); p <= end; ++p) {
ByteSwap::Swap2(p);
}
@@ -435,22 +434,27 @@ void BaseImporter::ConvertUTF8toISO8859_1(std::string& data)
// ------------------------------------------------------------------------------------------------
void BaseImporter::TextFileToBuffer(IOStream* stream,
std::vector<char>& data)
std::vector<char>& data,
TextFileMode mode)
{
ai_assert(NULL != stream);
const size_t fileSize = stream->FileSize();
if(!fileSize) {
throw DeadlyImportError("File is empty");
if (mode == FORBID_EMPTY) {
if(!fileSize) {
throw DeadlyImportError("File is empty");
}
}
data.reserve(fileSize+1);
data.resize(fileSize);
if(fileSize != stream->Read( &data[0], 1, fileSize)) {
throw DeadlyImportError("File read error");
}
if(fileSize > 0) {
if(fileSize != stream->Read( &data[0], 1, fileSize)) {
throw DeadlyImportError("File read error");
}
ConvertToUTF8(data);
ConvertToUTF8(data);
}
// append a binary zero to simplify string parsing
data.push_back(0);
@@ -529,7 +533,7 @@ BatchLoader::~BatchLoader()
delete (*it).scene;
}
data->pImporter->SetIOHandler(NULL); /* get pointer back into our posession */
data->pImporter->SetIOHandler(NULL); /* get pointer back into our possession */
delete data->pImporter;
delete data;
}

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <vector>
#include <set>
#include "../include/assimp/types.h"
#include "../include/assimp/ProgressHandler.hpp"
#include <assimp/types.h>
#include <assimp/ProgressHandler.hpp>
struct aiScene;
@@ -176,8 +176,8 @@ public:
);
// -------------------------------------------------------------------
/** Returns the error description of the last error that occured.
* @return A description of the last error that occured. An empty
/** Returns the error description of the last error that occurred.
* @return A description of the last error that occurred. An empty
* string if there was no error.
*/
const std::string& GetErrorText() const {
@@ -347,6 +347,8 @@ public: // static utilities
static void ConvertUTF8toISO8859_1(
std::string& data);
enum TextFileMode { ALLOW_EMPTY, FORBID_EMPTY };
// -------------------------------------------------------------------
/** Utility for text file loaders which copies the contents of the
* file into a memory buffer and converts it to our UTF8
@@ -354,10 +356,33 @@ public: // static utilities
* @param stream Stream to read from.
* @param data Output buffer to be resized and filled with the
* converted text file data. The buffer is terminated with
* a binary 0. */
* a binary 0.
* @param mode Whether it is OK to load empty text files. */
static void TextFileToBuffer(
IOStream* stream,
std::vector<char>& data);
std::vector<char>& data,
TextFileMode mode = FORBID_EMPTY);
// -------------------------------------------------------------------
/** Utility function to move a std::vector into a aiScene array
* @param vec The vector to be moved
* @param out The output pointer to the allocated array.
* @param numOut The output count of elements copied. */
template<typename T>
AI_FORCE_INLINE
static void CopyVector(
std::vector<T>& vec,
T*& out,
unsigned int& outLength)
{
outLength = unsigned(vec.size());
if (outLength) {
out = new T[outLength];
std::swap_ranges(vec.begin(), vec.end(), out);
}
}
protected:

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseImporter.h"
#include "BaseProcess.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include "Importer.h"
using namespace Assimp;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include "../include/assimp/types.h"
#include <assimp/types.h>
#include "GenericProperty.h"
struct aiScene;

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Bitmap.h"
#include "../include/assimp/texture.h"
#include "../include/assimp/IOStream.hpp"
#include <assimp/texture.h>
#include <assimp/IOStream.hpp>
#include "ByteSwapper.h"
namespace Assimp {
@@ -84,7 +84,12 @@ namespace Assimp {
template<typename T>
inline std::size_t Copy(uint8_t* data, T& field) {
#ifdef AI_BUILD_BIG_ENDIAN
T field_swapped=AI_BE(field);
std::memcpy(data, &field_swapped, sizeof(field)); return sizeof(field);
#else
std::memcpy(data, &AI_BE(field), sizeof(field)); return sizeof(field);
#endif
}
void Bitmap::WriteHeader(Header& header, IOStream* file) {

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -48,13 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderDNA.h"
#include "StreamReader.h"
#include "fast_atof.h"
#include <boost/foreach.hpp>
using namespace Assimp;
using namespace Assimp::Blender;
using namespace Assimp::Formatter;
#define for_each BOOST_FOREACH
bool match4(StreamReaderAny& stream, const char* string) {
char tmp[] = {
(stream).GetI1(),
@@ -86,7 +84,7 @@ void DNAParser :: Parse ()
}
std::vector<std::string> names (stream.GetI4());
for_each(std::string& s, names) {
for(std::string& s : names) {
while (char c = stream.GetI1()) {
s += c;
}
@@ -99,7 +97,7 @@ void DNAParser :: Parse ()
}
std::vector<Type> types (stream.GetI4());
for_each(Type& s, types) {
for(Type& s : types) {
while (char c = stream.GetI1()) {
s.name += c;
}
@@ -111,7 +109,7 @@ void DNAParser :: Parse ()
throw DeadlyImportError("BlenderDNA: Expected TLEN field");
}
for_each(Type& s, types) {
for(Type& s : types) {
s.size = stream.GetI2();
}
@@ -238,13 +236,15 @@ void DNA :: DumpToFile()
f << "Field format: type name offset size" << "\n";
f << "Structure format: name size" << "\n";
for_each(const Structure& s, structures) {
for(const Structure& s : structures) {
f << s.name << " " << s.size << "\n\n";
for_each(const Field& ff, s.fields) {
f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << std::endl;
for(const Field& ff : s.fields) {
f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << "\n";
}
f << std::endl;
f << "\n";
}
f << std::flush;
DefaultLogger::get()->info("BlenderDNA: Dumped dna to dna.txt");
}
#endif
@@ -270,17 +270,17 @@ void DNA :: DumpToFile()
}
// ------------------------------------------------------------------------------------------------
boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
std::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
const Structure& structure,
const FileDatabase& db
) const
{
std::map<std::string, FactoryPair >::const_iterator it = converters.find(structure.name);
if (it == converters.end()) {
return boost::shared_ptr< ElemBase >();
return std::shared_ptr< ElemBase >();
}
boost::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))();
std::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))();
(structure.*((*it).second.second))(ret,db);
return ret;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseImporter.h"
#include "TinyFormatter.h"
#include "StreamReader.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/DefaultLogger.hpp>
#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include <memory>
// enable verbose log output. really verbose, so be careful.
@@ -97,7 +97,7 @@ struct ElemBase
* string points is the `c_str` of the `name` attribute of the
* corresponding `Structure`, that is, it is only valid as long
* as the DNA is not modified. The dna_type is only set if the
* data type is not static, i.e. a boost::shared_ptr<ElemBase>
* data type is not static, i.e. a std::shared_ptr<ElemBase>
* in the scene description would have its type resolved
* at runtime, so this member is always set. */
const char* dna_type;
@@ -127,7 +127,7 @@ struct FileOffset
// -------------------------------------------------------------------------------
/** Dummy derivate of std::vector to be able to use it in templates simultaenously
* with boost::shared_ptr, which takes only one template argument
* with std::shared_ptr, which takes only one template argument
* while std::vector takes three. Also we need to provide some special member
* functions of shared_ptr */
// -------------------------------------------------------------------------------
@@ -209,7 +209,7 @@ class Structure
public:
Structure()
: cache_idx(-1)
: cache_idx(static_cast<size_t>(-1) )
{}
public:
@@ -260,11 +260,11 @@ public:
// --------------------------------------------------------
// generic converter
template <typename T>
void Convert(boost::shared_ptr<ElemBase> in,const FileDatabase& db) const;
void Convert(std::shared_ptr<ElemBase> in,const FileDatabase& db) const;
// --------------------------------------------------------
// generic allocator
template <typename T> boost::shared_ptr<ElemBase> Allocate() const;
template <typename T> std::shared_ptr<ElemBase> Allocate() const;
@@ -282,7 +282,7 @@ public:
// --------------------------------------------------------
// field parsing for pointer or dynamic array types
// (boost::shared_ptr or boost::shared_array)
// (std::shared_ptr)
// The return value indicates whether the data was already cached.
template <int error_policy, template <typename> class TOUT, typename T>
bool ReadFieldPtr(TOUT<T>& out, const char* name,
@@ -291,7 +291,7 @@ public:
// --------------------------------------------------------
// field parsing for static arrays of pointer or dynamic
// array types (boost::shared_ptr[] or boost::shared_array[])
// array types (std::shared_ptr[])
// The return value indicates whether the data was already cached.
template <int error_policy, template <typename> class TOUT, typename T, size_t N>
bool ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
@@ -318,7 +318,7 @@ private:
const FileDatabase& db, const Field& f, bool) const;
// --------------------------------------------------------
bool ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval,
bool ResolvePointer( std::shared_ptr< FileOffset >& out, const Pointer & ptrval,
const FileDatabase& db, const Field& f, bool) const;
// --------------------------------------------------------
@@ -329,8 +329,8 @@ private:
private:
// ------------------------------------------------------------------------------
template <typename T> T* _allocate(boost::shared_ptr<T>& out, size_t& s) const {
out = boost::shared_ptr<T>(new T());
template <typename T> T* _allocate(std::shared_ptr<T>& out, size_t& s) const {
out = std::shared_ptr<T>(new T());
s = 1;
return out.get();
}
@@ -394,7 +394,7 @@ template <> struct Structure :: _defaultInitializer<ErrorPolicy_Fail> {
};
// -------------------------------------------------------------------------------------------------------
template <> inline bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
template <> inline bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(std::shared_ptr<ElemBase>& out,
const Pointer & ptrval,
const FileDatabase& db,
const Field& f,
@@ -413,11 +413,11 @@ class DNA
public:
typedef void (Structure::*ConvertProcPtr) (
boost::shared_ptr<ElemBase> in,
std::shared_ptr<ElemBase> in,
const FileDatabase&
) const;
typedef boost::shared_ptr<ElemBase> (
typedef std::shared_ptr<ElemBase> (
Structure::*AllocProcPtr) () const;
typedef std::pair< AllocProcPtr, ConvertProcPtr > FactoryPair;
@@ -464,7 +464,7 @@ public:
* @param structure Destination structure definition
* @param db File database.
* @return A null pointer if no appropriate converter is available.*/
boost::shared_ptr< ElemBase > ConvertBlobToStructure(
std::shared_ptr< ElemBase > ConvertBlobToStructure(
const Structure& structure,
const FileDatabase& db
) const;
@@ -724,7 +724,7 @@ public:
bool little;
DNA dna;
boost::shared_ptr< StreamReaderAny > reader;
std::shared_ptr< StreamReaderAny > reader;
vector< FileBlockHead > entries;
public:
@@ -738,7 +738,7 @@ public:
// arrays of objects are never cached because we can't easily
// ensure their proper destruction.
template <typename T>
ObjectCache<boost::shared_ptr>& cache(boost::shared_ptr<T>& /*in*/) const {
ObjectCache<std::shared_ptr>& cache(std::shared_ptr<T>& /*in*/) const {
return _cache;
}
@@ -755,7 +755,7 @@ private:
#endif
mutable ObjectCache<vector> _cacheArrays;
mutable ObjectCache<boost::shared_ptr> _cache;
mutable ObjectCache<std::shared_ptr> _cache;
mutable size_t next_cache_idx;
};

View File

@@ -2,11 +2,11 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
@@ -23,29 +23,29 @@ following conditions are met:
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
/** @file BlenderDNA.inl
* @brief Blender `DNA` (file format specification embedded in
* @brief Blender `DNA` (file format specification embedded in
* blend file itself) loader.
*/
#ifndef INCLUDED_AI_BLEND_DNA_INL
#define INCLUDED_AI_BLEND_DNA_INL
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Assimp {
namespace Blender {
@@ -71,7 +71,7 @@ const Field* Structure :: Get (const std::string& ss) const
}
//--------------------------------------------------------------------------------
const Field& Structure :: operator [] (const size_t i) const
const Field& Structure :: operator [] (const size_t i) const
{
if (i >= fields.size()) {
throw Error((Formatter::format(),
@@ -83,15 +83,15 @@ const Field& Structure :: operator [] (const size_t i) const
}
//--------------------------------------------------------------------------------
template <typename T> boost::shared_ptr<ElemBase> Structure :: Allocate() const
template <typename T> std::shared_ptr<ElemBase> Structure :: Allocate() const
{
return boost::shared_ptr<T>(new T());
return std::shared_ptr<T>(new T());
}
//--------------------------------------------------------------------------------
template <typename T> void Structure :: Convert(
boost::shared_ptr<ElemBase> in,
const FileDatabase& db) const
std::shared_ptr<ElemBase> in,
const FileDatabase& db) const
{
Convert<T> (*static_cast<T*> ( in.get() ),db);
}
@@ -226,7 +226,7 @@ bool Structure :: ReadFieldPtr(TOUT<T>& out, const char* name, const FileDatabas
//--------------------------------------------------------------------------------
template <int error_policy, template <typename> class TOUT, typename T, size_t N>
bool Structure :: ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
bool Structure :: ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
const FileDatabase& db) const
{
// XXX see if we can reduce this to call to the 'normal' ReadFieldPtr
@@ -306,12 +306,12 @@ void Structure :: ReadField(T& out, const char* name, const FileDatabase& db) co
//--------------------------------------------------------------------------------
template <template <typename> class TOUT, typename T>
bool Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const FileDatabase& db,
const Field& f,
bool non_recursive /*= false*/) const
bool Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const FileDatabase& db,
const Field& f,
bool non_recursive /*= false*/) const
{
out.reset(); // ensure null pointers work
if (!ptrval.val) {
if (!ptrval.val) {
return false;
}
const Structure& s = db.dna[f.type];
@@ -328,7 +328,7 @@ bool Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const Fil
}
// try to retrieve the object from the cache
db.cache(out).get(s,out,ptrval);
db.cache(out).get(s,out,ptrval);
if (out) {
return true;
}
@@ -340,11 +340,11 @@ bool Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const Fil
// I really ought to improve StreamReader to work with 64 bit indices exclusively.
// continue conversion after allocating the required storage
size_t num = block->size / ss.size;
size_t num = block->size / ss.size;
T* o = _allocate(out,num);
// cache the object before we convert it to avoid cyclic recursion.
db.cache(out).set(s,out,ptrval);
db.cache(out).set(s,out,ptrval);
// if the non_recursive flag is set, we don't do anything but leave
// the cursor at the correct position to resolve the object.
@@ -366,45 +366,45 @@ bool Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const Fil
//--------------------------------------------------------------------------------
inline bool Structure :: ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval,
const FileDatabase& db,
inline bool Structure :: ResolvePointer( std::shared_ptr< FileOffset >& out, const Pointer & ptrval,
const FileDatabase& db,
const Field&,
bool) const
{
// Currently used exclusively by PackedFile::data to represent
// a simple offset into the mapped BLEND file.
// a simple offset into the mapped BLEND file.
out.reset();
if (!ptrval.val) {
if (!ptrval.val) {
return false;
}
// find the file block the pointer is pointing to
const FileBlockHead* block = LocateFileBlockForAddress(ptrval,db);
out = boost::shared_ptr< FileOffset > (new FileOffset());
out = std::shared_ptr< FileOffset > (new FileOffset());
out->val = block->start+ static_cast<size_t>((ptrval.val - block->address.val) );
return false;
}
//--------------------------------------------------------------------------------
template <template <typename> class TOUT, typename T>
bool Structure :: ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval,
const FileDatabase& db,
bool Structure :: ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval,
const FileDatabase& db,
const Field& f,
bool) const
bool) const
{
// This is a function overload, not a template specialization. According to
// the partial ordering rules, it should be selected by the compiler
// for array-of-pointer inputs, i.e. Object::mats.
out.reset();
if (!ptrval.val) {
if (!ptrval.val) {
return false;
}
// find the file block the pointer is pointing to
const FileBlockHead* block = LocateFileBlockForAddress(ptrval,db);
const size_t num = block->size / (db.i64bit?8:4);
const size_t num = block->size / (db.i64bit?8:4);
// keep the old stream position
const StreamReaderAny::pos pold = db.reader->GetCurrentPos();
@@ -418,7 +418,7 @@ bool Structure :: ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval,
Convert(val,db);
// and resolve the pointees
res = ResolvePointer(out[i],val,db,f) && res;
res = ResolvePointer(out[i],val,db,f) && res;
}
db.reader->SetCurrentPos(pold);
@@ -426,18 +426,18 @@ bool Structure :: ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval,
}
//--------------------------------------------------------------------------------
template <> bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
const Pointer & ptrval,
const FileDatabase& db,
template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(std::shared_ptr<ElemBase>& out,
const Pointer & ptrval,
const FileDatabase& db,
const Field&,
bool
) const
) const
{
// Special case when the data type needs to be determined at runtime.
// Less secure than in the `strongly-typed` case.
out.reset();
if (!ptrval.val) {
if (!ptrval.val) {
return false;
}
@@ -448,7 +448,7 @@ template <> bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::
const Structure& s = db.dna[block->dna_index];
// try to retrieve the object from the cache
db.cache(out).get(s,out,ptrval);
db.cache(out).get(s,out,ptrval);
if (out) {
return true;
}
@@ -473,15 +473,15 @@ template <> bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::
// allocate the object hull
out = (s.*builders.first)();
// cache the object immediately to prevent infinite recursion in a
// cache the object immediately to prevent infinite recursion in a
// circular list with a single element (i.e. a self-referencing element).
db.cache(out).set(s,out,ptrval);
// and do the actual conversion
(s.*builders.second)(out,db);
db.reader->SetCurrentPos(pold);
// store a pointer to the name string of the actual type
// in the object itself. This allows the conversion code
// to perform additional type checking.
@@ -495,10 +495,10 @@ template <> bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::
}
//--------------------------------------------------------------------------------
const FileBlockHead* Structure :: LocateFileBlockForAddress(const Pointer & ptrval, const FileDatabase& db) const
const FileBlockHead* Structure :: LocateFileBlockForAddress(const Pointer & ptrval, const FileDatabase& db) const
{
// the file blocks appear in list sorted by
// with ascending base addresses so we can run a
// with ascending base addresses so we can run a
// binary search to locate the pointee quickly.
// NOTE: Blender seems to distinguish between side-by-side
@@ -525,7 +525,7 @@ const FileBlockHead* Structure :: LocateFileBlockForAddress(const Pointer & ptrv
}
// ------------------------------------------------------------------------------------------------
// NOTE: The MSVC debugger keeps showing up this annoying `a cast to a smaller data type has
// NOTE: The MSVC debugger keeps showing up this annoying `a cast to a smaller data type has
// caused a loss of data`-warning. Avoid this warning by a masking with an appropriate bitmask.
template <typename T> struct signless;
@@ -534,7 +534,7 @@ template <> struct signless<short> {typedef unsigned short type;};
template <> struct signless<int> {typedef unsigned int type;};
template <typename T>
struct static_cast_silent {
struct static_cast_silent {
template <typename V>
T operator()(V in) {
return static_cast<T>(in & static_cast<typename signless<T>::type>(-1));
@@ -554,7 +554,7 @@ template <> struct static_cast_silent<double> {
};
// ------------------------------------------------------------------------------------------------
template <typename T> inline void ConvertDispatcher(T& out, const Structure& in,const FileDatabase& db)
template <typename T> inline void ConvertDispatcher(T& out, const Structure& in,const FileDatabase& db)
{
if (in.name == "int") {
out = static_cast_silent<T>()(db.reader->GetU4());
@@ -677,7 +677,7 @@ const Structure* DNA :: Get (const std::string& ss) const
}
//--------------------------------------------------------------------------------
const Structure& DNA :: operator [] (const size_t i) const
const Structure& DNA :: operator [] (const size_t i) const
{
if (i >= structures.size()) {
throw Error((Formatter::format(),
@@ -690,8 +690,8 @@ const Structure& DNA :: operator [] (const size_t i) const
//--------------------------------------------------------------------------------
template <template <typename> class TOUT> template <typename T> void ObjectCache<TOUT> :: get (
const Structure& s,
TOUT<T>& out,
const Structure& s,
TOUT<T>& out,
const Pointer& ptr
) const {
@@ -703,7 +703,7 @@ template <template <typename> class TOUT> template <typename T> void ObjectCache
typename StructureCache::const_iterator it = caches[s.cache_idx].find(ptr);
if (it != caches[s.cache_idx].end()) {
out = boost::static_pointer_cast<T>( (*it).second );
out = std::static_pointer_cast<T>( (*it).second );
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
++db.stats().cache_hits;
@@ -715,7 +715,7 @@ template <template <typename> class TOUT> template <typename T> void ObjectCache
//--------------------------------------------------------------------------------
template <template <typename> class TOUT> template <typename T> void ObjectCache<TOUT> :: set (
const Structure& s,
const Structure& s,
const TOUT<T>& out,
const Pointer& ptr
) {
@@ -723,7 +723,7 @@ template <template <typename> class TOUT> template <typename T> void ObjectCache
s.cache_idx = db.next_cache_idx++;
caches.resize(db.next_cache_idx);
}
caches[s.cache_idx][ptr] = boost::static_pointer_cast<ElemBase>( out );
caches[s.cache_idx][ptr] = std::static_pointer_cast<ElemBase>( out );
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
++db.stats().cached_objects;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -49,14 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderDNA.h"
#include "BlenderScene.h"
#include "BlenderSceneGen.h"
#include <boost/foreach.hpp>
#include <deque>
#include "./../include/assimp/material.h"
struct aiTexture;
#define for_each(x,y) BOOST_FOREACH(x,y)
namespace Assimp {
namespace Blender {
@@ -71,7 +68,7 @@ namespace Blender {
}
~TempArray () {
for_each(T* elem, arr) {
for(T* elem : arr) {
delete elem;
}
}
@@ -160,7 +157,7 @@ namespace Blender {
TempArray <std::vector, aiTexture> textures;
// set of all materials referenced by at least one mesh in the scene
std::deque< boost::shared_ptr< Material > > materials_raw;
std::deque< std::shared_ptr< Material > > materials_raw;
// counter to name sentinel textures inserted as substitutes for procedural textures.
unsigned int sentinel_cnt;

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -52,7 +52,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderIntermediate.h"
#include "BlenderModifier.h"
#include "BlenderBMesh.h"
#include "../include/assimp/scene.h"
#include "StringUtils.h"
#include <assimp/scene.h>
#include "StringComparison.h"
#include "StreamReader.h"
@@ -163,7 +164,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
#endif
FileDatabase file;
boost::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
if (!stream) {
ThrowException("Could not open file for reading");
}
@@ -189,7 +190,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
stream->Seek(0L,aiOrigin_SET);
boost::shared_ptr<StreamReaderLE> reader = boost::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
// build a zlib stream
z_stream zstream;
@@ -259,9 +260,9 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
}
// ------------------------------------------------------------------------------------------------
void BlenderImporter::ParseBlendFile(FileDatabase& out, boost::shared_ptr<IOStream> stream)
void BlenderImporter::ParseBlendFile(FileDatabase& out, std::shared_ptr<IOStream> stream)
{
out.reader = boost::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little));
out.reader = std::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little));
DNAParser dna_reader(out);
const DNA* dna = NULL;
@@ -304,7 +305,7 @@ void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
const Structure& ss = file.dna.structures[(*it).second];
// we need a scene somewhere to start with.
for_each(const FileBlockHead& bl,file.entries) {
for(const FileBlockHead& bl :file.entries) {
// Fix: using the DNA index is more reliable to locate scenes
//if (bl.id == "SC") {
@@ -341,7 +342,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
// the file. This is terrible. Here, we're first looking for
// all objects which don't have parent objects at all -
std::deque<const Object*> no_parents;
for (boost::shared_ptr<Base> cur = boost::static_pointer_cast<Base> ( in.base.first ); cur; cur = cur->next) {
for (std::shared_ptr<Base> cur = std::static_pointer_cast<Base> ( in.base.first ); cur; cur = cur->next) {
if (cur->object) {
if(!cur->object->parent) {
no_parents.push_back(cur->object.get());
@@ -349,7 +350,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
else conv.objects.insert(cur->object.get());
}
}
for (boost::shared_ptr<Base> cur = in.basact; cur; cur = cur->next) {
for (std::shared_ptr<Base> cur = in.basact; cur; cur = cur->next) {
if (cur->object) {
if(cur->object->parent) {
conv.objects.insert(cur->object.get());
@@ -496,7 +497,7 @@ void BlenderImporter::AddSentinelTexture(aiMaterial* out, const Material* mat, c
(void)mat; (void)tex; (void)conv_data;
aiString name;
name.length = sprintf(name.data, "Procedural,num=%i,type=%s",conv_data.sentinel_cnt++,
name.length = ai_snprintf(name.data, MAXLEN, "Procedural,num=%i,type=%s",conv_data.sentinel_cnt++,
GetTextureTypeDisplayString(tex->tex->type)
);
out->AddProperty(&name,AI_MATKEY_TEXTURE_DIFFUSE(
@@ -553,18 +554,16 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const
}
// ------------------------------------------------------------------------------------------------
void BlenderImporter::BuildMaterials(ConversionData& conv_data)
void BlenderImporter::BuildDefaultMaterial(Blender::ConversionData& conv_data)
{
conv_data.materials->reserve(conv_data.materials_raw.size());
// add a default material if necessary
unsigned int index = static_cast<unsigned int>( -1 );
for_each( aiMesh* mesh, conv_data.meshes.get() ) {
for( aiMesh* mesh : conv_data.meshes.get() ) {
if (mesh->mMaterialIndex == static_cast<unsigned int>( -1 )) {
if (index == static_cast<unsigned int>( -1 )) {
// Setup a default material.
boost::shared_ptr<Material> p(new Material());
std::shared_ptr<Material> p(new Material());
ai_assert(::strlen(AI_DEFAULT_MATERIAL_NAME) < sizeof(p->id.name)-2);
strcpy( p->id.name+2, AI_DEFAULT_MATERIAL_NAME );
@@ -587,8 +586,126 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
mesh->mMaterialIndex = index;
}
}
}
for_each(boost::shared_ptr<Material> mat, conv_data.materials_raw) {
void BlenderImporter::AddBlendParams(aiMaterial* result, const Material* source)
{
aiColor3D diffuseColor(source->r, source->g, source->b);
result->AddProperty(&diffuseColor, 1, "$mat.blend.diffuse.color", 0, 0);
float diffuseIntensity = source->ref;
result->AddProperty(&diffuseIntensity, 1, "$mat.blend.diffuse.intensity", 0, 0);
int diffuseShader = source->diff_shader;
result->AddProperty(&diffuseShader, 1, "$mat.blend.diffuse.shader", 0, 0);
int diffuseRamp = 0;
result->AddProperty(&diffuseRamp, 1, "$mat.blend.diffuse.ramp", 0, 0);
aiColor3D specularColor(source->specr, source->specg, source->specb);
result->AddProperty(&specularColor, 1, "$mat.blend.specular.color", 0, 0);
float specularIntensity = source->spec;
result->AddProperty(&specularIntensity, 1, "$mat.blend.specular.intensity", 0, 0);
int specularShader = source->spec_shader;
result->AddProperty(&specularShader, 1, "$mat.blend.specular.shader", 0, 0);
int specularRamp = 0;
result->AddProperty(&specularRamp, 1, "$mat.blend.specular.ramp", 0, 0);
int specularHardness = source->har;
result->AddProperty(&specularHardness, 1, "$mat.blend.specular.hardness", 0, 0);
int transparencyUse = source->mode & MA_TRANSPARENCY ? 1 : 0;
result->AddProperty(&transparencyUse, 1, "$mat.blend.transparency.use", 0, 0);
int transparencyMethod = source->mode & MA_RAYTRANSP ? 2 : (source->mode & MA_ZTRANSP ? 1 : 0);
result->AddProperty(&transparencyMethod, 1, "$mat.blend.transparency.method", 0, 0);
float transparencyAlpha = source->alpha;
result->AddProperty(&transparencyAlpha, 1, "$mat.blend.transparency.alpha", 0, 0);
float transparencySpecular = source->spectra;
result->AddProperty(&transparencySpecular, 1, "$mat.blend.transparency.specular", 0, 0);
float transparencyFresnel = source->fresnel_tra;
result->AddProperty(&transparencyFresnel, 1, "$mat.blend.transparency.fresnel", 0, 0);
float transparencyBlend = source->fresnel_tra_i;
result->AddProperty(&transparencyBlend, 1, "$mat.blend.transparency.blend", 0, 0);
float transparencyIor = source->ang;
result->AddProperty(&transparencyIor, 1, "$mat.blend.transparency.ior", 0, 0);
float transparencyFilter = source->filter;
result->AddProperty(&transparencyFilter, 1, "$mat.blend.transparency.filter", 0, 0);
float transparencyFalloff = source->tx_falloff;
result->AddProperty(&transparencyFalloff, 1, "$mat.blend.transparency.falloff", 0, 0);
float transparencyLimit = source->tx_limit;
result->AddProperty(&transparencyLimit, 1, "$mat.blend.transparency.limit", 0, 0);
int transparencyDepth = source->ray_depth_tra;
result->AddProperty(&transparencyDepth, 1, "$mat.blend.transparency.depth", 0, 0);
float transparencyGlossAmount = source->gloss_tra;
result->AddProperty(&transparencyGlossAmount, 1, "$mat.blend.transparency.glossAmount", 0, 0);
float transparencyGlossThreshold = source->adapt_thresh_tra;
result->AddProperty(&transparencyGlossThreshold, 1, "$mat.blend.transparency.glossThreshold", 0, 0);
int transparencyGlossSamples = source->samp_gloss_tra;
result->AddProperty(&transparencyGlossSamples, 1, "$mat.blend.transparency.glossSamples", 0, 0);
int mirrorUse = source->mode & MA_RAYMIRROR ? 1 : 0;
result->AddProperty(&mirrorUse, 1, "$mat.blend.mirror.use", 0, 0);
float mirrorReflectivity = source->ray_mirror;
result->AddProperty(&mirrorReflectivity, 1, "$mat.blend.mirror.reflectivity", 0, 0);
aiColor3D mirrorColor(source->mirr, source->mirg, source->mirb);
result->AddProperty(&mirrorColor, 1, "$mat.blend.mirror.color", 0, 0);
float mirrorFresnel = source->fresnel_mir;
result->AddProperty(&mirrorFresnel, 1, "$mat.blend.mirror.fresnel", 0, 0);
float mirrorBlend = source->fresnel_mir_i;
result->AddProperty(&mirrorBlend, 1, "$mat.blend.mirror.blend", 0, 0);
int mirrorDepth = source->ray_depth;
result->AddProperty(&mirrorDepth, 1, "$mat.blend.mirror.depth", 0, 0);
float mirrorMaxDist = source->dist_mir;
result->AddProperty(&mirrorMaxDist, 1, "$mat.blend.mirror.maxDist", 0, 0);
int mirrorFadeTo = source->fadeto_mir;
result->AddProperty(&mirrorFadeTo, 1, "$mat.blend.mirror.fadeTo", 0, 0);
float mirrorGlossAmount = source->gloss_mir;
result->AddProperty(&mirrorGlossAmount, 1, "$mat.blend.mirror.glossAmount", 0, 0);
float mirrorGlossThreshold = source->adapt_thresh_mir;
result->AddProperty(&mirrorGlossThreshold, 1, "$mat.blend.mirror.glossThreshold", 0, 0);
int mirrorGlossSamples = source->samp_gloss_mir;
result->AddProperty(&mirrorGlossSamples, 1, "$mat.blend.mirror.glossSamples", 0, 0);
float mirrorGlossAnisotropic = source->aniso_gloss_mir;
result->AddProperty(&mirrorGlossAnisotropic, 1, "$mat.blend.mirror.glossAnisotropic", 0, 0);
}
void BlenderImporter::BuildMaterials(ConversionData& conv_data)
{
conv_data.materials->reserve(conv_data.materials_raw.size());
BuildDefaultMaterial(conv_data);
for(std::shared_ptr<Material> mat : conv_data.materials_raw) {
// reset per material global counters
for (size_t i = 0; i < sizeof(conv_data.next_texture)/sizeof(conv_data.next_texture[0]);++i) {
@@ -603,7 +720,6 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
aiString name = aiString(mat->id.name+2); // skip over the name prefix 'MA'
mout->AddProperty(&name,AI_MATKEY_NAME);
// basic material colors
aiColor3D col(mat->r,mat->g,mat->b);
if (mat->r || mat->g || mat->b ) {
@@ -630,6 +746,12 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
col = aiColor3D(mat->ambr,mat->ambg,mat->ambb);
mout->AddProperty(&col,1,AI_MATKEY_COLOR_AMBIENT);
// is mirror enabled?
if( mat->mode & MA_RAYMIRROR ) {
const float ray_mirror = mat->ray_mirror;
mout->AddProperty(&ray_mirror,1,AI_MATKEY_REFLECTIVITY);
}
col = aiColor3D(mat->mirr,mat->mirg,mat->mirb);
mout->AddProperty(&col,1,AI_MATKEY_COLOR_REFLECTIVE);
@@ -640,6 +762,8 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
ResolveTexture(mout,mat.get(),mat->mtex[i].get(),conv_data);
}
AddBlendParams(mout, mat.get());
}
}
@@ -715,7 +839,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
temp->reserve(temp->size() + per_mat.size());
std::map<size_t,size_t> mat_num_to_mesh_idx;
for_each(MyPair& it, per_mat) {
for(MyPair& it : per_mat) {
mat_num_to_mesh_idx[it.first] = temp->size();
temp->push_back(new aiMesh());
@@ -742,8 +866,8 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
ThrowException("Material index is out of range");
}
boost::shared_ptr<Material> mat = mesh->mat[it.first];
const std::deque< boost::shared_ptr<Material> >::iterator has = std::find(
std::shared_ptr<Material> mat = mesh->mat[it.first];
const std::deque< std::shared_ptr<Material> >::iterator has = std::find(
conv_data.materials_raw.begin(),
conv_data.materials_raw.end(),mat
);
@@ -1010,13 +1134,19 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
}
// ------------------------------------------------------------------------------------------------
aiCamera* BlenderImporter::ConvertCamera(const Scene& /*in*/, const Object* obj, const Camera* /*camera*/, ConversionData& /*conv_data*/)
aiCamera* BlenderImporter::ConvertCamera(const Scene& /*in*/, const Object* obj, const Camera* cam, ConversionData& /*conv_data*/)
{
ScopeGuard<aiCamera> out(new aiCamera());
out->mName = obj->id.name+2;
out->mPosition = aiVector3D(0.f, 0.f, 0.f);
out->mUp = aiVector3D(0.f, 1.f, 0.f);
out->mLookAt = aiVector3D(0.f, 0.f, -1.f);
if (cam->sensor_x && cam->lens) {
out->mHorizontalFOV = atan2(cam->sensor_x, 2.f * cam->lens);
}
out->mClipPlaneNear = cam->clipsta;
out->mClipPlaneFar = cam->clipend;
return out.dismiss();
}
@@ -1036,7 +1166,24 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* obj, c
// blender orients directional lights as facing toward -z
out->mDirection = aiVector3D(0.f, 0.f, -1.f);
out->mUp = aiVector3D(0.f, 1.f, 0.f);
break;
case Lamp::Type_Area:
out->mType = aiLightSource_AREA;
if (lamp->area_shape == 0) {
out->mSize = aiVector2D(lamp->area_size, lamp->area_size);
}
else {
out->mSize = aiVector2D(lamp->area_size, lamp->area_sizey);
}
// blender orients directional lights as facing toward -z
out->mDirection = aiVector3D(0.f, 0.f, -1.f);
out->mUp = aiVector3D(0.f, 1.f, 0.f);
break;
default:
break;
}
@@ -1144,7 +1291,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
if (children.size()) {
node->mNumChildren = static_cast<unsigned int>(children.size());
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
for_each (const Object* nobj,children) {
for (const Object* nobj :children) {
*nd = ConvertNode(in,nobj,conv_data,node->mTransformation * parentTransform);
(*nd++)->mParent = node;
}

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseImporter.h"
#include "LogAux.h"
#include <boost/shared_ptr.hpp>
#include <memory>
struct aiNode;
struct aiMesh;
@@ -133,7 +133,7 @@ protected:
// --------------------
void ParseBlendFile(Blender::FileDatabase& out,
boost::shared_ptr<IOStream> stream
std::shared_ptr<IOStream> stream
);
// --------------------
@@ -179,9 +179,18 @@ private:
);
// --------------------
void BuildDefaultMaterial(
Blender::ConversionData& conv_data
);
void AddBlendParams(
aiMaterial* result,
const Blender::Material* source
);
void BuildMaterials(
Blender::ConversionData& conv_data
) ;
);
// --------------------
void ResolveTexture(

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -47,10 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderModifier.h"
#include "SceneCombiner.h"
#include "Subdivision.h"
#include "../include/assimp/scene.h"
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/pointer_cast.hpp>
#include <assimp/scene.h>
#include <memory>
#include <functional>
@@ -113,8 +111,8 @@ void BlenderModifierShowcase::ApplyModifiers(aiNode& out, ConversionData& conv_d
// we're allowed to dereference the pointers without risking to crash. We might still be
// invoking UB btw - we're assuming that the ModifierData member of the respective modifier
// structures is at offset sizeof(vftable) with no padding.
const SharedModifierData* cur = boost::static_pointer_cast<const SharedModifierData> ( orig_object.modifiers.first.get() );
for (; cur; cur = boost::static_pointer_cast<const SharedModifierData> ( cur->modifier.next.get() ), ++ful) {
const SharedModifierData* cur = static_cast<const SharedModifierData *> ( orig_object.modifiers.first.get() );
for (; cur; cur = static_cast<const SharedModifierData *> ( cur->modifier.next.get() ), ++ful) {
ai_assert(cur->dna_type);
const Structure* s = conv_data.db.dna.Get( cur->dna_type );
@@ -153,7 +151,7 @@ void BlenderModifierShowcase::ApplyModifiers(aiNode& out, ConversionData& conv_d
BlenderModifier* const modifier = *curmod;
if(modifier->IsActive(dat)) {
modifier->DoIt(out,conv_data,*boost::static_pointer_cast<const ElemBase>(cur),in,orig_object);
modifier->DoIt(out,conv_data,*static_cast<const ElemBase *>(cur),in,orig_object);
cnt++;
curgod = NULL;
@@ -312,11 +310,11 @@ void BlenderModifier_Subdivision :: DoIt(aiNode& out, ConversionData& conv_data
return;
};
boost::scoped_ptr<Subdivider> subd(Subdivider::Create(algo));
std::unique_ptr<Subdivider> subd(Subdivider::Create(algo));
ai_assert(subd);
aiMesh** const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
boost::scoped_array<aiMesh*> tempmeshes(new aiMesh*[out.mNumMeshes]());
std::unique_ptr<aiMesh*[]> tempmeshes(new aiMesh*[out.mNumMeshes]());
subd->Subdivide(meshes,out.mNumMeshes,tempmeshes.get(),std::max( mir.renderLevels, mir.levels ),true);
std::copy(tempmeshes.get(),tempmeshes.get()+out.mNumMeshes,meshes);

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -46,8 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderIntermediate.h"
#include "TinyFormatter.h"
namespace Assimp {
namespace Blender {
namespace Blender {
// -------------------------------------------------------------------------------------------
/** Dummy base class for all blender modifiers. Modifiers are reused between imports, so
@@ -56,8 +57,8 @@ namespace Assimp {
class BlenderModifier
{
public:
virtual ~BlenderModifier() {
// empty
}
public:

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2010, ASSIMP Development Team
Copyright (c) 2006-2016, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -64,7 +64,7 @@ template <> void Structure :: Convert<Object> (
ReadFieldArray2<ErrorPolicy_Warn>(dest.parentinv,"parentinv",db);
ReadFieldArray<ErrorPolicy_Warn>(dest.parsubstr,"parsubstr",db);
{
boost::shared_ptr<Object> parent;
std::shared_ptr<Object> parent;
ReadFieldPtr<ErrorPolicy_Warn>(parent,"*parent",db);
dest.parent = parent.get();
}
@@ -206,6 +206,10 @@ template <> void Structure :: Convert<Lamp> (
ReadField<ErrorPolicy_Igno>(dest.att2,"att2",db);
ReadField<ErrorPolicy_Igno>((int&)dest.falloff_type,"falloff_type",db);
ReadField<ErrorPolicy_Igno>(dest.sun_brightness,"sun_brightness",db);
ReadField<ErrorPolicy_Igno>(dest.area_size,"area_size",db);
ReadField<ErrorPolicy_Igno>(dest.area_sizey,"area_sizey",db);
ReadField<ErrorPolicy_Igno>(dest.area_sizez,"area_sizez",db);
ReadField<ErrorPolicy_Igno>(dest.area_shape,"area_shape",db);
db.reader->IncPtr(size);
}
@@ -297,7 +301,6 @@ template <> void Structure :: Convert<Material> (
const FileDatabase& db
) const
{
ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
@@ -313,9 +316,11 @@ template <> void Structure :: Convert<Material> (
ReadField<ErrorPolicy_Igno>(dest.mirg,"mirg",db);
ReadField<ErrorPolicy_Igno>(dest.mirb,"mirb",db);
ReadField<ErrorPolicy_Warn>(dest.emit,"emit",db);
ReadField<ErrorPolicy_Igno>(dest.ray_mirror,"ray_mirror",db);
ReadField<ErrorPolicy_Warn>(dest.alpha,"alpha",db);
ReadField<ErrorPolicy_Igno>(dest.ref,"ref",db);
ReadField<ErrorPolicy_Igno>(dest.translucency,"translucency",db);
ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
ReadField<ErrorPolicy_Igno>(dest.roughness,"roughness",db);
ReadField<ErrorPolicy_Igno>(dest.darkness,"darkness",db);
ReadField<ErrorPolicy_Igno>(dest.refrac,"refrac",db);
@@ -324,6 +329,91 @@ template <> void Structure :: Convert<Material> (
ReadField<ErrorPolicy_Warn>(dest.spec_shader,"spec_shader",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mtex,"*mtex",db);
ReadField<ErrorPolicy_Igno>(dest.amb, "amb", db);
ReadField<ErrorPolicy_Igno>(dest.ang, "ang", db);
ReadField<ErrorPolicy_Igno>(dest.spectra, "spectra", db);
ReadField<ErrorPolicy_Igno>(dest.spec, "spec", db);
ReadField<ErrorPolicy_Igno>(dest.zoffs, "zoffs", db);
ReadField<ErrorPolicy_Igno>(dest.add, "add", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_mir, "fresnel_mir", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_mir_i, "fresnel_mir_i", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_tra, "fresnel_tra", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_tra_i, "fresnel_tra_i", db);
ReadField<ErrorPolicy_Igno>(dest.filter, "filter", db);
ReadField<ErrorPolicy_Igno>(dest.tx_limit, "tx_limit", db);
ReadField<ErrorPolicy_Igno>(dest.tx_falloff, "tx_falloff", db);
ReadField<ErrorPolicy_Igno>(dest.gloss_mir, "gloss_mir", db);
ReadField<ErrorPolicy_Igno>(dest.gloss_tra, "gloss_tra", db);
ReadField<ErrorPolicy_Igno>(dest.adapt_thresh_mir, "adapt_thresh_mir", db);
ReadField<ErrorPolicy_Igno>(dest.adapt_thresh_tra, "adapt_thresh_tra", db);
ReadField<ErrorPolicy_Igno>(dest.aniso_gloss_mir, "aniso_gloss_mir", db);
ReadField<ErrorPolicy_Igno>(dest.dist_mir, "dist_mir", db);
ReadField<ErrorPolicy_Igno>(dest.hasize, "hasize", db);
ReadField<ErrorPolicy_Igno>(dest.flaresize, "flaresize", db);
ReadField<ErrorPolicy_Igno>(dest.subsize, "subsize", db);
ReadField<ErrorPolicy_Igno>(dest.flareboost, "flareboost", db);
ReadField<ErrorPolicy_Igno>(dest.strand_sta, "strand_sta", db);
ReadField<ErrorPolicy_Igno>(dest.strand_end, "strand_end", db);
ReadField<ErrorPolicy_Igno>(dest.strand_ease, "strand_ease", db);
ReadField<ErrorPolicy_Igno>(dest.strand_surfnor, "strand_surfnor", db);
ReadField<ErrorPolicy_Igno>(dest.strand_min, "strand_min", db);
ReadField<ErrorPolicy_Igno>(dest.strand_widthfade, "strand_widthfade", db);
ReadField<ErrorPolicy_Igno>(dest.sbias, "sbias", db);
ReadField<ErrorPolicy_Igno>(dest.lbias, "lbias", db);
ReadField<ErrorPolicy_Igno>(dest.shad_alpha, "shad_alpha", db);
ReadField<ErrorPolicy_Igno>(dest.param, "param", db);
ReadField<ErrorPolicy_Igno>(dest.rms, "rms", db);
ReadField<ErrorPolicy_Igno>(dest.rampfac_col, "rampfac_col", db);
ReadField<ErrorPolicy_Igno>(dest.rampfac_spec, "rampfac_spec", db);
ReadField<ErrorPolicy_Igno>(dest.friction, "friction", db);
ReadField<ErrorPolicy_Igno>(dest.fh, "fh", db);
ReadField<ErrorPolicy_Igno>(dest.reflect, "reflect", db);
ReadField<ErrorPolicy_Igno>(dest.fhdist, "fhdist", db);
ReadField<ErrorPolicy_Igno>(dest.xyfrict, "xyfrict", db);
ReadField<ErrorPolicy_Igno>(dest.sss_radius, "sss_radius", db);
ReadField<ErrorPolicy_Igno>(dest.sss_col, "sss_col", db);
ReadField<ErrorPolicy_Igno>(dest.sss_error, "sss_error", db);
ReadField<ErrorPolicy_Igno>(dest.sss_scale, "sss_scale", db);
ReadField<ErrorPolicy_Igno>(dest.sss_ior, "sss_ior", db);
ReadField<ErrorPolicy_Igno>(dest.sss_colfac, "sss_colfac", db);
ReadField<ErrorPolicy_Igno>(dest.sss_texfac, "sss_texfac", db);
ReadField<ErrorPolicy_Igno>(dest.sss_front, "sss_front", db);
ReadField<ErrorPolicy_Igno>(dest.sss_back, "sss_back", db);
ReadField<ErrorPolicy_Igno>(dest.material_type, "material_type", db);
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Igno>(dest.ray_depth, "ray_depth", db);
ReadField<ErrorPolicy_Igno>(dest.ray_depth_tra, "ray_depth_tra", db);
ReadField<ErrorPolicy_Igno>(dest.samp_gloss_mir, "samp_gloss_mir", db);
ReadField<ErrorPolicy_Igno>(dest.samp_gloss_tra, "samp_gloss_tra", db);
ReadField<ErrorPolicy_Igno>(dest.fadeto_mir, "fadeto_mir", db);
ReadField<ErrorPolicy_Igno>(dest.shade_flag, "shade_flag", db);
ReadField<ErrorPolicy_Igno>(dest.flarec, "flarec", db);
ReadField<ErrorPolicy_Igno>(dest.starc, "starc", db);
ReadField<ErrorPolicy_Igno>(dest.linec, "linec", db);
ReadField<ErrorPolicy_Igno>(dest.ringc, "ringc", db);
ReadField<ErrorPolicy_Igno>(dest.pr_lamp, "pr_lamp", db);
ReadField<ErrorPolicy_Igno>(dest.pr_texture, "pr_texture", db);
ReadField<ErrorPolicy_Igno>(dest.ml_flag, "ml_flag", db);
ReadField<ErrorPolicy_Igno>(dest.diff_shader, "diff_shader", db);
ReadField<ErrorPolicy_Igno>(dest.spec_shader, "spec_shader", db);
ReadField<ErrorPolicy_Igno>(dest.texco, "texco", db);
ReadField<ErrorPolicy_Igno>(dest.mapto, "mapto", db);
ReadField<ErrorPolicy_Igno>(dest.ramp_show, "ramp_show", db);
ReadField<ErrorPolicy_Igno>(dest.pad3, "pad3", db);
ReadField<ErrorPolicy_Igno>(dest.dynamode, "dynamode", db);
ReadField<ErrorPolicy_Igno>(dest.pad2, "pad2", db);
ReadField<ErrorPolicy_Igno>(dest.sss_flag, "sss_flag", db);
ReadField<ErrorPolicy_Igno>(dest.sss_preset, "sss_preset", db);
ReadField<ErrorPolicy_Igno>(dest.shadowonly_flag, "shadowonly_flag", db);
ReadField<ErrorPolicy_Igno>(dest.index, "index", db);
ReadField<ErrorPolicy_Igno>(dest.vcol_alpha, "vcol_alpha", db);
ReadField<ErrorPolicy_Igno>(dest.pad4, "pad4", db);
ReadField<ErrorPolicy_Igno>(dest.seed1, "seed1", db);
ReadField<ErrorPolicy_Igno>(dest.seed2, "seed2", db);
db.reader->IncPtr(size);
}
@@ -335,7 +425,7 @@ template <> void Structure :: Convert<MTexPoly> (
{
{
boost::shared_ptr<Image> tpage;
std::shared_ptr<Image> tpage;
ReadFieldPtr<ErrorPolicy_Igno>(tpage,"*tpage",db);
dest.tpage = tpage.get();
}
@@ -620,7 +710,10 @@ template <> void Structure :: Convert<Camera> (
ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db);
ReadField<ErrorPolicy_Warn>((int&)dest.flag,"flag",db);
ReadField<ErrorPolicy_Warn>(dest.angle,"angle",db);
ReadField<ErrorPolicy_Warn>(dest.lens,"lens",db);
ReadField<ErrorPolicy_Warn>(dest.sensor_x,"sensor_x",db);
ReadField<ErrorPolicy_Igno>(dest.clipsta,"clipsta",db);
ReadField<ErrorPolicy_Igno>(dest.clipend,"clipend",db);
db.reader->IncPtr(size);
}

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderDNA.h"
namespace Assimp {
namespace Blender {
namespace Blender {
// Minor parts of this file are extracts from blender data structures,
// declared in the ./source/blender/makesdna directory.
@@ -73,7 +73,7 @@ namespace Assimp {
//
// * Pointers to other structures or primitive types are allowed.
// No references or double pointers or arrays of pointers.
// A pointer to a T is normally written as boost::shared_ptr, while a
// A pointer to a T is normally written as std::shared_ptr, while a
// pointer to an array of elements is written as boost::
// shared_array. To avoid cyclic pointers, use raw pointers in
// one direction.
@@ -98,6 +98,8 @@ struct Object;
struct MTex;
struct Image;
#include <memory>
#define AI_BLEND_MESH_MAX_VERTS 2000000000L
// -------------------------------------------------------------------------------
@@ -110,8 +112,8 @@ struct ID : ElemBase {
// -------------------------------------------------------------------------------
struct ListBase : ElemBase {
boost::shared_ptr<ElemBase> first;
boost::shared_ptr<ElemBase> last;
std::shared_ptr<ElemBase> first;
std::shared_ptr<ElemBase> last;
};
@@ -119,14 +121,14 @@ struct ListBase : ElemBase {
struct PackedFile : ElemBase {
int size WARN;
int seek WARN;
boost::shared_ptr< FileOffset > data WARN;
std::shared_ptr< FileOffset > data WARN;
};
// -------------------------------------------------------------------------------
struct GroupObject : ElemBase {
boost::shared_ptr<GroupObject> prev,next FAIL;
boost::shared_ptr<Object> ob;
std::shared_ptr<GroupObject> prev,next FAIL;
std::shared_ptr<Object> ob;
};
// -------------------------------------------------------------------------------
@@ -134,7 +136,7 @@ struct Group : ElemBase {
ID id FAIL;
int layer;
boost::shared_ptr<GroupObject> gobject;
std::shared_ptr<GroupObject> gobject;
};
// -------------------------------------------------------------------------------
@@ -222,7 +224,7 @@ struct MTFace : ElemBase {
short tile;
short unwrap;
// boost::shared_ptr<Image> tpage;
// std::shared_ptr<Image> tpage;
};
// -------------------------------------------------------------------------------
@@ -239,6 +241,11 @@ struct MDeformVert : ElemBase {
};
// -------------------------------------------------------------------------------
#define MA_RAYMIRROR 0x40000
#define MA_TRANSPARENCY 0x10000
#define MA_RAYTRANSP 0x20000
#define MA_ZTRANSP 0x00040
struct Material : ElemBase {
ID id FAIL;
@@ -248,19 +255,104 @@ struct Material : ElemBase {
float ambr,ambg,ambb WARN;
float mirr,mirg,mirb;
float emit WARN;
float ray_mirror;
float alpha WARN;
float ref;
float translucency;
int mode;
float roughness;
float darkness;
float refrac;
boost::shared_ptr<Group> group;
float amb;
float ang;
float spectra;
float spec;
float zoffs;
float add;
float fresnel_mir;
float fresnel_mir_i;
float fresnel_tra;
float fresnel_tra_i;
float filter;
float tx_limit;
float tx_falloff;
float gloss_mir;
float gloss_tra;
float adapt_thresh_mir;
float adapt_thresh_tra;
float aniso_gloss_mir;
float dist_mir;
float hasize;
float flaresize;
float subsize;
float flareboost;
float strand_sta;
float strand_end;
float strand_ease;
float strand_surfnor;
float strand_min;
float strand_widthfade;
float sbias;
float lbias;
float shad_alpha;
float param;
float rms;
float rampfac_col;
float rampfac_spec;
float friction;
float fh;
float reflect;
float fhdist;
float xyfrict;
float sss_radius;
float sss_col;
float sss_error;
float sss_scale;
float sss_ior;
float sss_colfac;
float sss_texfac;
float sss_front;
float sss_back;
short material_type;
short flag;
short ray_depth;
short ray_depth_tra;
short samp_gloss_mir;
short samp_gloss_tra;
short fadeto_mir;
short shade_flag;
short flarec;
short starc;
short linec;
short ringc;
short pr_lamp;
short pr_texture;
short ml_flag;
short texco;
short mapto;
short ramp_show;
short pad3;
short dynamode;
short pad2;
short sss_flag;
short sss_preset;
short shadowonly_flag;
short index;
short vcol_alpha;
short pad4;
char seed1;
char seed2;
std::shared_ptr<Group> group;
short diff_shader WARN;
short spec_shader WARN;
boost::shared_ptr<MTex> mtex[18];
std::shared_ptr<MTex> mtex[18];
};
// -------------------------------------------------------------------------------
@@ -291,7 +383,7 @@ struct Mesh : ElemBase {
vector<MDeformVert> dvert;
vector<MCol> mcol;
vector< boost::shared_ptr<Material> > mat FAIL;
vector< std::shared_ptr<Material> > mat FAIL;
};
// -------------------------------------------------------------------------------
@@ -300,7 +392,7 @@ struct Library : ElemBase {
char name[240] WARN;
char filename[240] FAIL;
boost::shared_ptr<Library> parent WARN;
std::shared_ptr<Library> parent WARN;
};
// -------------------------------------------------------------------------------
@@ -312,18 +404,10 @@ struct Camera : ElemBase {
ID id FAIL;
// struct AnimData *adt;
Type type,flag WARN;
float angle WARN;
//float passepartalpha, angle;
//float clipsta, clipend;
//float lens, ortho_scale, drawsize;
//float shiftx, shifty;
//float YF_dofdist, YF_aperture;
//short YF_bkhtype, YF_bkhbias;
//float YF_bkhrot;
float lens WARN;
float sensor_x WARN;
float clipsta, clipend;
};
@@ -373,8 +457,8 @@ struct Lamp : ElemBase {
//short ray_samp, ray_sampy, ray_sampz;
//short ray_samp_type;
//short area_shape;
//float area_size, area_sizey, area_sizez;
short area_shape;
float area_size, area_sizey, area_sizez;
//float adapt_thresh;
//short ray_samp_method;
@@ -448,8 +532,8 @@ struct ModifierData : ElemBase {
eModifierType_ShapeKey
};
boost::shared_ptr<ElemBase> next WARN;
boost::shared_ptr<ElemBase> prev WARN;
std::shared_ptr<ElemBase> next WARN;
std::shared_ptr<ElemBase> prev WARN;
int type, mode;
char name[32];
@@ -493,7 +577,7 @@ struct MirrorModifierData : ElemBase {
short axis, flag;
float tolerance;
boost::shared_ptr<Object> mirror_ob;
std::shared_ptr<Object> mirror_ob;
};
// -------------------------------------------------------------------------------
@@ -521,11 +605,11 @@ struct Object : ElemBase {
char parsubstr[32] WARN;
Object* parent WARN;
boost::shared_ptr<Object> track WARN;
std::shared_ptr<Object> track WARN;
boost::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
boost::shared_ptr<Group> dup_group WARN;
boost::shared_ptr<ElemBase> data FAIL;
std::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
std::shared_ptr<Group> dup_group WARN;
std::shared_ptr<ElemBase> data FAIL;
ListBase modifiers;
};
@@ -534,17 +618,17 @@ struct Object : ElemBase {
// -------------------------------------------------------------------------------
struct Base : ElemBase {
Base* prev WARN;
boost::shared_ptr<Base> next WARN;
boost::shared_ptr<Object> object WARN;
std::shared_ptr<Base> next WARN;
std::shared_ptr<Object> object WARN;
};
// -------------------------------------------------------------------------------
struct Scene : ElemBase {
ID id FAIL;
boost::shared_ptr<Object> camera WARN;
boost::shared_ptr<World> world WARN;
boost::shared_ptr<Base> basact WARN;
std::shared_ptr<Object> camera WARN;
std::shared_ptr<World> world WARN;
std::shared_ptr<Base> basact WARN;
ListBase base;
};
@@ -568,7 +652,7 @@ struct Image : ElemBase {
//unsigned int bindcode;
//unsigned int *repbind;
boost::shared_ptr<PackedFile> packedfile;
std::shared_ptr<PackedFile> packedfile;
//struct PreviewImage * preview;
float lastupdate;
@@ -654,7 +738,7 @@ struct Tex : ElemBase {
//bNodeTree *nodetree;
//Ipo *ipo;
boost::shared_ptr<Image> ima WARN;
std::shared_ptr<Image> ima WARN;
//PluginTex *plugin;
//ColorBand *coba;
//EnvMap *env;
@@ -721,8 +805,8 @@ struct MTex : ElemBase {
MapType mapto;
BlendType blendtype;
boost::shared_ptr<Object> object;
boost::shared_ptr<Tex> tex;
std::shared_ptr<Object> object;
std::shared_ptr<Tex> tex;
char uvname[32];
Projection projx,projy,projz;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2010, ASSIMP Development Team
Copyright (c) 2006-2016, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -48,8 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderScene.h"
namespace Assimp {
namespace Blender {
namespace Blender {
template <> void Structure :: Convert<Object> (
Object& dest,

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2013, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -140,7 +140,7 @@ void BlenderTessellatorGL::TriangulateDrawCalls( const TessDataGL& tessData )
{
// NOTE - Because we are supplying a callback to GLU_TESS_EDGE_FLAG_DATA we don't technically
// need support for GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN but we'll keep it here in case
// GLU tessellate changes or tristrips and fans are wanted.
// GLU tessellate changes or tri-strips and fans are wanted.
// See: http://www.opengl.org/sdk/docs/man2/xhtml/gluTessCallback.xml
for ( unsigned int i = 0; i < tessData.drawCalls.size( ); ++i )
{
@@ -164,7 +164,7 @@ void BlenderTessellatorGL::TriangulateDrawCalls( const TessDataGL& tessData )
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorGL::MakeFacesFromTris( const VertexGL* vertices, int vertexCount )
{
int triangleCount = vertexCount / 3;
const int triangleCount = vertexCount / 3;
for ( int i = 0; i < triangleCount; ++i )
{
int vertexBase = i * 3;
@@ -175,7 +175,7 @@ void BlenderTessellatorGL::MakeFacesFromTris( const VertexGL* vertices, int vert
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorGL::MakeFacesFromTriStrip( const VertexGL* vertices, int vertexCount )
{
int triangleCount = vertexCount - 2;
const int triangleCount = vertexCount - 2;
for ( int i = 0; i < triangleCount; ++i )
{
int vertexBase = i;
@@ -186,7 +186,7 @@ void BlenderTessellatorGL::MakeFacesFromTriStrip( const VertexGL* vertices, int
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorGL::MakeFacesFromTriFan( const VertexGL* vertices, int vertexCount )
{
int triangleCount = vertexCount - 2;
const int triangleCount = vertexCount - 2;
for ( int i = 0; i < triangleCount; ++i )
{
int vertexBase = i;
@@ -353,7 +353,7 @@ aiMatrix4x4 BlenderTessellatorP2T::GeneratePointTransformMatrix( const Blender::
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorP2T::TransformAndFlattenVectices( const aiMatrix4x4& transform, std::vector< Blender::PointP2T >& vertices ) const
{
for ( unsigned int i = 0; i < vertices.size( ); ++i )
for ( size_t i = 0; i < vertices.size( ); ++i )
{
PointP2T& point = vertices[ i ];
point.point3D = transform * point.point3D;
@@ -365,7 +365,7 @@ void BlenderTessellatorP2T::TransformAndFlattenVectices( const aiMatrix4x4& tran
void BlenderTessellatorP2T::ReferencePoints( std::vector< Blender::PointP2T >& points, std::vector< p2t::Point* >& pointRefs ) const
{
pointRefs.resize( points.size( ) );
for ( unsigned int i = 0; i < points.size( ); ++i )
for ( size_t i = 0; i < points.size( ); ++i )
{
pointRefs[ i ] = &points[ i ].point2D;
}
@@ -391,7 +391,7 @@ inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& poi
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorP2T::MakeFacesFromTriangles( std::vector< p2t::Triangle* >& triangles ) const
{
for ( unsigned int i = 0; i < triangles.size( ); ++i )
for ( size_t i = 0; i < triangles.size( ); ++i )
{
p2t::Triangle& Triangle = *triangles[ i ];
@@ -415,9 +415,9 @@ float BlenderTessellatorP2T::FindLargestMatrixElem( const aiMatrix3x3& mtx ) con
{
float result = 0.0f;
for ( int x = 0; x < 3; ++x )
for ( size_t x = 0; x < 3; ++x )
{
for ( int y = 0; y < 3; ++y )
for ( size_t y = 0; y < 3; ++y )
{
result = p2tMax( std::fabs( mtx[ x ][ y ] ), result );
}
@@ -427,14 +427,14 @@ float BlenderTessellatorP2T::FindLargestMatrixElem( const aiMatrix3x3& mtx ) con
}
// ------------------------------------------------------------------------------------------------
// Aparently Assimp doesn't have matrix scaling
// Apparently Assimp doesn't have matrix scaling
aiMatrix3x3 BlenderTessellatorP2T::ScaleMatrix( const aiMatrix3x3& mtx, float scale ) const
{
aiMatrix3x3 result;
for ( int x = 0; x < 3; ++x )
for ( size_t x = 0; x < 3; ++x )
{
for ( int y = 0; y < 3; ++y )
for ( size_t y = 0; y < 3; ++y )
{
result[ x ][ y ] = mtx[ x ][ y ] * scale;
}
@@ -448,7 +448,7 @@ aiMatrix3x3 BlenderTessellatorP2T::ScaleMatrix( const aiMatrix3x3& mtx, float sc
// Adapted from: http://missingbytes.blogspot.co.uk/2012/06/fitting-plane-to-point-cloud.html
aiVector3D BlenderTessellatorP2T::GetEigenVectorFromLargestEigenValue( const aiMatrix3x3& mtx ) const
{
float scale = FindLargestMatrixElem( mtx );
const float scale = FindLargestMatrixElem( mtx );
aiMatrix3x3 mc = ScaleMatrix( mtx, 1.0f / scale );
mc = mc * mc * mc;
@@ -474,7 +474,7 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
PlaneP2T result;
aiVector3D sum( 0.0f );
for ( unsigned int i = 0; i < points.size( ); ++i )
for ( size_t i = 0; i < points.size( ); ++i )
{
sum += points[ i ].point3D;
}
@@ -486,7 +486,7 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
float sumYY = 0.0f;
float sumYZ = 0.0f;
float sumZZ = 0.0f;
for ( unsigned int i = 0; i < points.size( ); ++i )
for ( size_t i = 0; i < points.size( ); ++i )
{
aiVector3D offset = points[ i ].point3D - result.centre;
sumXX += offset.x * offset.x;
@@ -499,7 +499,7 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
aiMatrix3x3 mtx( sumXX, sumXY, sumXZ, sumXY, sumYY, sumYZ, sumXZ, sumYZ, sumZZ );
float det = mtx.Determinant( );
const float det = mtx.Determinant( );
if ( det == 0.0f )
{
result.normal = aiVector3D( 0.0f );

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2013, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "./../include/assimp/cexport.h"
#include "./../include/assimp/IOSystem.hpp"
#include "./../include/assimp/DefaultLogger.hpp"
#include <boost/foreach.hpp>
#include <stdint.h>
#include <set>
#include <vector>
@@ -224,7 +223,7 @@ public:
virtual ~BlobIOSystem()
{
BOOST_FOREACH(BlobEntry& blobby, blobs) {
for(BlobEntry& blobby : blobs) {
delete blobby.second;
}
}
@@ -243,7 +242,7 @@ public:
{
// one must be the master
aiExportDataBlob* master = NULL, *cur;
BOOST_FOREACH(const BlobEntry& blobby, blobs) {
for(const BlobEntry& blobby : blobs) {
if (blobby.first == AI_BLOBIO_MAGIC) {
master = blobby.second;
break;
@@ -257,7 +256,7 @@ public:
master->name.Set("");
cur = master;
BOOST_FOREACH(const BlobEntry& blobby, blobs) {
for(const BlobEntry& blobby : blobs) {
if (blobby.second == master) {
continue;
}

View File

@@ -1,23 +0,0 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -1,99 +0,0 @@
#ifndef BOOST_FOREACH
///////////////////////////////////////////////////////////////////////////////
// A stripped down version of FOREACH for
// illustration purposes. NOT FOR GENERAL USE.
// For a complete implementation, see BOOST_FOREACH at
// http://boost-sandbox.sourceforge.net/vault/index.php?directory=eric_niebler
//
// Copyright 2004 Eric Niebler.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Adapted to Assimp November 29th, 2008 (Alexander Gessler).
// Added code to handle both const and non-const iterators, simplified some
// parts.
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace foreach_detail {
///////////////////////////////////////////////////////////////////////////////
// auto_any
struct auto_any_base
{
operator bool() const { return false; }
};
template<typename T>
struct auto_any : auto_any_base
{
auto_any(T const& t) : item(t) {}
mutable T item;
};
template<typename T>
T& auto_any_cast(auto_any_base const& any)
{
return static_cast<auto_any<T> const&>(any).item;
}
///////////////////////////////////////////////////////////////////////////////
// FOREACH helper function
template<typename T>
auto_any<typename T::const_iterator> begin(T const& t)
{
return t.begin();
}
template<typename T>
auto_any<typename T::const_iterator> end(T const& t)
{
return t.end();
}
// iterator
template<typename T>
bool done(auto_any_base const& cur, auto_any_base const& end, T&)
{
typedef typename T::iterator iter_type;
return auto_any_cast<iter_type>(cur) == auto_any_cast<iter_type>(end);
}
template<typename T>
void next(auto_any_base const& cur, T&)
{
++auto_any_cast<typename T::iterator>(cur);
}
template<typename T>
typename T::reference deref(auto_any_base const& cur, T&)
{
return *auto_any_cast<typename T::iterator>(cur);
}
template<typename T>
typename T::const_reference deref(auto_any_base const& cur, const T&)
{
return *auto_any_cast<typename T::iterator>(cur);
}
} // end foreach_detail
///////////////////////////////////////////////////////////////////////////////
// FOREACH
#define BOOST_FOREACH(item, container) \
if(boost::foreach_detail::auto_any_base const& foreach_magic_b = boost::foreach_detail::begin(container)) {} else \
if(boost::foreach_detail::auto_any_base const& foreach_magic_e = boost::foreach_detail::end(container)) {} else \
for(;!boost::foreach_detail::done(foreach_magic_b,foreach_magic_e,container); boost::foreach_detail::next(foreach_magic_b,container)) \
if (bool ugly_and_unique_break = false) {} else \
for(item = boost::foreach_detail::deref(foreach_magic_b,container); !ugly_and_unique_break; ugly_and_unique_break = true)
} // end boost
#endif

View File

@@ -1,82 +0,0 @@
/* DEPRECATED! - use code/TinyFormatter.h instead.
*
*
* */
#ifndef AI_BOOST_FORMAT_DUMMY_INCLUDED
#define AI_BOOST_FORMAT_DUMMY_INCLUDED
#if (!defined BOOST_FORMAT_HPP) || (defined ASSIMP_FORCE_NOBOOST)
#include <string>
#include <vector>
#include <sstream>
namespace boost
{
class format
{
public:
format (const std::string& _d)
: d(_d)
{
}
template <typename T>
format& operator % (T in)
{
// XXX add replacement for boost::lexical_cast?
std::ostringstream ss;
ss << in; // note: ss cannot be an rvalue, or the global operator << (const char*) is not called for T == const char*.
chunks.push_back( ss.str());
return *this;
}
operator std::string () const {
std::string res; // pray for NRVO to kick in
size_t start = 0, last = 0;
std::vector<std::string>::const_iterator chunkin = chunks.begin();
for ( start = d.find('%');start != std::string::npos; start = d.find('%',last)) {
res += d.substr(last,start-last);
last = start+2;
if (d[start+1] == '%') {
res += "%";
continue;
}
if (chunkin == chunks.end()) {
break;
}
res += *chunkin++;
}
res += d.substr(last);
return res;
}
private:
std::string d;
std::vector<std::string> chunks;
};
inline std::string str(const std::string& s) {
return s;
}
}
#else
# error "format.h was already included"
#endif //
#endif // !! AI_BOOST_FORMAT_DUMMY_INCLUDED

View File

@@ -1,26 +0,0 @@
/// A quick replacement for boost::lexical_cast for all the Boost haters out there
#ifndef __AI_BOOST_WORKAROUND_LEXICAL_CAST
#define __AI_BOOST_WORKAROUND_LEXICAL_CAST
#include <sstream>
namespace boost
{
/// A quick replacement for boost::lexical_cast - should work for all types a stringstream can handle
template <typename TargetType, typename SourceType>
TargetType lexical_cast( const SourceType& source)
{
std::stringstream stream;
TargetType result;
stream << source;
stream >> result;
return result;
}
} // namespace boost
#endif // __AI_BOOST_WORKAROUND_LEXICAL_CAST

View File

@@ -1,57 +0,0 @@
// please note that this replacement implementation does not
// provide the performance benefit of the original, which
// makes only one allocation as opposed to two allocations
// (smart pointer counter and payload) which are usually
// required if object and smart pointer are constructed
// independently.
#ifndef INCLUDED_AI_BOOST_MAKE_SHARED
#define INCLUDED_AI_BOOST_MAKE_SHARED
namespace boost {
template <typename T>
shared_ptr<T> make_shared() {
return shared_ptr<T>(new T());
}
template <typename T, typename T0>
shared_ptr<T> make_shared(const T0& t0) {
return shared_ptr<T>(new T(t0));
}
template <typename T, typename T0,typename T1>
shared_ptr<T> make_shared(const T0& t0, const T1& t1) {
return shared_ptr<T>(new T(t0,t1));
}
template <typename T, typename T0,typename T1,typename T2>
shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2) {
return shared_ptr<T>(new T(t0,t1,t2));
}
template <typename T, typename T0,typename T1,typename T2,typename T3>
shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3) {
return shared_ptr<T>(new T(t0,t1,t2,t3));
}
template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4>
shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
return shared_ptr<T>(new T(t0,t1,t2,t3,t4));
}
template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4, typename T5>
shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) {
return shared_ptr<T>(new T(t0,t1,t2,t3,t4,t5));
}
template <typename T, typename T0,typename T1,typename T2,typename T3, typename T4, typename T5, typename T6>
shared_ptr<T> make_shared(const T0& t0, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) {
return shared_ptr<T>(new T(t0,t1,t2,t3,t4,t5,t6));
}
}
#endif

View File

@@ -1,37 +0,0 @@
#ifndef BOOST_MATH_COMMON_FACTOR_RT_HPP
#define BOOST_MATH_COMMON_FACTOR_RT_HPP
namespace boost {
namespace math {
// TODO: use binary GCD for unsigned integers ....
template < typename IntegerType >
IntegerType gcd( IntegerType a, IntegerType b )
{
const IntegerType zero = (IntegerType)0;
while ( true )
{
if ( a == zero )
return b;
b %= a;
if ( b == zero )
return a;
a %= b;
}
}
template < typename IntegerType >
IntegerType lcm( IntegerType a, IntegerType b )
{
const IntegerType t = gcd (a,b);
if (!t)return t;
return a / t * b;
}
}}
#endif

View File

@@ -1,36 +0,0 @@
// Boost noncopyable.hpp header file --------------------------------------//
// (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/utility for documentation.
#ifndef BOOST_NONCOPYABLE_HPP_INCLUDED
#define BOOST_NONCOPYABLE_HPP_INCLUDED
namespace boost {
// Private copy constructor and copy assignment ensure classes derived from
// class noncopyable cannot be copied.
// Contributed by Dave Abrahams
namespace noncopyable_ // protection from unintended ADL
{
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private: // emphasize the following members are private
noncopyable( const noncopyable& );
const noncopyable& operator=( const noncopyable& );
};
}
typedef noncopyable_::noncopyable noncopyable;
} // namespace boost
#endif // BOOST_NONCOPYABLE_HPP_INCLUDED

View File

@@ -1,45 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_POINTER_CAST_HPP
#define BOOST_POINTER_CAST_HPP
namespace boost {
//static_pointer_cast overload for raw pointers
template<class T, class U>
inline T* static_pointer_cast(U *ptr)
{
return static_cast<T*>(ptr);
}
//dynamic_pointer_cast overload for raw pointers
template<class T, class U>
inline T* dynamic_pointer_cast(U *ptr)
{
return dynamic_cast<T*>(ptr);
}
//const_pointer_cast overload for raw pointers
template<class T, class U>
inline T* const_pointer_cast(U *ptr)
{
return const_cast<T*>(ptr);
}
//reinterpret_pointer_cast overload for raw pointers
template<class T, class U>
inline T* reinterpret_pointer_cast(U *ptr)
{
return reinterpret_cast<T*>(ptr);
}
} // namespace boost
#endif //BOOST_POINTER_CAST_HPP

View File

@@ -1,79 +0,0 @@
#ifndef __AI_BOOST_SCOPED_ARRAY_INCLUDED
#define __AI_BOOST_SCOPED_ARRAY_INCLUDED
#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED
namespace boost {
// small replacement for boost::scoped_array
template <class T>
class scoped_array
{
public:
// provide a default construtctor
scoped_array()
: ptr(0)
{
}
// construction from an existing heap object of type T
scoped_array(T* _ptr)
: ptr(_ptr)
{
}
// automatic destruction of the wrapped object at the
// end of our lifetime
~scoped_array()
{
delete[] ptr;
}
inline T* get()
{
return ptr;
}
inline T* operator-> ()
{
return ptr;
}
inline void reset (T* t = 0)
{
delete[] ptr;
ptr = t;
}
T & operator[](std::ptrdiff_t i) const
{
return ptr[i];
}
void swap(scoped_array & b)
{
std::swap(ptr, b.ptr);
}
private:
// encapsulated object pointer
T* ptr;
};
template<class T>
inline void swap(scoped_array<T> & a, scoped_array<T> & b)
{
a.swap(b);
}
} // end of namespace boost
#else
# error "scoped_array.h was already included"
#endif
#endif // __AI_BOOST_SCOPED_ARRAY_INCLUDED

View File

@@ -1,79 +0,0 @@
#ifndef __AI_BOOST_SCOPED_PTR_INCLUDED
#define __AI_BOOST_SCOPED_PTR_INCLUDED
#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED
namespace boost {
// small replacement for boost::scoped_ptr
template <class T>
class scoped_ptr
{
public:
// provide a default construtctor
scoped_ptr()
: ptr(0)
{
}
// construction from an existing heap object of type T
scoped_ptr(T* _ptr)
: ptr(_ptr)
{
}
// automatic destruction of the wrapped object at the
// end of our lifetime
~scoped_ptr()
{
delete ptr;
}
inline T* get() const
{
return ptr;
}
inline operator T*()
{
return ptr;
}
inline T* operator-> ()
{
return ptr;
}
inline void reset (T* t = 0)
{
delete ptr;
ptr = t;
}
void swap(scoped_ptr & b)
{
std::swap(ptr, b.ptr);
}
private:
// encapsulated object pointer
T* ptr;
};
template<class T>
inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b)
{
a.swap(b);
}
} // end of namespace boost
#else
# error "scoped_ptr.h was already included"
#endif
#endif // __AI_BOOST_SCOPED_PTR_INCLUDED

View File

@@ -1,228 +0,0 @@
#ifndef INCLUDED_AI_BOOST_SHARED_ARRAY
#define INCLUDED_AI_BOOST_SHARED_ARRAY
#ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED
// ------------------------------
// Internal stub
namespace boost {
namespace array_detail {
class controller {
public:
controller()
: cnt(1)
{}
public:
template <typename T>
controller* decref(T* pt) {
if (--cnt <= 0) {
delete this;
delete[] pt;
}
return NULL;
}
controller* incref() {
++cnt;
return this;
}
long get() const {
return cnt;
}
private:
long cnt;
};
struct empty {};
template <typename DEST, typename SRC>
struct is_convertible_stub {
struct yes {char s[1];};
struct no {char s[2];};
static yes foo(DEST*);
static no foo(...);
enum {result = (sizeof(foo((SRC*)0)) == sizeof(yes) ? 1 : 0)};
};
template <bool> struct enable_if {};
template <> struct enable_if<true> {
typedef empty result;
};
template <typename DEST, typename SRC>
struct is_convertible : public enable_if<is_convertible_stub<DEST,SRC>::result > {
};
}
// ------------------------------
// Small replacement for boost::shared_array, not threadsafe because no
// atomic reference counter is in use.
// ------------------------------
template <class T>
class shared_array
{
template <typename TT> friend class shared_array;
template<class TT> friend bool operator== (const shared_array<TT>& a, const shared_array<TT>& b);
template<class TT> friend bool operator!= (const shared_array<TT>& a, const shared_array<TT>& b);
template<class TT> friend bool operator< (const shared_array<TT>& a, const shared_array<TT>& b);
public:
typedef T element_type;
public:
// provide a default constructor
shared_array()
: ptr()
, ctr(NULL)
{
}
// construction from an existing object of type T
explicit shared_array(T* ptr)
: ptr(ptr)
, ctr(ptr ? new array_detail::controller() : NULL)
{
}
shared_array(const shared_array& r)
: ptr(r.ptr)
, ctr(r.ctr ? r.ctr->incref() : NULL)
{
}
template <typename Y>
shared_array(const shared_array<Y>& r,typename detail::is_convertible<T,Y>::result = detail::empty())
: ptr(r.ptr)
, ctr(r.ctr ? r.ctr->incref() : NULL)
{
}
// automatic destruction of the wrapped object when all
// references are freed.
~shared_array() {
if (ctr) {
ctr = ctr->decref(ptr);
}
}
shared_array& operator=(const shared_array& r) {
if (this == &r) {
return *this;
}
if (ctr) {
ctr->decref(ptr);
}
ptr = r.ptr;
ctr = ptr?r.ctr->incref():NULL;
return *this;
}
template <typename Y>
shared_array& operator=(const shared_array<Y>& r) {
if (this == &r) {
return *this;
}
if (ctr) {
ctr->decref(ptr);
}
ptr = r.ptr;
ctr = ptr?r.ctr->incref():NULL;
return *this;
}
// pointer access
inline operator T*() {
return ptr;
}
inline T* operator-> () const {
return ptr;
}
// standard semantics
inline T* get() {
return ptr;
}
T& operator[] (std::ptrdiff_t index) const {
return ptr[index];
}
inline const T* get() const {
return ptr;
}
inline operator bool () const {
return ptr != NULL;
}
inline bool unique() const {
return use_count() == 1;
}
inline long use_count() const {
return ctr->get();
}
inline void reset (T* t = 0) {
if (ctr) {
ctr->decref(ptr);
}
ptr = t;
ctr = ptr?new array_detail::controller():NULL;
}
void swap(shared_array & b) {
std::swap(ptr, b.ptr);
std::swap(ctr, b.ctr);
}
private:
// encapsulated object pointer
T* ptr;
// control block
array_detail::controller* ctr;
};
template<class T>
inline void swap(shared_array<T> & a, shared_array<T> & b)
{
a.swap(b);
}
template<class T>
bool operator== (const shared_array<T>& a, const shared_array<T>& b) {
return a.ptr == b.ptr;
}
template<class T>
bool operator!= (const shared_array<T>& a, const shared_array<T>& b) {
return a.ptr != b.ptr;
}
template<class T>
bool operator< (const shared_array<T>& a, const shared_array<T>& b) {
return a.ptr < b.ptr;
}
} // end of namespace boost
#else
# error "shared_array.h was already included"
#endif
#endif // INCLUDED_AI_BOOST_SHARED_ARRAY

View File

@@ -1,260 +0,0 @@
#ifndef INCLUDED_AI_BOOST_SHARED_PTR
#define INCLUDED_AI_BOOST_SHARED_PTR
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
// ------------------------------
// Internal stub
#include <stddef.h> //NULL
#include <algorithm> //std::swap
namespace boost {
namespace detail {
class controller {
public:
controller()
: cnt(1)
{}
public:
template <typename T>
controller* decref(T* pt) {
if (--cnt <= 0) {
delete this;
delete pt;
}
return NULL;
}
controller* incref() {
++cnt;
return this;
}
long get() const {
return cnt;
}
private:
long cnt;
};
struct empty {};
template <typename DEST, typename SRC>
struct is_convertible_stub {
struct yes {char s[1];};
struct no {char s[2];};
static yes foo(DEST*);
static no foo(...);
enum {result = (sizeof(foo((SRC*)0)) == sizeof(yes) ? 1 : 0)};
};
template <bool> struct enable_if {};
template <> struct enable_if<true> {
typedef empty result;
};
template <typename DEST, typename SRC>
struct is_convertible : public enable_if<is_convertible_stub<DEST,SRC>::result > {
};
}
// ------------------------------
// Small replacement for boost::shared_ptr, not threadsafe because no
// atomic reference counter is in use.
// ------------------------------
template <class T>
class shared_ptr
{
template <typename TT> friend class shared_ptr;
template<class TT, class U> friend shared_ptr<TT> static_pointer_cast (shared_ptr<U> ptr);
template<class TT, class U> friend shared_ptr<TT> dynamic_pointer_cast (shared_ptr<U> ptr);
template<class TT, class U> friend shared_ptr<TT> const_pointer_cast (shared_ptr<U> ptr);
template<class TT> friend bool operator== (const shared_ptr<TT>& a, const shared_ptr<TT>& b);
template<class TT> friend bool operator!= (const shared_ptr<TT>& a, const shared_ptr<TT>& b);
template<class TT> friend bool operator< (const shared_ptr<TT>& a, const shared_ptr<TT>& b);
public:
typedef T element_type;
public:
// provide a default constructor
shared_ptr()
: ptr()
, ctr(NULL)
{
}
// construction from an existing object of type T
explicit shared_ptr(T* ptr)
: ptr(ptr)
, ctr(ptr ? new detail::controller() : NULL)
{
}
shared_ptr(const shared_ptr& r)
: ptr(r.ptr)
, ctr(r.ctr ? r.ctr->incref() : NULL)
{
}
template <typename Y>
shared_ptr(const shared_ptr<Y>& r,typename detail::is_convertible<T,Y>::result = detail::empty())
: ptr(r.ptr)
, ctr(r.ctr ? r.ctr->incref() : NULL)
{
}
// automatic destruction of the wrapped object when all
// references are freed.
~shared_ptr() {
if (ctr) {
ctr = ctr->decref(ptr);
}
}
shared_ptr& operator=(const shared_ptr& r) {
if (this == &r) {
return *this;
}
if (ctr) {
ctr->decref(ptr);
}
ptr = r.ptr;
ctr = ptr?r.ctr->incref():NULL;
return *this;
}
template <typename Y>
shared_ptr& operator=(const shared_ptr<Y>& r) {
if (this == &r) {
return *this;
}
if (ctr) {
ctr->decref(ptr);
}
ptr = r.ptr;
ctr = ptr?r.ctr->incref():NULL;
return *this;
}
// pointer access
inline operator T*() const {
return ptr;
}
inline T* operator-> () const {
return ptr;
}
// standard semantics
inline T* get() {
return ptr;
}
inline const T* get() const {
return ptr;
}
inline operator bool () const {
return ptr != NULL;
}
inline bool unique() const {
return use_count() == 1;
}
inline long use_count() const {
return ctr->get();
}
inline void reset (T* t = 0) {
if (ctr) {
ctr->decref(ptr);
}
ptr = t;
ctr = ptr?new detail::controller():NULL;
}
void swap(shared_ptr & b) {
std::swap(ptr, b.ptr);
std::swap(ctr, b.ctr);
}
private:
// for use by the various xxx_pointer_cast helper templates
explicit shared_ptr(T* ptr, detail::controller* ctr)
: ptr(ptr)
, ctr(ctr->incref())
{
}
private:
// encapsulated object pointer
T* ptr;
// control block
detail::controller* ctr;
};
template<class T>
inline void swap(shared_ptr<T> & a, shared_ptr<T> & b)
{
a.swap(b);
}
template<class T>
bool operator== (const shared_ptr<T>& a, const shared_ptr<T>& b) {
return a.ptr == b.ptr;
}
template<class T>
bool operator!= (const shared_ptr<T>& a, const shared_ptr<T>& b) {
return a.ptr != b.ptr;
}
template<class T>
bool operator< (const shared_ptr<T>& a, const shared_ptr<T>& b) {
return a.ptr < b.ptr;
}
template<class T, class U>
inline shared_ptr<T> static_pointer_cast( shared_ptr<U> ptr)
{
return shared_ptr<T>(static_cast<T*>(ptr.ptr),ptr.ctr);
}
template<class T, class U>
inline shared_ptr<T> dynamic_pointer_cast( shared_ptr<U> ptr)
{
return shared_ptr<T>(dynamic_cast<T*>(ptr.ptr),ptr.ctr);
}
template<class T, class U>
inline shared_ptr<T> const_pointer_cast( shared_ptr<U> ptr)
{
return shared_ptr<T>(const_cast<T*>(ptr.ptr),ptr.ctr);
}
} // end of namespace boost
#else
# error "shared_ptr.h was already included"
#endif
#endif // INCLUDED_AI_BOOST_SHARED_PTR

View File

@@ -1,20 +0,0 @@
#ifndef AI_BOOST_STATIC_ASSERT_INCLUDED
#define AI_BOOST_STATIC_ASSERT_INCLUDED
#ifndef BOOST_STATIC_ASSERT
namespace boost {
namespace detail {
template <bool b> class static_assertion_failure;
template <> class static_assertion_failure<true> {};
}
}
#define BOOST_STATIC_ASSERT(eval) \
{boost::detail::static_assertion_failure<(eval)> assert_dummy;(void)assert_dummy;}
#endif
#endif // !! AI_BOOST_STATIC_ASSERT_INCLUDED

View File

@@ -1,73 +0,0 @@
// boost timer.hpp header file ---------------------------------------------//
// Copyright Beman Dawes 1994-99. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/timer for documentation.
// Revision History
// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (JMaddock)
// 12 Jan 01 Change to inline implementation to allow use without library
// builds. See docs for more rationale. (Beman Dawes)
// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock)
// 16 Jul 99 Second beta
// 6 Jul 99 Initial boost version
#ifndef BOOST_TIMER_HPP
#define BOOST_TIMER_HPP
//#include <boost/config.hpp>
#include <ctime>
#include <limits>
//#include <boost/limits.hpp>
# ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::clock_t; using ::clock; }
# endif
namespace boost {
// timer -------------------------------------------------------------------//
// A timer object measures elapsed time.
// It is recommended that implementations measure wall clock rather than CPU
// time since the intended use is performance measurement on systems where
// total elapsed time is more important than just process or CPU time.
// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours
// due to implementation limitations. The accuracy of timings depends on the
// accuracy of timing information provided by the underlying platform, and
// this varies a great deal from platform to platform.
class timer
{
public:
timer() { _start_time = std::clock(); } // postcondition: elapsed()==0
// timer( const timer& src ); // post: elapsed()==src.elapsed()
// ~timer(){}
// timer& operator=( const timer& src ); // post: elapsed()==src.elapsed()
void restart() { _start_time = std::clock(); } // post: elapsed()==0
double elapsed() const // return elapsed time in seconds
{ return double(std::clock() - _start_time) / CLOCKS_PER_SEC; }
double elapsed_max() const // return estimated maximum value for elapsed()
// Portability warning: elapsed_max() may return too high a value on systems
// where std::clock_t overflows or resets at surprising values.
{
return (double((std::numeric_limits<std::clock_t>::max)())
- double(_start_time)) / double(CLOCKS_PER_SEC);
}
double elapsed_min() const // return minimum value for elapsed()
{ return double(1)/double(CLOCKS_PER_SEC); }
private:
std::clock_t _start_time;
}; // timer
} // namespace boost
#endif // BOOST_TIMER_HPP

View File

@@ -1,283 +0,0 @@
// A very small replacement for boost::tuple
// (c) Alexander Gessler, 2008 [alexander.gessler@gmx.net]
#ifndef BOOST_TUPLE_INCLUDED
#define BOOST_TUPLE_INCLUDED
namespace boost {
namespace detail {
// Represents an empty tuple slot (up to 5 supported)
struct nulltype {};
// For readable error messages
struct tuple_component_idx_out_of_bounds;
// To share some code for the const/nonconst versions of the getters
template <bool b, typename T>
struct ConstIf {
typedef T t;
};
template <typename T>
struct ConstIf<true,T> {
typedef const T t;
};
// Predeclare some stuff
template <typename, unsigned, typename, bool, unsigned> struct value_getter;
// Helper to obtain the type of a tuple element
template <typename T, unsigned NIDX, typename TNEXT, unsigned N /*= 0*/>
struct type_getter {
typedef type_getter<typename TNEXT::type,NIDX+1,typename TNEXT::next_type,N> next_elem_getter;
typedef typename next_elem_getter::type type;
};
template <typename T, unsigned NIDX, typename TNEXT >
struct type_getter <T,NIDX,TNEXT,NIDX> {
typedef T type;
};
// Base class for all explicit specializations of list_elem
template <typename T, unsigned NIDX, typename TNEXT >
struct list_elem_base {
// Store template parameters
typedef TNEXT next_type;
typedef T type;
static const unsigned nidx = NIDX;
};
// Represents an element in the tuple component list
template <typename T, unsigned NIDX, typename TNEXT >
struct list_elem : list_elem_base<T,NIDX,TNEXT>{
// Real members
T me;
TNEXT next;
// Get the value of a specific tuple element
template <unsigned N>
typename type_getter<T,NIDX,TNEXT,N>::type& get () {
value_getter <T,NIDX,TNEXT,false,N> s;
return s(*this);
}
// Get the value of a specific tuple element
template <unsigned N>
const typename type_getter<T,NIDX,TNEXT,N>::type& get () const {
value_getter <T,NIDX,TNEXT,true,N> s;
return s(*this);
}
// Explicit cast
template <typename T2, typename TNEXT2 >
operator list_elem<T2,NIDX,TNEXT2> () const {
list_elem<T2,NIDX,TNEXT2> ret;
ret.me = (T2)me;
ret.next = next;
return ret;
}
// Recursively compare two elements (last element returns always true)
bool operator == (const list_elem& s) const {
return (me == s.me && next == s.next);
}
};
// Represents a non-used tuple element - the very last element processed
template <typename TNEXT, unsigned NIDX >
struct list_elem<nulltype,NIDX,TNEXT> : list_elem_base<nulltype,NIDX,TNEXT> {
template <unsigned N, bool IS_CONST = true> struct value_getter {
/* just dummy members to produce readable error messages */
tuple_component_idx_out_of_bounds operator () (typename ConstIf<IS_CONST,list_elem>::t& me);
};
template <unsigned N> struct type_getter {
/* just dummy members to produce readable error messages */
typedef tuple_component_idx_out_of_bounds type;
};
// dummy
list_elem& operator = (const list_elem& /*other*/) {
return *this;
}
// dummy
bool operator == (const list_elem& other) {
return true;
}
};
// Represents the absolute end of the list
typedef list_elem<nulltype,0,int> list_end;
// Helper obtain to query the value of a tuple element
// NOTE: This can't be a nested class as the compiler won't accept a full or
// partial specialization of a nested class of a non-specialized template
template <typename T, unsigned NIDX, typename TNEXT, bool IS_CONST, unsigned N>
struct value_getter {
// calling list_elem
typedef list_elem<T,NIDX,TNEXT> outer_elem;
// typedef for the getter for next element
typedef value_getter<typename TNEXT::type,NIDX+1,typename TNEXT::next_type,
IS_CONST, N> next_value_getter;
typename ConstIf<IS_CONST,typename type_getter<T,NIDX,TNEXT,N>::type>::t&
operator () (typename ConstIf<IS_CONST,outer_elem >::t& me) {
next_value_getter s;
return s(me.next);
}
};
template <typename T, unsigned NIDX, typename TNEXT, bool IS_CONST>
struct value_getter <T,NIDX,TNEXT,IS_CONST,NIDX> {
typedef list_elem<T,NIDX,TNEXT> outer_elem;
typename ConstIf<IS_CONST,T>::t& operator () (typename ConstIf<IS_CONST,outer_elem >::t& me) {
return me.me;
}
};
}
// A very minimal implementation for up to 5 elements
template <typename T0 = detail::nulltype,
typename T1 = detail::nulltype,
typename T2 = detail::nulltype,
typename T3 = detail::nulltype,
typename T4 = detail::nulltype>
class tuple {
template <typename T0b,
typename T1b,
typename T2b,
typename T3b,
typename T4b >
friend class tuple;
private:
typedef detail::list_elem<T0,0,
detail::list_elem<T1,1,
detail::list_elem<T2,2,
detail::list_elem<T3,3,
detail::list_elem<T4,4,
detail::list_end > > > > > very_long;
very_long m;
public:
// Get a specific tuple element
template <unsigned N>
typename detail::type_getter<T0,0,typename very_long::next_type, N>::type& get () {
return m.template get<N>();
}
// ... and the const version
template <unsigned N>
const typename detail::type_getter<T0,0,typename very_long::next_type, N>::type& get () const {
return m.template get<N>();
}
// comparison operators
bool operator== (const tuple& other) const {
return m == other.m;
}
// ... and the other way round
bool operator!= (const tuple& other) const {
return !(m == other.m);
}
// cast to another tuple - all single elements must be convertible
template <typename T0b, typename T1b,typename T2b,typename T3b, typename T4b>
operator tuple <T0b,T1b,T2b,T3b,T4b> () const {
tuple <T0b,T1b,T2b,T3b,T4b> s;
s.m = (typename tuple <T0b,T1b,T2b,T3b,T4b>::very_long)m;
return s;
}
};
// Another way to access an element ...
template <unsigned N,typename T0,typename T1,typename T2,typename T3,typename T4>
inline typename tuple<T0,T1,T2,T3,T4>::very_long::template type_getter<N>::type& get (
tuple<T0,T1,T2,T3,T4>& m) {
return m.template get<N>();
}
// ... and the const version
template <unsigned N,typename T0,typename T1,typename T2,typename T3,typename T4>
inline const typename tuple<T0,T1,T2,T3,T4>::very_long::template type_getter<N>::type& get (
const tuple<T0,T1,T2,T3,T4>& m) {
return m.template get<N>();
}
// Constructs a tuple with 5 elements
template <typename T0,typename T1,typename T2,typename T3,typename T4>
inline tuple <T0,T1,T2,T3,T4> make_tuple (const T0& t0,
const T1& t1,const T2& t2,const T3& t3,const T4& t4) {
tuple <T0,T1,T2,T3,T4> t;
t.template get<0>() = t0;
t.template get<1>() = t1;
t.template get<2>() = t2;
t.template get<3>() = t3;
t.template get<4>() = t4;
return t;
}
// Constructs a tuple with 4 elements
template <typename T0,typename T1,typename T2,typename T3>
inline tuple <T0,T1,T2,T3> make_tuple (const T0& t0,
const T1& t1,const T2& t2,const T3& t3) {
tuple <T0,T1,T2,T3> t;
t.template get<0>() = t0;
t.template get<1>() = t1;
t.template get<2>() = t2;
t.template get<3>() = t3;
return t;
}
// Constructs a tuple with 3 elements
template <typename T0,typename T1,typename T2>
inline tuple <T0,T1,T2> make_tuple (const T0& t0,
const T1& t1,const T2& t2) {
tuple <T0,T1,T2> t;
t.template get<0>() = t0;
t.template get<1>() = t1;
t.template get<2>() = t2;
return t;
}
// Constructs a tuple with 2 elements
template <typename T0,typename T1>
inline tuple <T0,T1> make_tuple (const T0& t0,
const T1& t1) {
tuple <T0,T1> t;
t.template get<0>() = t0;
t.template get<1>() = t1;
return t;
}
// Constructs a tuple with 1 elements (well ...)
template <typename T0>
inline tuple <T0> make_tuple (const T0& t0) {
tuple <T0> t;
t.template get<0>() = t0;
return t;
}
// Constructs a tuple with 0 elements (well ...)
inline tuple <> make_tuple () {
tuple <> t;
return t;
}
}
#endif // !! BOOST_TUPLE_INCLUDED

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_BYTESWAPPER_H_INC
#define AI_BYTESWAPPER_H_INC
#include "../include/assimp/ai_assert.h"
#include "../include/assimp/types.h"
#include <assimp/ai_assert.h>
#include <assimp/types.h>
#include <stdint.h>
#if _MSC_VER >= 1400

View File

@@ -52,6 +52,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "C4DImporter.h"
#include "TinyFormatter.h"
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <assimp/ai_assert.h>
#if defined(_M_X64) || defined(__amd64__)
# define __C4D_64BIT
@@ -61,10 +65,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "c4d_file.h"
#include "default_alien_overloads.h"
using namespace _melange_;
using namespace melange;
// overload this function and fill in your own unique data
void GetWriterInfo(LONG &id, String &appname)
void GetWriterInfo(int &id, String &appname)
{
id = 2424226;
appname = "Open Asset Import Library";
@@ -131,7 +135,7 @@ void C4DImporter::SetupProperties(const Importer* /*pImp*/)
void C4DImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
if( file.get() == NULL) {
ThrowException("failed to open file " + pFile);
@@ -161,7 +165,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
RecurseHierarchy(doc->GetFirstObject(), pScene->mRootNode);
}
catch(...) {
BOOST_FOREACH(aiMesh* mesh, meshes) {
for(aiMesh* mesh : meshes) {
delete mesh;
}
BaseDocument::Free(doc);
@@ -176,7 +180,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// copy materials over, adding a default material if necessary
unsigned int mat_count = static_cast<unsigned int>(materials.size());
BOOST_FOREACH(aiMesh* mesh, meshes) {
for(aiMesh* mesh : meshes) {
ai_assert(mesh->mMaterialIndex <= mat_count);
if(mesh->mMaterialIndex >= mat_count) {
++mat_count;
@@ -197,7 +201,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------------------------------------
bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
bool C4DImporter::ReadShader(aiMaterial* out, melange::BaseShader* shader)
{
// based on Melange sample code (C4DImportExport.cpp)
while(shader) {
@@ -263,7 +267,7 @@ bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
// ------------------------------------------------------------------------------------------------
void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
{
// based on Melange sample code
while (mat)
@@ -288,7 +292,7 @@ void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
mat->GetParameter(MATERIAL_COLOR_COLOR, data);
Vector color = data.GetVector();
mat->GetParameter(MATERIAL_COLOR_BRIGHTNESS, data);
const Real brightness = data.GetReal();
const Float brightness = data.GetFloat();
color *= brightness;
@@ -507,11 +511,13 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
// copy normals
if (normals_src) {
if(i >= normals_src->GetNormalCount()) {
if(i >= normals_src->GetDataCount()) {
LogError("unexpected number of normals, ignoring");
}
else {
const NormalStruct& nor = normals_src->GetNormals(i);
ConstNormalHandle normal_handle = normals_src->GetDataAddressR();
NormalStruct nor;
NormalTag::Get(normal_handle, i, nor);
normals->x = nor.a.x;
normals->y = nor.a.y;
normals->z = nor.a.z;

View File

@@ -54,7 +54,7 @@ struct aiMaterial;
struct aiImporterDesc;
namespace _melange_ {
namespace melange {
class BaseObject; // c4d_file.h
class PolygonObject;
class BaseMaterial;
@@ -103,17 +103,17 @@ protected:
private:
void ReadMaterials(_melange_::BaseMaterial* mat);
void RecurseHierarchy(_melange_::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(_melange_::BaseObject* object);
unsigned int ResolveMaterial(_melange_::PolygonObject* obj);
void ReadMaterials(melange::BaseMaterial* mat);
void RecurseHierarchy(melange::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(melange::BaseObject* object);
unsigned int ResolveMaterial(melange::PolygonObject* obj);
bool ReadShader(aiMaterial* out, _melange_::BaseShader* shader);
bool ReadShader(aiMaterial* out, melange::BaseShader* shader);
std::vector<aiMesh*> meshes;
std::vector<aiMaterial*> materials;
typedef std::map<_melange_::BaseMaterial*, unsigned int> MaterialMap;
typedef std::map<melange::BaseMaterial*, unsigned int> MaterialMap;
MaterialMap material_mapping;
}; // !class C4DImporter

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_CIOSYSTEM_H_INCLUDED
#define AI_CIOSYSTEM_H_INCLUDED
#include "../include/assimp/cfileio.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include <assimp/cfileio.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
namespace Assimp {

View File

@@ -1,3 +1,41 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
#
# Copyright (c) 2006-2016, assimp team
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the
# following conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# * Neither the name of the assimp team, nor the names of its
# contributors may be used to endorse or promote products
# derived from this software without specific prior
# written permission of the assimp team.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#----------------------------------------------------------------------
# Listing and grouping of all the source files.
# 1) Set the file lists for each component
# 2) Create a Source Group for each component, for IDE project orginization
@@ -61,20 +99,6 @@ SET( Core_SRCS
Assimp.cpp
)
SET( Boost_SRCS
BoostWorkaround/boost/math/common_factor_rt.hpp
BoostWorkaround/boost/foreach.hpp
BoostWorkaround/boost/format.hpp
BoostWorkaround/boost/scoped_array.hpp
BoostWorkaround/boost/scoped_ptr.hpp
BoostWorkaround/boost/shared_array.hpp
BoostWorkaround/boost/shared_ptr.hpp
BoostWorkaround/boost/make_shared.hpp
BoostWorkaround/boost/static_assert.hpp
BoostWorkaround/boost/tuple/tuple.hpp
)
SOURCE_GROUP(Boost FILES ${Boost_SRCS})
SET( Logging_SRCS
${HEADER_PATH}/DefaultLogger.hpp
${HEADER_PATH}/LogStream.hpp
@@ -113,6 +137,7 @@ SET( Common_SRCS
StreamReader.h
StreamWriter.h
StringComparison.h
StringUtils.h
SGSpatialSort.cpp
SGSpatialSort.h
VertexTriangleAdjacency.cpp
@@ -177,7 +202,7 @@ SET(ASSIMP_LOADER_SRCS "")
SET(ASSIMP_IMPORTERS_ENABLED "") # list of enabled importers
SET(ASSIMP_IMPORTERS_DISABLED "") # disabled list (used to print)
ADD_ASSIMP_IMPORTER(3DS
ADD_ASSIMP_IMPORTER( 3DS
3DSConverter.cpp
3DSHelper.h
3DSLoader.cpp
@@ -186,41 +211,41 @@ ADD_ASSIMP_IMPORTER(3DS
3DSExporter.cpp
)
ADD_ASSIMP_IMPORTER(AC
ADD_ASSIMP_IMPORTER( AC
ACLoader.cpp
ACLoader.h
)
ADD_ASSIMP_IMPORTER(ASE
ADD_ASSIMP_IMPORTER( ASE
ASELoader.cpp
ASELoader.h
ASEParser.cpp
ASEParser.h
)
ADD_ASSIMP_IMPORTER(ASSBIN
ADD_ASSIMP_IMPORTER( ASSBIN
AssbinExporter.h
AssbinExporter.cpp
AssbinLoader.h
AssbinLoader.cpp
)
ADD_ASSIMP_IMPORTER(ASSXML
ADD_ASSIMP_IMPORTER( ASSXML
AssxmlExporter.h
AssxmlExporter.cpp
)
ADD_ASSIMP_IMPORTER(B3D
ADD_ASSIMP_IMPORTER( B3D
B3DImporter.cpp
B3DImporter.h
)
ADD_ASSIMP_IMPORTER(BVH
ADD_ASSIMP_IMPORTER( BVH
BVHLoader.cpp
BVHLoader.h
)
ADD_ASSIMP_IMPORTER(COLLADA
ADD_ASSIMP_IMPORTER( COLLADA
ColladaHelper.h
ColladaLoader.cpp
ColladaLoader.h
@@ -230,35 +255,39 @@ ADD_ASSIMP_IMPORTER(COLLADA
ColladaExporter.cpp
)
ADD_ASSIMP_IMPORTER(DXF
ADD_ASSIMP_IMPORTER( DXF
DXFLoader.cpp
DXFLoader.h
DXFHelper.h
)
ADD_ASSIMP_IMPORTER(CSM
ADD_ASSIMP_IMPORTER( CSM
CSMLoader.cpp
CSMLoader.h
)
ADD_ASSIMP_IMPORTER(HMP
ADD_ASSIMP_IMPORTER( HMP
HMPFileData.h
HMPLoader.cpp
HMPLoader.h
HalfLifeFileData.h
)
#FIXME: allow to set IRRMESH by option
ADD_ASSIMP_IMPORTER(IRR
IRRLoader.cpp
IRRLoader.h
ADD_ASSIMP_IMPORTER( IRRMESH
IRRMeshLoader.cpp
IRRMeshLoader.h
IRRShared.cpp
IRRShared.h
)
ADD_ASSIMP_IMPORTER(LWO
ADD_ASSIMP_IMPORTER( IRR
IRRLoader.cpp
IRRLoader.h
IRRShared.cpp
IRRShared.h
)
ADD_ASSIMP_IMPORTER( LWO
LWOAnimation.cpp
LWOAnimation.h
LWOBLoader.cpp
@@ -268,39 +297,39 @@ ADD_ASSIMP_IMPORTER(LWO
LWOMaterial.cpp
)
ADD_ASSIMP_IMPORTER(LWS
ADD_ASSIMP_IMPORTER( LWS
LWSLoader.cpp
LWSLoader.h
)
ADD_ASSIMP_IMPORTER(MD2
ADD_ASSIMP_IMPORTER( MD2
MD2FileData.h
MD2Loader.cpp
MD2Loader.h
MD2NormalTable.h
)
ADD_ASSIMP_IMPORTER(MD3
ADD_ASSIMP_IMPORTER( MD3
MD3FileData.h
MD3Loader.cpp
MD3Loader.h
)
ADD_ASSIMP_IMPORTER(MD5
ADD_ASSIMP_IMPORTER( MD5
MD5Loader.cpp
MD5Loader.h
MD5Parser.cpp
MD5Parser.h
)
ADD_ASSIMP_IMPORTER(MDC
ADD_ASSIMP_IMPORTER( MDC
MDCFileData.h
MDCLoader.cpp
MDCLoader.h
MDCNormalTable.h
)
ADD_ASSIMP_IMPORTER(MDL
ADD_ASSIMP_IMPORTER( MDL
MDLDefaultColorMap.h
MDLFileData.h
MDLLoader.cpp
@@ -314,22 +343,22 @@ SET( MaterialSystem_SRCS
)
SOURCE_GROUP( MaterialSystem FILES ${MaterialSystem_SRCS})
ADD_ASSIMP_IMPORTER(NFF
ADD_ASSIMP_IMPORTER( NFF
NFFLoader.cpp
NFFLoader.h
)
ADD_ASSIMP_IMPORTER(NDO
ADD_ASSIMP_IMPORTER( NDO
NDOLoader.cpp
NDOLoader.h
)
ADD_ASSIMP_IMPORTER(OFF
ADD_ASSIMP_IMPORTER( OFF
OFFLoader.cpp
OFFLoader.h
)
ADD_ASSIMP_IMPORTER(OBJ
ADD_ASSIMP_IMPORTER( OBJ
ObjFileData.h
ObjFileImporter.cpp
ObjFileImporter.h
@@ -338,12 +367,11 @@ ADD_ASSIMP_IMPORTER(OBJ
ObjFileParser.cpp
ObjFileParser.h
ObjTools.h
ObjExporter.h
ObjExporter.cpp
)
ADD_ASSIMP_IMPORTER(OGRE
ADD_ASSIMP_IMPORTER( OGRE
OgreImporter.h
OgreStructs.h
OgreParsingUtils.h
@@ -356,7 +384,7 @@ ADD_ASSIMP_IMPORTER(OGRE
OgreMaterial.cpp
)
ADD_ASSIMP_IMPORTER(OPENGEX
ADD_ASSIMP_IMPORTER( OPENGEX
OpenGEXExporter.cpp
OpenGEXExporter.h
OpenGEXImporter.cpp
@@ -364,7 +392,7 @@ ADD_ASSIMP_IMPORTER(OPENGEX
OpenGEXStructs.h
)
ADD_ASSIMP_IMPORTER(PLY
ADD_ASSIMP_IMPORTER( PLY
PlyLoader.cpp
PlyLoader.h
PlyParser.cpp
@@ -373,18 +401,18 @@ ADD_ASSIMP_IMPORTER(PLY
PlyExporter.h
)
ADD_ASSIMP_IMPORTER(MS3D
ADD_ASSIMP_IMPORTER( MS3D
MS3DLoader.cpp
MS3DLoader.h
)
ADD_ASSIMP_IMPORTER(COB
ADD_ASSIMP_IMPORTER( COB
COBLoader.cpp
COBLoader.h
COBScene.h
)
ADD_ASSIMP_IMPORTER(BLEND
ADD_ASSIMP_IMPORTER( BLEND
BlenderLoader.cpp
BlenderLoader.h
BlenderDNA.cpp
@@ -402,7 +430,7 @@ ADD_ASSIMP_IMPORTER(BLEND
BlenderTessellator.cpp
)
ADD_ASSIMP_IMPORTER(IFC
ADD_ASSIMP_IMPORTER( IFC
IFCLoader.cpp
IFCLoader.h
IFCReaderGen.cpp
@@ -421,14 +449,17 @@ ADD_ASSIMP_IMPORTER(IFC
STEPFileEncoding.cpp
STEPFileEncoding.h
)
if (MSVC AND ASSIMP_BUILD_IFC_IMPORTER)
set_source_files_properties(IFCReaderGen.cpp PROPERTIES COMPILE_FLAGS "/bigobj")
endif (MSVC AND ASSIMP_BUILD_IFC_IMPORTER)
ADD_ASSIMP_IMPORTER(XGL
ADD_ASSIMP_IMPORTER( XGL
XGLLoader.cpp
XGLLoader.h
)
ADD_ASSIMP_IMPORTER(FBX
ADD_ASSIMP_IMPORTER( FBX
FBXImporter.cpp
FBXCompileConfig.h
FBXImporter.h
@@ -445,6 +476,7 @@ ADD_ASSIMP_IMPORTER(FBX
FBXDocument.cpp
FBXProperties.h
FBXProperties.cpp
FBXMeshGeometry.h
FBXMeshGeometry.cpp
FBXMaterial.cpp
FBXModel.cpp
@@ -510,12 +542,12 @@ SET( PostProcessing_SRCS
)
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
ADD_ASSIMP_IMPORTER(Q3D
ADD_ASSIMP_IMPORTER( Q3D
Q3DLoader.cpp
Q3DLoader.h
)
ADD_ASSIMP_IMPORTER(Q3BSP
ADD_ASSIMP_IMPORTER( Q3BSP
Q3BSPFileData.h
Q3BSPFileParser.h
Q3BSPFileParser.cpp
@@ -525,34 +557,39 @@ ADD_ASSIMP_IMPORTER(Q3BSP
Q3BSPZipArchive.cpp
)
ADD_ASSIMP_IMPORTER(RAW
ADD_ASSIMP_IMPORTER( RAW
RawLoader.cpp
RawLoader.h
)
ADD_ASSIMP_IMPORTER(SMD
ADD_ASSIMP_IMPORTER( SIB
SIBImporter.cpp
SIBImporter.h
)
ADD_ASSIMP_IMPORTER( SMD
SMDLoader.cpp
SMDLoader.h
)
ADD_ASSIMP_IMPORTER(STL
ADD_ASSIMP_IMPORTER( STL
STLLoader.cpp
STLLoader.h
STLExporter.h
STLExporter.cpp
)
ADD_ASSIMP_IMPORTER(TERRAGEN
ADD_ASSIMP_IMPORTER( TERRAGEN
TerragenLoader.cpp
TerragenLoader.h
)
ADD_ASSIMP_IMPORTER(3D
ADD_ASSIMP_IMPORTER( 3D
UnrealLoader.cpp
UnrealLoader.h
)
ADD_ASSIMP_IMPORTER(X
ADD_ASSIMP_IMPORTER( X
XFileHelper.h
XFileImporter.cpp
XFileImporter.h
@@ -562,6 +599,26 @@ ADD_ASSIMP_IMPORTER(X
XFileExporter.cpp
)
ADD_ASSIMP_IMPORTER( GLTF
glTFAsset.h
glTFAsset.inl
glTFAssetWriter.h
glTFAssetWriter.inl
glTFImporter.cpp
glTFImporter.h
glTFExporter.h
glTFExporter.cpp
)
ADD_ASSIMP_IMPORTER( 3MF
D3MFImporter.h
D3MFImporter.cpp
D3MFOpcPackage.h
D3MFOpcPackage.cpp
)
SET( Step_SRCS
StepExporter.h
StepExporter.cpp
@@ -644,6 +701,8 @@ SET ( openddl_parser_SRCS
)
SOURCE_GROUP( openddl_parser FILES ${openddl_parser_SRCS})
INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" )
# VC2010 fixes
if(MSVC10)
option( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF )
@@ -689,13 +748,12 @@ SET( assimp_src
${Clipper_SRCS}
${openddl_parser_SRCS}
# Necessary to show the headers in the project when using the VC++ generator:
${Boost_SRCS}
${PUBLIC_HEADERS}
${COMPILER_HEADERS}
)
add_definitions( -DOPENDDLPARSER_BUILD )
ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD )
INCLUDE_DIRECTORIES(
../contrib/openddlparser/include
@@ -717,8 +775,8 @@ if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
endif(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARY})
TARGET_LINK_LIBRARIES(assimp debug ${C4D_DEBUG_LIBRARY})
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES})
TARGET_LINK_LIBRARIES(assimp debug ${C4D_DEBUG_LIBRARIES})
TARGET_LINK_LIBRARIES(assimp ${C4D_EXTRA_LIBRARIES})
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
@@ -736,8 +794,10 @@ if( MSVC )
set(MSVC_PREFIX "vc110")
elseif( MSVC12 )
set(MSVC_PREFIX "vc120")
elseif( MSVC14 )
set(MSVC_PREFIX "vc140")
else()
set(MSVC_PREFIX "vc130")
set(MSVC_PREFIX "vc150")
endif()
set(LIBRARY_SUFFIX "${ASSIMP_LIBRARY_SUFFIX}-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library")
endif()
@@ -749,7 +809,7 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES
)
if (APPLE)
SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR}")
endif()
# Build against external unzip, or add ../contrib/unzip so
@@ -758,7 +818,7 @@ if (UNZIP_FOUND)
INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES})
else (UNZIP_FOUND)
INCLUDE_DIRECTORIES("../contrib/unzip")
INCLUDE_DIRECTORIES("../")
endif (UNZIP_FOUND)
INSTALL( TARGETS assimp
@@ -769,13 +829,13 @@ INSTALL( TARGETS assimp
INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev)
INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev)
if (ASSIMP_ANDROID_JNIIOSYSTEM)
INSTALL(FILES ${HEADER_PATH}/../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/AndroidJNIIOSystem.h
INSTALL(FILES ${HEADER_PATH}/${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/AndroidJNIIOSystem.h
DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}
COMPONENT assimp-dev)
endif(ASSIMP_ANDROID_JNIIOSYSTEM)
if(MSVC AND ASSIMP_INSTALL_PDB)
install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${CMAKE_DEBUG_POSTFIX}.pdb
install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
CONFIGURATIONS Debug
)

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -53,19 +53,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "LineSplitter.h"
#include "TinyFormatter.h"
#include <boost/scoped_ptr.hpp>
#include <boost/foreach.hpp>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
using namespace Assimp;
using namespace Assimp::COB;
using namespace Assimp::Formatter;
#define for_each BOOST_FOREACH
static const float units[] = {
1000.f,
@@ -144,7 +141,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
COB::Scene scene;
boost::scoped_ptr<StreamReaderLE> stream(new StreamReaderLE( pIOHandler->Open(pFile,"rb")) );
std::unique_ptr<StreamReaderLE> stream(new StreamReaderLE( pIOHandler->Open(pFile,"rb")) );
// check header
char head[32];
@@ -170,17 +167,17 @@ void COBImporter::InternReadFile( const std::string& pFile,
}
// sort faces by material indices
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
for(std::shared_ptr< Node >& n : scene.nodes) {
if (n->type == Node::TYPE_MESH) {
Mesh& mesh = (Mesh&)(*n.get());
for_each(Face& f,mesh.faces) {
for(Face& f : mesh.faces) {
mesh.temp_map[f.material].push_back(&f);
}
}
}
// count meshes
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
for(std::shared_ptr< Node >& n : scene.nodes) {
if (n->type == Node::TYPE_MESH) {
Mesh& mesh = (Mesh&)(*n.get());
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
@@ -193,7 +190,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
pScene->mNumMeshes = 0;
// count lights and cameras
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
for(std::shared_ptr< Node >& n : scene.nodes) {
if (n->type == Node::TYPE_LIGHT) {
++pScene->mNumLights;
}
@@ -211,7 +208,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
pScene->mNumLights = pScene->mNumCameras = 0;
// resolve parents by their IDs and build the output graph
boost::scoped_ptr<Node> root(new Group());
std::unique_ptr<Node> root(new Group());
for(size_t n = 0; n < scene.nodes.size(); ++n) {
const Node& nn = *scene.nodes[n].get();
if(nn.parent_id==0) {
@@ -230,7 +227,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
}
// ------------------------------------------------------------------------------------------------
void ConvertTexture(boost::shared_ptr< Texture > tex, aiMaterial* out, aiTextureType type)
void ConvertTexture(std::shared_ptr< Texture > tex, aiMaterial* out, aiTextureType type)
{
const aiString path( tex->path );
out->AddProperty(&path,AI_MATKEY_TEXTURE(type,0));
@@ -251,10 +248,10 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) {
typedef std::pair<unsigned int,Mesh::FaceRefList> Entry;
for_each(const Entry& reflist,ndmesh.temp_map) {
for(const Entry& reflist : ndmesh.temp_map) {
{ // create mesh
size_t n = 0;
for_each(Face* f, reflist.second) {
for(Face* f : reflist.second) {
n += f->indices.size();
}
if (!n) {
@@ -267,7 +264,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
outmesh->mTextureCoords[0] = new aiVector3D[n];
outmesh->mFaces = new aiFace[reflist.second.size()]();
for_each(Face* f, reflist.second) {
for(Face* f : reflist.second) {
if (f->indices.empty()) {
continue;
}
@@ -275,7 +272,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
aiFace& fout = outmesh->mFaces[outmesh->mNumFaces++];
fout.mIndices = new unsigned int[f->indices.size()];
for_each(VertexIndex& v, f->indices) {
for(VertexIndex& v : f->indices) {
if (v.pos_idx >= ndmesh.vertex_positions.size()) {
ThrowException("Position index out of range");
}
@@ -295,13 +292,13 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
outmesh->mMaterialIndex = fill->mNumMaterials;
}{ // create material
const Material* min = NULL;
for_each(const Material& m, scin.materials) {
for(const Material& m : scin.materials) {
if (m.parent_id == ndmesh.id && m.matnum == reflist.first) {
min = &m;
break;
}
}
boost::scoped_ptr<const Material> defmat;
std::unique_ptr<const Material> defmat;
if(!min) {
DefaultLogger::get()->debug(format()<<"Could not resolve material index "
<<reflist.first<<" - creating default material for this slot");
@@ -396,7 +393,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
// add children recursively
nd->mChildren = new aiNode*[root.temp_children.size()]();
for_each(const Node* n, root.temp_children) {
for(const Node* n : root.temp_children) {
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n,scin,fill))->mParent = nd;
}
@@ -647,7 +644,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
// parent chunks preceede their childs, so we should have the
// corresponding chunk already.
for_each(boost::shared_ptr< Node >& nd, out.nodes) {
for(std::shared_ptr< Node >& nd : out.nodes) {
if (nd->id == nfo.parent_id) {
const unsigned int t=strtoul10(splitter[1]);
@@ -676,7 +673,7 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
return UnsupportedChunk_Ascii(splitter,nfo,"Lght");
}
out.nodes.push_back(boost::shared_ptr<Light>(new Light()));
out.nodes.push_back(std::shared_ptr<Light>(new Light()));
Light& msh = (Light&)(*out.nodes.back().get());
msh = nfo;
@@ -732,7 +729,7 @@ void COBImporter::ReadCame_Ascii(Scene& out, LineSplitter& splitter, const Chunk
return UnsupportedChunk_Ascii(splitter,nfo,"Came");
}
out.nodes.push_back(boost::shared_ptr<Camera>(new Camera()));
out.nodes.push_back(std::shared_ptr<Camera>(new Camera()));
Camera& msh = (Camera&)(*out.nodes.back().get());
msh = nfo;
@@ -750,7 +747,7 @@ void COBImporter::ReadBone_Ascii(Scene& out, LineSplitter& splitter, const Chunk
return UnsupportedChunk_Ascii(splitter,nfo,"Bone");
}
out.nodes.push_back(boost::shared_ptr<Bone>(new Bone()));
out.nodes.push_back(std::shared_ptr<Bone>(new Bone()));
Bone& msh = (Bone&)(*out.nodes.back().get());
msh = nfo;
@@ -766,7 +763,7 @@ void COBImporter::ReadGrou_Ascii(Scene& out, LineSplitter& splitter, const Chunk
return UnsupportedChunk_Ascii(splitter,nfo,"Grou");
}
out.nodes.push_back(boost::shared_ptr<Group>(new Group()));
out.nodes.push_back(std::shared_ptr<Group>(new Group()));
Group& msh = (Group&)(*out.nodes.back().get());
msh = nfo;
@@ -780,7 +777,7 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk
return UnsupportedChunk_Ascii(splitter,nfo,"PolH");
}
out.nodes.push_back(boost::shared_ptr<Mesh>(new Mesh()));
out.nodes.push_back(std::shared_ptr<Mesh>(new Mesh()));
Mesh& msh = (Mesh&)(*out.nodes.back().get());
msh = nfo;
@@ -903,7 +900,7 @@ void COBImporter::ReadBitM_Ascii(Scene& /*out*/, LineSplitter& splitter, const C
void COBImporter::ReadString_Binary(std::string& out, StreamReaderLE& reader)
{
out.resize( reader.GetI2());
for_each(char& c,out) {
for(char& c : out) {
c = reader.GetI1();
}
}
@@ -1036,21 +1033,21 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const
}
const chunk_guard cn(nfo,reader);
out.nodes.push_back(boost::shared_ptr<Mesh>(new Mesh()));
out.nodes.push_back(std::shared_ptr<Mesh>(new Mesh()));
Mesh& msh = (Mesh&)(*out.nodes.back().get());
msh = nfo;
ReadBasicNodeInfo_Binary(msh,reader,nfo);
msh.vertex_positions.resize(reader.GetI4());
for_each(aiVector3D& v,msh.vertex_positions) {
for(aiVector3D& v : msh.vertex_positions) {
v.x = reader.GetF4();
v.y = reader.GetF4();
v.z = reader.GetF4();
}
msh.texture_coords.resize(reader.GetI4());
for_each(aiVector2D& v,msh.texture_coords) {
for(aiVector2D& v : msh.texture_coords) {
v.x = reader.GetF4();
v.y = reader.GetF4();
}
@@ -1226,7 +1223,7 @@ void COBImporter::ReadCame_Binary(COB::Scene& out, StreamReaderLE& reader, const
const chunk_guard cn(nfo,reader);
out.nodes.push_back(boost::shared_ptr<Camera>(new Camera()));
out.nodes.push_back(std::shared_ptr<Camera>(new Camera()));
Camera& msh = (Camera&)(*out.nodes.back().get());
msh = nfo;
@@ -1249,7 +1246,7 @@ void COBImporter::ReadLght_Binary(COB::Scene& out, StreamReaderLE& reader, const
const chunk_guard cn(nfo,reader);
out.nodes.push_back(boost::shared_ptr<Light>(new Light()));
out.nodes.push_back(std::shared_ptr<Light>(new Light()));
Light& msh = (Light&)(*out.nodes.back().get());
msh = nfo;
@@ -1265,7 +1262,7 @@ void COBImporter::ReadGrou_Binary(COB::Scene& out, StreamReaderLE& reader, const
const chunk_guard cn(nfo,reader);
out.nodes.push_back(boost::shared_ptr<Group>(new Group()));
out.nodes.push_back(std::shared_ptr<Group>(new Group()));
Group& msh = (Group&)(*out.nodes.back().get());
msh = nfo;
@@ -1283,7 +1280,7 @@ void COBImporter::ReadUnit_Binary(COB::Scene& out, StreamReaderLE& reader, const
// parent chunks preceede their childs, so we should have the
// corresponding chunk already.
for_each(boost::shared_ptr< Node >& nd, out.nodes) {
for(std::shared_ptr< Node >& nd : out.nodes) {
if (nd->id == nfo.parent_id) {
const unsigned int t=reader.GetI2();
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_COB_SCENE_H
#define INCLUDED_AI_COB_SCENE_H
#include <boost/shared_ptr.hpp>
#include <memory>
#include <deque>
#include "BaseImporter.h"
@@ -237,7 +237,7 @@ struct Material : ChunkInfo
AutoFacet autofacet;
float autofacet_angle;
boost::shared_ptr<Texture> tex_env,tex_bump,tex_color;
std::shared_ptr<Texture> tex_env,tex_bump,tex_color;
};
// ------------------
@@ -254,7 +254,7 @@ struct Bitmap : ChunkInfo
std::vector<char> buff_zipped;
};
typedef std::deque< boost::shared_ptr<Node> > NodeList;
typedef std::deque< std::shared_ptr<Node> > NodeList;
typedef std::vector< Material > MaterialList;
// ------------------

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -51,12 +51,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SkeletonMeshBuilder.h"
#include "ParsingUtils.h"
#include "fast_atof.h"
#include "../include/assimp/Importer.hpp"
#include <boost/scoped_ptr.hpp>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/anim.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/Importer.hpp>
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/anim.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
using namespace Assimp;
@@ -122,7 +122,7 @@ void CSMImporter::SetupProperties(const Importer* pImp)
void CSMImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file
if( file.get() == NULL) {
@@ -227,7 +227,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
// read x,y,z
if(!SkipSpacesAndLineEnd(&buffer))
throw DeadlyImportError("CSM: Unexpected EOF occured reading sample x coord");
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample x coord");
if (TokenMatchI(buffer, "DROPOUT", 7)) {
// seems this is invalid marker data; at least the doc says it's possible
@@ -239,11 +239,11 @@ void CSMImporter::InternReadFile( const std::string& pFile,
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.x);
if(!SkipSpacesAndLineEnd(&buffer))
throw DeadlyImportError("CSM: Unexpected EOF occured reading sample y coord");
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample y coord");
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.y);
if(!SkipSpacesAndLineEnd(&buffer))
throw DeadlyImportError("CSM: Unexpected EOF occured reading sample z coord");
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample z coord");
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.z);
++s->mNumPositionKeys;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -108,7 +108,7 @@ void CalcTangentsProcess::Execute( aiScene* pScene)
}
// ------------------------------------------------------------------------------------------------
// Calculates tangents and bitangents for the given mesh
// Calculates tangents and bi-tangents for the given mesh
bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
{
// we assume that the mesh is still in the verbose vertex format where each face has its own set

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -49,13 +49,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SceneCombiner.h"
#include "DefaultIOSystem.h"
#include "XMLTools.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#include <assimp/scene.h>
#include "Exceptional.h"
#include <boost/scoped_ptr.hpp>
#include <memory>
#include <ctime>
#include <set>
@@ -75,7 +75,7 @@ void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* p
ColladaExporter iDoTheExportThing( pScene, pIOSystem, path, file);
// we're still here - export successfully completed. Write result to the given IOSYstem
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
if(outfile == NULL) {
throw DeadlyExportError("could not open output .dae file: " + std::string(pFile));
}
@@ -268,7 +268,7 @@ void ColladaExporter::WriteTextures() {
std::string name = mFile + "_texture_" + (i < 1000 ? "0" : "") + (i < 100 ? "0" : "") + (i < 10 ? "0" : "") + str + "." + ((const char*) texture->achFormatHint);
boost::scoped_ptr<IOStream> outfile(mIOSystem->Open(mPath + name, "wb"));
std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath + name, "wb"));
if(outfile == NULL) {
throw DeadlyExportError("could not open output texture file: " + mPath + name);
}
@@ -526,6 +526,13 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial*
}
}
// ------------------------------------------------------------------------------------------------
// Reimplementation of isalnum(,C locale), because AppVeyor does not see standard version.
static bool isalnum_C(char c)
{
return ( nullptr != strchr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c) );
}
// ------------------------------------------------------------------------------------------------
// Writes an image entry for the given surface
void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::string& pNameAdd)
@@ -540,7 +547,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( *it) || *it == '_' || *it == '.' || *it == '/' || *it == '\\' )
if( isalnum_C( (unsigned char) *it) || *it == ':' || *it == '_' || *it == '.' || *it == '/' || *it == '\\' )
imageUrlEncoded << *it;
else
imageUrlEncoded << '%' << std::hex << size_t( (unsigned char) *it) << std::dec;
@@ -629,11 +636,9 @@ void ColladaExporter::WriteMaterials()
aiString name;
if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
name = "mat";
materials[a].name = std::string( "m") + boost::lexical_cast<std::string> (a) + name.C_Str();
materials[a].name = std::string( "m") + std::to_string(a) + name.C_Str();
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
// isalnum on MSVC asserts for code points outside [0,255]. Thus prevent unwanted promotion
// of char to signed int and take the unsigned char value.
if( !isalnum( static_cast<uint8_t>(*it) ) ) {
if( !isalnum_C( *it ) ) {
*it = '_';
}
}
@@ -807,7 +812,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
{
if( mesh->HasTextureCoords( a) )
{
WriteFloatArray( idstr + "-tex" + boost::lexical_cast<std::string> (a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
WriteFloatArray( idstr + "-tex" + std::to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
(float*) mesh->mTextureCoords[a], mesh->mNumVertices);
}
}
@@ -816,7 +821,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
{
if( mesh->HasVertexColors( a) )
WriteFloatArray( idstr + "-color" + boost::lexical_cast<std::string> (a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices);
WriteFloatArray( idstr + "-color" + std::to_string(a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices);
}
// assemble vertex structure
@@ -867,7 +872,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
mOutput << startstr << "</lines>" << endstr;
}
// triangle - dont use it, because compatibility problems
// triangle - don't use it, because compatibility problems
// polygons
if (countPoly)
@@ -875,6 +880,11 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
mOutput << startstr << "<polylist count=\"" << countPoly << "\" material=\"defaultMaterial\">" << endstr;
PushTag();
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
{
if( mesh->HasTextureCoords( a) )
mOutput << startstr << "<input offset=\"0\" semantic=\"TEXCOORD\" source=\"#" << idstrEscaped << "-tex" << a << "\" set=\"" << a << "\" />" << endstr;
}
mOutput << startstr << "<vcount>";
for( size_t a = 0; a < mesh->mNumFaces; ++a )
@@ -1006,7 +1016,7 @@ void ColladaExporter::WriteSceneLibrary()
// start recursive write at the root node
for( size_t a = 0; a < mScene->mRootNode->mNumChildren; ++a )
WriteNode( mScene->mRootNode->mChildren[a]);
WriteNode( mScene, mScene->mRootNode->mChildren[a]);
PopTag();
mOutput << startstr << "</visual_scene>" << endstr;
@@ -1014,11 +1024,26 @@ void ColladaExporter::WriteSceneLibrary()
mOutput << startstr << "</library_visual_scenes>" << endstr;
}
// ------------------------------------------------------------------------------------------------
// Helper to find a bone by name in the scene
aiBone* findBone( const aiScene* scene, const char * name) {
for (size_t m=0; m<scene->mNumMeshes; m++) {
aiMesh * mesh = scene->mMeshes[m];
for (size_t b=0; b<mesh->mNumBones; b++) {
aiBone * bone = mesh->mBones[b];
if (0 == strcmp(name, bone->mName.C_Str())) {
return bone;
}
}
}
return NULL;
}
// ------------------------------------------------------------------------------------------------
// Recursively writes the given node
void ColladaExporter::WriteNode(aiNode* pNode)
void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
{
// the must have a name
// the node must have a name
if (pNode->mName.length == 0)
{
std::stringstream ss;
@@ -1026,12 +1051,25 @@ void ColladaExporter::WriteNode(aiNode* pNode)
pNode->mName.Set(ss.str());
}
// 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;
if (NULL == findBone(pScene, pNode->mName.C_Str())) {
node_type = "NODE";
} else {
node_type = "JOINT";
}
const std::string node_name_escaped = XMLEscape(pNode->mName.data);
mOutput << startstr << "<node id=\"" << node_name_escaped << "\" name=\"" << node_name_escaped << "\">" << endstr;
mOutput << startstr
<< "<node id=\"" << node_name_escaped
<< "\" name=\"" << node_name_escaped
<< "\" type=\"" << node_type
<< "\">" << endstr;
PushTag();
// write transformation - we can directly put the matrix there
// TODO: (thom) decompose into scale - rot - quad to allow adressing it by animations afterwards
// TODO: (thom) decompose into scale - rot - quad to allow addressing it by animations afterwards
const aiMatrix4x4& mat = pNode->mTransformation;
mOutput << startstr << "<matrix>";
mOutput << mat.a1 << " " << mat.a2 << " " << mat.a3 << " " << mat.a4 << " ";
@@ -1070,8 +1108,19 @@ void ColladaExporter::WriteNode(aiNode* pNode)
PushTag();
mOutput << startstr << "<technique_common>" << endstr;
PushTag();
mOutput << startstr << "<instance_material symbol=\"defaultMaterial\" target=\"#" << XMLEscape(materials[mesh->mMaterialIndex].name) << "\" />" << endstr;
PopTag();
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( 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;
@@ -1081,7 +1130,7 @@ void ColladaExporter::WriteNode(aiNode* pNode)
// recurse into subnodes
for( size_t a = 0; a < pNode->mNumChildren; ++a )
WriteNode( pNode->mChildren[a]);
WriteNode( pScene, pNode->mChildren[a]);
PopTag();
mOutput << startstr << "</node>" << endstr;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -44,15 +44,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_COLLADAEXPORTER_H_INC
#define AI_COLLADAEXPORTER_H_INC
#include "../include/assimp/ai_assert.h"
#include "../include/assimp/material.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/light.h"
#include "../include/assimp/Exporter.hpp"
#include <assimp/ai_assert.h>
#include <assimp/material.h>
#include <assimp/mesh.h>
#include <assimp/light.h>
#include <assimp/Exporter.hpp>
#include <sstream>
#include <vector>
#include <map>
#include <boost/lexical_cast.hpp>
struct aiScene;
struct aiNode;
@@ -115,7 +114,7 @@ protected:
void WriteSceneLibrary();
/// Recursively writes the given node
void WriteNode( aiNode* pNode);
void WriteNode( const aiScene* scene, aiNode* pNode);
/// Enters a new xml element, which increases the indentation
void PushTag() { startstr.append( " "); }
@@ -123,7 +122,7 @@ protected:
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 { return std::string( "meshId" ) + boost::lexical_cast<std::string> (pIndex); }
std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + std::to_string(pIndex); }
public:
/// Stringstream to write all output into

View File

@@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <vector>
#include <stdint.h>
#include "../include/assimp/light.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include <assimp/light.h>
#include <assimp/mesh.h>
#include <assimp/material.h>
struct aiMaterial;
@@ -517,6 +517,7 @@ struct Effect
float mTransparency;
bool mHasTransparency;
bool mRGBTransparency;
bool mInvertTransparency;
// local params referring to each other by their SID
typedef std::map<std::string, Collada::EffectParam> ParamLibrary;
@@ -536,10 +537,11 @@ struct Effect
, mTransparent ( 0, 0, 0, 1)
, mShininess (10.0f)
, mRefractIndex (1.f)
, mReflectivity (1.f)
, mReflectivity (0.f)
, mTransparency (1.f)
, mHasTransparency (false)
, mRGBTransparency(false)
, mInvertTransparency(false)
, mDoubleSided (false)
, mWireframe (false)
, mFaceted (false)
@@ -595,6 +597,48 @@ struct Animation
for( std::vector<Animation*>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it)
delete *it;
}
/** Collect all channels in the animation hierarchy into a single channel list. */
void CollectChannelsRecursively(std::vector<AnimationChannel> &channels)
{
channels.insert(channels.end(), mChannels.begin(), mChannels.end());
for (std::vector<Animation*>::iterator it = mSubAnims.begin(); it != mSubAnims.end(); ++it)
{
Animation *pAnim = (*it);
pAnim->CollectChannelsRecursively(channels);
}
}
/** Combine all single-channel animations' channel into the same (parent) animation channel list. */
void CombineSingleChannelAnimations()
{
CombineSingleChannelAnimationsRecursively(this);
}
void CombineSingleChannelAnimationsRecursively(Animation *pParent)
{
for (std::vector<Animation*>::iterator it = pParent->mSubAnims.begin(); it != pParent->mSubAnims.end();)
{
Animation *anim = *it;
CombineSingleChannelAnimationsRecursively(anim);
if (anim->mChannels.size() == 1)
{
pParent->mChannels.push_back(anim->mChannels[0]);
it = pParent->mSubAnims.erase(it);
delete anim;
}
else
{
++it;
}
}
}
};
/** Description of a collada animation channel which has been determined to affect the current node */

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -44,9 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include "ColladaLoader.h"
#include <assimp/anim.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Importer.hpp>
#include "ColladaParser.h"
#include "fast_atof.h"
@@ -55,14 +57,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Defines.h"
#include "time.h"
#include <boost/foreach.hpp>
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Importer.hpp"
#include "math.h"
#include <numeric>
#include "Defines.h"
using namespace Assimp;
using namespace Assimp::Formatter;
static const aiImporterDesc desc = {
"Collada Importer",
@@ -77,14 +78,21 @@ static const aiImporterDesc desc = {
"dae"
};
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ColladaLoader::ColladaLoader()
: noSkeletonMesh()
: mFileName()
, mMeshIndexByID()
, mMaterialIndexByName()
, mMeshes()
, newMats()
, mCameras()
, mLights()
, mTextures()
, mAnims()
, noSkeletonMesh( false )
, ignoreUpDirection(false)
, invertTransparency(false)
, mNodeNameCounter()
, mNodeNameCounter( 0 )
{}
// ------------------------------------------------------------------------------------------------
@@ -120,7 +128,6 @@ void ColladaLoader::SetupProperties(const Importer* pImp)
{
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0;
invertTransparency = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_INVERT_TRANSPARENCY,0) != 0;
}
@@ -269,21 +276,20 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
resolved.reserve(pNode->mNodeInstances.size());
// ... and iterate through all nodes to be instanced as children of pNode
for (std::vector<Collada::NodeInstance>::const_iterator it = pNode->mNodeInstances.begin(),
end = pNode->mNodeInstances.end(); it != end; ++it)
for (const auto &nodeInst: pNode->mNodeInstances)
{
// find the corresponding node in the library
const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find((*it).mNode);
const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find(nodeInst.mNode);
const Collada::Node* nd = itt == pParser.mNodeLibrary.end() ? NULL : (*itt).second;
// FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632
// need to check for both name and ID to catch all. To avoid breaking valid files,
// the workaround is only enabled when the first attempt to resolve the node has failed.
if (!nd) {
nd = FindNode(pParser.mRootNode,(*it).mNode);
nd = FindNode(pParser.mRootNode, nodeInst.mNode);
}
if (!nd)
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode);
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + nodeInst.mNode);
else {
// attach this node to the list of children
@@ -310,7 +316,7 @@ void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler
// Builds lights for the given node and references them
void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
{
BOOST_FOREACH( const Collada::LightInstance& lid, pNode->mLights)
for( const Collada::LightInstance& lid : pNode->mLights)
{
// find the referred light
ColladaParser::LightLibrary::const_iterator srcLightIt = pParser.mLightLibrary.find( lid.mLight);
@@ -378,7 +384,7 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
// Builds cameras for the given node and references them
void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
{
BOOST_FOREACH( const Collada::CameraInstance& cid, pNode->mCameras)
for( const Collada::CameraInstance& cid : pNode->mCameras)
{
// find the referred light
ColladaParser::CameraLibrary::const_iterator srcCameraIt = pParser.mCameraLibrary.find( cid.mCamera);
@@ -440,7 +446,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
newMeshRefs.reserve(pNode->mMeshes.size());
// add a mesh for each subgroup in each collada mesh
BOOST_FOREACH( const Collada::MeshInstance& mid, pNode->mMeshes)
for( const Collada::MeshInstance& mid : pNode->mMeshes)
{
const Collada::Mesh* srcMesh = NULL;
const Collada::Controller* srcController = NULL;
@@ -461,7 +467,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
if( !srcMesh)
{
DefaultLogger::get()->warn( boost::str( boost::format( "Collada: Unable to find geometry for ID \"%s\". Skipping.") % mid.mMeshOrController));
DefaultLogger::get()->warn( format() << "Collada: Unable to find geometry for ID \"" << mid.mMeshOrController << "\". Skipping." );
continue;
}
} else
@@ -490,7 +496,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
}
else
{
DefaultLogger::get()->warn( boost::str( boost::format( "Collada: No material specified for subgroup <%s> in geometry <%s>.") % submesh.mMaterial % mid.mMeshOrController));
DefaultLogger::get()->warn( format() << "Collada: No material specified for subgroup <" << submesh.mMaterial << "> in geometry <" << mid.mMeshOrController << ">." );
if( !mid.mMaterials.empty() )
meshMaterial = mid.mMaterials.begin()->second.mMatName;
}
@@ -656,7 +662,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
// joint vertex_weight name list - should refer to the same list as the joint names above. If not, report and reconsider
const Collada::Accessor& weightNamesAcc = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, pSrcController->mWeightInputJoints.mAccessor);
if( &weightNamesAcc != &jointNamesAcc)
throw DeadlyImportError( "Temporary implementational lazyness. If you read this, please report to the author.");
throw DeadlyImportError( "Temporary implementational laziness. If you read this, please report to the author.");
// vertex weights
const Collada::Accessor& weightsAcc = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, pSrcController->mWeightInputWeights.mAccessor);
const Collada::Data& weights = pParser.ResolveLibraryReference( pParser.mDataLibrary, weightsAcc.mSource);
@@ -778,7 +784,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
if( bnode)
bone->mName.Set( FindNameForNode( bnode));
else
DefaultLogger::get()->warn( boost::str( boost::format( "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"%s\".") % bone->mName.data));
DefaultLogger::get()->warn( format() << "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"" << bone->mName.data << "\"." );
// and insert bone
dstMesh->mBones[boneCount++] = bone;
@@ -998,7 +1004,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
else if( subElement == "Z")
entry.mSubElement = 2;
else
DefaultLogger::get()->warn( boost::str( boost::format( "Unknown anim subelement <%s>. Ignoring") % subElement));
DefaultLogger::get()->warn( format() << "Unknown anim subelement <" << subElement << ">. Ignoring" );
} else
{
// no subelement following, transformId is remaining string
@@ -1076,7 +1082,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
// time count and value count must match
if( e.mTimeAccessor->mCount != e.mValueAccessor->mCount)
throw DeadlyImportError( boost::str( boost::format( "Time count / value count mismatch in animation channel \"%s\".") % e.mChannel->mTarget));
throw DeadlyImportError( format() << "Time count / value count mismatch in animation channel \"" << e.mChannel->mTarget << "\"." );
if( e.mTimeAccessor->mCount > 0 )
{
@@ -1141,7 +1147,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
// Calculate resulting transformation
aiMatrix4x4 mat = pParser.CalculateResultTransform( transforms);
// out of lazyness: we store the time in matrix.d4
// out of laziness: we store the time in matrix.d4
mat.d4 = time;
resultTrafos.push_back( mat);
@@ -1149,13 +1155,13 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
float nextTime = 1e20f;
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
{
Collada::ChannelEntry& e = *it;
Collada::ChannelEntry& channelElement = *it;
// find the next time value larger than the current
size_t pos = 0;
while( pos < e.mTimeAccessor->mCount)
while( pos < channelElement.mTimeAccessor->mCount)
{
float t = ReadFloat( *e.mTimeAccessor, *e.mTimeData, pos, 0);
const float t = ReadFloat( *channelElement.mTimeAccessor, *channelElement.mTimeData, pos, 0);
if( t > time)
{
nextTime = std::min( nextTime, t);
@@ -1163,6 +1169,25 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
}
++pos;
}
// https://github.com/assimp/assimp/issues/458
// Sub-sample axis-angle channels if the delta between two consecutive
// key-frame angles is >= 180 degrees.
if (transforms[channelElement.mTransformIndex].mType == Collada::TF_ROTATE && channelElement.mSubElement == 3 && pos > 0 && pos < channelElement.mTimeAccessor->mCount) {
const float cur_key_angle = ReadFloat(*channelElement.mValueAccessor, *channelElement.mValueData, pos, 0);
const float last_key_angle = ReadFloat(*channelElement.mValueAccessor, *channelElement.mValueData, pos - 1, 0);
const float cur_key_time = ReadFloat(*channelElement.mTimeAccessor, *channelElement.mTimeData, pos, 0);
const float last_key_time = ReadFloat(*channelElement.mTimeAccessor, *channelElement.mTimeData, pos - 1, 0);
const float last_eval_angle = last_key_angle + (cur_key_angle - last_key_angle) * (time - last_key_time) / (cur_key_time - last_key_time);
const float delta = std::fabs(cur_key_angle - last_eval_angle);
if (delta >= 180.0f) {
const int subSampleCount = static_cast<int>(floorf(delta / 90.0f));
if (cur_key_time != time) {
const float nextSampleTime = time + (cur_key_time - time) / subSampleCount;
nextTime = std::min(nextTime, nextSampleTime);
}
}
}
}
// no more keys on any channel after the current time -> we're done
@@ -1268,7 +1293,7 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
_AI_MATKEY_TEXBLEND_BASE, type, idx);
// UV source index ... if we didn't resolve the mapping, it is actually just
// a guess but it works in most cases. We search for the frst occurence of a
// a guess but it works in most cases. We search for the frst occurrence of a
// number in the channel name. We assume it is the zero-based index into the
// UV channel array of all corresponding meshes. It could also be one-based
// for some exporters, but we won't care of it unless someone complains about.
@@ -1294,11 +1319,10 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
// Fills materials from the collada material definitions
void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pScene*/)
{
for (std::vector<std::pair<Collada::Effect*, aiMaterial*> >::iterator it = newMats.begin(),
end = newMats.end(); it != end; ++it)
for (auto &elem : newMats)
{
aiMaterial& mat = (aiMaterial&)*it->second;
Collada::Effect& effect = *it->first;
aiMaterial& mat = (aiMaterial&)*elem.second;
Collada::Effect& effect = *elem.first;
// resolve shading mode
int shadeMode;
@@ -1341,7 +1365,6 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
mat.AddProperty( &effect.mDiffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
mat.AddProperty( &effect.mSpecular, 1,AI_MATKEY_COLOR_SPECULAR);
mat.AddProperty( &effect.mEmissive, 1, AI_MATKEY_COLOR_EMISSIVE);
mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT);
mat.AddProperty( &effect.mReflective, 1, AI_MATKEY_COLOR_REFLECTIVE);
// scalar properties
@@ -1354,20 +1377,29 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
// therefore, we let the opportunity for the user to manually invert
// the transparency if necessary and we add preliminary support for RGB_ZERO mode
if(effect.mTransparency >= 0.f && effect.mTransparency <= 1.f) {
// Trying some support for RGB_ZERO mode
// handle RGB transparency completely, cf Collada specs 1.5.0 pages 249 and 304
if(effect.mRGBTransparency) {
effect.mTransparency = 1.f - effect.mTransparent.a;
// use luminance as defined by ISO/CIE color standards (see ITU-R Recommendation BT.709-4)
effect.mTransparency *= (
0.212671f * effect.mTransparent.r +
0.715160f * effect.mTransparent.g +
0.072169f * effect.mTransparent.b
);
effect.mTransparent.a = 1.f;
mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
} else {
effect.mTransparency *= effect.mTransparent.a;
}
// Global option
if(invertTransparency) {
if(effect.mInvertTransparency) {
effect.mTransparency = 1.f - effect.mTransparency;
}
// Is the material finally transparent ?
if (effect.mHasTransparency || effect.mTransparency < 1.f) {
mat.AddProperty( &effect.mTransparency, 1, AI_MATKEY_OPACITY );
mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
}
}
@@ -1465,8 +1497,8 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name);
if( imIt == pParser.mImageLibrary.end())
{
throw DeadlyImportError( boost::str( boost::format(
"Collada: Unable to resolve effect texture entry \"%s\", ended up at ID \"%s\".") % pName % name));
throw DeadlyImportError( format() <<
"Collada: Unable to resolve effect texture entry \"" << pName << "\", ended up at ID \"" << name << "\"." );
}
aiString result;
@@ -1632,7 +1664,7 @@ std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
{
// No need to worry. Unnamed nodes are no problem at all, except
// if cameras or lights need to be assigned to them.
return boost::str( boost::format( "$ColladaAutoName$_%d") % mNodeNameCounter++);
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
}
}

View File

@@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -241,7 +241,6 @@ protected:
bool noSkeletonMesh;
bool ignoreUpDirection;
bool invertTransparency;
/** Used by FindNameForNode() to generate unique node names */
unsigned int mNodeNameCounter;

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -51,38 +51,57 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ColladaParser.h"
#include "fast_atof.h"
#include "ParsingUtils.h"
#include <boost/scoped_ptr.hpp>
#include <boost/foreach.hpp>
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/light.h"
#include "StringUtils.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/light.h>
#include "TinyFormatter.h"
#include <memory>
using namespace Assimp;
using namespace Assimp::Collada;
using namespace Assimp::Formatter;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ColladaParser::ColladaParser( IOSystem* pIOHandler, const std::string& pFile)
: mFileName( pFile)
: mFileName( pFile )
, mReader( NULL )
, mDataLibrary()
, mAccessorLibrary()
, mMeshLibrary()
, mNodeLibrary()
, mImageLibrary()
, mEffectLibrary()
, mMaterialLibrary()
, mLightLibrary()
, mCameraLibrary()
, mControllerLibrary()
, mRootNode( NULL )
, mAnims()
, mUnitSize( 1.0f )
, mUpDirection( UP_Y )
, mFormat(FV_1_5_n ) // We assume the newest file format by default
{
mRootNode = NULL;
mUnitSize = 1.0f;
mUpDirection = UP_Y;
// validate io-handler instance
if ( NULL == pIOHandler ) {
throw DeadlyImportError("IOSystem is NULL." );
}
// We assume the newest file format by default
mFormat = FV_1_5_n;
// open the file
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
if( file.get() == NULL)
throw DeadlyImportError( "Failed to open file " + pFile + ".");
// open the file
std::unique_ptr<IOStream> file( pIOHandler->Open(pFile ) );
if (file.get() == NULL) {
throw DeadlyImportError( "Failed to open file " + pFile + "." );
}
// generate a XML reader for it
boost::scoped_ptr<CIrrXML_IOStreamReader> mIOWrapper( new CIrrXML_IOStreamReader( file.get()));
std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
mReader = irr::io::createIrrXMLReader( mIOWrapper.get());
if( !mReader)
ThrowException( "Collada: Unable to open file.");
if (!mReader) {
ThrowException("Collada: Unable to open file.");
}
// start reading
ReadContents();
@@ -148,7 +167,7 @@ void ColladaParser::ReadContents()
ReadStructure();
} else
{
DefaultLogger::get()->debug( boost::str( boost::format( "Ignoring global element <%s>.") % mReader->getNodeName()));
DefaultLogger::get()->debug( format() << "Ignoring global element <" << mReader->getNodeName() << ">." );
SkipElement();
}
} else
@@ -171,6 +190,8 @@ void ColladaParser::ReadStructure()
ReadAssetInfo();
else if( IsElement( "library_animations"))
ReadAnimationLibrary();
else if (IsElement("library_animation_clips"))
ReadAnimationClipLibrary();
else if( IsElement( "library_controllers"))
ReadControllerLibrary();
else if( IsElement( "library_images"))
@@ -199,6 +220,8 @@ void ColladaParser::ReadStructure()
break;
}
}
PostProcessRootAnimations();
}
// ------------------------------------------------------------------------------------------------
@@ -255,6 +278,131 @@ void ColladaParser::ReadAssetInfo()
}
}
// ------------------------------------------------------------------------------------------------
// Reads the animation clips
void ColladaParser::ReadAnimationClipLibrary()
{
if (mReader->isEmptyElement())
return;
while (mReader->read())
{
if (mReader->getNodeType() == irr::io::EXN_ELEMENT)
{
if (IsElement("animation_clip"))
{
// optional name given as an attribute
std::string animName;
int indexName = TestAttribute("name");
int indexID = TestAttribute("id");
if (indexName >= 0)
animName = mReader->getAttributeValue(indexName);
else if (indexID >= 0)
animName = mReader->getAttributeValue(indexID);
else
animName = std::string("animation_") + std::to_string(mAnimationClipLibrary.size());
std::pair<std::string, std::vector<std::string> > clip;
clip.first = animName;
while (mReader->read())
{
if (mReader->getNodeType() == irr::io::EXN_ELEMENT)
{
if (IsElement("instance_animation"))
{
int indexUrl = TestAttribute("url");
if (indexUrl >= 0)
{
const char* url = mReader->getAttributeValue(indexUrl);
if (url[0] != '#')
ThrowException("Unknown reference format");
url++;
clip.second.push_back(url);
}
}
else
{
// ignore the rest
SkipElement();
}
}
else if (mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{
if (strcmp(mReader->getNodeName(), "animation_clip") != 0)
ThrowException("Expected end of <animation_clip> element.");
break;
}
}
if (clip.second.size() > 0)
{
mAnimationClipLibrary.push_back(clip);
}
}
else
{
// ignore the rest
SkipElement();
}
}
else if (mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{
if (strcmp(mReader->getNodeName(), "library_animation_clips") != 0)
ThrowException("Expected end of <library_animation_clips> element.");
break;
}
}
}
// ------------------------------------------------------------------------------------------------
// Re-build animations from animation clip library, if present, otherwise combine single-channel animations
void ColladaParser::PostProcessRootAnimations()
{
if (mAnimationClipLibrary.size() > 0)
{
Animation temp;
for (AnimationClipLibrary::iterator it = mAnimationClipLibrary.begin(); it != mAnimationClipLibrary.end(); ++it)
{
std::string clipName = it->first;
Animation *clip = new Animation();
clip->mName = clipName;
temp.mSubAnims.push_back(clip);
for (std::vector<std::string>::iterator a = it->second.begin(); a != it->second.end(); ++a)
{
std::string animationID = *a;
AnimationLibrary::iterator animation = mAnimationLibrary.find(animationID);
if (animation != mAnimationLibrary.end())
{
Animation *pSourceAnimation = animation->second;
pSourceAnimation->CollectChannelsRecursively(clip->mChannels);
}
}
}
mAnims = temp;
// Ensure no double deletes.
temp.mSubAnims.clear();
}
else
{
mAnims.CombineSingleChannelAnimations();
}
}
// ------------------------------------------------------------------------------------------------
// Reads the animation library
void ColladaParser::ReadAnimationLibrary()
@@ -302,12 +450,17 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
// optional name given as an attribute
std::string animName;
std::string animID;
int indexName = TestAttribute( "name");
int indexID = TestAttribute( "id");
if (indexID >= 0)
animID = mReader->getAttributeValue(indexID);
if( indexName >= 0)
animName = mReader->getAttributeValue( indexName);
else if( indexID >= 0)
animName = mReader->getAttributeValue( indexID);
animName = animID;
else
animName = "animation";
@@ -379,11 +532,19 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
// it turned out to have channels - add them
if( !channels.empty())
{
// FIXME: Is this essentially doing the same as "single-anim-node" codepath in
// ColladaLoader::StoreAnimations? For now, this has been deferred to after
// all animations and all clips have been read. Due to handling of
// <library_animation_clips> this cannot be done here, as the channel owner
// is lost, and some exporters make up animations by referring to multiple
// single-channel animations from an <instance_animation>.
/*
// special filtering for stupid exporters packing each channel into a separate animation
if( channels.size() == 1)
{
pParent->mChannels.push_back( channels.begin()->second);
} else
*/
{
// else create the animation, if not done yet, and store the channels
if( !anim)
@@ -394,6 +555,11 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
}
for( ChannelMap::const_iterator it = channels.begin(); it != channels.end(); ++it)
anim->mChannels.push_back( it->second);
if (indexID >= 0)
{
mAnimationLibrary[animID] = anim;
}
}
}
}
@@ -453,7 +619,7 @@ void ColladaParser::ReadControllerLibrary()
{
if( IsElement( "controller"))
{
// read ID. Ask the spec if it's neccessary or optional... you might be surprised.
// read ID. Ask the spec if it's necessary or optional... you might be surprised.
int attrID = GetAttribute( "id");
std::string id = mReader->getAttributeValue( attrID);
@@ -562,7 +728,7 @@ void ColladaParser::ReadControllerJoints( Collada::Controller& pController)
// local URLS always start with a '#'. We don't support global URLs
if( attrSource[0] != '#')
ThrowException( boost::str( boost::format( "Unsupported URL format in \"%s\" in source attribute of <joints> data <input> element") % attrSource));
ThrowException( format() << "Unsupported URL format in \"" << attrSource << "\" in source attribute of <joints> data <input> element" );
attrSource++;
// parse source URL to corresponding source
@@ -571,7 +737,7 @@ void ColladaParser::ReadControllerJoints( Collada::Controller& pController)
else if( strcmp( attrSemantic, "INV_BIND_MATRIX") == 0)
pController.mJointOffsetMatrixSource = attrSource;
else
ThrowException( boost::str( boost::format( "Unknown semantic \"%s\" in <joints> data <input> element") % attrSemantic));
ThrowException( format() << "Unknown semantic \"" << attrSemantic << "\" in <joints> data <input> element" );
// skip inner data, if present
if( !mReader->isEmptyElement())
@@ -621,7 +787,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
// local URLS always start with a '#'. We don't support global URLs
if( attrSource[0] != '#')
ThrowException( boost::str( boost::format( "Unsupported URL format in \"%s\" in source attribute of <vertex_weights> data <input> element") % attrSource));
ThrowException( format() << "Unsupported URL format in \"" << attrSource << "\" in source attribute of <vertex_weights> data <input> element" );
channel.mAccessor = attrSource + 1;
// parse source URL to corresponding source
@@ -630,7 +796,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
else if( strcmp( attrSemantic, "WEIGHT") == 0)
pController.mWeightInputWeights = channel;
else
ThrowException( boost::str( boost::format( "Unknown semantic \"%s\" in <vertex_weights> data <input> element") % attrSemantic));
ThrowException( format() << "Unknown semantic \"" << attrSemantic << "\" in <vertex_weights> data <input> element" );
// skip inner data, if present
if( !mReader->isEmptyElement())
@@ -832,7 +998,7 @@ void ColladaParser::ReadMaterialLibrary()
{
if( IsElement( "material"))
{
// read ID. By now you propably know my opinion about this "specification"
// read ID. By now you probably know my opinion about this "specification"
int attrID = GetAttribute( "id");
std::string id = mReader->getAttributeValue( attrID);
@@ -890,7 +1056,7 @@ void ColladaParser::ReadLightLibrary()
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
if( IsElement( "light"))
{
// read ID. By now you propably know my opinion about this "specification"
// read ID. By now you probably know my opinion about this "specification"
int attrID = GetAttribute( "id");
std::string id = mReader->getAttributeValue( attrID);
@@ -924,7 +1090,7 @@ void ColladaParser::ReadCameraLibrary()
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
if( IsElement( "camera"))
{
// read ID. By now you propably know my opinion about this "specification"
// read ID. By now you probably know my opinion about this "specification"
int attrID = GetAttribute( "id");
std::string id = mReader->getAttributeValue( attrID);
@@ -1240,12 +1406,17 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
else if( IsElement( "transparent")) {
pEffect.mHasTransparency = true;
// In RGB_ZERO mode, the transparency is interpreted in reverse, go figure...
if(::strcmp(mReader->getAttributeValueSafe("opaque"), "RGB_ZERO") == 0) {
// TODO: handle RGB_ZERO mode completely
const char* opaque = mReader->getAttributeValueSafe("opaque");
if(::strcmp(opaque, "RGB_ZERO") == 0 || ::strcmp(opaque, "RGB_ONE") == 0) {
pEffect.mRGBTransparency = true;
}
// In RGB_ZERO mode, the transparency is interpreted in reverse, go figure...
if(::strcmp(opaque, "RGB_ZERO") == 0 || ::strcmp(opaque, "A_ZERO") == 0) {
pEffect.mInvertTransparency = true;
}
ReadEffectColor( pEffect.mTransparent,pEffect.mTexTransparent);
}
else if( IsElement( "shininess"))
@@ -1509,7 +1680,7 @@ void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam)
// don't care for remaining stuff
SkipElement( "surface");
}
else if( IsElement( "sampler2D"))
else if( IsElement( "sampler2D") && (FV_1_4_n == mFormat || FV_1_3_n == mFormat))
{
// surface ID is given inside <source> tags
TestOpening( "source");
@@ -1520,6 +1691,19 @@ void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam)
// don't care for remaining stuff
SkipElement( "sampler2D");
}
else if( IsElement( "sampler2D"))
{
// surface ID is given inside <instance_image> tags
TestOpening( "instance_image");
int attrURL = GetAttribute("url");
const char* url = mReader->getAttributeValue( attrURL);
if( url[0] != '#')
ThrowException( "Unsupported URL format in instance_image");
url++;
pParam.mType = Param_Sampler;
pParam.mReference = url;
SkipElement( "sampler2D");
} else
{
// ignore unknown element
@@ -1782,7 +1966,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
int attrSource = GetAttribute( "source");
const char* source = mReader->getAttributeValue( attrSource);
if( source[0] != '#')
ThrowException( boost::str( boost::format( "Unknown reference format in url \"%s\" in source attribute of <accessor> element.") % source));
ThrowException( format() << "Unknown reference format in url \"" << source << "\" in source attribute of <accessor> element." );
int attrCount = GetAttribute( "count");
unsigned int count = (unsigned int) mReader->getAttributeValueAsInt( attrCount);
int attrOffset = TestAttribute( "offset");
@@ -1841,7 +2025,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
else if( name == "U") acc.mSubOffset[0] = acc.mParams.size();
else if( name == "V") acc.mSubOffset[1] = acc.mParams.size();
//else
// DefaultLogger::get()->warn( boost::str( boost::format( "Unknown accessor parameter \"%s\". Ignoring data channel.") % name));
// DefaultLogger::get()->warn( format() << "Unknown accessor parameter \"" << name << "\". Ignoring data channel." );
}
// read data type
@@ -1864,7 +2048,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
SkipElement();
} else
{
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <accessor>") % mReader->getNodeName()));
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <accessor>" );
}
}
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
@@ -1894,7 +2078,7 @@ void ColladaParser::ReadVertexData( Mesh* pMesh)
ReadInputChannel( pMesh->mPerVertexData);
} else
{
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <vertices>") % mReader->getNodeName()));
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <vertices>" );
}
}
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
@@ -1947,7 +2131,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
ai_assert( primType != Prim_Invalid);
// also a number of <input> elements, but in addition a <p> primitive collection and propably index counts for all primitives
// also a number of <input> elements, but in addition a <p> primitive collection and probably index counts for all primitives
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
@@ -1992,13 +2176,13 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
SkipElement("extra");
} else
{
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <%s>") % mReader->getNodeName() % elementName));
ThrowException( format() << "Unexpected sub element <" << mReader->getNodeName() << "> in tag <" << elementName << ">" );
}
}
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{
if( mReader->getNodeName() != elementName)
ThrowException( boost::str( boost::format( "Expected end of <%s> element.") % elementName));
ThrowException( format() << "Expected end of <" << elementName << "> element." );
break;
}
@@ -2031,7 +2215,7 @@ void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
int attrSource = GetAttribute( "source");
const char* source = mReader->getAttributeValue( attrSource);
if( source[0] != '#')
ThrowException( boost::str( boost::format( "Unknown reference format in url \"%s\" in source attribute of <input> element.") % source));
ThrowException( format() << "Unknown reference format in url \"" << source << "\" in source attribute of <input> element." );
channel.mAccessor = source+1; // skipping the leading #, hopefully the remaining text is the accessor ID only
// read index offset, if per-index <input>
@@ -2045,7 +2229,7 @@ void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
if(attrSet > -1){
attrSet = mReader->getAttributeValueAsInt( attrSet);
if(attrSet < 0)
ThrowException( boost::str( boost::format( "Invalid index \"%i\" in set attribute of <input> element") % (attrSet)));
ThrowException( format() << "Invalid index \"" << (attrSet) << "\" in set attribute of <input> element" );
channel.mIndex = attrSet;
}
@@ -2068,7 +2252,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
// find the offset index for all per-vertex channels
size_t numOffsets = 1;
size_t perVertexOffset = SIZE_MAX; // invalid value
BOOST_FOREACH( const InputChannel& channel, pPerIndexChannels)
for( const InputChannel& channel : pPerIndexChannels)
{
numOffsets = std::max( numOffsets, channel.mOffset+1);
if( channel.mType == IT_Vertex)
@@ -2081,7 +2265,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
{
case Prim_Polylist:
{
BOOST_FOREACH( size_t i, pVCount)
for( size_t i : pVCount)
expectedPointCount += i;
break;
}
@@ -2101,7 +2285,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
if( expectedPointCount > 0)
indices.reserve( expectedPointCount * numOffsets);
if (pNumPrimitives > 0) // It is possible to not contain any indicies
if (pNumPrimitives > 0) // It is possible to not contain any indices
{
const char* content = GetTextContent();
while( *content != 0)
@@ -2136,7 +2320,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
// find accessor
input.mResolved = &ResolveLibraryReference( mAccessorLibrary, input.mAccessor);
// resolve accessor's data pointer as well, if neccessary
// resolve accessor's data pointer as well, if necessary
const Accessor* acc = input.mResolved;
if( !acc->mData)
acc->mData = &ResolveLibraryReference( mDataLibrary, acc->mSource);
@@ -2159,7 +2343,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
// find accessor
input.mResolved = &ResolveLibraryReference( mAccessorLibrary, input.mAccessor);
// resolve accessor's data pointer as well, if neccessary
// resolve accessor's data pointer as well, if necessary
const Accessor* acc = input.mResolved;
if( !acc->mData)
acc->mData = &ResolveLibraryReference( mDataLibrary, acc->mSource);
@@ -2269,7 +2453,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
const Accessor& acc = *pInput.mResolved;
if( pLocalIndex >= acc.mCount)
ThrowException( boost::str( boost::format( "Invalid data index (%d/%d) in primitive specification") % pLocalIndex % acc.mCount));
ThrowException( format() << "Invalid data index (" << pLocalIndex << "/" << acc.mCount << ") in primitive specification" );
// get a pointer to the start of the data object referred to by the accessor and the local index
const float* dataObject = &(acc.mData->mValues[0]) + acc.mOffset + pLocalIndex* acc.mStride;
@@ -2695,7 +2879,7 @@ void ColladaParser::ReadScene()
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) {
if( IsElement( "instance_visual_scene"))
{
// should be the first and only occurence
// should be the first and only occurrence
if( mRootNode)
ThrowException( "Invalid scene containing multiple root nodes in <instance_visual_scene> element");
@@ -2724,19 +2908,19 @@ void ColladaParser::ReadScene()
// Aborts the file reading with an exception
AI_WONT_RETURN void ColladaParser::ThrowException( const std::string& pError) const
{
throw DeadlyImportError( boost::str( boost::format( "Collada: %s - %s") % mFileName % pError));
throw DeadlyImportError( format() << "Collada: " << mFileName << " - " << pError );
}
void ColladaParser::ReportWarning(const char* msg,...)
{
ai_assert(NULL != msg);
va_list args;
va_start(args,msg);
char szBuffer[3000];
const int iLen = vsprintf(szBuffer,msg,args);
ai_assert(iLen > 0);
va_end(args);
DefaultLogger::get()->warn("Validation warning: " + std::string(szBuffer,iLen));
}
@@ -2775,14 +2959,14 @@ void ColladaParser::TestOpening( const char* pName)
{
// read element start
if( !mReader->read())
ThrowException( boost::str( boost::format( "Unexpected end of file while beginning of <%s> element.") % pName));
ThrowException( format() << "Unexpected end of file while beginning of <" << pName << "> element." );
// whitespace in front is ok, just read again if found
if( mReader->getNodeType() == irr::io::EXN_TEXT)
if( !mReader->read())
ThrowException( boost::str( boost::format( "Unexpected end of file while reading beginning of <%s> element.") % pName));
ThrowException( format() << "Unexpected end of file while reading beginning of <" << pName << "> element." );
if( mReader->getNodeType() != irr::io::EXN_ELEMENT || strcmp( mReader->getNodeName(), pName) != 0)
ThrowException( boost::str( boost::format( "Expected start of <%s> element.") % pName));
ThrowException( format() << "Expected start of <" << pName << "> element." );
}
// ------------------------------------------------------------------------------------------------
@@ -2795,15 +2979,15 @@ void ColladaParser::TestClosing( const char* pName)
// if not, read some more
if( !mReader->read())
ThrowException( boost::str( boost::format( "Unexpected end of file while reading end of <%s> element.") % pName));
ThrowException( format() << "Unexpected end of file while reading end of <" << pName << "> element." );
// whitespace in front is ok, just read again if found
if( mReader->getNodeType() == irr::io::EXN_TEXT)
if( !mReader->read())
ThrowException( boost::str( boost::format( "Unexpected end of file while reading end of <%s> element.") % pName));
ThrowException( format() << "Unexpected end of file while reading end of <" << pName << "> element." );
// but this has the be the closing tag, or we're lost
if( mReader->getNodeType() != irr::io::EXN_ELEMENT_END || strcmp( mReader->getNodeName(), pName) != 0)
ThrowException( boost::str( boost::format( "Expected end of <%s> element.") % pName));
ThrowException( format() << "Expected end of <" << pName << "> element." );
}
// ------------------------------------------------------------------------------------------------
@@ -2815,7 +2999,7 @@ int ColladaParser::GetAttribute( const char* pAttr) const
return index;
// attribute not found -> throw an exception
ThrowException( boost::str( boost::format( "Expected attribute \"%s\" for element <%s>.") % pAttr % mReader->getNodeName()));
ThrowException( format() << "Expected attribute \"" << pAttr << "\" for element <" << mReader->getNodeName() << ">." );
return -1;
}
@@ -2933,24 +3117,29 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
// ------------------------------------------------------------------------------------------------
// Determines the input data type for the given semantic string
Collada::InputType ColladaParser::GetTypeForSemantic( const std::string& pSemantic)
Collada::InputType ColladaParser::GetTypeForSemantic( const std::string& semantic)
{
if( pSemantic == "POSITION")
if ( semantic.empty() ) {
DefaultLogger::get()->warn( format() << "Vertex input type is empty." );
return IT_Invalid;
}
if( semantic == "POSITION")
return IT_Position;
else if( pSemantic == "TEXCOORD")
else if( semantic == "TEXCOORD")
return IT_Texcoord;
else if( pSemantic == "NORMAL")
else if( semantic == "NORMAL")
return IT_Normal;
else if( pSemantic == "COLOR")
else if( semantic == "COLOR")
return IT_Color;
else if( pSemantic == "VERTEX")
else if( semantic == "VERTEX")
return IT_Vertex;
else if( pSemantic == "BINORMAL" || pSemantic == "TEXBINORMAL")
else if( semantic == "BINORMAL" || semantic == "TEXBINORMAL")
return IT_Bitangent;
else if( pSemantic == "TANGENT" || pSemantic == "TEXTANGENT")
else if( semantic == "TANGENT" || semantic == "TEXTANGENT")
return IT_Tangent;
DefaultLogger::get()->warn( boost::str( boost::format( "Unknown vertex input type \"%s\". Ignoring.") % pSemantic));
DefaultLogger::get()->warn( format() << "Unknown vertex input type \"" << semantic << "\". Ignoring." );
return IT_Invalid;
}

View File

@@ -1,28 +1,28 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,7 +34,7 @@
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
@@ -47,12 +47,13 @@
#include "irrXMLWrapper.h"
#include "ColladaHelper.h"
#include "../include/assimp/ai_assert.h"
#include <boost/format.hpp>
#include <assimp/ai_assert.h>
#include "TinyFormatter.h"
#include <memory>
namespace Assimp
{
// ------------------------------------------------------------------------------------------
/** Parser helper class for the Collada loader.
*
@@ -62,156 +63,162 @@ namespace Assimp
class ColladaParser
{
friend class ColladaLoader;
protected:
/** Constructor from XML file */
ColladaParser( IOSystem* pIOHandler, const std::string& pFile);
/** Destructor */
~ColladaParser();
/** Reads the contents of the file */
void ReadContents();
/** Reads the structure of the file */
void ReadStructure();
/** Reads asset informations such as coordinate system informations and legal blah */
void ReadAssetInfo();
/** Reads the animation library */
void ReadAnimationLibrary();
/** Reads the animation clip library */
void ReadAnimationClipLibrary();
/** Re-build animations from animation clip library, if present, otherwise combine single-channel animations */
void PostProcessRootAnimations();
/** Reads an animation into the given parent structure */
void ReadAnimation( Collada::Animation* pParent);
/** Reads an animation sampler into the given anim channel */
void ReadAnimationSampler( Collada::AnimationChannel& pChannel);
/** Reads the skeleton controller library */
void ReadControllerLibrary();
/** Reads a controller into the given mesh structure */
void ReadController( Collada::Controller& pController);
/** Reads the joint definitions for the given controller */
void ReadControllerJoints( Collada::Controller& pController);
/** Reads the joint weights for the given controller */
void ReadControllerWeights( Collada::Controller& pController);
/** Reads the image library contents */
void ReadImageLibrary();
/** Reads an image entry into the given image */
void ReadImage( Collada::Image& pImage);
/** Reads the material library */
void ReadMaterialLibrary();
/** Reads a material entry into the given material */
void ReadMaterial( Collada::Material& pMaterial);
/** Reads the camera library */
void ReadCameraLibrary();
/** Reads a camera entry into the given camera */
void ReadCamera( Collada::Camera& pCamera);
/** Reads the light library */
void ReadLightLibrary();
/** Reads a light entry into the given light */
void ReadLight( Collada::Light& pLight);
/** Reads the effect library */
void ReadEffectLibrary();
/** Reads an effect entry into the given effect*/
void ReadEffect( Collada::Effect& pEffect);
/** Reads an COMMON effect profile */
void ReadEffectProfileCommon( Collada::Effect& pEffect);
/** Read sampler properties */
void ReadSamplerProperties( Collada::Sampler& pSampler);
/** Reads an effect entry containing a color or a texture defining that color */
void ReadEffectColor( aiColor4D& pColor, Collada::Sampler& pSampler);
/** Reads an effect entry containing a float */
void ReadEffectFloat( float& pFloat);
/** Reads an effect parameter specification of any kind */
void ReadEffectParam( Collada::EffectParam& pParam);
/** Reads the geometry library contents */
void ReadGeometryLibrary();
/** Reads a geometry from the geometry library. */
void ReadGeometry( Collada::Mesh* pMesh);
/** Reads a mesh from the geometry library */
void ReadMesh( Collada::Mesh* pMesh);
/** Reads a source element - a combination of raw data and an accessor defining
* things that should not be redefinable. Yes, that's another rant.
*/
void ReadSource();
/** Reads a data array holding a number of elements, and stores it in the global library.
* Currently supported are array of floats and arrays of strings.
*/
void ReadDataArray();
/** Reads an accessor and stores it in the global library under the given ID -
* accessors use the ID of the parent <source> element
*/
void ReadAccessor( const std::string& pID);
/** Reads input declarations of per-vertex mesh data into the given mesh */
void ReadVertexData( Collada::Mesh* pMesh);
/** Reads input declarations of per-index mesh data into the given mesh */
void ReadIndexData( Collada::Mesh* pMesh);
/** Reads a single input channel element and stores it in the given array, if valid */
void ReadInputChannel( std::vector<Collada::InputChannel>& poChannels);
/** Reads a <p> primitive index list and assembles the mesh data into the given mesh */
size_t ReadPrimitives( Collada::Mesh* pMesh, std::vector<Collada::InputChannel>& pPerIndexChannels,
size_t pNumPrimitives, const std::vector<size_t>& pVCount, Collada::PrimitiveType pPrimType);
/** Copies the data for a single primitive into the mesh, based on the InputChannels */
void CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset,
Collada::Mesh* pMesh, std::vector<Collada::InputChannel>& pPerIndexChannels,
size_t currentPrimitive, const std::vector<size_t>& indices);
/** Reads one triangle of a tristrip into the mesh */
void ReadPrimTriStrips(size_t numOffsets, size_t perVertexOffset, Collada::Mesh* pMesh,
std::vector<Collada::InputChannel>& pPerIndexChannels, size_t currentPrimitive, const std::vector<size_t>& indices);
/** Extracts a single object from an input channel and stores it in the appropriate mesh data array */
void ExtractDataObjectFromChannel( const Collada::InputChannel& pInput, size_t pLocalIndex, Collada::Mesh* pMesh);
/** Reads the library of node hierarchies and scene parts */
void ReadSceneLibrary();
/** Reads a scene node's contents including children and stores it in the given node */
void ReadSceneNode( Collada::Node* pNode);
/** Reads a node transformation entry of the given type and adds it to the given node's transformation list. */
void ReadNodeTransformation( Collada::Node* pNode, Collada::TransformType pType);
/** Reads a mesh reference in a node and adds it to the node's mesh list */
void ReadNodeGeometry( Collada::Node* pNode);
/** Reads the collada scene */
void ReadScene();
// Processes bind_vertex_input and bind elements
void ReadMaterialVertexInputBinding( Collada::SemanticMappingTable& tbl);
protected:
/** Aborts the file reading with an exception */
AI_WONT_RETURN void ThrowException( const std::string& pError) const AI_WONT_RETURN_SUFFIX;
@@ -219,116 +226,124 @@ namespace Assimp
/** Skips all data until the end node of the current element */
void SkipElement();
/** Skips all data until the end node of the given element */
void SkipElement( const char* pElement);
/** Compares the current xml element name to the given string and returns true if equal */
bool IsElement( const char* pName) const;
/** Tests for the opening tag of the given element, throws an exception if not found */
void TestOpening( const char* pName);
/** Tests for the closing tag of the given element, throws an exception if not found */
void TestClosing( const char* pName);
/** Checks the present element for the presence of the attribute, returns its index
or throws an exception if not found */
int GetAttribute( const char* pAttr) const;
/** Returns the index of the named attribute or -1 if not found. Does not throw,
therefore useful for optional attributes */
int TestAttribute( const char* pAttr) const;
/** Reads the text contents of an element, throws an exception if not given.
Skips leading whitespace. */
const char* GetTextContent();
/** Reads the text contents of an element, returns NULL if not given.
Skips leading whitespace. */
const char* TestTextContent();
/** Reads a single bool from current text content */
bool ReadBoolFromTextContent();
/** Reads a single float from current text content */
float ReadFloatFromTextContent();
/** Calculates the resulting transformation from all the given transform steps */
aiMatrix4x4 CalculateResultTransform( const std::vector<Collada::Transform>& pTransforms) const;
/** Determines the input data type for the given semantic string */
Collada::InputType GetTypeForSemantic( const std::string& pSemantic);
/** Finds the item in the given library by its reference, throws if not found */
template <typename Type> const Type& ResolveLibraryReference(
const std::map<std::string, Type>& pLibrary, const std::string& pURL) const;
protected:
/** Filename, for a verbose error message */
std::string mFileName;
/** XML reader, member for everyday use */
irr::io::IrrXMLReader* mReader;
/** All data arrays found in the file by ID. Might be referred to by actually
everyone. Collada, you are a steaming pile of indirection. */
typedef std::map<std::string, Collada::Data> DataLibrary;
DataLibrary mDataLibrary;
/** Same for accessors which define how the data in a data array is accessed. */
typedef std::map<std::string, Collada::Accessor> AccessorLibrary;
AccessorLibrary mAccessorLibrary;
/** Mesh library: mesh by ID */
typedef std::map<std::string, Collada::Mesh*> MeshLibrary;
MeshLibrary mMeshLibrary;
/** node library: root node of the hierarchy part by ID */
typedef std::map<std::string, Collada::Node*> NodeLibrary;
NodeLibrary mNodeLibrary;
/** Image library: stores texture properties by ID */
typedef std::map<std::string, Collada::Image> ImageLibrary;
ImageLibrary mImageLibrary;
/** Effect library: surface attributes by ID */
typedef std::map<std::string, Collada::Effect> EffectLibrary;
EffectLibrary mEffectLibrary;
/** Material library: surface material by ID */
typedef std::map<std::string, Collada::Material> MaterialLibrary;
MaterialLibrary mMaterialLibrary;
/** Light library: surface light by ID */
typedef std::map<std::string, Collada::Light> LightLibrary;
LightLibrary mLightLibrary;
/** Camera library: surface material by ID */
typedef std::map<std::string, Collada::Camera> CameraLibrary;
CameraLibrary mCameraLibrary;
/** Controller library: joint controllers by ID */
typedef std::map<std::string, Collada::Controller> ControllerLibrary;
ControllerLibrary mControllerLibrary;
/** Animation library: animation references by ID */
typedef std::map<std::string, Collada::Animation*> AnimationLibrary;
AnimationLibrary mAnimationLibrary;
/** Animation clip library: clip animation references by ID */
typedef std::vector<std::pair<std::string, std::vector<std::string> > > AnimationClipLibrary;
AnimationClipLibrary mAnimationClipLibrary;
/** Pointer to the root node. Don't delete, it just points to one of
the nodes in the node library. */
Collada::Node* mRootNode;
/** Root animation container */
Collada::Animation mAnims;
/** Size unit: how large compared to a meter */
float mUnitSize;
/** Which is the up vector */
enum { UP_X, UP_Y, UP_Z } mUpDirection;
/** Collada file format version */
Collada::FormatVersion mFormat;
};
// ------------------------------------------------------------------------------------------------
// Check for element match
inline bool ColladaParser::IsElement( const char* pName) const
@@ -336,7 +351,7 @@ namespace Assimp
ai_assert( mReader->getNodeType() == irr::io::EXN_ELEMENT);
return ::strcmp( mReader->getNodeName(), pName) == 0;
}
// ------------------------------------------------------------------------------------------------
// Finds the item in the given library by its reference, throws if not found
template <typename Type>
@@ -344,10 +359,10 @@ namespace Assimp
{
typename std::map<std::string, Type>::const_iterator it = pLibrary.find( pURL);
if( it == pLibrary.end())
ThrowException( boost::str( boost::format( "Unable to resolve library reference \"%s\".") % pURL));
ThrowException( Formatter::format() << "Unable to resolve library reference \"" << pURL << "\"." );
return it->second;
}
} // end of namespace Assimp
#endif // AI_COLLADAPARSER_H_INC

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -412,7 +412,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
{
if (!DefaultLogger::isNullLogger())
{
sprintf(buffer, "Found non-UV mapped texture (%s,%u). Mapping type: %s",
ai_snprintf(buffer, 1024, "Found non-UV mapped texture (%s,%u). Mapping type: %s",
TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex,
MappingTypeToString(mapping));

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -44,14 +44,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_COMPUTEUVMAPPING_H_INC
#include "BaseProcess.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include "../include/assimp/types.h"
#include <assimp/mesh.h>
#include <assimp/material.h>
#include <assimp/types.h>
class ComputeUVMappingTest;
namespace Assimp
{
namespace Assimp {
// ---------------------------------------------------------------------------
/** ComputeUVMappingProcess - converts special mappings, such as spherical,

View File

@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
@@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ConvertToLHProcess.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/postprocess.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_CONVERTTOLHPROCESS_H_INC
#define AI_CONVERTTOLHPROCESS_H_INC
#include "../include/assimp/types.h"
#include <assimp/types.h>
#include "BaseProcess.h"
struct aiMesh;

388
code/D3MFImporter.cpp Normal file
View File

@@ -0,0 +1,388 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#include "D3MFImporter.h"
#include <assimp/scene.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <contrib/unzip/unzip.h>
#include "irrXMLWrapper.h"
#include "StringComparison.h"
#include "StringUtils.h"
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <memory>
#include <assimp/ai_assert.h>
#include "D3MFOpcPackage.h"
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
namespace Assimp {
namespace D3MF {
namespace XmlTag {
const std::string model = "model";
const std::string metadata = "metadata";
const std::string resources = "resources";
const std::string object = "object";
const std::string mesh = "mesh";
const std::string vertices = "vertices";
const std::string vertex = "vertex";
const std::string triangles = "triangles";
const std::string triangle = "triangle";
const std::string x = "x";
const std::string y = "y";
const std::string z = "z";
const std::string v1 = "v1";
const std::string v2 = "v2";
const std::string v3 = "v3";
const std::string id = "id";
const std::string name = "name";
const std::string type = "type";
const std::string build = "build";
const std::string item = "item";
const std::string objectid = "objectid";
const std::string transform = "transform";
}
class XmlSerializer
{
public:
XmlSerializer(XmlReader* xmlReader)
: xmlReader(xmlReader)
{
}
void ImportXml(aiScene* scene)
{
scene->mFlags |= AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
scene->mRootNode = new aiNode();
std::vector<aiNode*> children;
while(ReadToEndElement(D3MF::XmlTag::model))
{
if(xmlReader->getNodeName() == D3MF::XmlTag::object)
{
children.push_back(ReadObject(scene));
}
else if(xmlReader->getNodeName() == D3MF::XmlTag::build)
{
}
}
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]();
std::copy(meshes.begin(), meshes.end(), scene->mMeshes);
scene->mRootNode->mNumChildren = static_cast<unsigned int>(children.size());
scene->mRootNode->mChildren = new aiNode*[scene->mRootNode->mNumChildren]();
std::copy(children.begin(), children.end(), scene->mRootNode->mChildren);
}
private:
aiNode* ReadObject(aiScene* scene)
{
ScopeGuard<aiNode> node(new aiNode());
std::vector<unsigned long> meshIds;
int id = std::atoi(xmlReader->getAttributeValue(D3MF::XmlTag::id.c_str()));
std::string name(xmlReader->getAttributeValue(D3MF::XmlTag::name.c_str()));
std::string type(xmlReader->getAttributeValue(D3MF::XmlTag::type.c_str()));
node->mParent = scene->mRootNode;
node->mName.Set(name);
unsigned long meshIdx = meshes.size();
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(meshIdx);
meshIdx++;
}
}
node->mNumMeshes = static_cast<unsigned int>(meshIds.size());
node->mMeshes = new unsigned int[node->mNumMeshes];
std::copy(meshIds.begin(), meshIds.end(), node->mMeshes);
return node.dismiss();
}
aiMesh* ReadMesh()
{
aiMesh* mesh = new aiMesh();
while(ReadToEndElement(D3MF::XmlTag::mesh))
{
if(xmlReader->getNodeName() == D3MF::XmlTag::vertices)
{
ImportVertices(mesh);
}
else if(xmlReader->getNodeName() == D3MF::XmlTag::triangles)
{
ImportTriangles(mesh);
}
}
return mesh;
}
void ImportVertices(aiMesh* mesh)
{
std::vector<aiVector3D> vertices;
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()
{
aiVector3D vertex;
vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
vertex.y = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr);
vertex.z = ai_strtof>(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr);
return vertex;
}
void ImportTriangles(aiMesh* mesh)
{
std::vector<aiFace> faces;
while(ReadToEndElement(D3MF::XmlTag::triangles))
{
if(xmlReader->getNodeName() == D3MF::XmlTag::triangle)
{
faces.push_back(ReadTriangle());
}
}
mesh->mNumFaces = static_cast<unsigned int>(faces.size());
mesh->mFaces = new aiFace[mesh->mNumFaces];
mesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
std::copy(faces.begin(), faces.end(), mesh->mFaces);
}
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())));
face.mIndices[1] = static_cast<unsigned int>(std::atoi(xmlReader->getAttributeValue(D3MF::XmlTag::v2.c_str())));
face.mIndices[2] = static_cast<unsigned int>(std::atoi(xmlReader->getAttributeValue(D3MF::XmlTag::v3.c_str())));
return face;
}
private:
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)
{
return false;
}
}
//DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
return false;
}
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)
{
return false;
}
}
DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag");
return false;
}
private:
std::vector<aiMesh*> meshes;
XmlReader* xmlReader;
};
} //namespace D3MF
static const aiImporterDesc desc = {
"3mf Importer",
"",
"",
"http://3mf.io/",
aiImporterFlags_SupportBinaryFlavour | aiImporterFlags_SupportCompressedFlavour,
0,
0,
0,
0,
"3mf"
};
D3MFImporter::D3MFImporter()
{
}
D3MFImporter::~D3MFImporter()
{
}
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
{
const std::string extension = GetExtension(pFile);
if(extension == "3mf")
{
return true;
}
else if(!extension.length() || checkSig)
{
if(!pIOHandler)
return true;
}
return false;
}
void D3MFImporter::SetupProperties(const Importer *pImp)
{
}
const aiImporterDesc *D3MFImporter::GetInfo() const
{
return &desc;
}
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()));
std::unique_ptr<D3MF::XmlReader> xmlReader(irr::io::createIrrXMLReader(xmlStream.get()));
D3MF::XmlSerializer xmlSerializer(xmlReader.get());
xmlSerializer.ImportXml(pScene);
}
}
#endif // ASSIMP_BUILD_NO_3MF_IMPORTER

68
code/D3MFImporter.h Normal file
View File

@@ -0,0 +1,68 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#ifndef AI_D3MFLOADER_H_INCLUDED
#define AI_D3MFLOADER_H_INCLUDED
#include <vector>
#include <cstdint>
#include "BaseImporter.h"
namespace Assimp {
class D3MFImporter : public BaseImporter
{
public:
D3MFImporter();
~D3MFImporter();
// BaseImporter interface
public:
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
void SetupProperties(const Importer *pImp);
const aiImporterDesc *GetInfo() const;
protected:
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
};
}
#endif // AI_D3MFLOADER_H_INCLUDED

592
code/D3MFOpcPackage.cpp Normal file
View File

@@ -0,0 +1,592 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#include "D3MFOpcPackage.h"
#include "Exceptional.h"
#include <contrib/unzip/unzip.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/ai_assert.h>
#include <memory>
#include <vector>
#include <map>
#include <algorithm>
#include <cassert>
#include <cstdlib>
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
namespace Assimp {
namespace D3MF {
namespace XmlTag {
const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
const std::string RELS_RELATIONSHIP_NODE = "Relationship";
const std::string RELS_ATTRIB_TARGET = "Target";
const std::string RELS_ATTRIB_TYPE = "Type";
const std::string RELS_ATTRIB_ID = "Id";
const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
}
class IOSystem2Unzip {
public:
static voidpf open(voidpf opaque, const char* filename, int mode);
static uLong read(voidpf opaque, voidpf stream, void* buf, uLong size);
static uLong write(voidpf opaque, voidpf stream, const void* buf, uLong size);
static long tell(voidpf opaque, voidpf stream);
static long seek(voidpf opaque, voidpf stream, uLong offset, int origin);
static int close(voidpf opaque, voidpf stream);
static int testerror(voidpf opaque, voidpf stream);
static zlib_filefunc_def get(IOSystem* pIOHandler);
};
voidpf IOSystem2Unzip::open(voidpf opaque, const char* filename, int mode) {
IOSystem* io_system = reinterpret_cast<IOSystem*>(opaque);
const char* mode_fopen = NULL;
if((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) {
mode_fopen = "rb";
} else {
if(mode & ZLIB_FILEFUNC_MODE_EXISTING) {
mode_fopen = "r+b";
} else {
if(mode & ZLIB_FILEFUNC_MODE_CREATE) {
mode_fopen = "wb";
}
}
}
return (voidpf) io_system->Open(filename, mode_fopen);
}
uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Read(buf, 1, size);
}
uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Write(buf, 1, size);
}
long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
IOStream* io_stream = (IOStream*) stream;
return io_stream->Tell();
}
long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {
IOStream* io_stream = (IOStream*) stream;
aiOrigin assimp_origin;
switch (origin) {
default:
case ZLIB_FILEFUNC_SEEK_CUR:
assimp_origin = aiOrigin_CUR;
break;
case ZLIB_FILEFUNC_SEEK_END:
assimp_origin = aiOrigin_END;
break;
case ZLIB_FILEFUNC_SEEK_SET:
assimp_origin = aiOrigin_SET;
break;
}
return (io_stream->Seek(offset, assimp_origin) == aiReturn_SUCCESS ? 0 : -1);
}
int IOSystem2Unzip::close(voidpf opaque, voidpf stream) {
IOSystem* io_system = (IOSystem*) opaque;
IOStream* io_stream = (IOStream*) stream;
io_system->Close(io_stream);
return 0;
}
int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) {
return 0;
}
zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) {
zlib_filefunc_def mapping;
mapping.zopen_file = open;
mapping.zread_file = read;
mapping.zwrite_file = write;
mapping.ztell_file = tell;
mapping.zseek_file = seek;
mapping.zclose_file = close;
mapping.zerror_file = testerror;
mapping.opaque = reinterpret_cast<voidpf>(pIOHandler);
return mapping;
}
class ZipFile : public IOStream
{
friend class D3MFZipArchive;
public:
explicit ZipFile(size_t size);
~ZipFile();
size_t Read(void* pvBuffer, size_t pSize, size_t pCount );
size_t Write(const void* /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/);
size_t FileSize() const;
aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/);
size_t Tell() const;
void Flush();
private:
void* m_Buffer;
size_t m_Size;
};
ZipFile::ZipFile(size_t size) : m_Size(size) {
ai_assert(m_Size != 0);
m_Buffer = malloc(m_Size);
}
ZipFile::~ZipFile() {
free(m_Buffer);
m_Buffer = NULL;
}
size_t ZipFile::Read(void* pvBuffer, size_t pSize, size_t pCount) {
const size_t size = pSize * pCount;
assert(size <= m_Size);
std::memcpy(pvBuffer, m_Buffer, size);
return size;
}
size_t ZipFile::Write(const void* /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) {
return 0;
}
size_t ZipFile::FileSize() const {
return m_Size;
}
aiReturn ZipFile::Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) {
return aiReturn_FAILURE;
}
size_t ZipFile::Tell() const {
return 0;
}
void ZipFile::Flush() {
// empty
}
class D3MFZipArchive : public IOSystem
{
public:
static const unsigned int FileNameSize = 256;
public:
D3MFZipArchive(IOSystem* pIOHandler, const std::string & rFile);
~D3MFZipArchive();
bool Exists(const char* pFile) const;
char getOsSeparator() const;
IOStream* Open(const char* pFile, const char* pMode = "rb");
void Close(IOStream* pFile);
bool isOpen() const;
void getFileList(std::vector<std::string> &rFileList);
private:
bool mapArchive();
private:
unzFile m_ZipFileHandle;
std::map<std::string, ZipFile*> m_ArchiveMap;
};
// ------------------------------------------------------------------------------------------------
// Constructor.
D3MFZipArchive::D3MFZipArchive(IOSystem* pIOHandler, const std::string& rFile)
: m_ZipFileHandle(NULL), m_ArchiveMap()
{
if (! rFile.empty())
{
zlib_filefunc_def mapping = IOSystem2Unzip::get(pIOHandler);
m_ZipFileHandle = unzOpen2(rFile.c_str(), &mapping);
if(m_ZipFileHandle != NULL) {
mapArchive();
}
}
}
// ------------------------------------------------------------------------------------------------
// Destructor.
D3MFZipArchive::~D3MFZipArchive() {
for(auto &file : m_ArchiveMap) {
delete file.second;
}
m_ArchiveMap.clear();
if(m_ZipFileHandle != NULL) {
unzClose(m_ZipFileHandle);
m_ZipFileHandle = NULL;
}
}
// ------------------------------------------------------------------------------------------------
// Returns true, if the archive is already open.
bool D3MFZipArchive::isOpen() const {
return (m_ZipFileHandle != NULL);
}
// ------------------------------------------------------------------------------------------------
// Returns true, if the filename is part of the archive.
bool D3MFZipArchive::Exists(const char* pFile) const {
ai_assert(pFile != NULL);
bool exist = false;
if (pFile != NULL) {
std::string rFile(pFile);
std::map<std::string, ZipFile*>::const_iterator it = m_ArchiveMap.find(rFile);
if(it != m_ArchiveMap.end()) {
exist = true;
}
}
return exist;
}
// ------------------------------------------------------------------------------------------------
// Returns the separator delimiter.
char D3MFZipArchive::getOsSeparator() const {
#ifndef _WIN32
return '/';
#else
return '\\';
#endif
}
// ------------------------------------------------------------------------------------------------
// Opens a file, which is part of the archive.
IOStream *D3MFZipArchive::Open(const char* pFile, const char* /*pMode*/) {
ai_assert(pFile != NULL);
IOStream* result = NULL;
std::map<std::string, ZipFile*>::iterator it = m_ArchiveMap.find(pFile);
if(it != m_ArchiveMap.end()) {
result = static_cast<IOStream*>(it->second);
}
return result;
}
// ------------------------------------------------------------------------------------------------
// Close a filestream.
void D3MFZipArchive::Close(IOStream *pFile) {
ai_assert(pFile != NULL);
// We don't do anything in case the file would be opened again in the future
}
// ------------------------------------------------------------------------------------------------
// Returns the file-list of the archive.
void D3MFZipArchive::getFileList(std::vector<std::string> &rFileList) {
rFileList.clear();
for(const auto &file : m_ArchiveMap) {
rFileList.push_back(file.first);
}
}
// ------------------------------------------------------------------------------------------------
// Maps the archive content.
bool D3MFZipArchive::mapArchive() {
bool success = false;
if(m_ZipFileHandle != NULL) {
if(m_ArchiveMap.empty()) {
// At first ensure file is already open
if(unzGoToFirstFile(m_ZipFileHandle) == UNZ_OK) {
// Loop over all files
do {
char filename[FileNameSize];
unz_file_info fileInfo;
if(unzGetCurrentFileInfo(m_ZipFileHandle, &fileInfo, filename, FileNameSize, NULL, 0, NULL, 0) == UNZ_OK) {
// The file has EXACTLY the size of uncompressed_size. In C
// you need to mark the last character with '\0', so add
// another character
if(fileInfo.uncompressed_size != 0 && unzOpenCurrentFile(m_ZipFileHandle) == UNZ_OK) {
std::pair<std::map<std::string, ZipFile*>::iterator, bool> result = m_ArchiveMap.insert(std::make_pair(filename, new ZipFile(fileInfo.uncompressed_size)));
if(unzReadCurrentFile(m_ZipFileHandle, result.first->second->m_Buffer, fileInfo.uncompressed_size) == (long int) fileInfo.uncompressed_size) {
if(unzCloseCurrentFile(m_ZipFileHandle) == UNZ_OK) {
// Nothing to do anymore...
}
}
}
}
} while(unzGoToNextFile(m_ZipFileHandle) != UNZ_END_OF_LIST_OF_FILE);
}
}
success = true;
}
return success;
}
// ------------------------------------------------------------------------------------------------
struct OpcPackageRelationship
{
std::string id;
std::string type;
std::string target;
};
typedef std::shared_ptr<OpcPackageRelationship> OpcPackageRelationshipPtr;
class OpcPackageRelationshipReader
{
public:
OpcPackageRelationshipReader(XmlReader* xmlReader)
{
while(xmlReader->read())
{
if(xmlReader->getNodeType() == irr::io::EXN_ELEMENT &&
xmlReader->getNodeName() == XmlTag::RELS_RELATIONSHIP_CONTAINER)
{
ParseRootNode(xmlReader);
}
}
}
void ParseRootNode(XmlReader* xmlReader)
{
ParseAttributes(xmlReader);
while(xmlReader->read())
{
if(xmlReader->getNodeType() == irr::io::EXN_ELEMENT &&
xmlReader->getNodeName() == XmlTag::RELS_RELATIONSHIP_NODE)
{
ParseChildNode(xmlReader);
}
}
}
void ParseAttributes(XmlReader*)
{
}
void ParseChildNode(XmlReader* xmlReader)
{
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
relPtr->id = xmlReader->getAttributeValue(XmlTag::RELS_ATTRIB_ID.c_str());
relPtr->type = xmlReader->getAttributeValue(XmlTag::RELS_ATTRIB_TYPE.c_str());
relPtr->target = xmlReader->getAttributeValue(XmlTag::RELS_ATTRIB_TARGET.c_str());
m_relationShips.push_back(relPtr);
}
std::vector<OpcPackageRelationshipPtr> m_relationShips;
};
// ------------------------------------------------------------------------------------------------
D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
: m_RootStream(nullptr)
{
zipArchive.reset(new D3MF::D3MFZipArchive( pIOHandler, rFile ));
if(!zipArchive->isOpen())
throw DeadlyImportError("Failed to open file " + rFile+ ".");
std::vector<std::string> fileList;
zipArchive->getFileList(fileList);
for(auto& file: fileList){
if(file == D3MF::XmlTag::ROOT_RELATIONSHIPS_ARCHIVE)
{
//PkgRelationshipReader pkgRelReader(file, archive);
ai_assert(zipArchive->Exists(file.c_str()));
IOStream *fileStream = zipArchive->Open(file.c_str());
ai_assert(fileStream != nullptr);
std::string rootFile = ReadPackageRootRelationship(fileStream);
if(rootFile.size() > 0 && rootFile[0] == '/')
rootFile = rootFile.substr(1);
DefaultLogger::get()->debug(rootFile);
m_RootStream = zipArchive->Open(rootFile.c_str());
ai_assert(m_RootStream != nullptr);
// const size_t size = zipArchive->FileSize();
// m_Data.resize( size );
// const size_t readSize = pMapFile->Read( &m_Data[0], sizeof( char ), size );
// if ( readSize != size )
// {
// m_Data.clear();
// return false;
// }
zipArchive->Close( fileStream );
}
else if( file == D3MF::XmlTag::CONTENT_TYPES_ARCHIVE)
{
}
}
}
D3MFOpcPackage::~D3MFOpcPackage()
{
}
IOStream* D3MFOpcPackage::RootStream() const
{
return m_RootStream;
}
std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream* stream)
{
std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(stream));
std::unique_ptr<XmlReader> xml(irr::io::createIrrXMLReader(xmlStream.get()));
OpcPackageRelationshipReader reader(xml.get());
auto itr = std::find_if(reader.m_relationShips.begin(), reader.m_relationShips.end(), [](const OpcPackageRelationshipPtr& rel){
return rel->type == XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE;
});
if(itr == reader.m_relationShips.end())
throw DeadlyImportError("Cannot find" + XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE);
return (*itr)->target;
}
} //namespace D3MF
}
#endif //ASSIMP_BUILD_NO_3MF_IMPORTER

76
code/D3MFOpcPackage.h Normal file
View File

@@ -0,0 +1,76 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#ifndef D3MFOPCPACKAGE_H
#define D3MFOPCPACKAGE_H
#include <string>
#include <memory>
#include <assimp/IOSystem.hpp>
#include "irrXMLWrapper.h"
namespace Assimp {
namespace D3MF {
typedef irr::io::IrrXMLReader XmlReader;
typedef std::shared_ptr<XmlReader> XmlReaderPtr;
class D3MFZipArchive;
class D3MFOpcPackage
{
public:
D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile);
~D3MFOpcPackage();
IOStream* RootStream() const;
private:
std::string ReadPackageRootRelationship(IOStream* stream);
private:
IOStream* m_RootStream;
std::unique_ptr<D3MFZipArchive> zipArchive;
};
}
}
#endif // D3MFOPCPACKAGE_H

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2015, assimp team
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StreamReader.h"
#include "fast_atof.h"
#include <vector>
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/DefaultLogger.hpp>
namespace Assimp {
namespace DXF {
@@ -66,6 +66,8 @@ public:
LineReader(StreamReaderLE& reader)
// do NOT skip empty lines. In DXF files, they count as valid data.
: splitter(reader,false,true)
, groupcode( 0 )
, value()
, end()
{
}
@@ -211,7 +213,7 @@ struct InsertBlock
// keeps track of all geometry in a single BLOCK.
struct Block
{
std::vector< boost::shared_ptr<PolyLine> > lines;
std::vector< std::shared_ptr<PolyLine> > lines;
std::vector<InsertBlock> insertions;
std::string name;

Some files were not shown because too many files have changed in this diff Show More