Compare commits

...

804 Commits

Author SHA1 Message Date
Kim Kulling
2d2889f73f Merge pull request #2667 from theakman2/issue_2661
Fix: memory leak in gltf2 importer (fixes #2661)
2019-09-24 19:28:59 +02:00
Alan
d3a79d0cc2 Merge branch 'master' into issue_2661 2019-09-24 02:21:19 +01:00
Kim Kulling
c07793149c Merge pull request #2671 from JenniferBuehler/master
Fix UV texture coords generation along Z Axis
2019-09-23 17:00:50 +02:00
Kim Kulling
3b2e0ebfc7 Merge branch 'master' into issue_2661 2019-09-23 16:59:28 +02:00
Jennifer Buehler
aa47a028c8 Fix UV texture coords generation along Z Axis 2019-09-23 11:22:20 +02:00
Kim Kulling
74ac8676e2 Merge pull request #2670 from assimp/fix_static_code_analysis
Use correct escape sequence for unsigned.
2019-09-22 15:56:37 +02:00
Kim Kulling
ab3c17419e fix warning 2019-09-22 12:27:44 +02:00
Theak
720ac4846b Fix: memory leak in gltf2 importer (fixes #2661) 2019-09-22 10:12:19 +01:00
Kim Kulling
87004aa70c Merge pull request #2664 from assimp/new_aistringsize
Ensure that the aiString lenght is 4 bytes independent which platform…
2019-09-22 11:09:00 +02:00
Kim Kulling
94c488d7ea fix compiler warnings. 2019-09-22 10:15:44 +02:00
Kim Kulling
ef54a00fc4 Use correct escape sequence for unsigned. 2019-09-22 09:12:37 +02:00
Kim Kulling
06eb199704 Merge branch 'master' into new_aistringsize 2019-09-21 22:31:48 +02:00
Kim Kulling
aeecc17482 Merge pull request #2665 from assimp/move_qt_viewer_to_new_repo
remove the qt-viewer from the build system.
2019-09-21 22:31:31 +02:00
Kim Kulling
13586eb073 remove the qt-viewer from the build system. 2019-09-21 18:02:37 +02:00
Kim Kulling
69087abc56 Ensure that the aiString lenght is 4 bytes independent which platform and add mingw back to appveyor. 2019-09-21 16:36:22 +02:00
Kim Kulling
83df4f4104 Merge pull request #2658 from escherstair/fix-codacy-issues
Fix codacy issues - part #5
2019-09-19 11:53:58 +02:00
escherstair
d4101bbf06 fix regression 2019-09-19 08:07:55 +02:00
escherstair
18bbfdac1a init variable 'base' in initializer list 2019-09-19 08:01:47 +02:00
Kim Kulling
4b9cc1a484 Merge branch 'master' into fix-codacy-issues 2019-09-18 20:32:49 +02:00
Kim Kulling
b6edcb35a8 Merge pull request #2659 from creacore-team/master
fix issue #2551
2019-09-18 20:31:54 +02:00
Bruno
dbf47f7769 fix issue #2551 2019-09-18 17:54:30 +02:00
Kim Kulling
e3d277faea Merge pull request #2656 from assimp/kimkullig_dev
Kimkullig dev
2019-09-18 16:40:31 +02:00
Kim Kulling
9186e107f6 Update .travis.sh
Enable expor by default for the coveralls tests.
2019-09-18 14:51:19 +02:00
Kim Kulling
fed7fcf2fb Update utFBXImporterExporter.cpp
put test in comments.
2019-09-18 14:09:48 +02:00
Kim Kulling
06542c49df Update utFBXImporterExporter.cpp
Disable test
2019-09-18 11:50:26 +02:00
escherstair
1abf6d50fe fixed regression #2 2019-09-18 08:31:33 +02:00
escherstair
2194577429 fix regression 2019-09-18 08:25:24 +02:00
escherstair
a5859dd3f4 Merge branch 'master' into fix-codacy-issues 2019-09-18 08:19:44 +02:00
escherstair
c0ec5140ee init variable in initializer list 2019-09-18 08:18:52 +02:00
escherstair
6d4854f12c init variable in initializer list 2019-09-18 08:15:50 +02:00
escherstair
116dcce0ba init member in itilializer list 2019-09-18 08:04:46 +02:00
escherstair
3b608307c8 prefer prefix ++/-- operators for non-primitive types 2019-09-18 08:00:58 +02:00
Kim Kulling
8add762eac Merge branch 'kimkullig_dev' of https://github.com/assimp/assimp into kimkullig_dev 2019-09-17 22:12:43 +02:00
Kim Kulling
f5dcd5060f add missing namespace." 2019-09-17 22:11:58 +02:00
Kim Kulling
f7da7d8f67 Merge branch 'master' into kimkullig_dev 2019-09-17 22:01:29 +02:00
Kim Kulling
2edcf82f5a add missing include. 2019-09-17 21:58:46 +02:00
Kim Kulling
7f3b33d1c2 Merge pull request #2655 from PascalGilbraith/issue_2603
Issue 2603
2019-09-16 17:23:08 +02:00
Kim Kulling
8b95479bb0 closes https://github.com/assimp/assimp/issues/2598: introduce getEpsilon 2019-09-15 19:25:37 +02:00
PascalGilbraith
7f7918957a Issue 2603
Normal face indices added to end of already resized vector, so normal faces did not match position faces.
Use vector index rather than push.
2019-09-15 13:05:04 +01:00
Kim Kulling
2be0eba1ab put one in comments because the file seems to be corrupt. 2019-09-14 19:32:47 +02:00
Kim Kulling
ca0549558b closes https://github.com/assimp/assimp/issues/2653: introduce 2 tests to reproduce fbx-tokenize issue. 2019-09-14 10:31:35 +02:00
Kim Kulling
79056da4be closes https://github.com/assimp/assimp/issues/2613 : merge glTF2 patch. 2019-09-14 09:12:08 +02:00
Kim Kulling
ab3528f726 Merge pull request #2646 from RumbleballTheReal/master
Build Binaries example batch
2019-09-14 01:07:22 +02:00
Kim Kulling
818a5b633f Merge branch 'master' into master 2019-09-13 22:23:49 +02:00
Kim Kulling
446381e1ca Merge pull request #2647 from FabienPean/patch-1
Update Sample_SimpleOpenGL.c
2019-09-13 18:51:52 +02:00
Kim Kulling
cc7ba5288c Merge branch 'master' into patch-1 2019-09-13 14:35:29 +02:00
Kim Kulling
ee1ed502e7 Merge pull request #2654 from assimp/kimkulling-patch-4
closes https://github.com/assimp/assimp/issues/2627 - fix typo
2019-09-13 14:35:10 +02:00
Kim Kulling
a1254f067e closes https://github.com/assimp/assimp/issues/2627 - fix typo
Remove code from ai_assert test, will be removed in release versions.
2019-09-13 12:05:29 +02:00
Kim Kulling
f985bcba83 Merge branch 'master' into patch-1 2019-09-13 11:21:57 +02:00
Kim Kulling
a642b1d51a Merge pull request #2649 from assimp/gltf_add_ortho_cam
Gltf add ortho cam
2019-09-12 21:40:01 +02:00
Kim Kulling
4d2adf5bea Merge branch 'master' into gltf_add_ortho_cam 2019-09-12 20:28:18 +02:00
Kim Kulling
3bd63c006f Merge branch 'gltf_add_ortho_cam' of https://github.com/assimp/assimp into gltf_add_ortho_cam 2019-09-12 20:27:53 +02:00
Kim Kulling
a25a1f0772 fix the build. 2019-09-12 20:27:35 +02:00
Kim Kulling
783f92e148 Merge branch 'master' into patch-1 2019-09-12 16:26:35 +02:00
Kim Kulling
3069e2272d Merge pull request #2648 from rspencer01/master
Fix indentation error in python bindings
2019-09-12 16:26:00 +02:00
Kim Kulling
f10bd72100 Merge branch 'master' into gltf_add_ortho_cam 2019-09-12 00:30:06 +02:00
Kim Kulling
f9c6fed190 Add a camera unittest. 2019-09-11 22:34:53 +02:00
Kim Kulling
f67c18d41a introduce inline helper. 2019-09-11 22:21:20 +02:00
Kim Kulling
55b735b6c3 Merge branch 'master' into master 2019-09-11 20:18:53 +02:00
Kim Kulling
3cbcfd3cd8 Merge pull request #2650 from escherstair/fix-codacy-issues
Fix codacy issues - part #4
2019-09-11 20:15:41 +02:00
kimkulling
7ff7a5d64e glTF: Try to remove duplicate code. 2019-09-11 17:00:39 +02:00
escherstair
0307327999 Merge branch 'master' into fix-codacy-issues 2019-09-11 10:06:16 +02:00
Kim Kulling
28d0300dbe Merge branch 'master' into gltf_add_ortho_cam 2019-09-11 09:32:14 +02:00
Kim Kulling
d91eebf347 Add ortho camera. 2019-09-10 22:13:54 +02:00
Robert Spencer
e1322f9178 Fix indentation error in python bindings 2019-09-10 20:38:31 +01:00
escherstair
b9cff2a019 prefer prefix ++/-- operators for non-primitive types 2019-09-10 07:54:07 +02:00
Fabien Péan
52d0170470 Update CMakeLists.txt 2019-09-09 23:00:04 +02:00
Fabien Péan
1899aaef6e Update Sample_SimpleOpenGL.c 2019-09-09 22:44:58 +02:00
Kim Kulling
bfac0aae9c Merge branch 'master' into master 2019-09-09 22:36:50 +02:00
Kim Kulling
d672ae21d0 Merge pull request #2640 from RevoluPowered/feature/implement-PBR-materials-fbx
FBX Implemented basic PBR material textures
2019-09-09 22:36:22 +02:00
RumbleballTheReal
a16645f3f7 Update BUILDBINARIES_EXAMPLE.bat 2019-09-09 21:20:44 +02:00
RumbleballTheReal
c19bd3d1d1 Merge branch 'master' into master 2019-09-09 21:17:22 +02:00
Kim Kulling
b4fdc009e2 Merge branch 'master' into feature/implement-PBR-materials-fbx 2019-09-09 20:51:20 +02:00
Kim Kulling
66e5765387 Merge branch 'master' of https://github.com/assimp/assimp 2019-09-09 20:22:48 +02:00
RumbleballTheReal
a0fb50146a Update BUILDBINARIES_EXAMPLE.bat 2019-09-09 15:56:21 +02:00
RumbleballTheReal
621a7a1abd Create BUILDBINARIES_EXAMPLE.bat 2019-09-09 15:50:57 +02:00
escherstair
db55ba4908 possible inefficient checking for 'tlist' emptiness 2019-09-09 15:00:28 +02:00
escherstair
027ee6ee00 Merge pull request #5 from escherstair/master
Merge master into fix-codacy-issues
2019-09-09 14:58:27 +02:00
escherstair
03514a9237 Merge pull request #4 from assimp/master
Sync with upstream repo
2019-09-09 14:20:15 +02:00
Kim Kulling
c519a91233 Merge pull request #2644 from FabienPean/patch-1
Fix Sample_SimpleOpenGL.c
2019-09-08 23:06:57 +02:00
Kim Kulling
602b0cf0c2 Update Sample_SimpleOpenGL.c
Introduce C_STRUCT  for c-compatibility mode.
2019-09-08 21:03:08 +02:00
RevoluPowered
ddc26e1c46 Added maya stingray support for textures 2019-09-08 19:15:27 +01:00
RevoluPowered
da97f1be79 Implemented basic PBR materials into assimp.
This adds the following texture types:
- BASE_COLOR
- NORMAL_CAMERA
- EMISSION_COLOR
- METALNESS
- DIFFUSE_ROUGHNESS

This is the first small change required.
We only support maya right now.
2019-09-08 19:15:27 +01:00
Fabien Péan
1b86de9d14 Fix Sample_SimpleOpenGL.c
Extra `struct` causing problems
2019-09-08 19:15:57 +02:00
Kim Kulling
3801b84ef9 Merge pull request #2639 from escherstair/fix-codacy-issues
Fix codacy issues - part #3
2019-09-08 16:04:00 +02:00
Kim Kulling
ad2dd2dc18 Merge branch 'master' into fix-codacy-issues 2019-09-08 12:08:01 +02:00
Kim Kulling
a835afeb2b Merge pull request #2638 from RumbleballTheReal/master
Added VertexColor to FBX exporter (one channel)
2019-09-07 21:00:28 +02:00
Kim Kulling
5d8482dae6 Merge branch 'master' into master 2019-09-07 18:53:26 +02:00
Kim Kulling
86886cb2e4 Merge pull request #2643 from assimp/thomasbiang-fix_issue_joinIdenticalVertices_notNeeded
Thomasbiang fix issue join identical vertices not needed
2019-09-07 18:43:52 +02:00
Kim Kulling
f8bcd7cb40 Merge branch 'master' into thomasbiang-fix_issue_joinIdenticalVertices_notNeeded 2019-09-07 10:02:20 +02:00
Kim Kulling
945af4397b Merge branch 'thomasbiang-fix_issue_joinIdenticalVertices_notNeeded' 2019-09-07 09:59:47 +02:00
Kim Kulling
336ae0e55a Merge branch 'fix_issue_joinIdenticalVertices_notNeeded' of https://github.com/thomasbiang/assimp into thomasbiang-fix_issue_joinIdenticalVertices_notNeeded 2019-09-07 09:58:07 +02:00
Kim Kulling
c1d4549d19 Merge pull request #2626 from muxanickms/crash_in_ai_mesh_desctuctor
A crash in the aiMesh destructor
2019-09-07 09:31:47 +02:00
Kim Kulling
3546403284 Merge branch 'master' into crash_in_ai_mesh_desctuctor 2019-09-06 20:45:16 +02:00
escherstair
570b3838c9 Merge branch 'master' into fix-codacy-issues 2019-09-06 13:20:00 +02:00
escherstair
1503608aaa prefer prefix ++/-- operators for non-primitive types 2019-09-06 11:31:07 +02:00
escherstair
91706a1f6e prefer prefix ++/-- operators for non-primitive types 2019-09-06 11:29:52 +02:00
Kim Kulling
1a8375f925 Merge pull request #2633 from rmccampbell/unicode_fix
Unicode fix
2019-09-06 11:28:57 +02:00
escherstair
d177c722b1 prefer prefix ++/-- operators for non-primitive types 2019-09-06 11:28:38 +02:00
escherstair
eb8479a95e possible inefficient checking for 'tlist' emptiness 2019-09-06 11:19:27 +02:00
Kim Kulling
6661e7047a Merge branch 'master' into unicode_fix 2019-09-06 08:59:21 +02:00
RumbleballTheReal
8fc625513e Merge pull request #1 from RumbleballTheReal/patch-1
Added VertexColors to FBX exporter (one channel)
2019-09-05 23:53:21 +02:00
RumbleballTheReal
22bd047db5 Added VertexColors to FBX exporter (one channel)
Works properly with Blender (custom importer) and UnrealEngine (Official SDK)
2019-09-05 23:44:54 +02:00
Kim Kulling
9b897a8e8d Merge pull request #2634 from escherstair/fix-codacy-issues
Fix codacy issues - part #2
2019-09-05 21:11:32 +02:00
Kim Kulling
af26c090db Merge branch 'master' into fix-codacy-issues 2019-09-05 19:50:31 +02:00
Mike Samsonov
b271091c64 fix division by zero 2019-09-05 11:44:02 +01:00
Mike Samsonov
4029fe5e46 alloc-dealloc-mismatch 2019-09-05 11:44:02 +01:00
Mike Samsonov
9adc4e87fa alloc-dealloc-mismatch 2019-09-05 11:44:02 +01:00
Mike Samsonov
0324643cd5 Missing model files 2019-09-05 11:44:02 +01:00
Mike Samsonov
873a358ce4 A crash in the aiMesh descructor 2019-09-05 11:44:02 +01:00
Kim Kulling
8ca9d2ed40 Merge branch 'master' into unicode_fix 2019-09-04 17:47:45 +02:00
Kim Kulling
893a0177ff Merge pull request #2624 from congard/master
Fix #2618
2019-09-04 16:31:01 +02:00
Ryan McCampbell
eb762e654e Removed WindowsStore checks 2019-09-03 23:13:44 -04:00
Ryan McCampbell
a16906686f Fixed type conversion warnings 2019-09-03 21:06:48 -04:00
Kim Kulling
50820e48b9 Merge branch 'master' into fix-codacy-issues 2019-09-03 21:54:59 +02:00
Ryan McCampbell
a8822a2b29 Cleaned up formatting in DefaultIOSystem.cpp 2019-09-03 11:18:01 -04:00
Ryan McCampbell
0685e415ad removed extra null character in Utf8ToWide and WideToUtf8 2019-09-03 11:18:01 -04:00
Ryan McCampbell
6c65b5b549 Cleaned up unicode code and removed fixed-size buffers 2019-09-03 11:18:01 -04:00
Ryan McCampbell
727cf0c49f Fixed unicode on windows 2019-09-03 11:18:01 -04:00
Kim Kulling
4d9b350184 Update CMakeLists.txt
Remove optimization because irrxml sucks.
2019-09-03 15:17:42 +02:00
Kim Kulling
57e712c0a8 Merge branch 'master' into master 2019-09-03 11:39:17 +02:00
Kim Kulling
071504991a Update CMakeLists.txt
Enable optimization
2019-09-03 11:39:05 +02:00
escherstair
c4ce8cec96 prefer prefix ++/-- operators for non-primitive types 2019-09-03 08:02:56 +02:00
escherstair
e317fbfbb6 prefer prefix ++/-- operators for non-primitive types 2019-09-03 08:01:56 +02:00
escherstair
bbb1f6a1dc prefer prefix ++/-- operators for non-primitive types 2019-09-03 08:01:05 +02:00
escherstair
ceacad237f prefer prefix ++/-- operators for non-primitive types 2019-09-03 08:00:12 +02:00
escherstair
33e71ee8df prefer prefix ++/-- operators for non-primitive types 2019-09-03 07:59:17 +02:00
escherstair
75993ad653 prefer prefix ++/-- operators for non-primitive types 2019-09-03 07:57:58 +02:00
escherstair
53d795c1c9 possible inefficient checking for 'tlist' emptiness 2019-09-03 07:57:08 +02:00
escherstair
ec1930478c prefer prefix ++/-- operators for non-primitive types 2019-09-03 07:56:37 +02:00
escherstair
c1d4ed7873 prefer prefix ++/-- operators for non-primitive types 2019-09-03 07:55:27 +02:00
Kim Kulling
9196dab247 Merge pull request #2630 from MalcolmTyrrell/accessibleIsVerbose
Make IsVerbose accessible outside the exporter
2019-09-03 00:28:45 +02:00
Kim Kulling
0f18ec9e2c Merge branch 'master' into accessibleIsVerbose 2019-09-02 20:47:04 +02:00
Kim Kulling
4c12328e05 Merge pull request #2623 from RevoluPowered/fix-missing-scale-data
FIX missing File Scale and Application scale fixes for all conversions
2019-09-01 17:58:31 +02:00
Kim Kulling
b34f9839f1 Merge branch 'master' into fix-missing-scale-data 2019-08-31 12:42:40 +02:00
Kim Kulling
e8592024bd Merge pull request #2628 from escherstair/fix-codacy-issues
Fix codacy issues
2019-08-31 12:42:15 +02:00
Malcolm Tyrrell
01d0f06d3a Make IsVerbose accessible outside the exporter 2019-08-30 11:42:23 +01:00
escherstair
de51122639 fix regression 2019-08-29 12:09:56 +02:00
escherstair
2d0d2374c1 fix ColladaLoader::findMesh() declaration 2019-08-29 12:00:44 +02:00
escherstair
89079ead12 prefer prefix ++/-- operators for non-primitive types 2019-08-29 11:44:41 +02:00
escherstair
946d64282b fix inefficient checking for 'url' emptiness 2019-08-29 10:58:01 +02:00
escherstair
340611785a prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:57:23 +02:00
escherstair
cb2beba073 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:56:58 +02:00
escherstair
aec4726d21 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:56:21 +02:00
escherstair
b3788039df prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:55:09 +02:00
escherstair
3ef0860f30 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:54:21 +02:00
escherstair
d7b3b344f6 Merge pull request #3 from escherstair/escherstair-patch-2
function parameter 'name' should be passed by const reference
2019-08-29 10:50:05 +02:00
escherstair
e8ae086b35 fix function definition 2019-08-29 10:48:51 +02:00
escherstair
75fed8340d fix function declaration 2019-08-29 10:46:50 +02:00
escherstair
a044852938 fix inefficient checking for lists emptiness 2019-08-29 10:44:19 +02:00
escherstair
ba3e4ae892 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:42:47 +02:00
escherstair
2f53d42d45 fix inefficient checking for 'SceneNode_Child' emptiness 2019-08-29 10:42:09 +02:00
escherstair
cca81e877a prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:41:34 +02:00
escherstair
b363fa3883 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:41:00 +02:00
escherstair
69fce64b9c prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:40:31 +02:00
escherstair
44d7cb8177 possible inefficient checking for lists emptiness 2019-08-29 10:37:19 +02:00
escherstair
02444be251 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:36:09 +02:00
escherstair
65ba0c4b46 fix inefficient checking for lists emptiness 2019-08-29 10:30:50 +02:00
escherstair
ebb061d89c fix inefficient check for 'mNodeElement_List' emptiness 2019-08-29 10:29:24 +02:00
escherstair
0d17315166 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:25:38 +02:00
escherstair
f009c216b6 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:24:58 +02:00
escherstair
eadbc89a1f prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:23:27 +02:00
escherstair
438b070508 prefer prefix ++/-- operators for non-primitive types 2019-08-29 10:22:50 +02:00
escherstair
805fda3df8 possible inefficient checking for 'NodeElement_List' emptiness 2019-08-29 09:05:15 +02:00
escherstair
b1f8f6ae3b prefer prefix ++/-- operators for non-primitive types 2019-08-29 09:04:27 +02:00
escherstair
ffb30fbc85 prefer prefix ++ operator for non-primitive types 2019-08-29 09:02:19 +02:00
escherstair
789e8abfe8 prefer prefix ++ operator for non-primitive types 2019-08-29 08:44:49 +02:00
escherstair
f1e0c460ed Prefer prefix ++ operator for non-primitive types 2019-08-29 08:43:56 +02:00
escherstair
8e90bf8381 fix inefficient checking for lists emptiness 2019-08-29 08:43:09 +02:00
escherstair
43865e6bc9 fix inefficient checking for 'url' emptiness 2019-08-29 08:34:18 +02:00
escherstair
60f2535dcd fix inefficient check for 'SceneNode_Mesh' emptiness 2019-08-29 08:30:24 +02:00
escherstair
7d8a25993b prefer prefix ++ operator for non-primitive types 2019-08-29 08:29:30 +02:00
escherstair
765c0e71f6 prefer prefix ++ operator for non-primitive types 2019-08-29 08:25:19 +02:00
escherstair
806bcf76b1 fix inefficient checking for lists emptiness 2019-08-29 08:23:09 +02:00
escherstair
30eb3c56c3 prefer prefix ++ operator for non-primitive types 2019-08-29 08:12:22 +02:00
escherstair
575d7eb29c Merge pull request #2 from escherstair/escherstair-patch-1
function parameter 'meshid' should be passed by const reference
2019-08-29 08:08:44 +02:00
escherstair
dbb498095d function parameter 'meshid' should be passed by const reference 2019-08-29 08:05:45 +02:00
escherstair
0dd1ae0196 prefer prefix ++ operator for non-primitive types 2019-08-29 08:02:51 +02:00
escherstair
9ad7ce1129 prefer prefix ++ operator for non-primitive types 2019-08-29 08:02:08 +02:00
escherstair
a9d902946d fix inefficient check for 'Composition' emptiness 2019-08-29 08:01:00 +02:00
escherstair
2405b3b5ba Merge pull request #1 from assimp/master
sync my fork to original upstream
2019-08-29 07:55:57 +02:00
Kim Kulling
84c0d6b95a Merge pull request #2621 from RevoluPowered/fix-segfault-fbx-import
Fix segfault #2614
2019-08-28 11:16:39 +02:00
Kim Kulling
e20640c2c8 Merge branch 'master' into fix-segfault-fbx-import 2019-08-28 09:14:51 +02:00
Daniel Bernar
afb24d7a1c Fix #2618
Added CXX flag -O3 for MinGW
2019-08-27 19:33:12 +03:00
Gordon MacPherson
43cb76653b Removed depreciated FBX Unit and scaling code 2019-08-27 15:54:27 +01:00
Gordon MacPherson
abdd853ca5 FIX missing update call for scale to post process 2019-08-27 15:50:50 +01:00
Kim Kulling
234b759cbc Merge pull request #2620 from RevoluPowered/feature/bug-fbx-application-scale-wrong
[WIP] Fix FBX units not being converted from CM to application scale
2019-08-27 16:23:39 +02:00
Gordon MacPherson
ad971468ef size_t cannot be less than 0 2019-08-27 15:15:40 +01:00
Kim Kulling
0729a6e20f Merge branch 'master' into feature/bug-fbx-application-scale-wrong 2019-08-27 14:06:00 +02:00
Gordon MacPherson
7e12257ebc Fix segfault #2614 2019-08-26 22:44:25 +01:00
Gordon MacPherson
c50a4d8ade Fix segfault caused by FBX file with missing face #2614 2019-08-26 22:39:20 +01:00
Gordon MacPherson
d56198774e Fix FBX units not being converted from CM to application scale 2019-08-26 22:03:56 +01:00
Kim Kulling
5fe728345f Merge pull request #2608 from RevoluPowered/feature/fix-removal-of-bones
Stop JoinVerticiesProcess removing bones from mesh as per #2596
2019-08-26 21:20:59 +02:00
Kim Kulling
48f1f012eb Merge branch 'master' into feature/fix-removal-of-bones 2019-08-25 09:34:20 +02:00
Kim Kulling
f119fedd55 Merge pull request #2611 from RevoluPowered/feature/prototype-for-assimp-universal-scale
Prototype unit system for assimp
2019-08-25 09:24:42 +02:00
Kim Kulling
594d90a18e Merge branch 'master' into feature/prototype-for-assimp-universal-scale 2019-08-24 10:22:08 +02:00
Kim Kulling
646a466c70 Merge pull request #2616 from assimp/kimkulling-patch-4
Update FUNDING.yml
2019-08-24 10:05:36 +02:00
Kim Kulling
b60fc4a44f Merge branch 'master' into kimkulling-patch-4 2019-08-23 21:04:51 +02:00
Kim Kulling
ef98d357b4 Merge pull request #2589 from MalcolmTyrrell/topic/fbxNodeChainFix
FBX node chain assert fix
2019-08-23 21:04:22 +02:00
Kim Kulling
d923c8ce48 Update FUNDING.yml
add kofi
2019-08-23 19:16:20 +02:00
Kim Kulling
9a78f2c6f1 Merge branch 'master' into topic/fbxNodeChainFix 2019-08-23 17:24:04 +02:00
Kim Kulling
95d4faef6d Merge pull request #2610 from RichardTea/Windows_RC_githash
Update DLL PE details: Copyright, git commit hash and original filename
2019-08-23 17:23:30 +02:00
Kim Kulling
7016428895 Merge branch 'master' into Windows_RC_githash 2019-08-22 18:17:42 +02:00
Gordon MacPherson
db8606ba57 Fix typo 2019-08-21 23:32:31 +01:00
Kim Kulling
fb2b673387 Merge pull request #2605 from anandvsingh/Fix-Issue-2586-LINK-fatal-error-LNK1189-library-limit-of-65535-objects-exceeded
Update CMakeLists.txt
2019-08-21 23:36:46 +02:00
Gordon MacPherson
ffc19790fb Depreciated compiler which doesn't support standard features 2019-08-21 22:22:23 +01:00
Gordon MacPherson
0d29203e24 Prototype unit system for assimp generic enough to be used across formats. 2019-08-21 21:41:41 +01:00
Kim Kulling
63f63c7470 Merge branch 'master' into Fix-Issue-2586-LINK-fatal-error-LNK1189-library-limit-of-65535-objects-exceeded 2019-08-21 22:00:27 +02:00
RichardTea
0f6e95f19d Fix typo. githash canonically doesn't start 0x 2019-08-21 16:07:51 +01:00
RichardTea
b8d4ae5a7c Add git commit, original filename to DLL PE header
Windows only
2019-08-21 15:54:14 +01:00
Kim Kulling
bdf6612ba0 Merge pull request #2607 from RevoluPowered/fix-scale-process
ScaleProcess overhauled to improve compatibility
2019-08-19 22:48:29 +02:00
Gordon MacPherson
4bc5e8c262 Stop JoinVerticiesProcess removing bones from mesh as per #2596
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2019-08-19 19:35:44 +01:00
Kim Kulling
eb55a6a3cd Update ScaleProcess.cpp
Fix review findings.
2019-08-19 20:24:01 +02:00
Gordon MacPherson
fbb34b1de1 ScaleProcess overhauled to improve compatibility with animations and unit conversion.
./assimp Added arguments --gs to assimp command line option to enable global scaling.

No scaling for mScale of 1.0.

Co-Authored-By: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2019-08-19 17:36:57 +01:00
Kim Kulling
74685477e6 Update CMakeLists.txt
Put it into the win32 for VS part.
2019-08-19 17:22:51 +02:00
anandvsingh
e5372fc385 Update CMakeLists.txt 2019-08-18 15:44:38 +02:00
Kim Kulling
23e1c0cbc9 Merge pull request #2577 from follower/patch-1
Fix error when building assimp on older Mac OS X version.
2019-08-18 14:39:46 +02:00
Kim Kulling
b25b83fb46 Merge branch 'master' into patch-1 2019-08-18 11:57:22 +02:00
Kim Kulling
7ee7946dc5 Update scene.h
use #include <cstdlib> only if the compiler is used to compile c++ code.
2019-08-18 09:40:13 +02:00
Kim Kulling
1cb23134b8 Merge pull request #2600 from RichardTea/issue-2599-multiconfig-debug-postfix
Issue 2599 multiconfig debug postfix
2019-08-17 16:36:27 +02:00
Kim Kulling
09a994f72c Merge branch 'master' into issue-2599-multiconfig-debug-postfix 2019-08-17 13:16:10 +02:00
Kim Kulling
effd324a21 Merge pull request #2601 from GBhutra/patch-1
fix for div by zero reported by address sanitizer
2019-08-17 13:15:45 +02:00
Ghanshyam Bhutra
f69bf5f7ed fix for div by zero reported by address sanitizer 2019-08-16 17:04:42 -07:00
RichardTea
0400e0bc7f Multi-Config generators should also set the debug suffix when enabled
Issue #2599
2019-08-16 11:10:30 +01:00
RichardTea
5fa1f20327 Merge remote-tracking branch 'upstream/master' 2019-08-16 10:09:29 +01:00
Malcolm Tyrrell
581b368223 Merge branch 'master' into topic/fbxNodeChainFix 2019-08-16 10:08:38 +01:00
Kim Kulling
812397d681 Merge pull request #2597 from rogersachan/patch-1
Add GitHub sponsors button to feature patreon
2019-08-16 08:53:17 +02:00
Kim Kulling
84e9d9ddf8 Merge branch 'master' into topic/fbxNodeChainFix 2019-08-16 08:47:02 +02:00
Roger
25dcef2758 Create FUNDING.yml 2019-08-16 00:11:12 -04:00
Kim Kulling
a9b4909a2f Merge branch 'master' into patch-1 2019-08-14 21:21:18 +02:00
Kim Kulling
3309ea9a5c Merge pull request #2545 from RichardTea/collada_zae
Add Collada zae import support
2019-08-14 21:20:20 +02:00
Kim Kulling
a2ee19e86d Merge branch 'master' into collada_zae 2019-08-14 20:02:53 +02:00
Rich ard
578fccf522 Merge remote-tracking branch 'upstream/master' 2019-08-13 10:03:44 +01:00
ywang
3d0775eebc respect export flag if aiJoinIdenticalVertices is not needed 2019-08-12 18:10:43 -07:00
Kim Kulling
172422460c Merge pull request #2568 from panquez/master
Proposal for issue 2567
2019-08-11 12:30:58 +02:00
Kim Kulling
02812f22af Merge branch 'master' into master 2019-08-10 10:08:15 +02:00
Kim Kulling
563ec1662c Merge pull request #2578 from petrmohelnik/glTF-2.0-Lights-import
glTF 2.0 Lights import
2019-08-10 10:07:20 +02:00
Kim Kulling
51923b5d3c Merge branch 'master' into glTF-2.0-Lights-import 2019-08-10 08:35:10 +02:00
Kim Kulling
4580c56504 Merge pull request #2590 from assimp/kimkulling-issue_2570
Update config.h.in
2019-08-10 07:36:34 +02:00
Kim Kulling
4c1e8fe9c3 Update config.h.in
closes https://github.com/assimp/assimp/issues/2570: fix a typo.
2019-08-09 20:30:12 +02:00
Kim Kulling
cc8e7dcc1b Merge branch 'master' into glTF-2.0-Lights-import 2019-08-09 20:03:51 +02:00
Kim Kulling
7d67eca52c Merge pull request #2574 from gongminmin/RemoveStdIterator
Remove the usage of std::iterator
2019-08-09 20:03:24 +02:00
Kim Kulling
f1f409d538 Merge branch 'master' into RemoveStdIterator 2019-08-09 17:43:30 +02:00
Malcolm Tyrrell
3c7a608956 Add an include. 2019-08-09 16:26:59 +01:00
Malcolm Tyrrell
181d3dd84f Fix node chain bug. 2019-08-09 15:28:14 +01:00
Malcolm Tyrrell
5b81899302 Add failing test. 2019-08-09 15:24:18 +01:00
Kim Kulling
2d7505b244 Merge branch 'master' into glTF-2.0-Lights-import 2019-08-08 21:57:32 +02:00
Kim Kulling
1097f47ff5 Merge pull request #2585 from RevoluPowered/feature/fix-armature-and-root-node
FBX importer armature fixes and root bone fixes - animations should now work for more models.
2019-08-08 21:56:08 +02:00
Gordon MacPherson
74d2eb842b Fixed armature being marked as 'limbnode'
This also fixes issue with root bone overwritten - which should not happen as it is a hack.

Before the behaviour would create an additional bone which would end up breaking animations completely on import.

Additionally this fixes required bones being removed.

Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2019-08-08 01:02:30 +01:00
Kim Kulling
090e896ebf Merge branch 'master' into collada_zae 2019-08-06 21:22:02 +02:00
Kim Kulling
42f07c8bbc Merge pull request #2536 from thomasbiang/fix_export_group_as_bone
Fix Issue: group node in fbx being exported as bone node
2019-08-06 21:21:35 +02:00
Kim Kulling
9f5b047f7c Merge branch 'master' into fix_export_group_as_bone 2019-08-06 19:27:37 +02:00
petrmohelnik
9330cca1cd glTF 2.0 Lights import
Importing of lights according to glTF 2.0 extension KHR_lights_punctual https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual

Since glTF lights are based on PBR they use different attenuation model than conventional lights supported by assimp. It is possible to use attenuation factors in assimp to describe inverse square law fallof. But the light structure does not provide means to save range property. Therefore I resorted to use of metadata. When range parameter is present, I put it into 'PBR_LightRange' metadata of light's node. Please, see comment in glTF2Importer file.
2019-08-03 20:51:00 +02:00
Kim Kulling
83d2ec7f74 Merge branch 'master' into RemoveStdIterator 2019-08-02 10:35:59 +02:00
follower
1e6eac9e65 Fix error when building assimp on older Mac OS X version.
Prevents this error when building with Mac OS X 10.9 SDK:

    error: no member named 'atoi' in namespace 'std'; did you mean simply 'atoi'?
2019-08-02 04:44:21 +12:00
Kim Kulling
1c3e934ae9 Merge pull request #2563 from mosra/stl-white-ambient
Fix white ambient in STL loader
2019-07-30 14:16:09 +02:00
Minmin Gong
cfbe368d72 Remove the usage of std::iterator 2019-07-29 22:34:24 -07:00
Kim Kulling
deee43f946 Merge branch 'master' into stl-white-ambient 2019-07-29 19:31:33 +02:00
RichardTea
7b67b00a79 Merge pull request #17 from assimp/master
Update to upstream
2019-07-29 12:27:05 +01:00
Kim Kulling
1d565b0aab Merge pull request #2566 from RichardTea/test_exporter_ids
Test Exporter Descriptions and IDs
2019-07-29 10:09:28 +02:00
Kim Kulling
d83af91095 Update Exporter.cpp
Add exporter detail.
2019-07-29 09:03:29 +02:00
Kim Kulling
762e039d15 Merge branch 'master' into test_exporter_ids 2019-07-28 22:20:57 +02:00
Kim Kulling
69265273c2 Merge pull request #2572 from thomasbiang/fix-multiUV-export
Fix issue # 2571: extra layer for multi uv sets
2019-07-28 11:13:31 +02:00
Kim Kulling
7d74a3354d Merge branch 'master' into fix-multiUV-export 2019-07-28 09:37:00 +02:00
RichardTea
361609c60b Merge branch 'master' into test_exporter_ids 2019-07-26 22:21:16 +01:00
RichardTea
7fc4cf1552 ASSIMP_BUILD_NO_*_EXPORTER
Full fix for #2557

These macros should be all-caps.
Correct the cmakelists
2019-07-26 22:17:24 +01:00
Kim Kulling
94328695d0 Merge branch 'master' into fix_export_group_as_bone 2019-07-26 11:00:04 +02:00
Kim Kulling
73914cd7e2 Update FBXExporter.cpp
small reformatting improvement
2019-07-26 10:55:28 +02:00
Kim Kulling
982914754e Merge pull request #2564 from RichardTea/test_gitignore_cleanup
Add Export Unit Test output to gitignore
2019-07-26 10:47:20 +02:00
RichardTea
72e18ed4aa Fix Travis CI sign-compare warning
EXPECT_* triggers sign compare error with literal 0 and unsigned
Use 0u literal with size_t
2019-07-26 09:10:09 +01:00
ywang
d8eaf0bc7f cleanup empty lines 2019-07-25 15:53:57 -07:00
ywang
a6b06ad811 update 2019-07-25 15:49:41 -07:00
thomasbiang
aaaa0a02a3 use ExportProperties to customize bind pose epsilon 2019-07-25 15:49:38 -07:00
thomasbiang
0f0454c3b7 customize error rate for bind pose 2019-07-25 15:47:17 -07:00
thomasbiang
f9f408690e use ExportProperties to customize bind pose epsilon 2019-07-25 15:45:50 -07:00
thomasbiang
2ddb00f4e0 clean up 2019-07-25 15:45:50 -07:00
thomasbiang
029338940c customize error rate for bind pose 2019-07-25 15:45:47 -07:00
ywang
0ed9158908 update 2019-07-25 15:43:43 -07:00
thomasbiang
6e6765cae3 clean up 2019-07-25 15:43:43 -07:00
thomasbiang
c597e21b67 customize error rate for bind pose 2019-07-25 15:43:43 -07:00
thomasbiang
9b2aac8c96 use ExportProperties to customize bind pose epsilon 2019-07-25 15:43:43 -07:00
thomasbiang
079e522eae clean up 2019-07-25 15:43:43 -07:00
thomasbiang
8fc899035c customize error rate for bind pose 2019-07-25 15:43:43 -07:00
thomasbiang
5a7c226c30 set->unordered_set;unsigned int for iteration 2019-07-25 15:43:24 -07:00
ywang
57a56b7b1d extra layer for multi uv sets 2019-07-25 13:14:54 -07:00
Pierre Anquez
337df20209 Update CMakeLists.txt 2019-07-25 17:12:16 +02:00
Pierre Anquez
80047cd633 Update Exporter.cpp 2019-07-25 16:29:17 +02:00
Pierre Anquez
a879102309 Update CMakeLists.txt 2019-07-25 16:27:35 +02:00
Pierre Anquez
9dce8e40ba Update CMakeLists.txt 2019-07-25 16:03:26 +02:00
RichardTea
7e8a3ec4cb Add unit test of valid and unique Exporter IDs, rename assjson id
"json" is a very vague exporter ID, change to "assjson"

Add a unit test to ensure all exporter have unique IDs
and that they all have an ID, description and extension
2019-07-25 13:38:49 +01:00
RichardTea
e993cdc309 Merge branch 'master' into collada_zae 2019-07-25 12:42:08 +01:00
RichardTea
59a5343a1a Merge branch 'master' into test_gitignore_cleanup 2019-07-25 12:41:30 +01:00
RichardTea
9880db8d4d Merge pull request #16 from assimp/master
Update to upstream
2019-07-25 12:38:29 +01:00
RichardTea
e05ece2eec Add Exporter Unit Test output to gitignore 2019-07-25 11:12:06 +01:00
RichardTea
9b78060a4a Add copyright headers to ZipArchiveIOSystem 2019-07-25 10:14:42 +01:00
RichardTea
3016f3a725 Convert Q3BSP Importer to use ZipArchiveIOSystem
Removes duplication, handles large files better
2019-07-25 10:13:53 +01:00
RichardTea
5c6ea5d7ba Fix memory leak in Collada ZAE and 3MF ZipFile reading
Must close the file!
2019-07-25 09:54:39 +01:00
RichardTea
9e04df810e ZipArchiveIOSystem should be sorted, fix ZipFile::Read()
Q3BSP relies on the sort order
Read() should return number of elements read, not count of bytes
Read() should clip to the file size and return elements actually read,
instead of aborting if try to read too much
2019-07-25 09:53:18 +01:00
Vladimír Vondruš
dadf5c0020 Fix white ambient in STL loader.
A problem that sneaked in from #1293 (f84851e893) 
due to insufficient code review, later reported in #2059 but not fixed 
properly. Having a white ambient practically means all other color information 
is ignored and the model stays bright white no matter how you set up your 
lighting, so putting it back to how it was before the commit above.
2019-07-25 10:28:09 +02:00
Kim Kulling
d1b206a8ea Merge pull request #2558 from panquez/patch-1
Fix issue #2557
2019-07-24 22:05:02 +02:00
RichardTea
c6620478ec Fix GCC warnings reported by Travis 2019-07-24 16:12:06 +01:00
Pierre Anquez
17adc98eec Fix issue #2557 2019-07-23 15:58:30 +02:00
Kim Kulling
e828dd1757 Merge branch 'master' into collada_zae 2019-07-21 14:37:12 +02:00
Kim Kulling
46a8164af4 Merge pull request #2543 from thomasbiang/fix_export_custom_bindpose_error
Fix export custom bindpose error
2019-07-21 14:36:24 +02:00
Kim Kulling
78b283135e Update utIssues.cpp
use correct test for floats.
2019-07-21 13:32:31 +02:00
Kim Kulling
5895f04391 Merge branch 'master' into fix_export_custom_bindpose_error 2019-07-21 12:17:02 +02:00
Kim Kulling
41ea607739 Merge branch 'master' into collada_zae 2019-07-20 14:12:18 +02:00
Kim Kulling
5b6fe80883 Merge pull request #2550 from merwaaan/fix-obj-line-continuation
Fix line continuations in OBJ files
2019-07-20 14:08:08 +02:00
Kim Kulling
ff7ec7e454 Merge branch 'master' into fix-obj-line-continuation 2019-07-20 12:07:49 +02:00
Kim Kulling
4bd8ae8211 Merge pull request #2552 from assimp/fix_new_compiler_warnings
Unit: Fix new compiler warnings.
2019-07-20 12:07:32 +02:00
Kim Kulling
103048ff85 Update UnrealLoader.h
use memcpy instead of = operator for pos copy.
2019-07-20 10:10:17 +02:00
Kim Kulling
f804036cf3 Update utBlenderWork.cpp
Fix compiler warning signed against unsigned.
2019-07-19 20:44:48 +02:00
kimkulling
b6616e7b79 Fix another signed unsigned comparison warning. 2019-07-19 13:28:00 +02:00
kimkulling
e84f961f78 change std::array<int, x > to std::array<unsigned int, x> to fix compiler warnings. 2019-07-19 13:03:08 +02:00
kimkulling
68520bff0c Fix another signed / unsigned comparison warning. 2019-07-19 11:55:12 +02:00
kimkulling
3416c04ad9 Unit: fix more compiler warnings. 2019-07-19 11:26:48 +02:00
kkulling
a8019cf8d8 Unit: Fix new compiler warnings. 2019-07-19 10:38:44 +02:00
Merwan
2f6a005fb8 Add unit test for OBJ line continuations 2019-07-17 20:17:49 +02:00
ywang
03b58e84c3 Merge branch 'fix_export_custom_bindpose_error' of https://github.com/thomasbiang/assimp into fix_export_custom_bindpose_error 2019-07-16 13:37:25 -07:00
ywang
e1e9d92c01 update 2019-07-16 13:36:46 -07:00
thomasbiang
e3683e49e4 clean up 2019-07-16 13:36:45 -07:00
thomasbiang
5121a835b5 customize error rate for bind pose 2019-07-16 13:36:45 -07:00
thomasbiang
6299c58fae use ExportProperties to customize bind pose epsilon 2019-07-16 13:34:00 -07:00
thomasbiang
6e0810d3c1 clean up 2019-07-16 13:34:00 -07:00
thomasbiang
cdf60d7423 customize error rate for bind pose 2019-07-16 13:33:59 -07:00
thomasbiang
c889699d58 set->unordered_set;unsigned int for iteration 2019-07-16 13:33:59 -07:00
thomasbiang
9210ff37f2 fix group node being exported as bone node 2019-07-16 13:33:59 -07:00
ywang
c979b4060d Merge branch 'fix_export_custom_bindpose_error' of https://github.com/thomasbiang/assimp into fix_export_custom_bindpose_error 2019-07-16 13:20:46 -07:00
ywang
4ff4938df4 Merge remote-tracking branch 'upstream/master' into fix_export_custom_bindpose_error 2019-07-16 13:17:04 -07:00
Merwan
2122dc231d Fix line continuations in OBJ files 2019-07-16 20:37:41 +02:00
Kim Kulling
0accbb58f1 Merge branch 'master' into fix_export_custom_bindpose_error 2019-07-16 16:03:09 +02:00
Kim Kulling
fed764d2a8 Merge pull request #2549 from assimp/issue_2548
closes https://github.com/assimp/assimp/issues/2548: check if weight …
2019-07-16 14:02:07 +02:00
kimkulling
c1670b6a97 closes https://github.com/assimp/assimp/issues/2548: check if weight are set or set the weight to 1.0f 2019-07-16 11:40:34 +02:00
ywang
f045170048 update 2019-07-15 15:52:45 -07:00
ywang
2bffdc7e08 Merge branch 'fix_export_custom_bindpose_error' of https://github.com/thomasbiang/assimp into fix_export_custom_bindpose_error 2019-07-15 15:50:36 -07:00
thomasbiang
36130f9b86 use ExportProperties to customize bind pose epsilon 2019-07-15 15:49:55 -07:00
thomasbiang
add4d6028b clean up 2019-07-15 15:49:55 -07:00
thomasbiang
f2731a1b99 customize error rate for bind pose 2019-07-15 15:49:55 -07:00
Kim Kulling
b344beb00b Merge pull request #2546 from Frooxius/master
Some FBX multi-material mesh fixes
2019-07-14 13:10:03 +02:00
Frooxius
bcdb173e09 - Fixed anim meshes generated from blendshapes not being copied to output for multi-material meshes
- Fixed first vertex of each blendshape on a multi-material mesh having all unmapped vertice offsets being added to it
- Fixed blendshapes not importing for multi-material FBX meshes with no bones
2019-07-13 22:20:47 +02:00
Kim Kulling
4a2df57241 Merge pull request #2541 from assimp/kimkulling_dev
Kimkulling dev
2019-07-12 20:43:19 +02:00
RichardTea
07d3a7d5b0 Fix some warnings
Hopefully the sorts out the MSVC2013 compiler
2019-07-12 16:02:51 +01:00
RichardTea
678dd32da3 Add missing header 2019-07-12 15:37:10 +01:00
kimkulling
8f74508e40 Fix missing doc in config.h 2019-07-12 16:28:36 +02:00
Kim Kulling
e786483c64 Merge branch 'master' into fix_export_custom_bindpose_error 2019-07-12 16:27:13 +02:00
kimkulling
53c0f91305 Add unittest for json. 2019-07-12 16:08:51 +02:00
RichardTea
0c718a9c95 Add Collada ZAE unit test 2019-07-12 14:56:29 +01:00
RichardTea
2a72c9b616 Read embedded textures from Collada ZAE 2019-07-12 14:46:48 +01:00
RichardTea
ddd1e770b9 First pass of Collada ZAE support
Reads the manifest and loads the DAE
Does not yet load embedded textures
2019-07-12 11:36:46 +01:00
RichardTea
8636d5607c Add ZipArchiveIOSystem to CMake 2019-07-12 11:35:43 +01:00
RichardTea
d64e1bde13 First pass of Collada ZAE support
Reads the manifest and loads the DAE
Does not yet load embedded textures
2019-07-12 11:29:35 +01:00
RichardTea
2c7f607e7c Create ZipArchiveIOSystem
Moved IOSystem Unzip functionality out of D3MF Importer into include/assimp
Cleaned up and more efficient:
Don't map the archive until the caller opens a file or requests the contents list
Don't extract any files until they are opened
Store the location of the data within the ZIP and extract it later if the file is opened.
2019-07-12 11:22:17 +01:00
thomasbiang
259a9bd2af use ExportProperties to customize bind pose epsilon 2019-07-11 17:00:47 -07:00
Kim Kulling
3b3a965d2b Delete JTImporter.h 2019-07-11 22:31:40 +02:00
Kim Kulling
b1d8398243 Delete JTImporter.cpp
Remove JTImorter.cpp from pull request
2019-07-11 22:31:24 +02:00
Kim Kulling
8bf1b9ac5e Update CMakeLists.txt
remove jtimporter
2019-07-11 22:29:30 +02:00
Kim Kulling
82e7775d6d Update JTImporter.cpp
disable unused method,.
2019-07-11 19:23:00 +02:00
Kim Kulling
da33262bcc Update FBXConverter.cpp
Fix merge conflicts
2019-07-11 19:17:41 +02:00
kkulling
eb5e829436 Assjson: add json export to list of exporters. 2019-07-11 17:43:03 +02:00
kkulling
2e782f43e5 Merge branch 'master' into kimkulling_dev 2019-07-11 17:37:52 +02:00
kkulling
b463ddd399 closes https://github.com/assimp/assimp/issues/340: start integrating assimp2json. 2019-07-11 17:37:31 +02:00
thomasbiang
f03f099fa8 clean up 2019-07-10 16:29:50 -07:00
thomasbiang
f703a798f4 customize error rate for bind pose 2019-07-10 16:27:59 -07:00
thomasbiang
d7773dcfba set->unordered_set;unsigned int for iteration 2019-07-10 09:51:20 -07:00
RichardTea
47661034ae Merge pull request #15 from assimp/master
From upstream
2019-07-10 17:46:04 +01:00
thomasbiang
6b5e0a9914 fix group node being exported as bone node 2019-07-09 19:05:45 -07:00
Kim Kulling
bc8f85eeae Merge pull request #2535 from assimp/issue_2182
closes code/Collada/ColladaLoader.cpp: fix possible memleak when thro…
2019-07-09 21:41:05 +02:00
Kim Kulling
39dc9801e0 Update ColladaLoader.cpp
- add header memory
- Fix format stuff
2019-07-09 20:35:57 +02:00
Kim Kulling
a01302dd4d Merge branch 'master' into issue_2182 2019-07-09 19:45:40 +02:00
Kim Kulling
ed6dbf9533 closes code/Collada/ColladaLoader.cpp: fix possible memleak when throwing an exception. 2019-07-09 19:44:56 +02:00
kkulling
b87f4c03ba Remove not needed init. 2019-07-09 11:49:59 +02:00
Kim Kulling
b688797766 Merge pull request #2533 from assimp/issue_2439
closes https://github.com/assimp/assimp/issues/2439: add null ptr tes…
2019-07-05 01:21:09 +02:00
Kim Kulling
01070b4de7 closes https://github.com/assimp/assimp/issues/2439: add null ptr test before calling hasAttr. 2019-07-04 22:34:11 +02:00
Kim Kulling
5a82e27885 Merge pull request #2532 from assimp/kimkulling_dev
closes https://github.com/assimp/assimp/issues/2527: use correct macr…
2019-07-04 20:29:53 +02:00
Kim Kulling
ae7b1f1a77 Merge branch 'master' into kimkulling_dev 2019-07-03 18:28:15 +02:00
Kim Kulling
6beed14e35 Merge pull request #2531 from assimp/fbx_multimatmesh_with_blendshapes
closes https://github.com/assimp/assimp/issues/2368: just fix it
2019-07-03 18:27:53 +02:00
Kim Kulling
0ec5eb752c Update FBXConverter.cpp
Removing dead and unused code.
2019-07-03 12:50:01 +02:00
Kim Kulling
08eb6701c3 Merge branch 'master' into fbx_multimatmesh_with_blendshapes 2019-07-02 23:29:55 +02:00
Kim Kulling
fa827f9075 Merge pull request #2528 from marxin/fix-gcc-9-warning
Fix a GCC 9 warning:
2019-07-02 23:29:29 +02:00
Kim Kulling
1fc232effa closes https://github.com/assimp/assimp/issues/2368: just fix it 2019-07-02 21:46:52 +02:00
Kim Kulling
96f16c7aea closes https://github.com/assimp/assimp/issues/2527: use correct macro for Assimp-exporter. 2019-07-02 19:48:53 +02:00
Martin Liska
ab55fb27c3 Fix a GCC 9 warning:
assimp/include/assimp/material.inl: In member function 'aiReturn aiMaterial::Get(const char*, unsigned int, unsigned int, aiColor3D&) const':
assimp/include/assimp/material.inl:176:33: error: implicitly-declared 'aiColor3D& aiColor3D::operator=(const aiColor3D&)' is deprecated [-Werror=deprecated-copy]
176 |     pOut = aiColor3D(c.r,c.g,c.b);
2019-07-02 13:38:04 +02:00
RichardTea
500983074b Merge pull request #14 from assimp/master
Update to upstream
2019-07-02 10:50:33 +01:00
Kim Kulling
ff662a6104 Merge pull request #2523 from muxanickms/topic/embedded_texture_name_fix
All textures use relative path except embedded textures, this is a fix for it
2019-06-30 20:30:17 +02:00
Kim Kulling
3fcf3bd81f Merge branch 'master' into topic/embedded_texture_name_fix 2019-06-30 12:43:40 +02:00
Kim Kulling
01d144ce89 Merge pull request #2526 from rconde01/bugfix/issue_2525_lwo_node_name_repeats
initialize unnamed node uniqueness index outside of loop
2019-06-29 00:31:05 +02:00
Rob Conde
f5ece83f31 initial unnamed node uniqueness index outside of loop 2019-06-28 16:12:58 -04:00
Kim Kulling
1ec01a870f Merge pull request #2519 from RichardTea/issue_2518_active_importer_ident
API: Add active importer identification
2019-06-28 21:44:11 +02:00
Mike Samsonov
6d07473550 all textures use relative path except embedded, this is fix for it 2019-06-27 17:59:55 +01:00
Kim Kulling
05f5b54f75 Merge branch 'master' into issue_2518_active_importer_ident 2019-06-27 14:02:01 +02:00
Kim Kulling
07779a7ae1 Merge pull request #2517 from RichardTea/issue_2456_text_formats_precision
Auto-detect text format export precision
2019-06-27 14:01:38 +02:00
Kim Kulling
af199c50aa Merge branch 'master' into issue_2456_text_formats_precision 2019-06-26 17:31:11 +02:00
Kim Kulling
b15311661c Merge pull request #2516 from RichardTea/fix_issue_2507_collada_import
Fix issue 2507 collada import
2019-06-26 17:30:39 +02:00
Kim Kulling
853afdf42b Merge branch 'master' into fix_issue_2507_collada_import 2019-06-25 20:19:42 +02:00
Kim Kulling
ed0cd2f775 Merge pull request #2521 from assimp/kimkulling_dev
Kimkulling dev
2019-06-25 00:24:24 +02:00
Kim Kulling
d7e442f78a Add missing file. 2019-06-24 21:48:52 +02:00
Kim Kulling
1952144445 Merge branch 'kimkulling_dev' of https://github.com/assimp/assimp into kimkulling_dev 2019-06-24 21:46:05 +02:00
Kim Kulling
0f66a917e5 Add unittest. 2019-06-24 21:37:53 +02:00
RichardTea
8f43fb144a Add "importerIndex" Importer property
This indicates the index of the Importer that was selected, or -1 if did not find one at all.
2019-06-24 14:55:48 +01:00
Kim Kulling
26bd54ae0b PostProcesswing: add gen-aabb process to postprocessing. 2019-06-23 20:24:32 +02:00
Kim Kulling
418c07a9bb closes https://github.com/assimp/assimp/issues/2368: add missign anim mesh for multimaterial meshes in fbx,. 2019-06-21 18:00:53 +02:00
RichardTea
bf252c4452 Add configuration of text format precision
Define ASSIMP_AI_REAL_TEXT_PRECISION
8 when ai_real is float
16 when ai_real is double
2019-06-20 18:11:11 +01:00
RichardTea
59f732e10d DAE Import: Don't use SkipElement() to skip empty Text
IrrXML doesn't recognise the construction: `<author></author>` as being an empty element, and so ColladaParser::TestTextContent advances the element stream into the `</author>` element.

Use TestClosing(const char*) instead of SkipElement() to skip an empty text element.
2019-06-20 16:30:52 +01:00
RichardTea
fb8ee5e301 Merge pull request #13 from assimp/master
fast forward to upstream
2019-06-20 15:54:17 +01:00
Kim Kulling
6b3d6c3b8f JT: next steps. 2019-06-18 20:35:02 +02:00
Kim Kulling
3929ea0644 Merge pull request #2254 from assimp/kimkulling-patch-3
Update XFileParser.cpp
2019-06-15 20:39:37 +02:00
Kim Kulling
ced080f9f3 X: fix out of bound access. 2019-06-15 19:17:15 +02:00
Kim Kulling
eb27fb753d Merge branch 'master' into kimkulling-patch-3 2019-06-15 13:44:13 +02:00
Kim Kulling
2d3c3379e5 Merge pull request #2488 from rbsheth/rbsheth_hunterize_assimp
Use Hunter for pulling in dependencies
2019-06-15 10:14:22 +02:00
Rahul Sheth
6c33374491 update install interface location 2019-06-13 22:08:34 -07:00
Rahul Sheth
d00f4f4b3a Build Hunter-compatible config file 2019-06-13 21:34:47 -07:00
Rahul Sheth
5cda81e84b code fixes for Hunter-based build 2019-06-13 21:32:37 -07:00
Rahul Sheth
dab8041bcd rewrite include paths for Hunter packages 2019-06-13 21:32:36 -07:00
Rahul Sheth
a4587e8609 Use hunter to download dependencies if HUNTER_ENABLED is ON 2019-06-13 21:31:24 -07:00
Rahul Sheth
1db3e1e11f Allow CXX_STANDARD and other relevant compiler definitions to be set by Hunter user 2019-06-13 21:31:24 -07:00
Rahul Sheth
dd9511aaef Add HunterGate URL/SHA1 2019-06-13 21:31:24 -07:00
Rahul Sheth
34fa64faf9 Add HunterGate 2019-06-13 21:31:24 -07:00
Kim Kulling
b381467fc3 Merge pull request #2508 from pkoller/patch-1
fixed MSVC toolset versions >140
2019-06-13 15:40:49 +02:00
Kim Kulling
ba29b8f1da Merge branch 'master' into patch-1 2019-06-13 13:41:40 +02:00
Kim Kulling
43375eafb7 Merge pull request #2509 from pkoller/pkoller-patch-1
additional changes in cmake template to find correct toolset version
2019-06-13 13:41:03 +02:00
Kim Kulling
8ec3aaed7d Merge branch 'master' into pkoller-patch-1 2019-06-13 09:04:53 +02:00
Kim Kulling
8d0567f727 Merge pull request #2510 from assimp/issue_2431
closes https://github.com/assimp/assimp/issues/2431: use irrXml direc…
2019-06-13 09:04:37 +02:00
Kim Kulling
c2097d9d0a Merge branch 'master' into issue_2431 2019-06-12 23:18:44 +02:00
Kim Kulling
05de460ced Merge pull request #2497 from assimp/kimkulling-patch-doc
Fix documentation for assimp.net
2019-06-12 23:18:29 +02:00
Kim Kulling
0021c93892 closes https://github.com/assimp/assimp/issues/2431: use irrXml directly for mingw compiler. 2019-06-12 22:12:38 +02:00
Kim Kulling
6ed753d80a Merge branch 'master' into kimkulling-patch-doc 2019-06-12 21:58:24 +02:00
Kim Kulling
fc06de82c6 Update Readme.md
Add more detailed information about the source code structure
2019-06-12 20:44:02 +02:00
Kim Kulling
963c6f1977 Merge branch 'master' into pkoller-patch-1 2019-06-12 18:44:39 +02:00
Kim Kulling
a4907e54b1 Merge pull request #2506 from assimp/reorg
Reorg
2019-06-12 15:05:53 +02:00
Kim Kulling
66f693a6a4 Update IRRLoader.cpp
fix case-sensitive typo.
2019-06-12 10:25:11 +02:00
Kim Kulling
e914b9531b Update IRRLoader.h
fix case-sensity typo.
2019-06-12 00:55:06 +02:00
Kim Kulling
4dcb3c9235 Update ImporterRegistry.cpp
fix case-sensiive folder bug.
2019-06-11 21:55:21 +02:00
Kim Kulling
fc065d8ab4 Merge branch 'master' into reorg 2019-06-11 20:59:46 +02:00
Kim Kulling
a6e3fc3fd9 Fix case-sensitive folder name for unix platforms. 2019-06-11 20:54:01 +02:00
Kim Kulling
cc10967913 Fix the build. 2019-06-11 20:17:50 +02:00
PK
d24b6e220b toolset changes in debug cmake template 2019-06-11 15:24:39 +02:00
PK
03c01004c5 toolset also in cmake release template 2019-06-11 15:23:05 +02:00
PK
d448b49ae1 fixed MSVC toolset versions >140
according to https://cmake.org/cmake/help/latest/variable/MSVC14.html the use of the MSVC** flags is deprecated, this change uses the encouraged MSVC_VERSION variable.
2019-06-11 15:16:53 +02:00
Kim Kulling
1651f16239 Merge pull request #2501 from petrmohelnik/glTF-importer---clean-all-member-arrays
glTF importer - clean all member arrays
2019-06-11 11:32:34 +02:00
Kim Kulling
f76d77955d Merge branch 'master' into reorg 2019-06-11 00:22:50 +02:00
Kim Kulling
2da3a38d60 Fix the compile pass, still unresolved symbols. 2019-06-10 23:26:00 +02:00
Kim Kulling
7e20356a20 Update XFileParser.cpp
Fix exception.
2019-06-10 20:32:56 +02:00
RichardTea
47c70a8811 Merge pull request #12 from assimp/master
fast forward to upstream
2019-06-10 10:16:44 +01:00
Kim Kulling
6fc42cb898 Merge branch 'master' into kimkulling-patch-3 2019-06-10 00:39:05 +02:00
Kim Kulling
a4bda3a205 Update XFileParser.cpp
Test
2019-06-09 21:25:25 +02:00
Kim Kulling
2d985b92c9 Fix references in cmake file. 2019-06-09 18:43:56 +02:00
petrmohelnik
83247e3fbd Merge branch 'master' into glTF-importer---clean-all-member-arrays 2019-06-09 15:52:32 +02:00
Kim Kulling
56d145e26a Merge pull request #2502 from arkeon7/Ogre_with_skeleton_missing
Prevent crash when Ogre skeleton file is missing
2019-06-09 01:21:35 +02:00
Kim Kulling
cbd5c5b284 Merge branch 'master' into Ogre_with_skeleton_missing 2019-06-08 21:31:47 +02:00
Kim Kulling
4a46717a77 Merge branch 'master' into kimkulling-patch-3 2019-06-08 09:09:37 +02:00
Kim Kulling
7dc38faeba Merge pull request #2483 from akien-mga/code-chmod-644
Remove Unix executable bit on code files
2019-06-08 09:05:55 +02:00
Arkeon
5679dd435a Prevent crash when Ogre skeleton file is missing 2019-06-07 09:49:24 +02:00
RichardTea
ee7a2b6e31 Merge pull request #11 from assimp/master
fast forward
2019-06-07 08:11:08 +01:00
Kim Kulling
57c46db042 Reorg of code. 2019-06-06 14:45:43 +02:00
Kim Kulling
589a306c85 Merge branch 'master' into code-chmod-644 2019-06-06 09:16:07 +02:00
Kim Kulling
6ed4f5d936 JT: Inital commit. 2019-06-06 08:29:12 +02:00
petrmohelnik
1855bf44f9 glTF importer - clean all member arrays
When importing more than one scene using the same gtlf importer loading fails with error 'bad array new length'. This happens because 'meshOffsets' are not cleared and the importer continues to push_back values at the end. Adjacent values are then used to calculate the length of 'mMeshes' array. This calculation expects that each value is higher than the previous otherwise we get negative length. But when pushin at the end of uncleared array we get contents like this: 0,1,2,3,0,1,2. Then when calculating 0-3 we try to allocate array of length -3 and get this exception.
2019-06-05 18:51:49 +02:00
Kim Kulling
83237de02f Merge pull request #2485 from jackoalan/static-lib-export
Export static libaries as CMake package
2019-06-04 19:43:19 +02:00
Kim Kulling
e8a4d60b6f Merge branch 'master' into static-lib-export 2019-06-04 15:43:42 +02:00
Kim Kulling
5dcb2cb8c0 Merge pull request #2473 from RichardTea/slow_xml_load
Speed up loading of XML-based formats
2019-06-04 15:20:20 +02:00
Kim Kulling
cead840a75 Merge branch 'master' into slow_xml_load 2019-06-04 12:50:43 +02:00
Kim Kulling
4de162fa79 Merge pull request #2484 from aavenel/FindInstancesProcessOptim
Optim FindInstancesProcess
2019-06-04 12:50:16 +02:00
Kim Kulling
dcee3295cc Merge branch 'master' into FindInstancesProcessOptim 2019-06-04 10:36:59 +02:00
Kim Kulling
fe4fd00a82 Merge branch 'master' into slow_xml_load 2019-06-03 22:58:02 +02:00
Kim Kulling
4d66b33253 Update Readme.md
Fix wrong link
2019-06-03 22:36:57 +02:00
Kim Kulling
35f9517510 Fix dox
Fix the assimp.net link
2019-06-03 22:34:22 +02:00
Kim Kulling
04117e1378 Merge pull request #2490 from olsoneric/add_null_check_py
Ensure obj is not null before using hasattr
2019-06-03 00:11:11 +02:00
Kim Kulling
f0f2a7fc09 Merge branch 'master' into add_null_check_py 2019-06-02 12:54:51 +02:00
Kim Kulling
0215d77abd Merge pull request #2496 from muxanickms/topic/double_precision_fix
FBX Importer double precision fix
2019-06-02 12:54:20 +02:00
Mike Samsonov
48ed2d2d3c Double precision fix 2019-05-30 10:54:44 +01:00
Kim Kulling
5bc6787d57 Merge branch 'master' into FindInstancesProcessOptim 2019-05-29 12:21:48 +02:00
Kim Kulling
1370e0b26f Merge pull request #2491 from marzer/visual-studio-fixes
quality-of-life improvements for Visual Studio
2019-05-29 12:20:56 +02:00
Kim Kulling
cf4d656bbf Merge branch 'master' into visual-studio-fixes 2019-05-29 11:12:01 +02:00
Kim Kulling
a6b51ef911 Merge branch 'master' into code-chmod-644 2019-05-29 08:59:47 +02:00
Kim Kulling
eb6d9db505 Merge pull request #2480 from aavenel/ParsePostProcessArgs
Parse post process arguments when using info tool
2019-05-29 08:59:06 +02:00
Kim Kulling
85a7f46049 Merge branch 'master' into ParsePostProcessArgs 2019-05-29 00:03:09 +02:00
Kim Kulling
873762cf60 Merge pull request #2482 from akien-mga/utf8
Fix code files encoding to make them all UTF-8
2019-05-29 00:02:29 +02:00
Kim Kulling
f114aa8d9b Merge branch 'master' into ParsePostProcessArgs 2019-05-28 20:11:43 +02:00
Kim Kulling
51527ba038 Merge branch 'master' into utf8 2019-05-28 19:53:14 +02:00
Mark Gillard
dff92d7733 quality-of-life improvements for Visual Studio 2019-05-27 21:14:50 +03:00
Eric Olson
3924a5c32a Ensure obj is not null before using hasattr
Fixes error shown below:
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 320, in load
    scene = _init(model.contents)
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 206, in _init
    raise e
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 187, in _init
    call_init(e, target)
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 80, in call_init
    _init(obj.contents, obj, caller)
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 214, in _init
    if _is_init_type(obj):
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\core.py", line 86, in _is_init_type
    if helper.hasattr_silent(obj,'contents'): #pointer
  File "C:\Users\micro\build2\boxwin_external_libs\pyassimp\helper.py", line 277, in hasattr_silent
    return hasattr(object, name)
ValueError: NULL pointer access
2019-05-27 13:06:38 -05:00
Kim Kulling
ca13160369 Merge pull request #2472 from ucla-pbpl/set_stl_mesh_names
Add mesh names to imported ASCII STL
2019-05-26 08:53:20 +02:00
Jack Andersen
d048bccad1 Export static libaries as CMake package
When built with BUILD_SHARED_LIBS disabled, the exported CMake
targets are modified to reference the static library location.

This also fixes version detection for VS2017 and beyond within
the target import script.
2019-05-24 22:06:50 -10:00
Kim Kulling
5c3662dc6d Merge branch 'master' into set_stl_mesh_names 2019-05-24 21:49:35 +02:00
Kim Kulling
4feefaf5f7 Merge pull request #2469 from muxanickms/topic/fbx_node_naming_optimization
Node names optimization and fixing non-unique name
2019-05-24 21:48:07 +02:00
Kim Kulling
b03b3b9c03 Initial parsing for header and more. 2019-05-24 17:22:54 +02:00
Brian Naranjo
fdcae81b61 Merge branch 'master' into set_stl_mesh_names 2019-05-23 11:21:49 -07:00
Kim Kulling
e1ed975839 Merge branch 'master' into topic/fbx_node_naming_optimization 2019-05-22 20:13:36 +02:00
Alexandre Avenel
daef984ac6 Optim FindInstancesProcess
ComputePositionEpsilon() is a costly function which was called in the inner
loop although it only uses data from upper loop.
2019-05-22 20:00:33 +02:00
Kim Kulling
f0a0de63e9 Merge pull request #2475 from ruxkor/master
Revert e45d12: Refers erroneously to ctype instead of ctypes
2019-05-22 19:03:36 +02:00
Rémi Verschelde
fc7575f5c5 Remove Unix executable bit on code files 2019-05-22 10:23:13 +02:00
Rémi Verschelde
5fa750fda0 Fix code files encoding to make them all UTF-8 2019-05-22 10:19:32 +02:00
Kim Kulling
1d05f1b222 Merge branch 'master' into master 2019-05-22 00:14:18 +02:00
Kim Kulling
9787ac724f Merge pull request #2468 from muxanickms/topic/fbx_file_more_than_4gb
Support for FBX file sizes more than 4GB
2019-05-22 00:13:33 +02:00
Kim Kulling
52d4564b7e Merge branch 'master' into topic/fbx_file_more_than_4gb 2019-05-21 20:12:57 +02:00
Kim Kulling
0e8444b83f Merge pull request #2466 from muxanickms/topic/fragmented_embedded_textures
Fragmented FBX ASCII emdedded resource
2019-05-21 20:12:31 +02:00
Alexandre Avenel
a60b7696e3 Parse post process arguments when using info tool 2019-05-21 19:39:49 +02:00
Mike Samsonov
0eec1c1d4a One map to rule them all 2019-05-21 16:05:38 +01:00
Brian Naranjo
7ac831489c Merge branch 'master' into set_stl_mesh_names 2019-05-20 08:52:20 -07:00
Andor Goetzendorff
b10dc5747b Revert "Remove experimental change unintentionally included in commit f001dfc8"
This reverts commit e45d120f21.
2019-05-20 15:35:19 +02:00
RichardTea
b1975aaabc Merge branch 'master' into slow_xml_load 2019-05-20 14:11:26 +01:00
RichardTea
b8262c4c70 Merge pull request #8 from assimp/master
Fast forward
2019-05-20 08:09:55 -05:00
RichardTea
45c12cd5fb Update irrXMLWrapper.h
Use std::find to find and remove null characters from XML
2019-05-20 13:49:56 +01:00
Kim Kulling
627cb93b0b Merge branch 'master' into topic/fragmented_embedded_textures 2019-05-19 20:16:49 +02:00
Kim Kulling
b4eb974d9e Merge pull request #2464 from muxanickms/topic/exception_spam_fix_fbxmaterial
Exception spam fix for FBXMaterial
2019-05-19 19:50:43 +02:00
Brian Naranjo
ff4ab7ff2e Add mesh names to imported ASCII STL 2019-05-17 11:48:57 -07:00
Kim Kulling
2f4cb93764 Merge branch 'master' into topic/exception_spam_fix_fbxmaterial 2019-05-17 19:43:54 +02:00
Kim Kulling
9740c043c6 Merge pull request #2463 from muxanickms/topic/degenerate_area_fix
Degenerate triangles with small area removing fix
2019-05-16 23:30:07 +02:00
Kim Kulling
4b10c7e432 Merge branch 'master' into topic/degenerate_area_fix 2019-05-16 21:44:46 +02:00
Kim Kulling
d29e245536 Merge pull request #2462 from assimp/kimkulling-2449
Update CMakeLists.txt
2019-05-16 21:44:30 +02:00
Kim Kulling
81f8ebf2d4 Merge branch 'master' into kimkulling-2449 2019-05-16 17:04:09 +02:00
Kim Kulling
2ba3d956d1 Merge pull request #2458 from jackoalan/pdb-install-fix
Set directory and name properties for installing static lib PDB
2019-05-16 17:03:36 +02:00
Kim Kulling
7cd021e704 Merge branch 'master' into pdb-install-fix 2019-05-16 14:49:29 +02:00
Kim Kulling
6fda615706 Merge pull request #2434 from mvorbrodt/master
Generate attenuation constants if non are provided in the Blender file…
2019-05-16 14:48:21 +02:00
Mike Samsonov
6c13ec8190 fix for clang runtime checks for overflow 2019-05-16 11:59:23 +01:00
Mike Samsonov
c84ac7a135 Fragmented FBX ASCII emdedded resource 2019-05-16 11:59:23 +01:00
Mike Samsonov
13bba4fb4c even more efficient 2019-05-16 11:58:48 +01:00
Mike Samsonov
b957d44943 Node names optimization and fixing non-unique name 2019-05-16 11:58:48 +01:00
Mike Samsonov
c58ed8da22 Support for FBX file sizes more than 4GB 2019-05-16 11:58:26 +01:00
Mike Samsonov
4e03a2c00d Exception spam fix for FBXMaterial 2019-05-16 11:58:07 +01:00
Mike Samsonov
5bca43be74 Degenerate triangles with small area removing fix 2019-05-16 11:57:46 +01:00
Kim Kulling
77281b75b2 Merge branch 'master' into master 2019-05-16 11:13:48 +02:00
Kim Kulling
524d8c281e Merge pull request #2460 from jackoalan/windows-external-zlib-fix
Fix Windows build with external zlib
2019-05-14 23:59:07 +02:00
Kim Kulling
785ceaf58a Merge branch 'master' into windows-external-zlib-fix 2019-05-14 22:07:56 +02:00
Rich ard
f50a0f0648 Merge branch 'master' into pr/7 2019-05-14 13:20:27 -05:00
Kim Kulling
add086b9e8 Merge pull request #2427 from RichardTea/assimpview_unicode
Some MSVC/Windows corrections and updates, issue 2302
2019-05-14 18:59:58 +02:00
Kim Kulling
747a7c963b Merge branch 'master' into assimpview_unicode 2019-05-13 23:49:06 +02:00
Kim Kulling
5bee5307e4 Merge pull request #2461 from assimp/issue_2459
closes https://github.com/assimp/assimp/issues/2459: fix duplicated f…
2019-05-13 23:48:42 +02:00
Kim Kulling
815730c92d Update CMakeLists.txt
closes https://github.com/assimp/assimp/issues/2449: fix uwp handling
2019-05-13 21:49:50 +02:00
Kim Kulling
adbdbf2be6 closes https://github.com/assimp/assimp/issues/2459: fix duplicated fbx-type propertry. 2019-05-13 21:41:37 +02:00
Jack Andersen
461e21f66d Fix Windows build with external zlib
assimp.rc contains an include with a double-parent header search.
In a default build configuration, this is resolved via the
configuration header path generated for in-tree zlib.

When external zlib is used, this header search path is not provided
to the RC compiler, therefore fails to find revision.h.

This is solved by simply including "revision.h" since the root of
the binary directory is already used as a search path.
2019-05-12 10:56:59 -10:00
Jack Andersen
cb0c47764a Set directory and name properties for installing static lib PDB 2019-05-11 12:11:52 -10:00
Kim Kulling
c48adf2301 Merge pull request #2455 from assimp/issue_2335
closes https://github.com/assimp/assimp/issues/2335: add cmake-module…
2019-05-11 20:43:02 +02:00
Kim Kulling
fd0e0d05e6 Inno: fix ArchitecturesInstallIn64BitMode for x86 platforms. 2019-05-11 13:02:07 +02:00
Kim Kulling
0898484d45 Inno: fix folder names + versions. 2019-05-11 11:02:28 +02:00
Kim Kulling
6aecfd0183 closes https://github.com/assimp/assimp/issues/2334: run vc_redist in passive + quiet mode. 2019-05-11 09:39:23 +02:00
Kim Kulling
64ff361610 closes https://github.com/assimp/assimp/issues/2335: add cmake-modules to the installer. 2019-05-11 09:19:43 +02:00
Kim Kulling
4f7de109a1 Merge branch 'master' into assimpview_unicode 2019-05-10 18:52:32 +02:00
Kim Kulling
2582ae53ee Merge pull request #2450 from mlavik1/fbxexport_crashfix
Fix for crash in StreamWriter::PutString when exporting ASCII FBX
2019-05-10 18:51:57 +02:00
Kim Kulling
741be6f9db Merge branch 'master' into fbxexport_crashfix 2019-05-10 15:32:18 +02:00
Kim Kulling
f81b90a469 Merge pull request #2451 from mlavik1/fbxexporter_embedded_textures
FBXExporter: Embedded texture support
2019-05-10 15:30:57 +02:00
Kim Kulling
700954c115 Update FBXExporter.cpp
Just fixed some typos.
2019-05-10 09:09:47 +02:00
Matias
a443544986 Replaced binary literals with hex literals (since binary literals was introduced in C++14) 2019-05-09 15:28:00 +02:00
Matias
9903504c42 Removed some code that I didn't mean to fix (I already submitted this in another PR: https://github.com/assimp/assimp/pull/2450). 2019-05-09 14:57:18 +02:00
Matias
575ef4d927 Added support for embedded textures to the FBXExporter (both binary and ASCII). Also made the FBX-namespaces more consistent (we had both Assimp::FBX:: and FBX::). Since we seem to support two types of embedded texture references (both asterisk+texture_id and filepath) I made the exporter use aiScene::GetEmbeddedTexture for looking up texture reference and integrated @loebl 's modification of the function to support the old ("*1") type of references (https://github.com/loebl/assimp/commit/e217358) 2019-05-09 14:50:22 +02:00
Matias
6736f3d24b Don't call PutString with an empty string. Both DumpChildrenAscii and EndAscii can return without modifyting the string, so we need to check the string before calling PutString. This used to cause a crash. 2019-05-09 11:19:05 +02:00
Kim Kulling
9430696048 Merge pull request #2433 from hshakula/gltf2-import-animation-name
Fix inconsistency between animation and node name in glTF2 Importer
2019-05-08 08:41:41 +02:00
Kim Kulling
56b82e9cd5 Merge branch 'master' into gltf2-import-animation-name 2019-05-07 21:43:29 +02:00
Kim Kulling
880e5ee32c Merge pull request #2448 from assimp/fbx_convert_to_unit
Fbx convert to unit
2019-05-07 21:43:08 +02:00
Kim Kulling
e1a0861556 Merge branch 'fbx_convert_to_unit' of https://github.com/assimp/assimp into fbx_convert_to_unit 2019-05-07 20:33:42 +02:00
Kim Kulling
390452bd06 Fix the build. 2019-05-07 20:32:45 +02:00
Kim Kulling
66a840d9e6 Merge branch 'master' into fbx_convert_to_unit 2019-05-07 15:26:52 +02:00
Kim Kulling
9501483367 Merge pull request #2438 from b1skit/master
Updated FBXConverter to set material shading mode when possible
2019-05-07 15:26:26 +02:00
Kim Kulling
22b01ca3e8 Merge branch 'master' into master 2019-05-07 09:55:43 +02:00
Kim Kulling
1517bfcb9f Merge pull request #2447 from assimp/issue_2054
Add missing doc.
2019-05-07 09:55:28 +02:00
Kim Kulling
e917b288a1 fix a typo. 2019-05-06 21:38:45 +02:00
Kim Kulling
4155f005be Add implementation to convert from cm to m. 2019-05-06 21:21:58 +02:00
Kim Kulling
4a9cd08451 Prepaation for conversion. 2019-05-06 20:51:04 +02:00
Kim Kulling
e611ccc933 Merge branch 'issue_2054' of https://github.com/assimp/assimp into issue_2054 2019-05-06 19:15:35 +02:00
Kim Kulling
02324123e5 Fix typo in comment. 2019-05-06 19:15:28 +02:00
Kim Kulling
e6b4a21be1 Merge branch 'master' into issue_2054 2019-05-06 18:47:14 +02:00
Kim Kulling
1203d4658c Add missing doc. 2019-05-06 18:44:30 +02:00
Kim Kulling
34084423ca Merge pull request #2446 from assimp/issue_2054
closes https://github.com/assimp/assimp/issues/2054: make empty bone …
2019-05-05 22:20:41 +02:00
Kim Kulling
e403aaa0cc Merge branch 'issue_2054' of https://github.com/assimp/assimp into issue_2054 2019-05-05 19:27:40 +02:00
Kim Kulling
eb1a2586c3 add missing define in config.h.in 2019-05-05 17:44:15 +02:00
Kim Kulling
df2a279895 Merge branch 'master' into issue_2054 2019-05-05 16:28:39 +02:00
Kim Kulling
e1fce7819c Merge pull request #2435 from ov/bad-obj-file
bad OBJ file that can still be read
2019-05-05 16:28:18 +02:00
Kim Kulling
9147fb8689 Merge branch 'issue_2054' of https://github.com/assimp/assimp into issue_2054 2019-05-05 16:24:05 +02:00
Kim Kulling
1324409c7b fix build: fix wrong function prototype. 2019-05-05 16:23:42 +02:00
Kim Kulling
8c18c42afb Merge branch 'master' into issue_2054 2019-05-05 16:16:45 +02:00
Kim Kulling
69ece762d1 fix the build: remove errorenous pragma statement. 2019-05-05 16:00:57 +02:00
Kim Kulling
fcff12b219 closes https://github.com/assimp/assimp/issues/2054: make empty bone validation optional. 2019-05-05 13:39:10 +02:00
Kim Kulling
9b9f7b2876 Merge branch 'master' into bad-obj-file 2019-05-04 21:17:15 +02:00
Kim Kulling
4a6b9d716a Merge pull request #2430 from Hugo-Pereira/fix_assimp_export_consistency
[FBX Export] fixed ordering of skin indices and weights, to be consistent between systems
2019-05-04 21:16:34 +02:00
Hugo Pereira
34ede5608b Merge branch 'master' into fix_assimp_export_consistency 2019-05-03 11:12:56 +01:00
Kim Kulling
2f38545cc4 Merge pull request #2429 from RichardTea/obj_nan
OBJ: Coerce texture coords of nan or infinity to zero
2019-05-03 11:20:25 +02:00
Kim Kulling
6d5f8cbe26 Merge branch 'master' into obj_nan 2019-05-02 01:36:45 +02:00
Kim Kulling
3e57510af5 Merge pull request #2426 from Epsirom/issue-2339
Fix "bytes aketrans" issues in Python>=3.1
2019-05-01 23:23:45 +02:00
Kim Kulling
8dacbf49f9 Merge branch 'master' into issue-2339 2019-05-01 19:47:36 +02:00
Kim Kulling
5498a50612 Merge pull request #2425 from simonppg/master
Fix typo on README.md
2019-05-01 19:47:09 +02:00
Kim Kulling
7c48552462 Merge branch 'master' into master 2019-05-01 18:15:22 +02:00
Kim Kulling
647d2f8d18 Merge pull request #2418 from Cgettys/fix-mingw-debug-build
Fix mingw debug build
2019-05-01 18:13:12 +02:00
Kim Kulling
e108b6f1d2 Merge branch 'master' into fix-mingw-debug-build 2019-05-01 17:04:45 +02:00
Kim Kulling
37bf09ef0b Merge pull request #2442 from assimp/RichardTea-collada_metadata
Richard tea collada metadata
2019-05-01 17:04:01 +02:00
Kim Kulling
d9cfc48a66 Update script_x86.iss
fix export lib name
2019-05-01 15:53:04 +02:00
Kim Kulling
c93886e87b Update script_x64.iss
Fix eport lib name.
2019-05-01 15:52:27 +02:00
Kim Kulling
3ee85a8cc8 Update script_x86.iss
Fix another wrong folder.
2019-05-01 15:13:56 +02:00
Kim Kulling
615a78e38f Update script_x86.iss
Fix wrong folder for assimp.exe
2019-05-01 14:41:51 +02:00
Kim Kulling
84e7f542fb Update script_x86.iss
Fix version of dll.
2019-05-01 12:10:52 +02:00
Kim Kulling
6ff7635338 Update script_x64.iss
put icons into comments.
2019-05-01 11:10:16 +02:00
Kim Kulling
a2ca691072 Update script_x86.iss
Fix invalid folder names.
2019-05-01 11:09:20 +02:00
Vitaly Ovchinnikov
84d5398d56 Merge branch 'master' into bad-obj-file 2019-05-01 19:08:50 +12:00
RichardTea
b96d53c05d Merge pull request #6 from assimp/master
Rollup to master
2019-04-30 17:14:22 +01:00
kimkulling
800616e83a Fix if block 2019-04-30 15:51:32 +02:00
kimkulling
c821c6f301 Fix names of dlls. 2019-04-30 15:33:31 +02:00
Adam B
718109c17e Merge branch 'master' into master 2019-04-29 10:54:02 -07:00
Kim Kulling
0b9c72fa94 Merge branch 'master' into collada_metadata 2019-04-29 18:49:31 +02:00
Kim Kulling
ae9cb02427 Merge pull request #2441 from jslee02/fix_color_alpha
Fix element access operator of aiColor4D
2019-04-29 18:48:58 +02:00
George Shakula
9ab7f88cdf Merge branch 'master' into gltf2-import-animation-name 2019-04-29 18:46:56 +03:00
Jeongseok Lee
bcd17481e5 Fix element access operator of aiColor4D 2019-04-28 22:16:20 -07:00
b1skit
243b2618a9 Updated the FBXConverter to correctly set the material shading mode when a Phong shader is detected 2019-04-27 17:37:23 -07:00
b1skit
bc4e411284 Updated the FBXConverter to correctly set the material shading mode when a Phong shader is detected 2019-04-27 17:20:27 -07:00
Kim Kulling
27665ce930 Merge branch 'master' into collada_metadata 2019-04-27 10:30:49 +02:00
Kim Kulling
55cdf1d37c Merge pull request #2437 from assimp/kimkulling-patch-4
Update Readme.md
2019-04-27 10:30:35 +02:00
Kim Kulling
bd53e67110 Merge branch 'master' into kimkulling-patch-4 2019-04-27 09:27:39 +02:00
Kim Kulling
3824f17223 Merge pull request #2436 from assimp/kimkulling-appveyor
Update appveyor.yml
2019-04-27 09:26:41 +02:00
Kim Kulling
0853623924 Update appveyor.yml
Try this solution 27eb7c5bdb
2019-04-27 08:38:01 +02:00
Kim Kulling
6d241cc2f0 Update appveyor.yml
Go back to normal
2019-04-26 21:11:23 +02:00
Kim Kulling
4c3e34ba6c Update Readme.md
Add link to read the docs.
2019-04-26 19:28:19 +02:00
Kim Kulling
09905c2de3 Update appveyor.yml
disable vs2015
2019-04-26 19:11:22 +02:00
Kim Kulling
58b1440fc8 Update appveyor.yml
Remove cache to fix access to not cached data.
2019-04-26 13:01:22 +02:00
Vitaly Ovchinnikov
42202c2204 a test for bad OBJ file format and code fix that handles it 2019-04-26 22:13:29 +12:00
Martin Vorbrodt
e83671f494 Generate attenuation constants if non are privded in the Blender file. Using: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/ 2019-04-24 18:35:14 -04:00
Heorhii Shakula
0b42d55f73 Fix inconsistency between animation and node name in glTF2 Importer 2019-04-24 16:58:35 +03:00
Kim Kulling
48e5b948e3 Update ColladaExporter.cpp
Some reformattings
2019-04-24 09:03:59 +02:00
Hugo Pereira
5713be615c [FBX export] fixed ordering of skin indices and weights, to be consistent between systems 2019-04-18 16:55:54 +01:00
RichardTea
c34327b355 use std::isfinite()
GCC is more standards compliant than MSVC
2019-04-17 14:30:40 +01:00
RichardTea
e8bcf162dd OBJ coerce invalid nan or inf texture coords to 0
Some exporters (eg Vectorworks 2019) may export texture coordinate components as "nan".

While this is invalid, it's better to coerce these values to 0 rather than reject the entire file.
2019-04-17 13:55:08 +01:00
RichardTea
51be6236a7 Merge branch 'master' into assimpview_unicode 2019-04-17 12:10:14 +01:00
RichardTea
7b6cb57e3b Merge branch 'collada_metadata' 2019-04-17 12:07:48 +01:00
RichardTea
00f1fd6f7c Merge branch 'master' into assimpview_unicode 2019-04-17 10:48:37 +01:00
RichardTea
b515f04ce6 assimp_view is ANSI (MBCS) only
It should really be ported to UNICODE at some point, however I do not have the DirectX9 SDK so cannot confirm whether such a port is working.
2019-04-17 10:48:14 +01:00
RichardTea
692927a8a1 Default CMAKE_DEBUG_POSTFIX to 'd' on multiconfig
When the generator is multi config (eg MSVC, xcode) always set the debug postfix to 'd'
2019-04-17 10:03:18 +01:00
RichardTea
0b9da72ed8 Merge pull request #5 from assimp/master
Rollup FBX material fixes from upstream
2019-04-17 09:44:10 +01:00
RichardTea
9242a12bf5 Qt5 requires cmake 3.1
Earlier versions are not supported
2019-04-17 09:32:59 +01:00
RichardTea
836801d37e CMake updates for VS2015/cmake 3.12 onwards
cmake 3.12 adds MSVC_TOOLSET_VERSION to define the version of MSVC toolchain in use
Use that if present instead of if-elseif chain
2019-04-17 09:32:24 +01:00
Huarong Chen
b6d3cbcb61 Fix "bytes aketrans" issues in Python>=3.1
Issue https://github.com/assimp/assimp/issues/2339
2019-04-17 14:19:00 +08:00
Kim Kulling
1ff10c1ade Merge branch 'master' into master 2019-04-16 16:38:53 +02:00
Kim Kulling
36bce5fa00 Merge pull request #2419 from merwaaan/fix-fbx-face-material
Fix FBX face materials not being properly loaded if the face count mi…
2019-04-16 11:03:14 +02:00
Kim Kulling
685a56266b Merge branch 'master' into fix-fbx-face-material 2019-04-15 09:55:38 +02:00
Simon Puente
9b9b2c8339 Fix typo on README.md
changing "fascade" to "facade"
2019-04-14 10:13:32 -07:00
Kim Kulling
5bf096ab6d Merge pull request #2410 from assimp/fbx_embedded_ascii
FBX: add test case
2019-04-11 12:40:13 +02:00
Kim Kulling
bbaa9f330d Merge branch 'master' into fbx_embedded_ascii 2019-04-11 10:36:29 +02:00
Kim Kulling
6ff563ec23 Merge pull request #2420 from assimp/kimkulling-dev-2
Update Readme.md
2019-04-11 01:13:20 +02:00
Kim Kulling
e2025c3dec Update Readme.md
Add info about C4D-importer.
2019-04-10 20:31:23 +02:00
Merwan Achibet
c92ae50e4f Fix FBX face materials not being properly loaded if the face count mismatches the material count 2019-04-10 19:16:42 +02:00
Charlie Gettys
2f6f716512 Clarify build instructions 2019-04-10 12:42:19 -04:00
Charlie Gettys
1b0c1139eb Fix more codacy warnings! 2019-04-10 11:45:30 -04:00
Charlie Gettys
c1f3624f5b Fix more codacy warnings 2019-04-10 11:06:00 -04:00
Charlie Gettys
24a0aaeb77 Fix Codacy Warning 2019-04-10 11:02:36 -04:00
Charlie Gettys
567a645c4f * Improve error message for new check on MinGW compiler version 2019-04-10 10:31:57 -04:00
Charlie Gettys
6a373d55c7 * Add notes on MinGW compiler version requirements
* Add check on MinGW compiler version to force compliance.
* Closes #2315 ?
2019-04-10 10:07:24 -04:00
Charlie Gettys
f7384dec95 Possible fix for #2406. Shouldn't affect other compiled files, but have
not verified this. Also, if anyone tries to debug StepFileGen1.cpp on MinGW,
the debug info may not be there, but I think this is the best we can do.
2019-04-10 09:45:31 -04:00
Charlie Gettys
9aae110161 * Remove old non-maintained mingw makefile to prevent confusion
* Add notes on building with MinGW to Build.md
2019-04-10 09:29:21 -04:00
RichardTea
1f55bdd9a7 Save/Load Collada 1.4 Root Asset Metadata
Add Collada 1.4 <asset/> metadata to export and import.
Can store in the Scene or the Root Node for export, will be loaded into the Scene during Import
2019-04-09 16:28:15 +01:00
RichardTea
49459435df Merge branch 'master' into collada_metadata 2019-04-09 12:38:29 +01:00
RichardTea
4507f7cf46 Merge pull request #4 from assimp/master
Fast forward
2019-04-09 12:37:38 +01:00
Kim Kulling
d72c8e9c22 Merge pull request #2414 from assimp/kimkulling-dev-2
closes https://github.com/assimp/assimp/issues/2411: Revert parts of dynamic ixxxml linkage
2019-04-08 21:24:28 +02:00
Kim Kulling
dbd0f06d32 Update CMakeLists.txt
Make IrrXml dynamic only on BSD
2019-04-08 20:21:20 +02:00
Kim Kulling
ef209c6eed Update utColladaExportCamera.cpp
Add mising override statement.
2019-04-08 20:10:11 +02:00
RichardTea
e3a397a98d Merge pull request #3 from assimp/master
fast forward to master
2019-04-08 17:57:09 +01:00
RichardTea
d66166675a first pass at collada metadata 2019-04-08 17:11:50 +01:00
Kim Kulling
99648b69c3 Merge branch 'master' into fbx_embedded_ascii 2019-04-08 17:38:56 +02:00
Kim Kulling
d3d98a7ec0 Merge pull request #2409 from assimp/issue_2336
closes https://github.com/assimp/assimp/issues/2336: use new cmp_048 …
2019-04-08 17:38:40 +02:00
kimkulling
cbd8b032e7 FBX: add test case 2019-04-08 17:37:40 +02:00
Kim Kulling
98ed6a2e18 Merge branch 'master' into issue_2336 2019-04-08 16:39:54 +02:00
Kim Kulling
189bb2a233 Merge pull request #2407 from mlavik1/issue_1957
issue 1957: ASCII FBX embedded content
2019-04-08 16:08:55 +02:00
RichardTea
2a3626577f Merge pull request #2 from assimp/master
Update to Assimp Master 0973f50
2019-04-08 14:06:36 +01:00
Kim Kulling
6dec1346ed Merge branch 'master' into issue_1957 2019-04-08 14:27:32 +02:00
Kim Kulling
0973f504b5 Merge pull request #2378 from assimp/issue_1650
Issue 1650
2019-04-08 14:25:25 +02:00
kimkulling
79f62b0174 closes https://github.com/assimp/assimp/issues/2336: use new cmp_048 policy even for zlib in the assimp build. 2019-04-08 14:24:33 +02:00
Kim Kulling
f7d226768c Merge branch 'master' into issue_1650 2019-04-08 13:06:30 +02:00
Kim Kulling
37357515fa Update irrXML.h
FIx export directive for linux.
2019-04-08 12:49:07 +02:00
Matias Lavik
ddfc140fc3 Added <stdint.h>-include 2019-04-07 00:02:22 +02:00
Matias Lavik
fac392d6cb Added missing include and fixed a mistake 2019-04-06 23:44:14 +02:00
Matias Lavik
015e960d0e Merge branch 'master' into issue_1957 2019-04-06 22:22:05 +02:00
Matias Lavik
b3177a2a9a issue 1957: Added support for reading embedded content (textures) in ASCII FBX. In ASCII FBX embedded content is encoded in Base64 and is surrounded by double quotation marks. The decoding functions are based on those used in the glTF importer. 2019-04-06 19:31:56 +02:00
Kim Kulling
03bd8905f5 Merge pull request #2391 from mlavik1/issue_2390
FBX: Fix for loading taking a very long time on models with duplicate names
2019-04-06 09:34:43 +02:00
Kim Kulling
c321fb6a44 Update FBXConverter.cpp
FBX: Add missind initializers.
2019-04-06 08:59:30 +02:00
Matias Lavik
d0ad03d653 Merge branch 'master' into issue_2390 2019-04-05 13:16:29 +02:00
Kim Kulling
225b6fa166 Merge pull request #2404 from mlavik1/issue_2043
Suggested fix for issue 2043
2019-04-05 10:41:15 +02:00
Matias Lavik
898e59d8ee Merge branch 'master' into issue_2043 2019-04-04 16:36:44 +02:00
Matias
20acce1c5e Suggested fix for issue : If available, use "Scaling" and "Translation" instead of "ModelUVScaling" and "ModelUVTranslation". This seems to be what 3DS Max and FBX SDK use. 2019-04-04 16:31:34 +02:00
Matias Lavik
3abb494dd6 Merge branch 'master' into issue_2390 2019-04-04 13:08:27 +02:00
Kim Kulling
010afeb1d8 Merge branch 'master' into issue_1650 2019-04-04 12:42:21 +02:00
Kim Kulling
01d4b10f14 Merge pull request #2399 from assimp/issue_2398
closes https://github.com/assimp/assimp/issues/2398: fix the build.
2019-04-04 12:40:54 +02:00
Matias Lavik
e63b9d4cd8 Merge branch 'master' into issue_2390 2019-04-03 21:17:38 +02:00
Matias Lavik
6d1514dd10 replaced "typedef" with "using" (I didn't notice Kim Kulling's previous commit until now) 2019-04-03 20:19:44 +02:00
Kim Kulling
f10e759db6 Merge branch 'issue_2398' of https://github.com/assimp/assimp into issue_2398 2019-04-03 20:16:24 +02:00
Kim Kulling
42608c0260 Fix small review findings. 2019-04-03 20:15:55 +02:00
Kim Kulling
287924a7d6 Merge branch 'master' into issue_2398 2019-04-03 20:03:07 +02:00
Kim Kulling
906a60a38d Merge pull request #2400 from mlavik1/issue_2393
issue_2393: Added AI_MATKEY_TRANSPARENCYFACTOR
2019-04-03 20:02:46 +02:00
Matias Lavik
0251633ea2 Merge branch 'master' into issue_2393 2019-04-03 12:46:11 +02:00
Matias
4884cf2172 issue_2393: Added TransparencyFactor material key 2019-04-03 12:35:09 +02:00
Matias Lavik
fa37018e08 Merge branch 'master' into issue_2390 2019-04-03 12:26:06 +02:00
Matias
0505dd7266 issue 2390: FBXConverter::GetUniqueName now uses a map for keeping track of duplicate node name count and a set for registering names that have been taken.This is required because the model might contain a several nodes called "nodename" and another one called "nodename001". In that case we can't add "001" to the second node called "nodename". 2019-04-03 12:19:23 +02:00
Kim Kulling
d2b45377e4 Merge pull request #2397 from Cgettys/fix-more-lgtm-alerts
Fix more LGTM Alerts
2019-04-03 10:36:22 +02:00
Kim Kulling
838d0c35b6 Remove deprecated definition for boost workaround. 2019-04-02 21:55:41 +02:00
Kim Kulling
930af2da44 closes https://github.com/assimp/assimp/issues/2398: fix the build. 2019-04-02 20:43:03 +02:00
Charlie Gettys
9d5a71e4af Merge branch 'master' into fix-more-lgtm-alerts 2019-04-01 11:23:33 -04:00
Kim Kulling
933fe5eb43 Merge pull request #2395 from TransformAndLighting/master
added casts for rapidjson in gltf asset writer, converted std::to_string to internal to_string in fbx.
2019-04-01 12:00:59 +02:00
Charlie Gettys
f15f37634d BlenderDNA.h:
* Fix rethrow that would crash the program.
* QUESTION: am I throwing the right exception here.

COBLoader:
* catch exception by const ref
* fix equality checks using strncmp taht weren't actually checking equality

FBXMaterial: Catch exception by const ref (+ Debug log that it's done so)

FBXConverter: Rename local variables to avoid shadowing parameter

ImageExtractor: Remove duplicated/unreachable code

FBXConverter: Another shadowed variable fix

MD5Loader: 2 shadowed variables

IRRLoader: shadowed parameter

StepFileReader.cpp: Shadowed parameter

IRRLoader: remove empty else statement

STLExporter: Throw error instead of silently ignoring unimplemented option

Misc empty blocks removed or debug logging added
2019-03-30 16:08:25 -04:00
Kim Kulling
5a85ceaf18 Merge branch 'master' into master 2019-03-30 18:27:41 +01:00
Kim Kulling
3e19545dc7 Merge pull request #2392 from Cgettys/fix-lgtm-alerts
Fix lgtm alerts
2019-03-30 18:26:25 +01:00
Charlie Gettys
e45d120f21 Remove experimental change unintentionally included in commit f001dfc8 2019-03-29 18:43:57 -04:00
Charlie Gettys
f001dfc840 * Fix error in previous commit improving imports 2019-03-29 18:36:17 -04:00
Charlie Gettys
5a53fbd65f port/PyAssimp/pyassimp/: Fix new warnings 2019-03-29 18:36:17 -04:00
Charlie Gettys
efbb85721c port/PyAssimp/pyassimp/: remove several unised imports 2019-03-29 18:36:17 -04:00
Charlie Gettys
1b9157440f port/PyAssimp/pyassimp/structs.py: remove unused import of c_int 2019-03-29 18:36:17 -04:00
Charlie Gettys
1614b7bea4 port/PyAssimp/pyassimp/core.py: convert_assimp_string now switches on
version instead of just catching the exception if unicode is not defined
& _init_face uses is None instead of == None
2019-03-29 18:36:17 -04:00
Charlie Gettys
ee79ac0f17 port/PyAssimp/pyassimp/sample.py: rename innerloop variable to clarify intent since it shadowed outer variable 2019-03-29 18:36:17 -04:00
Charlie Gettys
7930de9f37 port/PyAssimp/pyassimp/helper.py: replace from ctypes import POINTER; POINTER(something) with ctypes.POINTER(something) to remove warning about importing ctype twice 2019-03-29 18:36:17 -04:00
Charlie Gettys
e849b94f68 port/PyAssimp/pyassimp/core.py & helper.py: catch specific exceptions instead of BaseException 2019-03-29 18:36:17 -04:00
Charlie Gettys
0292acd5a9 scripts/BlenderImporter/genblenddna.py: return 0 on success 2019-03-29 18:36:17 -04:00
Charlie Gettys
51844b206d port/PyAssimp/pyassimp/formats.py: add missing comma (implicit string concatenation, assumed unintentional) 2019-03-29 18:36:17 -04:00
Charlie Gettys
44e89520eb scripts/StepImporter/CppGenerator.py: return 0 exit code on success 2019-03-29 18:36:17 -04:00
Charlie Gettys
4e714fce0e port/PyAssimp/pyassimp/core.py: remove unused import & second import of ctypes 2019-03-29 18:36:17 -04:00
Charlie Gettys
49033513ef port/PyAssimp/pyassimp/core.py: remove deprecated unused import & unnecessary from ctype import pointer 2019-03-29 18:36:17 -04:00
Charlie Gettys
1371cb59d9 scripts/StepImporter/CppGenerator.py: remove unused format parameter on line 158 2019-03-29 18:36:17 -04:00
Charlie Gettys
ae6c1e5ad8 Fix what I assume was a typo in scripts/StepImporter/CppGenerator.py - get_hierarchy is not used internally, so it did not cause runtime errors in the tests. Tests should perhaps be revised to reflect this. 2019-03-29 18:36:17 -04:00
Charlie Gettys
eb81619e56 Fix core.py raising string instead of correct RuntimeError 2019-03-29 18:36:17 -04:00
Matias Lavik
3ea9216c6e Merge branch 'master' into issue_2390 2019-03-29 22:10:30 +01:00
Kim Kulling
89b3de9473 Update FBXConverter.h
Introduce using instead of typedef.
2019-03-29 16:24:45 +01:00
Marco Di Benedetto
a79f832a54 updated cmakelists. 2019-03-29 12:21:47 +01:00
Marco Di Benedetto
d314afaebc added casts for rapidjson in gltf asset writer. 2019-03-29 12:19:39 +01:00
Marco Di Benedetto
faf12c6f5f Merge https://github.com/assimp/assimp 2019-03-29 11:55:21 +01:00
Kim Kulling
d129259ae4 Merge branch 'master' into issue_2390 2019-03-29 10:51:35 +01:00
Kim Kulling
7721e430b4 Merge pull request #2389 from Cgettys/fix-miniz-bug
zip: Update to latest version
2019-03-29 10:50:35 +01:00
Kim Kulling
d62724ab4f Update test.c
fix compiler warnings.
2019-03-29 09:05:24 +01:00
Kim Kulling
92ec834fec Update zip.c
Fix compiler warnings.
2019-03-29 08:42:19 +01:00
Kim Kulling
7b4c704e6b Update README.md
Fix format findings.
2019-03-29 08:27:38 +01:00
Kim Kulling
f0ffcd4025 Merge branch 'master' into issue_2390 2019-03-28 20:28:28 +01:00
Kim Kulling
f653c48c23 Merge branch 'master' into fix-miniz-bug 2019-03-27 20:19:06 +01:00
Kim Kulling
deceb4ebf4 Merge pull request #2387 from assimp/stepfile_fixes
Stepfile: fix some minor review finding.
2019-03-27 20:18:36 +01:00
Charlie Gettys
4efa3736ba Actually fix cmake this time 2019-03-27 12:03:39 -04:00
Charlie Gettys
d718793163 Fix change to CMakeLists.txt
change CMakeLists.txt to use add_definitions instead of add_compile_definitions on old versions of cmake
2019-03-27 11:43:21 -04:00
Charlie Gettys
769dd42b73 Add compile definition to fix issue
defines MINIZ_USE_UNALIGNED_LOADS_AND_STORES to be 0 to override default of 1 for x86 platforms.
2019-03-27 11:29:40 -04:00
Charlie Gettys
ab92f50fa8 Add upstreamed change to miniz.h 2019-03-27 11:28:37 -04:00
Matias
ca08c4a209 FBX: Fix for loading taking a very long time on models with many duplicate names (issue_2390) 2019-03-27 11:20:16 +01:00
Charlie Gettys
bb11f90983 Update zip library to current head. Closes assimp/assimp#2388 2019-03-26 22:45:20 -04:00
Kim Kulling
7e39ae0d52 Stepfile: fix some minor review finding. 2019-03-26 20:19:16 +01:00
Kim Kulling
a43ac5b3fd Merge pull request #2382 from asmaloney/fix_zlib_AMD64
{cmake} Explicitly turn off ASM686 & AMD64 options when ASSIMP_BUILD_ZLIB is on
2019-03-25 14:16:11 +01:00
Andy Maloney
6c26268035 {cmake} Explicitly turn off ASM686 and AMD64 cmake options when ASSIMP_BUILD_ZLIB is on
The AMD64 option causes a build failure on MSVC (#1760) and the ASM builds seem to have problems:

   https://github.com/madler/zlib/issues/41#issuecomment-125848075

This change also prevents these from "polluting" the cmake options if assimp is being included as a submodule.
2019-03-24 10:41:00 -04:00
Kim Kulling
f8753482d3 Merge pull request #2386 from assimp/kimkulling-dev-1
Update Readme.md
2019-03-24 15:23:40 +01:00
Kim Kulling
0fc58c135b Update Readme.md
Add the HAXE-port.
2019-03-24 13:01:38 +01:00
Kim Kulling
e3bd33f0c8 Merge pull request #2380 from devnoname120/patch-1
INSTALL: Out of source build and improve Windows
2019-03-21 17:10:33 +01:00
Kim Kulling
0abf6acf86 Merge branch 'master' into patch-1 2019-03-18 23:06:03 +01:00
Kim Kulling
8d5551a422 Merge pull request #2379 from asmaloney/select_exporters
Add a way to select which exporters you want to compile in
2019-03-18 20:53:51 +01:00
devnoname120
cd9c256de5 INSTALL: update bullet point numbers 2019-03-18 14:28:27 +01:00
devnoname120
82e08d2a92 INSTALL: Out of source build and improve Windows 2019-03-18 14:27:29 +01:00
Kim Kulling
22f4667932 Merge branch 'master' into select_exporters 2019-03-17 23:44:35 +01:00
Kim Kulling
e899067f44 Merge pull request #2371 from assimp/fix_vs107_warnings
Fix vs-2017 warnings
2019-03-17 09:26:36 +01:00
Kim Kulling
718b5b266b Merge branch 'master' into fix_vs107_warnings 2019-03-16 18:41:54 +01:00
Kim Kulling
525566b8b8 try to fix shared object issue. 2019-03-16 18:36:26 +01:00
Kim Kulling
c1e2f19c08 Merge branch 'issue_1650' of https://github.com/assimp/assimp into issue_1650 2019-03-16 17:03:02 +01:00
Kim Kulling
a3fdb46f67 fix typo. 2019-03-16 17:02:38 +01:00
Andy Maloney
df6d257633 Fix 3MF importer 2019-03-16 11:55:16 -04:00
Andy Maloney
5ccd7d8c39 Adds a way to select which exporters you want to compile
Mimics the ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT / ASSIMP_BUILD_XXX_IMPORTER code but for exporters.

This works exactly the same way with one exception - ASSIMP_NO_EXPORT still overrides everything and turns off all exporting.

Fixes #2377
2019-03-16 11:40:17 -04:00
Kim Kulling
581d06a7b7 Merge branch 'master' into issue_1650 2019-03-16 16:22:47 +01:00
Kim Kulling
2f6aa2460a Merge pull request #2376 from ucpu/master
fix loading 3D uvs from obj
2019-03-16 16:22:21 +01:00
Kim Kulling
64bcf56101 Merge branch 'master' into issue_1650 2019-03-16 16:13:52 +01:00
Kim Kulling
f4ec02a34b Fix install folders for cmake - os files. 2019-03-16 16:10:30 +01:00
Kim Kulling
a0c797a29e Merge branch 'master' into fix_vs107_warnings 2019-03-16 16:09:14 +01:00
Kim Kulling
64a7a46406 Update MD3Loader.cpp
Fix typo.
2019-03-16 16:08:03 +01:00
Kim Kulling
e9b6a4895d Fix the build. 2019-03-16 15:32:47 +01:00
Kim Kulling
ba6a7383b2 closes https://github.com/assimp/assimp/issues/1650: build irrXml as shared lib. 2019-03-16 09:45:21 +01:00
Tomas Maly
9a533d826a fix loading 3D uvs from obj 2019-03-15 22:43:12 +01:00
Rich ard
07bbb2c000 Nicer name for Assimp Binary importer
.assbin is not a nice name to show a user
2019-03-15 10:18:43 +00:00
Kim Kulling
ef270225ac Merge pull request #2372 from Aidmx/master
fix: change ScaleProcess priority
2019-03-15 08:03:58 +01:00
kimkulling
61ffe017e8 Fix some coverity findings. 2019-03-14 17:37:28 +01:00
Aidmx
170549559e fix: change ScaleProcess priority 2019-03-14 21:50:50 +08:00
Kim Kulling
d9e81cbfd1 Merge pull request #2370 from assimp/issue_934
closes https://github.com/assimp/assimp/issues/934: introduce materia…
2019-03-14 00:05:39 +01:00
Kim Kulling
04025f09cf Merge branch 'master' into issue_934 2019-03-13 22:27:23 +01:00
Kim Kulling
93e8a1054f Add short documentation. 2019-03-13 22:07:03 +01:00
Kim Kulling
27f3b35813 Merge pull request #2366 from Cgettys/master
Improve ValidateDataStructure error reporting
2019-03-13 21:35:14 +01:00
Kim Kulling
145c3d1589 add missing changes. 2019-03-13 19:35:36 +01:00
Kim Kulling
0a731a0bff closes https://github.com/assimp/assimp/issues/934: introduce material keys for shader types. 2019-03-13 19:32:13 +01:00
kkulling
650fadebe9 Fix compiler warnings: var declarations hides other var. 2019-03-13 16:58:18 +01:00
kkulling
0dc2e9197a Fix compiler warnings. 2019-03-13 14:40:02 +01:00
Kim Kulling
90dbd8f350 Merge branch 'master' into master 2019-03-13 08:40:34 +01:00
Kim Kulling
152cddedd3 Merge pull request #2369 from assimp/kimkulling-dev-1
Reenable vs2015 and vs1017
2019-03-13 00:21:11 +01:00
Kim Kulling
63afcf8267 Update appveyor.yml
Fix cmake generation.
2019-03-12 21:56:28 +01:00
Kim Kulling
ac80b116a9 Update appveyor.yml
Fix build image.
2019-03-12 21:42:32 +01:00
Kim Kulling
f0ed1702b9 Reenable vs2015 and vs1017 2019-03-12 20:49:14 +01:00
Charlie Gettys
5fd9789fc3 remove last warning? 2019-03-12 02:51:37 -04:00
Charlie Gettys
4728c1bb68 remove 1 more of the warnings 2019-03-12 02:49:33 -04:00
Charlie Gettys
27dc922d09 Hopefully fix all warnings? 2019-03-12 01:06:54 -04:00
Charlie Gettys
28c110af2e Initial pass 2019-03-10 13:15:15 -04:00
Charlie Gettys
7bb1303773 ValidateDataStructure.cpp:
* Fixed warnings introduced by last commit (hopefully)
* Fixed case fallthrough (due to exception flow, it didn't make a practical difference, but hopefully will remove a warning)
* Minor formatting consistency improvements
2019-03-10 13:12:56 -04:00
Charlie Gettys
2e262dbbc6 Make syntax used to call ReportError & ReportWarning a bit more consistent 2019-03-09 12:36:21 -05:00
Charlie Gettys
80dffb63e8 Add aiNode::mName to ValidateDataStructure error reporting to ease debugging 2019-03-09 12:01:45 -05:00
Rich ard
3a610d3d66 Embed version information under Windows 2019-03-08 15:49:18 +00:00
Marco Di Benedetto
b15c93c726 Merge https://github.com/assimp/assimp 2019-03-07 14:35:41 +01:00
Rich ard
c3c0f5028c Merge branch 'master' into ETC_Inc 2019-03-05 12:27:37 +00:00
RichardTea
762c09988c Merge pull request #1 from assimp/master
Fast forward to upstream
2019-03-05 12:25:42 +00:00
RichardTea
7d7574f189 Merge branch 'master' into ETC_Inc 2019-03-05 12:07:10 +00:00
RichardTea
c1c42023fa Merge branch 'master' into ETC_Inc 2019-02-20 16:58:41 +00:00
Kim Kulling
0810b2d51b Merge branch 'master' into ETC_Inc 2019-02-15 10:20:30 +01:00
Kim Kulling
6cc41d6be6 Merge branch 'master' into kimkulling-patch-3 2019-02-07 19:27:07 +01:00
Kim Kulling
ce691d383f Merge branch 'master' into kimkulling-patch-3 2019-02-02 15:21:31 +01:00
Kim Kulling
3aa5a61516 Merge branch 'master' into ETC_Inc 2019-01-23 19:53:43 +01:00
Kim Kulling
05ea039846 Merge branch 'master' into ETC_Inc 2019-01-22 20:10:50 +01:00
Richard
3c651be640 Exporter::ExportToBlob() Pass on preprocessing and properties. Issue #2302 2019-01-17 13:55:05 +00:00
Richard
fe6b316695 Set MSVC projects to default to Unicode
MBCS is deprecated and shouldn't be used in new projects
2019-01-10 17:27:54 +00:00
Marco Di Benedetto
555c54d917 Merge https://github.com/assimp/assimp 2018-12-29 20:17:04 +01:00
Marco Di Benedetto
cec163c025 Merge https://github.com/assimp/assimp 2018-12-22 13:50:54 +01:00
Marco Di Benedetto
ad7964be63 imported animation fix. 2018-12-21 10:36:03 +01:00
Marco Di Benedetto
cf6dff0b93 Merge https://github.com/assimp/assimp 2018-12-19 17:27:17 +01:00
Kim Kulling
b1da322deb Update XFileParser.cpp
Add misisng bracket.
2018-12-03 23:13:10 +01:00
Kim Kulling
54be5fdb7b Update XFileParser.cpp 2018-12-03 22:03:50 +01:00
Marco Di Benedetto
27b331eb0c disabled static zlib build 2018-10-18 18:46:02 +02:00
Kim Kulling
4f7bacd108 Collada: some reformatting + minor findings. 2018-09-11 20:01:16 +02:00
Kim Kulling
1c577f66f7 Collada-Exporter: fix some minor findings. 2018-09-07 19:14:52 +02:00
Marco Di Benedetto
cb567d9f65 added internal to_string. 2018-08-01 16:38:33 +02:00
556 changed files with 23417 additions and 13656 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
patreon: assimp
ko_fi: kimkulling

8
.gitignore vendored
View File

@@ -7,6 +7,12 @@ build
*.sln
*.ncb
*.vcproj
*.vcxproj.user
*.VC.db
*.VC.db-shm
*.VC.db-wal
*.VC.opendb
*.ipch
# Output
bin/
@@ -17,6 +23,7 @@ CMakeLists.txt.user
# Generated
assimp.pc
assimp.aps
revision.h
contrib/zlib/zconf.h
contrib/zlib/zlib.pc
@@ -31,6 +38,7 @@ cmake_uninstall.cmake
*.dir/
assimp-config.cmake
assimp-config-version.cmake
assimpTargets*.cmake
# MakeFile
Makefile

View File

@@ -7,7 +7,8 @@
#
function generate() {
OPTIONS="-DASSIMP_WERROR=ON"
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"
if [ "$DISABLE_EXPORTERS" = "YES" ] ; then
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=YES"
else

View File

@@ -70,6 +70,6 @@ addons:
project:
name: "assimp/assimp"
notification_email: kim.kulling@googlemail.com
build_command_prepend: "cmake . -DASSIMP_ENABLE_BOOST_WORKAROUND=YES"
build_command_prepend: "cmake ./"
build_command: "make -j4"
branch_pattern: coverity_scan

26
BUILDBINARIES_EXAMPLE.bat Normal file
View File

@@ -0,0 +1,26 @@
:: This is an example file to generate binaries using Windows Operating System
:: This script is configured to be executed from the source directory
:: Compiled binaries will be placed in BINARIES_DIR\code\CONFIG
:: NOTE
:: The build process will generate a config.h file that is placed in BINARIES_DIR\include
:: This file must be merged with SOURCE_DIR\include
:: You should write yourself a script that copies the files where you want them.
:: Also see: https://github.com/assimp/assimp/pull/2646
SET SOURCE_DIR=.
:: For generators see "cmake --help"
SET GENERATOR=Visual Studio 15 2017
SET BINARIES_DIR="./BINARIES/Win32"
cmake CMakeLists.txt -G "%GENERATOR%" -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config release
SET BINARIES_DIR="./BINARIES/x64"
cmake CMakeLists.txt -G "%GENERATOR% Win64" -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config debug
cmake --build %BINARIES_DIR% --config release
PAUSE

View File

@@ -1,32 +1,32 @@
# Install CMake
# Build Instructions
## Install CMake
Asset-Importer-Lib can be build for a lot of different platforms. We are using cmake to generate the build environment for these via cmake. So you have to make sure that you have a working cmake-installation on your system. You can download it at https://cmake.org/ or for linux install it via
```
```bash
sudo apt-get install cmake
```
# Get the source
## Get the source
Make sure you have a working git-installation. Open a command prompt and clone the Asset-Importer-Lib via:
```
```bash
git clone https://github.com/assimp/assimp.git
```
# Build instructions for Windows with Visual-Studio
## Build instructions for Windows with Visual-Studio
First you have to install Visual-Studio on your windows-system. You can get the Community-Version for free here: https://visualstudio.microsoft.com/de/downloads/
To generate the build environment for your IDE open a command prompt, navigate to your repo and type:
```
> cmake CMakeLists.txt
```bash
cmake CMakeLists.txt
```
This will generate the project files for the visual studio. All dependencies used to build Asset-IMporter-Lib shall be part of the repo. If you want to use you own zlib.installation this is possible as well. Check the options for it.
# Build instructions for Windows with UWP
See https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app
## Build instructions for Windows with UWP
See <https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app>
# Build instrcutions for Linux / Unix
## Build instructions for Linux / Unix
Open a terminal and got to your repository. You can generate the makefiles and build the library via:
```
```bash
cmake CMakeLists.txt
make -j4
```
@@ -34,7 +34,23 @@ The option -j descripes the number of parallel processes for the build. In this
If you want to use a IDE for linux you can try QTCreator for instance.
# CMake build options
## Build instructions for MinGW
Older versions of MinGW's compiler (e.g. 5.1.0) do not support the -mbig_obj flag
required to compile some of assimp's files, especially for debug builds.
Version 7.3.0 of g++-mingw-w64 & gcc-mingw-w64 appears to work.
Please see [CMake Cross Compiling](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling) for general information on CMake Toolchains.
Some users have had success building assimp using MinGW on Linux using [polly](https://github.com/ruslo/polly/).
The following toolchain, which is not maintained by assimp, seems to work on Linux: [linux-mingw-w64-gnuxx11.cmake](https://github.com/ruslo/polly/blob/master/linux-mingw-w64-gnuxx11.cmake)
The following toolchain may or may not be helpful for building assimp using MinGW on Windows (untested):
[mingw-cxx17.cmake](https://github.com/ruslo/polly/blob/master/mingw-cxx17.cmake)
Besides the toolchain, compilation should be the same as for Linux / Unix.
## CMake build options
The cmake-build-environment provides options to configure the build. The following options can be used:
- **BUILD_SHARED_LIBS ( default ON )**: Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib.
- **BUILD_FRAMEWORK ( default OFF, MacOnly)**: Build package as Mac OS X Framework bundle
@@ -55,4 +71,3 @@ The cmake-build-environment provides options to configure the build. The followi
- **INJECT_DEBUG_POSTFIX( default ON )**: Inject debug postfix in .a/.so lib names
- **IGNORE_GIT_HASH ( default OFF )**: Don't call git to get the hash.
- **ASSIMP_INSTALL_PDB ( default ON )**: Install MSVC debug files.

View File

@@ -1,7 +1,7 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
# Copyright (c) 2006-2019, assimp team
#
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms,
@@ -34,9 +34,24 @@
# (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 )
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
CMAKE_MINIMUM_REQUIRED( VERSION 3.0 )
# Toggles the use of the hunter package manager
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.176.tar.gz"
SHA1 "2e9ae973d028660b735ac4c6142725ca36a0048a"
)
IF(HUNTER_ENABLED)
add_definitions(-DASSIMP_USE_HUNTER)
ENDIF(HUNTER_ENABLED)
PROJECT( Assimp VERSION 5.0.0 )
# All supported options ###############################################
@@ -106,7 +121,7 @@ OPTION ( BUILD_DOCS
OFF
)
OPTION( INJECT_DEBUG_POSTFIX
"Inject debug postfix in .a/.so lib names"
"Inject debug postfix in .a/.so/.dll lib names"
ON
)
@@ -115,24 +130,27 @@ OPTION ( IGNORE_GIT_HASH
OFF
)
IF (IOS)
IF (IOS AND NOT HUNTER_ENABLED)
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF (NOT CMAKE_BUILD_TYPE)
ADD_DEFINITIONS(-DENABLE_BITCODE)
ENDIF (IOS)
ENDIF (IOS AND NOT HUNTER_ENABLED)
# Use subset of Windows.h
if (WIN32)
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
endif()
IF(MSVC)
OPTION( ASSIMP_INSTALL_PDB
"Install MSVC debug files."
ON
)
IF(NOT (MSVC_VERSION LESS 1900))
# Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
ENDIF()
ENDIF(MSVC)
IF (BUILD_FRAMEWORK)
@@ -148,17 +166,17 @@ ELSE()
ENDIF(NOT BUILD_SHARED_LIBS)
# Define here the needed parameters
SET (ASSIMP_VERSION_MAJOR 4)
SET (ASSIMP_VERSION_MINOR 1)
SET (ASSIMP_VERSION_PATCH 0)
SET (ASSIMP_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
SET (ASSIMP_VERSION_MINOR ${PROJECT_VERSION_MINOR})
SET (ASSIMP_VERSION_PATCH ${PROJECT_VERSION_PATCH})
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
SET (ASSIMP_SOVERSION 4)
SET (PROJECT_VERSION "${ASSIMP_VERSION}")
SET (ASSIMP_SOVERSION 5)
SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )
# Enable C++11 support globally
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
if(NOT HUNTER_ENABLED)
# Enable C++11 support globally
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
endif()
IF(NOT IGNORE_GIT_HASH)
# Get the current working branch
@@ -200,6 +218,7 @@ CONFIGURE_FILE(
INCLUDE_DIRECTORIES( BEFORE
./
code/
include
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/include
@@ -218,9 +237,13 @@ ENDIF( UNIX )
# Grouped compiler settings
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
IF(NOT HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++0x ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
ENDIF()
# hide all not-exported symbols
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
SET(LIBSTDC++_LIBRARIES -lstdc++)
ELSEIF(MSVC)
# enable multi-core compilation with MSVC
@@ -230,26 +253,39 @@ ELSEIF(MSVC)
IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351)
ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob2 /DEBUG:FULL /Zi")
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 ${CMAKE_CXX_FLAGS}" )
SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
IF(NOT HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
ENDIF()
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ELSEIF( CMAKE_COMPILER_IS_MINGW )
SET( CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}" )
SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS} ")
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message(FATAL_ERROR "MinGW is too old to be supported. Please update MinGW and try again.")
ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
message(WARNING "MinGW is old, if you experience errors, update MinGW.")
ENDIF()
IF(NOT HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
ENDIF()
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ADD_DEFINITIONS( -U__STRICT_ANSI__ )
ENDIF()
IF ( IOS )
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
ENDIF()
ENDIF( IOS )
IF ( IOS AND NOT HUNTER_ENABLED)
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
# Experimental for pdb generation
ENDIF()
ENDIF( IOS AND NOT HUNTER_ENABLED)
IF (ASSIMP_COVERALLS)
MESSAGE(STATUS "Coveralls enabled")
@@ -301,7 +337,9 @@ SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
"Path the tool executables are installed to." )
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
IF (INJECT_DEBUG_POSTFIX AND (is_multi_config OR 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")
@@ -314,20 +352,67 @@ IF (NOT TARGET uninstall)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
# cmake configuration files
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
#we should generated these scripts after CMake VERSION 3.0.2 using export(EXPORT ...) and write_basic_package_version_file(...)
INSTALL(FILES
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake"
DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
IF(HUNTER_ENABLED)
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(INCLUDE_INSTALL_DIR "include")
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
# Configuration
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NAMESPACE "${PROJECT_NAME}::")
# Include module with fuction 'write_basic_package_version_file'
include(CMakePackageConfigHelpers)
# Note: PROJECT_VERSION is used as a VERSION
write_basic_package_version_file("${VERSION_CONFIG}" COMPATIBILITY SameMajorVersion)
# Use variables:
# * TARGETS_EXPORT_NAME
# * PROJECT_NAME
configure_package_config_file(
"cmake/assimp-hunter-config.cmake.in"
"${PROJECT_CONFIG}"
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
)
install(
FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
DESTINATION "${CONFIG_INSTALL_DIR}"
)
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${NAMESPACE}"
DESTINATION "${CONFIG_INSTALL_DIR}"
)
ELSE(HUNTER_ENABLED)
# cmake configuration files
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
IF (is_multi_config)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake")
ELSEIF (CMAKE_BUILD_TYPE STREQUAL Debug)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake")
ELSE()
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake")
ENDIF()
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
#we should generated these scripts after CMake VERSION 3.0.2 using export(EXPORT ...) and write_basic_package_version_file(...)
INSTALL(FILES
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake"
${PACKAGE_TARGETS_FILE}
DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
ENDIF(HUNTER_ENABLED)
FIND_PACKAGE( DirectX )
@@ -342,39 +427,57 @@ ENDIF( SYSTEM_IRRXML )
# Search for external dependencies, and build them from source if not found
# Search for zlib
IF ( NOT ASSIMP_BUILD_ZLIB )
FIND_PACKAGE(ZLIB)
ENDIF( NOT ASSIMP_BUILD_ZLIB )
IF(HUNTER_ENABLED)
hunter_add_package(ZLIB)
find_package(ZLIB CONFIG REQUIRED)
IF( NOT ZLIB_FOUND )
MESSAGE(STATUS "compiling zlib from sources")
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)
# need to ensure we don't link with system zlib or minizip as well.
SET(ASSIMP_BUILD_MINIZIP 1)
ELSE(NOT ZLIB_FOUND)
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
SET(ZLIB_LIBRARIES_LINKED -lz)
ENDIF(NOT ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB)
set(ZLIB_FOUND TRUE)
set(ZLIB_LIBRARIES ZLIB::zlib)
set(ASSIMP_BUILD_MINIZIP TRUE)
ELSE(HUNTER_ENABLED)
IF ( NOT ASSIMP_BUILD_ZLIB )
FIND_PACKAGE(ZLIB)
ENDIF( NOT ASSIMP_BUILD_ZLIB )
# Search for unzip
IF ( NOT IOS )
IF( NOT ZLIB_FOUND )
MESSAGE(STATUS "compiling zlib from sources")
INCLUDE(CheckIncludeFile)
INCLUDE(CheckTypeSize)
INCLUDE(CheckFunctionExists)
# Explicitly turn off ASM686 and AMD64 cmake options.
# The AMD64 option causes a build failure on MSVC and the ASM builds seem to have problems:
# https://github.com/madler/zlib/issues/41#issuecomment-125848075
# Also prevents these options from "polluting" the cmake options if assimp is being
# included as a submodule.
set( ASM686 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE )
set( AMD64 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE )
# 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)
# need to ensure we don't link with system zlib or minizip as well.
SET(ASSIMP_BUILD_MINIZIP 1)
ELSE(NOT ZLIB_FOUND)
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
SET(ZLIB_LIBRARIES_LINKED -lz)
ENDIF(NOT ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF(HUNTER_ENABLED)
IF( NOT IOS )
IF( NOT ASSIMP_BUILD_MINIZIP )
use_pkgconfig(UNZIP minizip)
use_pkgconfig(UNZIP minizip)
ENDIF( NOT ASSIMP_BUILD_MINIZIP )
ELSE ( NOT IOS )
IF(NOT BUILD_SHARED_LIBS)
IF( NOT BUILD_SHARED_LIBS )
IF( NOT ASSIMP_BUILD_MINIZIP )
use_pkgconfig(UNZIP minizip)
use_pkgconfig(UNZIP minizip)
ENDIF( NOT ASSIMP_BUILD_MINIZIP )
ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF ( NOT BUILD_SHARED_LIBS )
ENDIF ( NOT IOS )
IF ( ASSIMP_NO_EXPORT )
@@ -448,26 +551,27 @@ ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ADD_SUBDIRECTORY(contrib)
IF(NOT HUNTER_ENABLED)
ADD_SUBDIRECTORY(contrib)
ENDIF(NOT HUNTER_ENABLED)
ADD_SUBDIRECTORY( code/ )
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
# The viewer for windows only
IF ( WIN32 AND DirectX_D3DX9_LIBRARY )
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 AND DirectX_D3DX9_LIBRARY )
# Te command line tool
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
IF (NOT IOS)
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
ENDIF (NOT IOS)
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
IF ( ASSIMP_BUILD_SAMPLES)
IF ( WIN32 )
ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )
ADD_SUBDIRECTORY( samples/SimpleTexturedDirectx11 )
ENDIF ( WIN32 )
ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
ENDIF ( ASSIMP_BUILD_SAMPLES )
@@ -533,18 +637,22 @@ if(WIN32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
elseif()
else()
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")
ELSEIF(MSVC15)
SET(ASSIMP_MSVC_VERSION "vc141")
ENDIF(MSVC12)
IF(MSVC_TOOLSET_VERSION)
set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
ELSE()
IF(MSVC12)
SET(ASSIMP_MSVC_VERSION "vc120")
ELSEIF(MSVC14)
SET(ASSIMP_MSVC_VERSION "vc140")
ELSEIF(MSVC15)
SET(ASSIMP_MSVC_VERSION "vc141")
ENDIF(MSVC12)
ENDIF()
IF(MSVC12 OR MSVC14 OR MSVC15 )
ADD_CUSTOM_TARGET(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)

11
INSTALL
View File

@@ -35,13 +35,16 @@ http://www.cmake.org/.
For Unix:
1. cmake CMakeLists.txt -G 'Unix Makefiles'
2. make
1. mkdir build && cd build
2. cmake .. -G 'Unix Makefiles'
3. make -j4
For Windows:
1. Open a command prompt
2. cmake CMakeLists.txt
2. Open your default IDE and build it
2. mkdir build
3. cd build
4. cmake ..
5. cmake --build .
For iOS:
Just check the following project, which deploys a compiler toolchain for different iOS-versions: https://github.com/assimp/assimp/tree/master/port/iOS

View File

@@ -17,6 +17,8 @@ A library to import and export various 3d-model-formats including scene-post-pro
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.
[Check the latest doc](https://assimp-docs.readthedocs.io/en/latest/).
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases).
@@ -99,7 +101,7 @@ __Importers__:
Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default):
- [C4D](https://en.wikipedia.org/wiki/Cinema_4D) (https://github.com/assimp/assimp/wiki/Cinema4D-&-Melange)
- [C4D](https://en.wikipedia.org/wiki/Cinema_4D) (https://github.com/assimp/assimp/wiki/Cinema4D-&-Melange) IMporting geometry + node hierarchy are currently supported
__Exporters__:
@@ -123,17 +125,18 @@ Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file.
### Ports ###
* [Android](port/AndroidJNI/README.md)
* [Python](port/PyAssimp/README.md)
* [.NET](port/AssimpNET/Readme.md)
* [.NET](https://github.com/kebby/assimp-net)
* [Pascal](port/AssimpPascal/Readme.md)
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
* [Unity 3d Plugin](https://www.assetstore.unity3d.com/en/#!/content/91777)
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (current [status](https://github.com/kotlin-graphics/assimp/wiki/Status))
* [HAXE-Port](https://github.com/longde123/assimp-haxe) The Assimp-HAXE-port.
### Other tools ###
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
#### Repository structure ####
Open Asset Import Library is implemented in C++. The directory structure is:
Open Asset Import Library is implemented in C++. The directory structure looks like:
/code Source code
/contrib Third-party libraries
@@ -146,6 +149,11 @@ Open Asset Import Library is implemented in C++. The directory structure is:
/samples A small number of samples to illustrate possible
use cases for Assimp
The source code is organized in the following way:
code/Common The base implementation for importers and the infrastructure
code/PostProcessing The post-processing steps
code/<FormatName> Implementation for import and export for the format
### Where to get help ###
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.

View File

@@ -14,9 +14,9 @@ matrix:
fast_finish: true
image:
- Visual Studio 2013
# - Visual Studio 2015
# - Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2017
- MinGW
platform:
- Win32
@@ -27,11 +27,13 @@ configuration: Release
install:
- set PATH=C:\Ruby24-x64\bin;%PATH%
- set CMAKE_DEFINES -DASSIMP_WERROR=ON
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" set CMAKE_GENERATOR_NAME=Visual Studio 12 2013
- if [%COMPILER%]==[MinGW] set PATH=C:\MinGW\bin;%PATH%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
- if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64
- cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%"
- cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" .
# Rename sh.exe as sh.exe in PATH interferes with MinGW
- rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
- set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe
@@ -53,7 +55,13 @@ build:
project: Assimp.sln
after_build:
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" iscc packaging\windows-innosetup\script.iss
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (
if "%platform%"=="x64" (
iscc packaging\windows-innosetup\script_x64.iss
) else (
iscc packaging\windows-innosetup\script_x86.iss
)
)
- 7z a assimp.7z bin\%CONFIGURATION%\* lib\%CONFIGURATION%\*
test_script:

View File

@@ -5,48 +5,79 @@
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
if(MSVC)
if( MSVC70 OR MSVC71 )
set(MSVC_PREFIX "vc70")
elseif( MSVC80 )
set(MSVC_PREFIX "vc80")
elseif( MSVC90 )
set(MSVC_PREFIX "vc90")
elseif( MSVC10 )
set(MSVC_PREFIX "vc100")
elseif( MSVC11 )
set(MSVC_PREFIX "vc110")
elseif( MSVC12 )
set(MSVC_PREFIX "vc120")
elseif( MSVC14 )
set(MSVC_PREFIX "vc140")
if(MSVC_TOOLSET_VERSION)
set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
else()
set(MSVC_PREFIX "vc150")
if( MSVC70 OR MSVC71 )
set(MSVC_PREFIX "vc70")
elseif( MSVC80 )
set(MSVC_PREFIX "vc80")
elseif( MSVC90 )
set(MSVC_PREFIX "vc90")
elseif( MSVC10 )
set(MSVC_PREFIX "vc100")
elseif( MSVC11 )
set(MSVC_PREFIX "vc110")
elseif( MSVC12 )
set(MSVC_PREFIX "vc120")
elseif( MSVC_VERSION LESS 1910)
set(MSVC_PREFIX "vc140")
elseif( MSVC_VERSION LESS 1920)
set(MSVC_PREFIX "vc141")
elseif( MSVC_VERSION LESS 1930)
set(MSVC_PREFIX "vc142")
else()
set(MSVC_PREFIX "vc150")
endif()
endif()
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" )
set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@")
if(ASSIMP_BUILD_SHARED_LIBS)
set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@")
# Import target "assimp::assimp" for configuration "Debug"
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/${importLibraryName}"
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/bin/${sharedLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}")
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" )
# Import target "assimp::assimp" for configuration "Debug"
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/${importLibraryName}"
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/bin/${sharedLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}")
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" )
else()
set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@")
# Import target "assimp::assimp" for configuration "Debug"
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}")
endif()
else()
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the openrave libraries" )
set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@")
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_SONAME_DEBUG "${sharedLibraryName}"
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${sharedLibraryName}"
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the assimp libraries" )
if(ASSIMP_BUILD_SHARED_LIBS)
set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@")
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_SONAME_DEBUG "${sharedLibraryName}"
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${sharedLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" )
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" )
else()
set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@")
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}" )
endif()
endif()
@@ -60,7 +91,11 @@ set( ASSIMP_CXX_FLAGS ) # dynamically linked library
set( ASSIMP_LINK_FLAGS "" )
set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@")
set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@")
set( ASSIMP_LIBRARIES ${sharedLibraryName})
if(ASSIMP_BUILD_SHARED_LIBS)
set( ASSIMP_LIBRARIES ${sharedLibraryName})
else()
set( ASSIMP_LIBRARIES ${staticLibraryName})
endif()
# for compatibility with pkg-config
set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}")
@@ -75,4 +110,5 @@ MARK_AS_ADVANCED(
ASSIMP_CFLAGS_OTHER
ASSIMP_LDFLAGS_OTHER
ASSIMP_LIBRARY_SUFFIX
ASSIMP_BUILD_SHARED_LIBS
)

View File

@@ -5,59 +5,95 @@
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
if(MSVC)
if( MSVC70 OR MSVC71 )
set(MSVC_PREFIX "vc70")
elseif( MSVC80 )
set(MSVC_PREFIX "vc80")
elseif( MSVC90 )
set(MSVC_PREFIX "vc90")
elseif( MSVC10 )
set(MSVC_PREFIX "vc100")
elseif( MSVC11 )
set(MSVC_PREFIX "vc110")
elseif( MSVC12 )
set(MSVC_PREFIX "vc120")
elseif( MSVC14 )
set(MSVC_PREFIX "vc140")
if(MSVC_TOOLSET_VERSION)
set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
else()
set(MSVC_PREFIX "vc150")
if( MSVC70 OR MSVC71 )
set(MSVC_PREFIX "vc70")
elseif( MSVC80 )
set(MSVC_PREFIX "vc80")
elseif( MSVC90 )
set(MSVC_PREFIX "vc90")
elseif( MSVC10 )
set(MSVC_PREFIX "vc100")
elseif( MSVC11 )
set(MSVC_PREFIX "vc110")
elseif( MSVC12 )
set(MSVC_PREFIX "vc120")
elseif( MSVC_VERSION LESS 1910)
set(MSVC_PREFIX "vc140")
elseif( MSVC_VERSION LESS 1920)
set(MSVC_PREFIX "vc141")
elseif( MSVC_VERSION LESS 1930)
set(MSVC_PREFIX "vc142")
else()
set(MSVC_PREFIX "vc150")
endif()
endif()
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" )
set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_IMPORT_LIBRARY_SUFFIX@")
if(ASSIMP_BUILD_SHARED_LIBS)
set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_IMPORT_LIBRARY_SUFFIX@")
# Import target "assimp::assimp" for configuration "Release"
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/${importLibraryName}"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/${sharedLibraryName}"
# Import target "assimp::assimp" for configuration "Release"
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/${importLibraryName}"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/${sharedLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}")
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" )
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}")
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" )
else()
set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@")
# Import target "assimp::assimp" for configuration "Release"
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}")
endif()
else()
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the openrave libraries" )
set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@")
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_SONAME_RELEASE "${sharedLibraryName}"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${sharedLibraryName}"
set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the assimp libraries" )
if(ASSIMP_BUILD_SHARED_LIBS)
set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@")
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_SONAME_RELEASE "${sharedLibraryName}"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${sharedLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" )
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" )
else()
set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@")
set_target_properties(assimp::assimp PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
)
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}" )
endif()
endif()
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
get_filename_component(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" REALPATH)
set( ASSIMP_CXX_FLAGS ) # dynamically linked library
set( ASSIMP_LINK_FLAGS "" )
set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@")
set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@")
set( ASSIMP_LIBRARIES ${sharedLibraryName})
if(ASSIMP_BUILD_SHARED_LIBS)
set( ASSIMP_LIBRARIES ${sharedLibraryName})
else()
set( ASSIMP_LIBRARIES ${staticLibraryName})
endif()
# for compatibility with pkg-config
set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}")
@@ -72,4 +108,5 @@ MARK_AS_ADVANCED(
ASSIMP_CFLAGS_OTHER
ASSIMP_LDFLAGS_OTHER
ASSIMP_LIBRARY_SUFFIX
ASSIMP_BUILD_SHARED_LIBS
)

View File

@@ -51,7 +51,11 @@ if(_IMPORT_PREFIX STREQUAL "/")
endif()
# Create imported target assimp::assimp
add_library(assimp::assimp SHARED IMPORTED)
if(@BUILD_SHARED_LIBS@)
add_library(assimp::assimp SHARED IMPORTED)
else()
add_library(assimp::assimp STATIC IMPORTED)
endif()
set_target_properties(assimp::assimp PROPERTIES
COMPATIBLE_INTERFACE_STRING "assimp_MAJOR_VERSION"

540
cmake/HunterGate.cmake Normal file
View File

@@ -0,0 +1,540 @@
# Copyright (c) 2013-2018, Ruslan Baratov
# All rights reserved.
#
# Redistribution and use 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.
#
# 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 HOLDER 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.
# This is a gate file to Hunter package manager.
# Include this file using `include` command and add package you need, example:
#
# cmake_minimum_required(VERSION 3.2)
#
# include("cmake/HunterGate.cmake")
# HunterGate(
# URL "https://github.com/path/to/hunter/archive.tar.gz"
# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d"
# )
#
# project(MyProject)
#
# hunter_add_package(Foo)
# hunter_add_package(Boo COMPONENTS Bar Baz)
#
# Projects:
# * https://github.com/hunter-packages/gate/
# * https://github.com/ruslo/hunter
option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
if(HUNTER_ENABLED)
if(CMAKE_VERSION VERSION_LESS "3.2")
message(
FATAL_ERROR
"At least CMake version 3.2 required for Hunter dependency management."
" Update CMake or set HUNTER_ENABLED to OFF."
)
endif()
endif()
include(CMakeParseArguments) # cmake_parse_arguments
option(HUNTER_STATUS_PRINT "Print working status" ON)
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON)
set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")
function(hunter_gate_status_print)
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
foreach(print_message ${ARGV})
message(STATUS "[hunter] ${print_message}")
endforeach()
endif()
endfunction()
function(hunter_gate_status_debug)
if(HUNTER_STATUS_DEBUG)
foreach(print_message ${ARGV})
string(TIMESTAMP timestamp)
message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}")
endforeach()
endif()
endfunction()
function(hunter_gate_wiki wiki_page)
message("------------------------------ WIKI -------------------------------")
message(" ${HUNTER_WIKI}/${wiki_page}")
message("-------------------------------------------------------------------")
message("")
message(FATAL_ERROR "")
endfunction()
function(hunter_gate_internal_error)
message("")
foreach(print_message ${ARGV})
message("[hunter ** INTERNAL **] ${print_message}")
endforeach()
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("error.internal")
endfunction()
function(hunter_gate_fatal_error)
cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}")
string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki)
if(have_no_wiki)
hunter_gate_internal_error("Expected wiki")
endif()
message("")
foreach(x ${hunter_UNPARSED_ARGUMENTS})
message("[hunter ** FATAL ERROR **] ${x}")
endforeach()
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("${hunter_WIKI}")
endfunction()
function(hunter_gate_user_error)
hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data")
endfunction()
function(hunter_gate_self root version sha1 result)
string(COMPARE EQUAL "${root}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("root is empty")
endif()
string(COMPARE EQUAL "${version}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("version is empty")
endif()
string(COMPARE EQUAL "${sha1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("sha1 is empty")
endif()
string(SUBSTRING "${sha1}" 0 7 archive_id)
if(EXISTS "${root}/cmake/Hunter")
set(hunter_self "${root}")
else()
set(
hunter_self
"${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked"
)
endif()
set("${result}" "${hunter_self}" PARENT_SCOPE)
endfunction()
# Set HUNTER_GATE_ROOT cmake variable to suitable value.
function(hunter_gate_detect_root)
# Check CMake variable
string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable")
return()
endif()
# Check environment variable
string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by environment variable")
return()
endif()
# Check HOME environment variable
string(COMPARE NOTEQUAL "$ENV{HOME}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable")
return()
endif()
# Check SYSTEMDRIVE and USERPROFILE environment variable (windows only)
if(WIN32)
string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using SYSTEMDRIVE environment variable"
)
return()
endif()
string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using USERPROFILE environment variable"
)
return()
endif()
endif()
hunter_gate_fatal_error(
"Can't detect HUNTER_ROOT"
WIKI "error.detect.hunter.root"
)
endfunction()
function(hunter_gate_download dir)
string(
COMPARE
NOTEQUAL
"$ENV{HUNTER_DISABLE_AUTOINSTALL}"
""
disable_autoinstall
)
if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL)
hunter_gate_fatal_error(
"Hunter not found in '${dir}'"
"Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'"
"Settings:"
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
WIKI "error.run.install"
)
endif()
string(COMPARE EQUAL "${dir}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("Empty 'dir' argument")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_SHA1 empty")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_URL empty")
endif()
set(done_location "${dir}/DONE")
set(sha1_location "${dir}/SHA1")
set(build_dir "${dir}/Build")
set(cmakelists "${dir}/CMakeLists.txt")
hunter_gate_status_debug("Locking directory: ${dir}")
file(LOCK "${dir}" DIRECTORY GUARD FUNCTION)
hunter_gate_status_debug("Lock done")
if(EXISTS "${done_location}")
# while waiting for lock other instance can do all the job
hunter_gate_status_debug("File '${done_location}' found, skip install")
return()
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(MAKE_DIRECTORY "${build_dir}") # check directory permissions
# Disabling languages speeds up a little bit, reduces noise in the output
# and avoids path too long windows error
file(
WRITE
"${cmakelists}"
"cmake_minimum_required(VERSION 3.2)\n"
"project(HunterDownload LANGUAGES NONE)\n"
"include(ExternalProject)\n"
"ExternalProject_Add(\n"
" Hunter\n"
" URL\n"
" \"${HUNTER_GATE_URL}\"\n"
" URL_HASH\n"
" SHA1=${HUNTER_GATE_SHA1}\n"
" DOWNLOAD_DIR\n"
" \"${dir}\"\n"
" TLS_VERIFY\n"
" ${HUNTER_TLS_VERIFY}\n"
" SOURCE_DIR\n"
" \"${dir}/Unpacked\"\n"
" CONFIGURE_COMMAND\n"
" \"\"\n"
" BUILD_COMMAND\n"
" \"\"\n"
" INSTALL_COMMAND\n"
" \"\"\n"
")\n"
)
if(HUNTER_STATUS_DEBUG)
set(logging_params "")
else()
set(logging_params OUTPUT_QUIET)
endif()
hunter_gate_status_debug("Run generate")
# Need to add toolchain file too.
# Otherwise on Visual Studio + MDD this will fail with error:
# "Could not find an appropriate version of the Windows 10 SDK installed on this machine"
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}")
else()
# 'toolchain_arg' can't be empty
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=")
endif()
string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make)
if(no_make)
set(make_arg "")
else()
# Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM
set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
endif()
execute_process(
COMMAND
"${CMAKE_COMMAND}"
"-H${dir}"
"-B${build_dir}"
"-G${CMAKE_GENERATOR}"
"${toolchain_arg}"
${make_arg}
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error(
"Configure project failed."
"To reproduce the error run: ${CMAKE_COMMAND} -H${dir} -B${build_dir} -G${CMAKE_GENERATOR} ${toolchain_arg} ${make_arg}"
"In directory ${dir}"
)
endif()
hunter_gate_status_print(
"Initializing Hunter workspace (${HUNTER_GATE_SHA1})"
" ${HUNTER_GATE_URL}"
" -> ${dir}"
)
execute_process(
COMMAND "${CMAKE_COMMAND}" --build "${build_dir}"
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error("Build project failed")
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}")
file(WRITE "${done_location}" "DONE")
hunter_gate_status_debug("Finished")
endfunction()
# Must be a macro so master file 'cmake/Hunter' can
# apply all variables easily just by 'include' command
# (otherwise PARENT_SCOPE magic needed)
macro(HunterGate)
if(HUNTER_GATE_DONE)
# variable HUNTER_GATE_DONE set explicitly for external project
# (see `hunter_download`)
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
# First HunterGate command will init Hunter, others will be ignored
get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET)
if(NOT HUNTER_ENABLED)
# Empty function to avoid error "unknown function"
function(hunter_add_package)
endfunction()
set(
_hunter_gate_disabled_mode_dir
"${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode"
)
if(EXISTS "${_hunter_gate_disabled_mode_dir}")
hunter_gate_status_debug(
"Adding \"disabled-mode\" modules: ${_hunter_gate_disabled_mode_dir}"
)
list(APPEND CMAKE_PREFIX_PATH "${_hunter_gate_disabled_mode_dir}")
endif()
elseif(_hunter_gate_done)
hunter_gate_status_debug("Secondary HunterGate (use old settings)")
hunter_gate_self(
"${HUNTER_CACHED_ROOT}"
"${HUNTER_VERSION}"
"${HUNTER_SHA1}"
_hunter_self
)
include("${_hunter_self}/cmake/Hunter")
else()
set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}")
string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name)
if(_have_project_name)
hunter_gate_fatal_error(
"Please set HunterGate *before* 'project' command. "
"Detected project: ${PROJECT_NAME}"
WIKI "error.huntergate.before.project"
)
endif()
cmake_parse_arguments(
HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV}
)
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1)
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url)
string(
COMPARE
NOTEQUAL
"${HUNTER_GATE_UNPARSED_ARGUMENTS}"
""
_have_unparsed
)
string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global)
string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath)
if(_have_unparsed)
hunter_gate_user_error(
"HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}"
)
endif()
if(_empty_sha1)
hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory")
endif()
if(_empty_url)
hunter_gate_user_error("URL suboption of HunterGate is mandatory")
endif()
if(_have_global)
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)")
endif()
endif()
if(HUNTER_GATE_LOCAL)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)")
endif()
endif()
if(_have_filepath)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)")
endif()
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)")
endif()
endif()
hunter_gate_detect_root() # set HUNTER_GATE_ROOT
# Beautify path, fix probable problems with windows path slashes
get_filename_component(
HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE
)
hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}")
if(NOT HUNTER_ALLOW_SPACES_IN_PATH)
string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces)
if(NOT _contain_spaces EQUAL -1)
hunter_gate_fatal_error(
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
"(Use at your own risk!)"
WIKI "error.spaces.in.hunter.root"
)
endif()
endif()
string(
REGEX
MATCH
"[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*"
HUNTER_GATE_VERSION
"${HUNTER_GATE_URL}"
)
string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty)
if(_is_empty)
set(HUNTER_GATE_VERSION "unknown")
endif()
hunter_gate_self(
"${HUNTER_GATE_ROOT}"
"${HUNTER_GATE_VERSION}"
"${HUNTER_GATE_SHA1}"
_hunter_self
)
set(_master_location "${_hunter_self}/cmake/Hunter")
if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter")
# Hunter downloaded manually (e.g. by 'git clone')
set(_unused "xxxxxxxxxx")
set(HUNTER_GATE_SHA1 "${_unused}")
set(HUNTER_GATE_VERSION "${_unused}")
else()
get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE)
set(_done_location "${_archive_id_location}/DONE")
set(_sha1_location "${_archive_id_location}/SHA1")
# Check Hunter already downloaded by HunterGate
if(NOT EXISTS "${_done_location}")
hunter_gate_download("${_archive_id_location}")
endif()
if(NOT EXISTS "${_done_location}")
hunter_gate_internal_error("hunter_gate_download failed")
endif()
if(NOT EXISTS "${_sha1_location}")
hunter_gate_internal_error("${_sha1_location} not found")
endif()
file(READ "${_sha1_location}" _sha1_value)
string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal)
if(NOT _is_equal)
hunter_gate_internal_error(
"Short SHA1 collision:"
" ${_sha1_value} (from ${_sha1_location})"
" ${HUNTER_GATE_SHA1} (HunterGate)"
)
endif()
if(NOT EXISTS "${_master_location}")
hunter_gate_user_error(
"Master file not found:"
" ${_master_location}"
"try to update Hunter/HunterGate"
)
endif()
endif()
include("${_master_location}")
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
endmacro()

View File

@@ -0,0 +1,14 @@
@PACKAGE_INIT@
find_package(RapidJSON CONFIG REQUIRED)
find_package(ZLIB CONFIG REQUIRED)
find_package(utf8 CONFIG REQUIRED)
find_package(irrXML CONFIG REQUIRED)
find_package(minizip CONFIG REQUIRED)
find_package(openddlparser CONFIG REQUIRED)
find_package(poly2tri CONFIG REQUIRED)
find_package(polyclipping CONFIG REQUIRED)
find_package(zip CONFIG REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")

View File

@@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers
#include "3DSLoader.h"
#include "TargetAnimation.h"
#include "Common/TargetAnimation.h"
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/StringComparison.h>

View File

@@ -43,15 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_3DS_EXPORTER
#include "3DSExporter.h"
#include "3DSLoader.h"
#include "3DSHelper.h"
#include "3DS/3DSExporter.h"
#include "3DS/3DSLoader.h"
#include "3DS/3DSHelper.h"
#include "PostProcessing/SplitLargeMeshes.h"
#include <assimp/SceneCombiner.h>
#include "SplitLargeMeshes.h"
#include <assimp/StringComparison.h>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Exporter.hpp>
#include <memory>
using namespace Assimp;

View File

@@ -55,7 +55,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "3MFXmlTags.h"
#include "D3MFOpcPackage.h"
#include <contrib/zip/src/zip.h>
#ifdef ASSIMP_USE_HUNTER
# include <zip/zip.h>
#else
# include <contrib/zip/src/zip.h>
#endif
namespace Assimp {

View File

@@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h>
#include <assimp/StringComparison.h>
#include <assimp/StringUtils.h>
#include <assimp/ZipArchiveIOSystem.h>
#include <string>
#include <vector>
@@ -58,7 +59,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory>
#include "D3MFOpcPackage.h"
#include <unzip.h>
#include <assimp/irrXMLWrapper.h>
#include "3MFXmlTags.h"
#include <assimp/fast_atof.h>
@@ -449,7 +449,7 @@ bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bo
if ( nullptr == pIOHandler ) {
return false;
}
if ( !D3MF::D3MFOpcPackage::isZipArchive( pIOHandler, filename ) ) {
if ( !ZipArchiveIOSystem::isZipArchive( pIOHandler, filename ) ) {
return false;
}
D3MF::D3MFOpcPackage opcPackage( pIOHandler, filename );

207
code/3MF/D3MFOpcPackage.cpp Normal file
View File

@@ -0,0 +1,207 @@
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2019, 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 ASSIMP_BUILD_NO_3MF_IMPORTER
#include "D3MFOpcPackage.h"
#include <assimp/Exceptional.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/ai_assert.h>
#include <assimp/ZipArchiveIOSystem.h>
#include <cstdlib>
#include <memory>
#include <vector>
#include <map>
#include <algorithm>
#include <cassert>
#include "3MFXmlTags.h"
namespace Assimp {
namespace D3MF {
// ------------------------------------------------------------------------------------------------
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*) {
// empty
}
bool validateRels( OpcPackageRelationshipPtr &relPtr ) {
if ( relPtr->id.empty() || relPtr->type.empty() || relPtr->target.empty() ) {
return false;
}
return true;
}
void ParseChildNode(XmlReader* xmlReader) {
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
relPtr->id = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_ID.c_str());
relPtr->type = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_TYPE.c_str());
relPtr->target = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_TARGET.c_str());
if ( validateRels( relPtr ) ) {
m_relationShips.push_back( relPtr );
}
}
std::vector<OpcPackageRelationshipPtr> m_relationShips;
};
// ------------------------------------------------------------------------------------------------
D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
: mRootStream(nullptr)
, mZipArchive() {
mZipArchive.reset( new ZipArchiveIOSystem( pIOHandler, rFile ) );
if(!mZipArchive->isOpen()) {
throw DeadlyImportError("Failed to open file " + rFile+ ".");
}
std::vector<std::string> fileList;
mZipArchive->getFileList(fileList);
for (auto& file: fileList) {
if(file == D3MF::XmlTag::ROOT_RELATIONSHIPS_ARCHIVE) {
//PkgRelationshipReader pkgRelReader(file, archive);
ai_assert(mZipArchive->Exists(file.c_str()));
IOStream *fileStream = mZipArchive->Open(file.c_str());
ai_assert(fileStream != nullptr);
std::string rootFile = ReadPackageRootRelationship(fileStream);
if ( rootFile.size() > 0 && rootFile[ 0 ] == '/' ) {
rootFile = rootFile.substr( 1 );
if ( rootFile[ 0 ] == '/' ) {
// deal with zip-bug
rootFile = rootFile.substr( 1 );
}
}
ASSIMP_LOG_DEBUG(rootFile);
mZipArchive->Close(fileStream);
mRootStream = mZipArchive->Open(rootFile.c_str());
ai_assert( mRootStream != nullptr );
if ( nullptr == mRootStream ) {
throw DeadlyExportError( "Cannot open root-file in archive : " + rootFile );
}
} else if( file == D3MF::XmlTag::CONTENT_TYPES_ARCHIVE) {
ASSIMP_LOG_WARN_F("Ignored file of unsupported type CONTENT_TYPES_ARCHIVES",file);
} else {
ASSIMP_LOG_WARN_F("Ignored file of unknown type: ",file);
}
}
}
D3MFOpcPackage::~D3MFOpcPackage() {
mZipArchive->Close(mRootStream);
}
IOStream* D3MFOpcPackage::RootStream() const {
return mRootStream;
}
static const std::string ModelRef = "3D/3dmodel.model";
bool D3MFOpcPackage::validate() {
if ( nullptr == mRootStream || nullptr == mZipArchive ) {
return false;
}
return mZipArchive->Exists( ModelRef.c_str() );
}
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
} // Namespace Assimp
#endif //ASSIMP_BUILD_NO_3MF_IMPORTER

View File

@@ -49,6 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/irrXMLWrapper.h>
namespace Assimp {
class ZipArchiveIOSystem;
namespace D3MF {
using XmlReader = irr::io::IrrXMLReader ;
@@ -60,22 +62,19 @@ struct OpcPackageRelationship {
std::string target;
};
class D3MFZipArchive;
class D3MFOpcPackage {
public:
D3MFOpcPackage( IOSystem* pIOHandler, const std::string& rFile );
~D3MFOpcPackage();
IOStream* RootStream() const;
bool validate();
static bool isZipArchive( IOSystem* pIOHandler, const std::string& rFile );
protected:
std::string ReadPackageRootRelationship(IOStream* stream);
private:
IOStream* mRootStream;
std::unique_ptr<D3MFZipArchive> mZipArchive;
std::unique_ptr<ZipArchiveIOSystem> mZipArchive;
};
} // Namespace D3MF

View File

@@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/ParsingUtils.h>
#include <assimp/fast_atof.h>
#include <assimp/Subdivision.h>
#include "Importer.h"
#include "Common/Importer.h"
#include <assimp/BaseImporter.h>
#include <assimp/Importer.hpp>
#include <assimp/light.h>

View File

@@ -83,7 +83,7 @@ void AMFImporter::Clear()
mMaterial_Converted.clear();
mTexture_Converted.clear();
// Delete all elements
if(mNodeElement_List.size())
if(!mNodeElement_List.empty())
{
for(CAMFImporter_NodeElement* ne: mNodeElement_List) { delete ne; }

View File

@@ -66,7 +66,7 @@ aiColor4D AMFImporter::SPP_Material::GetColor(const float /*pX*/, const float /*
aiColor4D tcol;
// Check if stored data are supported.
if(Composition.size() != 0)
if(!Composition.empty())
{
throw DeadlyImportError("IME. GetColor for composition");
}
@@ -321,7 +321,7 @@ void AMFImporter::PostprocessHelper_SplitFacesByTextureID(std::list<SComplexFace
};
pOutputList_Separated.clear();
if(pInputList.size() == 0) return;
if(pInputList.empty()) return;
do
{
@@ -334,19 +334,19 @@ void AMFImporter::PostprocessHelper_SplitFacesByTextureID(std::list<SComplexFace
{
auto it_old = it;
it++;
++it;
face_list_cur.push_back(*it_old);
pInputList.erase(it_old);
}
else
{
it++;
++it;
}
}
if(face_list_cur.size() > 0) pOutputList_Separated.push_back(face_list_cur);
if(!face_list_cur.empty()) pOutputList_Separated.push_back(face_list_cur);
} while(pInputList.size() > 0);
} while(!pInputList.empty());
}
void AMFImporter::Postprocess_AddMetadata(const std::list<CAMFImporter_NodeElement_Metadata*>& metadataList, aiNode& sceneNode) const
@@ -712,7 +712,7 @@ std::list<unsigned int> mesh_idx;
}// for(const CAMFImporter_NodeElement* ne_child: pNodeElement.Child)
// if meshes was created then assign new indices with current aiNode
if(mesh_idx.size() > 0)
if(!mesh_idx.empty())
{
std::list<unsigned int>::const_iterator mit = mesh_idx.begin();
@@ -787,7 +787,7 @@ std::list<aiNode*> ch_node;
}// for(const CAMFImporter_NodeElement* ne: pConstellation.Child)
// copy found aiNode's as children
if(ch_node.size() == 0) throw DeadlyImportError("<constellation> must have at least one <instance>.");
if(ch_node.empty()) throw DeadlyImportError("<constellation> must have at least one <instance>.");
size_t ch_idx = 0;
@@ -883,13 +883,13 @@ nl_clean_loop:
if(node_list.size() > 1)
{
// walk through all nodes
for(std::list<aiNode*>::iterator nl_it = node_list.begin(); nl_it != node_list.end(); nl_it++)
for(std::list<aiNode*>::iterator nl_it = node_list.begin(); nl_it != node_list.end(); ++nl_it)
{
// and try to find them in another top nodes.
std::list<aiNode*>::const_iterator next_it = nl_it;
next_it++;
for(; next_it != node_list.end(); next_it++)
++next_it;
for(; next_it != node_list.end(); ++next_it)
{
if((*next_it)->FindNode((*nl_it)->mName) != nullptr)
{
@@ -907,7 +907,7 @@ nl_clean_loop:
//
//
// Nodes
if(node_list.size() > 0)
if(!node_list.empty())
{
std::list<aiNode*>::const_iterator nl_it = node_list.begin();
@@ -924,7 +924,7 @@ nl_clean_loop:
//
// Meshes
if(mesh_list.size() > 0)
if(!mesh_list.empty())
{
std::list<aiMesh*>::const_iterator ml_it = mesh_list.begin();

View File

@@ -53,7 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ASELoader.h"
#include <assimp/StringComparison.h>
#include <assimp/SkeletonMeshBuilder.h>
#include "TargetAnimation.h"
#include "Common/TargetAnimation.h"
#include <assimp/Importer.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
@@ -88,23 +89,25 @@ ASEImporter::ASEImporter()
, mBuffer()
, pcScene()
, configRecomputeNormals()
, noSkeletonMesh()
{}
, noSkeletonMesh() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
ASEImporter::~ASEImporter()
{}
ASEImporter::~ASEImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool ASEImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const
{
bool ASEImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const {
// check file extension
const std::string extension = GetExtension(pFile);
if( extension == "ase" || extension == "ask")
if (extension == "ase" || extension == "ask") {
return true;
}
if ((!extension.length() || cs) && pIOHandler) {
const char* tokens[] = {"*3dsmax_asciiexport"};
@@ -115,15 +118,13 @@ bool ASEImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool
// ------------------------------------------------------------------------------------------------
// Loader meta information
const aiImporterDesc* ASEImporter::GetInfo () const
{
const aiImporterDesc* ASEImporter::GetInfo () const {
return &desc;
}
// ------------------------------------------------------------------------------------------------
// Setup configuration options
void ASEImporter::SetupProperties(const Importer* pImp)
{
void ASEImporter::SetupProperties(const Importer* pImp) {
configRecomputeNormals = (pImp->GetPropertyInteger(
AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS,1) ? true : false);
@@ -133,12 +134,11 @@ void ASEImporter::SetupProperties(const Importer* pImp)
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void ASEImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
aiScene* pScene, IOSystem* pIOHandler) {
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file
if( file.get() == NULL) {
if( file.get() == nullptr) {
throw DeadlyImportError( "Failed to open ASE file " + pFile + ".");
}
@@ -1299,7 +1299,7 @@ void ASEImporter::BuildMaterialIndices()
}
}
// Dekete our temporary array
// Delete our temporary array
delete[] pcIntMaterials;
}

View File

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

View File

@@ -45,20 +45,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of the ASE parser class
*/
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
// internal headers
#include "TextureTransform.h"
#include "PostProcessing/TextureTransform.h"
#include "ASELoader.h"
#include <assimp/fast_atof.h>
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;
using namespace Assimp::ASE;
// ------------------------------------------------------------------------------------------------
// Begin an ASE parsing function

View File

@@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/qnan.h>
// ASE is quite similar to 3ds. We can reuse some structures
#include "3DSLoader.h"
#include "3DS/3DSLoader.h"
namespace Assimp {
namespace ASE {
@@ -188,10 +188,11 @@ struct Animation {
} mRotationType, mScalingType, mPositionType;
Animation() AI_NO_EXCEPT
: mRotationType (TRACK)
, mScalingType (TRACK)
, mPositionType (TRACK)
{}
: mRotationType (TRACK)
, mScalingType (TRACK)
, mPositionType (TRACK) {
// empty
}
//! List of track rotation keyframes
std::vector< aiQuatKey > akeyRotations;
@@ -243,7 +244,6 @@ struct BaseNode {
mTargetPosition.x = qnan;
}
//! Name of the mesh
std::string mName;

View File

@@ -46,12 +46,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
#include "assbin_chunks.h"
#include "Common/assbin_chunks.h"
#include "PostProcessing/ProcessHelper.h"
#include <assimp/version.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#include "ProcessHelper.h"
#include <assimp/Exceptional.h>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB

View File

@@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
// internal headers
#include "AssbinLoader.h"
#include "assbin_chunks.h"
#include "Assbin/AssbinLoader.h"
#include "Common/assbin_chunks.h"
#include <assimp/MemoryIOWrapper.h>
#include <assimp/mesh.h>
#include <assimp/anim.h>
@@ -68,7 +68,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
static const aiImporterDesc desc = {
".assbin Importer",
"Assimp Binary Importer",
"Gargaj / Conspiracy",
"",
"",
@@ -708,7 +708,7 @@ void AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
unsigned char * uncompressedData = new unsigned char[ uncompressedSize ];
int res = uncompress( uncompressedData, &uncompressedSize, compressedData, len );
int res = uncompress( uncompressedData, &uncompressedSize, compressedData, (uLong) len );
if(res != Z_OK)
{
delete [] uncompressedData;

109
code/Assjson/cencode.c Normal file
View File

@@ -0,0 +1,109 @@
/*
cencoder.c - c source to a base64 encoding algorithm implementation
This is part of the libb64 project, and has been placed in the public domain.
For details, see http://sourceforge.net/projects/libb64
*/
#include "cencode.h" // changed from <B64/cencode.h>
const int CHARS_PER_LINE = 72;
void base64_init_encodestate(base64_encodestate* state_in)
{
state_in->step = step_A;
state_in->result = 0;
state_in->stepcount = 0;
}
char base64_encode_value(char value_in)
{
static const char* encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
if (value_in > 63) return '=';
return encoding[(int)value_in];
}
int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in)
{
const char* plainchar = plaintext_in;
const char* const plaintextend = plaintext_in + length_in;
char* codechar = code_out;
char result;
char fragment;
result = state_in->result;
switch (state_in->step)
{
while (1)
{
case step_A:
if (plainchar == plaintextend)
{
state_in->result = result;
state_in->step = step_A;
return codechar - code_out;
}
fragment = *plainchar++;
result = (fragment & 0x0fc) >> 2;
*codechar++ = base64_encode_value(result);
result = (fragment & 0x003) << 4;
case step_B:
if (plainchar == plaintextend)
{
state_in->result = result;
state_in->step = step_B;
return codechar - code_out;
}
fragment = *plainchar++;
result |= (fragment & 0x0f0) >> 4;
*codechar++ = base64_encode_value(result);
result = (fragment & 0x00f) << 2;
case step_C:
if (plainchar == plaintextend)
{
state_in->result = result;
state_in->step = step_C;
return codechar - code_out;
}
fragment = *plainchar++;
result |= (fragment & 0x0c0) >> 6;
*codechar++ = base64_encode_value(result);
result = (fragment & 0x03f) >> 0;
*codechar++ = base64_encode_value(result);
++(state_in->stepcount);
if (state_in->stepcount == CHARS_PER_LINE/4)
{
*codechar++ = '\n';
state_in->stepcount = 0;
}
}
}
/* control should not reach here */
return codechar - code_out;
}
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
{
char* codechar = code_out;
switch (state_in->step)
{
case step_B:
*codechar++ = base64_encode_value(state_in->result);
*codechar++ = '=';
*codechar++ = '=';
break;
case step_C:
*codechar++ = base64_encode_value(state_in->result);
*codechar++ = '=';
break;
case step_A:
break;
}
*codechar++ = '\n';
return codechar - code_out;
}

31
code/Assjson/cencode.h Normal file
View File

@@ -0,0 +1,31 @@
/*
cencode.h - c header for a base64 encoding algorithm
This is part of the libb64 project, and has been placed in the public domain.
For details, see http://sourceforge.net/projects/libb64
*/
#ifndef BASE64_CENCODE_H
#define BASE64_CENCODE_H
typedef enum
{
step_A, step_B, step_C
} base64_encodestep;
typedef struct
{
base64_encodestep step;
char result;
int stepcount;
} base64_encodestate;
void base64_init_encodestate(base64_encodestate* state_in);
char base64_encode_value(char value_in);
int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in);
int base64_encode_blockend(char* code_out, base64_encodestate* state_in);
#endif /* BASE64_CENCODE_H */

View File

@@ -0,0 +1,809 @@
/*
Assimp2Json
Copyright (c) 2011, Alexander C. Gessler
Licensed under a 3-clause BSD license. See the LICENSE file for more information.
*/
#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
#include <assimp/Importer.hpp>
#include <assimp/Exporter.hpp>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <sstream>
#include <limits>
#include <cassert>
#include <memory>
#define CURRENT_FORMAT_VERSION 100
// grab scoped_ptr from assimp to avoid a dependency on boost.
//#include <assimp/../../code/BoostWorkaround/boost/scoped_ptr.hpp>
#include "mesh_splitter.h"
extern "C" {
#include "cencode.h"
}
namespace Assimp {
void ExportAssimp2Json(const char*, Assimp::IOSystem*, const aiScene*, const Assimp::ExportProperties*);
// small utility class to simplify serializing the aiScene to Json
class JSONWriter {
public:
enum {
Flag_DoNotIndent = 0x1,
Flag_WriteSpecialFloats = 0x2,
};
JSONWriter(Assimp::IOStream& out, unsigned int flags = 0u)
: out(out)
, first()
, flags(flags) {
// make sure that all formatting happens using the standard, C locale and not the user's current locale
buff.imbue(std::locale("C"));
}
~JSONWriter() {
Flush();
}
void Flush() {
const std::string s = buff.str();
out.Write(s.c_str(), s.length(), 1);
buff.clear();
}
void PushIndent() {
indent += '\t';
}
void PopIndent() {
indent.erase(indent.end() - 1);
}
void Key(const std::string& name) {
AddIndentation();
Delimit();
buff << '\"' + name + "\": ";
}
template<typename Literal>
void Element(const Literal& name) {
AddIndentation();
Delimit();
LiteralToString(buff, name) << '\n';
}
template<typename Literal>
void SimpleValue(const Literal& s) {
LiteralToString(buff, s) << '\n';
}
void SimpleValue(const void* buffer, size_t len) {
base64_encodestate s;
base64_init_encodestate(&s);
char* const out = new char[std::max(len * 2, static_cast<size_t>(16u))];
const int n = base64_encode_block(reinterpret_cast<const char*>(buffer), static_cast<int>(len), out, &s);
out[n + base64_encode_blockend(out + n, &s)] = '\0';
// base64 encoding may add newlines, but JSON strings may not contain 'real' newlines
// (only escaped ones). Remove any newlines in out.
for (char* cur = out; *cur; ++cur) {
if (*cur == '\n') {
*cur = ' ';
}
}
buff << '\"' << out << "\"\n";
delete[] out;
}
void StartObj(bool is_element = false) {
// if this appears as a plain array element, we need to insert a delimiter and we should also indent it
if (is_element) {
AddIndentation();
if (!first) {
buff << ',';
}
}
first = true;
buff << "{\n";
PushIndent();
}
void EndObj() {
PopIndent();
AddIndentation();
first = false;
buff << "}\n";
}
void StartArray(bool is_element = false) {
// if this appears as a plain array element, we need to insert a delimiter and we should also indent it
if (is_element) {
AddIndentation();
if (!first) {
buff << ',';
}
}
first = true;
buff << "[\n";
PushIndent();
}
void EndArray() {
PopIndent();
AddIndentation();
buff << "]\n";
first = false;
}
void AddIndentation() {
if (!(flags & Flag_DoNotIndent)) {
buff << indent;
}
}
void Delimit() {
if (!first) {
buff << ',';
}
else {
buff << ' ';
first = false;
}
}
private:
template<typename Literal>
std::stringstream& LiteralToString(std::stringstream& stream, const Literal& s) {
stream << s;
return stream;
}
std::stringstream& LiteralToString(std::stringstream& stream, const aiString& s) {
std::string t;
// escape backslashes and single quotes, both would render the JSON invalid if left as is
t.reserve(s.length);
for (size_t i = 0; i < s.length; ++i) {
if (s.data[i] == '\\' || s.data[i] == '\'' || s.data[i] == '\"') {
t.push_back('\\');
}
t.push_back(s.data[i]);
}
stream << "\"";
stream << t;
stream << "\"";
return stream;
}
std::stringstream& LiteralToString(std::stringstream& stream, float f) {
if (!std::numeric_limits<float>::is_iec559) {
// on a non IEEE-754 platform, we make no assumptions about the representation or existence
// of special floating-point numbers.
stream << f;
return stream;
}
// JSON does not support writing Inf/Nan
// [RFC 4672: "Numeric values that cannot be represented as sequences of digits
// (such as Infinity and NaN) are not permitted."]
// Nevertheless, many parsers will accept the special keywords Infinity, -Infinity and NaN
if (std::numeric_limits<float>::infinity() == fabs(f)) {
if (flags & Flag_WriteSpecialFloats) {
stream << (f < 0 ? "\"-" : "\"") + std::string("Infinity\"");
return stream;
}
// we should print this warning, but we can't - this is called from within a generic assimp exporter, we cannot use cerr
// std::cerr << "warning: cannot represent infinite number literal, substituting 0 instead (use -i flag to enforce Infinity/NaN)" << std::endl;
stream << "0.0";
return stream;
}
// f!=f is the most reliable test for NaNs that I know of
else if (f != f) {
if (flags & Flag_WriteSpecialFloats) {
stream << "\"NaN\"";
return stream;
}
// we should print this warning, but we can't - this is called from within a generic assimp exporter, we cannot use cerr
// std::cerr << "warning: cannot represent infinite number literal, substituting 0 instead (use -i flag to enforce Infinity/NaN)" << std::endl;
stream << "0.0";
return stream;
}
stream << f;
return stream;
}
private:
Assimp::IOStream& out;
std::string indent, newline;
std::stringstream buff;
bool first;
unsigned int flags;
};
void Write(JSONWriter& out, const aiVector3D& ai, bool is_elem = true) {
out.StartArray(is_elem);
out.Element(ai.x);
out.Element(ai.y);
out.Element(ai.z);
out.EndArray();
}
void Write(JSONWriter& out, const aiQuaternion& ai, bool is_elem = true) {
out.StartArray(is_elem);
out.Element(ai.w);
out.Element(ai.x);
out.Element(ai.y);
out.Element(ai.z);
out.EndArray();
}
void Write(JSONWriter& out, const aiColor3D& ai, bool is_elem = true) {
out.StartArray(is_elem);
out.Element(ai.r);
out.Element(ai.g);
out.Element(ai.b);
out.EndArray();
}
void Write(JSONWriter& out, const aiMatrix4x4& ai, bool is_elem = true) {
out.StartArray(is_elem);
for (unsigned int x = 0; x < 4; ++x) {
for (unsigned int y = 0; y < 4; ++y) {
out.Element(ai[x][y]);
}
}
out.EndArray();
}
void Write(JSONWriter& out, const aiBone& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mName);
out.Key("offsetmatrix");
Write(out, ai.mOffsetMatrix, false);
out.Key("weights");
out.StartArray();
for (unsigned int i = 0; i < ai.mNumWeights; ++i) {
out.StartArray(true);
out.Element(ai.mWeights[i].mVertexId);
out.Element(ai.mWeights[i].mWeight);
out.EndArray();
}
out.EndArray();
out.EndObj();
}
void Write(JSONWriter& out, const aiFace& ai, bool is_elem = true) {
out.StartArray(is_elem);
for (unsigned int i = 0; i < ai.mNumIndices; ++i) {
out.Element(ai.mIndices[i]);
}
out.EndArray();
}
void Write(JSONWriter& out, const aiMesh& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mName);
out.Key("materialindex");
out.SimpleValue(ai.mMaterialIndex);
out.Key("primitivetypes");
out.SimpleValue(ai.mPrimitiveTypes);
out.Key("vertices");
out.StartArray();
for (unsigned int i = 0; i < ai.mNumVertices; ++i) {
out.Element(ai.mVertices[i].x);
out.Element(ai.mVertices[i].y);
out.Element(ai.mVertices[i].z);
}
out.EndArray();
if (ai.HasNormals()) {
out.Key("normals");
out.StartArray();
for (unsigned int i = 0; i < ai.mNumVertices; ++i) {
out.Element(ai.mNormals[i].x);
out.Element(ai.mNormals[i].y);
out.Element(ai.mNormals[i].z);
}
out.EndArray();
}
if (ai.HasTangentsAndBitangents()) {
out.Key("tangents");
out.StartArray();
for (unsigned int i = 0; i < ai.mNumVertices; ++i) {
out.Element(ai.mTangents[i].x);
out.Element(ai.mTangents[i].y);
out.Element(ai.mTangents[i].z);
}
out.EndArray();
out.Key("bitangents");
out.StartArray();
for (unsigned int i = 0; i < ai.mNumVertices; ++i) {
out.Element(ai.mBitangents[i].x);
out.Element(ai.mBitangents[i].y);
out.Element(ai.mBitangents[i].z);
}
out.EndArray();
}
if (ai.GetNumUVChannels()) {
out.Key("numuvcomponents");
out.StartArray();
for (unsigned int n = 0; n < ai.GetNumUVChannels(); ++n) {
out.Element(ai.mNumUVComponents[n]);
}
out.EndArray();
out.Key("texturecoords");
out.StartArray();
for (unsigned int n = 0; n < ai.GetNumUVChannels(); ++n) {
const unsigned int numc = ai.mNumUVComponents[n] ? ai.mNumUVComponents[n] : 2;
out.StartArray(true);
for (unsigned int i = 0; i < ai.mNumVertices; ++i) {
for (unsigned int c = 0; c < numc; ++c) {
out.Element(ai.mTextureCoords[n][i][c]);
}
}
out.EndArray();
}
out.EndArray();
}
if (ai.GetNumColorChannels()) {
out.Key("colors");
out.StartArray();
for (unsigned int n = 0; n < ai.GetNumColorChannels(); ++n) {
out.StartArray(true);
for (unsigned int i = 0; i < ai.mNumVertices; ++i) {
out.Element(ai.mColors[n][i].r);
out.Element(ai.mColors[n][i].g);
out.Element(ai.mColors[n][i].b);
out.Element(ai.mColors[n][i].a);
}
out.EndArray();
}
out.EndArray();
}
if (ai.mNumBones) {
out.Key("bones");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumBones; ++n) {
Write(out, *ai.mBones[n]);
}
out.EndArray();
}
out.Key("faces");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumFaces; ++n) {
Write(out, ai.mFaces[n]);
}
out.EndArray();
out.EndObj();
}
void Write(JSONWriter& out, const aiNode& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mName);
out.Key("transformation");
Write(out, ai.mTransformation, false);
if (ai.mNumMeshes) {
out.Key("meshes");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumMeshes; ++n) {
out.Element(ai.mMeshes[n]);
}
out.EndArray();
}
if (ai.mNumChildren) {
out.Key("children");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumChildren; ++n) {
Write(out, *ai.mChildren[n]);
}
out.EndArray();
}
out.EndObj();
}
void Write(JSONWriter& out, const aiMaterial& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("properties");
out.StartArray();
for (unsigned int i = 0; i < ai.mNumProperties; ++i) {
const aiMaterialProperty* const prop = ai.mProperties[i];
out.StartObj(true);
out.Key("key");
out.SimpleValue(prop->mKey);
out.Key("semantic");
out.SimpleValue(prop->mSemantic);
out.Key("index");
out.SimpleValue(prop->mIndex);
out.Key("type");
out.SimpleValue(prop->mType);
out.Key("value");
switch (prop->mType) {
case aiPTI_Float:
if (prop->mDataLength / sizeof(float) > 1) {
out.StartArray();
for (unsigned int i = 0; i < prop->mDataLength / sizeof(float); ++i) {
out.Element(reinterpret_cast<float*>(prop->mData)[i]);
}
out.EndArray();
}
else {
out.SimpleValue(*reinterpret_cast<float*>(prop->mData));
}
break;
case aiPTI_Integer:
if (prop->mDataLength / sizeof(int) > 1) {
out.StartArray();
for (unsigned int i = 0; i < prop->mDataLength / sizeof(int); ++i) {
out.Element(reinterpret_cast<int*>(prop->mData)[i]);
}
out.EndArray();
} else {
out.SimpleValue(*reinterpret_cast<int*>(prop->mData));
}
break;
case aiPTI_String:
{
aiString s;
aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s);
out.SimpleValue(s);
}
break;
case aiPTI_Buffer:
{
// binary data is written as series of hex-encoded octets
out.SimpleValue(prop->mData, prop->mDataLength);
}
break;
default:
assert(false);
}
out.EndObj();
}
out.EndArray();
out.EndObj();
}
void Write(JSONWriter& out, const aiTexture& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("width");
out.SimpleValue(ai.mWidth);
out.Key("height");
out.SimpleValue(ai.mHeight);
out.Key("formathint");
out.SimpleValue(aiString(ai.achFormatHint));
out.Key("data");
if (!ai.mHeight) {
out.SimpleValue(ai.pcData, ai.mWidth);
}
else {
out.StartArray();
for (unsigned int y = 0; y < ai.mHeight; ++y) {
out.StartArray(true);
for (unsigned int x = 0; x < ai.mWidth; ++x) {
const aiTexel& tx = ai.pcData[y*ai.mWidth + x];
out.StartArray(true);
out.Element(static_cast<unsigned int>(tx.r));
out.Element(static_cast<unsigned int>(tx.g));
out.Element(static_cast<unsigned int>(tx.b));
out.Element(static_cast<unsigned int>(tx.a));
out.EndArray();
}
out.EndArray();
}
out.EndArray();
}
out.EndObj();
}
void Write(JSONWriter& out, const aiLight& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mName);
out.Key("type");
out.SimpleValue(ai.mType);
if (ai.mType == aiLightSource_SPOT || ai.mType == aiLightSource_UNDEFINED) {
out.Key("angleinnercone");
out.SimpleValue(ai.mAngleInnerCone);
out.Key("angleoutercone");
out.SimpleValue(ai.mAngleOuterCone);
}
out.Key("attenuationconstant");
out.SimpleValue(ai.mAttenuationConstant);
out.Key("attenuationlinear");
out.SimpleValue(ai.mAttenuationLinear);
out.Key("attenuationquadratic");
out.SimpleValue(ai.mAttenuationQuadratic);
out.Key("diffusecolor");
Write(out, ai.mColorDiffuse, false);
out.Key("specularcolor");
Write(out, ai.mColorSpecular, false);
out.Key("ambientcolor");
Write(out, ai.mColorAmbient, false);
if (ai.mType != aiLightSource_POINT) {
out.Key("direction");
Write(out, ai.mDirection, false);
}
if (ai.mType != aiLightSource_DIRECTIONAL) {
out.Key("position");
Write(out, ai.mPosition, false);
}
out.EndObj();
}
void Write(JSONWriter& out, const aiNodeAnim& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mNodeName);
out.Key("prestate");
out.SimpleValue(ai.mPreState);
out.Key("poststate");
out.SimpleValue(ai.mPostState);
if (ai.mNumPositionKeys) {
out.Key("positionkeys");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumPositionKeys; ++n) {
const aiVectorKey& pos = ai.mPositionKeys[n];
out.StartArray(true);
out.Element(pos.mTime);
Write(out, pos.mValue);
out.EndArray();
}
out.EndArray();
}
if (ai.mNumRotationKeys) {
out.Key("rotationkeys");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumRotationKeys; ++n) {
const aiQuatKey& rot = ai.mRotationKeys[n];
out.StartArray(true);
out.Element(rot.mTime);
Write(out, rot.mValue);
out.EndArray();
}
out.EndArray();
}
if (ai.mNumScalingKeys) {
out.Key("scalingkeys");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumScalingKeys; ++n) {
const aiVectorKey& scl = ai.mScalingKeys[n];
out.StartArray(true);
out.Element(scl.mTime);
Write(out, scl.mValue);
out.EndArray();
}
out.EndArray();
}
out.EndObj();
}
void Write(JSONWriter& out, const aiAnimation& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mName);
out.Key("tickspersecond");
out.SimpleValue(ai.mTicksPerSecond);
out.Key("duration");
out.SimpleValue(ai.mDuration);
out.Key("channels");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumChannels; ++n) {
Write(out, *ai.mChannels[n]);
}
out.EndArray();
out.EndObj();
}
void Write(JSONWriter& out, const aiCamera& ai, bool is_elem = true) {
out.StartObj(is_elem);
out.Key("name");
out.SimpleValue(ai.mName);
out.Key("aspect");
out.SimpleValue(ai.mAspect);
out.Key("clipplanefar");
out.SimpleValue(ai.mClipPlaneFar);
out.Key("clipplanenear");
out.SimpleValue(ai.mClipPlaneNear);
out.Key("horizontalfov");
out.SimpleValue(ai.mHorizontalFOV);
out.Key("up");
Write(out, ai.mUp, false);
out.Key("lookat");
Write(out, ai.mLookAt, false);
out.EndObj();
}
void WriteFormatInfo(JSONWriter& out) {
out.StartObj();
out.Key("format");
out.SimpleValue("\"assimp2json\"");
out.Key("version");
out.SimpleValue(CURRENT_FORMAT_VERSION);
out.EndObj();
}
void Write(JSONWriter& out, const aiScene& ai) {
out.StartObj();
out.Key("__metadata__");
WriteFormatInfo(out);
out.Key("rootnode");
Write(out, *ai.mRootNode, false);
out.Key("flags");
out.SimpleValue(ai.mFlags);
if (ai.HasMeshes()) {
out.Key("meshes");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumMeshes; ++n) {
Write(out, *ai.mMeshes[n]);
}
out.EndArray();
}
if (ai.HasMaterials()) {
out.Key("materials");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumMaterials; ++n) {
Write(out, *ai.mMaterials[n]);
}
out.EndArray();
}
if (ai.HasAnimations()) {
out.Key("animations");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumAnimations; ++n) {
Write(out, *ai.mAnimations[n]);
}
out.EndArray();
}
if (ai.HasLights()) {
out.Key("lights");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumLights; ++n) {
Write(out, *ai.mLights[n]);
}
out.EndArray();
}
if (ai.HasCameras()) {
out.Key("cameras");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumCameras; ++n) {
Write(out, *ai.mCameras[n]);
}
out.EndArray();
}
if (ai.HasTextures()) {
out.Key("textures");
out.StartArray();
for (unsigned int n = 0; n < ai.mNumTextures; ++n) {
Write(out, *ai.mTextures[n]);
}
out.EndArray();
}
out.EndObj();
}
void ExportAssimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) {
std::unique_ptr<Assimp::IOStream> str(io->Open(file, "wt"));
if (!str) {
//throw Assimp::DeadlyExportError("could not open output file");
}
// get a copy of the scene so we can modify it
aiScene* scenecopy_tmp;
aiCopyScene(scene, &scenecopy_tmp);
try {
// split meshes so they fit into a 16 bit index buffer
MeshSplitter splitter;
splitter.SetLimit(1 << 16);
splitter.Execute(scenecopy_tmp);
// XXX Flag_WriteSpecialFloats is turned on by default, right now we don't have a configuration interface for exporters
JSONWriter s(*str, JSONWriter::Flag_WriteSpecialFloats);
Write(s, *scenecopy_tmp);
}
catch (...) {
aiFreeScene(scenecopy_tmp);
throw;
}
aiFreeScene(scenecopy_tmp);
}
}
#endif // ASSIMP_BUILD_NO_ASSJSON_EXPORTER
#endif // ASSIMP_BUILD_NO_EXPORT

View File

@@ -0,0 +1,320 @@
/*
Assimp2Json
Copyright (c) 2011, Alexander C. Gessler
Licensed under a 3-clause BSD license. See the LICENSE file for more information.
*/
#include "mesh_splitter.h"
#include <assimp/scene.h>
// ----------------------------------------------------------------------------
// Note: this is largely based on assimp's SplitLargeMeshes_Vertex process.
// it is refactored and the coding style is slightly improved, though.
// ----------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data.
void MeshSplitter::Execute( aiScene* pScene) {
std::vector<std::pair<aiMesh*, unsigned int> > source_mesh_map;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) {
SplitMesh(a, pScene->mMeshes[a],source_mesh_map);
}
const unsigned int size = static_cast<unsigned int>(source_mesh_map.size());
if (size != pScene->mNumMeshes) {
// it seems something has been split. rebuild the mesh list
delete[] pScene->mMeshes;
pScene->mNumMeshes = size;
pScene->mMeshes = new aiMesh*[size]();
for (unsigned int i = 0; i < size;++i) {
pScene->mMeshes[i] = source_mesh_map[i].first;
}
// now we need to update all nodes
UpdateNode(pScene->mRootNode,source_mesh_map);
}
}
// ------------------------------------------------------------------------------------------------
void MeshSplitter::UpdateNode(aiNode* pcNode, const std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map) {
// TODO: should better use std::(multi)set for source_mesh_map.
// for every index in out list build a new entry
std::vector<unsigned int> aiEntries;
aiEntries.reserve(pcNode->mNumMeshes + 1);
for (unsigned int i = 0; i < pcNode->mNumMeshes;++i) {
for (unsigned int a = 0, end = static_cast<unsigned int>(source_mesh_map.size()); a < end;++a) {
if (source_mesh_map[a].second == pcNode->mMeshes[i]) {
aiEntries.push_back(a);
}
}
}
// now build the new list
delete pcNode->mMeshes;
pcNode->mNumMeshes = static_cast<unsigned int>(aiEntries.size());
pcNode->mMeshes = new unsigned int[pcNode->mNumMeshes];
for (unsigned int b = 0; b < pcNode->mNumMeshes;++b) {
pcNode->mMeshes[b] = aiEntries[b];
}
// recursively update children
for (unsigned int i = 0, end = pcNode->mNumChildren; i < end;++i) {
UpdateNode ( pcNode->mChildren[i], source_mesh_map );
}
return;
}
#define WAS_NOT_COPIED 0xffffffff
typedef std::pair <unsigned int,float> PerVertexWeight;
typedef std::vector <PerVertexWeight> VertexWeightTable;
// ------------------------------------------------------------------------------------------------
VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) {
if (!pMesh || !pMesh->mNumVertices || !pMesh->mNumBones) {
return nullptr;
}
VertexWeightTable* const avPerVertexWeights = new VertexWeightTable[pMesh->mNumVertices];
for (unsigned int i = 0; i < pMesh->mNumBones;++i) {
aiBone* bone = pMesh->mBones[i];
for (unsigned int a = 0; a < bone->mNumWeights;++a) {
const aiVertexWeight& weight = bone->mWeights[a];
avPerVertexWeights[weight.mVertexId].push_back( std::make_pair(i,weight.mWeight) );
}
}
return avPerVertexWeights;
}
// ------------------------------------------------------------------------------------------------
void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map) {
// TODO: should better use std::(multi)set for source_mesh_map.
if (in_mesh->mNumVertices <= LIMIT) {
source_mesh_map.push_back(std::make_pair(in_mesh,a));
return;
}
// build a per-vertex weight list if necessary
VertexWeightTable* avPerVertexWeights = ComputeVertexBoneWeightTable(in_mesh);
// we need to split this mesh into sub meshes. Estimate submesh size
const unsigned int sub_meshes = (in_mesh->mNumVertices / LIMIT) + 1;
// create a std::vector<unsigned int> to remember which vertices have already
// been copied and to which position (i.e. output index)
std::vector<unsigned int> was_copied_to;
was_copied_to.resize(in_mesh->mNumVertices,WAS_NOT_COPIED);
// Try to find a good estimate for the number of output faces
// per mesh. Add 12.5% as buffer
unsigned int size_estimated = in_mesh->mNumFaces / sub_meshes;
size_estimated += size_estimated / 8;
// now generate all submeshes
unsigned int base = 0;
while (true) {
const unsigned int out_vertex_index = LIMIT;
aiMesh* out_mesh = new aiMesh();
out_mesh->mNumVertices = 0;
out_mesh->mMaterialIndex = in_mesh->mMaterialIndex;
// the name carries the adjacency information between the meshes
out_mesh->mName = in_mesh->mName;
typedef std::vector<aiVertexWeight> BoneWeightList;
if (in_mesh->HasBones()) {
out_mesh->mBones = new aiBone*[in_mesh->mNumBones]();
}
// clear the temporary helper array
if (base) {
std::fill(was_copied_to.begin(), was_copied_to.end(), WAS_NOT_COPIED);
}
std::vector<aiFace> vFaces;
// reserve enough storage for most cases
if (in_mesh->HasPositions()) {
out_mesh->mVertices = new aiVector3D[out_vertex_index];
}
if (in_mesh->HasNormals()) {
out_mesh->mNormals = new aiVector3D[out_vertex_index];
}
if (in_mesh->HasTangentsAndBitangents()) {
out_mesh->mTangents = new aiVector3D[out_vertex_index];
out_mesh->mBitangents = new aiVector3D[out_vertex_index];
}
for (unsigned int c = 0; in_mesh->HasVertexColors(c);++c) {
out_mesh->mColors[c] = new aiColor4D[out_vertex_index];
}
for (unsigned int c = 0; in_mesh->HasTextureCoords(c);++c) {
out_mesh->mNumUVComponents[c] = in_mesh->mNumUVComponents[c];
out_mesh->mTextureCoords[c] = new aiVector3D[out_vertex_index];
}
vFaces.reserve(size_estimated);
// (we will also need to copy the array of indices)
while (base < in_mesh->mNumFaces) {
const unsigned int iNumIndices = in_mesh->mFaces[base].mNumIndices;
// doesn't catch degenerates but is quite fast
unsigned int iNeed = 0;
for (unsigned int v = 0; v < iNumIndices;++v) {
unsigned int index = in_mesh->mFaces[base].mIndices[v];
// check whether we do already have this vertex
if (WAS_NOT_COPIED == was_copied_to[index]) {
iNeed++;
}
}
if (out_mesh->mNumVertices + iNeed > out_vertex_index) {
// don't use this face
break;
}
vFaces.push_back(aiFace());
aiFace& rFace = vFaces.back();
// setup face type and number of indices
rFace.mNumIndices = iNumIndices;
rFace.mIndices = new unsigned int[iNumIndices];
// need to update the output primitive types
switch (rFace.mNumIndices)
{
case 1:
out_mesh->mPrimitiveTypes |= aiPrimitiveType_POINT;
break;
case 2:
out_mesh->mPrimitiveTypes |= aiPrimitiveType_LINE;
break;
case 3:
out_mesh->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE;
break;
default:
out_mesh->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
}
// and copy the contents of the old array, offset them by current base
for (unsigned int v = 0; v < iNumIndices;++v) {
const unsigned int index = in_mesh->mFaces[base].mIndices[v];
// check whether we do already have this vertex
if (WAS_NOT_COPIED != was_copied_to[index]) {
rFace.mIndices[v] = was_copied_to[index];
continue;
}
// copy positions
out_mesh->mVertices[out_mesh->mNumVertices] = (in_mesh->mVertices[index]);
// copy normals
if (in_mesh->HasNormals()) {
out_mesh->mNormals[out_mesh->mNumVertices] = (in_mesh->mNormals[index]);
}
// copy tangents/bi-tangents
if (in_mesh->HasTangentsAndBitangents()) {
out_mesh->mTangents[out_mesh->mNumVertices] = (in_mesh->mTangents[index]);
out_mesh->mBitangents[out_mesh->mNumVertices] = (in_mesh->mBitangents[index]);
}
// texture coordinates
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c) {
if (in_mesh->HasTextureCoords( c)) {
out_mesh->mTextureCoords[c][out_mesh->mNumVertices] = in_mesh->mTextureCoords[c][index];
}
}
// vertex colors
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS;++c) {
if (in_mesh->HasVertexColors( c)) {
out_mesh->mColors[c][out_mesh->mNumVertices] = in_mesh->mColors[c][index];
}
}
// check whether we have bone weights assigned to this vertex
rFace.mIndices[v] = out_mesh->mNumVertices;
if (avPerVertexWeights) {
VertexWeightTable& table = avPerVertexWeights[ out_mesh->mNumVertices ];
for (VertexWeightTable::const_iterator iter = table.begin(), end = table.end(); iter != end;++iter) {
// allocate the bone weight array if necessary and store it in the mBones field (HACK!)
BoneWeightList* weight_list = reinterpret_cast<BoneWeightList*>(out_mesh->mBones[(*iter).first]);
if (!weight_list) {
weight_list = new BoneWeightList();
out_mesh->mBones[(*iter).first] = reinterpret_cast<aiBone*>(weight_list);
}
weight_list->push_back(aiVertexWeight(out_mesh->mNumVertices,(*iter).second));
}
}
was_copied_to[index] = out_mesh->mNumVertices;
out_mesh->mNumVertices++;
}
base++;
if(out_mesh->mNumVertices == out_vertex_index) {
// break here. The face is only added if it was complete
break;
}
}
// check which bones we'll need to create for this submesh
if (in_mesh->HasBones()) {
aiBone** ppCurrent = out_mesh->mBones;
for (unsigned int k = 0; k < in_mesh->mNumBones;++k) {
// check whether the bone exists
BoneWeightList* const weight_list = reinterpret_cast<BoneWeightList*>(out_mesh->mBones[k]);
if (weight_list) {
const aiBone* const bone_in = in_mesh->mBones[k];
aiBone* const bone_out = new aiBone();
*ppCurrent++ = bone_out;
bone_out->mName = aiString(bone_in->mName);
bone_out->mOffsetMatrix =bone_in->mOffsetMatrix;
bone_out->mNumWeights = (unsigned int)weight_list->size();
bone_out->mWeights = new aiVertexWeight[bone_out->mNumWeights];
// copy the vertex weights
::memcpy(bone_out->mWeights, &(*weight_list)[0],bone_out->mNumWeights * sizeof(aiVertexWeight));
delete weight_list;
out_mesh->mNumBones++;
}
}
}
// copy the face list to the mesh
out_mesh->mFaces = new aiFace[vFaces.size()];
out_mesh->mNumFaces = (unsigned int)vFaces.size();
for (unsigned int p = 0; p < out_mesh->mNumFaces;++p) {
out_mesh->mFaces[p] = vFaces[p];
}
// add the newly created mesh to the list
source_mesh_map.push_back(std::make_pair(out_mesh,a));
if (base == in_mesh->mNumFaces) {
break;
}
}
// delete the per-vertex weight list again
delete[] avPerVertexWeights;
// now delete the old mesh data
delete in_mesh;
}

View File

@@ -0,0 +1,61 @@
/*
Assimp2Json
Copyright (c) 2011, Alexander C. Gessler
Licensed under a 3-clause BSD license. See the LICENSE file for more information.
*/
#ifndef INCLUDED_MESH_SPLITTER
#define INCLUDED_MESH_SPLITTER
// ----------------------------------------------------------------------------
// Note: this is largely based on assimp's SplitLargeMeshes_Vertex process.
// it is refactored and the coding style is slightly improved, though.
// ----------------------------------------------------------------------------
#include <vector>
struct aiScene;
struct aiMesh;
struct aiNode;
// ---------------------------------------------------------------------------
/** Splits meshes of unique vertices into meshes with no more vertices than
* a given, configurable threshold value.
*/
class MeshSplitter
{
public:
void SetLimit(unsigned int l) {
LIMIT = l;
}
unsigned int GetLimit() const {
return LIMIT;
}
public:
// -------------------------------------------------------------------
/** Executes the post processing step on the given imported data.
* At the moment a process is not supposed to fail.
* @param pScene The imported data to work at.
*/
void Execute( aiScene* pScene);
private:
void UpdateNode(aiNode* pcNode, const std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map);
void SplitMesh (unsigned int index, aiMesh* mesh, std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map);
public:
unsigned int LIMIT;
};
#endif // INCLUDED_MESH_SPLITTER

View File

@@ -46,13 +46,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_EXPORT
#ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER
#include <stdarg.h>
#include "PostProcessing/ProcessHelper.h"
#include <assimp/version.h>
#include "ProcessHelper.h"
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#include <stdarg.h>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h>
#else
@@ -555,8 +557,6 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened) {
mesh->mNormals[n].z);
}
}
else {
}
ioprintf(io,"\t\t</Normals>\n");
}

View File

@@ -49,17 +49,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_B3D_IMPORTER
// internal headers
#include "B3DImporter.h"
#include "TextureTransform.h"
#include "ConvertToLHProcess.h"
#include "B3D/B3DImporter.h"
#include "PostProcessing/TextureTransform.h"
#include "PostProcessing/ConvertToLHProcess.h"
#include <assimp/StringUtils.h>
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/anim.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/importerdesc.h>
#include <memory>
using namespace Assimp;
using namespace std;

View File

@@ -416,7 +416,7 @@ template <> struct Structure :: _defaultInitializer<ErrorPolicy_Fail> {
void operator ()(T& /*out*/,const char* = "") {
// obviously, it is crucial that _DefaultInitializer is used
// only from within a catch clause.
throw;
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error");
}
};

View File

@@ -1225,6 +1225,16 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* obj, c
case Lamp::Type_Local:
out->mType = aiLightSource_POINT;
break;
case Lamp::Type_Spot:
out->mType = aiLightSource_SPOT;
// 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);
out->mAngleInnerCone = lamp->spotsize * (1.0f - lamp->spotblend);
out->mAngleOuterCone = lamp->spotsize;
break;
case Lamp::Type_Sun:
out->mType = aiLightSource_DIRECTIONAL;
@@ -1255,6 +1265,23 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* obj, c
out->mColorAmbient = aiColor3D(lamp->r, lamp->g, lamp->b) * lamp->energy;
out->mColorSpecular = aiColor3D(lamp->r, lamp->g, lamp->b) * lamp->energy;
out->mColorDiffuse = aiColor3D(lamp->r, lamp->g, lamp->b) * lamp->energy;
// If default values are supplied, compute the coefficients from light's max distance
// Read this: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/
//
if (lamp->constant_coefficient == 1.0f && lamp->linear_coefficient == 0.0f && lamp->quadratic_coefficient == 0.0f && lamp->dist > 0.0f)
{
out->mAttenuationConstant = 1.0f;
out->mAttenuationLinear = 2.0f / lamp->dist;
out->mAttenuationQuadratic = 1.0f / (lamp->dist * lamp->dist);
}
else
{
out->mAttenuationConstant = lamp->constant_coefficient;
out->mAttenuationLinear = lamp->linear_coefficient;
out->mAttenuationQuadratic = lamp->quadratic_coefficient;
}
return out.release();
}

View File

@@ -211,9 +211,12 @@ template <> void Structure :: Convert<Lamp> (
ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
ReadField<ErrorPolicy_Warn>(dest.k,"k",db);
ReadField<ErrorPolicy_Igno>(dest.energy,"energy",db);
ReadField<ErrorPolicy_Igno>(dest.dist,"dist",db);
ReadField<ErrorPolicy_Warn>(dest.dist,"dist",db);
ReadField<ErrorPolicy_Igno>(dest.spotsize,"spotsize",db);
ReadField<ErrorPolicy_Igno>(dest.spotblend,"spotblend",db);
ReadField<ErrorPolicy_Warn>(dest.constant_coefficient, "coeff_const", db);
ReadField<ErrorPolicy_Warn>(dest.linear_coefficient, "coeff_lin", db);
ReadField<ErrorPolicy_Warn>(dest.quadratic_coefficient, "coeff_quad", db);
ReadField<ErrorPolicy_Igno>(dest.att1,"att1",db);
ReadField<ErrorPolicy_Igno>(dest.att2,"att2",db);
ReadField<ErrorPolicy_Igno>(temp,"falloff_type",db);

View File

@@ -538,6 +538,10 @@ struct Lamp : ElemBase {
float energy, dist, spotsize, spotblend;
//float haint;
float constant_coefficient;
float linear_coefficient;
float quadratic_coefficient;
float att1, att2;
//struct CurveMapping *curfalloff;
FalloffType falloff_type;

View File

@@ -144,7 +144,11 @@ namespace Assimp
#if ASSIMP_BLEND_WITH_POLY_2_TRI
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
#ifdef ASSIMP_USE_HUNTER
# include <poly2tri/poly2tri.h>
#else
# include "../contrib/poly2tri/poly2tri/poly2tri.h"
#endif
namespace Assimp
{

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2012, assimp team
Copyright (c) 2006-2019, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -68,8 +68,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace melange;
// overload this function and fill in your own unique data
void GetWriterInfo(int &id, String &appname)
{
void GetWriterInfo(int &id, String &appname) {
id = 2424226;
appname = "Open Asset Import Library";
}
@@ -78,7 +77,10 @@ using namespace Assimp;
using namespace Assimp::Formatter;
namespace Assimp {
template<> const std::string LogFunctions<C4DImporter>::log_prefix = "C4D: ";
template<> const char* LogFunctions<C4DImporter>::Prefix() {
static auto prefix = "C4D: ";
return prefix;
}
}
static const aiImporterDesc desc = {
@@ -97,47 +99,44 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
C4DImporter::C4DImporter()
{}
: BaseImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
C4DImporter::~C4DImporter()
{}
C4DImporter::~C4DImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
const std::string& extension = GetExtension(pFile);
if (extension == "c4d") {
return true;
}
else if ((!extension.length() || checkSig) && pIOHandler) {
} else if ((!extension.length() || checkSig) && pIOHandler) {
// TODO
}
return false;
}
// ------------------------------------------------------------------------------------------------
const aiImporterDesc* C4DImporter::GetInfo () const
{
const aiImporterDesc* C4DImporter::GetInfo () const {
return &desc;
}
// ------------------------------------------------------------------------------------------------
void C4DImporter::SetupProperties(const Importer* /*pImp*/)
{
void C4DImporter::SetupProperties(const Importer* /*pImp*/) {
// nothing to be done for the moment
}
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void C4DImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
{
void C4DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
if( file.get() == NULL) {
if( file.get() == nullptr ) {
ThrowException("failed to open file " + pFile);
}
@@ -151,7 +150,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// open document first
BaseDocument* doc = LoadDocument(f, SCENEFILTER_OBJECTS | SCENEFILTER_MATERIALS);
if(doc == NULL) {
if(doc == nullptr ) {
ThrowException("failed to read document " + pFile);
}
@@ -160,11 +159,10 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// first convert all materials
ReadMaterials(doc->GetFirstMaterial());
// process C4D scenegraph recursively
// process C4D scene-graph recursively
try {
RecurseHierarchy(doc->GetFirstObject(), pScene->mRootNode);
}
catch(...) {
} catch(...) {
for(aiMesh* mesh : meshes) {
delete mesh;
}
@@ -201,8 +199,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) {
if(shader->GetType() == Xlayer) {
@@ -220,15 +217,12 @@ bool C4DImporter::ReadShader(aiMaterial* out, melange::BaseShader* shader)
// Ignore the actual layer blending - models for real-time rendering should not
// use them in a non-trivial way. Just try to find textures that we can apply
// to the model.
while (lsl)
{
if (lsl->GetType() == TypeFolder)
{
while (lsl) {
if (lsl->GetType() == TypeFolder) {
BlendFolder* const folder = dynamic_cast<BlendFolder*>(lsl);
LayerShaderLayer *subLsl = dynamic_cast<LayerShaderLayer*>(folder->m_Children.GetObject(0));
while (subLsl)
{
while (subLsl) {
if (subLsl->GetType() == TypeShader) {
BlendShader* const shader = dynamic_cast<BlendShader*>(subLsl);
if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) {
@@ -238,8 +232,7 @@ bool C4DImporter::ReadShader(aiMaterial* out, melange::BaseShader* shader)
subLsl = subLsl->GetNext();
}
}
else if (lsl->GetType() == TypeShader) {
} else if (lsl->GetType() == TypeShader) {
BlendShader* const shader = dynamic_cast<BlendShader*>(lsl);
if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) {
return true;
@@ -248,33 +241,27 @@ bool C4DImporter::ReadShader(aiMaterial* out, melange::BaseShader* shader)
lsl = lsl->GetNext();
}
}
else if ( shader->GetType() == Xbitmap )
{
} else if ( shader->GetType() == Xbitmap ) {
aiString path;
shader->GetFileName().GetString().GetCString(path.data, MAXLEN-1);
path.length = ::strlen(path.data);
out->AddProperty(&path, AI_MATKEY_TEXTURE_DIFFUSE(0));
return true;
}
else {
} else {
LogWarn("ignoring shader type: " + std::string(GetObjectTypeName(shader->GetType())));
}
shader = shader->GetNext();
}
return false;
}
// ------------------------------------------------------------------------------------------------
void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
{
void C4DImporter::ReadMaterials(melange::BaseMaterial* mat) {
// based on Melange sample code
while (mat)
{
while (mat) {
const String& name = mat->GetName();
if (mat->GetType() == Mmaterial)
{
if (mat->GetType() == Mmaterial) {
aiMaterial* out = new aiMaterial();
material_mapping[mat] = static_cast<unsigned int>(materials.size());
materials.push_back(out);
@@ -286,8 +273,7 @@ void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
Material& m = dynamic_cast<Material&>(*mat);
if (m.GetChannelState(CHANNEL_COLOR))
{
if (m.GetChannelState(CHANNEL_COLOR)) {
GeData data;
mat->GetParameter(MATERIAL_COLOR_COLOR, data);
Vector color = data.GetVector();
@@ -307,9 +293,7 @@ void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
if(shader) {
ReadShader(out, shader);
}
}
else
{
} else {
LogWarn("ignoring plugin material: " + std::string(GetObjectTypeName(mat->GetType())));
}
mat = mat->GetNext();
@@ -317,14 +301,12 @@ void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
}
// ------------------------------------------------------------------------------------------------
void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
{
ai_assert(parent != NULL);
void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent) {
ai_assert(parent != nullptr );
std::vector<aiNode*> nodes;
// based on Melange sample code
while (object)
{
while (object) {
const String& name = object->GetName();
const LONG type = object->GetType();
const Matrix& ml = object->GetMl();
@@ -356,26 +338,20 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
nodes.push_back(nd);
GeData data;
if (type == Ocamera)
{
if (type == Ocamera) {
object->GetParameter(CAMERAOBJECT_FOV, data);
// TODO: read camera
}
else if (type == Olight)
{
} else if (type == Olight) {
// TODO: read light
}
else if (type == Opolygon)
{
} else if (type == Opolygon) {
aiMesh* const mesh = ReadMesh(object);
if(mesh != NULL) {
if(mesh != nullptr) {
nd->mNumMeshes = 1;
nd->mMeshes = new unsigned int[1];
nd->mMeshes[0] = static_cast<unsigned int>(meshes.size());
meshes.push_back(mesh);
}
}
else {
} else {
LogWarn("ignoring object: " + std::string(GetObjectTypeName(type)));
}
@@ -389,28 +365,27 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
std::copy(nodes.begin(), nodes.end(), parent->mChildren);
}
// ------------------------------------------------------------------------------------------------
aiMesh* C4DImporter::ReadMesh(BaseObject* object)
{
ai_assert(object != NULL && object->GetType() == Opolygon);
aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
ai_assert(object != nullptr);
ai_assert( object->GetType() == Opolygon );
// based on Melange sample code
PolygonObject* const polyObject = dynamic_cast<PolygonObject*>(object);
ai_assert(polyObject != NULL);
ai_assert(polyObject != nullptr);
const LONG pointCount = polyObject->GetPointCount();
const LONG polyCount = polyObject->GetPolygonCount();
if(!polyObject || !pointCount) {
LogWarn("ignoring mesh with zero vertices or faces");
return NULL;
return nullptr;
}
const Vector* points = polyObject->GetPointR();
ai_assert(points != NULL);
ai_assert(points != nullptr);
const CPolygon* polys = polyObject->GetPolygonR();
ai_assert(polys != NULL);
ai_assert(polys != nullptr);
std::unique_ptr<aiMesh> mesh(new aiMesh());
mesh->mNumFaces = static_cast<unsigned int>(polyCount);
@@ -443,14 +418,14 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
// check if there are normals, tangents or UVW coordinates
BaseTag* tag = object->GetTag(Tnormal);
NormalTag* normals_src = NULL;
NormalTag* normals_src = nullptr;
if(tag) {
normals_src = dynamic_cast<NormalTag*>(tag);
normals = mesh->mNormals = new aiVector3D[mesh->mNumVertices]();
}
tag = object->GetTag(Ttangent);
TangentTag* tangents_src = NULL;
TangentTag* tangents_src = nullptr;
if(tag) {
tangents_src = dynamic_cast<TangentTag*>(tag);
tangents = mesh->mTangents = new aiVector3D[mesh->mNumVertices]();
@@ -458,15 +433,14 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
}
tag = object->GetTag(Tuvw);
UVWTag* uvs_src = NULL;
UVWTag* uvs_src = nullptr;
if(tag) {
uvs_src = dynamic_cast<UVWTag*>(tag);
uvs = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]();
}
// copy vertices and extra channels over and populate faces
for (LONG i = 0; i < polyCount; ++i, ++face)
{
for (LONG i = 0; i < polyCount; ++i, ++face) {
ai_assert(polys[i].a < pointCount && polys[i].a >= 0);
const Vector& pointA = points[polys[i].a];
verts->x = pointA.x;
@@ -489,8 +463,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
++verts;
// TODO: do we also need to handle lines or points with similar checks?
if (polys[i].c != polys[i].d)
{
if (polys[i].c != polys[i].d) {
ai_assert(polys[i].d < pointCount && polys[i].d >= 0);
face->mNumIndices = 4;
@@ -500,8 +473,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
verts->y = pointD.y;
verts->z = pointD.z;
++verts;
}
else {
} else {
face->mNumIndices = 3;
}
face->mIndices = new unsigned int[face->mNumIndices];
@@ -513,8 +485,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
if (normals_src) {
if(i >= normals_src->GetDataCount()) {
LogError("unexpected number of normals, ignoring");
}
else {
} else {
ConstNormalHandle normal_handle = normals_src->GetDataAddressR();
NormalStruct nor;
NormalTag::Get(normal_handle, i, nor);
@@ -616,26 +587,25 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
}
mesh->mMaterialIndex = ResolveMaterial(polyObject);
return mesh.release();
}
// ------------------------------------------------------------------------------------------------
unsigned int C4DImporter::ResolveMaterial(PolygonObject* obj)
{
ai_assert(obj != NULL);
unsigned int C4DImporter::ResolveMaterial(PolygonObject* obj) {
ai_assert(obj != nullptr);
const unsigned int mat_count = static_cast<unsigned int>(materials.size());
BaseTag* tag = obj->GetTag(Ttexture);
if(tag == NULL) {
if(tag == nullptr) {
return mat_count;
}
TextureTag& ttag = dynamic_cast<TextureTag&>(*tag);
BaseMaterial* const mat = ttag.GetMaterial();
ai_assert(mat != NULL);
ai_assert(mat != nullptr);
const MaterialMap::const_iterator it = material_mapping.find(mat);
if(it == material_mapping.end()) {
@@ -643,6 +613,7 @@ unsigned int C4DImporter::ResolveMaterial(PolygonObject* obj)
}
ai_assert((*it).second < mat_count);
return (*it).second;
}

View File

@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2012, assimp team
Copyright (c) 2006-2019, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/LogAux.h>
#include <map>
// Forward declarations
struct aiNode;
struct aiMesh;
struct aiMaterial;
@@ -61,8 +63,7 @@ namespace melange {
class BaseShader;
}
namespace Assimp {
namespace Assimp {
// TinyFormatter.h
namespace Formatter {
template <typename T,typename TR, typename A> class basic_formatter;
@@ -75,17 +76,10 @@ namespace Assimp {
*
* Note that Melange is not free software. */
// -------------------------------------------------------------------------------------------
class C4DImporter : public BaseImporter, public LogFunctions<C4DImporter>
{
class C4DImporter : public BaseImporter, public LogFunctions<C4DImporter> {
public:
C4DImporter();
~C4DImporter();
public:
// --------------------
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const;
@@ -119,5 +113,5 @@ private:
}; // !class C4DImporter
} // end of namespace Assimp
#endif // INCLUDED_AI_CINEMA_4D_LOADER_H
#endif // INCLUDED_AI_CINEMA_4D_LOADER_H

View File

@@ -49,7 +49,7 @@ Assimp C export interface. See Exporter.cpp for some notes.
#include "CInterfaceIOWrapper.h"
#include <assimp/SceneCombiner.h>
#include "ScenePrivate.h"
#include "Common/ScenePrivate.h"
#include <assimp/Exporter.hpp>
using namespace Assimp;

File diff suppressed because it is too large Load Diff

View File

@@ -45,20 +45,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_COB_IMPORTER
#include "COBLoader.h"
#include "COBScene.h"
#include "ConvertToLHProcess.h"
#include "COB/COBLoader.h"
#include "COB/COBScene.h"
#include "PostProcessing/ConvertToLHProcess.h"
#include <assimp/StreamReader.h>
#include <assimp/ParsingUtils.h>
#include <assimp/fast_atof.h>
#include <assimp/LineSplitter.h>
#include <assimp/TinyFormatter.h>
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include <assimp/importerdesc.h>
#include <memory>
using namespace Assimp;
using namespace Assimp::COB;
using namespace Assimp::Formatter;
@@ -144,7 +146,7 @@ void COBImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
// check header
char head[32];
stream->CopyAndAdvance(head,32);
if (strncmp(head,"Caligari ",9)) {
if (strncmp(head,"Caligari ",9) != 0) {
ThrowException("Could not found magic id: `Caligari`");
}
@@ -656,14 +658,14 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
ReadFloat3Tuple_Ascii(msh.color ,&rgb);
SkipSpaces(&rgb);
if (strncmp(rgb,"cone angle",10)) {
if (strncmp(rgb,"cone angle",10) != 0) {
ASSIMP_LOG_WARN_F( "Expected `cone angle` entity in `color` line in `Lght` chunk ", nfo.id );
}
SkipSpaces(rgb+10,&rgb);
msh.angle = fast_atof(&rgb);
SkipSpaces(&rgb);
if (strncmp(rgb,"inner angle",11)) {
if (strncmp(rgb,"inner angle",11) != 0) {
ASSIMP_LOG_WARN_F( "Expected `inner angle` entity in `color` line in `Lght` chunk ", nfo.id);
}
SkipSpaces(rgb+11,&rgb);
@@ -896,6 +898,7 @@ public:
: nfo(nfo)
, reader(reader)
, cur(reader.GetCurrentPos()) {
// empty
}
~chunk_guard() {
@@ -903,7 +906,7 @@ public:
if(nfo.size != static_cast<unsigned int>(-1)) {
try {
reader.IncPtr( static_cast< int >( nfo.size ) - reader.GetCurrentPos() + cur );
} catch ( DeadlyImportError e ) {
} catch (const DeadlyImportError& ) {
// out of limit so correct the value
reader.IncPtr( reader.GetReadLimit() );
}
@@ -911,15 +914,17 @@ public:
}
private:
const COB::ChunkInfo& nfo;
StreamReaderLE& reader;
long cur;
};
// ------------------------------------------------------------------------------------------------
void COBImporter::ReadBinaryFile(Scene& out, StreamReaderLE* reader)
{
void COBImporter::ReadBinaryFile(Scene& out, StreamReaderLE* reader) {
if (nullptr == reader) {
return;
}
while(1) {
std::string type;
type += reader -> GetI1()
@@ -1214,7 +1219,7 @@ void COBImporter::ReadGrou_Binary(COB::Scene& out, StreamReaderLE& reader, const
const chunk_guard cn(nfo,reader);
out.nodes.push_back(std::shared_ptr<Group>(new Group()));
out.nodes.push_back(std::make_shared<Group>());
Group& msh = (Group&)(*out.nodes.back().get());
msh = nfo;

View File

@@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ColladaExporter.h"
#include <assimp/Bitmap.h>
#include <assimp/MathFunctions.h>
#include <assimp/fast_atof.h>
#include <assimp/SceneCombiner.h>
#include <assimp/StringUtils.h>
@@ -64,13 +65,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
namespace Assimp
{
namespace Assimp {
// ------------------------------------------------------------------------------------------------
// Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp
void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/)
{
void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/) {
std::string path = DefaultIOSystem::absolutePath(std::string(pFile));
std::string file = DefaultIOSystem::completeBaseName(std::string(pFile));
@@ -93,15 +92,15 @@ void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* p
} // end of namespace Assimp
// ------------------------------------------------------------------------------------------------
// Constructor for a specific scene to export
ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file) : mIOSystem(pIOSystem), mPath(path), mFile(file)
{
ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file)
: mIOSystem(pIOSystem)
, mPath(path)
, mFile(file) {
// make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") );
mOutput.precision(16);
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
mScene = pScene;
mSceneOwned = false;
@@ -115,17 +114,15 @@ ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, co
// ------------------------------------------------------------------------------------------------
// Destructor
ColladaExporter::~ColladaExporter()
{
if(mSceneOwned) {
ColladaExporter::~ColladaExporter() {
if ( mSceneOwned ) {
delete mScene;
}
}
// ------------------------------------------------------------------------------------------------
// Starts writing the contents
void ColladaExporter::WriteFile()
{
void ColladaExporter::WriteFile() {
// write the DTD
mOutput << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" << endstr;
// COLLADA element start
@@ -158,9 +155,8 @@ void ColladaExporter::WriteFile()
// ------------------------------------------------------------------------------------------------
// Writes the asset header
void ColladaExporter::WriteHeader()
{
static const ai_real epsilon = ai_real( 0.00001 );
void ColladaExporter::WriteHeader() {
static const ai_real epsilon = Math::getEpsilon<ai_real>();
static const aiQuaternion x_rot(aiMatrix3x3(
0, -1, 0,
1, 0, 0,
@@ -238,25 +234,64 @@ void ColladaExporter::WriteHeader()
mOutput << startstr << "<contributor>" << endstr;
PushTag();
aiMetadata* meta = mScene->mRootNode->mMetaData;
// If no Scene metadata, use root node metadata
aiMetadata* meta = mScene->mMetaData;
if (nullptr == meta) {
meta = mScene->mRootNode->mMetaData;
}
aiString value;
if (!meta || !meta->Get("Author", value))
if (!meta || !meta->Get("Author", value)) {
mOutput << startstr << "<author>" << "Assimp" << "</author>" << endstr;
else
} else {
mOutput << startstr << "<author>" << XMLEscape(value.C_Str()) << "</author>" << endstr;
}
if (!meta || !meta->Get("AuthoringTool", value))
if (nullptr == meta || !meta->Get("AuthoringTool", value)) {
mOutput << startstr << "<authoring_tool>" << "Assimp Exporter" << "</authoring_tool>" << endstr;
else
} else {
mOutput << startstr << "<authoring_tool>" << XMLEscape(value.C_Str()) << "</authoring_tool>" << endstr;
}
//mOutput << startstr << "<author>" << mScene->author.C_Str() << "</author>" << endstr;
//mOutput << startstr << "<authoring_tool>" << mScene->authoringTool.C_Str() << "</authoring_tool>" << endstr;
if (meta) {
if (meta->Get("Comments", value)) {
mOutput << startstr << "<comments>" << XMLEscape(value.C_Str()) << "</comments>" << endstr;
}
if (meta->Get("Copyright", value)) {
mOutput << startstr << "<copyright>" << XMLEscape(value.C_Str()) << "</copyright>" << endstr;
}
if (meta->Get("SourceData", value)) {
mOutput << startstr << "<source_data>" << XMLEscape(value.C_Str()) << "</source_data>" << endstr;
}
}
PopTag();
mOutput << startstr << "</contributor>" << endstr;
mOutput << startstr << "<created>" << date_str << "</created>" << endstr;
if (nullptr == meta || !meta->Get("Created", value)) {
mOutput << startstr << "<created>" << date_str << "</created>" << endstr;
} else {
mOutput << startstr << "<created>" << XMLEscape(value.C_Str()) << "</created>" << endstr;
}
// Modified date is always the date saved
mOutput << startstr << "<modified>" << date_str << "</modified>" << endstr;
if (meta) {
if (meta->Get("Keywords", value)) {
mOutput << startstr << "<keywords>" << XMLEscape(value.C_Str()) << "</keywords>" << endstr;
}
if (meta->Get("Revision", value)) {
mOutput << startstr << "<revision>" << XMLEscape(value.C_Str()) << "</revision>" << endstr;
}
if (meta->Get("Subject", value)) {
mOutput << startstr << "<subject>" << XMLEscape(value.C_Str()) << "</subject>" << endstr;
}
if (meta->Get("Title", value)) {
mOutput << startstr << "<title>" << XMLEscape(value.C_Str()) << "</title>" << endstr;
}
}
mOutput << startstr << "<unit name=\"meter\" meter=\"" << scale << "\" />" << endstr;
mOutput << startstr << "<up_axis>" << up_axis << "</up_axis>" << endstr;
PopTag();
@@ -269,18 +304,21 @@ void ColladaExporter::WriteTextures() {
static const unsigned int buffer_size = 1024;
char str[buffer_size];
if(mScene->HasTextures()) {
if (mScene->HasTextures()) {
for(unsigned int i = 0; i < mScene->mNumTextures; i++) {
// It would be great to be able to create a directory in portable standard C++, but it's not the case,
// so we just write the textures in the current directory.
aiTexture* texture = mScene->mTextures[i];
if ( nullptr == texture ) {
continue;
}
ASSIMP_itoa10(str, buffer_size, i + 1);
std::string name = mFile + "_texture_" + (i < 1000 ? "0" : "") + (i < 100 ? "0" : "") + (i < 10 ? "0" : "") + str + "." + ((const char*) texture->achFormatHint);
std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath + name, "wb"));
std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath + mIOSystem->getOsSeparator() + name, "wb"));
if(outfile == NULL) {
throw DeadlyExportError("could not open output texture file: " + mPath + name);
}
@@ -428,6 +466,7 @@ void ColladaExporter::WritePointLight(const aiLight *const light){
mOutput << startstr << "</point>" << endstr;
}
void ColladaExporter::WriteDirectionalLight(const aiLight *const light){
const aiColor3D &color= light->mColorDiffuse;
mOutput << startstr << "<directional>" << endstr;
@@ -440,6 +479,7 @@ void ColladaExporter::WriteDirectionalLight(const aiLight *const light){
mOutput << startstr << "</directional>" << endstr;
}
void ColladaExporter::WriteSpotLight(const aiLight *const light){
const aiColor3D &color= light->mColorDiffuse;
@@ -496,18 +536,16 @@ void ColladaExporter::WriteAmbienttLight(const aiLight *const light){
// ------------------------------------------------------------------------------------------------
// Reads a single surface entry from the given material keys
void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat, aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex)
{
if( pSrcMat->GetTextureCount( pTexture) > 0 )
{
void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat,
aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex) {
if( pSrcMat->GetTextureCount( pTexture) > 0 ) {
aiString texfile;
unsigned int uvChannel = 0;
pSrcMat->GetTexture( pTexture, 0, &texfile, NULL, &uvChannel);
std::string index_str(texfile.C_Str());
if(index_str.size() != 0 && index_str[0] == '*')
{
if(index_str.size() != 0 && index_str[0] == '*') {
unsigned int index;
index_str = index_str.substr(1, std::string::npos);
@@ -525,15 +563,13 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial*
} else {
throw DeadlyExportError("could not find embedded texture at index " + index_str);
}
} else
{
} else {
poSurface.texture = texfile.C_Str();
}
poSurface.channel = uvChannel;
poSurface.exist = true;
} else
{
} else {
if( pKey )
poSurface.exist = pSrcMat->Get( pKey, static_cast<unsigned int>(pType), static_cast<unsigned int>(pIndex), poSurface.color) == aiReturn_SUCCESS;
}
@@ -541,15 +577,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)
{
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)
{
void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::string& pNameAdd) {
if( !pSurface.texture.empty() )
{
mOutput << startstr << "<image id=\"" << XMLEscape(pNameAdd) << "\">" << endstr;
@@ -803,8 +837,9 @@ void ColladaExporter::WriteControllerLibrary()
mOutput << startstr << "<library_controllers>" << endstr;
PushTag();
for( size_t a = 0; a < mScene->mNumMeshes; ++a)
for( size_t a = 0; a < mScene->mNumMeshes; ++a) {
WriteController( a);
}
PopTag();
mOutput << startstr << "</library_controllers>" << endstr;

View File

@@ -150,7 +150,6 @@ public:
/// Stringstream to write all output into
std::stringstream mOutput;
protected:
/// The IOSystem for output
IOSystem* mIOSystem;
@@ -204,7 +203,7 @@ protected:
std::map<unsigned int, std::string> textures;
protected:
public:
/// Dammit C++ - y u no compile two-pass? No I have to add all methods below the struct definitions
/// Reads a single surface entry from the given material keys
void ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat, aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex);

View File

@@ -580,15 +580,11 @@ struct Image
{
std::string mFileName;
/** If image file name is zero, embedded image data
*/
/** Embedded image data */
std::vector<uint8_t> mImageData;
/** If image file name is zero, file format of
* embedded image data.
*/
/** File format hint ofembedded image data */
std::string mEmbeddedFormat;
};
/** An animation channel. */

File diff suppressed because it is too large Load Diff

View File

@@ -94,20 +94,20 @@ public:
public:
/** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
protected:
/** Return importer meta information.
* See #BaseImporter::GetInfo for the details
*/
const aiImporterDesc* GetInfo () const;
const aiImporterDesc* GetInfo () const override;
void SetupProperties(const Importer* pImp);
void SetupProperties(const Importer* pImp) override;
/** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details
*/
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
/** Recursively constructs a scene node for the given parser node and returns it. */
aiNode* BuildHierarchy( const ColladaParser& pParser, const Collada::Node* pNode);
@@ -120,7 +120,7 @@ protected:
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
aiNode* pTarget);
aiMesh *findMesh(std::string meshid);
aiMesh *findMesh(const std::string& meshid);
/** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */
aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,

File diff suppressed because it is too large Load Diff

View File

@@ -54,6 +54,7 @@
namespace Assimp
{
class ZipArchiveIOSystem;
// ------------------------------------------------------------------------------------------
/** Parser helper class for the Collada loader.
@@ -66,12 +67,18 @@ namespace Assimp
friend class ColladaLoader;
protected:
/** Map for generic metadata as aiString */
typedef std::map<std::string, aiString> StringMetaData;
/** Constructor from XML file */
ColladaParser( IOSystem* pIOHandler, const std::string& pFile);
/** Destructor */
~ColladaParser();
/** Attempts to read the ZAE manifest and returns the DAE to open */
static std::string ReadZaeManifest(ZipArchiveIOSystem &zip_archive);
/** Reads the contents of the file */
void ReadContents();
@@ -81,6 +88,15 @@ namespace Assimp
/** Reads asset information such as coordinate system information and legal blah */
void ReadAssetInfo();
/** Reads contributor information such as author and legal blah */
void ReadContributorInfo();
/** Reads generic metadata into provided map */
void ReadMetaDataItem(StringMetaData &metadata);
/** Convert underscore_seperated to CamelCase "authoring_tool" becomes "AuthoringTool" */
static void ToCamelCase(std::string &text);
/** Reads the animation library */
void ReadAnimationLibrary();
@@ -223,6 +239,9 @@ namespace Assimp
// Processes bind_vertex_input and bind elements
void ReadMaterialVertexInputBinding( Collada::SemanticMappingTable& tbl);
/** Reads embedded textures from a ZAE archive*/
void ReadEmbeddedTextures(ZipArchiveIOSystem &zip_archive);
protected:
/** Aborts the file reading with an exception */
AI_WONT_RETURN void ThrowException( const std::string& pError) const AI_WONT_RETURN_SUFFIX;
@@ -343,6 +362,9 @@ namespace Assimp
/** Which is the up vector */
enum { UP_X, UP_Y, UP_Z } mUpDirection;
/** Asset metadata (global for scene) */
StringMetaData mAssetMetaData;
/** Collada file format version */
Collada::FormatVersion mFormat;
};

View File

@@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/Exceptional.h>
#include <assimp/BaseImporter.h>
#include "CInterfaceIOWrapper.h"
#include "CApi/CInterfaceIOWrapper.h"
#include "Importer.h"
#include "ScenePrivate.h"

View File

@@ -76,9 +76,25 @@ BaseImporter::~BaseImporter() {
// nothing to do here
}
void BaseImporter::UpdateImporterScale( Importer* pImp )
{
ai_assert(pImp != nullptr);
ai_assert(importerScale != 0.0);
ai_assert(fileScale != 0.0);
double activeScale = importerScale * fileScale;
// Set active scaling
pImp->SetPropertyFloat( AI_CONFIG_APP_SCALE_KEY, static_cast<float>( activeScale) );
ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: %f", activeScale );
}
// ------------------------------------------------------------------------------------------------
// Imports the given file and returns the imported data.
aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile, IOSystem* pIOHandler) {
aiScene* BaseImporter::ReadFile(Importer* pImp, const std::string& pFile, IOSystem* pIOHandler) {
m_progress = pImp->GetProgressHandler();
if (nullptr == m_progress) {
return nullptr;
@@ -100,6 +116,11 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile,
{
InternReadFile( pFile, sc.get(), &filter);
// Calculate import scale hook - required because pImp not available anywhere else
// passes scale into ScaleProcess
UpdateImporterScale(pImp);
} catch( const std::exception& err ) {
// extract error description
m_ErrorText = err.what();
@@ -112,7 +133,7 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile,
}
// ------------------------------------------------------------------------------------------------
void BaseImporter::SetupProperties(const Importer* /*pImp*/)
void BaseImporter::SetupProperties(const Importer* pImp)
{
// the default implementation does nothing
}
@@ -320,7 +341,11 @@ std::string BaseImporter::GetExtension( const std::string& file ) {
return false;
}
#include "../contrib/utf8cpp/source/utf8.h"
#ifdef ASSIMP_USE_HUNTER
# include <utf8/utf8.h>
#else
# include "../contrib/utf8cpp/source/utf8.h"
#endif
// ------------------------------------------------------------------------------------------------
// Convert to UTF8 data
@@ -584,6 +609,8 @@ aiScene* BatchLoader::GetImport( unsigned int which )
return nullptr;
}
// ------------------------------------------------------------------------------------------------
void BatchLoader::LoadAll()
{

View File

@@ -89,7 +89,7 @@ void BaseProcess::ExecuteOnScene( Importer* pImp)
// and kill the partially imported data
delete pImp->Pimpl()->mScene;
pImp->Pimpl()->mScene = NULL;
pImp->Pimpl()->mScene = nullptr;
}
}

View File

@@ -47,10 +47,6 @@ namespace Assimp {
aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh)
{
aiAnimMesh *animesh = new aiAnimMesh;
animesh->mVertices = NULL;
animesh->mNormals = NULL;
animesh->mTangents = NULL;
animesh->mBitangents = NULL;
animesh->mNumVertices = mesh->mNumVertices;
if (mesh->mVertices) {
animesh->mVertices = new aiVector3D[animesh->mNumVertices];

View File

@@ -61,83 +61,66 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
// maximum path length
// XXX http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
#ifdef PATH_MAX
# define PATHLIMIT PATH_MAX
#else
# define PATHLIMIT 4096
#ifdef _WIN32
static std::wstring Utf8ToWide(const char* in)
{
int size = MultiByteToWideChar(CP_UTF8, 0, in, -1, nullptr, 0);
// size includes terminating null; std::wstring adds null automatically
std::wstring out(static_cast<size_t>(size) - 1, L'\0');
MultiByteToWideChar(CP_UTF8, 0, in, -1, &out[0], size);
return out;
}
static std::string WideToUtf8(const wchar_t* in)
{
int size = WideCharToMultiByte(CP_UTF8, 0, in, -1, nullptr, 0, nullptr, nullptr);
// size includes terminating null; std::string adds null automatically
std::string out(static_cast<size_t>(size) - 1, '\0');
WideCharToMultiByte(CP_UTF8, 0, in, -1, &out[0], size, nullptr, nullptr);
return out;
}
#endif
// ------------------------------------------------------------------------------------------------
// Tests for the existence of a file at the given path.
bool DefaultIOSystem::Exists( const char* pFile) const
bool DefaultIOSystem::Exists(const char* pFile) const
{
#ifdef _WIN32
wchar_t fileName16[PATHLIMIT];
#ifndef WindowsStore
bool isUnicode = IsTextUnicode(pFile, static_cast<int>(strlen(pFile)), NULL) != 0;
if (isUnicode) {
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, pFile, -1, fileName16, PATHLIMIT);
struct __stat64 filestat;
if (0 != _wstat64(fileName16, &filestat)) {
return false;
}
} else {
#endif
FILE* file = ::fopen(pFile, "rb");
if (!file)
return false;
::fclose(file);
#ifndef WindowsStore
struct __stat64 filestat;
if (_wstat64(Utf8ToWide(pFile).c_str(), &filestat) != 0) {
return false;
}
#endif
#else
FILE* file = ::fopen( pFile, "rb");
if( !file)
FILE* file = ::fopen(pFile, "rb");
if (!file)
return false;
::fclose( file);
::fclose(file);
#endif
return true;
}
// ------------------------------------------------------------------------------------------------
// Open a new file with a given path.
IOStream* DefaultIOSystem::Open( const char* strFile, const char* strMode)
IOStream* DefaultIOSystem::Open(const char* strFile, const char* strMode)
{
ai_assert(NULL != strFile);
ai_assert(NULL != strMode);
ai_assert(strFile != nullptr);
ai_assert(strMode != nullptr);
FILE* file;
#ifdef _WIN32
wchar_t fileName16[PATHLIMIT];
#ifndef WindowsStore
bool isUnicode = IsTextUnicode(strFile, static_cast<int>(strlen(strFile)), NULL) != 0;
if (isUnicode) {
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, strFile, -1, fileName16, PATHLIMIT);
std::string mode8(strMode);
file = ::_wfopen(fileName16, std::wstring(mode8.begin(), mode8.end()).c_str());
} else {
#endif
file = ::fopen(strFile, strMode);
#ifndef WindowsStore
}
#endif
file = ::_wfopen(Utf8ToWide(strFile).c_str(), Utf8ToWide(strMode).c_str());
#else
file = ::fopen(strFile, strMode);
#endif
if (nullptr == file)
if (!file)
return nullptr;
return new DefaultIOStream(file, (std::string) strFile);
return new DefaultIOStream(file, strFile);
}
// ------------------------------------------------------------------------------------------------
// Closes the given file and releases all resources associated with it.
void DefaultIOSystem::Close( IOStream* pFile)
void DefaultIOSystem::Close(IOStream* pFile)
{
delete pFile;
}
@@ -155,78 +138,56 @@ char DefaultIOSystem::getOsSeparator() const
// ------------------------------------------------------------------------------------------------
// IOSystem default implementation (ComparePaths isn't a pure virtual function)
bool IOSystem::ComparePaths (const char* one, const char* second) const
bool IOSystem::ComparePaths(const char* one, const char* second) const
{
return !ASSIMP_stricmp(one,second);
return !ASSIMP_stricmp(one, second);
}
// ------------------------------------------------------------------------------------------------
// Convert a relative path into an absolute path
inline static void MakeAbsolutePath (const char* in, char* _out)
inline static std::string MakeAbsolutePath(const char* in)
{
ai_assert(in && _out);
#if defined( _MSC_VER ) || defined( __MINGW32__ )
#ifndef WindowsStore
bool isUnicode = IsTextUnicode(in, static_cast<int>(strlen(in)), NULL) != 0;
if (isUnicode) {
wchar_t out16[PATHLIMIT];
wchar_t in16[PATHLIMIT];
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, in, -1, out16, PATHLIMIT);
wchar_t* ret = ::_wfullpath(out16, in16, PATHLIMIT);
if (ret) {
WideCharToMultiByte(CP_UTF8, MB_PRECOMPOSED, out16, -1, _out, PATHLIMIT, nullptr, nullptr);
}
if (!ret) {
// preserve the input path, maybe someone else is able to fix
// the path before it is accessed (e.g. our file system filter)
ASSIMP_LOG_WARN_F("Invalid path: ", std::string(in));
strcpy(_out, in);
}
} else {
#endif
char* ret = :: _fullpath(_out, in, PATHLIMIT);
if (!ret) {
// preserve the input path, maybe someone else is able to fix
// the path before it is accessed (e.g. our file system filter)
ASSIMP_LOG_WARN_F("Invalid path: ", std::string(in));
strcpy(_out, in);
}
#ifndef WindowsStore
ai_assert(in);
std::string out;
#ifdef _WIN32
wchar_t* ret = ::_wfullpath(nullptr, Utf8ToWide(in).c_str(), 0);
if (ret) {
out = WideToUtf8(ret);
free(ret);
}
#else
char* ret = realpath(in, nullptr);
if (ret) {
out = ret;
free(ret);
}
#endif
#else
// use realpath
char* ret = realpath(in, _out);
if(!ret) {
if (!ret) {
// preserve the input path, maybe someone else is able to fix
// the path before it is accessed (e.g. our file system filter)
ASSIMP_LOG_WARN_F("Invalid path: ", std::string(in));
strcpy(_out,in);
out = in;
}
#endif
return out;
}
// ------------------------------------------------------------------------------------------------
// DefaultIOSystem's more specialized implementation
bool DefaultIOSystem::ComparePaths (const char* one, const char* second) const
bool DefaultIOSystem::ComparePaths(const char* one, const char* second) const
{
// chances are quite good both paths are formatted identically,
// so we can hopefully return here already
if( !ASSIMP_stricmp(one,second) )
if (!ASSIMP_stricmp(one, second))
return true;
char temp1[PATHLIMIT];
char temp2[PATHLIMIT];
std::string temp1 = MakeAbsolutePath(one);
std::string temp2 = MakeAbsolutePath(second);
MakeAbsolutePath (one, temp1);
MakeAbsolutePath (second, temp2);
return !ASSIMP_stricmp(temp1,temp2);
return !ASSIMP_stricmp(temp1, temp2);
}
// ------------------------------------------------------------------------------------------------
std::string DefaultIOSystem::fileName( const std::string &path )
std::string DefaultIOSystem::fileName(const std::string& path)
{
std::string ret = path;
std::size_t last = ret.find_last_of("\\/");
@@ -235,16 +196,16 @@ std::string DefaultIOSystem::fileName( const std::string &path )
}
// ------------------------------------------------------------------------------------------------
std::string DefaultIOSystem::completeBaseName( const std::string &path )
std::string DefaultIOSystem::completeBaseName(const std::string& path)
{
std::string ret = fileName(path);
std::size_t pos = ret.find_last_of('.');
if(pos != ret.npos) ret = ret.substr(0, pos);
if (pos != std::string::npos) ret = ret.substr(0, pos);
return ret;
}
// ------------------------------------------------------------------------------------------------
std::string DefaultIOSystem::absolutePath( const std::string &path )
std::string DefaultIOSystem::absolutePath(const std::string& path)
{
std::string ret = path;
std::size_t last = ret.find_last_of("\\/");
@@ -253,5 +214,3 @@ std::string DefaultIOSystem::absolutePath( const std::string &path )
}
// ------------------------------------------------------------------------------------------------
#undef PATHLIMIT

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