Compare commits
1739
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a14d6a48bd | ||
|
|
0be7cdd6db | ||
|
|
c6f997b584 | ||
|
|
3e2e3c9b12 | ||
|
|
34cda45471 | ||
|
|
a4b8943533 | ||
|
|
0996221017 | ||
|
|
672594c230 | ||
|
|
0978918f71 | ||
|
|
8e35cb1a9f | ||
|
|
ea249be466 | ||
|
|
276d3e998f | ||
|
|
b2d5fa201a | ||
|
|
95f09deaae | ||
|
|
e778c84cd6 | ||
|
|
5f7c06a71e | ||
|
|
7dcf6a8984 | ||
|
|
cc6ab1408f | ||
|
|
f544f9c217 | ||
|
|
194da5b2fd | ||
|
|
f28a96121d | ||
|
|
6401aa9744 | ||
|
|
1894bfb22c | ||
|
|
b8133b04c7 | ||
|
|
709fe3c3d0 | ||
|
|
489c8d565b | ||
|
|
0581ed5f11 | ||
|
|
5c568616ec | ||
|
|
45cb880835 | ||
|
|
dd98d4aea3 | ||
|
|
01ac320de8 | ||
|
|
a815a78433 | ||
|
|
69f8eb21fd | ||
|
|
72b9939b9f | ||
|
|
4c8a3bd39c | ||
|
|
8ef3838beb | ||
|
|
441884387f | ||
|
|
f7bbf6dc15 | ||
|
|
aadd49311a | ||
|
|
3f107bebf2 | ||
|
|
a38ec50fd3 | ||
|
|
4c42db1805 | ||
|
|
26e2372882 | ||
|
|
36b004e286 | ||
|
|
3a0ee8792f | ||
|
|
e3f9cf5564 | ||
|
|
6d7ea78792 | ||
|
|
13316790aa | ||
|
|
9255412906 | ||
|
|
8355e0c4bc | ||
|
|
6fa9d09a97 | ||
|
|
9f4e7c6d8d | ||
|
|
59bc03d931 | ||
|
|
edcb350129 | ||
|
|
a79dc358cf | ||
|
|
db0bde758e | ||
|
|
b447485c06 | ||
|
|
4c61ca3af5 | ||
|
|
4b6cc8c28a | ||
|
|
d99f9bd2f7 | ||
|
|
b2afe717d3 | ||
|
|
ad6e8e210a | ||
|
|
fb375dd8c0 | ||
|
|
a95addfc4a | ||
|
|
2d8c09b60f | ||
|
|
357b5baabb | ||
|
|
269987085f | ||
|
|
5be336779d | ||
|
|
177797c77b | ||
|
|
c1d6226c06 | ||
|
|
8621d52430 | ||
|
|
5d39661751 | ||
|
|
a98ffe6c6f | ||
|
|
b3a47a68fa | ||
|
|
c4515f53ca | ||
|
|
7eb6b0c3db | ||
|
|
7b38feb8a7 | ||
|
|
b97308683b | ||
|
|
4ad1d2aa30 | ||
|
|
4535ff9d6e | ||
|
|
18465fbb24 | ||
|
|
d2aed87f5e | ||
|
|
315075c4a6 | ||
|
|
4f3a759a05 | ||
|
|
3e8673b14d | ||
|
|
1933313ec8 | ||
|
|
696771d576 | ||
|
|
2c77d2555b | ||
|
|
ed89a02fff | ||
|
|
b40e41f9c3 | ||
|
|
9d9a80739d | ||
|
|
64073458bd | ||
|
|
b9bfac0418 | ||
|
|
536cd59807 | ||
|
|
327afe0183 | ||
|
|
2056679e98 | ||
|
|
af352d6f7c | ||
|
|
0dafa03ff8 | ||
|
|
d1b73dffec | ||
|
|
b0e0ce5a28 | ||
|
|
0c02313893 | ||
|
|
9182879e1f | ||
|
|
275eca9535 | ||
|
|
cb56793e16 | ||
|
|
ac5988422a | ||
|
|
4ee7b9d98d | ||
|
|
e68ea14f56 | ||
|
|
2f3e72413f | ||
|
|
0ae66d2703 | ||
|
|
e27204c27a | ||
|
|
55e6359436 | ||
|
|
b57f7d367c | ||
|
|
88959b2be7 | ||
|
|
79cba055b9 | ||
|
|
ac0b19a771 | ||
|
|
cbf279d522 | ||
|
|
d307c9f1d7 | ||
|
|
e2ee7d2c71 | ||
|
|
5a1cc9ec60 | ||
|
|
a93b9f8c80 | ||
|
|
2690e354da | ||
|
|
e8a6286542 | ||
|
|
2194944a25 | ||
|
|
4b8f55cc00 | ||
|
|
d2c6e64a11 | ||
|
|
bcf11c252a | ||
|
|
7f2c9d7b88 | ||
|
|
7c705fde41 | ||
|
|
c1eedbba8e | ||
|
|
f398a70163 | ||
|
|
70459b4d1f | ||
|
|
45898eee55 | ||
|
|
f52fcb6052 | ||
|
|
2bce77f909 | ||
|
|
5d716b8fe0 | ||
|
|
b58afb7b83 | ||
|
|
7945359a5c | ||
|
|
9bb6f2e1b8 | ||
|
|
7efb98db27 | ||
|
|
f967e76493 | ||
|
|
d41511bf8a | ||
|
|
53b5dba4df | ||
|
|
9f3cd51a87 | ||
|
|
bc47836a8f | ||
|
|
2aac984fa3 | ||
|
|
31f0dcb4d1 | ||
|
|
f13197921b | ||
|
|
d91e0e4f42 | ||
|
|
ba4455c9c0 | ||
|
|
79d451bf4b | ||
|
|
2a0969d4d9 | ||
|
|
1e44036c36 | ||
|
|
2f6dcdfd72 | ||
|
|
e722420907 | ||
|
|
8e44b40df4 | ||
|
|
5aa38fe3cd | ||
|
|
0834fed661 | ||
|
|
f2c6aa15ed | ||
|
|
5fa7b8ceb9 | ||
|
|
d386309af9 | ||
|
|
2f40a77ae1 | ||
|
|
a4d8a5fec3 | ||
|
|
bbeb515421 | ||
|
|
437b484070 | ||
|
|
d70606bfb6 | ||
|
|
69558d8889 | ||
|
|
5e091572d5 | ||
|
|
ab5b32ecc7 | ||
|
|
7bd54e3604 | ||
|
|
258cdfd2bc | ||
|
|
016be03c3d | ||
|
|
1ce3164bc2 | ||
|
|
9f3a7e95ab | ||
|
|
ecc8a1c869 | ||
|
|
2090508c34 | ||
|
|
2b773f0f5a | ||
|
|
7a114059cd | ||
|
|
862abe410b | ||
|
|
76d22e5fbe | ||
|
|
f12e521986 | ||
|
|
28ebc8452b | ||
|
|
46c26eda5a | ||
|
|
bddc374b5a | ||
|
|
164a5ae8cf | ||
|
|
ff61095928 | ||
|
|
ca17cdc1f9 | ||
|
|
739ebfd207 | ||
|
|
72c51a9997 | ||
|
|
2493deff37 | ||
|
|
12f3309996 | ||
|
|
02d3887e9a | ||
|
|
09f6a5e136 | ||
|
|
5f100a0984 | ||
|
|
795d4897db | ||
|
|
6fad13c82b | ||
|
|
48bd7c3e22 | ||
|
|
c867ddbc04 | ||
|
|
41cc2f66a4 | ||
|
|
f5fb8ff842 | ||
|
|
c9bbbcf633 | ||
|
|
e7a6d33365 | ||
|
|
9723b3554b | ||
|
|
f7bb1bc170 | ||
|
|
9694f7e8e4 | ||
|
|
6520354a58 | ||
|
|
e06b80f6b0 | ||
|
|
401279e2f9 | ||
|
|
7634cf84ca | ||
|
|
ec563823b6 | ||
|
|
287d7ec213 | ||
|
|
8d5cc3c5d5 | ||
|
|
e699d23559 | ||
|
|
53d4663f29 | ||
|
|
f6c62605c7 | ||
|
|
720eae1396 | ||
|
|
e4ef89182d | ||
|
|
fffce70fce | ||
|
|
a383cb1ff7 | ||
|
|
4b9ac76815 | ||
|
|
2591d0e490 | ||
|
|
ce0a50ec21 | ||
|
|
811bf2df15 | ||
|
|
cb4e663138 | ||
|
|
9934a8d1cc | ||
|
|
56ea25f9eb | ||
|
|
ecdf8d24b8 | ||
|
|
1d99895e91 | ||
|
|
97257a3bcc | ||
|
|
17399d198f | ||
|
|
f63625256c | ||
|
|
f4c7606faf | ||
|
|
66187a77cf | ||
|
|
5c7acc968b | ||
|
|
f81ea6986c | ||
|
|
ab12e8d8ba | ||
|
|
3bd98611d7 | ||
|
|
d468e633b1 | ||
|
|
4024726eca | ||
|
|
cd0ef869e3 | ||
|
|
ed3fccd5db | ||
|
|
ff2dc2fb2e | ||
|
|
f69e55058d | ||
|
|
c1ffbfec06 | ||
|
|
c35200e38e | ||
|
|
1e09642382 | ||
|
|
edaf87f186 | ||
|
|
88340d0ce0 | ||
|
|
5e912e68da | ||
|
|
ae0ff8a88a | ||
|
|
924106188e | ||
|
|
389bdedda7 | ||
|
|
f39f53e860 | ||
|
|
11daaf79a5 | ||
|
|
3e7e4c8c52 | ||
|
|
4338817ca2 | ||
|
|
fd7ad4a9d8 | ||
|
|
a7a424e0a7 | ||
|
|
f0ca4df704 | ||
|
|
d32370ff12 | ||
|
|
12ed0286e4 | ||
|
|
bb9db8409f | ||
|
|
d83904e3ee | ||
|
|
bc6710a116 | ||
|
|
10e97b2f4a | ||
|
|
d95a5c60ef | ||
|
|
12cdbb712c | ||
|
|
b992ff278b | ||
|
|
9485d49e93 | ||
|
|
f950f61a52 | ||
|
|
afe06f2298 | ||
|
|
d41b6b253d | ||
|
|
09b981d943 | ||
|
|
48c3a0ec46 | ||
|
|
a37d748c17 | ||
|
|
e63d3ed8e7 | ||
|
|
104a70f845 | ||
|
|
76de7cedf4 | ||
|
|
c55158cd82 | ||
|
|
571ba09dc7 | ||
|
|
db19f62a0c | ||
|
|
5d5e0bad3c | ||
|
|
9cf03b4ddc | ||
|
|
91e93578c7 | ||
|
|
da281b7f48 | ||
|
|
35e4f1bf64 | ||
|
|
0cb1693689 | ||
|
|
d3bec44990 | ||
|
|
b0aae04801 | ||
|
|
206839d4f2 | ||
|
|
193f2c5d87 | ||
|
|
bff00b15f1 | ||
|
|
d5cb1fe01f | ||
|
|
fe6e25080b | ||
|
|
ddb74c2bbd | ||
|
|
625528d02c | ||
|
|
7e053cc641 | ||
|
|
35976a4eb4 | ||
|
|
dd1474e280 | ||
|
|
0b19b7d73b | ||
|
|
d0703a5a3a | ||
|
|
cdf8394ccc | ||
|
|
dd10fb6ee4 | ||
|
|
adff2f388a | ||
|
|
0afd366dcb | ||
|
|
77f7706a97 | ||
|
|
5c2a33f230 | ||
|
|
0cef794abd | ||
|
|
07ab05cc41 | ||
|
|
a51500ba2b | ||
|
|
75091d4529 | ||
|
|
907da122e9 | ||
|
|
81858f9e62 | ||
|
|
97cbecb859 | ||
|
|
a722e33027 | ||
|
|
75a10fedd0 | ||
|
|
e963a863ce | ||
|
|
8231d99a85 | ||
|
|
0d546b3d2e | ||
|
|
43634b8b27 | ||
|
|
83d7216726 | ||
|
|
329fee2f0b | ||
|
|
4584719362 | ||
|
|
30466aaf16 | ||
|
|
ec5242a1a0 | ||
|
|
6fa4f0ff5e | ||
|
|
fd3f092d6e | ||
|
|
787c9afdf7 | ||
|
|
2521909b8c | ||
|
|
04afb63d34 | ||
|
|
942518a4ff | ||
|
|
10df90ec14 | ||
|
|
b6d53a0047 | ||
|
|
001bb01eb2 | ||
|
|
325b0a543f | ||
|
|
47dbabadcd | ||
|
|
c953739487 | ||
|
|
00b6db86ab | ||
|
|
4621676424 | ||
|
|
47ef79672e | ||
|
|
c05895f3c7 | ||
|
|
7bda0f88ca | ||
|
|
b71b8f77ee | ||
|
|
85f084a4ce | ||
|
|
08c1adc015 | ||
|
|
3ff7851ff9 | ||
|
|
64d88276ef | ||
|
|
b8aa68a080 | ||
|
|
8b9ed34eaa | ||
|
|
b41ffa5561 | ||
|
|
4a3e0e46ac | ||
|
|
1f920ee1fe | ||
|
|
778ce90a04 | ||
|
|
790aad4b62 | ||
|
|
52c2b6896a | ||
|
|
9d11b220eb | ||
|
|
39ce0c0456 | ||
|
|
feb861f17b | ||
|
|
730aa9d0b7 | ||
|
|
072320df4f | ||
|
|
fcb1444b84 | ||
|
|
727774f181 | ||
|
|
bb9101ae9e | ||
|
|
f95050e7aa | ||
|
|
01231d0e60 | ||
|
|
0664882763 | ||
|
|
4d6dd80257 | ||
|
|
94bc568d13 | ||
|
|
4b9f46dbda | ||
|
|
a3708e3464 | ||
|
|
ff5b0ae575 | ||
|
|
2d98f6a880 | ||
|
|
c877a15140 | ||
|
|
1164844ce4 | ||
|
|
a8c8e75a17 | ||
|
|
f59a5fab1a | ||
|
|
b7b6601a75 | ||
|
|
bc6673b4b2 | ||
|
|
005399a671 | ||
|
|
3990ec80a1 | ||
|
|
3476c79801 | ||
|
|
f956351942 | ||
|
|
c08e3b4abb | ||
|
|
d5f35582d4 | ||
|
|
a02085ea98 | ||
|
|
a8d30f7e91 | ||
|
|
c6fe03f7a5 | ||
|
|
8cde65bfe8 | ||
|
|
240fa97fed | ||
|
|
727001b0ca | ||
|
|
bdc08dd4a9 | ||
|
|
ac29847d56 | ||
|
|
81c20a5c61 | ||
|
|
74af43f655 | ||
|
|
9d71a275c3 | ||
|
|
c8ca1a48ec | ||
|
|
ea9aa863ff | ||
|
|
cb8150b3e8 | ||
|
|
b571501559 | ||
|
|
6a0e1d5467 | ||
|
|
9776d47cca | ||
|
|
ec122eb348 | ||
|
|
6bcdf989fb | ||
|
|
5cbdb6c63b | ||
|
|
636fbd65b3 | ||
|
|
263bebb5ba | ||
|
|
5d5496f1ad | ||
|
|
69dae9599a | ||
|
|
9dddef9b9d | ||
|
|
b9576e6992 | ||
|
|
274f64cbf1 | ||
|
|
7b54b0f406 | ||
|
|
df33d33e8f | ||
|
|
3ce8a58d41 | ||
|
|
d03ab3ef27 | ||
|
|
e86f1acb9b | ||
|
|
4034df8b6e | ||
|
|
88084a67fc | ||
|
|
762ad8e9b7 | ||
|
|
dc399f7343 | ||
|
|
a72289b327 | ||
|
|
213d73ebc6 | ||
|
|
a0b3df6dbd | ||
|
|
769e82ce5e | ||
|
|
d311fa95c6 | ||
|
|
e765862d24 | ||
|
|
f701d702e4 | ||
|
|
a63a6011c5 | ||
|
|
6f715edfa0 | ||
|
|
bfdd154d14 | ||
|
|
6f70e220e4 | ||
|
|
85f64c9131 | ||
|
|
01f2549abe | ||
|
|
384db8686e | ||
|
|
77a8f019e3 | ||
|
|
254619901b | ||
|
|
56e0ba58e1 | ||
|
|
e4e2c63e0c | ||
|
|
bfe8745b90 | ||
|
|
aae93691b9 | ||
|
|
6004290dde | ||
|
|
069e19487c | ||
|
|
2235518b3c | ||
|
|
8648c2af45 | ||
|
|
f0e7448fdc | ||
|
|
9efbbe0a69 | ||
|
|
4535e37fc6 | ||
|
|
8cf2d6e588 | ||
|
|
aa3abb3c06 | ||
|
|
0b0ec713f6 | ||
|
|
28ab0a094a | ||
|
|
46b19cc6a4 | ||
|
|
a521b23ab5 | ||
|
|
108e3192a2 | ||
|
|
f844c3397d | ||
|
|
a7cfa3264a | ||
|
|
c1deb808fa | ||
|
|
25aee03f66 | ||
|
|
c44e3427aa | ||
|
|
1169d3bc8c | ||
|
|
945c77d699 | ||
|
|
020554e213 | ||
|
|
2a347014f3 | ||
|
|
a531c72f7f | ||
|
|
666ecd3f1f | ||
|
|
5d60cf228a | ||
|
|
2f78d48d6b | ||
|
|
3c1423d5a5 | ||
|
|
1ee13872b1 | ||
|
|
01322ec831 | ||
|
|
8fcc65a8af | ||
|
|
5b8cfa920b | ||
|
|
d7cde43367 | ||
|
|
7b6bf139cf | ||
|
|
b2bfe6d253 | ||
|
|
7a4d8ec412 | ||
|
|
7a26433846 | ||
|
|
6a08c39e3a | ||
|
|
4b193dbee3 | ||
|
|
f9d3e7015b | ||
|
|
f1b8df01d5 | ||
|
|
c421247be9 | ||
|
|
cebb06280d | ||
|
|
967d61edc5 | ||
|
|
997d380c3a | ||
|
|
13945a5c5b | ||
|
|
e5e3e07b84 | ||
|
|
bad725ec86 | ||
|
|
fb23ef7c02 | ||
|
|
0c5138cb39 | ||
|
|
9d12dd6df3 | ||
|
|
7fb4b24cb5 | ||
|
|
fa71b84c1c | ||
|
|
59b1234496 | ||
|
|
f9f7ab0658 | ||
|
|
c7307ae84d | ||
|
|
c4d3c1dd67 | ||
|
|
2af4247260 | ||
|
|
aa1996e143 | ||
|
|
3cf7d28bc4 | ||
|
|
c3544f1f98 | ||
|
|
0ff0bd7a6e | ||
|
|
8d8a0a5af7 | ||
|
|
e673d1fd9e | ||
|
|
e41fe74b2a | ||
|
|
8c8f974ea3 | ||
|
|
f623870dd1 | ||
|
|
e79d105957 | ||
|
|
0afaf976b9 | ||
|
|
b52731c707 | ||
|
|
97227d7a4c | ||
|
|
cc2c5d3ae3 | ||
|
|
2f6f58707d | ||
|
|
b9ea538e6f | ||
|
|
215caa65aa | ||
|
|
80a03071ba | ||
|
|
fa69c47d45 | ||
|
|
fe6730f225 | ||
|
|
60b6d80936 | ||
|
|
c953c9b76f | ||
|
|
e50233b2c1 | ||
|
|
4389c3d80c | ||
|
|
d07934bf25 | ||
|
|
554fa8f5e2 | ||
|
|
2b4606c082 | ||
|
|
3a03fe31b1 | ||
|
|
32716002ac | ||
|
|
081cae6a95 | ||
|
|
7cbf4c4136 | ||
|
|
bc7ef58b49 | ||
|
|
72c10d856f | ||
|
|
5c45cdc0ad | ||
|
|
3a02de4d28 | ||
|
|
d77903423f | ||
|
|
0bfc588c39 | ||
|
|
2e60cb6ae6 | ||
|
|
556c89b5f1 | ||
|
|
e5d9339c21 | ||
|
|
461601e9ff | ||
|
|
1c5dc86afb | ||
|
|
d8a7399a04 | ||
|
|
df9c5cdb9f | ||
|
|
79dcc289d0 | ||
|
|
aa5b41446c | ||
|
|
20a2cc4c94 | ||
|
|
2baadf2fe5 | ||
|
|
b9460dd959 | ||
|
|
49ed0711d1 | ||
|
|
8312b31d27 | ||
|
|
bb1873dd22 | ||
|
|
f7e7f82b9d | ||
|
|
b5032db741 | ||
|
|
d6edfad8bb | ||
|
|
cf5ffdc366 | ||
|
|
d7dc88e0d0 | ||
|
|
60989a598e | ||
|
|
439b3369c1 | ||
|
|
dd40b0ccee | ||
|
|
3ec8a36764 | ||
|
|
131bc61d47 | ||
|
|
d05dbfa8c9 | ||
|
|
20cb815290 | ||
|
|
0ab7de70cd | ||
|
|
37a1366fb7 | ||
|
|
52e5c3f39e | ||
|
|
64e0ba2625 | ||
|
|
bf7ccb6206 | ||
|
|
a5a4090989 | ||
|
|
8c871ed4f0 | ||
|
|
46be2d3380 | ||
|
|
ca7f6de671 | ||
|
|
3161f0e754 | ||
|
|
5b7ff294b8 | ||
|
|
16021ef9ac | ||
|
|
0e7cd18c8b | ||
|
|
f66a7fd6bf | ||
|
|
1e6c7063b6 | ||
|
|
bf38d67935 | ||
|
|
cf7d363766 | ||
|
|
11f024b395 | ||
|
|
53846430ce | ||
|
|
c7afea3cd7 | ||
|
|
e2b19ef776 | ||
|
|
fe49a9ed94 | ||
|
|
87cac888e4 | ||
|
|
bdde968677 | ||
|
|
506baa21e6 | ||
|
|
0256047168 | ||
|
|
3423949490 | ||
|
|
e08cb0b5b8 | ||
|
|
668db327f4 | ||
|
|
8b005eaa83 | ||
|
|
6308de6e5b | ||
|
|
90ff723b6c | ||
|
|
9a94b26cdc | ||
|
|
ed903543a7 | ||
|
|
d3ee157342 | ||
|
|
a5bb4b59e4 | ||
|
|
093e35dd54 | ||
|
|
edb8375702 | ||
|
|
0dcfe2f72c | ||
|
|
d1ad4e54d7 | ||
|
|
5770faac10 | ||
|
|
f1561f03ce | ||
|
|
57306bcd63 | ||
|
|
96eb87265e | ||
|
|
0bacc7134d | ||
|
|
19da9cc84d | ||
|
|
3e1fd74940 | ||
|
|
7d542eb795 | ||
|
|
537b445a59 | ||
|
|
6f3bfb5b60 | ||
|
|
3838a8aaf8 | ||
|
|
e4cac7d00b | ||
|
|
8a65dcc19e | ||
|
|
3e74453b69 | ||
|
|
42386b829c | ||
|
|
b44dfd5ecf | ||
|
|
b61fc49c30 | ||
|
|
82d3f47432 | ||
|
|
b2cad5c58d | ||
|
|
d1edaa949b | ||
|
|
ac2cf2f71b | ||
|
|
59f2620164 | ||
|
|
261c7769b8 | ||
|
|
2875de132f | ||
|
|
17fac97b04 | ||
|
|
1c0f3c5f87 | ||
|
|
a2bdfdd05a | ||
|
|
03934128fc | ||
|
|
7ae88225b3 | ||
|
|
5a568d485c | ||
|
|
507a3d2f8d | ||
|
|
876b1a0d6e | ||
|
|
c9111fe89a | ||
|
|
e7a0985886 | ||
|
|
f55eebad06 | ||
|
|
8f61427880 | ||
|
|
1ec3dbd11a | ||
|
|
1791eac7ff | ||
|
|
3da92e05eb | ||
|
|
f24224fdc5 | ||
|
|
d2411a7ecd | ||
|
|
5d3f3281f4 | ||
|
|
db6c1a8b1c | ||
|
|
8937248f7c | ||
|
|
ef6bf03acd | ||
|
|
27c4de3419 | ||
|
|
141e278e1f | ||
|
|
41e2b0f5dc | ||
|
|
1830a8aad2 | ||
|
|
47575f759f | ||
|
|
ff36ea7e23 | ||
|
|
bce2fdbbe9 | ||
|
|
b1181b1086 | ||
|
|
96d0c0769e | ||
|
|
7005a9caa2 | ||
|
|
ed0dff2a7e | ||
|
|
6b1a2e91d5 | ||
|
|
4a658202ca | ||
|
|
438f9fe568 | ||
|
|
1477f696e0 | ||
|
|
3545aab937 | ||
|
|
46ea0a7d7c | ||
|
|
26c4505c53 | ||
|
|
a4258929ce | ||
|
|
86c332fec7 | ||
|
|
8a3ec3ca2f | ||
|
|
ce59d49dd9 | ||
|
|
8741da2036 | ||
|
|
bd65af0d44 | ||
|
|
b94392d199 | ||
|
|
63e1b071df | ||
|
|
6502b97d3e | ||
|
|
3d19cd9362 | ||
|
|
9c9d72169f | ||
|
|
7f0c388ad8 | ||
|
|
10059e6431 | ||
|
|
22c8d97b54 | ||
|
|
aab3c8010c | ||
|
|
9c54540a19 | ||
|
|
693d681813 | ||
|
|
3939d35f18 | ||
|
|
36dfa3bed3 | ||
|
|
b158b716d1 | ||
|
|
9ef71fe231 | ||
|
|
5bb1c6debd | ||
|
|
b3a1c72c8f | ||
|
|
646d3591b6 | ||
|
|
496a4bf156 | ||
|
|
8012657169 | ||
|
|
dbd15fd351 | ||
|
|
86aecf395e | ||
|
|
c6c95b69f6 | ||
|
|
54b0c00418 | ||
|
|
f897b0c461 | ||
|
|
4180b1fd08 | ||
|
|
3ccf242bdb | ||
|
|
feb0303fd0 | ||
|
|
bef66deeda | ||
|
|
1ab4161cd7 | ||
|
|
186d7fd606 | ||
|
|
9950bb4ed6 | ||
|
|
11dede8fc4 | ||
|
|
d5844f26b5 | ||
|
|
839bed3274 | ||
|
|
4c16a6a16b | ||
|
|
49a6eec294 | ||
|
|
cb86029153 | ||
|
|
d9268dcf96 | ||
|
|
02d5ab294c | ||
|
|
f5683b6f3a | ||
|
|
05ab5c2e3b | ||
|
|
513e62e1c9 | ||
|
|
23f9990b22 | ||
|
|
915e146307 | ||
|
|
5cc4a61d66 | ||
|
|
6c5fe9d76f | ||
|
|
57a55aa4d4 | ||
|
|
f4d3b6e862 | ||
|
|
62cefd5b27 | ||
|
|
d3506c24e7 | ||
|
|
e30823fb1d | ||
|
|
b6c0fdd6e0 | ||
|
|
d9a8837a5b | ||
|
|
628dde4a91 | ||
|
|
c22ddfda2b | ||
|
|
1538669f70 | ||
|
|
4cc70cb73c | ||
|
|
54f5d01190 | ||
|
|
c3e69b5b82 | ||
|
|
462755e5ba | ||
|
|
1f5c7da822 | ||
|
|
bee751b5f9 | ||
|
|
466f6960ac | ||
|
|
17c1a9125f | ||
|
|
0b53243b8f | ||
|
|
f43cfa1fba | ||
|
|
0f4667fce4 | ||
|
|
ca848c5b09 | ||
|
|
0794b41d55 | ||
|
|
d73595b85d | ||
|
|
e4621a3142 | ||
|
|
0fbd2f5894 | ||
|
|
9f593d70b5 | ||
|
|
b7a8c4ba75 | ||
|
|
3a09fd0c85 | ||
|
|
e947471549 | ||
|
|
0e06a5f945 | ||
|
|
03163a1dda | ||
|
|
7e16d4046e | ||
|
|
0dfd491d97 | ||
|
|
9c45f727e3 | ||
|
|
18b6cffe14 | ||
|
|
94905d445f | ||
|
|
71a4977dd1 | ||
|
|
8ad4bb0b2c | ||
|
|
b5b6400320 | ||
|
|
aed43878ef | ||
|
|
ad399adf4b | ||
|
|
121f09b62a | ||
|
|
0c4d5909f8 | ||
|
|
e627f691a8 | ||
|
|
f3e5a4835d | ||
|
|
478ce8af5a | ||
|
|
9d6b32f5c5 | ||
|
|
41102eeda6 | ||
|
|
9ea37b5330 | ||
|
|
ade4514752 | ||
|
|
d825eb7cf0 | ||
|
|
69145c8929 | ||
|
|
cb22d531a6 | ||
|
|
8cbfb44e9c | ||
|
|
1243325f10 | ||
|
|
75d024c91b | ||
|
|
167d811ff7 | ||
|
|
d58201a579 | ||
|
|
fbf8799cb5 | ||
|
|
55cb19f924 | ||
|
|
f32c21e6b3 | ||
|
|
b8877798ed | ||
|
|
c50b87fa6c | ||
|
|
92aa22e902 | ||
|
|
a923d1f89b | ||
|
|
92d426de2b | ||
|
|
51494e1b4f | ||
|
|
cdefc9f7aa | ||
|
|
cabf3a5d17 | ||
|
|
a8e7c23605 | ||
|
|
5c5b0f97b7 | ||
|
|
71043ec164 | ||
|
|
cea40f293a | ||
|
|
230bee2e34 | ||
|
|
6442158676 | ||
|
|
cf89990569 | ||
|
|
9c2594a1dc | ||
|
|
07aae9eaee | ||
|
|
4dc341955a | ||
|
|
71366fff8e | ||
|
|
ee6e05bb86 | ||
|
|
965ebaf78b | ||
|
|
97addc7cdc | ||
|
|
1ecb8e9196 | ||
|
|
cd9de860ce | ||
|
|
87a288ebd3 | ||
|
|
ff17f1fe3d | ||
|
|
46677b835c | ||
|
|
1244e58274 | ||
|
|
5738b3d172 | ||
|
|
739cf15a1e | ||
|
|
c0947b704e | ||
|
|
1b826afeda | ||
|
|
4d962057e5 | ||
|
|
12bc34a45c | ||
|
|
0a05a1f17f | ||
|
|
cec41f6dd5 | ||
|
|
7620a69e3e | ||
|
|
9e80dfc42d | ||
|
|
01488046e6 | ||
|
|
b1afa41047 | ||
|
|
1517983ab5 | ||
|
|
45946ec01b | ||
|
|
fd59a2209b | ||
|
|
9e056218cf | ||
|
|
d51f033e20 | ||
|
|
074af85734 | ||
|
|
133f730c11 | ||
|
|
0023f9b09a | ||
|
|
ca937788ee | ||
|
|
333f7d5ee0 | ||
|
|
aee4df9be8 | ||
|
|
5d841ec9a5 | ||
|
|
13c9db2310 | ||
|
|
8bc64ec147 | ||
|
|
8cf74c7663 | ||
|
|
7e8aabcbb4 | ||
|
|
e193220ad8 | ||
|
|
3dd08cdd60 | ||
|
|
74509ef8bd | ||
|
|
d4c21ba9a8 | ||
|
|
116ceeca31 | ||
|
|
a7cb3b4dbb | ||
|
|
55c6eaee0c | ||
|
|
502bceb6e8 | ||
|
|
a87585668d | ||
|
|
5b2f78ac20 | ||
|
|
23a3e8cf2d | ||
|
|
679eb972e6 | ||
|
|
89ccc89298 | ||
|
|
8705940801 | ||
|
|
1733d9f795 | ||
|
|
17d8e991cc | ||
|
|
17bdd5f9b5 | ||
|
|
414091ab11 | ||
|
|
e6f26fc52e | ||
|
|
ccbcf15a21 | ||
|
|
4e34e77226 | ||
|
|
f68f1f6bf2 | ||
|
|
9d76493ad8 | ||
|
|
a259277498 | ||
|
|
f2efcd77bc | ||
|
|
9915e875bf | ||
|
|
8aa959fa19 | ||
|
|
ca79916048 | ||
|
|
d6885d4025 | ||
|
|
19ff57a6c3 | ||
|
|
df21b6799f | ||
|
|
ae121bfbb0 | ||
|
|
70aceb203a | ||
|
|
97e31a895e | ||
|
|
9fba0ee31b | ||
|
|
acdb6684ba | ||
|
|
9c5ab67b64 | ||
|
|
dacaebc078 | ||
|
|
bddb4559a1 | ||
|
|
7df4efea44 | ||
|
|
e36812a449 | ||
|
|
87c309566f | ||
|
|
6d668382ec | ||
|
|
e1678f11e6 | ||
|
|
20b2f857c5 | ||
|
|
4d2512dcae | ||
|
|
04066ece8e | ||
|
|
1dcb5da1cd | ||
|
|
94067994cc | ||
|
|
6b54761310 | ||
|
|
5cf9d3abf7 | ||
|
|
7c64b6c599 | ||
|
|
203e1468df | ||
|
|
9c17c8c39a | ||
|
|
d032c3162a | ||
|
|
6d65e9c393 | ||
|
|
85b470a3ee | ||
|
|
6fa2f86d6b | ||
|
|
4daf8c36bc | ||
|
|
4438b3ecc9 | ||
|
|
5d6ca9808d | ||
|
|
55fa3d4251 | ||
|
|
3801d7e78f | ||
|
|
f4e9930e50 | ||
|
|
8ac0af5c58 | ||
|
|
b6ecba9114 | ||
|
|
83053f3d56 | ||
|
|
fa00571049 | ||
|
|
d8201bdb6f | ||
|
|
c9177b7811 | ||
|
|
6832aa227a | ||
|
|
bed2cf1a23 | ||
|
|
e8d4a11af5 | ||
|
|
0e657b575b | ||
|
|
e02a1ff577 | ||
|
|
e6c63cbee2 | ||
|
|
03aee802b2 | ||
|
|
7095c4f52f | ||
|
|
fc1a88deb4 | ||
|
|
f43281e89b | ||
|
|
7437f20d0a | ||
|
|
c32f4b71b7 | ||
|
|
5ddd18d1c7 | ||
|
|
7cc0c06fdb | ||
|
|
9552769f82 | ||
|
|
c546a4a73a | ||
|
|
4e645a0412 | ||
|
|
cf3c9d515a | ||
|
|
d8e2fc30a0 | ||
|
|
d902c2293d | ||
|
|
6360c90ac0 | ||
|
|
f81bb90f89 | ||
|
|
65440f17a1 | ||
|
|
ea3cc37890 | ||
|
|
48d89622ee | ||
|
|
cdfdd75a66 | ||
|
|
6da160f14d | ||
|
|
e7e4e3100f | ||
|
|
3a69e353f3 | ||
|
|
92409a821d | ||
|
|
e2063b3ba6 | ||
|
|
95616cf5b5 | ||
|
|
e394bda707 | ||
|
|
5a4f7c0a37 | ||
|
|
435181f5f5 | ||
|
|
88f3b950c7 | ||
|
|
16f9ba4935 | ||
|
|
b5f68d73ab | ||
|
|
da1ec4de91 | ||
|
|
7e5a178637 | ||
|
|
c537bd78d0 | ||
|
|
59d9711928 | ||
|
|
45c1da26b3 | ||
|
|
31ae9cde1c | ||
|
|
1147f0c8bd | ||
|
|
2acfc125c3 | ||
|
|
eb3b48e523 | ||
|
|
25ab05eb49 | ||
|
|
4c015077b8 | ||
|
|
054dacd068 | ||
|
|
7bc4c12956 | ||
|
|
d500f60490 | ||
|
|
3c2a425869 | ||
|
|
4b4cb55f22 | ||
|
|
fdcc45d010 | ||
|
|
3840c8bd8d | ||
|
|
8176c6a0e4 | ||
|
|
6e1959f061 | ||
|
|
c9539f67e3 | ||
|
|
60cefdd549 | ||
|
|
e308474163 | ||
|
|
ffd222334f | ||
|
|
2f7882cb8d | ||
|
|
63dae0a7f2 | ||
|
|
c82a6d05b0 | ||
|
|
dfd70b5c10 | ||
|
|
0ed957f70a | ||
|
|
348e672567 | ||
|
|
f3767a4eb2 | ||
|
|
b534584198 | ||
|
|
980e156251 | ||
|
|
366243f7ef | ||
|
|
05249353d4 | ||
|
|
8476a2c832 | ||
|
|
8c9580cfd3 | ||
|
|
8fb83af079 | ||
|
|
3a73ce37e4 | ||
|
|
4f48348af8 | ||
|
|
069b3ecdf8 | ||
|
|
44c2785663 | ||
|
|
5082c940d0 | ||
|
|
8171e041fa | ||
|
|
c089f11768 | ||
|
|
c305b50f13 | ||
|
|
dcb89cf107 | ||
|
|
2efd48dee2 | ||
|
|
4fa433c8ff | ||
|
|
1520aff680 | ||
|
|
74c406dd26 | ||
|
|
424f53b4d6 | ||
|
|
011382424b | ||
|
|
7916f87404 | ||
|
|
a0c29202be | ||
|
|
02a4276924 | ||
|
|
6ed433d011 | ||
|
|
b82c193dfd | ||
|
|
1092f0d94e | ||
|
|
09dd0d0c2e | ||
|
|
f7f54036f2 | ||
|
|
39efe4c832 | ||
|
|
534ee288c5 | ||
|
|
60da5e7e96 | ||
|
|
7f2760fe2f | ||
|
|
a1aace74e5 | ||
|
|
f9fcf33aaa | ||
|
|
94d9773548 | ||
|
|
90333340d6 | ||
|
|
437958ef91 | ||
|
|
e8f0eb930d | ||
|
|
3bdc43a216 | ||
|
|
657c1d8ad0 | ||
|
|
3bdfecb0ed | ||
|
|
be28f0949b | ||
|
|
53c6cc0966 | ||
|
|
92f7c50c91 | ||
|
|
28d4e394c0 | ||
|
|
bb5a6abae0 | ||
|
|
46ae8534f7 | ||
|
|
eb73464055 | ||
|
|
a14696b9ec | ||
|
|
2c3d52a5a1 | ||
|
|
408c41d687 | ||
|
|
c8d50dc83f | ||
|
|
27225fadc1 | ||
|
|
4d6b7ff8b4 | ||
|
|
277e19106a | ||
|
|
009cd6c64a | ||
|
|
6aac7a2458 | ||
|
|
2d448616d0 | ||
|
|
7de21694e9 | ||
|
|
65b0553b8d | ||
|
|
fa4273ee1f | ||
|
|
f8132bf17c | ||
|
|
ad2f0682e7 | ||
|
|
1f0bcdf54c | ||
|
|
c8a0119e45 | ||
|
|
3ad67771fe | ||
|
|
53e5f19b14 | ||
|
|
e4386d3013 | ||
|
|
2cd3da4831 | ||
|
|
3585dd577d | ||
|
|
7877dab43a | ||
|
|
bc8a122d88 | ||
|
|
4950d02bac | ||
|
|
9898138516 | ||
|
|
4c723a4ec8 | ||
|
|
bfa19f6900 | ||
|
|
779912e84e | ||
|
|
bb9b583bcf | ||
|
|
156a393b84 | ||
|
|
bde9a6a3c3 | ||
|
|
7b3f70a08b | ||
|
|
2390822baf | ||
|
|
4cf1ee98f6 | ||
|
|
b7d08fc8f2 | ||
|
|
b170370e5c | ||
|
|
57fc7144a7 | ||
|
|
fb146b7d39 | ||
|
|
dd6bcecf56 | ||
|
|
0c05682baf | ||
|
|
647f1e47fa | ||
|
|
487c03f547 | ||
|
|
839cd35a54 | ||
|
|
e6877cf20f | ||
|
|
e9c95d484e | ||
|
|
db72c6ee38 | ||
|
|
88ef9eecc1 | ||
|
|
8c6b3fe69a | ||
|
|
9453342491 | ||
|
|
8d405d60d9 | ||
|
|
dbd0ae8f22 | ||
|
|
14b80f1ac4 | ||
|
|
ea7321aae2 | ||
|
|
a2273df48e | ||
|
|
213b536282 | ||
|
|
6999caa683 | ||
|
|
feb3e9ff7a | ||
|
|
ce2f947eb1 | ||
|
|
b55e29b915 | ||
|
|
5caae1a86d | ||
|
|
e4c85645c6 | ||
|
|
47303c2d28 | ||
|
|
5c286b8c13 | ||
|
|
d2d8b84f83 | ||
|
|
d6b8d61066 | ||
|
|
527d110917 | ||
|
|
df28e7830f | ||
|
|
77e34eedc0 | ||
|
|
eff13f6a40 | ||
|
|
ffbeb2db18 | ||
|
|
37903f8ed2 | ||
|
|
6dc12f57a2 | ||
|
|
3e7121e1cc | ||
|
|
57054415cf | ||
|
|
8463242449 | ||
|
|
4d733d80f1 | ||
|
|
b31c04e37c | ||
|
|
4d5e47a870 | ||
|
|
f830d7998e | ||
|
|
a7c4399c26 | ||
|
|
cb8320945d | ||
|
|
036f2b3771 | ||
|
|
a9ce8a967d | ||
|
|
3e20502e0f | ||
|
|
ff9b6c8d79 | ||
|
|
3bd2f788f6 | ||
|
|
5ed09b7ab6 | ||
|
|
72b178b9fc | ||
|
|
cff81568f3 | ||
|
|
f2f967b8ba | ||
|
|
c48507beea | ||
|
|
f8bc8293ce | ||
|
|
303c30668f | ||
|
|
bf57eef8f2 | ||
|
|
7ad36b8925 | ||
|
|
43d336311e | ||
|
|
5ed01bcfa3 | ||
|
|
9e1de3ec6e | ||
|
|
288d49b721 | ||
|
|
81cf1369db | ||
|
|
ab0a119626 | ||
|
|
8d1256f472 | ||
|
|
d331a7e5d4 | ||
|
|
eb5d3c51e8 | ||
|
|
72f360710a | ||
|
|
20acfeaf97 | ||
|
|
67eae8ee5a | ||
|
|
b298b79a46 | ||
|
|
7f6e96747b | ||
|
|
d640a89035 | ||
|
|
a89d5c7cea | ||
|
|
e9f95e5ab6 | ||
|
|
6a8f169103 | ||
|
|
19dec716d3 | ||
|
|
36305cf987 | ||
|
|
43a062a5d7 | ||
|
|
39cbef1e21 | ||
|
|
3d3e856925 | ||
|
|
793284a766 | ||
|
|
5cbc00a595 | ||
|
|
bad76fd0f1 | ||
|
|
e5c02e8d45 | ||
|
|
43c0f8bb3d | ||
|
|
70edec0efb | ||
|
|
2d37f49f51 | ||
|
|
eb328ce69d | ||
|
|
b2672c082d | ||
|
|
74af523b3e | ||
|
|
33c32b6b35 | ||
|
|
b393132b58 | ||
|
|
9ace81a3d2 | ||
|
|
f6457e1c87 | ||
|
|
fa7d3aa0c0 | ||
|
|
2af29f4836 | ||
|
|
96b071bdb1 | ||
|
|
767644cd3f | ||
|
|
df8a9bb2b8 | ||
|
|
35162c19b2 | ||
|
|
8c57382b20 | ||
|
|
465566a87e | ||
|
|
e893248e7c | ||
|
|
05279f8bbd | ||
|
|
25f0146f44 | ||
|
|
7eadcebc9f | ||
|
|
ef5dd8c451 | ||
|
|
a8e50be781 | ||
|
|
883667c61a | ||
|
|
89b5011759 | ||
|
|
022c385571 | ||
|
|
76de8ba1f4 | ||
|
|
6743274b31 | ||
|
|
1e2cff6383 | ||
|
|
376f66a06d | ||
|
|
5c763f471c | ||
|
|
c3d15a3f51 | ||
|
|
c92b84e38d | ||
|
|
7c6e33fef1 | ||
|
|
db8ff41679 | ||
|
|
2612950b7b | ||
|
|
ee02c389ca | ||
|
|
917352dd8b | ||
|
|
90769ef3e6 | ||
|
|
d5294be00b | ||
|
|
2d372b302f | ||
|
|
0fdae2879d | ||
|
|
fec39154ed | ||
|
|
b2b85bf971 | ||
|
|
769b47ed0e | ||
|
|
3f66b92797 | ||
|
|
65bedac389 | ||
|
|
9d57ac9cc5 | ||
|
|
81f85a6f93 | ||
|
|
9c839f2d9a | ||
|
|
07d4e83f43 | ||
|
|
28c155bfb4 | ||
|
|
f8bb7704ad | ||
|
|
62486c6e7c | ||
|
|
d8b9e2b64b | ||
|
|
b0987f4513 | ||
|
|
f578b15759 | ||
|
|
497e286cfa | ||
|
|
7d06d798af | ||
|
|
54068637ee | ||
|
|
8fb7ba3444 | ||
|
|
6f6f77232e | ||
|
|
22cff318dc | ||
|
|
f3f533c390 | ||
|
|
b6adb9f2dd | ||
|
|
8f0e2db974 | ||
|
|
10b99dc4ca | ||
|
|
1476d50c7d | ||
|
|
ab82428bb5 | ||
|
|
88041152ac | ||
|
|
5689ac7869 | ||
|
|
355ebbedf3 | ||
|
|
371d5c78f4 | ||
|
|
b3daec65a0 | ||
|
|
80449dd014 | ||
|
|
1d1cd93371 | ||
|
|
5441f07d05 | ||
|
|
6392dbfe4d | ||
|
|
1cd5841b2f | ||
|
|
3b5e34ab30 | ||
|
|
863637a27e | ||
|
|
08f2f0f82f | ||
|
|
11fe77c446 | ||
|
|
3c51eafaf4 | ||
|
|
b8b515cbed | ||
|
|
b2cfe47d4e | ||
|
|
7f35bfb9e3 | ||
|
|
97d7f685ba | ||
|
|
49b3649264 | ||
|
|
bea3924fce | ||
|
|
ffaf378ee6 | ||
|
|
ce7a52fd19 | ||
|
|
822b240694 | ||
|
|
95d98ec98b | ||
|
|
49bc22ddb5 | ||
|
|
3730b7414f | ||
|
|
d635bc6914 | ||
|
|
ccfb175460 | ||
|
|
cfed74516b | ||
|
|
b717b1cd3e | ||
|
|
97cb1c6b15 | ||
|
|
5a0df03d2b | ||
|
|
945d93b46a | ||
|
|
852ea8325c | ||
|
|
899f8e1d17 | ||
|
|
02378b5e70 | ||
|
|
8da3d277c7 | ||
|
|
9a5d628232 | ||
|
|
99e515fbfd | ||
|
|
c2967cf79a | ||
|
|
ac87b9ce7e | ||
|
|
f8f12c8609 | ||
|
|
35136bc90c | ||
|
|
57c156019f | ||
|
|
07aef23d24 | ||
|
|
a77dcffb19 | ||
|
|
a3c209f2ca | ||
|
|
e7cea5a283 | ||
|
|
0bef3a2e0b | ||
|
|
565539bb68 | ||
|
|
fad49e0d12 | ||
|
|
4ac3b1fef5 | ||
|
|
e2f54d3c48 | ||
|
|
e17976e6e2 | ||
|
|
3705336467 | ||
|
|
5a89d6fee1 | ||
|
|
2e6c2315a2 | ||
|
|
002d50a54d | ||
|
|
29032b176b | ||
|
|
e0fb1674d1 | ||
|
|
38ccb7e6c9 | ||
|
|
5f28370f7f | ||
|
|
b70277e1ab | ||
|
|
e2e45f7a14 | ||
|
|
981677d4b9 | ||
|
|
4b65d65af3 | ||
|
|
0be5c567c9 | ||
|
|
232d809ecc | ||
|
|
816b8e6156 | ||
|
|
789168ba31 | ||
|
|
ca11fceb65 | ||
|
|
92c7419a28 | ||
|
|
e477533a6d | ||
|
|
f6a590065c | ||
|
|
22494bde17 | ||
|
|
9510132f3d | ||
|
|
9a11cabb06 | ||
|
|
18cbe89a4c | ||
|
|
7eb9edf0b9 | ||
|
|
65b14ef79d | ||
|
|
6415c0bfc9 | ||
|
|
1f61f0c3de | ||
|
|
f1766c4bd5 | ||
|
|
79c9c82026 | ||
|
|
f39606589e | ||
|
|
a165dbc6ff | ||
|
|
295b0f4dbf | ||
|
|
c976ceec90 | ||
|
|
be2eaac5a7 | ||
|
|
9d797c1489 | ||
|
|
8d9a0f777d | ||
|
|
704a187c90 | ||
|
|
34eaf2d092 | ||
|
|
f59dd695c8 | ||
|
|
128922a798 | ||
|
|
2324e1ea51 | ||
|
|
09fe87b6d4 | ||
|
|
b3c7bdbdd6 | ||
|
|
8ce6f5ad27 | ||
|
|
1944c45944 | ||
|
|
93e356b47d | ||
|
|
ff0c50236b | ||
|
|
c67ff12b06 | ||
|
|
4804101f1d | ||
|
|
7ebe21958d | ||
|
|
e4c77aa4fa | ||
|
|
9fab0af16a | ||
|
|
0dd5cfe3bf | ||
|
|
7be7e5d93e | ||
|
|
b2ea018fd5 | ||
|
|
20755f4200 | ||
|
|
7b874983d0 | ||
|
|
9519a62dd2 | ||
|
|
6a1a7c43cc | ||
|
|
ad1d0fcb45 | ||
|
|
3af53a42aa | ||
|
|
fff977c0b5 | ||
|
|
d475c132bf | ||
|
|
4c9d270a5e | ||
|
|
7872297ab7 | ||
|
|
396e7bcdb4 | ||
|
|
7116f46672 | ||
|
|
8895ecf243 | ||
|
|
362ff08855 | ||
|
|
edaf7fb7eb | ||
|
|
af0b29f30d | ||
|
|
57f4163c67 | ||
|
|
4b0e38e44f | ||
|
|
d15b4ad7ef | ||
|
|
fd6c534efc | ||
|
|
2a667cc637 | ||
|
|
de83245f42 | ||
|
|
411171fa45 | ||
|
|
e3b01e10db | ||
|
|
4c6652f5b0 | ||
|
|
a22aa75bca | ||
|
|
f527e56f22 | ||
|
|
80ae9afe4e | ||
|
|
2c3538fc46 | ||
|
|
fbb69df8be | ||
|
|
25d7510b8c | ||
|
|
6539b8685f | ||
|
|
e34becff62 | ||
|
|
8352f0478a | ||
|
|
0571ee21fb | ||
|
|
02e6c425f9 | ||
|
|
e4c383324a | ||
|
|
14186bcd6b | ||
|
|
9cd723e282 | ||
|
|
e93fa6699a | ||
|
|
6fa21dcc6e | ||
|
|
46e571e497 | ||
|
|
2b30b7e062 | ||
|
|
066f3f5f14 | ||
|
|
659195d852 | ||
|
|
0d8723a3eb | ||
|
|
654ae3af4e | ||
|
|
88c69d4edc | ||
|
|
25add7baa2 | ||
|
|
87f601531c | ||
|
|
aa521569f7 | ||
|
|
b176061c41 | ||
|
|
27edb43600 | ||
|
|
f890bc791f | ||
|
|
68bc6a06b9 | ||
|
|
03397d42e2 | ||
|
|
795c0abcc8 | ||
|
|
1ca44acebc | ||
|
|
712671e81a | ||
|
|
5f28c51c03 | ||
|
|
04997ccbf3 | ||
|
|
2013ae114a | ||
|
|
94c3ec57af | ||
|
|
4c143eb581 | ||
|
|
1c59de42fc | ||
|
|
d2dc0401c3 | ||
|
|
30555282fe | ||
|
|
219dbbd4af | ||
|
|
56b6446913 | ||
|
|
90d1464405 | ||
|
|
2e64880abf | ||
|
|
e43e3e11b9 | ||
|
|
2c1943cd10 | ||
|
|
a0f375162d | ||
|
|
89c4640744 | ||
|
|
d469c7b161 | ||
|
|
0dabe020a9 | ||
|
|
c9fc957535 | ||
|
|
bd64cc88df | ||
|
|
baf14f6c16 | ||
|
|
0e4ba1fdd1 | ||
|
|
888468e8f7 | ||
|
|
76daadb95d | ||
|
|
4b85eb59c2 | ||
|
|
253f8bfa62 | ||
|
|
17c6491c91 | ||
|
|
e419d6898c | ||
|
|
4aaa807704 | ||
|
|
b3b064eb69 | ||
|
|
ec131d0345 | ||
|
|
1b0682297d | ||
|
|
5084a4d155 | ||
|
|
0422dff537 | ||
|
|
2c4f51e863 | ||
|
|
9e0261ea7a | ||
|
|
abfe8ad413 | ||
|
|
f20071d740 | ||
|
|
da58fbe8fb | ||
|
|
cb4d0ab7aa | ||
|
|
233198baef | ||
|
|
99c3104588 | ||
|
|
8c63ed0455 | ||
|
|
0ada8b3b5e | ||
|
|
dabaa7bdae | ||
|
|
eac0876c9b | ||
|
|
dddfb74902 | ||
|
|
c349035cd1 | ||
|
|
85f86ec076 | ||
|
|
0513eff44f | ||
|
|
f6bcb160d0 | ||
|
|
75e678a0c5 | ||
|
|
fb653e8381 | ||
|
|
46aa7a548c | ||
|
|
340d800739 | ||
|
|
8abacebad7 | ||
|
|
173fad738f | ||
|
|
cb43690aad | ||
|
|
4f6640278a | ||
|
|
53a4b43ec1 | ||
|
|
b0210cb3cf | ||
|
|
2b804c638f | ||
|
|
7c75a4c59b | ||
|
|
3c253ca3e5 | ||
|
|
73542f3830 | ||
|
|
9bd2b4da50 | ||
|
|
bdee65e577 | ||
|
|
517fd3c76c | ||
|
|
5a2b811ba3 | ||
|
|
417481d17f | ||
|
|
f07bc2c5b9 | ||
|
|
749fe898b1 | ||
|
|
05ececc387 | ||
|
|
316f6e841c | ||
|
|
9ddc3a64d7 | ||
|
|
772cfdc757 | ||
|
|
94c0e9d890 | ||
|
|
a4274930e4 | ||
|
|
0c07ea7c71 | ||
|
|
0a9a23a056 | ||
|
|
bc6acedb33 | ||
|
|
684909a691 | ||
|
|
3e424f8119 | ||
|
|
d109db152c | ||
|
|
d8f42279a6 | ||
|
|
6ad8ea395a | ||
|
|
e63426b89c | ||
|
|
8a90ba8a39 | ||
|
|
b2d0ac18cf | ||
|
|
3890b5dff5 | ||
|
|
c3a89fd2d0 | ||
|
|
ae276987a0 | ||
|
|
a10abe0283 | ||
|
|
8e062792cd | ||
|
|
1c646057ce | ||
|
|
ee3aaf7446 | ||
|
|
ab4223f671 | ||
|
|
c23146bb20 | ||
|
|
c5dfcac08a | ||
|
|
24d110199a | ||
|
|
e254f80a3a | ||
|
|
a1f9a299e9 | ||
|
|
e59b8fb448 | ||
|
|
70b2db19a8 | ||
|
|
e77ab52dba | ||
|
|
7e4a20f843 | ||
|
|
e9b08f35b2 | ||
|
|
bac3432733 | ||
|
|
579bd6b13e | ||
|
|
e3c94c6412 | ||
|
|
3ae1a37a41 | ||
|
|
8d5ed5dfe5 | ||
|
|
395b9f535e | ||
|
|
77a2cdee76 | ||
|
|
0db8b3daae | ||
|
|
9a3bde0e6d | ||
|
|
422ed5279a | ||
|
|
44fad544e6 | ||
|
|
15030fb7b1 | ||
|
|
744ed2256b | ||
|
|
ec2db278e3 | ||
|
|
2ee7727d86 | ||
|
|
13bee0d5e6 | ||
|
|
eeae6eac26 | ||
|
|
2d994e1a28 | ||
|
|
b05ff26569 | ||
|
|
200e43b99d | ||
|
|
c1012b4af0 | ||
|
|
4a5ad50828 | ||
|
|
f4c8b55b33 | ||
|
|
90b75cd6e7 | ||
|
|
50638f98f5 | ||
|
|
5bce9e8ce5 | ||
|
|
a6b1a35748 | ||
|
|
6d26e91fc1 | ||
|
|
245cd66d11 | ||
|
|
636d8bffe5 | ||
|
|
9063216893 | ||
|
|
43f060663f | ||
|
|
55625d1af5 | ||
|
|
be700a0480 | ||
|
|
eee6269cd1 | ||
|
|
0924c4710b | ||
|
|
e1e8477732 | ||
|
|
96ccaa03a0 | ||
|
|
f76be1a631 | ||
|
|
3d692c72ba | ||
|
|
d3c8201614 | ||
|
|
b6f3c8eb15 | ||
|
|
2de95c77a4 | ||
|
|
33b672288c | ||
|
|
5598356157 | ||
|
|
6cebe2c1f1 | ||
|
|
855537f232 | ||
|
|
be2e6a1b24 | ||
|
|
038ae8c028 | ||
|
|
b392ff5ad1 | ||
|
|
4f06c41802 | ||
|
|
3f3f4dc6b7 | ||
|
|
bca5650578 | ||
|
|
fff74a4ac0 | ||
|
|
ad2a1546eb | ||
|
|
c2060a1f7e | ||
|
|
1b53f41787 | ||
|
|
2486a681c1 | ||
|
|
67fe6643c3 | ||
|
|
487a9aca2f | ||
|
|
079b7deb33 | ||
|
|
ce8081bd0a | ||
|
|
b8812d2b4f | ||
|
|
5adea2dbcf | ||
|
|
aaa19903c6 | ||
|
|
a5a38775f1 | ||
|
|
0768a13057 | ||
|
|
02b0c89fa4 | ||
|
|
4fb5cf4ba6 | ||
|
|
34cb936844 | ||
|
|
b9fdf6d3ca | ||
|
|
bc2786d830 | ||
|
|
e7daa5759b | ||
|
|
7a64f751ab | ||
|
|
988b5c1f36 | ||
|
|
096aee2c25 | ||
|
|
d018c3b555 | ||
|
|
c5b6b26b8b | ||
|
|
4961241c09 | ||
|
|
aca02190a7 | ||
|
|
49fdd12fdf | ||
|
|
680ea6b0e0 | ||
|
|
39a4627519 | ||
|
|
530ae2b192 | ||
|
|
638fda66da | ||
|
|
96d2052ed0 | ||
|
|
7fcd961a20 | ||
|
|
03532eaec3 | ||
|
|
17289985a4 | ||
|
|
02e0d1d05c | ||
|
|
681eb3e91e | ||
|
|
2e944686f8 | ||
|
|
b7a70ac707 | ||
|
|
43c767dd62 | ||
|
|
05867f4752 | ||
|
|
de4fe01c94 | ||
|
|
e28becbaf5 | ||
|
|
e5cd85ac0c | ||
|
|
4b25eb6c4b | ||
|
|
c0e141a6a9 | ||
|
|
b00923ebcd | ||
|
|
4e22635406 | ||
|
|
472e15c405 | ||
|
|
4b923f0603 | ||
|
|
234e55fbb1 | ||
|
|
f612865f22 | ||
|
|
26233f1b77 | ||
|
|
ddc63119b5 | ||
|
|
efbcdccac9 | ||
|
|
affa85a36b | ||
|
|
7ce447294f | ||
|
|
6b0a7a21a4 | ||
|
|
ed3e218550 | ||
|
|
e0696486b2 | ||
|
|
e5a2b00719 | ||
|
|
002d6dc016 | ||
|
|
4d451fe437 | ||
|
|
c623a363a6 | ||
|
|
c8dafe0d28 | ||
|
|
58af6ba9db | ||
|
|
deb1698cbe | ||
|
|
78dbef8711 | ||
|
|
36d730fc4e | ||
|
|
5d8b1649a4 | ||
|
|
1b3e9e4e01 | ||
|
|
e284fe67b8 | ||
|
|
0ffb91fbf1 | ||
|
|
f44a94e118 | ||
|
|
9e4fc9a40c | ||
|
|
16b7b35b04 | ||
|
|
0f780fe141 | ||
|
|
eeb524a76b | ||
|
|
787fcc160a | ||
|
|
cd9f417b84 | ||
|
|
ff43768d24 | ||
|
|
31c9a8b0ed | ||
|
|
6c943471f9 | ||
|
|
7338833f3b | ||
|
|
85d47dc359 | ||
|
|
25118d230e | ||
|
|
39f5b723f3 | ||
|
|
1f68f66162 | ||
|
|
7bda8b7a77 | ||
|
|
f86700f6f4 | ||
|
|
1c2caec2bd | ||
|
|
26ab3ce480 | ||
|
|
e59326a738 | ||
|
|
936cc791f2 | ||
|
|
e1f0f50010 | ||
|
|
18bfbaeee1 | ||
|
|
e97e7574ae | ||
|
|
4faae3d0e9 | ||
|
|
209c302f56 | ||
|
|
abfb26ab6f | ||
|
|
3dd2dbd916 | ||
|
|
f4b1a23010 | ||
|
|
bfb46ca5ef | ||
|
|
e8abb0fc1c | ||
|
|
1d3d5c4bb6 | ||
|
|
d5c798f325 | ||
|
|
bf32c4c408 | ||
|
|
a7e2b3ad30 | ||
|
|
63183a048c | ||
|
|
694dc8a0c3 | ||
|
|
94ebe71969 | ||
|
|
64a6968254 | ||
|
|
0afb594f40 | ||
|
|
6cdd1d3cc6 | ||
|
|
461370946c | ||
|
|
1a47f52eb8 | ||
|
|
92bdb993e9 | ||
|
|
1ac9173e8c | ||
|
|
0b3232ce10 | ||
|
|
66cfe0cdf4 | ||
|
|
174b2fcf59 | ||
|
|
37ec378b60 | ||
|
|
458a0314aa | ||
|
|
6c2f1378e3 | ||
|
|
d3a8306f59 | ||
|
|
cce62fded1 | ||
|
|
88a9598ded | ||
|
|
d14bff5a9f | ||
|
|
f3c9c7b413 | ||
|
|
a415f33fb5 | ||
|
|
7f0509ae87 | ||
|
|
02f070667a | ||
|
|
d6aa3db4ef | ||
|
|
41fbc5e715 | ||
|
|
0355ae967f | ||
|
|
320775b939 | ||
|
|
d3646c3118 | ||
|
|
2b3c49cb93 | ||
|
|
1d6ed840fb | ||
|
|
37be87b0bd | ||
|
|
7f913c180b | ||
|
|
8a1dc87b4c | ||
|
|
e3def37f42 | ||
|
|
863e3e0ccb | ||
|
|
9ab6ebd363 | ||
|
|
128242e371 | ||
|
|
feec92022f | ||
|
|
5ab1be8d04 | ||
|
|
b699d3a26a | ||
|
|
f26dc74f21 | ||
|
|
b38c25fe09 | ||
|
|
aa814a522d | ||
|
|
dc8ba61095 | ||
|
|
ae9f5b6fc5 | ||
|
|
26e471ad62 | ||
|
|
778ac976b2 | ||
|
|
6943e59886 | ||
|
|
518d50d2e6 | ||
|
|
e5747dad9b | ||
|
|
5c438963c0 | ||
|
|
97c7ab3c05 | ||
|
|
fa5a8476ee | ||
|
|
b8658cefe0 | ||
|
|
2bfb78f91d | ||
|
|
75ab2beb06 | ||
|
|
88dadd6c40 | ||
|
|
8109689dc2 | ||
|
|
42adc82354 | ||
|
|
a050dee096 | ||
|
|
de6e90a657 | ||
|
|
2152aae2a3 | ||
|
|
b08c04b87a | ||
|
|
cc515746f7 | ||
|
|
8e075ce713 | ||
|
|
18c4ebaa13 | ||
|
|
f985fe12cc | ||
|
|
422a45694a | ||
|
|
4175198d04 | ||
|
|
257927d7cf | ||
|
|
ba6c67c328 | ||
|
|
0a56065962 | ||
|
|
537c46a42a | ||
|
|
90a24440db | ||
|
|
5ec7e57b99 | ||
|
|
68d33a6e13 | ||
|
|
d594e6eea4 | ||
|
|
729ab8ae33 | ||
|
|
26bb601d8f | ||
|
|
51e248909f | ||
|
|
7aa87a9765 | ||
|
|
50d7e6fc61 |
+1
-1
@@ -70,7 +70,7 @@ IncludeCategories:
|
||||
- Regex: '^<.*'
|
||||
Priority: 3
|
||||
# IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentCaseLabels: false
|
||||
#IndentPPDirectives: AfterHash
|
||||
IndentWidth: 4
|
||||
# IndentWrappedFunctionNames: false
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
service_name: travis-pro
|
||||
repo_token: GZXuNlublKFy7HAewHAZLk5ZwgipTFAOA
|
||||
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "gitsubmodule"
|
||||
directory: "/" # the .gitmodules file must be placed at the top-level directory of a git working tree
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
open-pull-requests-limit: 15 # Assimp has 15 dependencies
|
||||
+157
-86
@@ -6,12 +6,148 @@ on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: write # to fetch code (actions/checkout),and release
|
||||
|
||||
jobs:
|
||||
job:
|
||||
build:
|
||||
name: ${{ matrix.name }}-build-and-test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, windows-latest-clang.exe, ubuntu-latest-clang++]
|
||||
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
|
||||
include:
|
||||
- name: windows-latest-clang.exe
|
||||
os: windows-latest
|
||||
cxx: clang++.exe
|
||||
cc: clang.exe
|
||||
- name: windows-latest-cl.exe
|
||||
os: windows-latest
|
||||
cxx: cl.exe
|
||||
cc: cl.exe
|
||||
- name: windows-hunter-latest-cl.exe
|
||||
os: windows-latest
|
||||
cxx: cl.exe
|
||||
cc: cl.exe
|
||||
- name: ubuntu-latest-clang++
|
||||
os: ubuntu-latest
|
||||
cxx: clang++
|
||||
cc: clang
|
||||
- name: macos-latest-clang++
|
||||
os: macos-latest
|
||||
cxx: clang++
|
||||
cc: clang
|
||||
- name: ubuntu-latest-g++
|
||||
os: ubuntu-latest
|
||||
cxx: g++
|
||||
cc: gcc
|
||||
|
||||
steps:
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Set Compiler Environment
|
||||
uses: lukka/set-shell-env@v1
|
||||
with:
|
||||
CXX: ${{ matrix.cxx }}
|
||||
CC: ${{ matrix.cc }}
|
||||
|
||||
- name: Cache DX SDK
|
||||
id: dxcache
|
||||
if: contains(matrix.name, 'windows')
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '${{ github.workspace }}/DX_SDK'
|
||||
key: ${{ runner.os }}-DX_SDK
|
||||
restore-keys: |
|
||||
${{ runner.os }}-DX_SDK
|
||||
|
||||
- name: Download DXSetup
|
||||
if: contains(matrix.name, 'windows-latest-cl.exe') && steps.dxcache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
|
||||
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
|
||||
|
||||
- name: Set Windows specific CMake arguments
|
||||
if: contains(matrix.name, 'windows-latest-cl.exe')
|
||||
id: windows_extra_cmake_args
|
||||
run: echo ":set-output name=args::=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set Hunter specific CMake arguments
|
||||
if: contains(matrix.name, 'hunter')
|
||||
id: hunter_extra_cmake_args
|
||||
run: echo "args=-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: configure and build
|
||||
uses: lukka/run-cmake@v3
|
||||
env:
|
||||
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
|
||||
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
|
||||
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
|
||||
buildWithCMakeArgs: '--parallel 24 -v'
|
||||
buildDirectory: '${{ github.workspace }}/build/'
|
||||
|
||||
- name: Exclude certain tests in Hunter specific builds
|
||||
if: contains(matrix.name, 'hunter')
|
||||
id: hunter_extra_test_args
|
||||
run: echo "args=--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: test
|
||||
run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
|
||||
shell: bash
|
||||
|
||||
- uses: actions/upload-artifact@v5
|
||||
if: matrix.name == 'windows-msvc'
|
||||
with:
|
||||
name: 'assimp-bins-${{ matrix.name }}'
|
||||
path: build/bin/assimp*.exe
|
||||
|
||||
- uses: marvinpinto/action-automatic-releases@latest
|
||||
if: contains(matrix.name, 'windows-msvc-hunter')
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "master"
|
||||
prerelease: true
|
||||
title: "AutoRelease"
|
||||
files: |
|
||||
build/bin/assimp*.exe
|
||||
|
||||
create-release:
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- id: create-release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
|
||||
with:
|
||||
tag_name: '${{github.ref}}'
|
||||
release_name: 'Release ${{github.ref}}'
|
||||
draft: false
|
||||
prerelease: true
|
||||
- run: |
|
||||
echo '${{steps.create-release.outputs.upload_url}}' > release_upload_url.txt
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: create-release
|
||||
path: release_upload_url.txt
|
||||
|
||||
upload-release:
|
||||
strategy:
|
||||
matrix:
|
||||
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter]
|
||||
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
|
||||
@@ -41,89 +177,24 @@ jobs:
|
||||
- name: windows-msvc-hunter
|
||||
os: windows-latest
|
||||
toolchain: ninja-vs-win64-cxx17
|
||||
|
||||
|
||||
needs: [create-release]
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Set Compiler Environment
|
||||
if: "!endsWith(matrix.name, 'hunter')"
|
||||
uses: lukka/set-shell-env@v1
|
||||
with:
|
||||
CXX: ${{ matrix.cxx }}
|
||||
CC: ${{ matrix.cc }}
|
||||
|
||||
- name: Set Compiler Environment for Hunter on Windows
|
||||
if: startsWith(matrix.name, 'windows') && endsWith(matrix.name, 'hunter')
|
||||
uses: lukka/set-shell-env@v1
|
||||
with:
|
||||
VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools
|
||||
|
||||
- name: Checkout Hunter toolchains
|
||||
if: endsWith(matrix.name, 'hunter')
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: cpp-pm/polly
|
||||
path: cmake/polly
|
||||
|
||||
- name: Remove contrib directory for Hunter builds
|
||||
if: contains(matrix.name, 'hunter')
|
||||
uses: JesseTG/rm@v1.0.2
|
||||
with:
|
||||
path: contrib
|
||||
|
||||
- name: Cache DX SDK
|
||||
id: dxcache
|
||||
if: contains(matrix.name, 'windows')
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: '${{ github.workspace }}/DX_SDK'
|
||||
key: ${{ runner.os }}-DX_SDK
|
||||
restore-keys: |
|
||||
${{ runner.os }}-DX_SDK
|
||||
|
||||
- name: Download DXSetup
|
||||
if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
|
||||
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
|
||||
|
||||
- name: Set Windows specific CMake arguments
|
||||
if: contains(matrix.name, 'windows')
|
||||
id: windows_extra_cmake_args
|
||||
run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1"
|
||||
|
||||
- name: Set Hunter specific CMake arguments
|
||||
if: contains(matrix.name, 'hunter')
|
||||
id: hunter_extra_cmake_args
|
||||
run: echo "::set-output name=args::-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake"
|
||||
|
||||
- name: configure and build
|
||||
uses: lukka/run-cmake@v3
|
||||
env:
|
||||
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
|
||||
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
|
||||
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
|
||||
buildWithCMakeArgs: '-- -v'
|
||||
buildDirectory: '${{ github.workspace }}/build/'
|
||||
|
||||
- name: Exclude certain tests in Hunter specific builds
|
||||
if: contains(matrix.name, 'hunter')
|
||||
id: hunter_extra_test_args
|
||||
run: echo "::set-output name=args::--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest"
|
||||
|
||||
- name: test
|
||||
run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
|
||||
shell: bash
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: matrix.name == 'windows-msvc'
|
||||
with:
|
||||
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
|
||||
path: build/bin
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: create-release
|
||||
- id: upload-url
|
||||
run: |
|
||||
echo "url=$(cat create-release/release_upload_url.txt)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
|
||||
- uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
|
||||
with:
|
||||
files: |
|
||||
*.zip
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Build and Publish Prebuilt Binaries
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: windows-x64
|
||||
os: windows-latest
|
||||
arch: x64
|
||||
- name: windows-x86
|
||||
os: windows-latest
|
||||
arch: x86
|
||||
cmake_args: -A Win32
|
||||
- name: macos-x64
|
||||
os: macos-13
|
||||
- name: macos-arm64
|
||||
os: macos-latest
|
||||
- name: linux-x64
|
||||
os: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -B build -S . ${{ matrix.cmake_args }} -DCMAKE_BUILD_TYPE=Release -DASSIMP_BUILD_TESTS=OFF
|
||||
cmake --build build --config Release
|
||||
|
||||
- uses: TheDoctor0/zip-release@0.7.6
|
||||
with:
|
||||
filename: ${{ matrix.name }}-${{ github.event.release.tag_name }}.zip
|
||||
directory: build/bin/
|
||||
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: build/bin/${{ matrix.name }}-${{ github.event.release.tag_name }}.zip
|
||||
append_body: true
|
||||
fail_on_unmatched_files: true
|
||||
@@ -0,0 +1,26 @@
|
||||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
id: build
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'assimp'
|
||||
dry-run: false
|
||||
language: c++
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'assimp'
|
||||
fuzz-seconds: 300
|
||||
dry-run: false
|
||||
language: c++
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v5
|
||||
if: failure() && steps.build.outcome == 'success'
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Build Windows Installer
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
build:
|
||||
name: Build the Inno Setup Installer
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: lukka/get-cmake@latest
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
|
||||
- name: Cache DX SDK
|
||||
id: dxcache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '${{ github.workspace }}/DX_SDK'
|
||||
key: ${{ runner.os }}-DX_SDK
|
||||
restore-keys: |
|
||||
${{ runner.os }}-DX_SDK
|
||||
|
||||
- name: Download DXSetup
|
||||
run: |
|
||||
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
|
||||
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
|
||||
|
||||
- name: Set Windows specific CMake arguments
|
||||
id: windows_extra_cmake_args
|
||||
run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1 -DASSIMP_BUILD_ZLIB=1"
|
||||
|
||||
- name: configure and build
|
||||
uses: lukka/run-cmake@v3
|
||||
env:
|
||||
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
|
||||
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
|
||||
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
|
||||
buildWithCMakeArgs: '--parallel 24 -v'
|
||||
buildDirectory: '${{ github.workspace }}/build/'
|
||||
|
||||
- name: Compile .ISS to .EXE Installer
|
||||
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
|
||||
with:
|
||||
path: packaging/windows-innosetup/script_x64.iss
|
||||
options: /O+
|
||||
@@ -6,12 +6,15 @@ on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
name: adress-sanitizer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v5
|
||||
- uses: lukka/get-cmake@latest
|
||||
- uses: lukka/set-shell-env@v1
|
||||
with:
|
||||
@@ -35,7 +38,7 @@ jobs:
|
||||
name: undefined-behavior-sanitizer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v5
|
||||
- uses: lukka/get-cmake@latest
|
||||
- uses: lukka/set-shell-env@v1
|
||||
with:
|
||||
@@ -43,7 +46,7 @@ jobs:
|
||||
CC: clang
|
||||
|
||||
- name: configure and build
|
||||
uses: lukka/run-cmake@v2
|
||||
uses: lukka/run-cmake@v3
|
||||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
|
||||
@@ -54,3 +57,13 @@ jobs:
|
||||
- name: test
|
||||
run: cd build/bin && ./unit
|
||||
shell: bash
|
||||
|
||||
job3:
|
||||
name: printf-sanitizer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: run scan_printf script
|
||||
run: ./scripts/scan_printf.sh
|
||||
shell: bash
|
||||
|
||||
@@ -120,3 +120,9 @@ tools/assimp_qt_viewer/ui_mainwindow.h
|
||||
|
||||
#Generated directory
|
||||
generated/*
|
||||
|
||||
# 3rd party cloned repos/tarballs etc
|
||||
# meshlab repo, automatically cloned via CMake (to gain 2 source files for VRML file format conversion)
|
||||
contrib/meshlab/autoclone
|
||||
# tinyusdz repo, automatically cloned via CMake
|
||||
contrib/tinyusdz/autoclone
|
||||
|
||||
@@ -1,35 +1,12 @@
|
||||
# Build / Install Instructions
|
||||
|
||||
## Install on all platforms using vcpkg
|
||||
You can download and install assimp using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
|
||||
```bash
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
vcpkg install assimp
|
||||
```
|
||||
The assimp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
## Install on Ubuntu
|
||||
You can install the Asset-Importer-Lib via apt:
|
||||
```
|
||||
sudo apt-get install assimp
|
||||
```
|
||||
|
||||
## Install pyassimp
|
||||
You need to have pip installed:
|
||||
```
|
||||
pip install pyassimp
|
||||
```
|
||||
|
||||
## Manual 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
|
||||
```
|
||||
### Install prerequisites
|
||||
You need to install
|
||||
* cmake
|
||||
* Your compiler (must support C++17 and C99 at least)
|
||||
* For Windows
|
||||
* DX-SDK 9 if you want to use our 3D-Viewer
|
||||
|
||||
### Get the source
|
||||
Make sure you have a working git-installation. Open a command prompt and clone the Asset-Importer-Lib via:
|
||||
@@ -37,37 +14,34 @@ Make sure you have a working git-installation. Open a command prompt and clone t
|
||||
git clone https://github.com/assimp/assimp.git
|
||||
```
|
||||
### Build from source:
|
||||
* For *assimp.lib* without any tools:
|
||||
```bash
|
||||
cd assimp
|
||||
cmake CMakeLists.txt
|
||||
cmake CMakeLists.txt
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
### Build instructions for Windows with Visual-Studio
|
||||
* For assimp with the common tools like *assimp-cmd*
|
||||
```bash
|
||||
cd assimp
|
||||
cmake CMakeLists.txt -DASSIMP_BUILD_ASSIMP_TOOLS=ON
|
||||
cmake --build .
|
||||
```
|
||||
Note that by default this builds a shared library into the `bin` directory. If you want to build it as a static library see the build options at the bottom of this file.
|
||||
|
||||
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/
|
||||
### 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/downloads/)
|
||||
To generate the build environment for your IDE open a command prompt, navigate to your repo and type:
|
||||
```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.
|
||||
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 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
|
||||
```
|
||||
The option -j descripes the number of parallel processes for the build. In this case make will try to use 4 cores for the build.
|
||||
|
||||
If you want to use a IDE for linux you can try QTCreator for instance.
|
||||
|
||||
### Build instructions for MinGW
|
||||
Older versions of MinGW's compiler (e.g. 5.1.0) do not support the -mbig_obj flag
|
||||
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.
|
||||
|
||||
@@ -84,23 +58,57 @@ 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
|
||||
- **ASSIMP_DOUBLE_PRECISION( default OFF )**: All data will be stored as double values.
|
||||
- **ASSIMP_OPT_BUILD_PACKAGES ( default OFF)**: Set to ON to generate CPack configuration files and packaging targets
|
||||
- **ASSIMP_ANDROID_JNIIOSYSTEM ( default OFF )**: Android JNI IOSystem support is active
|
||||
- **ASSIMP_NO_EXPORT ( default OFF )**: Disable Assimp's export functionality
|
||||
- **ASSIMP_BUILD_ZLIB ( default OFF )**: Build your own zlib
|
||||
- **ASSIMP_BUILD_ASSIMP_TOOLS ( default ON )**: If the supplementary tools for Assimp are built in addition to the library.
|
||||
- **ASSIMP_BUILD_SAMPLES ( default OFF )**: If the official samples are built as well (needs Glut).
|
||||
- **ASSIMP_BUILD_TESTS ( default ON )**: If the test suite for Assimp is built in addition to the library.
|
||||
- **ASSIMP_COVERALLS ( default OFF )**: Enable this to measure test coverage.
|
||||
- **ASSIMP_ERROR_MAX( default OFF)**: Enable all warnings.
|
||||
- **ASSIMP_WERROR( default OFF )**: Treat warnings as errors.
|
||||
- **ASSIMP_ASAN ( default OFF )**: Enable AddressSanitizer.
|
||||
- **ASSIMP_UBSAN ( default OFF )**: Enable Undefined Behavior sanitizer.
|
||||
- **SYSTEM_IRRXML ( default OFF )**: Use system installed Irrlicht/IrrXML library.
|
||||
- **BUILD_DOCS ( default OFF )**: Build documentation using Doxygen.
|
||||
- **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.
|
||||
- **ASSIMP_HUNTER_ENABLED (default OFF)**: Enable Hunter package manager support.
|
||||
- **BUILD_SHARED_LIBS (default ON)**: Generation of shared libs (dll for windows, so for Linux). Set this to OFF to get a static lib.
|
||||
- **ASSIMP_BUILD_FRAMEWORK (default OFF, MacOnly)**: Build package as Mac OS X Framework bundle.
|
||||
- **ASSIMP_DOUBLE_PRECISION (default OFF)**: All data will be stored as double values.
|
||||
- **ASSIMP_OPT_BUILD_PACKAGES (default OFF)**: Set to ON to generate CPack configuration files and packaging targets.
|
||||
- **ASSIMP_ANDROID_JNIIOSYSTEM (default OFF)**: Android JNI IOSystem support is active.
|
||||
- **ASSIMP_NO_EXPORT (default OFF)**: Disable Assimp's export functionality.
|
||||
- **ASSIMP_BUILD_ZLIB (default OFF)**: Build our own zlib.
|
||||
- **ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all exporters enabled.
|
||||
- **ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT (default ON)**: Build Assimp with (most) importers enabled. Currently, USD importer is not included. See ASSIMP_BUILD_USD_IMPORTER.
|
||||
- **ASSIMP_BUILD_ASSIMP_TOOLS (default OFF)**: If the supplementary tools for Assimp are built in addition to the library.
|
||||
- **ASSIMP_BUILD_SAMPLES (default OFF)**: If the official samples are built as well (needs Glut).
|
||||
- **ASSIMP_BUILD_TESTS (default ON)**: If the test suite for Assimp is built in addition to the library.
|
||||
- **ASSIMP_COVERALLS (default OFF)**: Enable this to measure test coverage.
|
||||
- **ASSIMP_INSTALL (default ON)**: Install Assimp library. Disable this if you want to use Assimp as a submodule.
|
||||
- **ASSIMP_WARNINGS_AS_ERRORS (default ON)**: Treat all warnings as errors.
|
||||
- **ASSIMP_ASAN (default OFF)**: Enable AddressSanitizer.
|
||||
- **ASSIMP_UBSAN (default OFF)**: Enable Undefined Behavior sanitizer.
|
||||
- **ASSIMP_BUILD_DOCS (default OFF)**: Build documentation using Doxygen. OBSOLETE, see https://github.com/assimp/assimp-docs
|
||||
- **ASSIMP_INJECT_DEBUG_POSTFIX (default ON)**: Inject debug postfix in .a/.so/.lib/.dll lib names
|
||||
- **ASSIMP_IGNORE_GIT_HASH (default OFF)**: Don't call git to get the hash.
|
||||
- **ASSIMP_INSTALL_PDB (default ON)**: Install MSVC debug files.
|
||||
- **USE_STATIC_CRT (default OFF)**: Link against the static MSVC runtime libraries.
|
||||
- **ASSIMP_BUILD_DRACO (default OFF)**: Build Draco libraries. Primarily for glTF.
|
||||
- **ASSIMP_BUILD_ASSIMP_VIEW (default ON, if DirectX found, OFF otherwise)**: Build Assimp view tool (requires DirectX).
|
||||
- **ASSIMP_BUILD_USD_IMPORTER (default OFF, requires ASSIMP_WARNINGS_AS_ERRORS to be OFF)**: Build USD importer, defaults to off for CI purposes
|
||||
|
||||
### Install prebuild binaries
|
||||
## Install on all platforms using vcpkg
|
||||
You can download and install assimp using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
|
||||
```bash
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
./vcpkg install assimp
|
||||
```
|
||||
The assimp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
### Install on Ubuntu
|
||||
You can install the Asset-Importer-Lib via apt:
|
||||
```
|
||||
sudo apt-get update
|
||||
sudo apt-get install libassimp-dev
|
||||
```
|
||||
|
||||
### Install pyassimp
|
||||
You need to have pip installed:
|
||||
```
|
||||
pip install pyassimp
|
||||
```
|
||||
|
||||
### Get the SDK from itch.io
|
||||
Just check [itch.io](https://kimkulling.itch.io/the-asset-importer-lib)
|
||||
|
||||
@@ -290,7 +290,7 @@ FEATURES:
|
||||
- Added support for 64 bit version header introduced in FbxSdk2016
|
||||
- Travis: enable coverall support.
|
||||
- PyAssimp: New version of the pyASSIMP 3D viewer, with much improved 3D controls
|
||||
- Morph animation support for collada
|
||||
- Morph animation support for collada
|
||||
- Added support for parameters Ni and Tf in OBJ/MTL file format
|
||||
- aiScene: add method to add children
|
||||
- Added new option to IFC importer to control tessellation angle + removed unused IFC option
|
||||
@@ -300,7 +300,7 @@ FEATURES:
|
||||
- travis ci: enable sudo support.
|
||||
- openddlparser: integrate release v0.4.0
|
||||
- aiMetaData: Added support for metadata in assbin format
|
||||
|
||||
|
||||
FIXES/HOUSEKEEPING:
|
||||
- Introduce usage of #pragma statement
|
||||
- Put cmake-scripts into their own folder
|
||||
@@ -352,7 +352,7 @@ FIXES/HOUSEKEEPING:
|
||||
- add vertex color export support ( issue 809 )
|
||||
- Fix memory leak in Collada importer ( issue 1169 )
|
||||
- add stp to the list of supported extensions for step-files ( issue 1183 )
|
||||
- fix clang build ( Issue-1169 )
|
||||
- fix clang build ( Issue-1169 )
|
||||
- fix for FreeBSD
|
||||
- Import FindPkgMacros to main CMake Configuration
|
||||
- Extended support for tessellation parameter to more IFC shapes
|
||||
@@ -375,7 +375,7 @@ FIXES/HOUSEKEEPING:
|
||||
- Obj-Importer: do not break when detecting an overflow ( issue 1244 )
|
||||
- Obj-Importer: fix parsing of multible line data definitions
|
||||
- Fixed bug where IFC models with multiple IFCSite only loaded 1 site instead of the complete model
|
||||
- PLYImporter: - optimize memory and speed on ply importer / change parser to use a file stream - manage texture path in ply
|
||||
- PLYImporter: - optimize memory and speed on ply importer / change parser to use a file stream - manage texture path in ply
|
||||
import - manage texture coords on faces in ply import - correction on point cloud faces generation
|
||||
- Utf8: integrate new lib ( issue 1158 )
|
||||
- fixed CMAKE_MODULE_PATH overwriting previous values
|
||||
@@ -400,7 +400,7 @@ FIXES/HOUSEKEEPING:
|
||||
- Remove std functions deprecated by C++11.
|
||||
- X-Importer: make it deal with lines
|
||||
- use correct path for compilers ( issue 1335 )
|
||||
- Collada: add workaround to deal with polygon with holes
|
||||
- Collada: add workaround to deal with polygon with holes
|
||||
- update python readme
|
||||
- Use unique node names when loading Collada files
|
||||
- Fixed many FBX bugs
|
||||
@@ -429,7 +429,7 @@ FEATURES:
|
||||
- C4D: update to latest Melange-SDK
|
||||
- Add a gitter channel
|
||||
- Coverity check enabled
|
||||
- Switch to <...> include brackets for public headers
|
||||
- Switch to <...> include brackets for public headers
|
||||
- Enable export by pyAssimp
|
||||
- CI: check windows build
|
||||
- Add functionality to perform a singlepost-processing step
|
||||
@@ -564,7 +564,7 @@ API CHANGES:
|
||||
currently used, however ...)
|
||||
- Some Assimp::Importer methods are const now.
|
||||
|
||||
|
||||
|
||||
1.1 (2010-04-17)
|
||||
This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700).
|
||||
|
||||
|
||||
+291
-192
@@ -1,6 +1,6 @@
|
||||
# Open Asset Import Library (assimp)
|
||||
# ----------------------------------------------------------------------
|
||||
# Copyright (c) 2006-2022, assimp team
|
||||
# Copyright (c) 2006-2025, assimp team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -38,25 +38,76 @@ SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW)
|
||||
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
|
||||
SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.10 )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.22 )
|
||||
|
||||
#================================================================================#
|
||||
# Model formats not enabled by default
|
||||
#
|
||||
# 3rd party projects may not adhere to strict standards enforced by assimp,
|
||||
# in which case those formats must be opt-in; otherwise the 3rd party code
|
||||
# would fail assimp CI checks
|
||||
#================================================================================#
|
||||
# M3D format import support (assimp integration no longer supported by M3D format author)
|
||||
# User may override these in their CMake script to provide M3D import/export support
|
||||
# (M3D importer/exporter was disabled for assimp release 5.1 or later)
|
||||
OPTION(ASSIMP_BUILD_M3D_IMPORTER "Enable M3D file import" off)
|
||||
OPTION(ASSIMP_BUILD_M3D_EXPORTER "Enable M3D file export" off)
|
||||
|
||||
# Experimental USD importer: disabled, need to opt-in
|
||||
# Note: assimp github PR automatic checks will fail the PR due to compiler warnings in
|
||||
# the external, 3rd party tinyusdz code which isn't technically part of the PR since it's
|
||||
# auto-cloned during build; so MUST disable the feature or the PR will be rejected
|
||||
OPTION(ASSIMP_BUILD_USD_IMPORTER "Enable USD file import" off)
|
||||
OPTION(ASSIMP_BUILD_USD_VERBOSE_LOGS "Enable verbose USD import debug logging" off)
|
||||
|
||||
# VRML (.wrl/.x3dv) file import support by leveraging X3D importer and 3rd party file
|
||||
# format converter to convert .wrl/.x3dv files to X3D-compatible .xml
|
||||
# (Need to make this opt-in because 3rd party code triggers lots of CI code quality warnings)
|
||||
OPTION(ASSIMP_BUILD_VRML_IMPORTER "Enable VRML (.wrl/.x3dv) file import" off)
|
||||
|
||||
#--------------------------------------------------------------------------------#
|
||||
# Internal impl for optional model formats
|
||||
#--------------------------------------------------------------------------------#
|
||||
# Internal/private M3D logic
|
||||
if (NOT ASSIMP_BUILD_M3D_IMPORTER)
|
||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_IMPORTER)
|
||||
endif () # if (not ASSIMP_BUILD_M3D_IMPORTER)
|
||||
if (NOT ASSIMP_BUILD_M3D_EXPORTER)
|
||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)
|
||||
endif () # if (not ASSIMP_BUILD_M3D_EXPORTER)
|
||||
|
||||
# Internal/private VRML logic
|
||||
if (NOT ASSIMP_BUILD_VRML_IMPORTER)
|
||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_VRML_IMPORTER)
|
||||
endif () # if (not ASSIMP_BUILD_VRML_IMPORTER)
|
||||
#================================================================================#
|
||||
|
||||
option(ASSIMP_BUILD_USE_CCACHE "Use ccache to speed up compilation." on)
|
||||
|
||||
IF(ASSIMP_BUILD_USE_CCACHE)
|
||||
find_program(CCACHE_PATH ccache)
|
||||
IF (CCACHE_PATH)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PATH})
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_PATH})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Disabled importers: m3d for 5.1
|
||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_IMPORTER)
|
||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)
|
||||
# Toggles the use of the hunter package manager
|
||||
option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
|
||||
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
include("cmake-modules/HunterGate.cmake")
|
||||
HunterGate(
|
||||
URL "https://github.com/cpp-pm/hunter/archive/v0.24.0.tar.gz"
|
||||
SHA1 "a3d7f4372b1dcd52faa6ff4a3bd5358e1d0e5efd"
|
||||
URL "https://github.com/cpp-pm/hunter/archive/v0.25.8.tar.gz"
|
||||
SHA1 "26c79d587883ec910bce168e25f6ac4595f97033"
|
||||
)
|
||||
|
||||
add_definitions(-DASSIMP_USE_HUNTER)
|
||||
ADD_DEFINITIONS(-DASSIMP_USE_HUNTER)
|
||||
ENDIF()
|
||||
|
||||
PROJECT(Assimp VERSION 5.2.0)
|
||||
PROJECT(Assimp VERSION 6.0.2
|
||||
LANGUAGES C CXX
|
||||
DESCRIPTION "Open Asset Import Library (Assimp) is a library to import various well-known 3D model formats in a uniform manner."
|
||||
)
|
||||
|
||||
# All supported options ###############################################
|
||||
|
||||
@@ -84,13 +135,9 @@ OPTION( ASSIMP_NO_EXPORT
|
||||
"Disable Assimp's export functionality."
|
||||
OFF
|
||||
)
|
||||
OPTION( ASSIMP_BUILD_ZLIB
|
||||
"Build your own zlib"
|
||||
OFF
|
||||
)
|
||||
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
|
||||
"If the supplementary tools for Assimp are built in addition to the library."
|
||||
ON
|
||||
OFF
|
||||
)
|
||||
OPTION ( ASSIMP_BUILD_SAMPLES
|
||||
"If the official samples are built as well (needs Glut)."
|
||||
@@ -108,9 +155,9 @@ OPTION( ASSIMP_INSTALL
|
||||
"Disable this if you want to use assimp as a submodule."
|
||||
ON
|
||||
)
|
||||
OPTION ( ASSIMP_ERROR_MAX
|
||||
"Enable all warnings."
|
||||
OFF
|
||||
OPTION ( ASSIMP_WARNINGS_AS_ERRORS
|
||||
"Treat all warnings as errors."
|
||||
ON
|
||||
)
|
||||
OPTION ( ASSIMP_ASAN
|
||||
"Enable AddressSanitizer."
|
||||
@@ -135,28 +182,36 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH
|
||||
)
|
||||
|
||||
IF (WIN32)
|
||||
# Use subset of Windows.h
|
||||
OPTION( ASSIMP_BUILD_ZLIB
|
||||
"Build your zlib"
|
||||
ON
|
||||
)
|
||||
ELSE()
|
||||
OPTION( ASSIMP_BUILD_ZLIB
|
||||
"Build your zlib"
|
||||
OFF
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
# Use a subset of Windows.h
|
||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||
|
||||
IF(MSVC)
|
||||
OPTION (ASSIMP_BUILD_ASSIMP_VIEW
|
||||
"If the Assimp view tool is built. (requires DirectX)"
|
||||
OFF )
|
||||
|
||||
OPTION( ASSIMP_INSTALL_PDB
|
||||
"Install MSVC debug files."
|
||||
"Create MSVC debug symbol files and add to Install target."
|
||||
ON )
|
||||
IF(NOT (MSVC_VERSION LESS 1900))
|
||||
# Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
|
||||
# Multibyte character set has been deprecated since at least MSVC2015 (possibly earlier)
|
||||
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
|
||||
ENDIF()
|
||||
|
||||
# Link statically against c/c++ lib to avoid missing redistriburable such as
|
||||
# Link statically against c/c++ lib to avoid missing redistributable such as
|
||||
# "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users
|
||||
# a choice to opt for the shared runtime if they want.
|
||||
option(USE_STATIC_CRT "Link against the static runtime libraries." OFF)
|
||||
|
||||
# The CMAKE_CXX_FLAGS vars can be overriden by some Visual Studio generators, so we use an alternative
|
||||
# The CMAKE_CXX_FLAGS vars can be overridden by some Visual Studio generators, so we use an alternative
|
||||
# global method here:
|
||||
if (${USE_STATIC_CRT})
|
||||
add_compile_options(
|
||||
@@ -164,12 +219,6 @@ IF (WIN32)
|
||||
$<$<CONFIG:Debug>:/MTd>
|
||||
$<$<CONFIG:Release>:/MT>
|
||||
)
|
||||
else()
|
||||
add_compile_options(
|
||||
$<$<CONFIG:>:/MD>
|
||||
$<$<CONFIG:Debug>:/MDd>
|
||||
$<$<CONFIG:Release>:/MD>
|
||||
)
|
||||
endif()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
@@ -190,6 +239,7 @@ ENDIF()
|
||||
IF(NOT BUILD_SHARED_LIBS)
|
||||
MESSAGE(STATUS "Shared libraries disabled")
|
||||
SET(LINK_SEARCH_START_STATIC TRUE)
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Shared libraries enabled")
|
||||
ENDIF()
|
||||
@@ -199,15 +249,12 @@ 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 5)
|
||||
SET (ASSIMP_SOVERSION 6)
|
||||
|
||||
SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )
|
||||
if(NOT ASSIMP_HUNTER_ENABLED)
|
||||
# Enable C++11 support globally
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
IF(NOT ASSIMP_IGNORE_GIT_HASH)
|
||||
# Get the current working branch
|
||||
@@ -237,16 +284,6 @@ IF(ASSIMP_DOUBLE_PRECISION)
|
||||
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/revision.h
|
||||
)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES( BEFORE
|
||||
./
|
||||
code/
|
||||
@@ -264,53 +301,77 @@ SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
|
||||
IF( UNIX )
|
||||
# Use GNUInstallDirs for Unix predefined directories
|
||||
INCLUDE(GNUInstallDirs)
|
||||
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit linux
|
||||
IF( ${OPERATING_SYSTEM} MATCHES "Android")
|
||||
ELSE()
|
||||
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit linux
|
||||
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit Linux
|
||||
IF(NOT ${OPERATING_SYSTEM} MATCHES "Android")
|
||||
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit Linux
|
||||
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND WIN32)
|
||||
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
|
||||
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
|
||||
ENDIF()
|
||||
|
||||
IF( MSVC OR "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") # clang with MSVC ABI
|
||||
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
|
||||
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
|
||||
endif ()
|
||||
|
||||
|
||||
# Grouped compiler settings ########################################
|
||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW)
|
||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW AND NOT HAIKU)
|
||||
IF(NOT ASSIMP_HUNTER_ENABLED)
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
MESSAGE(STATUS "GCC13 detected disabling \"-Wdangling-reference\" in Cpp files as it appears to be a false positive")
|
||||
ADD_COMPILE_OPTIONS("$<$<COMPILE_LANGUAGE:CXX>:-Wno-dangling-reference>")
|
||||
ENDIF()
|
||||
# hide all not-exported symbols
|
||||
IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" )
|
||||
SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
ELSE()
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC)
|
||||
# enable multi-core compilation with MSVC
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
|
||||
ADD_COMPILE_OPTIONS(/bigobj /W4 /WX )
|
||||
ADD_COMPILE_OPTIONS(/bigobj)
|
||||
ELSE() # msvc
|
||||
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)
|
||||
ADD_COMPILE_OPTIONS(/MP /bigobj)
|
||||
ENDIF()
|
||||
|
||||
# disable "elements of array '' will be default initialized" warning on MSVC2013
|
||||
IF(MSVC12)
|
||||
ADD_COMPILE_OPTIONS(/wd4351)
|
||||
ADD_COMPILE_OPTIONS(/wd4351)
|
||||
ENDIF()
|
||||
ADD_COMPILE_OPTIONS(/wd4244) #supress warning for double to float conversion if Double precission is activated
|
||||
# supress warning for double to float conversion if Double precision is activated
|
||||
ADD_COMPILE_OPTIONS(/wd4244)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
|
||||
# Allow user to disable PDBs
|
||||
if(ASSIMP_INSTALL_PDB)
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
|
||||
elseif((GENERATOR_IS_MULTI_CONFIG) OR (CMAKE_BUILD_TYPE MATCHES Release))
|
||||
message("-- MSVC PDB generation disabled. Release binary will not be debuggable.")
|
||||
endif()
|
||||
if(NOT /utf-8 IN_LIST CMAKE_CXX_FLAGS)
|
||||
# Source code is encoded in UTF-8
|
||||
ADD_COMPILE_OPTIONS(/source-charset:utf-8)
|
||||
endif()
|
||||
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
IF(NOT ASSIMP_HUNTER_ENABLED)
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "-Wno-deprecated-non-prototype -fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
|
||||
SET(CMAKE_C_FLAGS "-Wno-deprecated-non-prototype -fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
ELSEIF( MINGW )
|
||||
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.")
|
||||
@@ -318,51 +379,47 @@ ELSEIF( MINGW )
|
||||
message(WARNING "MinGW is old, if you experience errors, update MinGW.")
|
||||
ENDIF()
|
||||
IF(NOT ASSIMP_HUNTER_ENABLED)
|
||||
SET(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "-std=gnu++17 ${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}")
|
||||
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -g ${CMAKE_CXX_FLAGS}")
|
||||
ELSE()
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
|
||||
ENDIF()
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
IF ( IOS AND NOT ASSIMP_HUNTER_ENABLED)
|
||||
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
|
||||
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_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
|
||||
# Experimental for pdb generation
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF (ASSIMP_COVERALLS)
|
||||
MESSAGE(STATUS "Coveralls enabled")
|
||||
|
||||
INCLUDE(Coveralls)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
ENDIF()
|
||||
|
||||
IF (ASSIMP_ERROR_MAX)
|
||||
MESSAGE(STATUS "Turning on all warnings")
|
||||
IF (MSVC)
|
||||
ADD_COMPILE_OPTIONS(/W4) # NB: there is a /Wall option, pedantic mode
|
||||
ELSE()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF (ASSIMP_ASAN)
|
||||
MESSAGE(STATUS "AddressSanitizer enabled")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
||||
ENDIF()
|
||||
|
||||
IF (ASSIMP_UBSAN)
|
||||
MESSAGE(STATUS "Undefined Behavior sanitizer enabled")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE (FindPkgMacros)
|
||||
@@ -413,13 +470,6 @@ IF (NOT TARGET uninstall AND ASSIMP_INSTALL)
|
||||
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
ENDIF()
|
||||
|
||||
# cmake configuration files
|
||||
if(${BUILD_SHARED_LIBS})
|
||||
set(BUILD_LIB_TYPE SHARED)
|
||||
else()
|
||||
set(BUILD_LIB_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
IF( UNIX )
|
||||
# Use GNUInstallDirs for Unix predefined directories
|
||||
INCLUDE(GNUInstallDirs)
|
||||
@@ -444,20 +494,20 @@ ENDIF()
|
||||
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
|
||||
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-hunter-config.cmake.in")
|
||||
set(NAMESPACE "${PROJECT_NAME}::")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
||||
SET(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
|
||||
SET(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-hunter-config.cmake.in")
|
||||
SET(NAMESPACE "${PROJECT_NAME}::")
|
||||
SET(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
SET(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
SET(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
||||
ELSE()
|
||||
set(CONFIG_INSTALL_DIR "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
|
||||
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-plain-config.cmake.in")
|
||||
SET(CONFIG_INSTALL_DIR "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
|
||||
SET(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-plain-config.cmake.in")
|
||||
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
|
||||
set(NAMESPACE "${PROJECT_NAME_LOWERCASE}::")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWERCASE}Targets")
|
||||
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake")
|
||||
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake")
|
||||
SET(NAMESPACE "${PROJECT_NAME_LOWERCASE}::")
|
||||
SET(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWERCASE}Targets")
|
||||
SET(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake")
|
||||
SET(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake")
|
||||
ENDIF()
|
||||
|
||||
set(INCLUDE_INSTALL_DIR "include")
|
||||
@@ -474,18 +524,20 @@ configure_package_config_file(
|
||||
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
|
||||
DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
COMPONENT ${LIBASSIMP-DEV_COMPONENT}
|
||||
)
|
||||
IF(ASSIMP_INSTALL)
|
||||
INSTALL(
|
||||
FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
|
||||
DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
COMPONENT ${LIBASSIMP-DEV_COMPONENT}
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
NAMESPACE "${NAMESPACE}"
|
||||
DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
COMPONENT ${LIBASSIMP-DEV_COMPONENT}
|
||||
)
|
||||
INSTALL(
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
NAMESPACE "${NAMESPACE}"
|
||||
DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
COMPONENT ${LIBASSIMP-DEV_COMPONENT}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF( ASSIMP_BUILD_DOCS )
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
@@ -498,12 +550,12 @@ IF(ASSIMP_HUNTER_ENABLED)
|
||||
find_package(ZLIB CONFIG REQUIRED)
|
||||
|
||||
add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_LIBRARIES ZLIB::zlib)
|
||||
set(ASSIMP_BUILD_MINIZIP TRUE)
|
||||
SET(ZLIB_FOUND TRUE)
|
||||
SET(ZLIB_LIBRARIES ZLIB::zlib)
|
||||
SET(ASSIMP_BUILD_MINIZIP TRUE)
|
||||
ELSE()
|
||||
# If the zlib is already found outside, add an export in case assimpTargets can't find it.
|
||||
IF( ZLIB_FOUND )
|
||||
IF( ZLIB_FOUND AND ASSIMP_INSTALL)
|
||||
INSTALL( TARGETS zlib zlibstatic
|
||||
EXPORT "${TARGETS_EXPORT_NAME}")
|
||||
ENDIF()
|
||||
@@ -512,7 +564,11 @@ ELSE()
|
||||
FIND_PACKAGE(ZLIB)
|
||||
ENDIF()
|
||||
|
||||
IF( NOT ZLIB_FOUND )
|
||||
IF ( NOT ZLIB_FOUND AND NOT ASSIMP_BUILD_ZLIB )
|
||||
message( FATAL_ERROR
|
||||
"Build configured with -DASSIMP_BUILD_ZLIB=OFF but unable to find zlib"
|
||||
)
|
||||
ELSEIF( NOT ZLIB_FOUND )
|
||||
MESSAGE(STATUS "compiling zlib from sources")
|
||||
INCLUDE(CheckIncludeFile)
|
||||
INCLUDE(CheckTypeSize)
|
||||
@@ -523,8 +579,8 @@ ELSE()
|
||||
# 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 )
|
||||
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)
|
||||
@@ -535,7 +591,7 @@ ELSE()
|
||||
SET(ASSIMP_BUILD_MINIZIP 1)
|
||||
ELSE()
|
||||
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||
SET(ZLIB_LIBRARIES_LINKED -lz)
|
||||
SET(ZLIB_LIBRARIES_LINKED -l${ZLIB_LIBRARIES})
|
||||
ENDIF()
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
@@ -547,7 +603,7 @@ IF( NOT IOS )
|
||||
ELSE ()
|
||||
IF( NOT BUILD_SHARED_LIBS )
|
||||
IF( NOT ASSIMP_BUILD_MINIZIP )
|
||||
use_pkgconfig(UNZIP minizip)
|
||||
USE_PKGCONFIG(UNZIP minizip)
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
@@ -581,11 +637,15 @@ SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
|
||||
)
|
||||
|
||||
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
IF ( MSVC )
|
||||
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/includes")
|
||||
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/includes")
|
||||
|
||||
IF (WIN32)
|
||||
# pick the correct prebuilt library
|
||||
IF(MSVC15)
|
||||
IF(MSVC143)
|
||||
SET(C4D_LIB_POSTFIX "_2022")
|
||||
ELSEIF(MSV142)
|
||||
SET(C4D_LIB_POSTFIX "_2019")
|
||||
ELSEIF(MSVC15)
|
||||
SET(C4D_LIB_POSTFIX "_2017")
|
||||
ELSEIF(MSVC14)
|
||||
SET(C4D_LIB_POSTFIX "_2015")
|
||||
@@ -597,7 +657,7 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
SET(C4D_LIB_POSTFIX "_2010")
|
||||
ELSE()
|
||||
MESSAGE( FATAL_ERROR
|
||||
"C4D is currently only supported with MSVC 10, 11, 12, 14"
|
||||
"C4D for Windows is currently only supported with MSVC 10, 11, 12, 14, 14.2, 14.3"
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
@@ -615,108 +675,133 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
# winsock and winmm are necessary (and undocumented) dependencies of Cineware SDK because
|
||||
# it can be used to communicate with a running Cinema 4D instance
|
||||
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
|
||||
ELSE ()
|
||||
MESSAGE( FATAL_ERROR
|
||||
"C4D is currently only available on Windows with Cineware SDK installed in contrib/Cineware"
|
||||
ELSEIF (APPLE)
|
||||
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/libraries/osx")
|
||||
|
||||
SET(C4D_DEBUG_LIBRARIES
|
||||
"${C4D_LIB_BASE_PATH}/debug/libcinewarelib.a"
|
||||
"${C4D_LIB_BASE_PATH}/debug/libjpeglib.a"
|
||||
)
|
||||
ENDIF ()
|
||||
SET(C4D_RELEASE_LIBRARIES
|
||||
"${C4D_LIB_BASE_PATH}/release/libcinewarelib.a"
|
||||
"${C4D_LIB_BASE_PATH}/release/libjpeglib.a"
|
||||
)
|
||||
ELSE()
|
||||
MESSAGE( FATAL_ERROR
|
||||
"C4D is currently only available on Windows and macOS with Cineware SDK installed in contrib/Cineware"
|
||||
)
|
||||
ENDIF()
|
||||
ELSE ()
|
||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
||||
ENDIF ()
|
||||
|
||||
IF(ASSIMP_BUILD_DRACO_STATIC)
|
||||
SET(ASSIMP_BUILD_DRACO ON)
|
||||
ENDIF()
|
||||
|
||||
# Draco requires cmake 3.12
|
||||
IF (DEFINED CMAKE_VERSION AND "${CMAKE_VERSION}" VERSION_LESS "3.12")
|
||||
message(NOTICE "draco requires cmake 3.12 or newer, cmake is ${CMAKE_VERSION} . Draco is disabled")
|
||||
MESSAGE(NOTICE "draco requires cmake 3.12 or newer, cmake is ${CMAKE_VERSION} . Draco is disabled")
|
||||
SET ( ASSIMP_BUILD_DRACO OFF CACHE BOOL "Disabled: Draco requires newer cmake" FORCE )
|
||||
ELSE()
|
||||
OPTION ( ASSIMP_BUILD_DRACO "If the Draco libraries are to be built. Primarily for glTF" OFF )
|
||||
IF ( ASSIMP_BUILD_DRACO )
|
||||
# Primarily for glTF v2
|
||||
# Enable Draco glTF feature set
|
||||
set(DRACO_GLTF ON CACHE BOOL "" FORCE)
|
||||
SET(DRACO_GLTF_BITSTREAM ON CACHE BOOL "" FORCE)
|
||||
# Disable unnecessary or omitted components
|
||||
set(DRACO_JS_GLUE OFF CACHE BOOL "" FORCE)
|
||||
set(DRACO_WASM OFF CACHE BOOL "" FORCE)
|
||||
set(DRACO_MAYA_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(DRACO_UNITY_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(DRACO_TESTS OFF CACHE BOOL "" FORCE)
|
||||
SET(DRACO_JS_GLUE OFF CACHE BOOL "" FORCE)
|
||||
SET(DRACO_WASM OFF CACHE BOOL "" FORCE)
|
||||
SET(DRACO_MAYA_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
SET(DRACO_UNITY_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
SET(DRACO_TESTS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
hunter_add_package(draco)
|
||||
find_package(draco CONFIG REQUIRED)
|
||||
set(draco_LIBRARIES draco::draco)
|
||||
SET(draco_LIBRARIES draco::draco)
|
||||
ELSE()
|
||||
# Draco 1.4.1 has many warnings and will not build with /WX or -Werror
|
||||
# See https://github.com/google/draco/issues/672
|
||||
# and https://github.com/google/draco/issues/673
|
||||
IF(MSVC)
|
||||
set(DRACO_CXX_FLAGS "/W0")
|
||||
SET(DRACO_CXX_FLAGS "/W0")
|
||||
ELSE()
|
||||
list(APPEND DRACO_CXX_FLAGS
|
||||
LIST(APPEND DRACO_CXX_FLAGS
|
||||
"-Wno-bool-compare"
|
||||
"-Wno-comment"
|
||||
"-Wno-maybe-uninitialized"
|
||||
"-Wno-sign-compare"
|
||||
"-Wno-unused-local-typedefs"
|
||||
)
|
||||
# Draco 1.4.1 does not explicitly export any symbols under GCC/clang
|
||||
list(APPEND DRACO_CXX_FLAGS
|
||||
"-fvisibility=default"
|
||||
)
|
||||
|
||||
IF(NOT ASSIMP_BUILD_DRACO_STATIC)
|
||||
# Draco 1.4.1 does not explicitly export any symbols under GCC/clang
|
||||
LIST(APPEND DRACO_CXX_FLAGS
|
||||
"-fvisibility=default"
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Don't build or install all of Draco by default
|
||||
ADD_SUBDIRECTORY( "contrib/draco" EXCLUDE_FROM_ALL )
|
||||
|
||||
if(MSVC OR WIN32)
|
||||
set(draco_LIBRARIES "draco")
|
||||
else()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(draco_LIBRARIES "draco_shared")
|
||||
else()
|
||||
set(draco_LIBRARIES "draco_static")
|
||||
endif()
|
||||
endif()
|
||||
IF(ASSIMP_BUILD_DRACO_STATIC)
|
||||
set_property(DIRECTORY "contrib/draco" PROPERTY BUILD_SHARED_LIBS OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC OR WIN32)
|
||||
SET(draco_LIBRARIES "draco")
|
||||
ELSE()
|
||||
IF(ASSIMP_BUILD_DRACO_STATIC)
|
||||
SET(draco_LIBRARIES "draco_static")
|
||||
ELSE()
|
||||
SET(draco_LIBRARIES "draco_shared")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Don't build the draco command-line tools by default
|
||||
set_target_properties(draco_encoder draco_decoder PROPERTIES
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
EXCLUDE_FROM_DEFAULT_BUILD TRUE
|
||||
)
|
||||
)
|
||||
|
||||
# Do build the draco shared library
|
||||
set_target_properties(${draco_LIBRARIES} PROPERTIES
|
||||
EXCLUDE_FROM_ALL FALSE
|
||||
EXCLUDE_FROM_DEFAULT_BUILD FALSE
|
||||
)
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(${draco_LIBRARIES})
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(draco_encoder)
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(draco_decoder)
|
||||
|
||||
set(draco_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/draco/src")
|
||||
SET(draco_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/draco/src")
|
||||
|
||||
# This is probably wrong
|
||||
INSTALL( TARGETS ${draco_LIBRARIES}
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
|
||||
FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
COMPONENT ${LIBASSIMP_COMPONENT}
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
IF (ASSIMP_INSTALL)
|
||||
INSTALL( TARGETS ${draco_LIBRARIES}
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
|
||||
FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||
COMPONENT ${LIBASSIMP_COMPONENT}
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Main assimp code
|
||||
ADD_SUBDIRECTORY( code/ )
|
||||
|
||||
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||
# The viewer for windows only
|
||||
IF (WIN32)
|
||||
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" OFF )
|
||||
FIND_PACKAGE(DirectX)
|
||||
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 ()
|
||||
@@ -741,12 +826,22 @@ IF ( ASSIMP_BUILD_TESTS )
|
||||
ADD_SUBDIRECTORY( test/ )
|
||||
ENDIF ()
|
||||
|
||||
# Generate a pkg-config .pc for the Assimp library.
|
||||
# Generate a pkg-config .pc, revision.h, and config.h for the Assimp library.
|
||||
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
|
||||
IF ( ASSIMP_INSTALL )
|
||||
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_LIST_DIR}/include/assimp/revision.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/revision.h
|
||||
)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
|
||||
)
|
||||
|
||||
IF ( ASSIMP_INSTALL )
|
||||
IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
||||
# Packing information
|
||||
@@ -780,7 +875,7 @@ IF ( ASSIMP_INSTALL )
|
||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS)
|
||||
SET(cPACK_DEBIAN_PACKAGE_NAME "assimp")
|
||||
SET(CPACK_DEBIAN_PACKAGE_NAME "assimp")
|
||||
SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/gtest contrib/zlib workspaces test doc obj samples packaging)
|
||||
SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
|
||||
SET(CPACK_DEBIAN_CHANGELOG)
|
||||
@@ -817,30 +912,34 @@ if(WIN32)
|
||||
SET(ASSIMP_MSVC_VERSION "vc140")
|
||||
ELSEIF(MSVC15)
|
||||
SET(ASSIMP_MSVC_VERSION "vc141")
|
||||
ELSEIF(MSV142)
|
||||
SET(ASSIMP_MSVC_VERSION "vc142")
|
||||
ELSEIF(MSVC143)
|
||||
SET(ASSIMP_MSVC_VERSION "vc143")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC12 OR MSVC14 OR MSVC15 )
|
||||
ADD_CUSTOM_TARGET(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)
|
||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ELSE()
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "assimp_with_tools",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS" : "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
@@ -60,7 +60,7 @@ The GUY who performed some of the CSM mocaps.
|
||||
Contributed fixes for the documentation and the doxygen markup
|
||||
|
||||
- Zhao Lei
|
||||
Contributed several bugfixes fixing memory leaks and improving float parsing
|
||||
Contributed several bugfixes fixing memory leaks and improving float parsing
|
||||
|
||||
- sueastside
|
||||
Updated PyAssimp to the latest Assimp data structures and provided a script to keep the Python binding up-to-date.
|
||||
@@ -129,7 +129,7 @@ Contributed a patch to fix the VertexTriangleAdjacency postprocessing step.
|
||||
Contributed the Debian build fixes ( architecture macro ).
|
||||
|
||||
- gellule
|
||||
Several LWO and LWS fixes (pivoting).
|
||||
Several LWO and LWS fixes (pivoting).
|
||||
|
||||
- Marcel Metz
|
||||
GCC/Linux fixes for the SimpleOpenGL sample.
|
||||
|
||||
+11
-19
@@ -1,25 +1,17 @@
|
||||
FROM ubuntu:14.04
|
||||
FROM gcc:1.5.1.0
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git cmake build-essential software-properties-common
|
||||
RUN apt-get update \
|
||||
apt-get install -y ninja-build cmake zlib1g-dev
|
||||
|
||||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update && apt-get install -y gcc-4.9 g++-4.9 && \
|
||||
cd /usr/bin && \
|
||||
rm gcc g++ cpp && \
|
||||
ln -s gcc-4.9 gcc && \
|
||||
ln -s g++-4.9 g++ && \
|
||||
ln -s cpp-4.9 cpp
|
||||
WORKDIR /app
|
||||
|
||||
WORKDIR /opt
|
||||
COPY . .
|
||||
|
||||
# Build Assimp
|
||||
RUN git clone https://github.com/assimp/assimp.git /opt/assimp
|
||||
|
||||
WORKDIR /opt/assimp
|
||||
|
||||
RUN git checkout master \
|
||||
&& mkdir build && cd build && \
|
||||
cmake \
|
||||
RUN mkdir build && cd build && \
|
||||
cmake -G 'Ninja' \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DASSIMP_BUILD_ASSIMP_TOOLS=ON \
|
||||
.. && \
|
||||
make && make install
|
||||
ninja -j4 && ninja install
|
||||
|
||||
CMD ["/app/build/bin/unit"]
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
|
||||
|
||||
========================================================================
|
||||
Open Asset Import Library (assimp) INSTALL
|
||||
Open Asset Import Library (assimp) INSTALL
|
||||
========================================================================
|
||||
|
||||
------------------------------
|
||||
Getting the documentation
|
||||
------------------------------
|
||||
|
||||
A regularly-updated copy is available at
|
||||
A regularly-updated copy is available at
|
||||
https://assimp-docs.readthedocs.io/en/latest/
|
||||
|
||||
------------------------------
|
||||
Building Assimp
|
||||
Building Assimp
|
||||
------------------------------
|
||||
|
||||
Just check the build-instaructions which you can find here: https://github.com/assimp/assimp/blob/master/Build.md
|
||||
Just check the build-instructions which you can find here: https://github.com/assimp/assimp/blob/master/Build.md
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
Open Asset Import Library (assimp)
|
||||
==================================
|
||||
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
|
||||
|
||||
Open Asset Import Library is a library that loads various 3D file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
|
||||
|
||||
### Current project status ###
|
||||
[](https://opencollective.com/assimp)
|
||||

|
||||
<a href="https://scan.coverity.com/projects/5607">
|
||||
<img alt="Coverity Scan Build Status"
|
||||
src="https://scan.coverity.com/projects/5607/badge.svg"/>
|
||||
</a>
|
||||
[](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade)
|
||||
[](https://coveralls.io/github/assimp/assimp?branch=master)
|
||||
[](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://sonarcloud.io/summary/new_code?id=assimp_assimp)
|
||||
[](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
|
||||
[](https://lgtm.com/projects/g/assimp/assimp/alerts/)
|
||||
[](http://isitmaintained.com/project/assimp/assimp "Percentage of issues still open")
|
||||
[](https://gurubase.io/g/assimp)
|
||||
[](https://opencollective.com/assimp)
|
||||
<br>
|
||||
|
||||
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
|
||||
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
|
||||
APIs are provided for C and C++. Various bindings exist to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
|
||||
Additionally, assimp features various __mesh post-processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
|
||||
|
||||
### Latest Doc's ###
|
||||
Please check the latest documents at [Asset-Importer-Lib-Doc](https://assimp-docs.readthedocs.io/en/latest/).
|
||||
## Project activity ##
|
||||

|
||||
|
||||
### Get involved ###
|
||||
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).
|
||||
<br>
|
||||
You find a bug in the docs? Use [Doc-Repo](https://github.com/assimp/assimp-docs).
|
||||
<br>
|
||||
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
|
||||
### Documentation ###
|
||||
Read [our latest documentation](https://the-asset-importer-lib-documentation.readthedocs.io/en/latest/).
|
||||
|
||||
If you want to check our Model-Database, use the following repo: https://github.com/assimp/assimp-mdb
|
||||
### Pre-built binaries ###
|
||||
Download binaries from [our Itch Projectspace](https://kimkulling.itch.io/the-asset-importer-lib).
|
||||
|
||||
### Test data ###
|
||||
Clone [our model database for testing purposes](https://github.com/assimp/assimp-mdb).
|
||||
|
||||
### Communities ###
|
||||
- Ask questions at [the Assimp Discussion Board](https://github.com/assimp/assimp/discussions).
|
||||
- Find us on [discord](https://discord.gg/kKazXMXDy2)
|
||||
- Ask [the Assimp community on Reddit](https://www.reddit.com/r/Assimp/).
|
||||
- Ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest).
|
||||
- Nothing has worked? File a question or an issue report at [The Assimp-Issue Tracker](https://github.com/assimp/assimp/issues)
|
||||
|
||||
#### Supported file formats ####
|
||||
You can find the complete list of supported file-formats [here](https://github.com/assimp/assimp/blob/master/doc/Fileformats.md)
|
||||
See [the complete list of supported formats](https://github.com/assimp/assimp/blob/master/doc/Fileformats.md).
|
||||
|
||||
### Building ###
|
||||
Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file. We are available in vcpkg, and our build system is CMake; if you used CMake before there is a good chance you know what to do.
|
||||
Start by reading [our build instructions](https://github.com/assimp/assimp/blob/master/Build.md). We are available in vcpkg, and our build system is CMake; if you used CMake before there is a good chance you know what to do.
|
||||
|
||||
### Ports ###
|
||||
* [Android](port/AndroidJNI/README.md)
|
||||
* [Python](port/PyAssimp/README.md)
|
||||
* [.NET](https://bitbucket.org/Starnick/assimpnet/src/master/)
|
||||
* [.NET](https://github.com/Saalvage/AssimpNetter)
|
||||
* [Pascal](port/AssimpPascal/Readme.md)
|
||||
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
|
||||
* [Javascript/Node.js Interface](https://github.com/kovacsv/assimpjs)
|
||||
* [Unity 3d Plugin](https://ricardoreis.net/trilib-2/)
|
||||
* [Unreal Engine Plugin](https://github.com/irajsb/UE4_Assimp/)
|
||||
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (current [status](https://github.com/kotlin-graphics/assimp/wiki/Status))
|
||||
* [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.
|
||||
* [Rust](https://github.com/jkvargas/russimp)
|
||||
|
||||
### Other tools ###
|
||||
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
|
||||
[Qt5-ModelViewer](https://github.com/sharjith/ModelViewer-Qt5) is a powerful viewer based on Qt5 and Assimp's import and export abilities.<br>
|
||||
[Assimp-Viewer](https://github.com/assimp/assimp_view) is an experimental implementation for an Asset-Viewer based on ImGUI and Assimp (experimental).
|
||||
|
||||
#### Repository structure ####
|
||||
Open Asset Import Library is implemented in C++. The directory structure looks like:
|
||||
Open Asset Import Library is implemented in C++. The directory structure looks like this:
|
||||
|
||||
/code Source code
|
||||
/contrib Third-party libraries
|
||||
/doc Documentation (doxysource and pre-compiled docs)
|
||||
/doc Documentation (Doxygen source and pre-compiled docs)
|
||||
/fuzz Contains the test code for the Google Fuzzer project
|
||||
/include Public header C and C++ header files
|
||||
/scripts Scripts used to generate the loading code for some formats
|
||||
/scripts Scripts are used to generate the loading code for some formats
|
||||
/port Ports to other languages and scripts to maintain those.
|
||||
/test Unit- and regression tests, test suite of models
|
||||
/tools Tools (old assimp viewer, command line `assimp`)
|
||||
/samples A small number of samples to illustrate possible
|
||||
use cases for Assimp
|
||||
/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/AssetLib/<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.
|
||||
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
|
||||
|
||||
If the docs don't solve your problem, ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
|
||||
|
||||
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
|
||||
|
||||
And we also have a Gitter-channel:Gitter [](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
|
||||
code/Common The base implementation for importers and the infrastructure
|
||||
code/CApi Special implementations which are only used for the C-API
|
||||
code/Geometry A collection of geometry tools
|
||||
code/Material The material system
|
||||
code/PBR An exporter for physical-based models
|
||||
code/PostProcessing The post-processing steps
|
||||
code/AssetLib/<FormatName> Implementation for import and export of the format
|
||||
|
||||
### Contributing ###
|
||||
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
|
||||
We would greatly appreciate for you to contribute to assimp. The easiest way to get involved is to submit
|
||||
a pull request with your changes against the main repository's `master` branch.
|
||||
|
||||
## Contributors
|
||||
@@ -105,7 +105,7 @@ Become a financial contributor and help us sustain our community. [[Contribute](
|
||||
|
||||
#### Organizations
|
||||
|
||||
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/assimp/contribute)]
|
||||
You can support the project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/assimp/contribute)]
|
||||
|
||||
<a href="https://opencollective.com/assimp/organization/0/website"><img src="https://opencollective.com/assimp/organization/0/avatar.svg"></a>
|
||||
|
||||
@@ -115,6 +115,3 @@ Our license is based on the modified, __3-clause BSD__-License.
|
||||
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
|
||||
and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you may link statically to Assimp.
|
||||
For the legal details, see the `LICENSE` file.
|
||||
|
||||
### Why this name ###
|
||||
Sorry, we're germans :-), no english native speakers ...
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The current version of Assimp that's being supported with security updates:
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 6.0.2 | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you have found any security vulnerability you can contact us via
|
||||
kim.kulling@assimp.org
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Creates source debian files and manages library dependencies
|
||||
#
|
||||
# Features:
|
||||
#
|
||||
#
|
||||
# - Automatically generates symbols and run-time dependencies from the build dependencies
|
||||
# - Custom copy of source directory via CPACK_DEBIAN_PACKAGE_SOURCE_COPY
|
||||
# - Simultaneous output of multiple debian source packages for each distribution
|
||||
@@ -114,7 +114,6 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES})
|
||||
endif( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER} )
|
||||
endif( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
|
||||
|
||||
|
||||
file(APPEND ${DEBIAN_CONTROL} "\n"
|
||||
"Standards-Version: 3.8.4\n"
|
||||
"Homepage: ${CPACK_PACKAGE_VENDOR}\n"
|
||||
@@ -173,7 +172,7 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES})
|
||||
endforeach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS})
|
||||
endif( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER} )
|
||||
endif( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
|
||||
|
||||
|
||||
file(APPEND ${DEBIAN_CONTROL} "\n"
|
||||
"Description: ${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n"
|
||||
"${DEB_LONG_DESCRIPTION}"
|
||||
|
||||
@@ -26,7 +26,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||
getenv_path(DIRECTX_BASE)
|
||||
|
||||
# construct search paths
|
||||
set(DirectX_PREFIX_PATH
|
||||
set(DirectX_PREFIX_PATH
|
||||
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
|
||||
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
|
||||
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
|
||||
@@ -55,7 +55,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||
endif(CMAKE_CL_64)
|
||||
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_DXERR_LIBRARY NAMES DxErr DxErr9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||
find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
|
||||
findpkg_finish(DirectX)
|
||||
set(DirectX_LIBRARIES ${DirectX_LIBRARIES}
|
||||
set(DirectX_LIBRARIES ${DirectX_LIBRARIES}
|
||||
${DirectX_D3DX9_LIBRARY}
|
||||
${DirectX_DXERR_LIBRARY}
|
||||
${DirectX_DXGUID_LIBRARY}
|
||||
@@ -82,7 +82,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||
get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH)
|
||||
message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}")
|
||||
find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
|
||||
set(DirectX_D3D11_FOUND TRUE)
|
||||
set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR})
|
||||
@@ -92,8 +92,8 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||
${DirectX_DXGI_LIBRARY}
|
||||
${DirectX_DXERR_LIBRARY}
|
||||
${DirectX_DXGUID_LIBRARY}
|
||||
${DirectX_D3DCOMPILER_LIBRARY}
|
||||
)
|
||||
${DirectX_D3DCOMPILER_LIBRARY}
|
||||
)
|
||||
endif ()
|
||||
mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY)
|
||||
endif ()
|
||||
|
||||
@@ -54,7 +54,7 @@ macro(clear_if_changed TESTVAR)
|
||||
set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
|
||||
endforeach(var)
|
||||
endif ()
|
||||
set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE)
|
||||
set(${TESTVAR}_INT_CHECK "${${TESTVAR}}" CACHE INTERNAL "x" FORCE)
|
||||
endmacro(clear_if_changed)
|
||||
|
||||
# Try to get some hints from pkg-config, if available
|
||||
|
||||
@@ -3,7 +3,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(ASSIMP_ARCHITECTURE "32")
|
||||
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
|
||||
|
||||
if(WIN32)
|
||||
set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory")
|
||||
|
||||
@@ -17,29 +17,29 @@ if(WIN32)
|
||||
|
||||
if(MSVC12)
|
||||
set(ASSIMP_MSVC_VERSION "vc120")
|
||||
elseif(MSVC14)
|
||||
elseif(MSVC14)
|
||||
set(ASSIMP_MSVC_VERSION "vc140")
|
||||
endif(MSVC12)
|
||||
|
||||
|
||||
if(MSVC12 OR MSVC14)
|
||||
|
||||
|
||||
find_path(ASSIMP_LIBRARY_DIR
|
||||
NAMES
|
||||
assimp-${ASSIMP_MSVC_VERSION}-mt.lib
|
||||
HINTS
|
||||
${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}
|
||||
)
|
||||
|
||||
|
||||
find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib PATHS ${ASSIMP_LIBRARY_DIR})
|
||||
find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib PATHS ${ASSIMP_LIBRARY_DIR})
|
||||
|
||||
set(ASSIMP_LIBRARY
|
||||
|
||||
set(ASSIMP_LIBRARY
|
||||
optimized ${ASSIMP_LIBRARY_RELEASE}
|
||||
debug ${ASSIMP_LIBRARY_DEBUG}
|
||||
)
|
||||
|
||||
|
||||
set(ASSIMP_LIBRARIES "ASSIMP_LIBRARY_RELEASE" "ASSIMP_LIBRARY_DEBUG")
|
||||
|
||||
|
||||
FUNCTION(ASSIMP_COPY_BINARIES TargetDirectory)
|
||||
ADD_CUSTOM_TARGET(AssimpCopyBinaries
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll
|
||||
@@ -47,9 +47,37 @@ if(WIN32)
|
||||
COMMENT "Copying Assimp binaries to '${TargetDirectory}'"
|
||||
VERBATIM)
|
||||
ENDFUNCTION(ASSIMP_COPY_BINARIES)
|
||||
|
||||
|
||||
if (NOT TARGET ASSIMP)
|
||||
set(INCLUDE_DIRS ${ASSIMP_ROOT_DIR}/include)
|
||||
|
||||
find_library(ASSIMP_LIB_DEBUG
|
||||
NAMES assimp-${ASSIMP_MSVC_VERSION}-mtd.lib
|
||||
PATHS ${ASSIMP_LIBRARY_DIR})
|
||||
|
||||
find_file(ASSIMP_DLL_DEBUG
|
||||
NAMES assimp-${ASSIMP_MSVC_VERSION}-mtd.dll
|
||||
PATHS ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE})
|
||||
|
||||
find_library(ASSIMP_LIB_RELEASE
|
||||
NAMES assimp-${ASSIMP_MSVC_VERSION}-mt.lib
|
||||
PATHS ${ASSIMP_LIBRARY_DIR})
|
||||
|
||||
find_file(ASSIMP_DLL_RELEASE
|
||||
NAMES assimp-${ASSIMP_MSVC_VERSION}-mt.dll
|
||||
PATHS ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE})
|
||||
|
||||
add_library(ASSIMP SHARED IMPORTED)
|
||||
set_target_properties(ASSIMP PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INCLUDE_DIRS}"
|
||||
IMPORTED_IMPLIB_DEBUG ${ASSIMP_LIB_DEBUG}
|
||||
IMPORTED_IMPLIB_RELEASE ${ASSIMP_LIB_RELEASE}
|
||||
IMPORTED_LOCATION_DEBUG ${ASSIMP_DLL_DEBUG}
|
||||
IMPORTED_LOCATION_RELEASE ${ASSIMP_DLL_RELEASE}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
else(WIN32)
|
||||
|
||||
find_path(
|
||||
@@ -81,5 +109,5 @@ else(WIN32)
|
||||
message(FATAL_ERROR "Could not find asset importer library")
|
||||
endif (assimp_FIND_REQUIRED)
|
||||
endif (assimp_FOUND)
|
||||
|
||||
|
||||
endif(WIN32)
|
||||
|
||||
@@ -22,45 +22,16 @@
|
||||
# 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_ERROR_PAGE "https://docs.hunter.sh/en/latest/reference/errors")
|
||||
set(HUNTER_ERROR_PAGE "https://hunter.readthedocs.io/en/latest/reference/errors")
|
||||
|
||||
function(hunter_gate_status_print)
|
||||
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
|
||||
|
||||
@@ -9,14 +9,14 @@ MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar
|
||||
OBJECT_OUTPUTS "${PrecompiledBinary}")
|
||||
|
||||
# Do not consider .c files
|
||||
foreach(fname ${Sources})
|
||||
foreach(fname ${Sources})
|
||||
GET_FILENAME_COMPONENT(fext ${fname} EXT)
|
||||
if(fext STREQUAL ".cpp")
|
||||
SET_SOURCE_FILES_PROPERTIES(${fname}
|
||||
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
|
||||
OBJECT_DEPENDS "${PrecompiledBinary}")
|
||||
OBJECT_DEPENDS "${PrecompiledBinary}")
|
||||
endif(fext STREQUAL ".cpp")
|
||||
endforeach(fname)
|
||||
endforeach(fname)
|
||||
|
||||
ENDIF(MSVC)
|
||||
# Add precompiled header to SourcesVar
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# See <http://EditorConfig.org> for details
|
||||
|
||||
[*.{h,hpp,c,cpp}]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -52,27 +52,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <cctype>
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static const unsigned int NotSet = 0xcdcdcdcd;
|
||||
static constexpr unsigned int NotSet = 0xcdcdcdcd;
|
||||
|
||||
using namespace D3DS;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Setup final material indices, generae a default material if necessary
|
||||
// Setup final material indices, generate a default material if necessary
|
||||
void Discreet3DSImporter::ReplaceDefaultMaterial() {
|
||||
// Try to find an existing material that matches the
|
||||
// typical default material setting:
|
||||
// - no textures
|
||||
// - diffuse color (in grey!)
|
||||
// NOTE: This is here to workaround the fact that some
|
||||
// NOTE: This is here to work-around the fact that some
|
||||
// exporters are writing a default material, too.
|
||||
unsigned int idx(NotSet);
|
||||
for (unsigned int i = 0; i < mScene->mMaterials.size(); ++i) {
|
||||
std::string s = mScene->mMaterials[i].mName;
|
||||
for (char & it : s) {
|
||||
auto s = mScene->mMaterials[i].mName;
|
||||
for (char &it : s) {
|
||||
it = static_cast<char>(::tolower(static_cast<unsigned char>(it)));
|
||||
}
|
||||
|
||||
if (std::string::npos == s.find("default")) continue;
|
||||
if (std::string::npos == s.find("default")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mScene->mMaterials[i].mDiffuse.r !=
|
||||
mScene->mMaterials[i].mDiffuse.g ||
|
||||
@@ -85,25 +89,22 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
|
||||
idx = i;
|
||||
}
|
||||
if (NotSet == idx) {
|
||||
idx = (unsigned int)mScene->mMaterials.size();
|
||||
idx = static_cast<unsigned int>(mScene->mMaterials.size());
|
||||
}
|
||||
|
||||
// now iterate through all meshes and through all faces and
|
||||
// find all faces that are using the default material
|
||||
unsigned int cnt = 0;
|
||||
for (std::vector<D3DS::Mesh>::iterator
|
||||
i = mScene->mMeshes.begin();
|
||||
i != mScene->mMeshes.end(); ++i) {
|
||||
for (std::vector<unsigned int>::iterator
|
||||
a = (*i).mFaceMaterials.begin();
|
||||
a != (*i).mFaceMaterials.end(); ++a) {
|
||||
for (auto i = mScene->mMeshes.begin(); i != mScene->mMeshes.end(); ++i) {
|
||||
for (auto a = i->mFaceMaterials.begin(); a != i->mFaceMaterials.end(); ++a) {
|
||||
// NOTE: The additional check seems to be necessary,
|
||||
// some exporters seem to generate invalid data here
|
||||
if (0xcdcdcdcd == (*a)) {
|
||||
(*a) = idx;
|
||||
|
||||
if (NotSet == *a) {
|
||||
*a = idx;
|
||||
++cnt;
|
||||
} else if ((*a) >= mScene->mMaterials.size()) {
|
||||
(*a) = idx;
|
||||
*a = idx;
|
||||
ASSIMP_LOG_WARN("Material index overflow in 3DS file. Using default material");
|
||||
++cnt;
|
||||
}
|
||||
@@ -111,7 +112,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
|
||||
}
|
||||
if (cnt && idx == mScene->mMaterials.size()) {
|
||||
// We need to create our own default material
|
||||
D3DS::Material sMat("%%%DEFAULT");
|
||||
Material sMat("%%%DEFAULT");
|
||||
sMat.mDiffuse = aiColor3D(0.3f, 0.3f, 0.3f);
|
||||
mScene->mMaterials.push_back(sMat);
|
||||
|
||||
@@ -121,17 +122,17 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Check whether all indices are valid. Otherwise we'd crash before the validation step is reached
|
||||
void Discreet3DSImporter::CheckIndices(D3DS::Mesh &sMesh) {
|
||||
for (std::vector<D3DS::Face>::iterator i = sMesh.mFaces.begin(); i != sMesh.mFaces.end(); ++i) {
|
||||
void Discreet3DSImporter::CheckIndices(Mesh &sMesh) {
|
||||
for (auto i = sMesh.mFaces.begin(); i != sMesh.mFaces.end(); ++i) {
|
||||
// check whether all indices are in range
|
||||
for (unsigned int a = 0; a < 3; ++a) {
|
||||
if ((*i).mIndices[a] >= sMesh.mPositions.size()) {
|
||||
ASSIMP_LOG_WARN("3DS: Vertex index overflow)");
|
||||
(*i).mIndices[a] = (uint32_t)sMesh.mPositions.size() - 1;
|
||||
(*i).mIndices[a] = static_cast<uint32_t>(sMesh.mPositions.size() - 1);
|
||||
}
|
||||
if (!sMesh.mTexCoords.empty() && (*i).mIndices[a] >= sMesh.mTexCoords.size()) {
|
||||
ASSIMP_LOG_WARN("3DS: Texture coordinate index overflow)");
|
||||
(*i).mIndices[a] = (uint32_t)sMesh.mTexCoords.size() - 1;
|
||||
(*i).mIndices[a] = static_cast<uint32_t>(sMesh.mTexCoords.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,7 +140,7 @@ void Discreet3DSImporter::CheckIndices(D3DS::Mesh &sMesh) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Generate out unique verbose format representation
|
||||
void Discreet3DSImporter::MakeUnique(D3DS::Mesh &sMesh) {
|
||||
void Discreet3DSImporter::MakeUnique(Mesh &sMesh) {
|
||||
// TODO: really necessary? I don't think. Just a waste of memory and time
|
||||
// to do it now in a separate buffer.
|
||||
|
||||
@@ -150,7 +151,7 @@ void Discreet3DSImporter::MakeUnique(D3DS::Mesh &sMesh) {
|
||||
vNew2.resize(sMesh.mFaces.size() * 3);
|
||||
|
||||
for (unsigned int i = 0, base = 0; i < sMesh.mFaces.size(); ++i) {
|
||||
D3DS::Face &face = sMesh.mFaces[i];
|
||||
Face &face = sMesh.mFaces[i];
|
||||
|
||||
// Positions
|
||||
for (unsigned int a = 0; a < 3; ++a, ++base) {
|
||||
@@ -167,10 +168,9 @@ void Discreet3DSImporter::MakeUnique(D3DS::Mesh &sMesh) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Convert a 3DS texture to texture keys in an aiMaterial
|
||||
void CopyTexture(aiMaterial &mat, D3DS::Texture &texture, aiTextureType type) {
|
||||
void CopyTexture(aiMaterial &mat, Texture &texture, aiTextureType type) {
|
||||
// Setup the texture name
|
||||
aiString tex;
|
||||
tex.Set(texture.mMapName);
|
||||
aiString tex(texture.mMapName);
|
||||
mat.AddProperty(&tex, AI_MATKEY_TEXTURE(type, 0));
|
||||
|
||||
// Setup the texture blend factor
|
||||
@@ -197,13 +197,11 @@ void CopyTexture(aiMaterial &mat, D3DS::Texture &texture, aiTextureType type) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Convert a 3DS material to an aiMaterial
|
||||
void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
||||
aiMaterial &mat) {
|
||||
void Discreet3DSImporter::ConvertMaterial(Material &oldMat, aiMaterial &mat) {
|
||||
// NOTE: Pass the background image to the viewer by bypassing the
|
||||
// material system. This is an evil hack, never do it again!
|
||||
if (0 != mBackgroundImage.length() && bHasBG) {
|
||||
aiString tex;
|
||||
tex.Set(mBackgroundImage);
|
||||
if (mBackgroundImage.empty() && bHasBG) {
|
||||
aiString tex(mBackgroundImage);
|
||||
mat.AddProperty(&tex, AI_MATKEY_GLOBAL_BACKGROUND_IMAGE);
|
||||
|
||||
// Be sure this is only done for the first material
|
||||
@@ -215,8 +213,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
||||
oldMat.mAmbient.g += mClrAmbient.g;
|
||||
oldMat.mAmbient.b += mClrAmbient.b;
|
||||
|
||||
aiString name;
|
||||
name.Set(oldMat.mName);
|
||||
aiString name(oldMat.mName);
|
||||
mat.AddProperty(&name, AI_MATKEY_NAME);
|
||||
|
||||
// Material colors
|
||||
@@ -226,10 +223,9 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
||||
mat.AddProperty(&oldMat.mEmissive, 1, AI_MATKEY_COLOR_EMISSIVE);
|
||||
|
||||
// Phong shininess and shininess strength
|
||||
if (D3DS::Discreet3DS::Phong == oldMat.mShading ||
|
||||
D3DS::Discreet3DS::Metal == oldMat.mShading) {
|
||||
if (Discreet3DS::Phong == oldMat.mShading || Discreet3DS::Metal == oldMat.mShading) {
|
||||
if (!oldMat.mSpecularExponent || !oldMat.mShininessStrength) {
|
||||
oldMat.mShading = D3DS::Discreet3DS::Gouraud;
|
||||
oldMat.mShading = Discreet3DS::Gouraud;
|
||||
} else {
|
||||
mat.AddProperty(&oldMat.mSpecularExponent, 1, AI_MATKEY_SHININESS);
|
||||
mat.AddProperty(&oldMat.mShininessStrength, 1, AI_MATKEY_SHININESS_STRENGTH);
|
||||
@@ -251,39 +247,41 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
||||
// Shading mode
|
||||
aiShadingMode eShading = aiShadingMode_NoShading;
|
||||
switch (oldMat.mShading) {
|
||||
case D3DS::Discreet3DS::Flat:
|
||||
case Discreet3DS::Flat:
|
||||
eShading = aiShadingMode_Flat;
|
||||
break;
|
||||
|
||||
// I don't know what "Wire" shading should be,
|
||||
// assume it is simple lambertian diffuse shading
|
||||
case D3DS::Discreet3DS::Wire: {
|
||||
case Discreet3DS::Wire: {
|
||||
// Set the wireframe flag
|
||||
unsigned int iWire = 1;
|
||||
mat.AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME);
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
||||
case D3DS::Discreet3DS::Gouraud:
|
||||
case Discreet3DS::Gouraud:
|
||||
eShading = aiShadingMode_Gouraud;
|
||||
break;
|
||||
|
||||
// assume cook-torrance shading for metals.
|
||||
case D3DS::Discreet3DS::Phong:
|
||||
case Discreet3DS::Phong:
|
||||
eShading = aiShadingMode_Phong;
|
||||
break;
|
||||
|
||||
case D3DS::Discreet3DS::Metal:
|
||||
case Discreet3DS::Metal:
|
||||
eShading = aiShadingMode_CookTorrance;
|
||||
break;
|
||||
|
||||
// FIX to workaround a warning with GCC 4 who complained
|
||||
// about a missing case Blinn: here - Blinn isn't a valid
|
||||
// value in the 3DS Loader, it is just needed for ASE
|
||||
case D3DS::Discreet3DS::Blinn:
|
||||
case Discreet3DS::Blinn:
|
||||
eShading = aiShadingMode_Blinn;
|
||||
break;
|
||||
}
|
||||
int eShading_ = static_cast<int>(eShading);
|
||||
|
||||
const int eShading_ = eShading;
|
||||
mat.AddProperty<int>(&eShading_, 1, AI_MATKEY_SHADING_MODEL);
|
||||
|
||||
// DIFFUSE texture
|
||||
@@ -332,7 +330,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene *pcOut) {
|
||||
aiString name;
|
||||
|
||||
// we need to split all meshes by their materials
|
||||
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(); i != mScene->mMeshes.end(); ++i) {
|
||||
for (auto i = mScene->mMeshes.begin(); i != mScene->mMeshes.end(); ++i) {
|
||||
std::unique_ptr<std::vector<unsigned int>[]> aiSplit(new std::vector<unsigned int>[mScene->mMaterials.size()]);
|
||||
|
||||
name.length = ASSIMP_itoa10(name.data, num++);
|
||||
@@ -347,7 +345,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene *pcOut) {
|
||||
if (aiSplit[p].empty()) {
|
||||
continue;
|
||||
}
|
||||
aiMesh *meshOut = new aiMesh();
|
||||
auto *meshOut = new aiMesh();
|
||||
meshOut->mName = name;
|
||||
meshOut->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
||||
|
||||
@@ -359,7 +357,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene *pcOut) {
|
||||
avOutMeshes.push_back(meshOut);
|
||||
|
||||
// convert vertices
|
||||
meshOut->mNumFaces = (unsigned int)aiSplit[p].size();
|
||||
meshOut->mNumFaces = static_cast<unsigned int>(aiSplit[p].size());
|
||||
meshOut->mNumVertices = meshOut->mNumFaces * 3;
|
||||
|
||||
// allocate enough storage for faces
|
||||
@@ -407,8 +405,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene *pcOut) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Add a node to the scenegraph and setup its final transformation
|
||||
void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
D3DS::Node *pcIn, aiMatrix4x4 & /*absTrafo*/) {
|
||||
void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut, D3DS::Node *pcIn, aiMatrix4x4 & /*absTrafo*/) {
|
||||
std::vector<unsigned int> iArray;
|
||||
iArray.reserve(3);
|
||||
|
||||
@@ -416,7 +413,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
|
||||
// Find all meshes with the same name as the node
|
||||
for (unsigned int a = 0; a < pcSOut->mNumMeshes; ++a) {
|
||||
const D3DS::Mesh *pcMesh = (const D3DS::Mesh *)pcSOut->mMeshes[a]->mColors[0];
|
||||
const auto *pcMesh = (const D3DS::Mesh *)pcSOut->mMeshes[a]->mColors[0];
|
||||
ai_assert(nullptr != pcMesh);
|
||||
|
||||
if (pcIn->mName == pcMesh->mName)
|
||||
@@ -425,7 +422,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
if (!iArray.empty()) {
|
||||
// The matrix should be identical for all meshes with the
|
||||
// same name. It HAS to be identical for all meshes .....
|
||||
D3DS::Mesh *imesh = ((D3DS::Mesh *)pcSOut->mMeshes[iArray[0]]->mColors[0]);
|
||||
auto *imesh = ((D3DS::Mesh *)pcSOut->mMeshes[iArray[0]]->mColors[0]);
|
||||
|
||||
// Compute the inverse of the transformation matrix to move the
|
||||
// vertices back to their relative and local space
|
||||
@@ -434,7 +431,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
mInvTransposed.Transpose();
|
||||
aiVector3D pivot = pcIn->vPivot;
|
||||
|
||||
pcOut->mNumMeshes = (unsigned int)iArray.size();
|
||||
pcOut->mNumMeshes = static_cast<unsigned int>(iArray.size());
|
||||
pcOut->mMeshes = new unsigned int[iArray.size()];
|
||||
for (unsigned int i = 0; i < iArray.size(); ++i) {
|
||||
const unsigned int iIndex = iArray[i];
|
||||
@@ -453,7 +450,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
|
||||
// Handle negative transformation matrix determinant -> invert vertex x
|
||||
if (imesh->mMat.Determinant() < 0.0f) {
|
||||
/* we *must* have normals */
|
||||
// we *must* have normals
|
||||
for (pvCurrent = mesh->mVertices, t2 = mesh->mNormals; pvCurrent != pvEnd; ++pvCurrent, ++t2) {
|
||||
pvCurrent->x *= -1.f;
|
||||
t2->x *= -1.f;
|
||||
@@ -493,7 +490,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
if (pcIn->aRotationKeys.size()) {
|
||||
|
||||
// FIX to get to Assimp's quaternion conventions
|
||||
for (std::vector<aiQuatKey>::iterator it = pcIn->aRotationKeys.begin(); it != pcIn->aRotationKeys.end(); ++it) {
|
||||
for (auto it = pcIn->aRotationKeys.begin(); it != pcIn->aRotationKeys.end(); ++it) {
|
||||
(*it).mValue.w *= -1.f;
|
||||
}
|
||||
|
||||
@@ -592,7 +589,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
|
||||
// Cameras or lights define their transformation in their parent node and in the
|
||||
// corresponding light or camera chunks. However, we read and process the latter
|
||||
// to to be able to return valid cameras/lights even if no scenegraph is given.
|
||||
// to be able to return valid cameras/lights even if no scenegraph is given.
|
||||
for (unsigned int n = 0; n < pcSOut->mNumCameras; ++n) {
|
||||
if (pcSOut->mCameras[n]->mName == pcOut->mName) {
|
||||
pcSOut->mCameras[n]->mLookAt = aiVector3D(0.f, 0.f, 1.f);
|
||||
@@ -605,11 +602,11 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
}
|
||||
|
||||
// Allocate a new node anim and setup its name
|
||||
aiNodeAnim *nda = anim->mChannels[anim->mNumChannels++] = new aiNodeAnim();
|
||||
auto *nda = anim->mChannels[anim->mNumChannels++] = new aiNodeAnim();
|
||||
nda->mNodeName.Set(pcIn->mName);
|
||||
|
||||
// POSITION keys
|
||||
if (pcIn->aPositionKeys.size() > 0) {
|
||||
if (!pcIn->aPositionKeys.empty()) {
|
||||
nda->mNumPositionKeys = (unsigned int)pcIn->aPositionKeys.size();
|
||||
nda->mPositionKeys = new aiVectorKey[nda->mNumPositionKeys];
|
||||
::memcpy(nda->mPositionKeys, &pcIn->aPositionKeys[0],
|
||||
@@ -617,7 +614,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
}
|
||||
|
||||
// ROTATION keys
|
||||
if (pcIn->aRotationKeys.size() > 0) {
|
||||
if (!pcIn->aRotationKeys.empty()) {
|
||||
nda->mNumRotationKeys = (unsigned int)pcIn->aRotationKeys.size();
|
||||
nda->mRotationKeys = new aiQuatKey[nda->mNumRotationKeys];
|
||||
|
||||
@@ -633,7 +630,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
}
|
||||
|
||||
// SCALING keys
|
||||
if (pcIn->aScalingKeys.size() > 0) {
|
||||
if (!pcIn->aScalingKeys.empty()) {
|
||||
nda->mNumScalingKeys = (unsigned int)pcIn->aScalingKeys.size();
|
||||
nda->mScalingKeys = new aiVectorKey[nda->mNumScalingKeys];
|
||||
::memcpy(nda->mScalingKeys, &pcIn->aScalingKeys[0],
|
||||
@@ -642,11 +639,17 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
||||
}
|
||||
|
||||
// Allocate storage for children
|
||||
pcOut->mNumChildren = (unsigned int)pcIn->mChildren.size();
|
||||
const auto size = static_cast<unsigned int>(pcIn->mChildren.size());
|
||||
|
||||
pcOut->mNumChildren = size;
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
pcOut->mChildren = new aiNode *[pcIn->mChildren.size()];
|
||||
|
||||
// Recursively process all children
|
||||
const unsigned int size = static_cast<unsigned int>(pcIn->mChildren.size());
|
||||
|
||||
for (unsigned int i = 0; i < size; ++i) {
|
||||
pcOut->mChildren[i] = new aiNode();
|
||||
pcOut->mChildren[i]->mParent = pcOut;
|
||||
@@ -679,7 +682,7 @@ void CountTracks(D3DS::Node *node, unsigned int &cnt) {
|
||||
// Generate the output node graph
|
||||
void Discreet3DSImporter::GenerateNodeGraph(aiScene *pcOut) {
|
||||
pcOut->mRootNode = new aiNode();
|
||||
if (0 == mRootNode->mChildren.size()) {
|
||||
if (mRootNode->mChildren.empty()) {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// It seems the file is so messed up that it has not even a hierarchy.
|
||||
// generate a flat hiearachy which looks like this:
|
||||
@@ -708,12 +711,12 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene *pcOut) {
|
||||
pcNode->mNumMeshes = 1;
|
||||
|
||||
// Build a name for the node
|
||||
pcNode->mName.length = ai_snprintf(pcNode->mName.data, MAXLEN, "3DSMesh_%u", i);
|
||||
pcNode->mName.length = ai_snprintf(pcNode->mName.data, AI_MAXLEN, "3DSMesh_%u", i);
|
||||
}
|
||||
|
||||
// Build dummy nodes for all cameras
|
||||
for (unsigned int i = 0; i < (unsigned int)mScene->mCameras.size(); ++i, ++a) {
|
||||
aiNode *pcNode = pcOut->mRootNode->mChildren[a] = new aiNode();
|
||||
auto *pcNode = pcOut->mRootNode->mChildren[a] = new aiNode();
|
||||
pcNode->mParent = pcOut->mRootNode;
|
||||
|
||||
// Build a name for the node
|
||||
@@ -722,7 +725,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene *pcOut) {
|
||||
|
||||
// Build dummy nodes for all lights
|
||||
for (unsigned int i = 0; i < (unsigned int)mScene->mLights.size(); ++i, ++a) {
|
||||
aiNode *pcNode = pcOut->mRootNode->mChildren[a] = new aiNode();
|
||||
auto *pcNode = pcOut->mRootNode->mChildren[a] = new aiNode();
|
||||
pcNode->mParent = pcOut->mRootNode;
|
||||
|
||||
// Build a name for the node
|
||||
@@ -738,7 +741,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene *pcOut) {
|
||||
// Allocate a primary animation channel
|
||||
pcOut->mNumAnimations = 1;
|
||||
pcOut->mAnimations = new aiAnimation *[1];
|
||||
aiAnimation *anim = pcOut->mAnimations[0] = new aiAnimation();
|
||||
auto *anim = pcOut->mAnimations[0] = new aiAnimation();
|
||||
|
||||
anim->mName.Set("3DSMasterAnim");
|
||||
|
||||
@@ -776,12 +779,12 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene *pcOut) {
|
||||
// Convert all meshes in the scene and generate the final output scene.
|
||||
void Discreet3DSImporter::ConvertScene(aiScene *pcOut) {
|
||||
// Allocate enough storage for all output materials
|
||||
pcOut->mNumMaterials = (unsigned int)mScene->mMaterials.size();
|
||||
pcOut->mNumMaterials = static_cast<unsigned int>(mScene->mMaterials.size());
|
||||
pcOut->mMaterials = new aiMaterial *[pcOut->mNumMaterials];
|
||||
|
||||
// ... and convert the 3DS materials to aiMaterial's
|
||||
for (unsigned int i = 0; i < pcOut->mNumMaterials; ++i) {
|
||||
aiMaterial *pcNew = new aiMaterial();
|
||||
auto *pcNew = new aiMaterial();
|
||||
ConvertMaterial(mScene->mMaterials[i], *pcNew);
|
||||
pcOut->mMaterials[i] = pcNew;
|
||||
}
|
||||
@@ -790,18 +793,20 @@ void Discreet3DSImporter::ConvertScene(aiScene *pcOut) {
|
||||
ConvertMeshes(pcOut);
|
||||
|
||||
// Now copy all light sources to the output scene
|
||||
pcOut->mNumLights = (unsigned int)mScene->mLights.size();
|
||||
pcOut->mNumLights = static_cast<unsigned int>(mScene->mLights.size());
|
||||
if (pcOut->mNumLights) {
|
||||
pcOut->mLights = new aiLight *[pcOut->mNumLights];
|
||||
::memcpy(pcOut->mLights, &mScene->mLights[0], sizeof(void *) * pcOut->mNumLights);
|
||||
memcpy(pcOut->mLights, &mScene->mLights[0], sizeof(void *) * pcOut->mNumLights);
|
||||
}
|
||||
|
||||
// Now copy all cameras to the output scene
|
||||
pcOut->mNumCameras = (unsigned int)mScene->mCameras.size();
|
||||
pcOut->mNumCameras = static_cast<unsigned int>(mScene->mCameras.size());
|
||||
if (pcOut->mNumCameras) {
|
||||
pcOut->mCameras = new aiCamera *[pcOut->mNumCameras];
|
||||
::memcpy(pcOut->mCameras, &mScene->mCameras[0], sizeof(void *) * pcOut->mNumCameras);
|
||||
memcpy(pcOut->mCameras, &mScene->mCameras[0], sizeof(void *) * pcOut->mNumCameras);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -52,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/StringComparison.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/Exceptional.h>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
|
||||
#include <memory>
|
||||
@@ -76,33 +76,33 @@ class ChunkWriter {
|
||||
|
||||
public:
|
||||
ChunkWriter(StreamWriterLE &writer, uint16_t chunk_type) :
|
||||
writer(writer) {
|
||||
chunk_start_pos = writer.GetCurrentPos();
|
||||
mWriter(writer) {
|
||||
mChunkStartPos = writer.GetCurrentPos();
|
||||
writer.PutU2(chunk_type);
|
||||
writer.PutU4((uint32_t)CHUNK_SIZE_NOT_SET);
|
||||
}
|
||||
|
||||
~ChunkWriter() {
|
||||
std::size_t head_pos = writer.GetCurrentPos();
|
||||
std::size_t head_pos = mWriter.GetCurrentPos();
|
||||
|
||||
ai_assert(head_pos > chunk_start_pos);
|
||||
const std::size_t chunk_size = head_pos - chunk_start_pos;
|
||||
ai_assert(head_pos > mChunkStartPos);
|
||||
const std::size_t chunk_size = head_pos - mChunkStartPos;
|
||||
|
||||
writer.SetCurrentPos(chunk_start_pos + SIZE_OFFSET);
|
||||
writer.PutU4(static_cast<uint32_t>(chunk_size));
|
||||
writer.SetCurrentPos(head_pos);
|
||||
mWriter.SetCurrentPos(mChunkStartPos + SIZE_OFFSET);
|
||||
mWriter.PutU4(static_cast<uint32_t>(chunk_size));
|
||||
mWriter.SetCurrentPos(head_pos);
|
||||
}
|
||||
|
||||
private:
|
||||
StreamWriterLE &writer;
|
||||
std::size_t chunk_start_pos;
|
||||
StreamWriterLE &mWriter;
|
||||
std::size_t mChunkStartPos;
|
||||
};
|
||||
|
||||
// Return an unique name for a given |mesh| attached to |node| that
|
||||
// preserves the mesh's given name if it has one. |index| is the index
|
||||
// of the mesh in |aiScene::mMeshes|.
|
||||
std::string GetMeshName(const aiMesh &mesh, unsigned int index, const aiNode &node) {
|
||||
static const char underscore = '_';
|
||||
static constexpr char underscore = '_';
|
||||
char postfix[10] = { 0 };
|
||||
ASSIMP_itoa10(postfix, index);
|
||||
|
||||
@@ -122,8 +122,7 @@ std::string GetMaterialName(const aiMaterial &mat, unsigned int index) {
|
||||
char postfix[10] = { 0 };
|
||||
ASSIMP_itoa10(postfix, index);
|
||||
|
||||
aiString mat_name;
|
||||
if (AI_SUCCESS == mat.Get(AI_MATKEY_NAME, mat_name)) {
|
||||
if (aiString mat_name; AI_SUCCESS == mat.Get(AI_MATKEY_NAME, mat_name)) {
|
||||
return mat_name.C_Str() + underscore + postfix;
|
||||
}
|
||||
|
||||
@@ -208,11 +207,6 @@ Discreet3DSExporter::Discreet3DSExporter(std::shared_ptr<IOStream> &outfile, con
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Discreet3DSExporter::~Discreet3DSExporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int Discreet3DSExporter::WriteHierarchy(const aiNode &node, int seq, int sibling_level) {
|
||||
// 3DS scene hierarchy is serialized as in http://www.martinreddy.net/gfx/3d/3DS.spec
|
||||
@@ -308,8 +302,7 @@ void Discreet3DSExporter::WriteMaterials() {
|
||||
WriteColor(color);
|
||||
}
|
||||
|
||||
aiShadingMode shading_mode = aiShadingMode_Flat;
|
||||
if (mat.Get(AI_MATKEY_SHADING_MODEL, shading_mode) == AI_SUCCESS) {
|
||||
if (aiShadingMode shading_mode = aiShadingMode_Flat; mat.Get(AI_MATKEY_SHADING_MODEL, shading_mode) == AI_SUCCESS) {
|
||||
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_SHADING);
|
||||
|
||||
Discreet3DS::shadetype3ds shading_mode_out;
|
||||
@@ -337,7 +330,7 @@ void Discreet3DSExporter::WriteMaterials() {
|
||||
default:
|
||||
shading_mode_out = Discreet3DS::Flat;
|
||||
ai_assert(false);
|
||||
};
|
||||
}
|
||||
writer.PutU2(static_cast<uint16_t>(shading_mode_out));
|
||||
}
|
||||
|
||||
@@ -351,8 +344,7 @@ void Discreet3DSExporter::WriteMaterials() {
|
||||
WritePercentChunk(f);
|
||||
}
|
||||
|
||||
int twosided;
|
||||
if (mat.Get(AI_MATKEY_TWOSIDED, twosided) == AI_SUCCESS && twosided != 0) {
|
||||
if (int twosided; mat.Get(AI_MATKEY_TWOSIDED, twosided) == AI_SUCCESS && twosided != 0) {
|
||||
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_TWO_SIDE);
|
||||
writer.PutI2(1);
|
||||
}
|
||||
@@ -546,7 +538,7 @@ void Discreet3DSExporter::WriteFaceMaterialChunk(const aiMesh &mesh) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Discreet3DSExporter::WriteString(const std::string &s) {
|
||||
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
|
||||
for (auto it = s.begin(); it != s.end(); ++it) {
|
||||
writer.PutI1(*it);
|
||||
}
|
||||
writer.PutI1('\0');
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -57,18 +56,17 @@ struct aiNode;
|
||||
struct aiMaterial;
|
||||
struct aiMesh;
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Helper class to export a given scene to a 3DS file.
|
||||
*/
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
class Discreet3DSExporter {
|
||||
class Discreet3DSExporter final {
|
||||
public:
|
||||
Discreet3DSExporter(std::shared_ptr<IOStream> &outfile, const aiScene* pScene);
|
||||
~Discreet3DSExporter();
|
||||
~Discreet3DSExporter() = default;
|
||||
|
||||
private:
|
||||
void WriteMeshes();
|
||||
@@ -88,9 +86,8 @@ private:
|
||||
|
||||
std::map<const aiNode*, aiMatrix4x4> trafos;
|
||||
|
||||
typedef std::multimap<const aiNode*, unsigned int> MeshesByNodeMap;
|
||||
using MeshesByNodeMap = std::multimap<const aiNode*, unsigned int>;
|
||||
MeshesByNodeMap meshes;
|
||||
|
||||
};
|
||||
|
||||
} // Namespace Assimp
|
||||
|
||||
+10
-129
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -55,8 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/qnan.h>
|
||||
#include <cstdio> //sprintf
|
||||
|
||||
namespace Assimp {
|
||||
namespace D3DS {
|
||||
namespace Assimp::D3DS {
|
||||
|
||||
#include <assimp/Compiler/pushpack1.h>
|
||||
|
||||
@@ -322,7 +320,6 @@ struct Texture {
|
||||
//! Default constructor
|
||||
Texture() AI_NO_EXCEPT
|
||||
: mTextureBlend(0.0f),
|
||||
mMapName(),
|
||||
mOffsetU(0.0),
|
||||
mOffsetV(0.0),
|
||||
mScaleU(1.0),
|
||||
@@ -334,51 +331,11 @@ struct Texture {
|
||||
mTextureBlend = get_qnan();
|
||||
}
|
||||
|
||||
Texture(const Texture &other) :
|
||||
mTextureBlend(other.mTextureBlend),
|
||||
mMapName(other.mMapName),
|
||||
mOffsetU(other.mOffsetU),
|
||||
mOffsetV(other.mOffsetV),
|
||||
mScaleU(other.mScaleU),
|
||||
mScaleV(other.mScaleV),
|
||||
mRotation(other.mRotation),
|
||||
mMapMode(other.mMapMode),
|
||||
bPrivate(other.bPrivate),
|
||||
iUVSrc(other.iUVSrc) {
|
||||
// empty
|
||||
}
|
||||
Texture(const Texture &other) = default;
|
||||
|
||||
Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend),
|
||||
mMapName(std::move(other.mMapName)),
|
||||
mOffsetU(other.mOffsetU),
|
||||
mOffsetV(other.mOffsetV),
|
||||
mScaleU(other.mScaleU),
|
||||
mScaleV(other.mScaleV),
|
||||
mRotation(other.mRotation),
|
||||
mMapMode(other.mMapMode),
|
||||
bPrivate(other.bPrivate),
|
||||
iUVSrc(other.iUVSrc) {
|
||||
// empty
|
||||
}
|
||||
Texture(Texture &&other) AI_NO_EXCEPT = default;
|
||||
|
||||
Texture &operator=(Texture &&other) AI_NO_EXCEPT {
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
mTextureBlend = other.mTextureBlend;
|
||||
mMapName = std::move(other.mMapName);
|
||||
mOffsetU = other.mOffsetU;
|
||||
mOffsetV = other.mOffsetV;
|
||||
mScaleU = other.mScaleU;
|
||||
mScaleV = other.mScaleV;
|
||||
mRotation = other.mRotation;
|
||||
mMapMode = other.mMapMode;
|
||||
bPrivate = other.bPrivate;
|
||||
iUVSrc = other.iUVSrc;
|
||||
|
||||
return *this;
|
||||
}
|
||||
Texture &operator=(Texture &&other) AI_NO_EXCEPT = default;
|
||||
|
||||
//! Specifies the blend factor for the texture
|
||||
ai_real mTextureBlend;
|
||||
@@ -406,14 +363,13 @@ struct Texture {
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Helper structure representing a 3ds material */
|
||||
struct Material {
|
||||
//! Default constructor has been deleted
|
||||
Material() :
|
||||
mName(),
|
||||
mDiffuse(ai_real(0.6), ai_real(0.6), ai_real(0.6)),
|
||||
mDiffuse(0.6f, 0.6f, 0.6f),
|
||||
mSpecularExponent(ai_real(0.0)),
|
||||
mShininessStrength(ai_real(1.0)),
|
||||
mShading(Discreet3DS::Gouraud),
|
||||
@@ -426,7 +382,7 @@ struct Material {
|
||||
//! Constructor with explicit name
|
||||
explicit Material(const std::string &name) :
|
||||
mName(name),
|
||||
mDiffuse(ai_real(0.6), ai_real(0.6), ai_real(0.6)),
|
||||
mDiffuse(0.6f, 0.6f, 0.6f),
|
||||
mSpecularExponent(ai_real(0.0)),
|
||||
mShininessStrength(ai_real(1.0)),
|
||||
mShading(Discreet3DS::Gouraud),
|
||||
@@ -436,83 +392,9 @@ struct Material {
|
||||
// empty
|
||||
}
|
||||
|
||||
Material(const Material &other) :
|
||||
mName(other.mName),
|
||||
mDiffuse(other.mDiffuse),
|
||||
mSpecularExponent(other.mSpecularExponent),
|
||||
mShininessStrength(other.mShininessStrength),
|
||||
mSpecular(other.mSpecular),
|
||||
mAmbient(other.mAmbient),
|
||||
mShading(other.mShading),
|
||||
mTransparency(other.mTransparency),
|
||||
sTexDiffuse(other.sTexDiffuse),
|
||||
sTexOpacity(other.sTexOpacity),
|
||||
sTexSpecular(other.sTexSpecular),
|
||||
sTexReflective(other.sTexReflective),
|
||||
sTexBump(other.sTexBump),
|
||||
sTexEmissive(other.sTexEmissive),
|
||||
sTexShininess(other.sTexShininess),
|
||||
mBumpHeight(other.mBumpHeight),
|
||||
mEmissive(other.mEmissive),
|
||||
sTexAmbient(other.sTexAmbient),
|
||||
mTwoSided(other.mTwoSided) {
|
||||
// empty
|
||||
}
|
||||
Material(const Material &other) = default;
|
||||
|
||||
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
|
||||
Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)),
|
||||
mDiffuse(other.mDiffuse),
|
||||
mSpecularExponent(other.mSpecularExponent),
|
||||
mShininessStrength(other.mShininessStrength),
|
||||
mSpecular(other.mSpecular),
|
||||
mAmbient(other.mAmbient),
|
||||
mShading(other.mShading),
|
||||
mTransparency(other.mTransparency),
|
||||
sTexDiffuse(std::move(other.sTexDiffuse)),
|
||||
sTexOpacity(std::move(other.sTexOpacity)),
|
||||
sTexSpecular(std::move(other.sTexSpecular)),
|
||||
sTexReflective(std::move(other.sTexReflective)),
|
||||
sTexBump(std::move(other.sTexBump)),
|
||||
sTexEmissive(std::move(other.sTexEmissive)),
|
||||
sTexShininess(std::move(other.sTexShininess)),
|
||||
mBumpHeight(other.mBumpHeight),
|
||||
mEmissive(other.mEmissive),
|
||||
sTexAmbient(std::move(other.sTexAmbient)),
|
||||
mTwoSided(other.mTwoSided) {
|
||||
// empty
|
||||
}
|
||||
|
||||
Material &operator=(Material &&other) AI_NO_EXCEPT {
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
mName = std::move(other.mName);
|
||||
mDiffuse = other.mDiffuse;
|
||||
mSpecularExponent = other.mSpecularExponent;
|
||||
mShininessStrength = other.mShininessStrength,
|
||||
mSpecular = other.mSpecular;
|
||||
mAmbient = other.mAmbient;
|
||||
mShading = other.mShading;
|
||||
mTransparency = other.mTransparency;
|
||||
sTexDiffuse = std::move(other.sTexDiffuse);
|
||||
sTexOpacity = std::move(other.sTexOpacity);
|
||||
sTexSpecular = std::move(other.sTexSpecular);
|
||||
sTexReflective = std::move(other.sTexReflective);
|
||||
sTexBump = std::move(other.sTexBump);
|
||||
sTexEmissive = std::move(other.sTexEmissive);
|
||||
sTexShininess = std::move(other.sTexShininess);
|
||||
mBumpHeight = other.mBumpHeight;
|
||||
mEmissive = other.mEmissive;
|
||||
sTexAmbient = std::move(other.sTexAmbient);
|
||||
mTwoSided = other.mTwoSided;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~Material() {
|
||||
// empty
|
||||
}
|
||||
virtual ~Material() = default;
|
||||
|
||||
//! Name of the material
|
||||
std::string mName;
|
||||
@@ -696,7 +578,6 @@ struct Scene {
|
||||
// Node* pcRootNode;
|
||||
};
|
||||
|
||||
} // end of namespace D3DS
|
||||
} // end of namespace Assimp
|
||||
} // end of namespace Assimp::D3DS
|
||||
|
||||
#endif // AI_XFILEHELPER_H_INC
|
||||
|
||||
+196
-193
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -54,9 +54,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
using namespace D3DS;
|
||||
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Discreet 3DS Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -75,7 +77,7 @@ static const aiImporterDesc desc = {
|
||||
// - computes its length
|
||||
#define ASSIMP_3DS_BEGIN_CHUNK() \
|
||||
while (true) { \
|
||||
if (stream->GetRemainingSizeToLimit() < sizeof(Discreet3DS::Chunk)) { \
|
||||
if (mStream->GetRemainingSizeToLimit() < sizeof(Discreet3DS::Chunk)) { \
|
||||
return; \
|
||||
} \
|
||||
Discreet3DS::Chunk chunk; \
|
||||
@@ -83,36 +85,30 @@ static const aiImporterDesc desc = {
|
||||
int chunkSize = chunk.Size - sizeof(Discreet3DS::Chunk); \
|
||||
if (chunkSize <= 0) \
|
||||
continue; \
|
||||
const unsigned int oldReadLimit = stream->SetReadLimit( \
|
||||
stream->GetCurrentPos() + chunkSize);
|
||||
const unsigned int oldReadLimit = mStream->SetReadLimit( \
|
||||
mStream->GetCurrentPos() + chunkSize);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// End a parsing block
|
||||
// Must follow at the end of each parsing block, reset chunk end marker to previous value
|
||||
#define ASSIMP_3DS_END_CHUNK() \
|
||||
stream->SkipToReadLimit(); \
|
||||
stream->SetReadLimit(oldReadLimit); \
|
||||
if (stream->GetRemainingSizeToLimit() == 0) \
|
||||
mStream->SkipToReadLimit(); \
|
||||
mStream->SetReadLimit(oldReadLimit); \
|
||||
if (mStream->GetRemainingSizeToLimit() == 0) \
|
||||
return; \
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
Discreet3DSImporter::Discreet3DSImporter() :
|
||||
stream(), mLastNodeIndex(), mCurrentNode(), mRootNode(), mScene(), mMasterScale(), bHasBG(), bIsPrj() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
Discreet3DSImporter::~Discreet3DSImporter() {
|
||||
mStream(nullptr), mLastNodeIndex(), mCurrentNode(), mRootNode(), mScene(), mMasterScale(), bHasBG(), bIsPrj() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
static const uint16_t token[] = { 0x4d4d, 0x3dc2 /*, 0x3daa */ };
|
||||
static constexpr uint16_t token[] = { 0x4d4d, 0x3dc2 /*, 0x3daa */ };
|
||||
return CheckMagicToken(pIOHandler, pFile, token, AI_COUNT_OF(token), 0, sizeof token[0]);
|
||||
}
|
||||
|
||||
@@ -130,9 +126,7 @@ void Discreet3DSImporter::SetupProperties(const Importer * /*pImp*/) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
||||
aiScene *pScene, IOSystem *pIOHandler) {
|
||||
|
||||
void Discreet3DSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
auto theFile = pIOHandler->Open(pFile, "rb");
|
||||
if (!theFile) {
|
||||
throw DeadlyImportError("3DS: Could not open ", pFile);
|
||||
@@ -144,14 +138,14 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
||||
if (theStream.GetRemainingSize() < 16) {
|
||||
throw DeadlyImportError("3DS file is either empty or corrupt: ", pFile);
|
||||
}
|
||||
this->stream = &theStream;
|
||||
mStream = &theStream;
|
||||
|
||||
// Allocate our temporary 3DS representation
|
||||
D3DS::Scene _scene;
|
||||
Scene _scene;
|
||||
mScene = &_scene;
|
||||
|
||||
// Initialize members
|
||||
D3DS::Node _rootNode("UNNAMED");
|
||||
Node _rootNode("UNNAMED");
|
||||
mLastNodeIndex = -1;
|
||||
mCurrentNode = &_rootNode;
|
||||
mRootNode = mCurrentNode;
|
||||
@@ -172,12 +166,12 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
||||
// vectors from the smoothing groups we read from the
|
||||
// file.
|
||||
for (auto &mesh : mScene->mMeshes) {
|
||||
if (mesh.mFaces.size() > 0 && mesh.mPositions.size() == 0) {
|
||||
if (!mesh.mFaces.empty() && mesh.mPositions.empty()) {
|
||||
throw DeadlyImportError("3DS file contains faces but no vertices: ", pFile);
|
||||
}
|
||||
CheckIndices(mesh);
|
||||
MakeUnique(mesh);
|
||||
ComputeNormalsWithSmoothingsGroups<D3DS::Face>(mesh);
|
||||
ComputeNormalsWithSmoothingsGroups<Face>(mesh);
|
||||
}
|
||||
|
||||
// Replace all occurrences of the default material with a
|
||||
@@ -202,12 +196,12 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
||||
|
||||
AI_DEBUG_INVALIDATE_PTR(mRootNode);
|
||||
AI_DEBUG_INVALIDATE_PTR(mScene);
|
||||
AI_DEBUG_INVALIDATE_PTR(this->stream);
|
||||
AI_DEBUG_INVALIDATE_PTR(mStream);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Applies a master-scaling factor to the imported scene
|
||||
void Discreet3DSImporter::ApplyMasterScale(aiScene *pScene) {
|
||||
void Discreet3DSImporter::ApplyMasterScale(const aiScene *pScene) {
|
||||
// There are some 3DS files with a zero scaling factor
|
||||
if (!mMasterScale)
|
||||
mMasterScale = 1.0f;
|
||||
@@ -229,14 +223,14 @@ void Discreet3DSImporter::ApplyMasterScale(aiScene *pScene) {
|
||||
void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk *pcOut) {
|
||||
ai_assert(pcOut != nullptr);
|
||||
|
||||
pcOut->Flag = stream->GetI2();
|
||||
pcOut->Size = stream->GetI4();
|
||||
pcOut->Flag = mStream->GetI2();
|
||||
pcOut->Size = mStream->GetI4();
|
||||
|
||||
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize()) {
|
||||
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > mStream->GetRemainingSize()) {
|
||||
throw DeadlyImportError("Chunk is too large");
|
||||
}
|
||||
|
||||
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) {
|
||||
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > mStream->GetRemainingSizeToLimit()) {
|
||||
ASSIMP_LOG_ERROR("3DS: Chunk overflow");
|
||||
}
|
||||
}
|
||||
@@ -247,8 +241,7 @@ void Discreet3DSImporter::SkipChunk() {
|
||||
Discreet3DS::Chunk psChunk;
|
||||
ReadChunk(&psChunk);
|
||||
|
||||
stream->IncPtr(psChunk.Size - sizeof(Discreet3DS::Chunk));
|
||||
return;
|
||||
mStream->IncPtr(psChunk.Size - sizeof(Discreet3DS::Chunk));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -265,39 +258,45 @@ void Discreet3DSImporter::ParseMainChunk() {
|
||||
case Discreet3DS::CHUNK_MAIN:
|
||||
ParseEditorChunk();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
ASSIMP_3DS_END_CHUNK();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunreachable-code-return"
|
||||
#endif
|
||||
// recursively continue processing this hierarchy level
|
||||
return ParseMainChunk();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Discreet3DSImporter::ParseEditorChunk() {
|
||||
ASSIMP_3DS_BEGIN_CHUNK();
|
||||
ASSIMP_3DS_BEGIN_CHUNK()
|
||||
|
||||
// get chunk type
|
||||
switch (chunk.Flag) {
|
||||
case Discreet3DS::CHUNK_OBJMESH:
|
||||
case Discreet3DS::CHUNK_OBJMESH:
|
||||
ParseObjectChunk();
|
||||
break;
|
||||
|
||||
ParseObjectChunk();
|
||||
// NOTE: In several documentations in the internet this
|
||||
// chunk appears at different locations
|
||||
case Discreet3DS::CHUNK_KEYFRAMER:
|
||||
ParseKeyframeChunk();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_VERSION: {
|
||||
// print the version number
|
||||
char buff[10];
|
||||
ASSIMP_itoa10(buff, mStream->GetI2());
|
||||
ASSIMP_LOG_INFO("3DS file format version: ", buff);
|
||||
}
|
||||
break;
|
||||
|
||||
// NOTE: In several documentations in the internet this
|
||||
// chunk appears at different locations
|
||||
case Discreet3DS::CHUNK_KEYFRAMER:
|
||||
|
||||
ParseKeyframeChunk();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_VERSION: {
|
||||
// print the version number
|
||||
char buff[10];
|
||||
ASSIMP_itoa10(buff, stream->GetI2());
|
||||
ASSIMP_LOG_INFO("3DS file format version: ", buff);
|
||||
} break;
|
||||
};
|
||||
ASSIMP_3DS_END_CHUNK();
|
||||
ASSIMP_3DS_END_CHUNK()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -308,10 +307,10 @@ void Discreet3DSImporter::ParseObjectChunk() {
|
||||
switch (chunk.Flag) {
|
||||
case Discreet3DS::CHUNK_OBJBLOCK: {
|
||||
unsigned int cnt = 0;
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
const auto *sz = (const char *)mStream->GetPtr();
|
||||
|
||||
// Get the name of the geometry object
|
||||
while (stream->GetI1())
|
||||
while (mStream->GetI1())
|
||||
++cnt;
|
||||
ParseChunk(sz, cnt);
|
||||
} break;
|
||||
@@ -319,7 +318,7 @@ void Discreet3DSImporter::ParseObjectChunk() {
|
||||
case Discreet3DS::CHUNK_MAT_MATERIAL:
|
||||
|
||||
// Add a new material to the list
|
||||
mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size()))));
|
||||
mScene->mMaterials.emplace_back(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size())));
|
||||
ParseMaterialChunk();
|
||||
break;
|
||||
|
||||
@@ -339,8 +338,8 @@ void Discreet3DSImporter::ParseObjectChunk() {
|
||||
// Specifies the background image. The string should already be
|
||||
// properly 0 terminated but we need to be sure
|
||||
unsigned int cnt = 0;
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
while (stream->GetI1())
|
||||
auto *sz = (const char *)mStream->GetPtr();
|
||||
while (mStream->GetI1())
|
||||
++cnt;
|
||||
mBackgroundImage = std::string(sz, cnt);
|
||||
} break;
|
||||
@@ -351,7 +350,7 @@ void Discreet3DSImporter::ParseObjectChunk() {
|
||||
|
||||
case Discreet3DS::CHUNK_MASTER_SCALE:
|
||||
// Scene master scaling factor
|
||||
mMasterScale = stream->GetF4();
|
||||
mMasterScale = mStream->GetF4();
|
||||
break;
|
||||
};
|
||||
ASSIMP_3DS_END_CHUNK();
|
||||
@@ -364,13 +363,13 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
|
||||
// IMPLEMENTATION NOTE;
|
||||
// Cameras or lights define their transformation in their parent node and in the
|
||||
// corresponding light or camera chunks. However, we read and process the latter
|
||||
// to to be able to return valid cameras/lights even if no scenegraph is given.
|
||||
// to be able to return valid cameras/lights even if no scenegraph is given.
|
||||
|
||||
// get chunk type
|
||||
switch (chunk.Flag) {
|
||||
case Discreet3DS::CHUNK_TRIMESH: {
|
||||
// this starts a new triangle mesh
|
||||
mScene->mMeshes.push_back(D3DS::Mesh(std::string(name, num)));
|
||||
mScene->mMeshes.emplace_back(std::string(name, num));
|
||||
|
||||
// Read mesh chunks
|
||||
ParseMeshChunk();
|
||||
@@ -378,15 +377,15 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
|
||||
|
||||
case Discreet3DS::CHUNK_LIGHT: {
|
||||
// This starts a new light
|
||||
aiLight *light = new aiLight();
|
||||
auto *light = new aiLight();
|
||||
mScene->mLights.push_back(light);
|
||||
|
||||
light->mName.Set(std::string(name, num));
|
||||
|
||||
// First read the position of the light
|
||||
light->mPosition.x = stream->GetF4();
|
||||
light->mPosition.y = stream->GetF4();
|
||||
light->mPosition.z = stream->GetF4();
|
||||
light->mPosition.x = mStream->GetF4();
|
||||
light->mPosition.y = mStream->GetF4();
|
||||
light->mPosition.z = mStream->GetF4();
|
||||
|
||||
light->mColorDiffuse = aiColor3D(1.f, 1.f, 1.f);
|
||||
|
||||
@@ -407,19 +406,19 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
|
||||
|
||||
case Discreet3DS::CHUNK_CAMERA: {
|
||||
// This starts a new camera
|
||||
aiCamera *camera = new aiCamera();
|
||||
auto *camera = new aiCamera();
|
||||
mScene->mCameras.push_back(camera);
|
||||
camera->mName.Set(std::string(name, num));
|
||||
|
||||
// First read the position of the camera
|
||||
camera->mPosition.x = stream->GetF4();
|
||||
camera->mPosition.y = stream->GetF4();
|
||||
camera->mPosition.z = stream->GetF4();
|
||||
camera->mPosition.x = mStream->GetF4();
|
||||
camera->mPosition.y = mStream->GetF4();
|
||||
camera->mPosition.z = mStream->GetF4();
|
||||
|
||||
// Then the camera target
|
||||
camera->mLookAt.x = stream->GetF4() - camera->mPosition.x;
|
||||
camera->mLookAt.y = stream->GetF4() - camera->mPosition.y;
|
||||
camera->mLookAt.z = stream->GetF4() - camera->mPosition.z;
|
||||
camera->mLookAt.x = mStream->GetF4() - camera->mPosition.x;
|
||||
camera->mLookAt.y = mStream->GetF4() - camera->mPosition.y;
|
||||
camera->mLookAt.z = mStream->GetF4() - camera->mPosition.z;
|
||||
ai_real len = camera->mLookAt.Length();
|
||||
if (len < 1e-5) {
|
||||
|
||||
@@ -431,12 +430,12 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
|
||||
camera->mLookAt /= len;
|
||||
|
||||
// And finally - the camera rotation angle, in counter clockwise direction
|
||||
const ai_real angle = AI_DEG_TO_RAD(stream->GetF4());
|
||||
const ai_real angle = AI_DEG_TO_RAD(mStream->GetF4());
|
||||
aiQuaternion quat(camera->mLookAt, angle);
|
||||
camera->mUp = quat.GetMatrix() * aiVector3D(0.0, 1.0, 0.0);
|
||||
|
||||
// Read the lense angle
|
||||
camera->mHorizontalFOV = AI_DEG_TO_RAD(stream->GetF4());
|
||||
camera->mHorizontalFOV = AI_DEG_TO_RAD(mStream->GetF4());
|
||||
if (camera->mHorizontalFOV < 0.001f) {
|
||||
camera->mHorizontalFOV = float(AI_DEG_TO_RAD(45.f));
|
||||
}
|
||||
@@ -462,34 +461,34 @@ void Discreet3DSImporter::ParseLightChunk() {
|
||||
light->mType = aiLightSource_SPOT;
|
||||
|
||||
// We wouldn't need to normalize here, but we do it
|
||||
light->mDirection.x = stream->GetF4() - light->mPosition.x;
|
||||
light->mDirection.y = stream->GetF4() - light->mPosition.y;
|
||||
light->mDirection.z = stream->GetF4() - light->mPosition.z;
|
||||
light->mDirection.x = mStream->GetF4() - light->mPosition.x;
|
||||
light->mDirection.y = mStream->GetF4() - light->mPosition.y;
|
||||
light->mDirection.z = mStream->GetF4() - light->mPosition.z;
|
||||
light->mDirection.Normalize();
|
||||
|
||||
// Now the hotspot and falloff angles - in degrees
|
||||
light->mAngleInnerCone = AI_DEG_TO_RAD(stream->GetF4());
|
||||
light->mAngleInnerCone = AI_DEG_TO_RAD(mStream->GetF4());
|
||||
|
||||
// FIX: the falloff angle is just an offset
|
||||
light->mAngleOuterCone = light->mAngleInnerCone + AI_DEG_TO_RAD(stream->GetF4());
|
||||
light->mAngleOuterCone = light->mAngleInnerCone + AI_DEG_TO_RAD(mStream->GetF4());
|
||||
break;
|
||||
|
||||
// intensity multiplier
|
||||
case Discreet3DS::CHUNK_DL_MULTIPLIER:
|
||||
light->mColorDiffuse = light->mColorDiffuse * stream->GetF4();
|
||||
light->mColorDiffuse = light->mColorDiffuse * mStream->GetF4();
|
||||
break;
|
||||
|
||||
// light color
|
||||
case Discreet3DS::CHUNK_RGBF:
|
||||
case Discreet3DS::CHUNK_LINRGBF:
|
||||
light->mColorDiffuse.r *= stream->GetF4();
|
||||
light->mColorDiffuse.g *= stream->GetF4();
|
||||
light->mColorDiffuse.b *= stream->GetF4();
|
||||
light->mColorDiffuse.r *= mStream->GetF4();
|
||||
light->mColorDiffuse.g *= mStream->GetF4();
|
||||
light->mColorDiffuse.b *= mStream->GetF4();
|
||||
break;
|
||||
|
||||
// light attenuation
|
||||
case Discreet3DS::CHUNK_DL_ATTENUATE:
|
||||
light->mAttenuationLinear = stream->GetF4();
|
||||
light->mAttenuationLinear = mStream->GetF4();
|
||||
break;
|
||||
};
|
||||
|
||||
@@ -504,10 +503,10 @@ void Discreet3DSImporter::ParseCameraChunk() {
|
||||
// get chunk type
|
||||
switch (chunk.Flag) {
|
||||
// near and far clip plane
|
||||
case Discreet3DS::CHUNK_CAM_RANGES:
|
||||
camera->mClipPlaneNear = stream->GetF4();
|
||||
camera->mClipPlaneFar = stream->GetF4();
|
||||
break;
|
||||
case Discreet3DS::CHUNK_CAM_RANGES:
|
||||
camera->mClipPlaneNear = mStream->GetF4();
|
||||
camera->mClipPlaneFar = mStream->GetF4();
|
||||
break;
|
||||
}
|
||||
|
||||
ASSIMP_3DS_END_CHUNK();
|
||||
@@ -554,14 +553,13 @@ void Discreet3DSImporter::InverseNodeSearch(D3DS::Node *pcNode, D3DS::Node *pcCu
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Find a node with a specific name in the import hierarchy
|
||||
D3DS::Node *FindNode(D3DS::Node *root, const std::string &name) {
|
||||
Node *FindNode(Node *root, const std::string &name) {
|
||||
if (root->mName == name) {
|
||||
return root;
|
||||
}
|
||||
|
||||
for (std::vector<D3DS::Node *>::iterator it = root->mChildren.begin(); it != root->mChildren.end(); ++it) {
|
||||
D3DS::Node *nd = FindNode(*it, name);
|
||||
if (nullptr != nd) {
|
||||
for (auto it = root->mChildren.begin(); it != root->mChildren.end(); ++it) {
|
||||
if (auto *nd = FindNode(*it, name); nullptr != nd) {
|
||||
return nd;
|
||||
}
|
||||
}
|
||||
@@ -579,7 +577,7 @@ bool KeyUniqueCompare(const T &first, const T &second) {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Skip some additional import data.
|
||||
void Discreet3DSImporter::SkipTCBInfo() {
|
||||
unsigned int flags = stream->GetI2();
|
||||
unsigned int flags = mStream->GetI2();
|
||||
|
||||
if (!flags) {
|
||||
// Currently we can't do anything with these values. They occur
|
||||
@@ -590,19 +588,19 @@ void Discreet3DSImporter::SkipTCBInfo() {
|
||||
}
|
||||
|
||||
if (flags & Discreet3DS::KEY_USE_TENS) {
|
||||
stream->IncPtr(4);
|
||||
mStream->IncPtr(4);
|
||||
}
|
||||
if (flags & Discreet3DS::KEY_USE_BIAS) {
|
||||
stream->IncPtr(4);
|
||||
mStream->IncPtr(4);
|
||||
}
|
||||
if (flags & Discreet3DS::KEY_USE_CONT) {
|
||||
stream->IncPtr(4);
|
||||
mStream->IncPtr(4);
|
||||
}
|
||||
if (flags & Discreet3DS::KEY_USE_EASE_FROM) {
|
||||
stream->IncPtr(4);
|
||||
mStream->IncPtr(4);
|
||||
}
|
||||
if (flags & Discreet3DS::KEY_USE_EASE_TO) {
|
||||
stream->IncPtr(4);
|
||||
mStream->IncPtr(4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,15 +619,15 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
|
||||
// First of all: get the name of the object
|
||||
unsigned int cnt = 0;
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
auto *sz = (const char *)mStream->GetPtr();
|
||||
|
||||
while (stream->GetI1())
|
||||
while (mStream->GetI1())
|
||||
++cnt;
|
||||
std::string name = std::string(sz, cnt);
|
||||
|
||||
// Now find out whether we have this node already (target animation channels
|
||||
// are stored with a separate object ID)
|
||||
D3DS::Node *pcNode = FindNode(mRootNode, name);
|
||||
Node *pcNode = FindNode(mRootNode, name);
|
||||
int instanceNumber = 1;
|
||||
|
||||
if (pcNode) {
|
||||
@@ -645,10 +643,10 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
pcNode->mInstanceNumber = instanceNumber;
|
||||
|
||||
// There are two unknown values which we can safely ignore
|
||||
stream->IncPtr(4);
|
||||
mStream->IncPtr(4);
|
||||
|
||||
// Now read the hierarchy position of the object
|
||||
uint16_t hierarchy = stream->GetI2() + 1;
|
||||
uint16_t hierarchy = mStream->GetI2() + 1;
|
||||
pcNode->mHierarchyPos = hierarchy;
|
||||
pcNode->mHierarchyIndex = mLastNodeIndex;
|
||||
|
||||
@@ -677,8 +675,8 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
|
||||
// This is the "real" name of a $$$DUMMY object
|
||||
{
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
while (stream->GetI1())
|
||||
const char *sz = (const char *)mStream->GetPtr();
|
||||
while (mStream->GetI1())
|
||||
;
|
||||
|
||||
// If object name is DUMMY, take this one instead
|
||||
@@ -697,16 +695,16 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
}
|
||||
|
||||
// Pivot = origin of rotation and scaling
|
||||
mCurrentNode->vPivot.x = stream->GetF4();
|
||||
mCurrentNode->vPivot.y = stream->GetF4();
|
||||
mCurrentNode->vPivot.z = stream->GetF4();
|
||||
mCurrentNode->vPivot.x = mStream->GetF4();
|
||||
mCurrentNode->vPivot.y = mStream->GetF4();
|
||||
mCurrentNode->vPivot.z = mStream->GetF4();
|
||||
break;
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////
|
||||
// POSITION KEYFRAME
|
||||
case Discreet3DS::CHUNK_TRACKPOS: {
|
||||
stream->IncPtr(10);
|
||||
const unsigned int numFrames = stream->GetI4();
|
||||
mStream->IncPtr(10);
|
||||
const unsigned int numFrames = mStream->GetI4();
|
||||
bool sortKeys = false;
|
||||
|
||||
// This could also be meant as the target position for
|
||||
@@ -719,16 +717,16 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
|
||||
l->reserve(numFrames);
|
||||
for (unsigned int i = 0; i < numFrames; ++i) {
|
||||
const unsigned int fidx = stream->GetI4();
|
||||
const unsigned int fidx = mStream->GetI4();
|
||||
|
||||
// Setup a new position key
|
||||
aiVectorKey v;
|
||||
v.mTime = (double)fidx;
|
||||
|
||||
SkipTCBInfo();
|
||||
v.mValue.x = stream->GetF4();
|
||||
v.mValue.y = stream->GetF4();
|
||||
v.mValue.z = stream->GetF4();
|
||||
v.mValue.x = mStream->GetF4();
|
||||
v.mValue.y = mStream->GetF4();
|
||||
v.mValue.z = mStream->GetF4();
|
||||
|
||||
// check whether we'll need to sort the keys
|
||||
if (!l->empty() && v.mTime <= l->back().mTime)
|
||||
@@ -758,11 +756,11 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
bool sortKeys = false;
|
||||
std::vector<aiFloatKey> *l = &mCurrentNode->aCameraRollKeys;
|
||||
|
||||
stream->IncPtr(10);
|
||||
const unsigned int numFrames = stream->GetI4();
|
||||
mStream->IncPtr(10);
|
||||
const unsigned int numFrames = mStream->GetI4();
|
||||
l->reserve(numFrames);
|
||||
for (unsigned int i = 0; i < numFrames; ++i) {
|
||||
const unsigned int fidx = stream->GetI4();
|
||||
const unsigned int fidx = mStream->GetI4();
|
||||
|
||||
// Setup a new position key
|
||||
aiFloatKey v;
|
||||
@@ -770,7 +768,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
|
||||
// This is just a single float
|
||||
SkipTCBInfo();
|
||||
v.mValue = stream->GetF4();
|
||||
v.mValue = mStream->GetF4();
|
||||
|
||||
// Check whether we'll need to sort the keys
|
||||
if (!l->empty() && v.mTime <= l->back().mTime)
|
||||
@@ -797,26 +795,26 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
// ////////////////////////////////////////////////////////////////////
|
||||
// ROTATION KEYFRAME
|
||||
case Discreet3DS::CHUNK_TRACKROTATE: {
|
||||
stream->IncPtr(10);
|
||||
const unsigned int numFrames = stream->GetI4();
|
||||
mStream->IncPtr(10);
|
||||
const unsigned int numFrames = mStream->GetI4();
|
||||
|
||||
bool sortKeys = false;
|
||||
std::vector<aiQuatKey> *l = &mCurrentNode->aRotationKeys;
|
||||
l->reserve(numFrames);
|
||||
|
||||
for (unsigned int i = 0; i < numFrames; ++i) {
|
||||
const unsigned int fidx = stream->GetI4();
|
||||
const unsigned int fidx = mStream->GetI4();
|
||||
SkipTCBInfo();
|
||||
|
||||
aiQuatKey v;
|
||||
v.mTime = (double)fidx;
|
||||
|
||||
// The rotation keyframe is given as an axis-angle pair
|
||||
const float rad = stream->GetF4();
|
||||
const float rad = mStream->GetF4();
|
||||
aiVector3D axis;
|
||||
axis.x = stream->GetF4();
|
||||
axis.y = stream->GetF4();
|
||||
axis.z = stream->GetF4();
|
||||
axis.x = mStream->GetF4();
|
||||
axis.y = mStream->GetF4();
|
||||
axis.z = mStream->GetF4();
|
||||
|
||||
if (!axis.x && !axis.y && !axis.z)
|
||||
axis.y = 1.f;
|
||||
@@ -841,16 +839,16 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
// ////////////////////////////////////////////////////////////////////
|
||||
// SCALING KEYFRAME
|
||||
case Discreet3DS::CHUNK_TRACKSCALE: {
|
||||
stream->IncPtr(10);
|
||||
const unsigned int numFrames = stream->GetI2();
|
||||
stream->IncPtr(2);
|
||||
mStream->IncPtr(10);
|
||||
const unsigned int numFrames = mStream->GetI2();
|
||||
mStream->IncPtr(2);
|
||||
|
||||
bool sortKeys = false;
|
||||
std::vector<aiVectorKey> *l = &mCurrentNode->aScalingKeys;
|
||||
l->reserve(numFrames);
|
||||
|
||||
for (unsigned int i = 0; i < numFrames; ++i) {
|
||||
const unsigned int fidx = stream->GetI4();
|
||||
const unsigned int fidx = mStream->GetI4();
|
||||
SkipTCBInfo();
|
||||
|
||||
// Setup a new key
|
||||
@@ -858,9 +856,9 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent) {
|
||||
v.mTime = (double)fidx;
|
||||
|
||||
// ... and read its value
|
||||
v.mValue.x = stream->GetF4();
|
||||
v.mValue.y = stream->GetF4();
|
||||
v.mValue.z = stream->GetF4();
|
||||
v.mValue.x = mStream->GetF4();
|
||||
v.mValue.y = mStream->GetF4();
|
||||
v.mValue.z = mStream->GetF4();
|
||||
|
||||
// check whether we'll need to sort the keys
|
||||
if (!l->empty() && v.mTime <= l->back().mTime)
|
||||
@@ -901,23 +899,23 @@ void Discreet3DSImporter::ParseFaceChunk() {
|
||||
if (num > mMesh.mFaces.size()) {
|
||||
throw DeadlyImportError("3DS: More smoothing groups than faces");
|
||||
}
|
||||
for (std::vector<D3DS::Face>::iterator i = mMesh.mFaces.begin(); m != num; ++i, ++m) {
|
||||
for (auto i = mMesh.mFaces.begin(); m != num; ++i, ++m) {
|
||||
// nth bit is set for nth smoothing group
|
||||
(*i).iSmoothGroup = stream->GetI4();
|
||||
i->iSmoothGroup = mStream->GetI4();
|
||||
}
|
||||
} break;
|
||||
|
||||
case Discreet3DS::CHUNK_FACEMAT: {
|
||||
// at fist an asciiz with the material name
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
while (stream->GetI1())
|
||||
const char *sz = (const char *)mStream->GetPtr();
|
||||
while (mStream->GetI1())
|
||||
;
|
||||
|
||||
// find the index of the material
|
||||
unsigned int idx = 0xcdcdcdcd, cnt = 0;
|
||||
for (std::vector<D3DS::Material>::const_iterator i = mScene->mMaterials.begin(); i != mScene->mMaterials.end(); ++i, ++cnt) {
|
||||
for (auto i = mScene->mMaterials.begin(); i != mScene->mMaterials.end(); ++i, ++cnt) {
|
||||
// use case independent comparisons. hopefully it will work.
|
||||
if ((*i).mName.length() && !ASSIMP_stricmp(sz, (*i).mName.c_str())) {
|
||||
if (i->mName.length() && !ASSIMP_stricmp(sz, i->mName.c_str())) {
|
||||
idx = cnt;
|
||||
break;
|
||||
}
|
||||
@@ -927,9 +925,9 @@ void Discreet3DSImporter::ParseFaceChunk() {
|
||||
}
|
||||
|
||||
// Now continue and read all material indices
|
||||
cnt = (uint16_t)stream->GetI2();
|
||||
cnt = (uint16_t)mStream->GetI2();
|
||||
for (unsigned int i = 0; i < cnt; ++i) {
|
||||
unsigned int fidx = (uint16_t)stream->GetI2();
|
||||
unsigned int fidx = (uint16_t)mStream->GetI2();
|
||||
|
||||
// check range
|
||||
if (fidx >= mMesh.mFaceMaterials.size()) {
|
||||
@@ -954,59 +952,59 @@ void Discreet3DSImporter::ParseMeshChunk() {
|
||||
switch (chunk.Flag) {
|
||||
case Discreet3DS::CHUNK_VERTLIST: {
|
||||
// This is the list of all vertices in the current mesh
|
||||
int num = (int)(uint16_t)stream->GetI2();
|
||||
int num = (int)(uint16_t)mStream->GetI2();
|
||||
mMesh.mPositions.reserve(num);
|
||||
while (num-- > 0) {
|
||||
aiVector3D v;
|
||||
v.x = stream->GetF4();
|
||||
v.y = stream->GetF4();
|
||||
v.z = stream->GetF4();
|
||||
v.x = mStream->GetF4();
|
||||
v.y = mStream->GetF4();
|
||||
v.z = mStream->GetF4();
|
||||
mMesh.mPositions.push_back(v);
|
||||
}
|
||||
} break;
|
||||
case Discreet3DS::CHUNK_TRMATRIX: {
|
||||
// This is the RLEATIVE transformation matrix of the current mesh. Vertices are
|
||||
// pretransformed by this matrix wonder.
|
||||
mMesh.mMat.a1 = stream->GetF4();
|
||||
mMesh.mMat.b1 = stream->GetF4();
|
||||
mMesh.mMat.c1 = stream->GetF4();
|
||||
mMesh.mMat.a2 = stream->GetF4();
|
||||
mMesh.mMat.b2 = stream->GetF4();
|
||||
mMesh.mMat.c2 = stream->GetF4();
|
||||
mMesh.mMat.a3 = stream->GetF4();
|
||||
mMesh.mMat.b3 = stream->GetF4();
|
||||
mMesh.mMat.c3 = stream->GetF4();
|
||||
mMesh.mMat.a4 = stream->GetF4();
|
||||
mMesh.mMat.b4 = stream->GetF4();
|
||||
mMesh.mMat.c4 = stream->GetF4();
|
||||
mMesh.mMat.a1 = mStream->GetF4();
|
||||
mMesh.mMat.b1 = mStream->GetF4();
|
||||
mMesh.mMat.c1 = mStream->GetF4();
|
||||
mMesh.mMat.a2 = mStream->GetF4();
|
||||
mMesh.mMat.b2 = mStream->GetF4();
|
||||
mMesh.mMat.c2 = mStream->GetF4();
|
||||
mMesh.mMat.a3 = mStream->GetF4();
|
||||
mMesh.mMat.b3 = mStream->GetF4();
|
||||
mMesh.mMat.c3 = mStream->GetF4();
|
||||
mMesh.mMat.a4 = mStream->GetF4();
|
||||
mMesh.mMat.b4 = mStream->GetF4();
|
||||
mMesh.mMat.c4 = mStream->GetF4();
|
||||
} break;
|
||||
|
||||
case Discreet3DS::CHUNK_MAPLIST: {
|
||||
// This is the list of all UV coords in the current mesh
|
||||
int num = (int)(uint16_t)stream->GetI2();
|
||||
int num = (int)(uint16_t)mStream->GetI2();
|
||||
mMesh.mTexCoords.reserve(num);
|
||||
while (num-- > 0) {
|
||||
aiVector3D v;
|
||||
v.x = stream->GetF4();
|
||||
v.y = stream->GetF4();
|
||||
v.x = mStream->GetF4();
|
||||
v.y = mStream->GetF4();
|
||||
mMesh.mTexCoords.push_back(v);
|
||||
}
|
||||
} break;
|
||||
|
||||
case Discreet3DS::CHUNK_FACELIST: {
|
||||
// This is the list of all faces in the current mesh
|
||||
int num = (int)(uint16_t)stream->GetI2();
|
||||
int num = (int)(uint16_t)mStream->GetI2();
|
||||
mMesh.mFaces.reserve(num);
|
||||
while (num-- > 0) {
|
||||
// 3DS faces are ALWAYS triangles
|
||||
mMesh.mFaces.push_back(D3DS::Face());
|
||||
D3DS::Face &sFace = mMesh.mFaces.back();
|
||||
mMesh.mFaces.emplace_back();
|
||||
Face &sFace = mMesh.mFaces.back();
|
||||
|
||||
sFace.mIndices[0] = (uint16_t)stream->GetI2();
|
||||
sFace.mIndices[1] = (uint16_t)stream->GetI2();
|
||||
sFace.mIndices[2] = (uint16_t)stream->GetI2();
|
||||
sFace.mIndices[0] = (uint16_t)mStream->GetI2();
|
||||
sFace.mIndices[1] = (uint16_t)mStream->GetI2();
|
||||
sFace.mIndices[2] = (uint16_t)mStream->GetI2();
|
||||
|
||||
stream->IncPtr(2); // skip edge visibility flag
|
||||
mStream->IncPtr(2); // skip edge visibility flag
|
||||
}
|
||||
|
||||
// Resize the material array (0xcdcdcdcd marks the default material; so if a face is
|
||||
@@ -1014,7 +1012,7 @@ void Discreet3DSImporter::ParseMeshChunk() {
|
||||
mMesh.mFaceMaterials.resize(mMesh.mFaces.size(), 0xcdcdcdcd);
|
||||
|
||||
// Larger 3DS files could have multiple FACE chunks here
|
||||
chunkSize = (int)stream->GetRemainingSizeToLimit();
|
||||
chunkSize = (int)mStream->GetRemainingSizeToLimit();
|
||||
if (chunkSize > (int)sizeof(Discreet3DS::Chunk))
|
||||
ParseFaceChunk();
|
||||
} break;
|
||||
@@ -1031,9 +1029,9 @@ void Discreet3DSImporter::ParseMaterialChunk() {
|
||||
|
||||
{
|
||||
// The material name string is already zero-terminated, but we need to be sure ...
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
const char *sz = (const char *)mStream->GetPtr();
|
||||
unsigned int cnt = 0;
|
||||
while (stream->GetI1())
|
||||
while (mStream->GetI1())
|
||||
++cnt;
|
||||
|
||||
if (!cnt) {
|
||||
@@ -1101,7 +1099,7 @@ void Discreet3DSImporter::ParseMaterialChunk() {
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_SHADING:
|
||||
// This is the material shading mode
|
||||
mScene->mMaterials.back().mShading = (D3DS::Discreet3DS::shadetype3ds)stream->GetI2();
|
||||
mScene->mMaterials.back().mShading = (Discreet3DS::shadetype3ds)mStream->GetI2();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_TWO_SIDE:
|
||||
@@ -1177,31 +1175,31 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture *pcOut) {
|
||||
switch (chunk.Flag) {
|
||||
case Discreet3DS::CHUNK_MAPFILE: {
|
||||
// The material name string is already zero-terminated, but we need to be sure ...
|
||||
const char *sz = (const char *)stream->GetPtr();
|
||||
const char *sz = (const char *)mStream->GetPtr();
|
||||
unsigned int cnt = 0;
|
||||
while (stream->GetI1())
|
||||
while (mStream->GetI1())
|
||||
++cnt;
|
||||
pcOut->mMapName = std::string(sz, cnt);
|
||||
} break;
|
||||
|
||||
case Discreet3DS::CHUNK_PERCENTD:
|
||||
// Manually parse the blend factor
|
||||
pcOut->mTextureBlend = ai_real(stream->GetF8());
|
||||
pcOut->mTextureBlend = ai_real(mStream->GetF8());
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_PERCENTF:
|
||||
// Manually parse the blend factor
|
||||
pcOut->mTextureBlend = stream->GetF4();
|
||||
pcOut->mTextureBlend = mStream->GetF4();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_PERCENTW:
|
||||
// Manually parse the blend factor
|
||||
pcOut->mTextureBlend = (ai_real)((uint16_t)stream->GetI2()) / ai_real(100.0);
|
||||
pcOut->mTextureBlend = (ai_real)((uint16_t) mStream->GetI2()) / ai_real(100.0);
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_MAP_USCALE:
|
||||
// Texture coordinate scaling in the U direction
|
||||
pcOut->mScaleU = stream->GetF4();
|
||||
pcOut->mScaleU = mStream->GetF4();
|
||||
if (0.0f == pcOut->mScaleU) {
|
||||
ASSIMP_LOG_WARN("Texture coordinate scaling in the x direction is zero. Assuming 1.");
|
||||
pcOut->mScaleU = 1.0f;
|
||||
@@ -1209,7 +1207,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture *pcOut) {
|
||||
break;
|
||||
case Discreet3DS::CHUNK_MAT_MAP_VSCALE:
|
||||
// Texture coordinate scaling in the V direction
|
||||
pcOut->mScaleV = stream->GetF4();
|
||||
pcOut->mScaleV = mStream->GetF4();
|
||||
if (0.0f == pcOut->mScaleV) {
|
||||
ASSIMP_LOG_WARN("Texture coordinate scaling in the y direction is zero. Assuming 1.");
|
||||
pcOut->mScaleV = 1.0f;
|
||||
@@ -1218,21 +1216,21 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture *pcOut) {
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_MAP_UOFFSET:
|
||||
// Texture coordinate offset in the U direction
|
||||
pcOut->mOffsetU = -stream->GetF4();
|
||||
pcOut->mOffsetU = -mStream->GetF4();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_MAP_VOFFSET:
|
||||
// Texture coordinate offset in the V direction
|
||||
pcOut->mOffsetV = stream->GetF4();
|
||||
pcOut->mOffsetV = mStream->GetF4();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_MAP_ANG:
|
||||
// Texture coordinate rotation, CCW in DEGREES
|
||||
pcOut->mRotation = -AI_DEG_TO_RAD(stream->GetF4());
|
||||
pcOut->mRotation = -AI_DEG_TO_RAD(mStream->GetF4());
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_MAT_MAP_TILING: {
|
||||
const uint16_t iFlags = stream->GetI2();
|
||||
const uint16_t iFlags = mStream->GetI2();
|
||||
|
||||
// Get the mapping mode (for both axes)
|
||||
if (iFlags & 0x2u)
|
||||
@@ -1257,9 +1255,11 @@ ai_real Discreet3DSImporter::ParsePercentageChunk() {
|
||||
ReadChunk(&chunk);
|
||||
|
||||
if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag) {
|
||||
return stream->GetF4() * ai_real(100) / ai_real(0xFFFF);
|
||||
} else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag) {
|
||||
return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF;
|
||||
return mStream->GetF4() * ai_real(100) / ai_real(0xFFFF);
|
||||
}
|
||||
|
||||
if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag) {
|
||||
return (ai_real)((uint16_t)mStream->GetI2()) / (ai_real)0xFFFF;
|
||||
}
|
||||
|
||||
return get_qnan();
|
||||
@@ -1284,34 +1284,35 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
|
||||
switch (chunk.Flag) {
|
||||
case Discreet3DS::CHUNK_LINRGBF:
|
||||
bGamma = true;
|
||||
|
||||
// fallthrough
|
||||
case Discreet3DS::CHUNK_RGBF:
|
||||
if (sizeof(float) * 3 > diff) {
|
||||
*out = clrError;
|
||||
return;
|
||||
}
|
||||
out->r = stream->GetF4();
|
||||
out->g = stream->GetF4();
|
||||
out->b = stream->GetF4();
|
||||
out->r = mStream->GetF4();
|
||||
out->g = mStream->GetF4();
|
||||
out->b = mStream->GetF4();
|
||||
break;
|
||||
|
||||
case Discreet3DS::CHUNK_LINRGBB:
|
||||
bGamma = true;
|
||||
// fallthrough
|
||||
case Discreet3DS::CHUNK_RGBB: {
|
||||
if (sizeof(char) * 3 > diff) {
|
||||
*out = clrError;
|
||||
return;
|
||||
}
|
||||
const ai_real invVal = ai_real(1.0) / ai_real(255.0);
|
||||
out->r = (ai_real)(uint8_t)stream->GetI1() * invVal;
|
||||
out->g = (ai_real)(uint8_t)stream->GetI1() * invVal;
|
||||
out->b = (ai_real)(uint8_t)stream->GetI1() * invVal;
|
||||
out->r = (ai_real)(uint8_t)mStream->GetI1() * invVal;
|
||||
out->g = (ai_real)(uint8_t)mStream->GetI1() * invVal;
|
||||
out->b = (ai_real)(uint8_t)mStream->GetI1() * invVal;
|
||||
} break;
|
||||
|
||||
// Percentage chunks are accepted, too.
|
||||
case Discreet3DS::CHUNK_PERCENTF:
|
||||
if (acceptPercent && 4 <= diff) {
|
||||
out->g = out->b = out->r = stream->GetF4();
|
||||
out->g = out->b = out->r = mStream->GetF4();
|
||||
break;
|
||||
}
|
||||
*out = clrError;
|
||||
@@ -1319,18 +1320,20 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
|
||||
|
||||
case Discreet3DS::CHUNK_PERCENTW:
|
||||
if (acceptPercent && 1 <= diff) {
|
||||
out->g = out->b = out->r = (ai_real)(uint8_t)stream->GetI1() / ai_real(255.0);
|
||||
out->g = out->b = out->r = (ai_real)(uint8_t)mStream->GetI1() / ai_real(255.0);
|
||||
break;
|
||||
}
|
||||
*out = clrError;
|
||||
return;
|
||||
|
||||
default:
|
||||
stream->IncPtr(diff);
|
||||
mStream->IncPtr(diff);
|
||||
// Skip unknown chunks, hope this won't cause any problems.
|
||||
return ParseColorChunk(out, acceptPercent);
|
||||
};
|
||||
(void)bGamma;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -51,24 +49,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/BaseImporter.h>
|
||||
#include <assimp/types.h>
|
||||
|
||||
|
||||
#include "3DSHelper.h"
|
||||
#include <assimp/StreamReader.h>
|
||||
|
||||
struct aiNode;
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
|
||||
using namespace D3DS;
|
||||
namespace Assimp {
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
/** Importer class for 3D Studio r3 and r4 3DS files
|
||||
*/
|
||||
class Discreet3DSImporter : public BaseImporter {
|
||||
class Discreet3DSImporter final : public BaseImporter {
|
||||
public:
|
||||
Discreet3DSImporter();
|
||||
~Discreet3DSImporter();
|
||||
~Discreet3DSImporter() override = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns whether the class can handle the format of the given file.
|
||||
@@ -102,15 +96,14 @@ protected:
|
||||
// -------------------------------------------------------------------
|
||||
/** Converts a temporary material to the outer representation
|
||||
*/
|
||||
void ConvertMaterial(D3DS::Material& p_cMat,
|
||||
aiMaterial& p_pcOut);
|
||||
void ConvertMaterial(D3DS::Material& p_cMat, aiMaterial& p_pcOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Read a chunk
|
||||
*
|
||||
* @param pcOut Receives the current chunk
|
||||
*/
|
||||
void ReadChunk(Discreet3DS::Chunk* pcOut);
|
||||
void ReadChunk(D3DS::Discreet3DS::Chunk* pcOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Parse a percentage chunk. mCurrent will point to the next
|
||||
@@ -120,13 +113,10 @@ protected:
|
||||
ai_real ParsePercentageChunk();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Parse a color chunk. mCurrent will point to the next
|
||||
* chunk behind afterwards. If no color chunk is found
|
||||
* QNAN is returned in all members.
|
||||
*/
|
||||
void ParseColorChunk(aiColor3D* p_pcOut,
|
||||
bool p_bAcceptPercent = true);
|
||||
|
||||
/** Parse a color chunk. mCurrent will point to the next chunk behind
|
||||
* afterward. If no color chunk is found QNAN is returned in all members.
|
||||
*/
|
||||
void ParseColorChunk(aiColor3D* p_pcOut, bool p_bAcceptPercent = true);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Skip a chunk in the file
|
||||
@@ -134,7 +124,7 @@ protected:
|
||||
void SkipChunk();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Generate the nodegraph
|
||||
/** Generate the node-graph
|
||||
*/
|
||||
void GenerateNodeGraph(aiScene* pcOut);
|
||||
|
||||
@@ -230,19 +220,19 @@ protected:
|
||||
// -------------------------------------------------------------------
|
||||
/** Add a node to the node graph
|
||||
*/
|
||||
void AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,D3DS::Node* pcIn,
|
||||
void AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut, D3DS::Node* pcIn,
|
||||
aiMatrix4x4& absTrafo);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Search for a node in the graph.
|
||||
* Called recursively
|
||||
*/
|
||||
void InverseNodeSearch(D3DS::Node* pcNode,D3DS::Node* pcCurrent);
|
||||
void InverseNodeSearch(D3DS::Node* pcNode, D3DS::Node* pcCurrent);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Apply the master scaling factor to the mesh
|
||||
*/
|
||||
void ApplyMasterScale(aiScene* pScene);
|
||||
void ApplyMasterScale(const aiScene* pScene);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Clamp all indices in the file to a valid range
|
||||
@@ -254,31 +244,26 @@ protected:
|
||||
*/
|
||||
void SkipTCBInfo();
|
||||
|
||||
protected:
|
||||
|
||||
/** Stream to read from */
|
||||
StreamReaderLE* stream;
|
||||
|
||||
/** Last touched node index */
|
||||
private:
|
||||
/// Stream to read from
|
||||
StreamReaderLE* mStream;
|
||||
/// Last touched node index
|
||||
short mLastNodeIndex;
|
||||
|
||||
/** Current node, root node */
|
||||
D3DS::Node* mCurrentNode, *mRootNode;
|
||||
|
||||
/** Scene under construction */
|
||||
/// Current node
|
||||
D3DS::Node* mCurrentNode;
|
||||
/// Root node
|
||||
D3DS::Node *mRootNode;
|
||||
/// Scene under construction
|
||||
D3DS::Scene* mScene;
|
||||
|
||||
/** Ambient base color of the scene */
|
||||
/// Ambient base color of the scene
|
||||
aiColor3D mClrAmbient;
|
||||
|
||||
/** Master scaling factor of the scene */
|
||||
/// Master scaling factor of the scene
|
||||
ai_real mMasterScale;
|
||||
|
||||
/** Path to the background image of the scene */
|
||||
/// Path to the background image of the scene
|
||||
std::string mBackgroundImage;
|
||||
/// true for has a background
|
||||
bool bHasBG;
|
||||
|
||||
/** true if PRJ file */
|
||||
/// true if PRJ file
|
||||
bool bIsPrj;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -49,14 +49,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
struct aiMaterial;
|
||||
struct aiMesh;
|
||||
|
||||
namespace Assimp {
|
||||
namespace D3MF {
|
||||
namespace Assimp:: D3MF {
|
||||
|
||||
enum class ResourceType {
|
||||
RT_Object,
|
||||
RT_BaseMaterials,
|
||||
RT_EmbeddedTexture2D,
|
||||
RT_Texture2DGroup,
|
||||
RT_ColorGroup,
|
||||
RT_Unknown
|
||||
}; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...)
|
||||
|
||||
@@ -64,21 +64,18 @@ class Resource {
|
||||
public:
|
||||
int mId;
|
||||
|
||||
Resource(int id) :
|
||||
mId(id) {
|
||||
explicit Resource(int id) : mId(id) {
|
||||
// empty
|
||||
}
|
||||
|
||||
virtual ~Resource() {
|
||||
// empty
|
||||
}
|
||||
virtual ~Resource() = default;
|
||||
|
||||
virtual ResourceType getType() const {
|
||||
return ResourceType::RT_Unknown;
|
||||
}
|
||||
};
|
||||
|
||||
class EmbeddedTexture : public Resource {
|
||||
class EmbeddedTexture final : public Resource {
|
||||
public:
|
||||
std::string mPath;
|
||||
std::string mContentType;
|
||||
@@ -86,50 +83,57 @@ public:
|
||||
std::string mTilestyleV;
|
||||
std::vector<char> mBuffer;
|
||||
|
||||
EmbeddedTexture(int id) :
|
||||
Resource(id),
|
||||
mPath(),
|
||||
mContentType(),
|
||||
mTilestyleU(),
|
||||
mTilestyleV() {
|
||||
explicit EmbeddedTexture(int id) : Resource(id) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~EmbeddedTexture() = default;
|
||||
~EmbeddedTexture() override = default;
|
||||
|
||||
ResourceType getType() const override {
|
||||
return ResourceType::RT_EmbeddedTexture2D;
|
||||
}
|
||||
};
|
||||
|
||||
class Texture2DGroup : public Resource {
|
||||
class Texture2DGroup final : public Resource {
|
||||
public:
|
||||
std::vector<aiVector2D> mTex2dCoords;
|
||||
int mTexId;
|
||||
Texture2DGroup(int id) :
|
||||
Resource(id),
|
||||
mTexId(-1) {
|
||||
|
||||
explicit Texture2DGroup(int id) : Resource(id), mTexId(-1) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~Texture2DGroup() = default;
|
||||
~Texture2DGroup() override = default;
|
||||
|
||||
ResourceType getType() const override {
|
||||
return ResourceType::RT_Texture2DGroup;
|
||||
}
|
||||
};
|
||||
|
||||
class BaseMaterials : public Resource {
|
||||
class ColorGroup final : public Resource {
|
||||
public:
|
||||
std::vector<unsigned int> mMaterialIndex;
|
||||
std::vector<aiColor4D> mColors;
|
||||
|
||||
BaseMaterials(int id) :
|
||||
Resource(id),
|
||||
mMaterialIndex() {
|
||||
explicit ColorGroup(int id) : Resource(id) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~BaseMaterials() = default;
|
||||
~ColorGroup() override = default;
|
||||
|
||||
ResourceType getType() const override {
|
||||
return ResourceType::RT_ColorGroup;
|
||||
}
|
||||
};
|
||||
|
||||
class BaseMaterials final : public Resource {
|
||||
public:
|
||||
std::vector<unsigned int> mMaterialIndex;
|
||||
|
||||
explicit BaseMaterials(int id) : Resource(id) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~BaseMaterials() override = default;
|
||||
|
||||
ResourceType getType() const override {
|
||||
return ResourceType::RT_BaseMaterials;
|
||||
@@ -141,25 +145,24 @@ struct Component {
|
||||
aiMatrix4x4 mTransformation;
|
||||
};
|
||||
|
||||
class Object : public Resource {
|
||||
class Object final : public Resource {
|
||||
public:
|
||||
std::vector<aiMesh *> mMeshes;
|
||||
std::vector<unsigned int> mMeshIndex;
|
||||
std::vector<Component> mComponents;
|
||||
std::string mName;
|
||||
|
||||
Object(int id) :
|
||||
explicit Object(int id) :
|
||||
Resource(id),
|
||||
mName(std::string("Object_") + ai_to_string(id)) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~Object() = default;
|
||||
~Object() override = default;
|
||||
|
||||
ResourceType getType() const override {
|
||||
return ResourceType::RT_Object;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace D3MF
|
||||
} // namespace Assimp
|
||||
} // namespace Assimp::D3MF
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -40,78 +40,80 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Assimp {
|
||||
namespace D3MF {
|
||||
|
||||
namespace XmlTag {
|
||||
namespace Assimp::D3MF::XmlTag {
|
||||
// Root tag
|
||||
const char* const RootTag = "3MF";
|
||||
constexpr char RootTag[] = "3MF";
|
||||
|
||||
// Meta-data
|
||||
const char* const meta = "metadata";
|
||||
const char* const meta_name = "name";
|
||||
constexpr char meta[] = "metadata";
|
||||
constexpr char meta_name[] = "name";
|
||||
|
||||
// Model-data specific tags
|
||||
const char* const model = "model";
|
||||
const char* const model_unit = "unit";
|
||||
const char* const metadata = "metadata";
|
||||
const char* const resources = "resources";
|
||||
const char* const object = "object";
|
||||
const char* const mesh = "mesh";
|
||||
const char* const components = "components";
|
||||
const char* const component = "component";
|
||||
const char* const vertices = "vertices";
|
||||
const char* const vertex = "vertex";
|
||||
const char* const triangles = "triangles";
|
||||
const char* const triangle = "triangle";
|
||||
const char* const x = "x";
|
||||
const char* const y = "y";
|
||||
const char* const z = "z";
|
||||
const char* const v1 = "v1";
|
||||
const char* const v2 = "v2";
|
||||
const char* const v3 = "v3";
|
||||
const char* const id = "id";
|
||||
const char* const pid = "pid";
|
||||
const char* const pindex = "pindex";
|
||||
const char* const p1 = "p1";
|
||||
const char* const name = "name";
|
||||
const char* const type = "type";
|
||||
const char* const build = "build";
|
||||
const char* const item = "item";
|
||||
const char* const objectid = "objectid";
|
||||
const char* const transform = "transform";
|
||||
const char *const path = "path";
|
||||
constexpr char model[] = "model";
|
||||
constexpr char model_unit[] = "unit";
|
||||
constexpr char metadata[] = "metadata";
|
||||
constexpr char resources[] = "resources";
|
||||
constexpr char object[] = "object";
|
||||
constexpr char mesh[] = "mesh";
|
||||
constexpr char components[] = "components";
|
||||
constexpr char component[] = "component";
|
||||
constexpr char vertices[] = "vertices";
|
||||
constexpr char vertex[] = "vertex";
|
||||
constexpr char triangles[] = "triangles";
|
||||
constexpr char triangle[] = "triangle";
|
||||
constexpr char x[] = "x";
|
||||
constexpr char y[] = "y";
|
||||
constexpr char z[] = "z";
|
||||
constexpr char v1[] = "v1";
|
||||
constexpr char v2[] = "v2";
|
||||
constexpr char v3[] = "v3";
|
||||
constexpr char id[] = "id";
|
||||
constexpr char pid[] = "pid";
|
||||
constexpr char pindex[] = "pindex";
|
||||
constexpr char p1[] = "p1";
|
||||
constexpr char p2[] = "p2";
|
||||
constexpr char p3[] = "p3";
|
||||
constexpr char name[] = "name";
|
||||
constexpr char type[] = "type";
|
||||
constexpr char build[] = "build";
|
||||
constexpr char item[] = "item";
|
||||
constexpr char objectid[] = "objectid";
|
||||
constexpr char transform[] = "transform";
|
||||
constexpr char path[] = "path";
|
||||
|
||||
// Material definitions
|
||||
const char* const basematerials = "basematerials";
|
||||
const char* const basematerials_base = "base";
|
||||
const char* const basematerials_name = "name";
|
||||
const char* const basematerials_displaycolor = "displaycolor";
|
||||
const char* const texture_2d = "m:texture2d";
|
||||
const char *const texture_group = "m:texture2dgroup";
|
||||
const char *const texture_content_type = "contenttype";
|
||||
const char *const texture_tilestyleu = "tilestyleu";
|
||||
const char *const texture_tilestylev = "tilestylev";
|
||||
const char *const texture_2d_coord = "m:tex2coord";
|
||||
const char *const texture_cuurd_u = "u";
|
||||
const char *const texture_cuurd_v = "v";
|
||||
constexpr char basematerials[] = "basematerials";
|
||||
constexpr char basematerials_base[] = "base";
|
||||
constexpr char basematerials_name[] = "name";
|
||||
constexpr char basematerials_displaycolor[] = "displaycolor";
|
||||
constexpr char texture_2d[] = "m:texture2d";
|
||||
constexpr char texture_group[] = "m:texture2dgroup";
|
||||
constexpr char texture_content_type[] = "contenttype";
|
||||
constexpr char texture_tilestyleu[] = "tilestyleu";
|
||||
constexpr char texture_tilestylev[] = "tilestylev";
|
||||
constexpr char texture_2d_coord[] = "m:tex2coord";
|
||||
constexpr char texture_cuurd_u[] = "u";
|
||||
constexpr char texture_cuurd_v[] = "v";
|
||||
|
||||
// vertex color definitions
|
||||
constexpr char colorgroup[] = "m:colorgroup";
|
||||
constexpr char color_item[] = "m:color";
|
||||
constexpr char color_value[] = "color";
|
||||
|
||||
// Meta info tags
|
||||
const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
|
||||
const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
|
||||
const char* const SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
|
||||
const char* const SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
||||
const char* const RELS_RELATIONSHIP_CONTAINER = "Relationships";
|
||||
const char* const RELS_RELATIONSHIP_NODE = "Relationship";
|
||||
const char* const RELS_ATTRIB_TARGET = "Target";
|
||||
const char* const RELS_ATTRIB_TYPE = "Type";
|
||||
const char* const RELS_ATTRIB_ID = "Id";
|
||||
const char* const PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
|
||||
const char* const PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
|
||||
const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
|
||||
const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
|
||||
}
|
||||
constexpr char CONTENT_TYPES_ARCHIVE[] = "[Content_Types].xml";
|
||||
constexpr char ROOT_RELATIONSHIPS_ARCHIVE[] = "_rels/.rels";
|
||||
constexpr char SCHEMA_CONTENTTYPES[] = "http://schemas.openxmlformats.org/package/2006/content-types";
|
||||
constexpr char SCHEMA_RELATIONSHIPS[] = "http://schemas.openxmlformats.org/package/2006/relationships";
|
||||
constexpr char RELS_RELATIONSHIP_CONTAINER[] = "Relationships";
|
||||
constexpr char RELS_RELATIONSHIP_NODE[] = "Relationship";
|
||||
constexpr char RELS_ATTRIB_TARGET[] = "Target";
|
||||
constexpr char RELS_ATTRIB_TYPE[] = "Type";
|
||||
constexpr char RELS_ATTRIB_ID[] = "Id";
|
||||
constexpr char PACKAGE_START_PART_RELATIONSHIP_TYPE[] = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
|
||||
constexpr char PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE[] = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
|
||||
constexpr char PACKAGE_TEXTURE_RELATIONSHIP_TYPE[] = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
|
||||
constexpr char PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE[] = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
constexpr char PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE[] = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
|
||||
|
||||
} // Namespace D3MF
|
||||
} // Namespace Assimp
|
||||
} // namespace Assimp::D3MF
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/IOStream.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
|
||||
#include "3MFXmlTags.h"
|
||||
@@ -83,7 +82,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen
|
||||
namespace D3MF {
|
||||
|
||||
D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) :
|
||||
mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene), mModelOutput(), mRelOutput(), mContentOutput(), mBuildItems(), mRelations() {
|
||||
mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene) {
|
||||
// empty
|
||||
}
|
||||
|
||||
@@ -94,7 +93,7 @@ D3MFExporter::~D3MFExporter() {
|
||||
mRelations.clear();
|
||||
}
|
||||
|
||||
bool D3MFExporter::validate() {
|
||||
bool D3MFExporter::validate() const {
|
||||
if (mArchiveName.empty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -249,10 +248,10 @@ void D3MFExporter::writeBaseMaterials() {
|
||||
if (color.r <= 1 && color.g <= 1 && color.b <= 1 && color.a <= 1) {
|
||||
|
||||
hexDiffuseColor = ai_rgba2hex(
|
||||
(int)((ai_real)color.r) * 255,
|
||||
(int)((ai_real)color.g) * 255,
|
||||
(int)((ai_real)color.b) * 255,
|
||||
(int)((ai_real)color.a) * 255,
|
||||
(int)(((ai_real)color.r) * 255),
|
||||
(int)(((ai_real)color.g) * 255),
|
||||
(int)(((ai_real)color.b) * 255),
|
||||
(int)(((ai_real)color.a) * 255),
|
||||
true);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -68,7 +68,7 @@ class D3MFExporter {
|
||||
public:
|
||||
D3MFExporter( const char* pFile, const aiScene* pScene );
|
||||
~D3MFExporter();
|
||||
bool validate();
|
||||
bool validate() const;
|
||||
bool exportArchive( const char *file );
|
||||
bool exportContentTypes();
|
||||
bool exportRelations();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Assimp {
|
||||
|
||||
using namespace D3MF;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"3mf Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -81,21 +81,17 @@ static const aiImporterDesc desc = {
|
||||
"3mf"
|
||||
};
|
||||
|
||||
D3MFImporter::D3MFImporter() :
|
||||
BaseImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
D3MFImporter::~D3MFImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool ) const {
|
||||
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
|
||||
return false;
|
||||
}
|
||||
D3MF::D3MFOpcPackage opcPackage(pIOHandler, filename);
|
||||
return opcPackage.validate();
|
||||
static constexpr char ModelRef[] = "3D/3dmodel.model";
|
||||
ZipArchiveIOSystem archive(pIOHandler, filename);
|
||||
if (!archive.Exists(ModelRef)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void D3MFImporter::SetupProperties(const Importer*) {
|
||||
@@ -111,7 +107,7 @@ void D3MFImporter::InternReadFile(const std::string &filename, aiScene *pScene,
|
||||
|
||||
XmlParser xmlParser;
|
||||
if (xmlParser.parse(opcPackage.RootStream())) {
|
||||
XmlSerializer xmlSerializer(&xmlParser);
|
||||
XmlSerializer xmlSerializer(xmlParser);
|
||||
xmlSerializer.ImportXml(pScene);
|
||||
|
||||
const std::vector<aiTexture*> &tex = opcPackage.GetEmbeddedTextures();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -53,13 +53,13 @@ namespace Assimp {
|
||||
///
|
||||
/// Implements the basic topology import and embedded textures.
|
||||
// ---------------------------------------------------------------------------
|
||||
class D3MFImporter : public BaseImporter {
|
||||
class D3MFImporter final : public BaseImporter {
|
||||
public:
|
||||
/// @brief The default class constructor.
|
||||
D3MFImporter();
|
||||
D3MFImporter() = default;
|
||||
|
||||
/// @brief The class destructor.
|
||||
~D3MFImporter() override;
|
||||
~D3MFImporter() override = default;
|
||||
|
||||
/// @brief Performs the data format detection.
|
||||
/// @param pFile The filename to check.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -65,10 +65,9 @@ namespace D3MF {
|
||||
|
||||
using OpcPackageRelationshipPtr = std::shared_ptr<OpcPackageRelationship>;
|
||||
|
||||
class OpcPackageRelationshipReader {
|
||||
class OpcPackageRelationshipReader final {
|
||||
public:
|
||||
OpcPackageRelationshipReader(XmlParser &parser) :
|
||||
m_relationShips() {
|
||||
explicit OpcPackageRelationshipReader(XmlParser &parser) : mRelations() {
|
||||
XmlNode root = parser.getRootNode();
|
||||
ParseRootNode(root);
|
||||
}
|
||||
@@ -108,20 +107,20 @@ public:
|
||||
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string();
|
||||
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string();
|
||||
if (validateRels(relPtr)) {
|
||||
m_relationShips.push_back(relPtr);
|
||||
mRelations.push_back(relPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<OpcPackageRelationshipPtr> m_relationShips;
|
||||
std::vector<OpcPackageRelationshipPtr> mRelations;
|
||||
};
|
||||
|
||||
static bool IsEmbeddedTexture( const std::string &filename ) {
|
||||
const std::string extension = BaseImporter::GetExtension(filename);
|
||||
if (extension == "jpg" || extension == "png") {
|
||||
if (extension == "jpg" || extension == "png" || extension == "jpeg") {
|
||||
std::string::size_type pos = filename.find("thumbnail");
|
||||
if (pos == std::string::npos) {
|
||||
if (pos != std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -160,7 +159,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) :
|
||||
// deal with zip-bug
|
||||
rootFile = rootFile.substr(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSIMP_LOG_VERBOSE_DEBUG(rootFile);
|
||||
|
||||
@@ -214,11 +213,11 @@ std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
|
||||
|
||||
OpcPackageRelationshipReader reader(xmlParser);
|
||||
|
||||
auto itr = std::find_if(reader.m_relationShips.begin(), reader.m_relationShips.end(), [](const OpcPackageRelationshipPtr &rel) {
|
||||
auto itr = std::find_if(reader.mRelations.begin(), reader.mRelations.end(), [](const OpcPackageRelationshipPtr &rel) {
|
||||
return rel->type == XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE;
|
||||
});
|
||||
|
||||
if (itr == reader.m_relationShips.end()) {
|
||||
if (itr == reader.mRelations.end()) {
|
||||
throw DeadlyImportError("Cannot find ", XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -44,19 +44,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "3MFTypes.h"
|
||||
#include <assimp/scene.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Assimp {
|
||||
namespace D3MF {
|
||||
|
||||
static const int IdNotSet = -1;
|
||||
static constexpr int IdNotSet = -1;
|
||||
|
||||
namespace {
|
||||
|
||||
static const size_t ColRGBA_Len = 9;
|
||||
static const size_t ColRGB_Len = 7;
|
||||
static constexpr size_t ColRGBA_Len = 9;
|
||||
static constexpr size_t ColRGB_Len = 7;
|
||||
|
||||
// format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1)
|
||||
bool validateColorString(const char *color) {
|
||||
const size_t len = strlen(color);
|
||||
bool validateColorString(const std::string color) {
|
||||
const size_t len = color.size();
|
||||
if (ColRGBA_Len != len && ColRGB_Len != len) {
|
||||
return false;
|
||||
}
|
||||
@@ -64,7 +66,7 @@ bool validateColorString(const char *color) {
|
||||
return true;
|
||||
}
|
||||
|
||||
aiFace ReadTriangle(XmlNode &node) {
|
||||
aiFace ReadTriangle(XmlNode &node, int &texId0, int &texId1, int &texId2) {
|
||||
aiFace face;
|
||||
|
||||
face.mNumIndices = 3;
|
||||
@@ -73,6 +75,11 @@ aiFace ReadTriangle(XmlNode &node) {
|
||||
face.mIndices[1] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v2).as_string()));
|
||||
face.mIndices[2] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v3).as_string()));
|
||||
|
||||
texId0 = texId1 = texId2 = IdNotSet;
|
||||
XmlParser::getIntAttribute(node, XmlTag::p1, texId0);
|
||||
XmlParser::getIntAttribute(node, XmlTag::p2, texId1);
|
||||
XmlParser::getIntAttribute(node, XmlTag::p3, texId2);
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
@@ -106,7 +113,7 @@ bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &va
|
||||
return false;
|
||||
}
|
||||
|
||||
aiMatrix4x4 parseTransformMatrix(std::string matrixStr) {
|
||||
aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) {
|
||||
// split the string
|
||||
std::vector<float> numbers;
|
||||
std::string currentNumber;
|
||||
@@ -150,8 +157,8 @@ aiMatrix4x4 parseTransformMatrix(std::string matrixStr) {
|
||||
return transformMatrix;
|
||||
}
|
||||
|
||||
bool parseColor(const char *color, aiColor4D &diffuse) {
|
||||
if (nullptr == color) {
|
||||
bool parseColor(const std::string &color, aiColor4D &diffuse) {
|
||||
if (color.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -171,7 +178,7 @@ bool parseColor(const char *color, aiColor4D &diffuse) {
|
||||
|
||||
char b[3] = { color[5], color[6], '\0' };
|
||||
diffuse.b = static_cast<ai_real>(strtol(b, nullptr, 16)) / ai_real(255.0);
|
||||
const size_t len = strlen(color);
|
||||
const size_t len = color.size();
|
||||
if (ColRGB_Len == len) {
|
||||
return true;
|
||||
}
|
||||
@@ -192,11 +199,11 @@ void assignDiffuseColor(XmlNode &node, aiMaterial *mat) {
|
||||
|
||||
} // namespace
|
||||
|
||||
XmlSerializer::XmlSerializer(XmlParser *xmlParser) :
|
||||
XmlSerializer::XmlSerializer(XmlParser &xmlParser) :
|
||||
mResourcesDictionnary(),
|
||||
mMeshCount(0),
|
||||
mXmlParser(xmlParser) {
|
||||
ai_assert(nullptr != xmlParser);
|
||||
// empty
|
||||
}
|
||||
|
||||
XmlSerializer::~XmlSerializer() {
|
||||
@@ -209,9 +216,9 @@ void XmlSerializer::ImportXml(aiScene *scene) {
|
||||
if (nullptr == scene) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
scene->mRootNode = new aiNode(XmlTag::RootTag);
|
||||
XmlNode node = mXmlParser->getRootNode().child(XmlTag::model);
|
||||
XmlNode node = mXmlParser.getRootNode().child(XmlTag::model);
|
||||
if (node.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -229,6 +236,8 @@ void XmlSerializer::ImportXml(aiScene *scene) {
|
||||
ReadBaseMaterials(currentNode);
|
||||
} else if (currentNodeName == XmlTag::meta) {
|
||||
ReadMetadata(currentNode);
|
||||
} else if (currentNodeName == XmlTag::colorgroup) {
|
||||
ReadColorGroup(currentNode);
|
||||
}
|
||||
}
|
||||
StoreMaterialsInScene(scene);
|
||||
@@ -324,9 +333,49 @@ void XmlSerializer::ReadObject(XmlNode &node) {
|
||||
|
||||
if (hasPid) {
|
||||
auto it = mResourcesDictionnary.find(pid);
|
||||
if (hasPindex && it != mResourcesDictionnary.end() && it->second->getType() == ResourceType::RT_BaseMaterials) {
|
||||
BaseMaterials *materials = static_cast<BaseMaterials *>(it->second);
|
||||
mesh->mMaterialIndex = materials->mMaterialIndex[pindex];
|
||||
if (hasPindex && it != mResourcesDictionnary.end()) {
|
||||
if (it->second->getType() == ResourceType::RT_BaseMaterials) {
|
||||
BaseMaterials *materials = static_cast<BaseMaterials *>(it->second);
|
||||
mesh->mMaterialIndex = materials->mMaterialIndex[pindex];
|
||||
} else if (it->second->getType() == ResourceType::RT_Texture2DGroup) {
|
||||
Texture2DGroup *group = static_cast<Texture2DGroup *>(it->second);
|
||||
if (mesh->mTextureCoords[0] == nullptr) {
|
||||
mesh->mNumUVComponents[0] = 2;
|
||||
for (unsigned int i = 1; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||
mesh->mNumUVComponents[i] = 0;
|
||||
}
|
||||
|
||||
const std::string name = ai_to_string(group->mTexId);
|
||||
for (size_t i = 0; i < mMaterials.size(); ++i) {
|
||||
if (name == mMaterials[i]->GetName().C_Str()) {
|
||||
mesh->mMaterialIndex = static_cast<unsigned int>(i);
|
||||
}
|
||||
}
|
||||
|
||||
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
|
||||
for (unsigned int vertex_idx = 0; vertex_idx < mesh->mNumVertices; vertex_idx++) {
|
||||
mesh->mTextureCoords[0][vertex_idx] =
|
||||
aiVector3D(group->mTex2dCoords[pindex].x, group->mTex2dCoords[pindex].y, 0.0f);
|
||||
}
|
||||
} else {
|
||||
for (unsigned int vertex_idx = 0; vertex_idx < mesh->mNumVertices; vertex_idx++) {
|
||||
if (mesh->mTextureCoords[0][vertex_idx].z < 0) {
|
||||
// use default
|
||||
mesh->mTextureCoords[0][vertex_idx] =
|
||||
aiVector3D(group->mTex2dCoords[pindex].x, group->mTex2dCoords[pindex].y, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (it->second->getType() == ResourceType::RT_ColorGroup) {
|
||||
if (mesh->mColors[0] == nullptr) {
|
||||
mesh->mColors[0] = new aiColor4D[mesh->mNumVertices];
|
||||
|
||||
ColorGroup *group = static_cast<ColorGroup *>(it->second);
|
||||
for (unsigned int vertex_idx = 0; vertex_idx < mesh->mNumVertices; vertex_idx++) {
|
||||
mesh->mColors[0][vertex_idx] = group->mColors[pindex];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,35 +457,81 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
|
||||
for (XmlNode ¤tNode : node.children()) {
|
||||
const std::string currentName = currentNode.name();
|
||||
if (currentName == XmlTag::triangle) {
|
||||
int pid = IdNotSet, p1 = IdNotSet;
|
||||
int pid = IdNotSet;
|
||||
bool hasPid = getNodeAttribute(currentNode, D3MF::XmlTag::pid, pid);
|
||||
bool hasP1 = getNodeAttribute(currentNode, D3MF::XmlTag::p1, p1);
|
||||
|
||||
if (hasPid && hasP1) {
|
||||
int pindex[3];
|
||||
aiFace face = ReadTriangle(currentNode, pindex[0], pindex[1], pindex[2]);
|
||||
if (hasPid && (pindex[0] != IdNotSet || pindex[1] != IdNotSet || pindex[2] != IdNotSet)) {
|
||||
auto it = mResourcesDictionnary.find(pid);
|
||||
if (it != mResourcesDictionnary.end()) {
|
||||
if (it->second->getType() == ResourceType::RT_BaseMaterials) {
|
||||
BaseMaterials *baseMaterials = static_cast<BaseMaterials *>(it->second);
|
||||
mesh->mMaterialIndex = baseMaterials->mMaterialIndex[p1];
|
||||
|
||||
auto update_material = [&](int idx) {
|
||||
if (pindex[idx] != IdNotSet) {
|
||||
mesh->mMaterialIndex = baseMaterials->mMaterialIndex[pindex[idx]];
|
||||
}
|
||||
};
|
||||
|
||||
update_material(0);
|
||||
update_material(1);
|
||||
update_material(2);
|
||||
|
||||
} else if (it->second->getType() == ResourceType::RT_Texture2DGroup) {
|
||||
// Load texture coordinates into mesh, when any
|
||||
Texture2DGroup *group = static_cast<Texture2DGroup *>(it->second); // fix bug
|
||||
if (mesh->mTextureCoords[0] == nullptr) {
|
||||
Texture2DGroup *group = static_cast<Texture2DGroup *>(it->second);
|
||||
mesh->mNumUVComponents[0] = 2;
|
||||
for (unsigned int i = 1; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||
mesh->mNumUVComponents[i] = 0;
|
||||
}
|
||||
|
||||
const std::string name = ai_to_string(group->mTexId);
|
||||
for (size_t i = 0; i < mMaterials.size(); ++i) {
|
||||
if (name == mMaterials[i]->GetName().C_Str()) {
|
||||
mesh->mMaterialIndex = static_cast<unsigned int>(i);
|
||||
}
|
||||
}
|
||||
mesh->mTextureCoords[0] = new aiVector3D[group->mTex2dCoords.size()];
|
||||
for (unsigned int i = 0; i < group->mTex2dCoords.size(); ++i) {
|
||||
mesh->mTextureCoords[0][i] = aiVector3D(group->mTex2dCoords[i].x, group->mTex2dCoords[i].y, 0);
|
||||
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
|
||||
for (unsigned int vertex_index = 0; vertex_index < mesh->mNumVertices; vertex_index++) {
|
||||
mesh->mTextureCoords[0][vertex_index].z = IdNotSet;//mark not set
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto update_texture = [&](int idx) {
|
||||
if (pindex[idx] != IdNotSet) {
|
||||
size_t vertex_index = face.mIndices[idx];
|
||||
mesh->mTextureCoords[0][vertex_index] =
|
||||
aiVector3D(group->mTex2dCoords[pindex[idx]].x, group->mTex2dCoords[pindex[idx]].y, 0.0f);
|
||||
}
|
||||
};
|
||||
|
||||
update_texture(0);
|
||||
update_texture(1);
|
||||
update_texture(2);
|
||||
|
||||
} else if (it->second->getType() == ResourceType::RT_ColorGroup) {
|
||||
// Load vertex color into mesh, when any
|
||||
ColorGroup *group = static_cast<ColorGroup *>(it->second);
|
||||
if (mesh->mColors[0] == nullptr) {
|
||||
mesh->mColors[0] = new aiColor4D[mesh->mNumVertices];
|
||||
}
|
||||
|
||||
auto update_color = [&](int idx) {
|
||||
if (pindex[idx] != IdNotSet) {
|
||||
size_t vertex_index = face.mIndices[idx];
|
||||
mesh->mColors[0][vertex_index] = group->mColors[pindex[idx]];
|
||||
}
|
||||
};
|
||||
|
||||
update_color(0);
|
||||
update_color(1);
|
||||
update_color(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aiFace face = ReadTriangle(currentNode);
|
||||
faces.push_back(face);
|
||||
}
|
||||
}
|
||||
@@ -563,7 +658,7 @@ aiMaterial *XmlSerializer::readMaterialDef(XmlNode &node, unsigned int basemater
|
||||
stdMaterialName += strId;
|
||||
stdMaterialName += "_";
|
||||
if (hasName) {
|
||||
stdMaterialName += std::string(name);
|
||||
stdMaterialName += name;
|
||||
} else {
|
||||
stdMaterialName += "basemat_";
|
||||
stdMaterialName += ai_to_string(mMaterials.size());
|
||||
@@ -577,12 +672,48 @@ aiMaterial *XmlSerializer::readMaterialDef(XmlNode &node, unsigned int basemater
|
||||
return material;
|
||||
}
|
||||
|
||||
void XmlSerializer::ReadColor(XmlNode &node, ColorGroup *colorGroup) {
|
||||
if (node.empty() || nullptr == colorGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (XmlNode currentNode : node.children()) {
|
||||
const std::string currentName = currentNode.name();
|
||||
if (currentName == XmlTag::color_item) {
|
||||
const char *color = currentNode.attribute(XmlTag::color_value).as_string();
|
||||
aiColor4D color_value;
|
||||
if (parseColor(color, color_value)) {
|
||||
colorGroup->mColors.push_back(color_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XmlSerializer::ReadColorGroup(XmlNode &node) {
|
||||
if (node.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int id = IdNotSet;
|
||||
if (!XmlParser::getIntAttribute(node, XmlTag::id, id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ColorGroup *group = new ColorGroup(id);
|
||||
ReadColor(node, group);
|
||||
mResourcesDictionnary.insert(std::make_pair(id, group));
|
||||
}
|
||||
|
||||
void XmlSerializer::StoreMaterialsInScene(aiScene *scene) {
|
||||
if (nullptr == scene || mMaterials.empty()) {
|
||||
if (nullptr == scene) {
|
||||
return;
|
||||
}
|
||||
|
||||
scene->mNumMaterials = static_cast<unsigned int>(mMaterials.size());
|
||||
if (scene->mNumMaterials == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
scene->mMaterials = new aiMaterial *[scene->mNumMaterials];
|
||||
for (size_t i = 0; i < mMaterials.size(); ++i) {
|
||||
scene->mMaterials[i] = mMaterials[i];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -57,10 +57,12 @@ class D3MFOpcPackage;
|
||||
class Object;
|
||||
class Texture2DGroup;
|
||||
class EmbeddedTexture;
|
||||
class ColorGroup;
|
||||
|
||||
class XmlSerializer {
|
||||
/// @brief his class implements ther 3mf serialization.
|
||||
class XmlSerializer final {
|
||||
public:
|
||||
XmlSerializer(XmlParser *xmlParser);
|
||||
explicit XmlSerializer(XmlParser &xmlParser);
|
||||
~XmlSerializer();
|
||||
void ImportXml(aiScene *scene);
|
||||
|
||||
@@ -78,6 +80,8 @@ private:
|
||||
void ReadTextureGroup(XmlNode &node);
|
||||
aiMaterial *readMaterialDef(XmlNode &node, unsigned int basematerialsId);
|
||||
void StoreMaterialsInScene(aiScene *scene);
|
||||
void ReadColorGroup(XmlNode &node);
|
||||
void ReadColor(XmlNode &node, ColorGroup *colorGroup);
|
||||
|
||||
private:
|
||||
struct MetaEntry {
|
||||
@@ -89,7 +93,7 @@ private:
|
||||
std::vector<aiMaterial *> mMaterials;
|
||||
std::map<unsigned int, Resource *> mResourcesDictionnary;
|
||||
unsigned int mMeshCount;
|
||||
XmlParser *mXmlParser;
|
||||
XmlParser &mXmlParser;
|
||||
};
|
||||
|
||||
} // namespace D3MF
|
||||
|
||||
+170
-139
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -60,9 +60,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"AC3D Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -75,10 +75,12 @@ static const aiImporterDesc desc = {
|
||||
"ac acc ac3d"
|
||||
};
|
||||
|
||||
static constexpr auto ACDoubleSidedFlag = 0x20;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// skip to the next token
|
||||
inline const char *AcSkipToNextToken(const char *buffer) {
|
||||
if (!SkipSpaces(&buffer)) {
|
||||
inline const char *AcSkipToNextToken(const char *buffer, const char *end) {
|
||||
if (!SkipSpaces(&buffer, end)) {
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL");
|
||||
}
|
||||
return buffer;
|
||||
@@ -86,13 +88,13 @@ inline const char *AcSkipToNextToken(const char *buffer) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// read a string (may be enclosed in double quotation marks). buffer must point to "
|
||||
inline const char *AcGetString(const char *buffer, std::string &out) {
|
||||
inline const char *AcGetString(const char *buffer, const char *end, std::string &out) {
|
||||
if (*buffer == '\0') {
|
||||
throw DeadlyImportError("AC3D: Unexpected EOF in string");
|
||||
}
|
||||
++buffer;
|
||||
const char *sz = buffer;
|
||||
while ('\"' != *buffer) {
|
||||
while ('\"' != *buffer && buffer != end) {
|
||||
if (IsLineEnd(*buffer)) {
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL in string");
|
||||
out = "ERROR";
|
||||
@@ -112,8 +114,8 @@ inline const char *AcGetString(const char *buffer, std::string &out) {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// read 1 to n floats prefixed with an optional predefined identifier
|
||||
template <class T>
|
||||
inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *name, size_t name_length, size_t num, T *out) {
|
||||
buffer = AcSkipToNextToken(buffer);
|
||||
inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *end, const char *name, size_t name_length, size_t num, T *out) {
|
||||
buffer = AcSkipToNextToken(buffer, end);
|
||||
if (0 != name_length) {
|
||||
if (0 != strncmp(buffer, name, name_length) || !IsSpace(buffer[name_length])) {
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected token. ", name, " was expected.");
|
||||
@@ -122,17 +124,41 @@ inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *name
|
||||
buffer += name_length + 1;
|
||||
}
|
||||
for (unsigned int _i = 0; _i < num; ++_i) {
|
||||
buffer = AcSkipToNextToken(buffer);
|
||||
buffer = fast_atoreal_move<float>(buffer, ((float *)out)[_i]);
|
||||
buffer = AcSkipToNextToken(buffer, end);
|
||||
buffer = fast_atoreal_move(buffer, ((float *)out)[_i]);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Reverses vertex indices in a face.
|
||||
static void flipWindingOrder(aiFace &f) {
|
||||
std::reverse(f.mIndices, f.mIndices + f.mNumIndices);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Duplicates a face and inverts it. Also duplicates all vertices (so the new face gets its own
|
||||
// set of normals and isn’t smoothed against the original).
|
||||
static void buildBacksideOfFace(const aiFace &origFace, aiFace *&outFaces, aiVector3D *&outVertices, const aiVector3D *allVertices,
|
||||
aiVector3D *&outUV, const aiVector3D *allUV, unsigned &curIdx) {
|
||||
auto &newFace = *outFaces++;
|
||||
newFace = origFace;
|
||||
flipWindingOrder(newFace);
|
||||
for (unsigned f = 0; f < newFace.mNumIndices; ++f) {
|
||||
*outVertices++ = allVertices[newFace.mIndices[f]];
|
||||
if (outUV) {
|
||||
*outUV = allUV[newFace.mIndices[f]];
|
||||
outUV++;
|
||||
}
|
||||
newFace.mIndices[f] = curIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
AC3DImporter::AC3DImporter() :
|
||||
buffer(),
|
||||
mBuffer(),
|
||||
configSplitBFCull(),
|
||||
configEvalSubdivision(),
|
||||
mNumMeshes(),
|
||||
@@ -144,16 +170,10 @@ AC3DImporter::AC3DImporter() :
|
||||
// nothing to be done here
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
AC3DImporter::~AC3DImporter() {
|
||||
// nothing to be done here
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool AC3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
static const uint32_t tokens[] = { AI_MAKE_MAGIC("AC3D") };
|
||||
static constexpr uint32_t tokens[] = { AI_MAKE_MAGIC("AC3D") };
|
||||
return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
|
||||
}
|
||||
|
||||
@@ -166,25 +186,26 @@ const aiImporterDesc *AC3DImporter::GetInfo() const {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Get a pointer to the next line from the file
|
||||
bool AC3DImporter::GetNextLine() {
|
||||
SkipLine(&buffer);
|
||||
return SkipSpaces(&buffer);
|
||||
SkipLine(&mBuffer.data, mBuffer.end);
|
||||
return SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Parse an object section in an AC file
|
||||
void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
|
||||
if (!TokenMatch(buffer, "OBJECT", 6))
|
||||
return;
|
||||
bool AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
|
||||
if (!TokenMatch(mBuffer.data, "OBJECT", 6)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkipSpaces(&buffer);
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
|
||||
++mNumMeshes;
|
||||
|
||||
objects.push_back(Object());
|
||||
objects.emplace_back();
|
||||
Object &obj = objects.back();
|
||||
|
||||
aiLight *light = nullptr;
|
||||
if (!ASSIMP_strincmp(buffer, "light", 5)) {
|
||||
if (!ASSIMP_strincmp(mBuffer.data, "light", 5)) {
|
||||
// This is a light source. Add it to the list
|
||||
mLights->push_back(light = new aiLight());
|
||||
|
||||
@@ -194,66 +215,73 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
|
||||
light->mAttenuationConstant = 1.f;
|
||||
|
||||
// Generate a default name for both the light source and the node
|
||||
// FIXME - what's the right way to print a size_t? Is 'zu' universally available? stick with the safe version.
|
||||
light->mName.length = ::ai_snprintf(light->mName.data, MAXLEN, "ACLight_%i", static_cast<unsigned int>(mLights->size()) - 1);
|
||||
light->mName.length = ::ai_snprintf(light->mName.data, AI_MAXLEN, "ACLight_%i", static_cast<unsigned int>(mLights->size()) - 1);
|
||||
obj.name = std::string(light->mName.data);
|
||||
|
||||
ASSIMP_LOG_VERBOSE_DEBUG("AC3D: Light source encountered");
|
||||
obj.type = Object::Light;
|
||||
} else if (!ASSIMP_strincmp(buffer, "group", 5)) {
|
||||
} else if (!ASSIMP_strincmp(mBuffer.data, "group", 5)) {
|
||||
obj.type = Object::Group;
|
||||
} else if (!ASSIMP_strincmp(buffer, "world", 5)) {
|
||||
} else if (!ASSIMP_strincmp(mBuffer.data, "world", 5)) {
|
||||
obj.type = Object::World;
|
||||
} else
|
||||
} else {
|
||||
obj.type = Object::Poly;
|
||||
}
|
||||
|
||||
while (GetNextLine()) {
|
||||
if (TokenMatch(buffer, "kids", 4)) {
|
||||
SkipSpaces(&buffer);
|
||||
unsigned int num = strtoul10(buffer, &buffer);
|
||||
if (TokenMatch(mBuffer.data, "kids", 4)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
unsigned int num = strtoul10(mBuffer.data, &mBuffer.data);
|
||||
GetNextLine();
|
||||
if (num) {
|
||||
// load the children of this object recursively
|
||||
obj.children.reserve(num);
|
||||
for (unsigned int i = 0; i < num; ++i)
|
||||
LoadObjectSection(obj.children);
|
||||
for (unsigned int i = 0; i < num; ++i) {
|
||||
if (!LoadObjectSection(obj.children)) {
|
||||
ASSIMP_LOG_WARN("AC3D: wrong number of kids");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (TokenMatch(buffer, "name", 4)) {
|
||||
SkipSpaces(&buffer);
|
||||
buffer = AcGetString(buffer, obj.name);
|
||||
return true;
|
||||
} else if (TokenMatch(mBuffer.data, "name", 4)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.data);
|
||||
mBuffer.data = AcGetString(mBuffer.data, mBuffer.end, obj.name);
|
||||
|
||||
// If this is a light source, we'll also need to store
|
||||
// the name of the node in it.
|
||||
if (light) {
|
||||
light->mName.Set(obj.name);
|
||||
}
|
||||
} else if (TokenMatch(buffer, "texture", 7)) {
|
||||
SkipSpaces(&buffer);
|
||||
buffer = AcGetString(buffer, obj.texture);
|
||||
} else if (TokenMatch(buffer, "texrep", 6)) {
|
||||
SkipSpaces(&buffer);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &obj.texRepeat);
|
||||
} else if (TokenMatch(mBuffer.data, "texture", 7)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
std::string texture;
|
||||
mBuffer.data = AcGetString(mBuffer.data, mBuffer.end, texture);
|
||||
obj.textures.push_back(texture);
|
||||
} else if (TokenMatch(mBuffer.data, "texrep", 6)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 2, &obj.texRepeat);
|
||||
if (!obj.texRepeat.x || !obj.texRepeat.y)
|
||||
obj.texRepeat = aiVector2D(1.f, 1.f);
|
||||
} else if (TokenMatch(buffer, "texoff", 6)) {
|
||||
SkipSpaces(&buffer);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &obj.texOffset);
|
||||
} else if (TokenMatch(buffer, "rot", 3)) {
|
||||
SkipSpaces(&buffer);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 9, &obj.rotation);
|
||||
} else if (TokenMatch(buffer, "loc", 3)) {
|
||||
SkipSpaces(&buffer);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 3, &obj.translation);
|
||||
} else if (TokenMatch(buffer, "subdiv", 6)) {
|
||||
SkipSpaces(&buffer);
|
||||
obj.subDiv = strtoul10(buffer, &buffer);
|
||||
} else if (TokenMatch(buffer, "crease", 6)) {
|
||||
SkipSpaces(&buffer);
|
||||
obj.crease = fast_atof(buffer);
|
||||
} else if (TokenMatch(buffer, "numvert", 7)) {
|
||||
SkipSpaces(&buffer);
|
||||
} else if (TokenMatch(mBuffer.data, "texoff", 6)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 2, &obj.texOffset);
|
||||
} else if (TokenMatch(mBuffer.data, "rot", 3)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 9, &obj.rotation);
|
||||
} else if (TokenMatch(mBuffer.data, "loc", 3)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 3, &obj.translation);
|
||||
} else if (TokenMatch(mBuffer.data, "subdiv", 6)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
obj.subDiv = strtoul10(mBuffer.data, &mBuffer.data);
|
||||
} else if (TokenMatch(mBuffer.data, "crease", 6)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
obj.crease = fast_atof(mBuffer.data);
|
||||
} else if (TokenMatch(mBuffer.data, "numvert", 7)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
|
||||
unsigned int t = strtoul10(buffer, &buffer);
|
||||
unsigned int t = strtoul10(mBuffer.data, &mBuffer.data);
|
||||
if (t >= AI_MAX_ALLOC(aiVector3D)) {
|
||||
throw DeadlyImportError("AC3D: Too many vertices, would run out of memory");
|
||||
}
|
||||
@@ -262,59 +290,59 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
|
||||
if (!GetNextLine()) {
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: not all vertices have been parsed yet");
|
||||
break;
|
||||
} else if (!IsNumeric(*buffer)) {
|
||||
} else if (!IsNumeric(*mBuffer.data)) {
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected token: not all vertices have been parsed yet");
|
||||
--buffer; // make sure the line is processed a second time
|
||||
--mBuffer.data; // make sure the line is processed a second time
|
||||
break;
|
||||
}
|
||||
obj.vertices.push_back(aiVector3D());
|
||||
obj.vertices.emplace_back();
|
||||
aiVector3D &v = obj.vertices.back();
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 3, &v.x);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 3, &v.x);
|
||||
}
|
||||
} else if (TokenMatch(buffer, "numsurf", 7)) {
|
||||
SkipSpaces(&buffer);
|
||||
} else if (TokenMatch(mBuffer.data, "numsurf", 7)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
|
||||
bool Q3DWorkAround = false;
|
||||
|
||||
const unsigned int t = strtoul10(buffer, &buffer);
|
||||
const unsigned int t = strtoul10(mBuffer.data, &mBuffer.data);
|
||||
obj.surfaces.reserve(t);
|
||||
for (unsigned int i = 0; i < t; ++i) {
|
||||
GetNextLine();
|
||||
if (!TokenMatch(buffer, "SURF", 4)) {
|
||||
if (!TokenMatch(mBuffer.data, "SURF", 4)) {
|
||||
// FIX: this can occur for some files - Quick 3D for
|
||||
// example writes no surf chunks
|
||||
if (!Q3DWorkAround) {
|
||||
ASSIMP_LOG_WARN("AC3D: SURF token was expected");
|
||||
ASSIMP_LOG_VERBOSE_DEBUG("Continuing with Quick3D Workaround enabled");
|
||||
}
|
||||
--buffer; // make sure the line is processed a second time
|
||||
--mBuffer.data; // make sure the line is processed a second time
|
||||
// break; --- see fix notes above
|
||||
|
||||
Q3DWorkAround = true;
|
||||
}
|
||||
SkipSpaces(&buffer);
|
||||
obj.surfaces.push_back(Surface());
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
obj.surfaces.emplace_back();
|
||||
Surface &surf = obj.surfaces.back();
|
||||
surf.flags = strtoul_cppstyle(buffer);
|
||||
surf.flags = strtoul_cppstyle(mBuffer.data);
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
if (!GetNextLine()) {
|
||||
throw DeadlyImportError("AC3D: Unexpected EOF: surface is incomplete");
|
||||
}
|
||||
if (TokenMatch(buffer, "mat", 3)) {
|
||||
SkipSpaces(&buffer);
|
||||
surf.mat = strtoul10(buffer);
|
||||
} else if (TokenMatch(buffer, "refs", 4)) {
|
||||
if (TokenMatch(mBuffer.data, "mat", 3)) {
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
surf.mat = strtoul10(mBuffer.data);
|
||||
} else if (TokenMatch(mBuffer.data, "refs", 4)) {
|
||||
// --- see fix notes above
|
||||
if (Q3DWorkAround) {
|
||||
if (!surf.entries.empty()) {
|
||||
buffer -= 6;
|
||||
mBuffer.data -= 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SkipSpaces(&buffer);
|
||||
const unsigned int m = strtoul10(buffer);
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
const unsigned int m = strtoul10(mBuffer.data);
|
||||
surf.entries.reserve(m);
|
||||
|
||||
obj.numRefs += m;
|
||||
@@ -324,15 +352,15 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: surface references are incomplete");
|
||||
break;
|
||||
}
|
||||
surf.entries.push_back(Surface::SurfaceEntry());
|
||||
surf.entries.emplace_back();
|
||||
Surface::SurfaceEntry &entry = surf.entries.back();
|
||||
|
||||
entry.first = strtoul10(buffer, &buffer);
|
||||
SkipSpaces(&buffer);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &entry.second);
|
||||
entry.first = strtoul10(mBuffer.data, &mBuffer.data);
|
||||
SkipSpaces(&mBuffer.data, mBuffer.end);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 2, &entry.second);
|
||||
}
|
||||
} else {
|
||||
--buffer; // make sure the line is processed a second time
|
||||
--mBuffer.data; // make sure the line is processed a second time
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -340,6 +368,8 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
|
||||
}
|
||||
}
|
||||
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: \'kids\' line was expected");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -353,8 +383,8 @@ void AC3DImporter::ConvertMaterial(const Object &object,
|
||||
s.Set(matSrc.name);
|
||||
matDest.AddProperty(&s, AI_MATKEY_NAME);
|
||||
}
|
||||
if (object.texture.length()) {
|
||||
s.Set(object.texture);
|
||||
if (!object.textures.empty()) {
|
||||
s.Set(object.textures[0]);
|
||||
matDest.AddProperty(&s, AI_MATKEY_TEXTURE_DIFFUSE(0));
|
||||
|
||||
// UV transformation
|
||||
@@ -445,8 +475,10 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
idx = 0;
|
||||
}
|
||||
if ((*it).entries.empty()) {
|
||||
ASSIMP_LOG_WARN("AC3D: surface her zero vertex references");
|
||||
ASSIMP_LOG_WARN("AC3D: surface has zero vertex references");
|
||||
}
|
||||
const bool isDoubleSided = ACDoubleSidedFlag == (it->flags & ACDoubleSidedFlag);
|
||||
const int doubleSidedFactor = isDoubleSided ? 2 : 1;
|
||||
|
||||
// validate all vertex indices to make sure we won't crash here
|
||||
for (it2 = (*it).entries.begin(),
|
||||
@@ -463,22 +495,21 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
}
|
||||
|
||||
switch ((*it).GetType()) {
|
||||
// closed line
|
||||
case Surface::ClosedLine:
|
||||
needMat[idx].first += (unsigned int)(*it).entries.size();
|
||||
needMat[idx].second += (unsigned int)(*it).entries.size() << 1u;
|
||||
case Surface::ClosedLine: // closed line
|
||||
needMat[idx].first += static_cast<unsigned int>((*it).entries.size());
|
||||
needMat[idx].second += static_cast<unsigned int>((*it).entries.size() << 1u);
|
||||
break;
|
||||
|
||||
// unclosed line
|
||||
case Surface::OpenLine:
|
||||
needMat[idx].first += (unsigned int)(*it).entries.size() - 1;
|
||||
needMat[idx].second += ((unsigned int)(*it).entries.size() - 1) << 1u;
|
||||
needMat[idx].first += static_cast<unsigned int>((*it).entries.size() - 1);
|
||||
needMat[idx].second += static_cast<unsigned int>(((*it).entries.size() - 1) << 1u);
|
||||
break;
|
||||
|
||||
// triangle strip
|
||||
case Surface::TriangleStrip:
|
||||
needMat[idx].first += (unsigned int)(*it).entries.size() - 2;
|
||||
needMat[idx].second += ((unsigned int)(*it).entries.size() - 2) * 3;
|
||||
needMat[idx].first += static_cast<unsigned int>(it->entries.size() - 2) * doubleSidedFactor;
|
||||
needMat[idx].second += static_cast<unsigned int>(it->entries.size() - 2) * 3 * doubleSidedFactor;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -491,8 +522,8 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
case Surface::Polygon:
|
||||
// the number of faces increments by one, the number
|
||||
// of vertices by surface.numref.
|
||||
needMat[idx].first++;
|
||||
needMat[idx].second += (unsigned int)(*it).entries.size();
|
||||
needMat[idx].first += doubleSidedFactor;
|
||||
needMat[idx].second += static_cast<unsigned int>(it->entries.size()) * doubleSidedFactor;
|
||||
};
|
||||
}
|
||||
unsigned int *pip = node->mMeshes = new unsigned int[node->mNumMeshes];
|
||||
@@ -534,7 +565,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
// allocate UV coordinates, but only if the texture name for the
|
||||
// surface is not empty
|
||||
aiVector3D *uv = nullptr;
|
||||
if (object.texture.length()) {
|
||||
if (!object.textures.empty()) {
|
||||
uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
|
||||
mesh->mNumUVComponents[0] = 2;
|
||||
}
|
||||
@@ -542,6 +573,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
for (it = object.surfaces.begin(); it != end; ++it) {
|
||||
if (mat == (*it).mat) {
|
||||
const Surface &src = *it;
|
||||
const bool isDoubleSided = ACDoubleSidedFlag == (src.flags & ACDoubleSidedFlag);
|
||||
|
||||
// closed polygon
|
||||
uint8_t type = (*it).GetType();
|
||||
@@ -567,6 +599,8 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
++uv;
|
||||
}
|
||||
}
|
||||
if(isDoubleSided) // Need a backface?
|
||||
buildBacksideOfFace(faces[-1], faces, vertices, mesh->mVertices, uv, mesh->mTextureCoords[0], cur);
|
||||
}
|
||||
} else if (type == Surface::TriangleStrip) {
|
||||
for (unsigned int i = 0; i < (unsigned int)src.entries.size() - 2; ++i) {
|
||||
@@ -574,15 +608,6 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
const Surface::SurfaceEntry &entry2 = src.entries[i + 1];
|
||||
const Surface::SurfaceEntry &entry3 = src.entries[i + 2];
|
||||
|
||||
// skip degenerate triangles
|
||||
if (object.vertices[entry1.first] == object.vertices[entry2.first] ||
|
||||
object.vertices[entry1.first] == object.vertices[entry3.first] ||
|
||||
object.vertices[entry2.first] == object.vertices[entry3.first]) {
|
||||
mesh->mNumFaces--;
|
||||
mesh->mNumVertices -= 3;
|
||||
continue;
|
||||
}
|
||||
|
||||
aiFace &face = *faces++;
|
||||
face.mNumIndices = 3;
|
||||
face.mIndices = new unsigned int[face.mNumIndices];
|
||||
@@ -625,6 +650,8 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
uv->y = entry3.second.y;
|
||||
++uv;
|
||||
}
|
||||
if(isDoubleSided) // Need a backface?
|
||||
buildBacksideOfFace(faces[-1], faces, vertices, mesh->mVertices, uv, mesh->mTextureCoords[0], cur);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -701,18 +728,18 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||
// generate a name depending on the type of the node
|
||||
switch (object.type) {
|
||||
case Object::Group:
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACGroup_%i", mGroupsCounter++);
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, AI_MAXLEN, "ACGroup_%i", mGroupsCounter++);
|
||||
break;
|
||||
case Object::Poly:
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACPoly_%i", mPolysCounter++);
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, AI_MAXLEN, "ACPoly_%i", mPolysCounter++);
|
||||
break;
|
||||
case Object::Light:
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACLight_%i", mLightsCounter++);
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, AI_MAXLEN, "ACLight_%i", mLightsCounter++);
|
||||
break;
|
||||
|
||||
// there shouldn't be more than one world, but we don't care
|
||||
case Object::World:
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, MAXLEN, "ACWorld_%i", mWorldsCounter++);
|
||||
node->mName.length = ::ai_snprintf(node->mName.data, AI_MAXLEN, "ACWorld_%i", mWorldsCounter++);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -752,7 +779,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr) {
|
||||
if (file == nullptr) {
|
||||
throw DeadlyImportError("Failed to open AC3D file ", pFile, ".");
|
||||
}
|
||||
|
||||
@@ -760,17 +787,18 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||
std::vector<char> mBuffer2;
|
||||
TextFileToBuffer(file.get(), mBuffer2);
|
||||
|
||||
buffer = &mBuffer2[0];
|
||||
mBuffer.data = &mBuffer2[0];
|
||||
mBuffer.end = &mBuffer2[0] + mBuffer2.size();
|
||||
mNumMeshes = 0;
|
||||
|
||||
mLightsCounter = mPolysCounter = mWorldsCounter = mGroupsCounter = 0;
|
||||
|
||||
if (::strncmp(buffer, "AC3D", 4)) {
|
||||
if (::strncmp(mBuffer.data, "AC3D", 4)) {
|
||||
throw DeadlyImportError("AC3D: No valid AC3D file, magic sequence not found");
|
||||
}
|
||||
|
||||
// print the file format version to the console
|
||||
unsigned int version = HexDigitToDecimal(buffer[4]);
|
||||
unsigned int version = HexDigitToDecimal(mBuffer.data[4]);
|
||||
char msg[3];
|
||||
ASSIMP_itoa10(msg, 3, version);
|
||||
ASSIMP_LOG_INFO("AC3D file format version: ", msg);
|
||||
@@ -785,35 +813,36 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||
mLights = &lights;
|
||||
|
||||
while (GetNextLine()) {
|
||||
if (TokenMatch(buffer, "MATERIAL", 8)) {
|
||||
materials.push_back(Material());
|
||||
if (TokenMatch(mBuffer.data, "MATERIAL", 8)) {
|
||||
materials.emplace_back();
|
||||
Material &mat = materials.back();
|
||||
|
||||
// manually parse the material ... sscanf would use the buldin atof ...
|
||||
// Format: (name) rgb %f %f %f amb %f %f %f emis %f %f %f spec %f %f %f shi %d trans %f
|
||||
|
||||
buffer = AcSkipToNextToken(buffer);
|
||||
if ('\"' == *buffer) {
|
||||
buffer = AcGetString(buffer, mat.name);
|
||||
buffer = AcSkipToNextToken(buffer);
|
||||
mBuffer.data = AcSkipToNextToken(mBuffer.data, mBuffer.end);
|
||||
if ('\"' == *mBuffer.data) {
|
||||
mBuffer.data = AcGetString(mBuffer.data, mBuffer.end, mat.name);
|
||||
mBuffer.data = AcSkipToNextToken(mBuffer.data, mBuffer.end);
|
||||
}
|
||||
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "rgb", 3, 3, &mat.rgb);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "amb", 3, 3, &mat.amb);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "emis", 4, 3, &mat.emis);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "spec", 4, 3, &mat.spec);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "shi", 3, 1, &mat.shin);
|
||||
buffer = TAcCheckedLoadFloatArray(buffer, "trans", 5, 1, &mat.trans);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "rgb", 3, 3, &mat.rgb);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "amb", 3, 3, &mat.amb);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "emis", 4, 3, &mat.emis);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "spec", 4, 3, &mat.spec);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "shi", 3, 1, &mat.shin);
|
||||
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "trans", 5, 1, &mat.trans);
|
||||
} else {
|
||||
LoadObjectSection(rootObjects);
|
||||
}
|
||||
LoadObjectSection(rootObjects);
|
||||
}
|
||||
|
||||
if (rootObjects.empty() || !mNumMeshes) {
|
||||
if (rootObjects.empty() || mNumMeshes == 0u) {
|
||||
throw DeadlyImportError("AC3D: No meshes have been loaded");
|
||||
}
|
||||
if (materials.empty()) {
|
||||
ASSIMP_LOG_WARN("AC3D: No material has been found");
|
||||
materials.push_back(Material());
|
||||
materials.emplace_back();
|
||||
}
|
||||
|
||||
mNumMeshes += (mNumMeshes >> 2u) + 1;
|
||||
@@ -824,7 +853,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||
materials.reserve(mNumMeshes);
|
||||
|
||||
// generate a dummy root if there are multiple objects on the top layer
|
||||
Object *root;
|
||||
Object *root = nullptr;
|
||||
if (1 == rootObjects.size())
|
||||
root = &rootObjects[0];
|
||||
else {
|
||||
@@ -837,7 +866,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||
delete root;
|
||||
}
|
||||
|
||||
if (!::strncmp(pScene->mRootNode->mName.data, "Node", 4)) {
|
||||
if (::strncmp(pScene->mRootNode->mName.data, "Node", 4) == 0) {
|
||||
pScene->mRootNode->mName.Set("<AC3DWorld>");
|
||||
}
|
||||
|
||||
@@ -856,10 +885,12 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
|
||||
|
||||
// copy lights
|
||||
pScene->mNumLights = (unsigned int)lights.size();
|
||||
if (lights.size()) {
|
||||
if (!lights.empty()) {
|
||||
pScene->mLights = new aiLight *[lights.size()];
|
||||
::memcpy(pScene->mLights, &lights[0], lights.size() * sizeof(void *));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -60,10 +60,10 @@ namespace Assimp {
|
||||
// ---------------------------------------------------------------------------
|
||||
/** AC3D (*.ac) importer class
|
||||
*/
|
||||
class AC3DImporter : public BaseImporter {
|
||||
class AC3DImporter final : public BaseImporter {
|
||||
public:
|
||||
AC3DImporter();
|
||||
~AC3DImporter() override;
|
||||
~AC3DImporter() override = default;
|
||||
|
||||
// Represents an AC3D material
|
||||
struct Material {
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
unsigned int mat, flags;
|
||||
|
||||
typedef std::pair<unsigned int, aiVector2D> SurfaceEntry;
|
||||
using SurfaceEntry = std::pair<unsigned int, aiVector2D>;
|
||||
std::vector<SurfaceEntry> entries;
|
||||
|
||||
// Type is low nibble of flags
|
||||
@@ -125,7 +125,6 @@ public:
|
||||
type(World),
|
||||
name(),
|
||||
children(),
|
||||
texture(),
|
||||
texRepeat(1.f, 1.f),
|
||||
texOffset(0.0f, 0.0f),
|
||||
rotation(),
|
||||
@@ -151,7 +150,8 @@ public:
|
||||
std::vector<Object> children;
|
||||
|
||||
// texture to be assigned to all surfaces of the object
|
||||
std::string texture;
|
||||
// the .acc format supports up to 4 textures
|
||||
std::vector<std::string> textures;
|
||||
|
||||
// texture repat factors (scaling for all coordinates)
|
||||
aiVector2D texRepeat, texOffset;
|
||||
@@ -216,7 +216,7 @@ private:
|
||||
* load subobjects, the method returns after a 'kids 0' was
|
||||
* encountered.
|
||||
* @objects List of output objects*/
|
||||
void LoadObjectSection(std::vector<Object> &objects);
|
||||
bool LoadObjectSection(std::vector<Object> &objects);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Convert all objects into meshes and nodes.
|
||||
@@ -242,7 +242,7 @@ private:
|
||||
|
||||
private:
|
||||
// points to the next data line
|
||||
const char *buffer;
|
||||
aiBuffer mBuffer;
|
||||
|
||||
// Configuration option: if enabled, up to two meshes
|
||||
// are generated per material: those faces who have
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
const aiImporterDesc AMFImporter::Description = {
|
||||
static constexpr aiImporterDesc Description = {
|
||||
"Additive manufacturing file format(AMF) Importer",
|
||||
"smalcom",
|
||||
"",
|
||||
@@ -83,11 +83,7 @@ void AMFImporter::Clear() {
|
||||
|
||||
AMFImporter::AMFImporter() AI_NO_EXCEPT :
|
||||
mNodeElement_Cur(nullptr),
|
||||
mXmlParser(nullptr),
|
||||
mUnit(),
|
||||
mVersion(),
|
||||
mMaterial_Converted(),
|
||||
mTexture_Converted() {
|
||||
mXmlParser(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
@@ -182,28 +178,6 @@ bool AMFImporter::XML_SearchNode(const std::string &nodeName) {
|
||||
return nullptr != mXmlParser->findNode(nodeName);
|
||||
}
|
||||
|
||||
void AMFImporter::ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString) {
|
||||
size_t instr_len;
|
||||
|
||||
pOutString.clear();
|
||||
instr_len = strlen(pInStr);
|
||||
if (!instr_len) return;
|
||||
|
||||
pOutString.reserve(instr_len * 3 / 2);
|
||||
// check and correct floats in format ".x". Must be "x.y".
|
||||
if (pInStr[0] == '.') pOutString.push_back('0');
|
||||
|
||||
pOutString.push_back(pInStr[0]);
|
||||
for (size_t ci = 1; ci < instr_len; ci++) {
|
||||
if ((pInStr[ci] == '.') && ((pInStr[ci - 1] == ' ') || (pInStr[ci - 1] == '-') || (pInStr[ci - 1] == '+') || (pInStr[ci - 1] == '\t'))) {
|
||||
pOutString.push_back('0');
|
||||
pOutString.push_back('.');
|
||||
} else {
|
||||
pOutString.push_back(pInStr[ci]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool ParseHelper_Decode_Base64_IsBase64(const char pChar) {
|
||||
return (isalnum((unsigned char)pChar) || (pChar == '+') || (pChar == '/'));
|
||||
}
|
||||
@@ -217,7 +191,10 @@ void AMFImporter::ParseHelper_Decode_Base64(const std::string &pInputBase64, std
|
||||
uint8_t arr4[4], arr3[3];
|
||||
|
||||
// check input data
|
||||
if (pInputBase64.size() % 4) throw DeadlyImportError("Base64-encoded data must have size multiply of four.");
|
||||
if (pInputBase64.size() % 4) {
|
||||
throw DeadlyImportError("Base64-encoded data must have size multiply of four.");
|
||||
}
|
||||
|
||||
// prepare output place
|
||||
pOutputData.clear();
|
||||
pOutputData.reserve(pInputBase64.size() / 4 * 3);
|
||||
@@ -261,7 +238,7 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) {
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr) {
|
||||
if (file == nullptr) {
|
||||
throw DeadlyImportError("Failed to open AMF file ", pFile, ".");
|
||||
}
|
||||
|
||||
@@ -350,8 +327,7 @@ void AMFImporter::ParseNode_Root() {
|
||||
// Multi elements - Yes.
|
||||
// Parent element - <amf>.
|
||||
void AMFImporter::ParseNode_Constellation(XmlNode &node) {
|
||||
std::string id;
|
||||
id = node.attribute("id").as_string();
|
||||
std::string id = node.attribute("id").as_string();
|
||||
|
||||
// create and if needed - define new grouping object.
|
||||
AMFNodeElementBase *ne = new AMFConstellation(mNodeElement_Cur);
|
||||
@@ -407,17 +383,17 @@ void AMFImporter::ParseNode_Instance(XmlNode &node) {
|
||||
for (auto ¤tNode : node.children()) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName == "deltax") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Delta.x);
|
||||
XmlParser::getValueAsReal(currentNode, als.Delta.x);
|
||||
} else if (currentName == "deltay") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Delta.y);
|
||||
XmlParser::getValueAsReal(currentNode, als.Delta.y);
|
||||
} else if (currentName == "deltaz") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Delta.z);
|
||||
XmlParser::getValueAsReal(currentNode, als.Delta.z);
|
||||
} else if (currentName == "rx") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Delta.x);
|
||||
XmlParser::getValueAsReal(currentNode, als.Delta.x);
|
||||
} else if (currentName == "ry") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Delta.y);
|
||||
XmlParser::getValueAsReal(currentNode, als.Delta.y);
|
||||
} else if (currentName == "rz") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Delta.z);
|
||||
XmlParser::getValueAsReal(currentNode, als.Delta.z);
|
||||
}
|
||||
}
|
||||
ParseHelper_Node_Exit();
|
||||
@@ -497,7 +473,7 @@ void AMFImporter::ParseNode_Metadata(XmlNode &node) {
|
||||
|
||||
// read attribute
|
||||
ne = new AMFMetadata(mNodeElement_Cur);
|
||||
((AMFMetadata *)ne)->Type = type;
|
||||
((AMFMetadata *)ne)->MetaType = type;
|
||||
((AMFMetadata *)ne)->Value = value;
|
||||
mNodeElement_Cur->Child.push_back(ne); // Add element to child list of current element
|
||||
mNodeElement_List.push_back(ne); // and to node element list because its a new object in graph.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -97,9 +97,13 @@ namespace Assimp {
|
||||
/// new - <texmap> and children <utex1>, <utex2>, <utex3>, <vtex1>, <vtex2>, <vtex3>
|
||||
/// old - <map> and children <u1>, <u2>, <u3>, <v1>, <v2>, <v3>
|
||||
///
|
||||
class AMFImporter : public BaseImporter {
|
||||
private:
|
||||
struct SPP_Material; // forward declaration
|
||||
class AMFImporter final : public BaseImporter {
|
||||
using AMFMetaDataArray = std::vector<AMFMetadata *>;
|
||||
using MeshArray = std::vector<aiMesh *>;
|
||||
using NodeArray = std::vector<aiNode *>;
|
||||
|
||||
public:
|
||||
struct SPP_Material;
|
||||
|
||||
/// Data type for post-processing step. More suitable container for part of material's composition.
|
||||
struct SPP_Composite {
|
||||
@@ -107,22 +111,6 @@ private:
|
||||
std::string Formula; ///< Formula for calculating ratio of \ref Material.
|
||||
};
|
||||
|
||||
/// \struct SPP_Material
|
||||
/// Data type for post-processing step. More suitable container for material.
|
||||
struct SPP_Material {
|
||||
std::string ID; ///< Material ID.
|
||||
std::list<AMFMetadata *> Metadata; ///< Metadata of material.
|
||||
AMFColor *Color; ///< Color of material.
|
||||
std::list<SPP_Composite> Composition; ///< List of child materials if current material is composition of few another.
|
||||
|
||||
/// Return color calculated for specified coordinate.
|
||||
/// \param [in] pX - "x" coordinate.
|
||||
/// \param [in] pY - "y" coordinate.
|
||||
/// \param [in] pZ - "z" coordinate.
|
||||
/// \return calculated color.
|
||||
aiColor4D GetColor(const float pX, const float pY, const float pZ) const;
|
||||
};
|
||||
|
||||
/// Data type for post-processing step. More suitable container for texture.
|
||||
struct SPP_Texture {
|
||||
std::string ID;
|
||||
@@ -139,10 +127,51 @@ private:
|
||||
const AMFTexMap *TexMap; ///< Face texture mapping data. Equal to nullptr if texture mapping is not set for the face.
|
||||
};
|
||||
|
||||
using AMFMetaDataArray = std::vector<AMFMetadata*>;
|
||||
using MeshArray = std::vector<aiMesh*>;
|
||||
using NodeArray = std::vector<aiNode*>;
|
||||
/// Data type for post-processing step. More suitable container for material.
|
||||
struct SPP_Material {
|
||||
std::string ID; ///< Material ID.
|
||||
std::list<AMFMetadata *> Metadata; ///< Metadata of material.
|
||||
AMFColor *Color; ///< Color of material.
|
||||
std::list<SPP_Composite> Composition; ///< List of child materials if current material is composition of few another.
|
||||
|
||||
/// Return color calculated for specified coordinate.
|
||||
/// \param [in] pX - "x" coordinate.
|
||||
/// \param [in] pY - "y" coordinate.
|
||||
/// \param [in] pZ - "z" coordinate.
|
||||
/// \return calculated color.
|
||||
aiColor4D GetColor(const float pX, const float pY, const float pZ) const;
|
||||
};
|
||||
|
||||
/// Default constructor.
|
||||
AMFImporter() AI_NO_EXCEPT;
|
||||
|
||||
/// Default destructor.
|
||||
~AMFImporter() override;
|
||||
|
||||
/// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
|
||||
/// Also exception can be thrown if trouble will found.
|
||||
/// \param [in] pFile - name of file to be parsed.
|
||||
/// \param [in] pIOHandler - pointer to IO helper object.
|
||||
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
|
||||
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
|
||||
void ParseHelper_Node_Exit();
|
||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const override;
|
||||
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||
const aiImporterDesc *GetInfo() const override;
|
||||
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
|
||||
bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
|
||||
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
|
||||
AI_WONT_RETURN void Throw_CloseNotFound(const std::string &nodeName) AI_WONT_RETURN_SUFFIX;
|
||||
AI_WONT_RETURN void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX;
|
||||
AI_WONT_RETURN void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX;
|
||||
AI_WONT_RETURN void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription) AI_WONT_RETURN_SUFFIX;
|
||||
AI_WONT_RETURN void Throw_ID_NotFound(const std::string &pID) const AI_WONT_RETURN_SUFFIX;
|
||||
void XML_CheckNode_MustHaveChildren(pugi::xml_node &node);
|
||||
bool XML_SearchNode(const std::string &nodeName);
|
||||
AMFImporter(const AMFImporter &pScene) = delete;
|
||||
AMFImporter &operator=(const AMFImporter &pScene) = delete;
|
||||
|
||||
private:
|
||||
/// Clear all temporary data.
|
||||
void Clear();
|
||||
|
||||
@@ -262,40 +291,9 @@ private:
|
||||
/// \param [in] pUseOldName - if true then use old name of node(and children) - <map>, instead of new name - <texmap>.
|
||||
void ParseNode_TexMap(XmlNode &node, const bool pUseOldName = false);
|
||||
|
||||
public:
|
||||
/// Default constructor.
|
||||
AMFImporter() AI_NO_EXCEPT;
|
||||
|
||||
/// Default destructor.
|
||||
~AMFImporter() override;
|
||||
|
||||
/// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
|
||||
/// Also exception can be thrown if trouble will found.
|
||||
/// \param [in] pFile - name of file to be parsed.
|
||||
/// \param [in] pIOHandler - pointer to IO helper object.
|
||||
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
|
||||
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
|
||||
void ParseHelper_Node_Exit();
|
||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const override;
|
||||
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||
const aiImporterDesc *GetInfo() const override;
|
||||
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
|
||||
bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
|
||||
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
|
||||
void Throw_CloseNotFound(const std::string &nodeName);
|
||||
void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName);
|
||||
void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName);
|
||||
void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription);
|
||||
void Throw_ID_NotFound(const std::string &pID) const;
|
||||
void XML_CheckNode_MustHaveChildren(pugi::xml_node &node);
|
||||
bool XML_SearchNode(const std::string &nodeName);
|
||||
void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString);
|
||||
AMFImporter(const AMFImporter &pScene) = delete;
|
||||
AMFImporter &operator=(const AMFImporter &pScene) = delete;
|
||||
|
||||
private:
|
||||
static const aiImporterDesc Description;
|
||||
|
||||
AMFNodeElementBase *mNodeElement_Cur; ///< Current element.
|
||||
std::list<AMFNodeElementBase *> mNodeElement_List; ///< All elements of scene graph.
|
||||
XmlParser *mXmlParser;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -167,11 +167,11 @@ void AMFImporter::ParseNode_Coordinates(XmlNode &node) {
|
||||
AMFCoordinates &als = *((AMFCoordinates *)ne); // alias for convenience
|
||||
const std::string ¤tName = ai_tolower(currentNode.name());
|
||||
if (currentName == "x") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Coordinate.x);
|
||||
XmlParser::getValueAsReal(currentNode, als.Coordinate.x);
|
||||
} else if (currentName == "y") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Coordinate.y);
|
||||
XmlParser::getValueAsReal(currentNode, als.Coordinate.y);
|
||||
} else if (currentName == "z") {
|
||||
XmlParser::getValueAsFloat(currentNode, als.Coordinate.z);
|
||||
XmlParser::getValueAsReal(currentNode, als.Coordinate.z);
|
||||
}
|
||||
}
|
||||
ParseHelper_Node_Exit();
|
||||
@@ -202,7 +202,7 @@ void AMFImporter::ParseNode_Volume(XmlNode &node) {
|
||||
|
||||
((AMFVolume *)ne)->MaterialID = node.attribute("materialid").as_string();
|
||||
|
||||
((AMFVolume *)ne)->Type = type;
|
||||
((AMFVolume *)ne)->VolumeType = type;
|
||||
// Check for child nodes
|
||||
bool col_read = false;
|
||||
if (!node.empty()) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -263,26 +263,25 @@ void AMFImporter::ParseNode_TexMap(XmlNode &node, const bool pUseOldName) {
|
||||
const std::string &name = currentNode.name();
|
||||
if (name == "utex1") {
|
||||
read_flag[0] = true;
|
||||
XmlParser::getValueAsFloat(node, als.TextureCoordinate[0].x);
|
||||
XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[0].x);
|
||||
} else if (name == "utex2") {
|
||||
read_flag[1] = true;
|
||||
XmlParser::getValueAsFloat(node, als.TextureCoordinate[1].x);
|
||||
XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[1].x);
|
||||
} else if (name == "utex3") {
|
||||
read_flag[2] = true;
|
||||
XmlParser::getValueAsFloat(node, als.TextureCoordinate[2].x);
|
||||
XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[2].x);
|
||||
} else if (name == "vtex1") {
|
||||
read_flag[3] = true;
|
||||
XmlParser::getValueAsFloat(node, als.TextureCoordinate[0].y);
|
||||
XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[0].y);
|
||||
} else if (name == "vtex2") {
|
||||
read_flag[4] = true;
|
||||
XmlParser::getValueAsFloat(node, als.TextureCoordinate[1].y);
|
||||
XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[1].y);
|
||||
} else if (name == "vtex3") {
|
||||
read_flag[5] = true;
|
||||
XmlParser::getValueAsFloat(node, als.TextureCoordinate[2].y);
|
||||
XmlParser::getValueAsReal(currentNode, als.TextureCoordinate[2].y);
|
||||
}
|
||||
}
|
||||
ParseHelper_Node_Exit();
|
||||
|
||||
} else {
|
||||
for (pugi::xml_attribute &attr : node.attributes()) {
|
||||
const std::string name = attr.name();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -56,7 +56,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/// \class CAMFImporter_NodeElement
|
||||
/// Base class for elements of nodes.
|
||||
class AMFNodeElementBase {
|
||||
public:
|
||||
@@ -87,10 +86,9 @@ public:
|
||||
AMFNodeElementBase *Parent; ///< Parent element. If nullptr then this node is root.
|
||||
std::list<AMFNodeElementBase *> Child; ///< Child elements.
|
||||
|
||||
public: /// Destructor, virtual..
|
||||
virtual ~AMFNodeElementBase() {
|
||||
// empty
|
||||
}
|
||||
public:
|
||||
/// Destructor, virtual..
|
||||
virtual ~AMFNodeElementBase() = default;
|
||||
|
||||
/// Disabled copy constructor and co.
|
||||
AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete;
|
||||
@@ -100,27 +98,25 @@ public: /// Destructor, virtual..
|
||||
|
||||
protected:
|
||||
/// In constructor inheritor must set element type.
|
||||
/// \param [in] pType - element type.
|
||||
/// \param [in] type - element type.
|
||||
/// \param [in] pParent - parent element.
|
||||
AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) :
|
||||
Type(pType), ID(), Parent(pParent), Child() {
|
||||
AMFNodeElementBase(EType type, AMFNodeElementBase *pParent) :
|
||||
Type(type), Parent(pParent) {
|
||||
// empty
|
||||
}
|
||||
}; // class IAMFImporter_NodeElement
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Constellation
|
||||
/// A collection of objects or constellations with specific relative locations.
|
||||
struct AMFConstellation : public AMFNodeElementBase {
|
||||
struct AMFConstellation final : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFConstellation(AMFNodeElementBase *pParent) :
|
||||
explicit AMFConstellation(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Constellation, pParent) {}
|
||||
|
||||
}; // struct CAMFImporter_NodeElement_Constellation
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Instance
|
||||
/// Part of constellation.
|
||||
struct AMFInstance : public AMFNodeElementBase {
|
||||
struct AMFInstance final : public AMFNodeElementBase {
|
||||
|
||||
std::string ObjectID; ///< ID of object for instantiation.
|
||||
/// \var Delta - The distance of translation in the x, y, or z direction, respectively, in the referenced object's coordinate system, to
|
||||
@@ -133,24 +129,24 @@ struct AMFInstance : public AMFNodeElementBase {
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFInstance(AMFNodeElementBase *pParent) :
|
||||
explicit AMFInstance(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Instance, pParent) {}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Metadata
|
||||
/// Structure that define metadata node.
|
||||
struct AMFMetadata : public AMFNodeElementBase {
|
||||
|
||||
std::string Type; ///< Type of "Value".
|
||||
std::string Value; ///< Value.
|
||||
std::string MetaType; ///< Type of "Value".
|
||||
std::string Value; ///< Value.
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFMetadata(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Metadata, pParent) {}
|
||||
explicit AMFMetadata(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Metadata, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Root
|
||||
/// Structure that define root node.
|
||||
struct AMFRoot : public AMFNodeElementBase {
|
||||
|
||||
@@ -159,11 +155,12 @@ struct AMFRoot : public AMFNodeElementBase {
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFRoot(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Root, pParent) {}
|
||||
explicit AMFRoot(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Root, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Color
|
||||
/// Structure that define object node.
|
||||
struct AMFColor : public AMFNodeElementBase {
|
||||
bool Composed; ///< Type of color stored: if true then look for formula in \ref Color_Composed[4], else - in \ref Color.
|
||||
@@ -173,92 +170,97 @@ struct AMFColor : public AMFNodeElementBase {
|
||||
|
||||
/// @brief Constructor.
|
||||
/// @param [in] pParent - pointer to parent node.
|
||||
AMFColor(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() {
|
||||
explicit AMFColor(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Material
|
||||
/// Structure that define material node.
|
||||
struct AMFMaterial : public AMFNodeElementBase {
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFMaterial(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Material, pParent) {}
|
||||
explicit AMFMaterial(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Material, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Object
|
||||
/// Structure that define object node.
|
||||
struct AMFObject : public AMFNodeElementBase {
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFObject(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Object, pParent) {}
|
||||
explicit AMFObject(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Object, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Mesh
|
||||
/// Structure that define mesh node.
|
||||
struct AMFMesh : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFMesh(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Mesh, pParent) {}
|
||||
explicit AMFMesh(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Mesh, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Vertex
|
||||
/// Structure that define vertex node.
|
||||
struct AMFVertex : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFVertex(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Vertex, pParent) {}
|
||||
explicit AMFVertex(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Vertex, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Edge
|
||||
/// Structure that define edge node.
|
||||
struct AMFEdge : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFEdge(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Edge, pParent) {}
|
||||
explicit AMFEdge(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Edge, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Vertices
|
||||
/// Structure that define vertices node.
|
||||
struct AMFVertices : public AMFNodeElementBase {
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFVertices(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Vertices, pParent) {}
|
||||
explicit AMFVertices(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Vertices, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Volume
|
||||
/// Structure that define volume node.
|
||||
struct AMFVolume : public AMFNodeElementBase {
|
||||
std::string MaterialID; ///< Which material to use.
|
||||
std::string Type; ///< What this volume describes can be "region" or "support". If none specified, "object" is assumed.
|
||||
std::string VolumeType; ///< What this volume describes can be "region" or "support". If none specified, "object" is assumed.
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFVolume(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Volume, pParent) {}
|
||||
explicit AMFVolume(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Volume, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Coordinates
|
||||
/// Structure that define coordinates node.
|
||||
struct AMFCoordinates : public AMFNodeElementBase {
|
||||
aiVector3D Coordinate; ///< Coordinate.
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFCoordinates(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Coordinates, pParent) {}
|
||||
explicit AMFCoordinates(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Coordinates, pParent) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_TexMap
|
||||
/// Structure that define texture coordinates node.
|
||||
struct AMFTexMap : public AMFNodeElementBase {
|
||||
aiVector3D TextureCoordinate[3]; ///< Texture coordinates.
|
||||
@@ -269,20 +271,19 @@ struct AMFTexMap : public AMFNodeElementBase {
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFTexMap(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() {
|
||||
explicit AMFTexMap(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
/// \struct CAMFImporter_NodeElement_Triangle
|
||||
/// Structure that define triangle node.
|
||||
struct AMFTriangle : public AMFNodeElementBase {
|
||||
size_t V[3]; ///< Triangle vertices.
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFTriangle(AMFNodeElementBase *pParent) :
|
||||
explicit AMFTriangle(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Triangle, pParent) {
|
||||
// empty
|
||||
}
|
||||
@@ -296,7 +297,7 @@ struct AMFTexture : public AMFNodeElementBase {
|
||||
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFTexture(AMFNodeElementBase *pParent) :
|
||||
explicit AMFTexture(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Texture, pParent), Width(0), Height(0), Depth(0), Data(), Tiled(false) {
|
||||
// empty
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -57,8 +57,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
|
||||
aiColor4D AMFImporter::SPP_Material::GetColor(const float /*pX*/, const float /*pY*/, const float /*pZ*/) const {
|
||||
aiColor4D tcol;
|
||||
|
||||
// Check if stored data are supported.
|
||||
if (!Composition.empty()) {
|
||||
throw DeadlyImportError("IME. GetColor for composition");
|
||||
@@ -68,7 +66,7 @@ aiColor4D AMFImporter::SPP_Material::GetColor(const float /*pX*/, const float /*
|
||||
throw DeadlyImportError("IME. GetColor, composed color");
|
||||
}
|
||||
|
||||
tcol = Color->Color;
|
||||
aiColor4D tcol = Color->Color;
|
||||
|
||||
// Check if default color must be used
|
||||
if ((tcol.r == 0) && (tcol.g == 0) && (tcol.b == 0) && (tcol.a == 0)) {
|
||||
@@ -224,7 +222,8 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string &
|
||||
}
|
||||
|
||||
// Create format hint.
|
||||
strcpy(converted_texture.FormatHint, "rgba0000"); // copy initial string.
|
||||
constexpr char templateColor[] = "rgba0000";
|
||||
memcpy(converted_texture.FormatHint, templateColor, 8);
|
||||
if (!r.empty()) converted_texture.FormatHint[4] = '8';
|
||||
if (!g.empty()) converted_texture.FormatHint[5] = '8';
|
||||
if (!b.empty()) converted_texture.FormatHint[6] = '8';
|
||||
@@ -332,7 +331,7 @@ void AMFImporter::Postprocess_AddMetadata(const AMFMetaDataArray &metadataList,
|
||||
size_t meta_idx(0);
|
||||
|
||||
for (const AMFMetadata *metadata : metadataList) {
|
||||
sceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx++), metadata->Type, aiString(metadata->Value));
|
||||
sceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx++), metadata->MetaType, aiString(metadata->Value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,11 +530,9 @@ void AMFImporter::Postprocess_BuildMeshSet(const AMFMesh &pNodeElement, const st
|
||||
col_arr.reserve(VertexCount_Max * 2);
|
||||
|
||||
{ // fill arrays
|
||||
size_t vert_idx_from, vert_idx_to;
|
||||
|
||||
// first iteration.
|
||||
vert_idx_to = 0;
|
||||
vert_idx_from = VertexIndex_GetMinimal(face_list_cur, nullptr);
|
||||
size_t vert_idx_to = 0;
|
||||
size_t vert_idx_from = VertexIndex_GetMinimal(face_list_cur, nullptr);
|
||||
vert_arr.push_back(pVertexCoordinateArray.at(vert_idx_from));
|
||||
col_arr.push_back(Vertex_CalculateColor(vert_idx_from));
|
||||
if (vert_idx_from != vert_idx_to) VertexIndex_Replace(face_list_cur, vert_idx_from, vert_idx_to);
|
||||
@@ -815,6 +812,7 @@ nl_clean_loop:
|
||||
for (; next_it != nodeArray.end(); ++next_it) {
|
||||
if ((*next_it)->FindNode((*nl_it)->mName) != nullptr) {
|
||||
// if current top node(nl_it) found in another top node then erase it from node_list and restart search loop.
|
||||
// FIXME: this leaks memory on test models test8.amf and test9.amf
|
||||
nodeArray.erase(nl_it);
|
||||
|
||||
goto nl_clean_loop;
|
||||
@@ -866,7 +864,7 @@ nl_clean_loop:
|
||||
pScene->mTextures[idx]->mHeight = static_cast<unsigned int>(tex_convd.Height);
|
||||
pScene->mTextures[idx]->pcData = (aiTexel *)tex_convd.Data;
|
||||
// texture format description.
|
||||
strcpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint);
|
||||
strncpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint, HINTMAXTEXTURELEN);
|
||||
idx++;
|
||||
} // for(const SPP_Texture& tex_convd: mTexture_Converted)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -44,7 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
// internal headers
|
||||
@@ -64,10 +63,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// utilities
|
||||
#include <assimp/fast_atof.h>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
using namespace Assimp::ASE;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"ASE Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -87,12 +86,6 @@ ASEImporter::ASEImporter() :
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
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 /*checkSig*/) const {
|
||||
@@ -124,14 +117,14 @@ void ASEImporter::InternReadFile(const std::string &pFile,
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr) {
|
||||
if (file == nullptr) {
|
||||
throw DeadlyImportError("Failed to open ASE file ", pFile, ".");
|
||||
}
|
||||
|
||||
// Allocate storage and copy the contents of the file to a memory buffer
|
||||
std::vector<char> mBuffer2;
|
||||
TextFileToBuffer(file.get(), mBuffer2);
|
||||
|
||||
const size_t fileSize = mBuffer2.size();
|
||||
this->mBuffer = &mBuffer2[0];
|
||||
this->pcScene = pScene;
|
||||
|
||||
@@ -153,7 +146,7 @@ void ASEImporter::InternReadFile(const std::string &pFile,
|
||||
};
|
||||
|
||||
// Construct an ASE parser and parse the file
|
||||
ASE::Parser parser(mBuffer, defaultFormat);
|
||||
ASE::Parser parser(mBuffer, fileSize, defaultFormat);
|
||||
mParser = &parser;
|
||||
mParser->Parse();
|
||||
|
||||
@@ -265,7 +258,7 @@ void ASEImporter::GenerateDefaultMaterial() {
|
||||
}
|
||||
if (bHas || mParser->m_vMaterials.empty()) {
|
||||
// add a simple material without submaterials to the parser's list
|
||||
mParser->m_vMaterials.push_back(ASE::Material(AI_DEFAULT_MATERIAL_NAME));
|
||||
mParser->m_vMaterials.emplace_back(AI_DEFAULT_MATERIAL_NAME);
|
||||
ASE::Material &mat = mParser->m_vMaterials.back();
|
||||
|
||||
mat.mDiffuse = aiColor3D(0.6f, 0.6f, 0.6f);
|
||||
@@ -328,21 +321,6 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode *> &nodes) {
|
||||
aiNodeAnim *nd = pcAnim->mChannels[iNum++] = new aiNodeAnim();
|
||||
nd->mNodeName.Set(me->mName + ".Target");
|
||||
|
||||
// If there is no input position channel we will need
|
||||
// to supply the default position from the node's
|
||||
// local transformation matrix.
|
||||
/*TargetAnimationHelper helper;
|
||||
if (me->mAnim.akeyPositions.empty())
|
||||
{
|
||||
aiMatrix4x4& mat = (*i)->mTransform;
|
||||
helper.SetFixedMainAnimationChannel(aiVector3D(
|
||||
mat.a4, mat.b4, mat.c4));
|
||||
}
|
||||
else helper.SetMainAnimationChannel (&me->mAnim.akeyPositions);
|
||||
helper.SetTargetAnimationChannel (&me->mTargetAnim.akeyPositions);
|
||||
|
||||
helper.Process(&me->mTargetAnim.akeyPositions);*/
|
||||
|
||||
// Allocate the key array and fill it
|
||||
nd->mNumPositionKeys = (unsigned int)me->mTargetAnim.akeyPositions.size();
|
||||
nd->mPositionKeys = new aiVectorKey[nd->mNumPositionKeys];
|
||||
@@ -468,10 +446,9 @@ void ASEImporter::BuildLights() {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
||||
aiNode *pcParent, const char *szName) {
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, aiNode *pcParent, const std::string &name) {
|
||||
aiMatrix4x4 m;
|
||||
AddNodes(nodes, pcParent, szName, m);
|
||||
AddNodes(nodes, pcParent, name, m);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -528,10 +505,9 @@ void ASEImporter::AddMeshes(const ASE::BaseNode *snode, aiNode *node) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Add child nodes to a given parent node
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
||||
aiNode *pcParent, const char *szName,
|
||||
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, aiNode *pcParent, const std::string &name,
|
||||
const aiMatrix4x4 &mat) {
|
||||
const size_t len = szName ? ::strlen(szName) : 0;
|
||||
const size_t len = name.size();
|
||||
ai_assert(4 <= AI_MAX_NUMBER_OF_COLOR_SETS);
|
||||
|
||||
// Receives child nodes for the pcParent node
|
||||
@@ -541,16 +517,18 @@ void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
||||
// which has *us* as parent.
|
||||
for (std::vector<BaseNode *>::const_iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) {
|
||||
const BaseNode *snode = *it;
|
||||
if (szName) {
|
||||
if (len != snode->mParent.length() || ::strcmp(szName, snode->mParent.c_str()))
|
||||
if (!name.empty()) {
|
||||
if (len != snode->mParent.length() || name != snode->mParent.c_str()) {
|
||||
continue;
|
||||
} else if (snode->mParent.length())
|
||||
}
|
||||
} else if (snode->mParent.length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
(*it)->mProcessed = true;
|
||||
|
||||
// Allocate a new node and add it to the output data structure
|
||||
apcNodes.push_back(new aiNode());
|
||||
apcNodes.push_back(new aiNode);
|
||||
aiNode *node = apcNodes.back();
|
||||
|
||||
node->mName.Set((snode->mName.length() ? snode->mName.c_str() : "Unnamed_Node"));
|
||||
@@ -563,7 +541,7 @@ void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
|
||||
|
||||
// Add sub nodes - prevent stack overflow due to recursive parenting
|
||||
if (node->mName != node->mParent->mName && node->mName != node->mParent->mParent->mName) {
|
||||
AddNodes(nodes, node, node->mName.data, snode->mTransform);
|
||||
AddNodes(nodes, node, node->mName.C_Str(), snode->mTransform);
|
||||
}
|
||||
|
||||
// Further processing depends on the type of the node
|
||||
@@ -641,7 +619,8 @@ void ASEImporter::BuildNodes(std::vector<BaseNode *> &nodes) {
|
||||
}
|
||||
|
||||
// add all nodes
|
||||
AddNodes(nodes, ch, nullptr);
|
||||
static const std::string none = "";
|
||||
AddNodes(nodes, ch, none);
|
||||
|
||||
// now iterate through al nodes and find those that have not yet
|
||||
// been added to the nodegraph (= their parent could not be recognized)
|
||||
@@ -752,6 +731,10 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh &mesh) {
|
||||
unsigned int iCurrent = 0, fi = 0;
|
||||
for (std::vector<ASE::Face>::iterator i = mesh.mFaces.begin(); i != mesh.mFaces.end(); ++i, ++fi) {
|
||||
for (unsigned int n = 0; n < 3; ++n, ++iCurrent) {
|
||||
const uint32_t curIndex = (*i).mIndices[n];
|
||||
if (curIndex >= mesh.mPositions.size()) {
|
||||
throw DeadlyImportError("ASE: Invalid vertex index in face ", fi, ".");
|
||||
}
|
||||
mPositions[iCurrent] = mesh.mPositions[(*i).mIndices[n]];
|
||||
|
||||
// add texture coordinates
|
||||
@@ -870,6 +853,7 @@ void ASEImporter::ConvertMaterial(ASE::Material &mat) {
|
||||
unsigned int iWire = 1;
|
||||
mat.pcInstance->AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME);
|
||||
}
|
||||
// fallthrough
|
||||
case D3DS::Discreet3DS::Gouraud:
|
||||
eShading = aiShadingMode_Gouraud;
|
||||
break;
|
||||
@@ -925,7 +909,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh &mesh, std::vector<aiMesh *> &avOutMes
|
||||
ASSIMP_LOG_WARN("Material index is out of range");
|
||||
}
|
||||
|
||||
// If the material the mesh is assigned to is consisting of submeshes, split it
|
||||
// If the material the mesh is assigned to consists of submeshes, split it
|
||||
if (!mParser->m_vMaterials[mesh.iMaterialIndex].avSubMaterials.empty()) {
|
||||
std::vector<ASE::Material> vSubMaterials = mParser->m_vMaterials[mesh.iMaterialIndex].avSubMaterials;
|
||||
|
||||
@@ -1004,8 +988,8 @@ void ASEImporter::ConvertMeshes(ASE::Mesh &mesh, std::vector<aiMesh *> &avOutMes
|
||||
blubb != mesh.mBoneVertices[iIndex2].mBoneWeights.end(); ++blubb) {
|
||||
|
||||
// NOTE: illegal cases have already been filtered out
|
||||
avOutputBones[(*blubb).first].push_back(std::pair<unsigned int, float>(
|
||||
iBase, (*blubb).second));
|
||||
avOutputBones[(*blubb).first].emplace_back(
|
||||
iBase, (*blubb).second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1283,6 +1267,7 @@ bool ASEImporter::GenerateNormals(ASE::Mesh &mesh) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
}
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
#endif // ASSIMP_BUILD_NO_ASE_IMPORTER
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -59,10 +59,10 @@ namespace Assimp {
|
||||
/** Importer class for the 3DS ASE ASCII format.
|
||||
*
|
||||
*/
|
||||
class ASEImporter : public BaseImporter {
|
||||
class ASEImporter final : public BaseImporter {
|
||||
public:
|
||||
ASEImporter();
|
||||
~ASEImporter() override;
|
||||
~ASEImporter() override = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns whether the class can handle the format of the given file.
|
||||
@@ -153,13 +153,13 @@ private:
|
||||
* \param matrix Current transform
|
||||
*/
|
||||
void AddNodes(const std::vector<ASE::BaseNode*>& nodes,
|
||||
aiNode* pcParent,const char* szName);
|
||||
aiNode* pcParent, const std::string &name);
|
||||
|
||||
void AddNodes(const std::vector<ASE::BaseNode*>& nodes,
|
||||
aiNode* pcParent,const char* szName,
|
||||
aiNode* pcParent, const std::string &name,
|
||||
const aiMatrix4x4& matrix);
|
||||
|
||||
void AddMeshes(const ASE::BaseNode* snode,aiNode* node);
|
||||
void AddMeshes(const ASE::BaseNode* snode, aiNode* node);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Generate a default material and add it to the parser's list
|
||||
@@ -188,5 +188,4 @@ protected:
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
||||
|
||||
#endif // AI_3DSIMPORTER_H_INC
|
||||
|
||||
+400
-340
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -58,14 +57,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// ASE is quite similar to 3ds. We can reuse some structures
|
||||
#include "AssetLib/3DS/3DSLoader.h"
|
||||
|
||||
namespace Assimp {
|
||||
namespace ASE {
|
||||
namespace Assimp::ASE {
|
||||
|
||||
using namespace D3DS;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Helper structure representing an ASE material */
|
||||
struct Material : public D3DS::Material {
|
||||
struct Material final : D3DS::Material {
|
||||
//! Default constructor has been deleted
|
||||
Material() = delete;
|
||||
|
||||
@@ -116,7 +114,7 @@ struct Material : public D3DS::Material {
|
||||
return *this;
|
||||
}
|
||||
|
||||
~Material() {}
|
||||
~Material() override = default;
|
||||
|
||||
//! Contains all sub materials of this material
|
||||
std::vector<Material> avSubMaterials;
|
||||
@@ -374,8 +372,8 @@ struct Dummy : public BaseNode {
|
||||
};
|
||||
|
||||
// Parameters to Parser::Parse()
|
||||
#define AI_ASE_NEW_FILE_FORMAT 200
|
||||
#define AI_ASE_OLD_FILE_FORMAT 110
|
||||
static constexpr unsigned int AI_ASE_NEW_FILE_FORMAT = 200;
|
||||
static constexpr unsigned int AI_ASE_OLD_FILE_FORMAT = 110;
|
||||
|
||||
// Internally we're a little bit more tolerant
|
||||
#define AI_ASE_IS_NEW_FILE_FORMAT() (iFileFormat >= 200)
|
||||
@@ -385,20 +383,18 @@ struct Dummy : public BaseNode {
|
||||
/** \brief Class to parse ASE files
|
||||
*/
|
||||
class Parser {
|
||||
private:
|
||||
Parser() AI_NO_EXCEPT {
|
||||
// empty
|
||||
}
|
||||
|
||||
public:
|
||||
/// @brief No default constructor.
|
||||
Parser() = delete;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Construct a parser from a given input file which is
|
||||
//! guaranteed to be terminated with zero.
|
||||
//! @param szFile Input file
|
||||
//! @param file The name of the input file.
|
||||
//! @param fileFormatDefault Assumed file format version. If the
|
||||
//! file format is specified in the file the new value replaces
|
||||
//! the default value.
|
||||
Parser(const char *szFile, unsigned int fileFormatDefault);
|
||||
Parser(const char *file, size_t fileLen, unsigned int fileFormatDefault);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parses the file into the parsers internal representation
|
||||
@@ -556,13 +552,15 @@ private:
|
||||
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
|
||||
//! \param apOut Output buffer (3 floats)
|
||||
//! \param rIndexOut Output index
|
||||
void ParseLV4MeshFloatTriple(ai_real *apOut, unsigned int &rIndexOut);
|
||||
void ParseLV4MeshRealTriple(ai_real *apOut, unsigned int &rIndexOut);
|
||||
void ParseLV4MeshFloatTriple(float *apOut, unsigned int &rIndexOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parse a *MESH_VERT block in a file
|
||||
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
|
||||
//! \param apOut Output buffer (3 floats)
|
||||
void ParseLV4MeshFloatTriple(ai_real *apOut);
|
||||
void ParseLV4MeshRealTriple(ai_real *apOut);
|
||||
void ParseLV4MeshFloatTriple(float *apOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parse a *MESH_TFACE block in a file
|
||||
@@ -580,7 +578,8 @@ private:
|
||||
// -------------------------------------------------------------------
|
||||
//! Parse a single float element
|
||||
//! \param fOut Output float
|
||||
void ParseLV4MeshFloat(ai_real &fOut);
|
||||
void ParseLV4MeshReal(ai_real &fOut);
|
||||
void ParseLV4MeshFloat(float &fOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//! Parse a single int element
|
||||
@@ -620,8 +619,8 @@ private:
|
||||
bool ParseString(std::string &out, const char *szName);
|
||||
|
||||
public:
|
||||
//! Pointer to current data
|
||||
const char *filePtr;
|
||||
const char *mFilePtr; ////< Pointer to current data
|
||||
const char *mEnd; ///< The end pointer of the file data
|
||||
|
||||
//! background color to be passed to the viewer
|
||||
//! QNAN if none was found
|
||||
@@ -668,8 +667,7 @@ public:
|
||||
unsigned int iFileFormat;
|
||||
};
|
||||
|
||||
} // Namespace ASE
|
||||
} // namespace Assimp
|
||||
} // Namespace Assimp::ASE
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -56,5 +56,5 @@ namespace Assimp {
|
||||
void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/);
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // AI_ASSBINEXPORTER_H_INC
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -50,11 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/version.h>
|
||||
#include <assimp/IOStream.hpp>
|
||||
|
||||
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||
#include <zlib.h>
|
||||
#else
|
||||
#include "../contrib/zlib/zlib.h"
|
||||
#endif
|
||||
#include "zlib.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
@@ -130,7 +126,7 @@ inline size_t Write<double>(IOStream *stream, const double &f) {
|
||||
// Serialize a vec3
|
||||
template <>
|
||||
inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
|
||||
size_t t = Write<float>(stream, v.x);
|
||||
size_t t = Write<ai_real>(stream, v.x);
|
||||
t += Write<float>(stream, v.y);
|
||||
t += Write<float>(stream, v.z);
|
||||
|
||||
@@ -141,7 +137,7 @@ inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
|
||||
// Serialize a color value
|
||||
template <>
|
||||
inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
|
||||
size_t t = Write<float>(stream, v.r);
|
||||
size_t t = Write<ai_real>(stream, v.r);
|
||||
t += Write<float>(stream, v.g);
|
||||
t += Write<float>(stream, v.b);
|
||||
|
||||
@@ -152,7 +148,7 @@ inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
|
||||
// Serialize a color value
|
||||
template <>
|
||||
inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
|
||||
size_t t = Write<float>(stream, v.r);
|
||||
size_t t = Write<ai_real>(stream, v.r);
|
||||
t += Write<float>(stream, v.g);
|
||||
t += Write<float>(stream, v.b);
|
||||
t += Write<float>(stream, v.a);
|
||||
@@ -164,7 +160,7 @@ inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
|
||||
// Serialize a quaternion
|
||||
template <>
|
||||
inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) {
|
||||
size_t t = Write<float>(stream, v.w);
|
||||
size_t t = Write<ai_real>(stream, v.w);
|
||||
t += Write<float>(stream, v.x);
|
||||
t += Write<float>(stream, v.y);
|
||||
t += Write<float>(stream, v.z);
|
||||
@@ -190,7 +186,7 @@ template <>
|
||||
inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) {
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
for (unsigned int i2 = 0; i2 < 4; ++i2) {
|
||||
Write<float>(stream, m[i][i2]);
|
||||
Write<ai_real>(stream, m[i][i2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,29 +239,7 @@ inline size_t WriteArray(IOStream *stream, const T *in, unsigned int size) {
|
||||
* and the chunk contents to the container stream. This allows relatively easy chunk
|
||||
* chunk construction, even recursively.
|
||||
*/
|
||||
class AssbinChunkWriter : public IOStream {
|
||||
private:
|
||||
uint8_t *buffer;
|
||||
uint32_t magic;
|
||||
IOStream *container;
|
||||
size_t cur_size, cursor, initial;
|
||||
|
||||
private:
|
||||
// -------------------------------------------------------------------
|
||||
void Grow(size_t need = 0) {
|
||||
size_t new_size = std::max(initial, std::max(need, cur_size + (cur_size >> 1)));
|
||||
|
||||
const uint8_t *const old = buffer;
|
||||
buffer = new uint8_t[new_size];
|
||||
|
||||
if (old) {
|
||||
memcpy(buffer, old, cur_size);
|
||||
delete[] old;
|
||||
}
|
||||
|
||||
cur_size = new_size;
|
||||
}
|
||||
|
||||
class AssbinChunkWriter final : public IOStream {
|
||||
public:
|
||||
AssbinChunkWriter(IOStream *container, uint32_t magic, size_t initial = 4096) :
|
||||
buffer(nullptr),
|
||||
@@ -291,15 +265,15 @@ public:
|
||||
size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override {
|
||||
return aiReturn_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
size_t Tell() const override {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
|
||||
void Flush() override {
|
||||
// not implemented
|
||||
}
|
||||
@@ -319,6 +293,28 @@ public:
|
||||
|
||||
return pCount;
|
||||
}
|
||||
|
||||
private:
|
||||
// -------------------------------------------------------------------
|
||||
void Grow(size_t need = 0) {
|
||||
size_t new_size = std::max(initial, std::max(need, cur_size + (cur_size >> 1)));
|
||||
|
||||
const uint8_t *const old = buffer;
|
||||
buffer = new uint8_t[new_size];
|
||||
|
||||
if (old) {
|
||||
memcpy(buffer, old, cur_size);
|
||||
delete[] old;
|
||||
}
|
||||
|
||||
cur_size = new_size;
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *buffer;
|
||||
uint32_t magic;
|
||||
IOStream *container;
|
||||
size_t cur_size, cursor, initial;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
@@ -642,6 +638,10 @@ protected:
|
||||
Write<aiString>(&chunk, l->mName);
|
||||
Write<unsigned int>(&chunk, l->mType);
|
||||
|
||||
Write<aiVector3D>(&chunk, l->mPosition);
|
||||
Write<aiVector3D>(&chunk, l->mDirection);
|
||||
Write<aiVector3D>(&chunk, l->mUp);
|
||||
|
||||
if (l->mType != aiLightSource_DIRECTIONAL) {
|
||||
Write<float>(&chunk, l->mAttenuationConstant);
|
||||
Write<float>(&chunk, l->mAttenuationLinear);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "AssetLib/Assbin/AssbinLoader.h"
|
||||
#include "AssbinLoader.h"
|
||||
#include "Common/assbin_chunks.h"
|
||||
#include <assimp/MemoryIOWrapper.h>
|
||||
#include <assimp/anim.h>
|
||||
@@ -65,7 +65,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Assimp Binary Importer",
|
||||
"Gargaj / Conspiracy",
|
||||
"",
|
||||
@@ -91,10 +91,14 @@ bool AssbinImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, boo
|
||||
}
|
||||
|
||||
char s[32];
|
||||
in->Read(s, sizeof(char), 32);
|
||||
const size_t read = in->Read(s, sizeof(char), 32);
|
||||
|
||||
pIOHandler->Close(in);
|
||||
|
||||
if (read < 19) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return strncmp(s, "ASSIMP.binary-dump.", 19) == 0;
|
||||
}
|
||||
|
||||
@@ -556,6 +560,10 @@ void AssbinImporter::ReadBinaryLight(IOStream *stream, aiLight *l) {
|
||||
l->mName = Read<aiString>(stream);
|
||||
l->mType = (aiLightSourceType)Read<unsigned int>(stream);
|
||||
|
||||
l->mPosition = Read<aiVector3D>(stream);
|
||||
l->mDirection = Read<aiVector3D>(stream);
|
||||
l->mUp = Read<aiVector3D>(stream);
|
||||
|
||||
if (l->mType != aiLightSource_DIRECTIONAL) {
|
||||
l->mAttenuationConstant = Read<float>(stream);
|
||||
l->mAttenuationLinear = Read<float>(stream);
|
||||
@@ -680,6 +688,7 @@ void AssbinImporter::InternReadFile(const std::string &pFile, aiScene *pScene, I
|
||||
unsigned int versionMajor = Read<unsigned int>(stream);
|
||||
unsigned int versionMinor = Read<unsigned int>(stream);
|
||||
if (versionMinor != ASSBIN_VERSION_MINOR || versionMajor != ASSBIN_VERSION_MAJOR) {
|
||||
pIOHandler->Close(stream);
|
||||
throw DeadlyImportError("Invalid version, data format not compatible!");
|
||||
}
|
||||
|
||||
@@ -689,8 +698,10 @@ void AssbinImporter::InternReadFile(const std::string &pFile, aiScene *pScene, I
|
||||
shortened = Read<uint16_t>(stream) > 0;
|
||||
compressed = Read<uint16_t>(stream) > 0;
|
||||
|
||||
if (shortened)
|
||||
if (shortened) {
|
||||
pIOHandler->Close(stream);
|
||||
throw DeadlyImportError("Shortened binaries are not supported!");
|
||||
}
|
||||
|
||||
stream->Seek(256, aiOrigin_CUR); // original filename
|
||||
stream->Seek(128, aiOrigin_CUR); // options
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -61,7 +60,7 @@ struct aiCamera;
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
|
||||
|
||||
namespace Assimp {
|
||||
namespace Assimp {
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
/** Importer class for 3D Studio r3 and r4 3DS files
|
||||
|
||||
@@ -7,7 +7,7 @@ For details, see http://sourceforge.net/projects/libb64
|
||||
|
||||
#include "cencode.h" // changed from <B64/cencode.h>
|
||||
|
||||
const int CHARS_PER_LINE = 72;
|
||||
static const int CHARS_PER_LINE = 72;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
|
||||
@@ -10,6 +10,7 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information
|
||||
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
|
||||
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/IOStream.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
@@ -23,16 +24,15 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information
|
||||
|
||||
#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"
|
||||
# include "cencode.h"
|
||||
}
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
// Forward declarations
|
||||
void ExportAssimp2Json(const char *, Assimp::IOSystem *, const aiScene *, const Assimp::ExportProperties *);
|
||||
|
||||
// small utility class to simplify serializing the aiScene to Json
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
Flag_WriteSpecialFloats = 0x2,
|
||||
Flag_SkipWhitespaces = 0x4
|
||||
};
|
||||
|
||||
|
||||
JSONWriter(Assimp::IOStream &out, unsigned int flags = 0u) :
|
||||
out(out), indent (""), newline("\n"), space(" "), buff (), first(false), flags(flags) {
|
||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||
@@ -179,7 +179,6 @@ private:
|
||||
// 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('\\');
|
||||
}
|
||||
@@ -241,7 +240,7 @@ private:
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
void Write(JSONWriter &out, const aiVector3D &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiVector3D &ai, bool is_elem = true) {
|
||||
out.StartArray(is_elem);
|
||||
out.Element(ai.x);
|
||||
out.Element(ai.y);
|
||||
@@ -249,7 +248,7 @@ void Write(JSONWriter &out, const aiVector3D &ai, bool is_elem = true) {
|
||||
out.EndArray();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiQuaternion &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiQuaternion &ai, bool is_elem = true) {
|
||||
out.StartArray(is_elem);
|
||||
out.Element(ai.w);
|
||||
out.Element(ai.x);
|
||||
@@ -258,7 +257,7 @@ void Write(JSONWriter &out, const aiQuaternion &ai, bool is_elem = true) {
|
||||
out.EndArray();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiColor3D &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiColor3D &ai, bool is_elem = true) {
|
||||
out.StartArray(is_elem);
|
||||
out.Element(ai.r);
|
||||
out.Element(ai.g);
|
||||
@@ -266,7 +265,7 @@ void Write(JSONWriter &out, const aiColor3D &ai, bool is_elem = true) {
|
||||
out.EndArray();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiMatrix4x4 &ai, bool is_elem = true) {
|
||||
static 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) {
|
||||
@@ -276,7 +275,7 @@ void Write(JSONWriter &out, const aiMatrix4x4 &ai, bool is_elem = true) {
|
||||
out.EndArray();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiBone &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiBone &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -297,7 +296,7 @@ void Write(JSONWriter &out, const aiBone &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiFace &ai, bool is_elem = true) {
|
||||
static 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]);
|
||||
@@ -305,7 +304,7 @@ void Write(JSONWriter &out, const aiFace &ai, bool is_elem = true) {
|
||||
out.EndArray();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiMesh &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiMesh &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -416,7 +415,7 @@ void Write(JSONWriter &out, const aiMesh &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiNode &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiNode &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -446,7 +445,7 @@ void Write(JSONWriter &out, const aiNode &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("properties");
|
||||
@@ -466,41 +465,55 @@ void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
|
||||
|
||||
out.Key("value");
|
||||
switch (prop->mType) {
|
||||
case aiPTI_Float:
|
||||
if (prop->mDataLength / sizeof(float) > 1) {
|
||||
out.StartArray();
|
||||
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(float); ++ii) {
|
||||
out.Element(reinterpret_cast<float *>(prop->mData)[ii]);
|
||||
case aiPTI_Float:
|
||||
if (prop->mDataLength / sizeof(float) > 1) {
|
||||
out.StartArray();
|
||||
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(float); ++ii) {
|
||||
out.Element(reinterpret_cast<float *>(prop->mData)[ii]);
|
||||
}
|
||||
out.EndArray();
|
||||
} else {
|
||||
out.SimpleValue(*reinterpret_cast<float *>(prop->mData));
|
||||
}
|
||||
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 ii = 0; ii < prop->mDataLength / sizeof(int); ++ii) {
|
||||
out.Element(reinterpret_cast<int *>(prop->mData)[ii]);
|
||||
break;
|
||||
case aiPTI_Double:
|
||||
if (prop->mDataLength / sizeof(double) > 1) {
|
||||
out.StartArray();
|
||||
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(double); ++ii) {
|
||||
out.Element(reinterpret_cast<double*>(prop->mData)[ii]);
|
||||
}
|
||||
out.EndArray();
|
||||
} else {
|
||||
out.SimpleValue(*reinterpret_cast<double*>(prop->mData));
|
||||
}
|
||||
out.EndArray();
|
||||
} else {
|
||||
out.SimpleValue(*reinterpret_cast<int *>(prop->mData));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case aiPTI_Integer:
|
||||
if (prop->mDataLength / sizeof(int) > 1) {
|
||||
out.StartArray();
|
||||
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(int); ++ii) {
|
||||
out.Element(reinterpret_cast<int *>(prop->mData)[ii]);
|
||||
}
|
||||
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);
|
||||
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:
|
||||
ai_assert(false);
|
||||
}
|
||||
|
||||
out.EndObj();
|
||||
@@ -510,7 +523,7 @@ void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiTexture &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiTexture &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("width");
|
||||
@@ -546,7 +559,7 @@ void Write(JSONWriter &out, const aiTexture &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiLight &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiLight &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -594,7 +607,7 @@ void Write(JSONWriter &out, const aiLight &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiNodeAnim &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiNodeAnim &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -647,7 +660,7 @@ void Write(JSONWriter &out, const aiNodeAnim &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiAnimation &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiAnimation &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -668,7 +681,7 @@ void Write(JSONWriter &out, const aiAnimation &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiCamera &ai, bool is_elem = true) {
|
||||
static void Write(JSONWriter &out, const aiCamera &ai, bool is_elem = true) {
|
||||
out.StartObj(is_elem);
|
||||
|
||||
out.Key("name");
|
||||
@@ -695,7 +708,7 @@ void Write(JSONWriter &out, const aiCamera &ai, bool is_elem = true) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void WriteFormatInfo(JSONWriter &out) {
|
||||
static void WriteFormatInfo(JSONWriter &out) {
|
||||
out.StartObj();
|
||||
out.Key("format");
|
||||
out.SimpleValue("\"assimp2json\"");
|
||||
@@ -704,7 +717,7 @@ void WriteFormatInfo(JSONWriter &out) {
|
||||
out.EndObj();
|
||||
}
|
||||
|
||||
void Write(JSONWriter &out, const aiScene &ai) {
|
||||
static void Write(JSONWriter &out, const aiScene &ai) {
|
||||
out.StartObj();
|
||||
|
||||
out.Key("__metadata__");
|
||||
|
||||
@@ -304,7 +304,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
|
||||
}
|
||||
|
||||
// add the newly created mesh to the list
|
||||
source_mesh_map.push_back(std::make_pair(out_mesh,a));
|
||||
source_mesh_map.emplace_back(out_mesh,a);
|
||||
|
||||
if (base == in_mesh->mNumFaces) {
|
||||
break;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -50,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/IOSystem.hpp>
|
||||
#include <assimp/Exporter.hpp>
|
||||
|
||||
namespace Assimp {
|
||||
namespace Assimp {
|
||||
|
||||
void ExportSceneAssxml(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -36,7 +35,6 @@ 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -79,8 +77,7 @@ static int ioprintf(IOStream *io, const char *format, ...) {
|
||||
}
|
||||
|
||||
static const int Size = 4096;
|
||||
char sz[Size];
|
||||
::memset(sz, '\0', Size);
|
||||
char sz[Size] = {};
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
const unsigned int nSize = vsnprintf(sz, Size - 1, format, va);
|
||||
@@ -223,7 +220,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
|
||||
const unsigned int majorVersion(aiGetVersionMajor());
|
||||
const unsigned int minorVersion(aiGetVersionMinor());
|
||||
const unsigned int rev(aiGetVersionRevision());
|
||||
const char *curtime(asctime(p));
|
||||
const char *curtime = asctime(p);
|
||||
ioprintf(io, header.c_str(), majorVersion, minorVersion, rev, pFile, c.c_str(), curtime, scene->mFlags, 0u);
|
||||
|
||||
// write the node graph
|
||||
@@ -304,7 +301,11 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
|
||||
bool compressed = (tex->mHeight == 0);
|
||||
|
||||
// mesh header
|
||||
ioprintf(io, "\t<Texture width=\"%u\" height=\"%u\" compressed=\"%s\"> \n",
|
||||
std::string texName = "unknown";
|
||||
if (tex->mFilename.length != 0u) {
|
||||
texName = tex->mFilename.data;
|
||||
}
|
||||
ioprintf(io, "\t<Texture name=\"%s\" width=\"%u\" height=\"%u\" compressed=\"%s\"> \n", texName.c_str(),
|
||||
(compressed ? -1 : tex->mWidth), (compressed ? -1 : tex->mHeight),
|
||||
(compressed ? "true" : "false"));
|
||||
|
||||
@@ -352,7 +353,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
|
||||
for (unsigned int n = 0; n < mat->mNumProperties; ++n) {
|
||||
|
||||
const aiMaterialProperty *prop = mat->mProperties[n];
|
||||
const char *sz = "";
|
||||
auto sz = "";
|
||||
if (prop->mType == aiPTI_Float) {
|
||||
sz = "float";
|
||||
} else if (prop->mType == aiPTI_Integer) {
|
||||
@@ -365,7 +366,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
|
||||
|
||||
ioprintf(io, "\t\t\t<MatProperty key=\"%s\" \n\t\t\ttype=\"%s\" tex_usage=\"%s\" tex_index=\"%u\"",
|
||||
prop->mKey.data, sz,
|
||||
::TextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex);
|
||||
::aiTextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex);
|
||||
|
||||
if (prop->mType == aiPTI_Float) {
|
||||
ioprintf(io, " size=\"%i\">\n\t\t\t\t",
|
||||
@@ -652,7 +653,7 @@ void DumpSceneToAssxml(
|
||||
const char *pFile, const char *cmd, IOSystem *pIOSystem,
|
||||
const aiScene *pScene, bool shortened) {
|
||||
std::unique_ptr<IOStream> file(pIOSystem->Open(pFile, "wt"));
|
||||
if (!file.get()) {
|
||||
if (!file) {
|
||||
throw std::runtime_error("Unable to open output file " + std::string(pFile) + '\n');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef ASSIMP_BUILD_NO_B3D_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "AssetLib/B3D/B3DImporter.h"
|
||||
#include "B3DImporter.h"
|
||||
#include "PostProcessing/ConvertToLHProcess.h"
|
||||
#include "PostProcessing/TextureTransform.h"
|
||||
|
||||
@@ -59,10 +59,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
using namespace std;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"BlitzBasic 3D Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -79,18 +79,16 @@ static const aiImporterDesc desc = {
|
||||
#pragma warning(disable : 4018)
|
||||
#endif
|
||||
|
||||
//#define DEBUG_B3D
|
||||
// #define DEBUG_B3D
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void DeleteAllBarePointers(std::vector<T> &x) {
|
||||
for (auto p : x) {
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
B3DImporter::~B3DImporter() {
|
||||
// empty
|
||||
}
|
||||
B3DImporter::~B3DImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool B3DImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
|
||||
@@ -118,7 +116,7 @@ void B3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr) {
|
||||
if (file == nullptr) {
|
||||
throw DeadlyImportError("Failed to open B3D file ", pFile, ".");
|
||||
}
|
||||
|
||||
@@ -152,7 +150,7 @@ AI_WONT_RETURN void B3DImporter::Fail(const string &str) {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int B3DImporter::ReadByte() {
|
||||
if (_pos > _buf.size()) {
|
||||
if (_pos >= _buf.size()) {
|
||||
Fail("EOF");
|
||||
}
|
||||
|
||||
@@ -255,7 +253,7 @@ size_t B3DImporter::ChunkSize() {
|
||||
template <class T>
|
||||
T *B3DImporter::to_array(const vector<T> &v) {
|
||||
if (v.empty()) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
T *p = new T[v.size()];
|
||||
for (size_t i = 0; i < v.size(); ++i) {
|
||||
@@ -268,7 +266,7 @@ T *B3DImporter::to_array(const vector<T> &v) {
|
||||
template <class T>
|
||||
T **unique_to_array(vector<std::unique_ptr<T>> &v) {
|
||||
if (v.empty()) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
T **p = new T *[v.size()];
|
||||
for (size_t i = 0; i < v.size(); ++i) {
|
||||
@@ -331,7 +329,7 @@ void B3DImporter::ReadBRUS() {
|
||||
mat->AddProperty(&i, 1, AI_MATKEY_TWOSIDED);
|
||||
}
|
||||
|
||||
//Textures
|
||||
// Textures
|
||||
for (int i = 0; i < n_texs; ++i) {
|
||||
int texid = ReadInt();
|
||||
if (texid < -1 || (texid >= 0 && texid >= static_cast<int>(_textures.size()))) {
|
||||
@@ -374,7 +372,7 @@ void B3DImporter::ReadVRTS() {
|
||||
}
|
||||
|
||||
if (_vflags & 2) {
|
||||
ReadQuat(); //skip v 4bytes...
|
||||
ReadQuat(); // skip v 4bytes...
|
||||
}
|
||||
|
||||
for (int j = 0; j < _tcsets; ++j) {
|
||||
@@ -420,7 +418,6 @@ void B3DImporter::ReadTRIS(int v0) {
|
||||
ASSIMP_LOG_ERROR("Bad triangle index: i0=", i0, ", i1=", i1, ", i2=", i2);
|
||||
#endif
|
||||
Fail("Bad triangle index");
|
||||
continue;
|
||||
}
|
||||
face->mNumIndices = 3;
|
||||
face->mIndices = new unsigned[3];
|
||||
@@ -479,13 +476,13 @@ void B3DImporter::ReadKEYS(aiNodeAnim *nodeAnim) {
|
||||
while (ChunkSize()) {
|
||||
int frame = ReadInt();
|
||||
if (flags & 1) {
|
||||
trans.push_back(aiVectorKey(frame, ReadVec3()));
|
||||
trans.emplace_back(frame, ReadVec3());
|
||||
}
|
||||
if (flags & 2) {
|
||||
scale.push_back(aiVectorKey(frame, ReadVec3()));
|
||||
scale.emplace_back(frame, ReadVec3());
|
||||
}
|
||||
if (flags & 4) {
|
||||
rot.push_back(aiQuatKey(frame, ReadQuat()));
|
||||
rot.emplace_back(frame, ReadQuat());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,7 +616,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
||||
} else if (chunk == "BRUS") {
|
||||
ReadBRUS();
|
||||
} else if (chunk == "NODE") {
|
||||
ReadNODE(0);
|
||||
ReadNODE(nullptr);
|
||||
}
|
||||
ExitChunk();
|
||||
}
|
||||
@@ -644,7 +641,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
||||
int n_tris = mesh->mNumFaces;
|
||||
int n_verts = mesh->mNumVertices = n_tris * 3;
|
||||
|
||||
aiVector3D *mv = mesh->mVertices = new aiVector3D[n_verts], *mn = 0, *mc = 0;
|
||||
aiVector3D *mv = mesh->mVertices = new aiVector3D[n_verts], *mn = nullptr, *mc = nullptr;
|
||||
if (_vflags & 1) {
|
||||
mn = mesh->mNormals = new aiVector3D[n_verts];
|
||||
}
|
||||
@@ -673,7 +670,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
||||
int bone = v.bones[k];
|
||||
float weight = v.weights[k];
|
||||
|
||||
vweights[bone].push_back(aiVertexWeight(vertIdx + faceIndex, weight));
|
||||
vweights[bone].emplace_back(vertIdx + faceIndex, weight);
|
||||
}
|
||||
}
|
||||
++face;
|
||||
@@ -707,22 +704,22 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
||||
}
|
||||
}
|
||||
|
||||
//nodes
|
||||
// nodes
|
||||
scene->mRootNode = _nodes[0];
|
||||
_nodes.clear(); // node ownership now belongs to scene
|
||||
|
||||
//material
|
||||
// material
|
||||
if (!_materials.size()) {
|
||||
_materials.emplace_back(std::unique_ptr<aiMaterial>(new aiMaterial));
|
||||
}
|
||||
scene->mNumMaterials = static_cast<unsigned int>(_materials.size());
|
||||
scene->mMaterials = unique_to_array(_materials);
|
||||
|
||||
//meshes
|
||||
// meshes
|
||||
scene->mNumMeshes = static_cast<unsigned int>(_meshes.size());
|
||||
scene->mMeshes = unique_to_array(_meshes);
|
||||
|
||||
//animations
|
||||
// animations
|
||||
if (_animations.size() == 1 && _nodeAnims.size()) {
|
||||
|
||||
aiAnimation *anim = _animations.back().get();
|
||||
@@ -741,4 +738,6 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
|
||||
flip.Execute(scene);
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_B3D_IMPORTER
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -60,7 +60,7 @@ struct aiAnimation;
|
||||
|
||||
namespace Assimp{
|
||||
|
||||
class B3DImporter : public BaseImporter{
|
||||
class B3DImporter final : public BaseImporter{
|
||||
public:
|
||||
B3DImporter() = default;
|
||||
~B3DImporter() override;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -55,10 +53,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"BVH Importer (MoCap)",
|
||||
"",
|
||||
"",
|
||||
@@ -73,8 +72,8 @@ static const aiImporterDesc desc = {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Aborts the file reading with an exception
|
||||
template<typename... T>
|
||||
AI_WONT_RETURN void BVHLoader::ThrowException(T&&... args) {
|
||||
template <typename... T>
|
||||
AI_WONT_RETURN void BVHLoader::ThrowException(T &&...args) {
|
||||
throw DeadlyImportError(mFileName, ":", mLine, " - ", args...);
|
||||
}
|
||||
|
||||
@@ -84,11 +83,9 @@ BVHLoader::BVHLoader() :
|
||||
mLine(),
|
||||
mAnimTickDuration(),
|
||||
mAnimNumFrames(),
|
||||
noSkeletonMesh() {}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
BVHLoader::~BVHLoader() {}
|
||||
noSkeletonMesh() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
@@ -115,7 +112,7 @@ void BVHLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IOSyst
|
||||
|
||||
// read file into memory
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile));
|
||||
if (file.get() == nullptr) {
|
||||
if (file == nullptr) {
|
||||
throw DeadlyImportError("Failed to open file ", pFile, ".");
|
||||
}
|
||||
|
||||
@@ -186,12 +183,12 @@ aiNode *BVHLoader::ReadNode() {
|
||||
std::vector<aiNode *> childNodes;
|
||||
|
||||
// and create an bone entry for it
|
||||
mNodes.push_back(Node(node));
|
||||
mNodes.emplace_back(node);
|
||||
Node &internNode = mNodes.back();
|
||||
|
||||
// now read the node's contents
|
||||
std::string siteToken;
|
||||
while (1) {
|
||||
while (true) {
|
||||
std::string token = GetNextToken();
|
||||
|
||||
// node offset to parent node
|
||||
@@ -247,7 +244,7 @@ aiNode *BVHLoader::ReadEndSite(const std::string &pParentName) {
|
||||
|
||||
// now read the node's contents. Only possible entry is "OFFSET"
|
||||
std::string token;
|
||||
while (1) {
|
||||
while (true) {
|
||||
token.clear();
|
||||
token = GetNextToken();
|
||||
|
||||
@@ -388,7 +385,7 @@ float BVHLoader::GetNextTokenAsFloat() {
|
||||
// check if the float is valid by testing if the atof() function consumed every char of the token
|
||||
const char *ctoken = token.c_str();
|
||||
float result = 0.0f;
|
||||
ctoken = fast_atoreal_move<float>(ctoken, result);
|
||||
ctoken = fast_atoreal_move(ctoken, result);
|
||||
|
||||
if (ctoken != token.c_str() + token.length())
|
||||
ThrowException("Expected a floating point number, but found \"", token, "\".");
|
||||
@@ -426,7 +423,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
||||
nodeAnim->mNodeName.Set(nodeName);
|
||||
std::map<BVHLoader::ChannelType, int> channelMap;
|
||||
|
||||
//Build map of channels
|
||||
// Build map of channels
|
||||
for (unsigned int channel = 0; channel < node.mChannels.size(); ++channel) {
|
||||
channelMap[node.mChannels[channel]] = channel;
|
||||
}
|
||||
@@ -441,7 +438,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
||||
|
||||
// Now compute all translations
|
||||
for (BVHLoader::ChannelType channel = Channel_PositionX; channel <= Channel_PositionZ; channel = (BVHLoader::ChannelType)(channel + 1)) {
|
||||
//Find channel in node
|
||||
// Find channel in node
|
||||
std::map<BVHLoader::ChannelType, int>::iterator mapIter = channelMap.find(channel);
|
||||
|
||||
if (mapIter == channelMap.end())
|
||||
@@ -485,30 +482,27 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
||||
for (unsigned int fr = 0; fr < mAnimNumFrames; ++fr) {
|
||||
aiMatrix4x4 temp;
|
||||
aiMatrix3x3 rotMatrix;
|
||||
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++ channelIdx) {
|
||||
switch (node.mChannels[channelIdx]) {
|
||||
case Channel_RotationX:
|
||||
{
|
||||
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++channelIdx) {
|
||||
switch (node.mChannels[channelIdx]) {
|
||||
case Channel_RotationX: {
|
||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||
aiMatrix4x4::RotationX( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
||||
}
|
||||
break;
|
||||
case Channel_RotationY:
|
||||
{
|
||||
aiMatrix4x4::RotationX(angle, temp);
|
||||
rotMatrix *= aiMatrix3x3(temp);
|
||||
} break;
|
||||
case Channel_RotationY: {
|
||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||
aiMatrix4x4::RotationY( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
||||
}
|
||||
break;
|
||||
case Channel_RotationZ:
|
||||
{
|
||||
aiMatrix4x4::RotationY(angle, temp);
|
||||
rotMatrix *= aiMatrix3x3(temp);
|
||||
} break;
|
||||
case Channel_RotationZ: {
|
||||
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
|
||||
aiMatrix4x4::RotationZ( angle, temp); rotMatrix *= aiMatrix3x3( temp);
|
||||
}
|
||||
break;
|
||||
aiMatrix4x4::RotationZ(angle, temp);
|
||||
rotMatrix *= aiMatrix3x3(temp);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rotkey->mTime = double(fr);
|
||||
rotkey->mValue = aiQuaternion(rotMatrix);
|
||||
++rotkey;
|
||||
@@ -525,4 +519,6 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_BUILD_NO_BVH_IMPORTER
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -62,7 +61,7 @@ namespace Assimp {
|
||||
* the hierarchy. It contains no actual mesh data, but we generate a dummy mesh
|
||||
* inside the loader just to be able to see something.
|
||||
*/
|
||||
class BVHLoader : public BaseImporter {
|
||||
class BVHLoader final : public BaseImporter {
|
||||
|
||||
/** Possible animation channels for which the motion data holds the values */
|
||||
enum ChannelType {
|
||||
@@ -80,32 +79,27 @@ class BVHLoader : public BaseImporter {
|
||||
std::vector<ChannelType> mChannels;
|
||||
std::vector<float> mChannelValues; // motion data values for that node. Of size NumChannels * NumFrames
|
||||
|
||||
Node() :
|
||||
mNode(nullptr) {}
|
||||
|
||||
explicit Node(const aiNode *pNode) :
|
||||
mNode(pNode) {}
|
||||
Node() : mNode(nullptr) {}
|
||||
explicit Node(const aiNode *pNode) :mNode(pNode) {}
|
||||
};
|
||||
|
||||
public:
|
||||
BVHLoader();
|
||||
~BVHLoader();
|
||||
~BVHLoader() override = default;
|
||||
|
||||
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 cs) const;
|
||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool cs) const override;
|
||||
|
||||
void SetupProperties(const Importer *pImp);
|
||||
const aiImporterDesc *GetInfo() const;
|
||||
void SetupProperties(const Importer *pImp) override;
|
||||
const aiImporterDesc *GetInfo() const override;
|
||||
|
||||
protected:
|
||||
/** 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;
|
||||
|
||||
protected:
|
||||
/** Reads the file */
|
||||
void ReadStructure(aiScene *pScene);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
template <>
|
||||
const char *LogFunctions<BlenderBMeshConverter>::Prefix() {
|
||||
static auto prefix = "BLEND_BMESH: ";
|
||||
return prefix;
|
||||
return "BLEND_BMESH: ";
|
||||
}
|
||||
} // namespace Assimp
|
||||
|
||||
@@ -75,7 +74,9 @@ BlenderBMeshConverter::~BlenderBMeshConverter() {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool BlenderBMeshConverter::ContainsBMesh() const {
|
||||
// TODO - Should probably do some additional verification here
|
||||
if (BMesh == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return BMesh->totpoly && BMesh->totloop && BMesh->totvert;
|
||||
}
|
||||
|
||||
@@ -140,7 +141,7 @@ void BlenderBMeshConverter::ConvertPolyToFaces(const MPoly &poly) {
|
||||
ThrowException("BMesh uv loop array has incorrect size");
|
||||
}
|
||||
const MLoopUV *loopUV = &BMesh->mloopuv[poly.loopstart];
|
||||
AddTFace(loopUV[0].uv, loopUV[1].uv, loopUV[2].uv, poly.totloop == 4 ? loopUV[3].uv : 0);
|
||||
AddTFace(loopUV[0].uv, loopUV[1].uv, loopUV[2].uv, poly.totloop == 4 ? loopUV[3].uv : nullptr);
|
||||
}
|
||||
} else if (poly.totloop > 4) {
|
||||
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -63,14 +63,12 @@ namespace Assimp
|
||||
struct MLoop;
|
||||
}
|
||||
|
||||
class BlenderBMeshConverter: public LogFunctions< BlenderBMeshConverter >
|
||||
class BlenderBMeshConverter final : public LogFunctions< BlenderBMeshConverter >
|
||||
{
|
||||
public:
|
||||
BlenderBMeshConverter( const Blender::Mesh* mesh );
|
||||
~BlenderBMeshConverter( );
|
||||
|
||||
bool ContainsBMesh( ) const;
|
||||
|
||||
explicit BlenderBMeshConverter( const Blender::Mesh* mesh );
|
||||
~BlenderBMeshConverter();
|
||||
bool ContainsBMesh() const;
|
||||
const Blender::Mesh* TriangulateBMesh( );
|
||||
|
||||
private:
|
||||
@@ -80,7 +78,7 @@ namespace Assimp
|
||||
void DestroyTriMesh( );
|
||||
void ConvertPolyToFaces( const Blender::MPoly& poly );
|
||||
void AddFace( int v1, int v2, int v3, int v4 = 0 );
|
||||
void AddTFace( const float* uv1, const float* uv2, const float *uv3, const float* uv4 = 0 );
|
||||
void AddTFace(const float *uv1, const float *uv2, const float *uv3, const float *uv4 = nullptr);
|
||||
|
||||
const Blender::Mesh* BMesh;
|
||||
Blender::Mesh* triMesh;
|
||||
|
||||
@@ -96,7 +96,8 @@ struct CustomDataTypeDescription {
|
||||
* other (like CD_ORCO, ...) uses arrays of rawtypes or even arrays of Structures
|
||||
* use a special readfunction for that cases
|
||||
*/
|
||||
std::array<CustomDataTypeDescription, CD_NUMTYPES> customDataTypeDescriptions = { { DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MVert),
|
||||
static const std::array<CustomDataTypeDescription, CD_NUMTYPES> customDataTypeDescriptions = { {
|
||||
DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MVert),
|
||||
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION,
|
||||
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION,
|
||||
DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MEdge),
|
||||
@@ -141,7 +142,8 @@ std::array<CustomDataTypeDescription, CD_NUMTYPES> customDataTypeDescriptions =
|
||||
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION,
|
||||
|
||||
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION,
|
||||
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION } };
|
||||
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION
|
||||
} };
|
||||
|
||||
bool isValidCustomDataType(const int cdtype) {
|
||||
return cdtype >= 0 && cdtype < CD_NUMTYPES;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -72,7 +71,7 @@ struct Type {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DNAParser::Parse() {
|
||||
StreamReaderAny &stream = *db.reader.get();
|
||||
StreamReaderAny &stream = *db.reader;
|
||||
DNA &dna = db.dna;
|
||||
|
||||
if (!match4(stream, "SDNA")) {
|
||||
@@ -325,10 +324,10 @@ void SectionParser ::Next() {
|
||||
stream.SetCurrentPos(current.start + current.size);
|
||||
|
||||
const char tmp[] = {
|
||||
(const char)stream.GetI1(),
|
||||
(const char)stream.GetI1(),
|
||||
(const char)stream.GetI1(),
|
||||
(const char)stream.GetI1()
|
||||
(char)stream.GetI1(),
|
||||
(char)stream.GetI1(),
|
||||
(char)stream.GetI1(),
|
||||
(char)stream.GetI1()
|
||||
};
|
||||
current.id = std::string(tmp, tmp[3] ? 4 : tmp[2] ? 3 : tmp[1] ? 2 : 1);
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -56,14 +55,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// enable verbose log output. really verbose, so be careful.
|
||||
#ifdef ASSIMP_BUILD_DEBUG
|
||||
#define ASSIMP_BUILD_BLENDER_DEBUG
|
||||
# define ASSIMP_BUILD_BLENDER_DEBUG
|
||||
#endif
|
||||
|
||||
// set this to non-zero to dump BlenderDNA stuff to dna.txt.
|
||||
// you could set it on the assimp build command line too without touching it here.
|
||||
// !!! please make sure this is set to 0 in the repo !!!
|
||||
#ifndef ASSIMP_BUILD_BLENDER_DEBUG_DNA
|
||||
#define ASSIMP_BUILD_BLENDER_DEBUG_DNA 0
|
||||
# define ASSIMP_BUILD_BLENDER_DEBUG_DNA 0
|
||||
#endif
|
||||
|
||||
// #define ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
@@ -106,9 +105,7 @@ struct ElemBase {
|
||||
// empty
|
||||
}
|
||||
|
||||
virtual ~ElemBase() {
|
||||
// empty
|
||||
}
|
||||
virtual ~ElemBase() = default;
|
||||
|
||||
/** Type name of the element. The type
|
||||
* string points is the `c_str` of the `name` attribute of the
|
||||
@@ -127,22 +124,14 @@ struct ElemBase {
|
||||
* they used to point to.*/
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Pointer {
|
||||
Pointer() :
|
||||
val() {
|
||||
// empty
|
||||
}
|
||||
uint64_t val;
|
||||
uint64_t val{0};
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Represents a generic offset within a BLEND file */
|
||||
// -------------------------------------------------------------------------------
|
||||
struct FileOffset {
|
||||
FileOffset() :
|
||||
val() {
|
||||
// empty
|
||||
}
|
||||
uint64_t val;
|
||||
uint64_t val{0};
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -207,7 +196,7 @@ enum ErrorPolicy {
|
||||
};
|
||||
|
||||
#ifdef ASSIMP_BUILD_BLENDER_DEBUG
|
||||
#define ErrorPolicy_Igno ErrorPolicy_Warn
|
||||
# define ErrorPolicy_Igno ErrorPolicy_Warn
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -399,10 +388,9 @@ private:
|
||||
mutable size_t cache_idx;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------
|
||||
template <>
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
template<>
|
||||
struct Structure::_defaultInitializer<ErrorPolicy_Warn> {
|
||||
|
||||
template <typename T>
|
||||
void operator()(T &out, const char *reason = "<add reason>") {
|
||||
ASSIMP_LOG_WARN(reason);
|
||||
@@ -412,14 +400,14 @@ struct Structure::_defaultInitializer<ErrorPolicy_Warn> {
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
template<>
|
||||
struct Structure::_defaultInitializer<ErrorPolicy_Fail> {
|
||||
|
||||
template <typename T>
|
||||
void operator()(T & /*out*/, const char * = "") {
|
||||
void operator()(T & /*out*/, const char *message = "") {
|
||||
// obviously, it is crucial that _DefaultInitializer is used
|
||||
// only from within a catch clause.
|
||||
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error");
|
||||
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error: ", message);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -431,6 +419,17 @@ inline bool Structure ::ResolvePointer<std::shared_ptr, ElemBase>(std::shared_pt
|
||||
const Field &f,
|
||||
bool) const;
|
||||
|
||||
template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(
|
||||
std::shared_ptr<ElemBase>& out, const Pointer & ptrval,
|
||||
const FileDatabase& db, const Field&, bool) const;
|
||||
template <> inline void Structure :: Convert<int> (int& dest,const FileDatabase& db) const;
|
||||
template<> inline void Structure :: Convert<short> (short& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<char> (char& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure::Convert<unsigned char>(unsigned char& dest, const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<double> (double& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<Pointer> (Pointer& dest,const FileDatabase& db) const;
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Represents the full data structure information for a single BLEND file.
|
||||
* This data is extracted from the DNA1 chunk in the file.
|
||||
@@ -611,31 +610,23 @@ public:
|
||||
/** Import statistics, i.e. number of file blocks read*/
|
||||
// -------------------------------------------------------------------------------
|
||||
class Statistics {
|
||||
|
||||
public:
|
||||
Statistics() :
|
||||
fields_read(), pointers_resolved(), cache_hits()
|
||||
// , blocks_read ()
|
||||
,
|
||||
cached_objects() {}
|
||||
Statistics() = default;
|
||||
~Statistics() = default;
|
||||
|
||||
public:
|
||||
/** total number of fields we read */
|
||||
/// total number of fields we read
|
||||
unsigned int fields_read;
|
||||
|
||||
/** total number of resolved pointers */
|
||||
/// total number of resolved pointers
|
||||
unsigned int pointers_resolved;
|
||||
|
||||
/** number of pointers resolved from the cache */
|
||||
/// number of pointers resolved from the cache
|
||||
unsigned int cache_hits;
|
||||
|
||||
/** number of blocks (from FileDatabase::entries)
|
||||
we did actually read from. */
|
||||
// unsigned int blocks_read;
|
||||
|
||||
/** objects in FileData::cache */
|
||||
/// objects in FileData::cache
|
||||
unsigned int cached_objects;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -648,15 +639,13 @@ public:
|
||||
typedef std::map<Pointer, TOUT<ElemBase>> StructureCache;
|
||||
|
||||
public:
|
||||
ObjectCache(const FileDatabase &db) :
|
||||
db(db) {
|
||||
explicit ObjectCache(const FileDatabase &db) : db(db) {
|
||||
// currently there are only ~400 structure records per blend file.
|
||||
// we read only a small part of them and don't cache objects
|
||||
// which we don't need, so this should suffice.
|
||||
caches.reserve(64);
|
||||
}
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------
|
||||
/** Check whether a specific item is in the cache.
|
||||
* @param s Data type of the item
|
||||
@@ -664,10 +653,7 @@ public:
|
||||
* cache doesn't know the item yet.
|
||||
* @param ptr Item address to look for. */
|
||||
template <typename T>
|
||||
void get(
|
||||
const Structure &s,
|
||||
TOUT<T> &out,
|
||||
const Pointer &ptr) const;
|
||||
void get( const Structure &s,TOUT<T> &out, const Pointer &ptr) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Add an item to the cache after the item has
|
||||
@@ -692,7 +678,7 @@ private:
|
||||
template <>
|
||||
class ObjectCache<Blender::vector> {
|
||||
public:
|
||||
ObjectCache(const FileDatabase &) {}
|
||||
explicit ObjectCache(const FileDatabase &) {}
|
||||
|
||||
template <typename T>
|
||||
void get(const Structure &, vector<T> &, const Pointer &) {}
|
||||
@@ -701,7 +687,7 @@ public:
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4355)
|
||||
# pragma warning(disable : 4355)
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -716,16 +702,6 @@ public:
|
||||
FileDatabase() :
|
||||
_cacheArrays(*this), _cache(*this), next_cache_idx() {}
|
||||
|
||||
public:
|
||||
// publicly accessible fields
|
||||
bool i64bit;
|
||||
bool little;
|
||||
|
||||
DNA dna;
|
||||
std::shared_ptr<StreamReaderAny> reader;
|
||||
vector<FileBlockHead> entries;
|
||||
|
||||
public:
|
||||
Statistics &stats() const {
|
||||
return _stats;
|
||||
}
|
||||
@@ -744,6 +720,15 @@ public:
|
||||
return _cacheArrays;
|
||||
}
|
||||
|
||||
public:
|
||||
// publicly accessible fields
|
||||
bool i64bit;
|
||||
bool little;
|
||||
|
||||
DNA dna;
|
||||
std::shared_ptr<StreamReaderAny> reader;
|
||||
vector<FileBlockHead> entries;
|
||||
|
||||
private:
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
mutable Statistics _stats;
|
||||
@@ -756,20 +741,19 @@ private:
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4355)
|
||||
# pragma warning(default : 4355)
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Factory to extract a #DNA from the DNA1 file block in a BLEND file. */
|
||||
// -------------------------------------------------------------------------------
|
||||
class DNAParser {
|
||||
|
||||
public:
|
||||
/** Bind the parser to a empty DNA and an input stream */
|
||||
DNAParser(FileDatabase &db) :
|
||||
db(db) {}
|
||||
explicit DNAParser(FileDatabase &db) : db(db) {
|
||||
// empty
|
||||
}
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------
|
||||
/** Locate the DNA in the file and parse it. The input
|
||||
* stream is expected to point to the beginning of the DN1
|
||||
@@ -780,7 +764,6 @@ public:
|
||||
* afterwards.*/
|
||||
void Parse();
|
||||
|
||||
public:
|
||||
/** Obtain a reference to the extracted DNA information */
|
||||
const Blender::DNA &GetDNA() const {
|
||||
return db.dna;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -841,5 +841,7 @@ template <template <typename> class TOUT> template <typename T> void ObjectCache
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -65,8 +64,7 @@ namespace Blender {
|
||||
struct TempArray {
|
||||
typedef TCLASS< T*,std::allocator<T*> > mywrap;
|
||||
|
||||
TempArray() {
|
||||
}
|
||||
TempArray() = default;
|
||||
|
||||
~TempArray () {
|
||||
for(T* elem : arr) {
|
||||
@@ -118,7 +116,7 @@ namespace Blender {
|
||||
mywrap arr;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
# pragma warning(disable:4351)
|
||||
#endif
|
||||
|
||||
@@ -173,7 +171,7 @@ namespace Blender {
|
||||
// original file data
|
||||
const FileDatabase& db;
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
# pragma warning(default:4351)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -63,23 +61,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/StringComparison.h>
|
||||
|
||||
#include <cctype>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
// zlib is needed for compressed blend files
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
|
||||
#include "Common/Compression.h"
|
||||
/* #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||
# include <zlib.h>
|
||||
# else
|
||||
# include "../contrib/zlib/zlib.h"
|
||||
# endif*/
|
||||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
template <>
|
||||
const char *LogFunctions<BlenderImporter>::Prefix() {
|
||||
static auto prefix = "BLEND: ";
|
||||
return prefix;
|
||||
return "BLEND: ";
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
@@ -88,7 +82,7 @@ using namespace Assimp;
|
||||
using namespace Assimp::Blender;
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
static const aiImporterDesc blenderDesc = {
|
||||
static constexpr aiImporterDesc blenderDesc = {
|
||||
"Blender 3D Importer (http://www.blender3d.org)",
|
||||
"",
|
||||
"",
|
||||
@@ -114,15 +108,12 @@ BlenderImporter::~BlenderImporter() {
|
||||
delete modifier_cache;
|
||||
}
|
||||
|
||||
static const char * const Tokens[] = { "BLENDER" };
|
||||
static constexpr char Token[] = "BLENDER";
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
// note: this won't catch compressed files
|
||||
static const char *tokens[] = { "<BLENDER", "blender" };
|
||||
|
||||
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
|
||||
return ParseMagicToken(pFile, pIOHandler).error.empty();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -141,67 +132,25 @@ void BlenderImporter::SetupProperties(const Importer * /*pImp*/) {
|
||||
// Imports the given file into the given scene structure.
|
||||
void BlenderImporter::InternReadFile(const std::string &pFile,
|
||||
aiScene *pScene, IOSystem *pIOHandler) {
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
|
||||
std::vector<char> uncompressed;
|
||||
#endif
|
||||
|
||||
FileDatabase file;
|
||||
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
|
||||
if (!stream) {
|
||||
ThrowException("Could not open file for reading");
|
||||
StreamOrError streamOrError = ParseMagicToken(pFile, pIOHandler);
|
||||
if (!streamOrError.error.empty()) {
|
||||
ThrowException(streamOrError.error);
|
||||
}
|
||||
std::shared_ptr<IOStream> stream = std::move(streamOrError.stream);
|
||||
|
||||
char magic[8] = { 0 };
|
||||
stream->Read(magic, 7, 1);
|
||||
if (strcmp(magic, Tokens[0])) {
|
||||
// Check for presence of the gzip header. If yes, assume it is a
|
||||
// compressed blend file and try uncompressing it, else fail. This is to
|
||||
// avoid uncompressing random files which our loader might end up with.
|
||||
#ifdef ASSIMP_BUILD_NO_COMPRESSED_BLEND
|
||||
ThrowException("BLENDER magic bytes are missing, is this file compressed (Assimp was built without decompression support)?");
|
||||
#else
|
||||
if (magic[0] != 0x1f || static_cast<uint8_t>(magic[1]) != 0x8b) {
|
||||
ThrowException("BLENDER magic bytes are missing, couldn't find GZIP header either");
|
||||
}
|
||||
char version[4] = { 0 };
|
||||
file.i64bit = (stream->Read(version, 1, 1), version[0] == '-');
|
||||
file.little = (stream->Read(version, 1, 1), version[0] == 'v');
|
||||
|
||||
LogDebug("Found no BLENDER magic word but a GZIP header, might be a compressed file");
|
||||
if (magic[2] != 8) {
|
||||
ThrowException("Unsupported GZIP compression method");
|
||||
}
|
||||
stream->Read(version, 3, 1);
|
||||
version[3] = '\0';
|
||||
|
||||
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
|
||||
stream->Seek(0L, aiOrigin_SET);
|
||||
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
||||
|
||||
size_t total = 0;
|
||||
Compression compression;
|
||||
if (compression.open(Compression::Format::Binary, Compression::FlushMode::NoFlush, 16 + Compression::MaxWBits)) {
|
||||
total = compression.decompress((unsigned char *)reader->GetPtr(), reader->GetRemainingSize(), uncompressed);
|
||||
compression.close();
|
||||
}
|
||||
|
||||
// replace the input stream with a memory stream
|
||||
stream.reset(new MemoryIOStream(reinterpret_cast<uint8_t *>(uncompressed.data()), total));
|
||||
|
||||
// .. and retry
|
||||
stream->Read(magic, 7, 1);
|
||||
if (strcmp(magic, "BLENDER")) {
|
||||
ThrowException("Found no BLENDER magic word in decompressed GZIP file");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
file.i64bit = (stream->Read(magic, 1, 1), magic[0] == '-');
|
||||
file.little = (stream->Read(magic, 1, 1), magic[0] == 'v');
|
||||
|
||||
stream->Read(magic, 3, 1);
|
||||
magic[3] = '\0';
|
||||
|
||||
LogInfo("Blender version is ", magic[0], ".", magic + 1,
|
||||
LogInfo("Blender version is ", version[0], ".", version + 1,
|
||||
" (64bit: ", file.i64bit ? "true" : "false",
|
||||
", little endian: ", file.little ? "true" : "false", ")");
|
||||
|
||||
ParseBlendFile(file, stream);
|
||||
ParseBlendFile(file, std::move(stream));
|
||||
|
||||
Scene scene;
|
||||
ExtractScene(scene, file);
|
||||
@@ -218,7 +167,7 @@ void BlenderImporter::ParseBlendFile(FileDatabase &out, std::shared_ptr<IOStream
|
||||
|
||||
out.entries.reserve(128);
|
||||
{ // even small BLEND files tend to consist of many file blocks
|
||||
SectionParser parser(*out.reader.get(), out.i64bit);
|
||||
SectionParser parser(*out.reader, out.i64bit);
|
||||
|
||||
// first parse the file in search for the DNA and insert all other sections into the database
|
||||
while ((parser.Next(), 1)) {
|
||||
@@ -281,7 +230,7 @@ void BlenderImporter::ExtractScene(Scene &out, const FileDatabase &file) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr<Collection> collection, ConversionData &conv_data) {
|
||||
void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr<Collection>& collection, ConversionData &conv_data) {
|
||||
|
||||
std::deque<Object *> root_objects;
|
||||
// Count number of objects
|
||||
@@ -408,7 +357,7 @@ void BlenderImporter::ResolveImage(aiMaterial *out, const Material *mat, const M
|
||||
// check if the file contents are bundled with the BLEND file
|
||||
if (img->packedfile) {
|
||||
name.data[0] = '*';
|
||||
name.length = 1 + ASSIMP_itoa10(name.data + 1, static_cast<unsigned int>(MAXLEN - 1), static_cast<int32_t>(conv_data.textures->size()));
|
||||
name.length = 1 + ASSIMP_itoa10(name.data + 1, static_cast<unsigned int>(AI_MAXLEN - 1), static_cast<int32_t>(conv_data.textures->size()));
|
||||
|
||||
conv_data.textures->push_back(new aiTexture());
|
||||
aiTexture *curTex = conv_data.textures->back();
|
||||
@@ -482,7 +431,7 @@ void BlenderImporter::AddSentinelTexture(aiMaterial *out, const Material *mat, c
|
||||
(void)conv_data;
|
||||
|
||||
aiString name;
|
||||
name.length = ai_snprintf(name.data, MAXLEN, "Procedural,num=%i,type=%s", conv_data.sentinel_cnt++,
|
||||
name.length = ai_snprintf(name.data, AI_MAXLEN, "Procedural,num=%i,type=%s", conv_data.sentinel_cnt++,
|
||||
GetTextureTypeDisplayString(tex->tex->type));
|
||||
out->AddProperty(&name, AI_MATKEY_TEXTURE_DIFFUSE(
|
||||
conv_data.next_texture[aiTextureType_DIFFUSE]++));
|
||||
@@ -544,8 +493,9 @@ void BlenderImporter::BuildDefaultMaterial(Blender::ConversionData &conv_data) {
|
||||
if (index == static_cast<unsigned int>(-1)) {
|
||||
// Setup a default material.
|
||||
std::shared_ptr<Material> p(new Material());
|
||||
ai_assert(::strlen(AI_DEFAULT_MATERIAL_NAME) < sizeof(p->id.name) - 2);
|
||||
strcpy(p->id.name + 2, AI_DEFAULT_MATERIAL_NAME);
|
||||
const size_t len = ::strlen(AI_DEFAULT_MATERIAL_NAME);
|
||||
ai_assert(len < sizeof(p->id.name) - 2);
|
||||
memcpy(p->id.name + 2, AI_DEFAULT_MATERIAL_NAME, len);
|
||||
|
||||
// Note: MSVC11 does not zero-initialize Material here, although it should.
|
||||
// Thus all relevant fields should be explicitly initialized. We cannot add
|
||||
@@ -986,7 +936,7 @@ void BlenderImporter::ConvertMesh(const Scene & /*in*/, const Object * /*obj*/,
|
||||
// key is material number, value is the TextureUVMapping for the material
|
||||
typedef std::map<uint32_t, TextureUVMapping> MaterialTextureUVMappings;
|
||||
MaterialTextureUVMappings matTexUvMappings;
|
||||
const uint32_t maxMat = static_cast<const uint32_t>(mesh->mat.size());
|
||||
const uint32_t maxMat = static_cast<uint32_t>(mesh->mat.size());
|
||||
for (uint32_t m = 0; m < maxMat; ++m) {
|
||||
// get material by index
|
||||
const std::shared_ptr<Material> pMat = mesh->mat[m];
|
||||
@@ -1337,4 +1287,55 @@ aiNode *BlenderImporter::ConvertNode(const Scene &in, const Object *obj, Convers
|
||||
return node.release();
|
||||
}
|
||||
|
||||
BlenderImporter::StreamOrError BlenderImporter::ParseMagicToken(const std::string &pFile, IOSystem *pIOHandler) const {
|
||||
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
|
||||
if (stream == nullptr) {
|
||||
return {{}, {}, "Could not open file for reading"};
|
||||
}
|
||||
|
||||
char magic[8] = { 0 };
|
||||
stream->Read(magic, 7, 1);
|
||||
if (strcmp(magic, Token) == 0) {
|
||||
return {stream, {}, {}};
|
||||
}
|
||||
|
||||
// Check for presence of the gzip header. If yes, assume it is a
|
||||
// compressed blend file and try uncompressing it, else fail. This is to
|
||||
// avoid uncompressing random files which our loader might end up with.
|
||||
#ifdef ASSIMP_BUILD_NO_COMPRESSED_BLEND
|
||||
return {{}, {}, "BLENDER magic bytes are missing, is this file compressed (Assimp was built without decompression support)?"};
|
||||
#else
|
||||
if (magic[0] != 0x1f || static_cast<uint8_t>(magic[1]) != 0x8b) {
|
||||
return {{}, {}, "BLENDER magic bytes are missing, couldn't find GZIP header either"};
|
||||
}
|
||||
|
||||
LogDebug("Found no BLENDER magic word but a GZIP header, might be a compressed file");
|
||||
if (magic[2] != 8) {
|
||||
return {{}, {}, "Unsupported GZIP compression method"};
|
||||
}
|
||||
|
||||
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
|
||||
stream->Seek(0L, aiOrigin_SET);
|
||||
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
||||
|
||||
size_t total = 0;
|
||||
Compression compression;
|
||||
auto uncompressed = std::make_shared<std::vector<char>>();
|
||||
if (compression.open(Compression::Format::Binary, Compression::FlushMode::NoFlush, 16 + Compression::MaxWBits)) {
|
||||
total = compression.decompress((unsigned char *)reader->GetPtr(), reader->GetRemainingSize(), *uncompressed);
|
||||
compression.close();
|
||||
}
|
||||
|
||||
// replace the input stream with a memory stream
|
||||
stream = std::make_shared<MemoryIOStream>(reinterpret_cast<uint8_t *>(uncompressed->data()), total);
|
||||
|
||||
// .. and retry
|
||||
stream->Read(magic, 7, 1);
|
||||
if (strcmp(magic, Token) == 0) {
|
||||
return {stream, uncompressed, {}};
|
||||
}
|
||||
return {{}, {}, "Found no BLENDER magic word in decompressed GZIP file"};
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -105,7 +105,7 @@ class BlenderModifier;
|
||||
* call it is outsourced to BlenderDNA.cpp/BlenderDNA.h. This class only performs the
|
||||
* conversion from intermediate format to aiScene. */
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderImporter : public BaseImporter, public LogFunctions<BlenderImporter> {
|
||||
class BlenderImporter final : public BaseImporter, public LogFunctions<BlenderImporter> {
|
||||
public:
|
||||
BlenderImporter();
|
||||
~BlenderImporter() override;
|
||||
@@ -117,7 +117,7 @@ protected:
|
||||
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
|
||||
void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr<IOStream> stream);
|
||||
void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file);
|
||||
void ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr<Blender::Collection> collection, Blender::ConversionData &conv_data);
|
||||
void ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr<Blender::Collection>& collection, Blender::ConversionData &conv_data);
|
||||
void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file);
|
||||
|
||||
private:
|
||||
@@ -180,6 +180,19 @@ private:
|
||||
const Blender::MTex *tex,
|
||||
Blender::ConversionData &conv_data);
|
||||
|
||||
// TODO: Move to a std::variant, once c++17 is supported.
|
||||
struct StreamOrError {
|
||||
std::shared_ptr<IOStream> stream;
|
||||
std::shared_ptr<std::vector<char>> input;
|
||||
std::string error;
|
||||
};
|
||||
|
||||
// Returns either a stream (and optional input data for the stream) or
|
||||
// an error if it can't parse the magic token.
|
||||
StreamOrError ParseMagicToken(
|
||||
const std::string &pFile,
|
||||
IOSystem *pIOHandler) const;
|
||||
|
||||
private: // static stuff, mostly logging and error reporting.
|
||||
// --------------------
|
||||
static void CheckActualType(const Blender::ElemBase *dt,
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -71,10 +70,6 @@ static const fpCreateModifier creators[] = {
|
||||
nullptr // sentinel
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct SharedModifierData : ElemBase {
|
||||
ModifierData modifier;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderModifierShowcase::ApplyModifiers(aiNode &out, ConversionData &conv_data, const Scene &in, const Object &orig_object) {
|
||||
@@ -157,6 +152,7 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
|
||||
// hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers()
|
||||
const MirrorModifierData &mir = static_cast<const MirrorModifierData &>(orig_modifier);
|
||||
ai_assert(mir.modifier.type == ModifierData::eModifierType_Mirror);
|
||||
std::shared_ptr<Object> mirror_ob = mir.mirror_ob.lock();
|
||||
|
||||
conv_data.meshes->reserve(conv_data.meshes->size() + out.mNumMeshes);
|
||||
|
||||
@@ -171,8 +167,8 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
|
||||
const float ys = mir.flag & MirrorModifierData::Flags_AXIS_Y ? -1.f : 1.f;
|
||||
const float zs = mir.flag & MirrorModifierData::Flags_AXIS_Z ? -1.f : 1.f;
|
||||
|
||||
if (mir.mirror_ob) {
|
||||
const aiVector3D center(mir.mirror_ob->obmat[3][0], mir.mirror_ob->obmat[3][1], mir.mirror_ob->obmat[3][2]);
|
||||
if (mirror_ob) {
|
||||
const aiVector3D center(mirror_ob->obmat[3][0], mirror_ob->obmat[3][1], mirror_ob->obmat[3][2]);
|
||||
for (unsigned int j = 0; j < mesh->mNumVertices; ++j) {
|
||||
aiVector3D &v = mesh->mVertices[j];
|
||||
|
||||
@@ -286,6 +282,11 @@ void BlenderModifier_Subdivision ::DoIt(aiNode &out, ConversionData &conv_data,
|
||||
if (conv_data.meshes->empty()) {
|
||||
return;
|
||||
}
|
||||
const size_t meshIndex = conv_data.meshes->size() - out.mNumMeshes;
|
||||
if (meshIndex >= conv_data.meshes->size()) {
|
||||
ASSIMP_LOG_ERROR("Invalid index detected.");
|
||||
return;
|
||||
}
|
||||
aiMesh **const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
|
||||
std::unique_ptr<aiMesh *[]> tempmeshes(new aiMesh *[out.mNumMeshes]());
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -62,9 +61,7 @@ public:
|
||||
/**
|
||||
* The class destructor, virtual.
|
||||
*/
|
||||
virtual ~BlenderModifier() {
|
||||
// empty
|
||||
}
|
||||
virtual ~BlenderModifier() = default;
|
||||
|
||||
// --------------------
|
||||
/**
|
||||
@@ -117,7 +114,7 @@ private:
|
||||
* Mirror modifier. Status: implemented.
|
||||
*/
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderModifier_Mirror : public BlenderModifier {
|
||||
class BlenderModifier_Mirror final : public BlenderModifier {
|
||||
public:
|
||||
// --------------------
|
||||
virtual bool IsActive( const ModifierData& modin);
|
||||
@@ -134,7 +131,7 @@ public:
|
||||
// -------------------------------------------------------------------------------------------
|
||||
/** Subdivision modifier. Status: dummy. */
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderModifier_Subdivision : public BlenderModifier {
|
||||
class BlenderModifier_Subdivision final : public BlenderModifier {
|
||||
public:
|
||||
|
||||
// --------------------
|
||||
|
||||
@@ -102,10 +102,6 @@ void Structure::Convert<CollectionObject>(
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Fail>(dest.next, "*next", db);
|
||||
{
|
||||
//std::shared_ptr<CollectionObject> prev;
|
||||
//ReadFieldPtr<ErrorPolicy_Fail>(prev, "*prev", db);
|
||||
//dest.prev = prev.get();
|
||||
|
||||
std::shared_ptr<Object> ob;
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(ob, "*ob", db);
|
||||
dest.ob = ob.get();
|
||||
@@ -301,7 +297,7 @@ void Structure ::Convert<Base>(
|
||||
const FileDatabase &db) const {
|
||||
// note: as per https://github.com/assimp/assimp/issues/128,
|
||||
// reading the Object linked list recursively is prone to stack overflow.
|
||||
// This structure converter is therefore an hand-written exception that
|
||||
// This structure converter is therefore a hand-written exception that
|
||||
// does it iteratively.
|
||||
|
||||
const int initial_pos = db.reader->GetCurrentPos();
|
||||
@@ -569,7 +565,7 @@ void Structure ::Convert<MVert>(
|
||||
const FileDatabase &db) const {
|
||||
|
||||
ReadFieldArray<ErrorPolicy_Fail>(dest.co, "co", db);
|
||||
ReadFieldArray<ErrorPolicy_Fail>(dest.no, "no", db);
|
||||
ReadFieldArray<ErrorPolicy_Warn>(dest.no, "no", db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
|
||||
//ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.bweight, "bweight", db);
|
||||
@@ -624,7 +620,9 @@ void Structure ::Convert<ListBase>(
|
||||
const FileDatabase &db) const {
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.last, "*last", db);
|
||||
std::shared_ptr<ElemBase> last;
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(last, "*last", db);
|
||||
dest.last = last;
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
@@ -648,7 +646,9 @@ void Structure ::Convert<ModifierData>(
|
||||
const FileDatabase &db) const {
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.next, "*next", db);
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.prev, "*prev", db);
|
||||
std::shared_ptr<ElemBase> prev;
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(prev, "*prev", db);
|
||||
dest.prev = prev;
|
||||
ReadField<ErrorPolicy_Igno>(dest.type, "type", db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mode, "mode", db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.name, "name", db);
|
||||
@@ -772,7 +772,9 @@ void Structure ::Convert<MirrorModifierData>(
|
||||
ReadField<ErrorPolicy_Igno>(dest.axis, "axis", db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.tolerance, "tolerance", db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.mirror_ob, "*mirror_ob", db);
|
||||
std::shared_ptr<Object> mirror_ob;
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(mirror_ob, "*mirror_ob", db);
|
||||
dest.mirror_ob = mirror_ob;
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
@@ -833,9 +835,9 @@ void Structure::Convert<CustomDataLayer>(
|
||||
ReadField<ErrorPolicy_Fail>(dest.flag, "flag", db);
|
||||
ReadField<ErrorPolicy_Fail>(dest.active, "active", db);
|
||||
ReadField<ErrorPolicy_Fail>(dest.active_rnd, "active_rnd", db);
|
||||
ReadField<ErrorPolicy_Fail>(dest.active_clone, "active_clone", db);
|
||||
ReadField<ErrorPolicy_Fail>(dest.active_mask, "active_mask", db);
|
||||
ReadField<ErrorPolicy_Fail>(dest.uid, "uid", db);
|
||||
ReadField<ErrorPolicy_Warn>(dest.active_clone, "active_clone", db);
|
||||
ReadField<ErrorPolicy_Warn>(dest.active_mask, "active_mask", db);
|
||||
ReadField<ErrorPolicy_Warn>(dest.uid, "uid", db);
|
||||
ReadFieldArray<ErrorPolicy_Warn>(dest.name, "name", db);
|
||||
ReadCustomDataPtr<ErrorPolicy_Fail>(dest.data, dest.type, "*data", db);
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -48,8 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "BlenderDNA.h"
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
namespace Assimp::Blender {
|
||||
|
||||
// Minor parts of this file are extracts from blender data structures,
|
||||
// declared in the ./source/blender/makesdna directory.
|
||||
@@ -116,32 +114,32 @@ struct Collection;
|
||||
static const size_t MaxNameLen = 1024;
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct ID : ElemBase {
|
||||
struct ID final : ElemBase {
|
||||
char name[MaxNameLen] WARN;
|
||||
short flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct ListBase : ElemBase {
|
||||
struct ListBase final : ElemBase {
|
||||
std::shared_ptr<ElemBase> first;
|
||||
std::shared_ptr<ElemBase> last;
|
||||
std::weak_ptr<ElemBase> last;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct PackedFile : ElemBase {
|
||||
struct PackedFile final : ElemBase {
|
||||
int size WARN;
|
||||
int seek WARN;
|
||||
std::shared_ptr<FileOffset> data WARN;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct GroupObject : ElemBase {
|
||||
struct GroupObject final : ElemBase {
|
||||
std::shared_ptr<GroupObject> prev, next FAIL;
|
||||
std::shared_ptr<Object> ob;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Group : ElemBase {
|
||||
struct Group final : ElemBase {
|
||||
ID id FAIL;
|
||||
int layer;
|
||||
|
||||
@@ -149,32 +147,32 @@ struct Group : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct CollectionObject : ElemBase {
|
||||
struct CollectionObject final : ElemBase {
|
||||
//CollectionObject* prev;
|
||||
std::shared_ptr<CollectionObject> next;
|
||||
Object *ob;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct CollectionChild : ElemBase {
|
||||
struct CollectionChild final : ElemBase {
|
||||
std::shared_ptr<CollectionChild> next, prev;
|
||||
std::shared_ptr<Collection> collection;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Collection : ElemBase {
|
||||
struct Collection final : ElemBase {
|
||||
ID id FAIL;
|
||||
ListBase gobject; // CollectionObject
|
||||
ListBase children; // CollectionChild
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct World : ElemBase {
|
||||
struct World final : ElemBase {
|
||||
ID id FAIL;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MVert : ElemBase {
|
||||
struct MVert final : ElemBase {
|
||||
float co[3] FAIL;
|
||||
float no[3] FAIL; // read as short and divided through / 32767.f
|
||||
char flag;
|
||||
@@ -182,35 +180,35 @@ struct MVert : ElemBase {
|
||||
int bweight;
|
||||
|
||||
MVert() :
|
||||
ElemBase(), flag(0), mat_nr(0), bweight(0) {}
|
||||
flag(0), mat_nr(0), bweight(0) {}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MEdge : ElemBase {
|
||||
struct MEdge final : ElemBase {
|
||||
int v1, v2 FAIL;
|
||||
char crease, bweight;
|
||||
short flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MLoop : ElemBase {
|
||||
struct MLoop final : ElemBase {
|
||||
int v, e;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MLoopUV : ElemBase {
|
||||
struct MLoopUV final : ElemBase {
|
||||
float uv[2];
|
||||
int flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Note that red and blue are not swapped, as with MCol
|
||||
struct MLoopCol : ElemBase {
|
||||
struct MLoopCol final : ElemBase {
|
||||
unsigned char r, g, b, a;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MPoly : ElemBase {
|
||||
struct MPoly final : ElemBase {
|
||||
int loopstart;
|
||||
int totloop;
|
||||
short mat_nr;
|
||||
@@ -218,26 +216,26 @@ struct MPoly : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MTexPoly : ElemBase {
|
||||
struct MTexPoly final : ElemBase {
|
||||
Image *tpage;
|
||||
char flag, transp;
|
||||
short mode, tile, pad;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MCol : ElemBase {
|
||||
struct MCol final : ElemBase {
|
||||
char r, g, b, a FAIL;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MFace : ElemBase {
|
||||
struct MFace final : ElemBase {
|
||||
int v1, v2, v3, v4 FAIL;
|
||||
int mat_nr FAIL;
|
||||
char flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct TFace : ElemBase {
|
||||
struct TFace final : ElemBase {
|
||||
float uv[4][2] FAIL;
|
||||
int col[4] FAIL;
|
||||
char flag;
|
||||
@@ -247,7 +245,7 @@ struct TFace : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MTFace : ElemBase {
|
||||
struct MTFace final : ElemBase {
|
||||
MTFace() :
|
||||
flag(0),
|
||||
mode(0),
|
||||
@@ -265,24 +263,24 @@ struct MTFace : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MDeformWeight : ElemBase {
|
||||
struct MDeformWeight final : ElemBase {
|
||||
int def_nr FAIL;
|
||||
float weight FAIL;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MDeformVert : ElemBase {
|
||||
struct MDeformVert final : ElemBase {
|
||||
vector<MDeformWeight> dw WARN;
|
||||
int totweight;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
#define MA_RAYMIRROR 0x40000
|
||||
#define MA_TRANSPARENCY 0x10000
|
||||
#define MA_RAYTRANSP 0x20000
|
||||
#define MA_ZTRANSP 0x00040
|
||||
constexpr uint32_t MA_RAYMIRROR = 0x40000;
|
||||
constexpr uint32_t MA_TRANSPARENCY = 0x10000;
|
||||
constexpr uint32_t MA_RAYTRANSP = 0x20000;
|
||||
constexpr uint32_t MA_ZTRANSP = 0x00040;
|
||||
|
||||
struct Material : ElemBase {
|
||||
struct Material final : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
float r, g, b WARN;
|
||||
@@ -404,7 +402,7 @@ CustomDataLayer 104
|
||||
char name 32 64
|
||||
void *data 96 8
|
||||
*/
|
||||
struct CustomDataLayer : ElemBase {
|
||||
struct CustomDataLayer final : ElemBase {
|
||||
int type;
|
||||
int offset;
|
||||
int flag;
|
||||
@@ -417,7 +415,6 @@ struct CustomDataLayer : ElemBase {
|
||||
std::shared_ptr<ElemBase> data; // must be converted to real type according type member
|
||||
|
||||
CustomDataLayer() :
|
||||
ElemBase(),
|
||||
type(0),
|
||||
offset(0),
|
||||
flag(0),
|
||||
@@ -443,7 +440,7 @@ CustomData 208
|
||||
BLI_mempool *pool 192 8
|
||||
CustomDataExternal *external 200 8
|
||||
*/
|
||||
struct CustomData : ElemBase {
|
||||
struct CustomData final : ElemBase {
|
||||
vector<std::shared_ptr<struct CustomDataLayer>> layers;
|
||||
int typemap[42]; // CD_NUMTYPES
|
||||
int totlayer;
|
||||
@@ -456,7 +453,7 @@ struct CustomData : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Mesh : ElemBase {
|
||||
struct Mesh final : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
int totface FAIL;
|
||||
@@ -493,7 +490,7 @@ struct Mesh : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Library : ElemBase {
|
||||
struct Library final : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
char name[240] WARN;
|
||||
@@ -517,7 +514,7 @@ struct Camera : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Lamp : ElemBase {
|
||||
struct Lamp final : ElemBase {
|
||||
|
||||
enum FalloffType {
|
||||
FalloffType_Constant = 0x0,
|
||||
@@ -604,7 +601,7 @@ struct Lamp : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct ModifierData : ElemBase {
|
||||
struct ModifierData final : ElemBase {
|
||||
enum ModifierType {
|
||||
eModifierType_None = 0,
|
||||
eModifierType_Subsurf,
|
||||
@@ -642,14 +639,20 @@ struct ModifierData : ElemBase {
|
||||
};
|
||||
|
||||
std::shared_ptr<ElemBase> next WARN;
|
||||
std::shared_ptr<ElemBase> prev WARN;
|
||||
std::weak_ptr<ElemBase> prev WARN;
|
||||
|
||||
int type, mode;
|
||||
char name[32];
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct SharedModifierData : ElemBase {
|
||||
ModifierData modifier;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct SubsurfModifierData : ElemBase {
|
||||
struct SubsurfModifierData final : SharedModifierData {
|
||||
|
||||
enum Type {
|
||||
|
||||
@@ -662,7 +665,6 @@ struct SubsurfModifierData : ElemBase {
|
||||
FLAGS_SubsurfUV = 1 << 3
|
||||
};
|
||||
|
||||
ModifierData modifier FAIL;
|
||||
short subdivType WARN;
|
||||
short levels FAIL;
|
||||
short renderLevels;
|
||||
@@ -670,7 +672,7 @@ struct SubsurfModifierData : ElemBase {
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MirrorModifierData : ElemBase {
|
||||
struct MirrorModifierData final : SharedModifierData {
|
||||
|
||||
enum Flags {
|
||||
Flags_CLIPPING = 1 << 0,
|
||||
@@ -682,15 +684,13 @@ struct MirrorModifierData : ElemBase {
|
||||
Flags_VGROUP = 1 << 6
|
||||
};
|
||||
|
||||
ModifierData modifier FAIL;
|
||||
|
||||
short axis, flag;
|
||||
float tolerance;
|
||||
std::shared_ptr<Object> mirror_ob;
|
||||
std::weak_ptr<Object> mirror_ob;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Object : ElemBase {
|
||||
struct Object final : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
enum Type {
|
||||
@@ -725,26 +725,25 @@ struct Object : ElemBase {
|
||||
ListBase modifiers;
|
||||
|
||||
Object() :
|
||||
ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() {
|
||||
type(Type_EMPTY), parent(nullptr) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Base : ElemBase {
|
||||
struct Base final : ElemBase {
|
||||
Base *prev WARN;
|
||||
std::shared_ptr<Base> next WARN;
|
||||
std::shared_ptr<Object> object WARN;
|
||||
|
||||
Base() :
|
||||
ElemBase(), prev(nullptr), next(), object() {
|
||||
// empty
|
||||
prev(nullptr) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Scene : ElemBase {
|
||||
struct Scene final : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
std::shared_ptr<Object> camera WARN;
|
||||
@@ -754,14 +753,11 @@ struct Scene : ElemBase {
|
||||
|
||||
ListBase base;
|
||||
|
||||
Scene() :
|
||||
ElemBase(), camera(), world(), basact(), master_collection() {
|
||||
// empty
|
||||
}
|
||||
Scene() = default;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Image : ElemBase {
|
||||
struct Image final : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
char name[240] WARN;
|
||||
@@ -787,14 +783,11 @@ struct Image : ElemBase {
|
||||
|
||||
short gen_x, gen_y, gen_type;
|
||||
|
||||
Image() :
|
||||
ElemBase() {
|
||||
// empty
|
||||
}
|
||||
Image() = default;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Tex : ElemBase {
|
||||
struct Tex final : ElemBase {
|
||||
|
||||
// actually, the only texture type we support is Type_IMAGE
|
||||
enum Type {
|
||||
@@ -879,14 +872,13 @@ struct Tex : ElemBase {
|
||||
|
||||
//char use_nodes;
|
||||
|
||||
Tex() :
|
||||
ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() {
|
||||
Tex() : imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MTex : ElemBase {
|
||||
struct MTex final : ElemBase {
|
||||
|
||||
enum Projection {
|
||||
Proj_N = 0,
|
||||
@@ -972,12 +964,9 @@ struct MTex : ElemBase {
|
||||
//float shadowfac;
|
||||
//float zenupfac, zendownfac, blendfac;
|
||||
|
||||
MTex() :
|
||||
ElemBase() {
|
||||
// empty
|
||||
}
|
||||
MTex() = default;
|
||||
};
|
||||
|
||||
} // namespace Blender
|
||||
} // namespace Assimp
|
||||
} // namespace Assimp::Blender
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "BlenderDNA.h"
|
||||
#include "BlenderScene.h"
|
||||
|
||||
namespace Assimp {
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
template <> void Structure :: Convert<Object> (
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -40,10 +39,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderTessellator.cpp
|
||||
* @brief A simple tessellation wrapper
|
||||
*/
|
||||
|
||||
/// @file BlenderTessellator.cpp
|
||||
/// @brief A simple tessellation wrapper
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
|
||||
@@ -62,8 +59,7 @@ namspace Assimp
|
||||
{
|
||||
template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_TESS_GL: ";
|
||||
return prefix;
|
||||
return "BLEND_TESS_GL: ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +77,7 @@ BlenderTessellatorGL::BlenderTessellatorGL( BlenderBMeshConverter& converter ):
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BlenderTessellatorGL::~BlenderTessellatorGL( )
|
||||
{
|
||||
}
|
||||
BlenderTessellatorGL::~BlenderTessellatorGL() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )
|
||||
@@ -259,8 +253,7 @@ namespace Assimp
|
||||
{
|
||||
template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_TESS_P2T: ";
|
||||
return prefix;
|
||||
return "BLEND_TESS_P2T: ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,9 +267,7 @@ BlenderTessellatorP2T::BlenderTessellatorP2T( BlenderBMeshConverter& converter )
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
BlenderTessellatorP2T::~BlenderTessellatorP2T( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderTessellatorP2T::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )
|
||||
@@ -390,7 +381,14 @@ inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& poi
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Winvalid-offsetof"
|
||||
#endif // __clang__
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||
#endif // __GNUC__
|
||||
unsigned int pointOffset = offsetof( PointP2T, point2D );
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
#if defined __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -144,11 +143,7 @@ namespace Assimp
|
||||
|
||||
#if ASSIMP_BLEND_WITH_POLY_2_TRI
|
||||
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <poly2tri/poly2tri.h>
|
||||
#else
|
||||
# include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
#endif
|
||||
#include "contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
@@ -186,7 +181,7 @@ namespace Assimp
|
||||
{
|
||||
public:
|
||||
BlenderTessellatorP2T( BlenderBMeshConverter& converter );
|
||||
~BlenderTessellatorP2T( );
|
||||
~BlenderTessellatorP2T( ) = default;
|
||||
|
||||
void Tessellate( const Blender::MLoop* polyLoop, int vertexCount, const std::vector< Blender::MVert >& vertices );
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -46,10 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// no #ifdefing here, Cinema4D support is carried out in a branch of assimp
|
||||
// where it is turned on in the CMake settings.
|
||||
|
||||
#ifndef _MSC_VER
|
||||
# error C4D support is currently MSVC only
|
||||
#endif
|
||||
|
||||
#include "C4DImporter.h"
|
||||
#include <memory>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
@@ -68,7 +64,7 @@ namespace {
|
||||
|
||||
aiString aiStringFrom(cineware::String const & cinestring) {
|
||||
aiString result;
|
||||
cinestring.GetCString(result.data, MAXLEN-1);
|
||||
cinestring.GetCString(result.data, AI_MAXLEN - 1);
|
||||
result.length = static_cast<ai_uint32>(cinestring.GetLength());
|
||||
return result;
|
||||
}
|
||||
@@ -86,12 +82,11 @@ void GetWriterInfo(int &id, String &appname) {
|
||||
|
||||
namespace Assimp {
|
||||
template<> const char* LogFunctions<C4DImporter>::Prefix() {
|
||||
static auto prefix = "C4D: ";
|
||||
return prefix;
|
||||
return "C4D: ";
|
||||
}
|
||||
}
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"Cinema4D Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -104,27 +99,15 @@ static const aiImporterDesc desc = {
|
||||
"c4d"
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
C4DImporter::C4DImporter()
|
||||
: BaseImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
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) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -206,7 +189,6 @@ void C4DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
||||
std::copy(materials.begin(), materials.end(), pScene->mMaterials);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool C4DImporter::ReadShader(aiMaterial* out, BaseShader* shader) {
|
||||
// based on Cineware sample code (C4DImportExport.cpp)
|
||||
@@ -311,7 +293,7 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent) {
|
||||
|
||||
// based on Cineware sample code
|
||||
while (object) {
|
||||
const LONG type = object->GetType();
|
||||
const Int32 type = object->GetType();
|
||||
const Matrix& ml = object->GetMl();
|
||||
|
||||
aiNode* const nd = new aiNode();
|
||||
@@ -374,8 +356,8 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
|
||||
PolygonObject* const polyObject = dynamic_cast<PolygonObject*>(object);
|
||||
ai_assert(polyObject != nullptr);
|
||||
|
||||
const LONG pointCount = polyObject->GetPointCount();
|
||||
const LONG polyCount = polyObject->GetPolygonCount();
|
||||
const Int32 pointCount = polyObject->GetPointCount();
|
||||
const Int32 polyCount = polyObject->GetPolygonCount();
|
||||
if(!polyObject || !pointCount) {
|
||||
LogWarn("ignoring mesh with zero vertices or faces");
|
||||
return nullptr;
|
||||
@@ -397,7 +379,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
|
||||
unsigned int vcount = 0;
|
||||
|
||||
// first count vertices
|
||||
for (LONG i = 0; i < polyCount; i++)
|
||||
for (Int32 i = 0; i < polyCount; i++)
|
||||
{
|
||||
vcount += 3;
|
||||
|
||||
@@ -440,7 +422,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
|
||||
}
|
||||
|
||||
// copy vertices and extra channels over and populate faces
|
||||
for (LONG i = 0; i < polyCount; ++i, ++face) {
|
||||
for (Int32 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;
|
||||
@@ -517,7 +499,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
|
||||
if (tangents_src) {
|
||||
|
||||
for(unsigned int k = 0; k < face->mNumIndices; ++k) {
|
||||
LONG l;
|
||||
Int32 l;
|
||||
switch(k) {
|
||||
case 0:
|
||||
l = polys[i].a;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace cineware {
|
||||
class BaseShader;
|
||||
}
|
||||
|
||||
namespace Assimp {
|
||||
namespace Assimp {
|
||||
// TinyFormatter.h
|
||||
namespace Formatter {
|
||||
template <typename T,typename TR, typename A> class basic_formatter;
|
||||
@@ -78,6 +78,8 @@ namespace Assimp {
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class C4DImporter : public BaseImporter, public LogFunctions<C4DImporter> {
|
||||
public:
|
||||
C4DImporter() = default;
|
||||
~C4DImporter() override = default;
|
||||
bool CanRead( const std::string& pFile, IOSystem*, bool checkSig) const override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_COB_IMPORTER
|
||||
|
||||
#include "AssetLib/COB/COBLoader.h"
|
||||
#include "AssetLib/COB/COBScene.h"
|
||||
#include "COBLoader.h"
|
||||
#include "COBScene.h"
|
||||
#include "PostProcessing/ConvertToLHProcess.h"
|
||||
|
||||
#include <assimp/LineSplitter.h>
|
||||
@@ -61,11 +61,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
using namespace Assimp::COB;
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
static const float units[] = {
|
||||
static constexpr float units[] = {
|
||||
1000.f,
|
||||
100.f,
|
||||
1.f,
|
||||
@@ -76,7 +77,7 @@ static const float units[] = {
|
||||
1.f / 1609.344f
|
||||
};
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"TrueSpace Object Importer",
|
||||
"",
|
||||
"",
|
||||
@@ -89,18 +90,6 @@ static const aiImporterDesc desc = {
|
||||
"cob scn"
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
COBImporter::COBImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
COBImporter::~COBImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool COBImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
@@ -121,10 +110,29 @@ void COBImporter::SetupProperties(const Importer * /*pImp*/) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ AI_WONT_RETURN void COBImporter::ThrowException(const std::string &msg) {
|
||||
AI_WONT_RETURN void COBImporter::ThrowException(const std::string &msg) {
|
||||
throw DeadlyImportError("COB: ", msg);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static bool isValidASCIIHeader(const char *head) {
|
||||
ai_assert(head != nullptr);
|
||||
|
||||
if (strncmp(head, "Caligari ", 9) != 0) {
|
||||
COBImporter::ThrowException("Could not found magic id: `Caligari`");
|
||||
}
|
||||
|
||||
if (strncmp(&head[9], "V00.", 4) != 0) {
|
||||
COBImporter::ThrowException("Could not found Version tag: `V00.`");
|
||||
}
|
||||
ASSIMP_LOG_INFO("File format tag: ", std::string(head + 9, 6));
|
||||
if (head[16] != 'L') {
|
||||
COBImporter::ThrowException("File is big-endian, which is not supported");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
@@ -138,19 +146,15 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
std::unique_ptr<StreamReaderLE> stream(new StreamReaderLE(file));
|
||||
|
||||
// check header
|
||||
char head[32];
|
||||
stream->CopyAndAdvance(head, 32);
|
||||
if (strncmp(head, "Caligari ", 9) != 0) {
|
||||
ThrowException("Could not found magic id: `Caligari`");
|
||||
}
|
||||
|
||||
ASSIMP_LOG_INFO("File format tag: ", std::string(head + 9, 6));
|
||||
if (head[16] != 'L') {
|
||||
ThrowException("File is big-endian, which is not supported");
|
||||
}
|
||||
static constexpr size_t HeaderSize = 32u;
|
||||
char head[HeaderSize] = {};
|
||||
stream->CopyAndAdvance(head, HeaderSize);
|
||||
|
||||
// load data into intermediate structures
|
||||
if (head[15] == 'A') {
|
||||
if (!isValidASCIIHeader(head)) {
|
||||
ThrowException("Invalid ASCII file header");
|
||||
}
|
||||
ReadAsciiFile(scene, stream.get());
|
||||
} else {
|
||||
ReadBinaryFile(scene, stream.get());
|
||||
@@ -162,7 +166,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
// sort faces by material indices
|
||||
for (std::shared_ptr<Node> &n : scene.nodes) {
|
||||
if (n->type == Node::TYPE_MESH) {
|
||||
Mesh &mesh = (Mesh &)(*n.get());
|
||||
Mesh &mesh = (Mesh &)(*n);
|
||||
for (Face &f : mesh.faces) {
|
||||
mesh.temp_map[f.material].push_back(&f);
|
||||
}
|
||||
@@ -172,7 +176,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
// count meshes
|
||||
for (std::shared_ptr<Node> &n : scene.nodes) {
|
||||
if (n->type == Node::TYPE_MESH) {
|
||||
Mesh &mesh = (Mesh &)(*n.get());
|
||||
Mesh &mesh = (Mesh &)(*n);
|
||||
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
|
||||
pScene->mNumMeshes += static_cast<unsigned int>(mesh.temp_map.size());
|
||||
}
|
||||
@@ -215,7 +219,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
}
|
||||
}
|
||||
|
||||
pScene->mRootNode = BuildNodes(*root.get(), scene, pScene);
|
||||
pScene->mRootNode = BuildNodes(*root, scene, pScene);
|
||||
//flip normals after import
|
||||
FlipWindingOrderProcess flip;
|
||||
flip.Execute(pScene);
|
||||
@@ -240,7 +244,7 @@ aiNode *COBImporter::BuildNodes(const Node &root, const Scene &scin, aiScene *fi
|
||||
const Mesh &ndmesh = (const Mesh &)(root);
|
||||
if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) {
|
||||
|
||||
typedef std::pair<const unsigned int, Mesh::FaceRefList> Entry;
|
||||
using Entry = std::pair<const unsigned int, Mesh::FaceRefList>;
|
||||
for (const Entry &reflist : ndmesh.temp_map) {
|
||||
{ // create mesh
|
||||
size_t n = 0;
|
||||
@@ -384,9 +388,11 @@ aiNode *COBImporter::BuildNodes(const Node &root, const Scene &scin, aiScene *fi
|
||||
}
|
||||
|
||||
// add children recursively
|
||||
nd->mChildren = new aiNode *[root.temp_children.size()]();
|
||||
for (const Node *n : root.temp_children) {
|
||||
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n, scin, fill))->mParent = nd;
|
||||
if (!root.temp_children.empty()) {
|
||||
nd->mChildren = new aiNode *[root.temp_children.size()]();
|
||||
for (const Node *n : root.temp_children) {
|
||||
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n, scin, fill))->mParent = nd;
|
||||
}
|
||||
}
|
||||
|
||||
return nd;
|
||||
@@ -485,8 +491,9 @@ void COBImporter::ReadBasicNodeInfo_Ascii(Node &msh, LineSplitter &splitter, con
|
||||
} else if (splitter.match_start("Transform")) {
|
||||
for (unsigned int y = 0; y < 4 && ++splitter; ++y) {
|
||||
const char *s = splitter->c_str();
|
||||
const char *end = s + splitter->size();
|
||||
for (unsigned int x = 0; x < 4; ++x) {
|
||||
SkipSpaces(&s);
|
||||
SkipSpaces(&s, end);
|
||||
msh.transform[y][x] = fast_atof(&s);
|
||||
}
|
||||
}
|
||||
@@ -498,12 +505,12 @@ void COBImporter::ReadBasicNodeInfo_Ascii(Node &msh, LineSplitter &splitter, con
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void COBImporter::ReadFloat3Tuple_Ascii(T &fill, const char **in) {
|
||||
void COBImporter::ReadFloat3Tuple_Ascii(T &fill, const char **in, const char *end) {
|
||||
const char *rgb = *in;
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
SkipSpaces(&rgb);
|
||||
SkipSpaces(&rgb, end);
|
||||
if (*rgb == ',') ++rgb;
|
||||
SkipSpaces(&rgb);
|
||||
SkipSpaces(&rgb, end);
|
||||
|
||||
fill[i] = fast_atof(&rgb);
|
||||
}
|
||||
@@ -522,7 +529,7 @@ void COBImporter::ReadMat1_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
return;
|
||||
}
|
||||
|
||||
out.materials.push_back(Material());
|
||||
out.materials.emplace_back();
|
||||
Material &mat = out.materials.back();
|
||||
mat = nfo;
|
||||
|
||||
@@ -550,7 +557,7 @@ void COBImporter::ReadMat1_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
}
|
||||
|
||||
const char *rgb = splitter[1];
|
||||
ReadFloat3Tuple_Ascii(mat.rgb, &rgb);
|
||||
ReadFloat3Tuple_Ascii(mat.rgb, &rgb, splitter.getEnd());
|
||||
|
||||
++splitter;
|
||||
if (!splitter.match_start("alpha ")) {
|
||||
@@ -629,20 +636,21 @@ void COBImporter::ReadLght_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
}
|
||||
|
||||
const char *rgb = splitter[1];
|
||||
ReadFloat3Tuple_Ascii(msh.color, &rgb);
|
||||
const char *end = splitter.getEnd();
|
||||
ReadFloat3Tuple_Ascii(msh.color, &rgb, end);
|
||||
|
||||
SkipSpaces(&rgb);
|
||||
SkipSpaces(&rgb, end);
|
||||
if (strncmp(rgb, "cone angle", 10) != 0) {
|
||||
ASSIMP_LOG_WARN("Expected `cone angle` entity in `color` line in `Lght` chunk ", nfo.id);
|
||||
}
|
||||
SkipSpaces(rgb + 10, &rgb);
|
||||
SkipSpaces(rgb + 10, &rgb, end);
|
||||
msh.angle = fast_atof(&rgb);
|
||||
|
||||
SkipSpaces(&rgb);
|
||||
SkipSpaces(&rgb, end);
|
||||
if (strncmp(rgb, "inner angle", 11) != 0) {
|
||||
ASSIMP_LOG_WARN("Expected `inner angle` entity in `color` line in `Lght` chunk ", nfo.id);
|
||||
}
|
||||
SkipSpaces(rgb + 11, &rgb);
|
||||
SkipSpaces(rgb + 11, &rgb, end);
|
||||
msh.inner_angle = fast_atof(&rgb);
|
||||
|
||||
// skip the rest for we can't handle this kind of physically-based lighting information.
|
||||
@@ -715,14 +723,14 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
|
||||
for (unsigned int cur = 0; cur < cnt && ++splitter; ++cur) {
|
||||
const char *s = splitter->c_str();
|
||||
|
||||
const char *end = splitter.getEnd();
|
||||
aiVector3D &v = msh.vertex_positions[cur];
|
||||
|
||||
SkipSpaces(&s);
|
||||
SkipSpaces(&s, end);
|
||||
v.x = fast_atof(&s);
|
||||
SkipSpaces(&s);
|
||||
SkipSpaces(&s, end);
|
||||
v.y = fast_atof(&s);
|
||||
SkipSpaces(&s);
|
||||
SkipSpaces(&s, end);
|
||||
v.z = fast_atof(&s);
|
||||
}
|
||||
} else if (splitter.match_start("Texture Vertices")) {
|
||||
@@ -731,12 +739,13 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
|
||||
for (unsigned int cur = 0; cur < cnt && ++splitter; ++cur) {
|
||||
const char *s = splitter->c_str();
|
||||
const char *end = splitter.getEnd();
|
||||
|
||||
aiVector2D &v = msh.texture_coords[cur];
|
||||
|
||||
SkipSpaces(&s);
|
||||
SkipSpaces(&s, end);
|
||||
v.x = fast_atof(&s);
|
||||
SkipSpaces(&s);
|
||||
SkipSpaces(&s, end);
|
||||
v.y = fast_atof(&s);
|
||||
}
|
||||
} else if (splitter.match_start("Faces")) {
|
||||
@@ -753,7 +762,7 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
ThrowException("Expected Face line");
|
||||
}
|
||||
|
||||
msh.faces.push_back(Face());
|
||||
msh.faces.emplace_back();
|
||||
Face &face = msh.faces.back();
|
||||
|
||||
face.indices.resize(strtoul10(splitter[2]));
|
||||
@@ -761,8 +770,9 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
|
||||
face.material = strtoul10(splitter[6]);
|
||||
|
||||
const char *s = (++splitter)->c_str();
|
||||
const char *end = splitter.getEnd();
|
||||
for (size_t i = 0; i < face.indices.size(); ++i) {
|
||||
if (!SkipSpaces(&s)) {
|
||||
if (!SkipSpaces(&s, end)) {
|
||||
ThrowException("Expected EOL token in Face entry");
|
||||
}
|
||||
if ('<' != *s++) {
|
||||
@@ -872,7 +882,7 @@ void COBImporter::ReadBinaryFile(Scene &out, StreamReaderLE *reader) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
std::string type;
|
||||
type += reader->GetI1();
|
||||
type += reader->GetI1();
|
||||
@@ -956,7 +966,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id);
|
||||
}
|
||||
} else
|
||||
msh.faces.push_back(Face());
|
||||
msh.faces.emplace_back();
|
||||
Face &f = msh.faces.back();
|
||||
|
||||
const size_t num = reader.GetI2();
|
||||
@@ -968,7 +978,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
}
|
||||
|
||||
for (size_t x = 0; x < num; ++x) {
|
||||
f.indices.push_back(VertexIndex());
|
||||
f.indices.emplace_back();
|
||||
|
||||
VertexIndex &v = f.indices.back();
|
||||
v.pos_idx = reader.GetI4();
|
||||
@@ -1008,7 +1018,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
|
||||
const chunk_guard cn(nfo, reader);
|
||||
|
||||
out.materials.push_back(Material());
|
||||
out.materials.emplace_back();
|
||||
Material &mat = out.materials.back();
|
||||
mat = nfo;
|
||||
|
||||
@@ -1058,7 +1068,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
id[0] = reader.GetI1(), id[1] = reader.GetI1();
|
||||
|
||||
if (id[0] == 'e' && id[1] == ':') {
|
||||
mat.tex_env.reset(new Texture());
|
||||
mat.tex_env = std::make_shared<Texture>();
|
||||
|
||||
reader.GetI1();
|
||||
ReadString_Binary(mat.tex_env->path, reader);
|
||||
@@ -1068,7 +1078,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
}
|
||||
|
||||
if (id[0] == 't' && id[1] == ':') {
|
||||
mat.tex_color.reset(new Texture());
|
||||
mat.tex_color = std::make_shared<Texture>();
|
||||
|
||||
reader.GetI1();
|
||||
ReadString_Binary(mat.tex_color->path, reader);
|
||||
@@ -1084,7 +1094,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
}
|
||||
|
||||
if (id[0] == 'b' && id[1] == ':') {
|
||||
mat.tex_bump.reset(new Texture());
|
||||
mat.tex_bump = std::make_shared<Texture>();
|
||||
|
||||
reader.GetI1();
|
||||
ReadString_Binary(mat.tex_bump->path, reader);
|
||||
@@ -1176,4 +1186,6 @@ void COBImporter::ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const
|
||||
ASSIMP_LOG_WARN("`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_COB_IMPORTER
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -56,16 +55,16 @@ class LineSplitter;
|
||||
|
||||
// TinyFormatter.h
|
||||
namespace Formatter {
|
||||
template <typename T, typename TR, typename A>
|
||||
class basic_formatter;
|
||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||
template <typename T, typename TR, typename A>
|
||||
class basic_formatter;
|
||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||
} // namespace Formatter
|
||||
|
||||
// COBScene.h
|
||||
namespace COB {
|
||||
struct ChunkInfo;
|
||||
struct Node;
|
||||
struct Scene;
|
||||
struct ChunkInfo;
|
||||
struct Node;
|
||||
struct Scene;
|
||||
} // namespace COB
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
@@ -73,15 +72,19 @@ struct Scene;
|
||||
*
|
||||
* Currently relatively limited, loads only ASCII files and needs more test coverage. */
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class COBImporter : public BaseImporter {
|
||||
class COBImporter final : public BaseImporter {
|
||||
public:
|
||||
COBImporter();
|
||||
~COBImporter() override;
|
||||
COBImporter() = default;
|
||||
~COBImporter() override = default;
|
||||
|
||||
// --------------------
|
||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||
bool checkSig) const override;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Prepend 'COB: ' and throw msg.*/
|
||||
AI_WONT_RETURN static void ThrowException(const std::string &msg) AI_WONT_RETURN_SUFFIX;
|
||||
|
||||
protected:
|
||||
// --------------------
|
||||
const aiImporterDesc *GetInfo() const override;
|
||||
@@ -94,10 +97,6 @@ protected:
|
||||
IOSystem *pIOHandler) override;
|
||||
|
||||
private:
|
||||
// -------------------------------------------------------------------
|
||||
/** Prepend 'COB: ' and throw msg.*/
|
||||
AI_WONT_RETURN static void ThrowException(const std::string &msg) AI_WONT_RETURN_SUFFIX;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Read from an ascii scene/object file
|
||||
* @param out Receives output data.
|
||||
@@ -120,7 +119,7 @@ private:
|
||||
void ReadChunkInfo_Ascii(COB::ChunkInfo &out, const LineSplitter &splitter);
|
||||
void ReadBasicNodeInfo_Ascii(COB::Node &msh, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||
template <typename T>
|
||||
void ReadFloat3Tuple_Ascii(T &fill, const char **in);
|
||||
void ReadFloat3Tuple_Ascii(T &fill, const char **in, const char *end);
|
||||
|
||||
void ReadPolH_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||
void ReadBitM_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
|
||||
@@ -149,4 +148,5 @@ private:
|
||||
}; // !class COBImporter
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
||||
#endif // AI_UNREALIMPORTER_H_INC
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -52,68 +52,66 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
namespace Assimp {
|
||||
namespace COB {
|
||||
namespace Assimp::COB {
|
||||
|
||||
// ------------------
|
||||
/** Represents a single vertex index in a face */
|
||||
struct VertexIndex
|
||||
{
|
||||
struct VertexIndex {
|
||||
// intentionally uninitialized
|
||||
unsigned int pos_idx,uv_idx;
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB Face data structure */
|
||||
struct Face
|
||||
{
|
||||
struct Face {
|
||||
// intentionally uninitialized
|
||||
unsigned int material, flags;
|
||||
unsigned int material;
|
||||
unsigned int flags;
|
||||
std::vector<VertexIndex> indices;
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB chunk header information */
|
||||
const unsigned int NO_SIZE = UINT_MAX;
|
||||
constexpr unsigned int NO_SIZE = UINT_MAX;
|
||||
|
||||
struct ChunkInfo
|
||||
{
|
||||
ChunkInfo ()
|
||||
: id (0)
|
||||
, parent_id (0)
|
||||
, version (0)
|
||||
, size (NO_SIZE)
|
||||
{}
|
||||
struct ChunkInfo {
|
||||
ChunkInfo() = default;
|
||||
virtual ~ChunkInfo() = default;
|
||||
|
||||
// Id of this chunk, unique within file
|
||||
unsigned int id;
|
||||
unsigned int id{ 0 };
|
||||
|
||||
// and the corresponding parent
|
||||
unsigned int parent_id;
|
||||
unsigned int parent_id{ 0 };
|
||||
|
||||
// version. v1.23 becomes 123
|
||||
unsigned int version;
|
||||
unsigned int version{ 0 };
|
||||
|
||||
// chunk size in bytes, only relevant for binary files
|
||||
// NO_SIZE is also valid.
|
||||
unsigned int size;
|
||||
unsigned int size{NO_SIZE};
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** A node in the scenegraph */
|
||||
struct Node : public ChunkInfo
|
||||
{
|
||||
struct Node : ChunkInfo {
|
||||
enum Type {
|
||||
TYPE_MESH,TYPE_GROUP,TYPE_LIGHT,TYPE_CAMERA,TYPE_BONE
|
||||
TYPE_INVALID = -1,
|
||||
TYPE_MESH = 0,
|
||||
TYPE_GROUP,
|
||||
TYPE_LIGHT,
|
||||
TYPE_CAMERA,
|
||||
TYPE_BONE,
|
||||
TYPE_COUNT
|
||||
};
|
||||
|
||||
virtual ~Node() {}
|
||||
Node(Type type) : type(type), unit_scale(1.f){}
|
||||
~Node() override = default;
|
||||
explicit Node(Type type) : type(type), unit_scale(1.f){}
|
||||
|
||||
Type type;
|
||||
|
||||
// used during resolving
|
||||
typedef std::deque<const Node*> ChildList;
|
||||
using ChildList = std::deque<const Node*> ;
|
||||
mutable ChildList temp_children;
|
||||
|
||||
// unique name
|
||||
@@ -128,8 +126,7 @@ struct Node : public ChunkInfo
|
||||
|
||||
// ------------------
|
||||
/** COB Mesh data structure */
|
||||
struct Mesh : public Node
|
||||
{
|
||||
struct Mesh final : Node {
|
||||
using ChunkInfo::operator=;
|
||||
enum DrawFlags {
|
||||
SOLID = 0x1,
|
||||
@@ -162,107 +159,118 @@ struct Mesh : public Node
|
||||
|
||||
// ------------------
|
||||
/** COB Group data structure */
|
||||
struct Group : public Node
|
||||
{
|
||||
struct Group final : Node {
|
||||
using ChunkInfo::operator=;
|
||||
Group() : Node(TYPE_GROUP) {}
|
||||
|
||||
Group() : Node(TYPE_GROUP) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB Bone data structure */
|
||||
struct Bone : public Node
|
||||
{
|
||||
struct Bone final : Node {
|
||||
using ChunkInfo::operator=;
|
||||
Bone() : Node(TYPE_BONE) {}
|
||||
|
||||
Bone() : Node(TYPE_BONE) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB Light data structure */
|
||||
struct Light : public Node
|
||||
{
|
||||
struct Light final : Node {
|
||||
enum LightType {
|
||||
SPOT,LOCAL,INFINITE
|
||||
SPOT,
|
||||
LOCAL,
|
||||
INFINITE
|
||||
};
|
||||
|
||||
using ChunkInfo::operator=;
|
||||
Light() : Node(TYPE_LIGHT),angle(),inner_angle(),ltype(SPOT) {}
|
||||
|
||||
Light() : Node(TYPE_LIGHT), ltype() {
|
||||
// empty
|
||||
}
|
||||
|
||||
aiColor3D color;
|
||||
float angle,inner_angle;
|
||||
float angle{ 0.0f };
|
||||
float inner_angle{ 0.0f };
|
||||
|
||||
LightType ltype;
|
||||
LightType ltype{SPOT};
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB Camera data structure */
|
||||
struct Camera : public Node
|
||||
{
|
||||
struct Camera final : Node {
|
||||
using ChunkInfo::operator=;
|
||||
Camera() : Node(TYPE_CAMERA) {}
|
||||
|
||||
Camera() : Node(TYPE_CAMERA) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB Texture data structure */
|
||||
struct Texture
|
||||
{
|
||||
struct Texture {
|
||||
std::string path;
|
||||
aiUVTransform transform;
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** COB Material data structure */
|
||||
struct Material : ChunkInfo
|
||||
{
|
||||
struct Material : ChunkInfo {
|
||||
using ChunkInfo::operator=;
|
||||
|
||||
enum Shader {
|
||||
FLAT,PHONG,METAL
|
||||
FLAT,
|
||||
PHONG,
|
||||
METAL
|
||||
};
|
||||
|
||||
enum AutoFacet {
|
||||
FACETED,AUTOFACETED,SMOOTH
|
||||
FACETED,
|
||||
AUTOFACETED,
|
||||
SMOOTH
|
||||
};
|
||||
|
||||
Material() : alpha(),exp(),ior(),ka(),ks(1.f),
|
||||
matnum(UINT_MAX),
|
||||
shader(FLAT),autofacet(FACETED),
|
||||
autofacet_angle()
|
||||
{}
|
||||
Material() : shader(FLAT) {
|
||||
// empty
|
||||
}
|
||||
|
||||
std::string type;
|
||||
|
||||
aiColor3D rgb;
|
||||
float alpha, exp, ior,ka,ks;
|
||||
|
||||
unsigned int matnum;
|
||||
float alpha{ 0.0f };
|
||||
float exp{ 0.0f };
|
||||
float ior{ 0.0f };
|
||||
float ka{ 0.0f };
|
||||
float ks{ 1.0f };
|
||||
unsigned int matnum{ UINT_MAX };
|
||||
Shader shader;
|
||||
|
||||
AutoFacet autofacet;
|
||||
float autofacet_angle;
|
||||
|
||||
AutoFacet autofacet{FACETED};
|
||||
float autofacet_angle{ 0.0f };
|
||||
std::shared_ptr<Texture> tex_env,tex_bump,tex_color;
|
||||
};
|
||||
|
||||
// ------------------
|
||||
/** Embedded bitmap, for instance for the thumbnail image */
|
||||
struct Bitmap : ChunkInfo
|
||||
{
|
||||
Bitmap() : orig_size() {}
|
||||
struct BitmapHeader
|
||||
{
|
||||
struct Bitmap : ChunkInfo {
|
||||
Bitmap() = default;
|
||||
|
||||
struct BitmapHeader {
|
||||
// empty
|
||||
};
|
||||
|
||||
BitmapHeader head;
|
||||
size_t orig_size;
|
||||
size_t orig_size{ 0u };
|
||||
std::vector<char> buff_zipped;
|
||||
};
|
||||
|
||||
typedef std::deque< std::shared_ptr<Node> > NodeList;
|
||||
typedef std::vector< Material > MaterialList;
|
||||
using NodeList = std::deque< std::shared_ptr<Node>>;
|
||||
using MaterialList = std::vector< Material >;
|
||||
|
||||
// ------------------
|
||||
/** Represents a master COB scene, even if we loaded just a single COB file */
|
||||
struct Scene
|
||||
{
|
||||
struct Scene {
|
||||
NodeList nodes;
|
||||
MaterialList materials;
|
||||
|
||||
@@ -270,7 +278,6 @@ struct Scene
|
||||
Bitmap thumbnail;
|
||||
};
|
||||
|
||||
} // end COB
|
||||
} // end Assimp
|
||||
} // end Assimp::COB
|
||||
|
||||
#endif
|
||||
#endif // INCLUDED_AI_COB_SCENE_H
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -44,9 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
/** @file CSMLoader.cpp
|
||||
* Implementation of the CSM importer class.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
|
||||
|
||||
#include "CSMLoader.h"
|
||||
@@ -63,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
static constexpr aiImporterDesc desc = {
|
||||
"CharacterStudio Motion Importer (MoCap)",
|
||||
"",
|
||||
"",
|
||||
@@ -76,49 +71,39 @@ static const aiImporterDesc desc = {
|
||||
"csm"
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
CSMImporter::CSMImporter()
|
||||
: noSkeletonMesh()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
CSMImporter::~CSMImporter()
|
||||
{}
|
||||
CSMImporter::CSMImporter() : noSkeletonMesh() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const
|
||||
{
|
||||
bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const {
|
||||
static const char* tokens[] = {"$Filename"};
|
||||
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Build a string of all file extensions supported
|
||||
const aiImporterDesc* CSMImporter::GetInfo () const
|
||||
{
|
||||
const aiImporterDesc* CSMImporter::GetInfo () const {
|
||||
return &desc;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Setup configuration properties for the loader
|
||||
void CSMImporter::SetupProperties(const Importer* pImp)
|
||||
{
|
||||
void CSMImporter::SetupProperties(const Importer* pImp) {
|
||||
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void CSMImporter::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() == nullptr) {
|
||||
if (file == nullptr) {
|
||||
throw DeadlyImportError( "Failed to open CSM file ", pFile, ".");
|
||||
}
|
||||
|
||||
@@ -126,80 +111,92 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
||||
std::vector<char> mBuffer2;
|
||||
TextFileToBuffer(file.get(),mBuffer2);
|
||||
const char* buffer = &mBuffer2[0];
|
||||
|
||||
const char *end = &mBuffer2[mBuffer2.size() - 1] + 1;
|
||||
std::unique_ptr<aiAnimation> anim(new aiAnimation());
|
||||
int first = 0, last = 0x00ffffff;
|
||||
|
||||
// now process the file and look out for '$' sections
|
||||
while (1) {
|
||||
SkipSpaces(&buffer);
|
||||
if ('\0' == *buffer)
|
||||
while (true) {
|
||||
SkipSpaces(&buffer, end);
|
||||
if ('\0' == *buffer) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ('$' == *buffer) {
|
||||
if ('$' == *buffer) {
|
||||
++buffer;
|
||||
if (TokenMatchI(buffer,"firstframe",10)) {
|
||||
SkipSpaces(&buffer);
|
||||
if (TokenMatchI(buffer,"firstframe",10)) {
|
||||
SkipSpaces(&buffer, end);
|
||||
first = strtol10(buffer,&buffer);
|
||||
}
|
||||
else if (TokenMatchI(buffer,"lastframe",9)) {
|
||||
SkipSpaces(&buffer);
|
||||
else if (TokenMatchI(buffer,"lastframe",9)) {
|
||||
SkipSpaces(&buffer, end);
|
||||
last = strtol10(buffer,&buffer);
|
||||
}
|
||||
else if (TokenMatchI(buffer,"rate",4)) {
|
||||
SkipSpaces(&buffer);
|
||||
float d;
|
||||
buffer = fast_atoreal_move<float>(buffer,d);
|
||||
SkipSpaces(&buffer, end);
|
||||
float d = { 0.0f };
|
||||
buffer = fast_atoreal_move(buffer,d);
|
||||
anim->mTicksPerSecond = d;
|
||||
}
|
||||
else if (TokenMatchI(buffer,"order",5)) {
|
||||
std::vector< aiNodeAnim* > anims_temp;
|
||||
anims_temp.reserve(30);
|
||||
while (1) {
|
||||
SkipSpaces(&buffer);
|
||||
if (IsLineEnd(*buffer) && SkipSpacesAndLineEnd(&buffer) && *buffer == '$')
|
||||
while (true) {
|
||||
SkipSpaces(&buffer, end);
|
||||
if (IsLineEnd(*buffer) && SkipSpacesAndLineEnd(&buffer, end) && *buffer == '$')
|
||||
break; // next section
|
||||
|
||||
// Construct a new node animation channel and setup its name
|
||||
anims_temp.push_back(new aiNodeAnim());
|
||||
aiNodeAnim* nda = anims_temp.back();
|
||||
|
||||
char* ot = nda->mNodeName.data;
|
||||
while (!IsSpaceOrNewLine(*buffer))
|
||||
char *ot = nda->mNodeName.data;
|
||||
const char *ot_end = nda->mNodeName.data + AI_MAXLEN;
|
||||
while (!IsSpaceOrNewLine(*buffer) && buffer != end && ot != ot_end) {
|
||||
*ot++ = *buffer++;
|
||||
}
|
||||
|
||||
*ot = '\0';
|
||||
nda->mNodeName.length = static_cast<ai_uint32>(ot-nda->mNodeName.data);
|
||||
}
|
||||
|
||||
anim->mNumChannels = static_cast<unsigned int>(anims_temp.size());
|
||||
if (!anim->mNumChannels)
|
||||
if (!anim->mNumChannels) {
|
||||
throw DeadlyImportError("CSM: Empty $order section");
|
||||
}
|
||||
|
||||
// copy over to the output animation
|
||||
anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
|
||||
::memcpy(anim->mChannels,&anims_temp[0],sizeof(aiNodeAnim*)*anim->mNumChannels);
|
||||
}
|
||||
else if (TokenMatchI(buffer,"points",6)) {
|
||||
if (!anim->mNumChannels)
|
||||
} else if (TokenMatchI(buffer,"points",6)) {
|
||||
if (!anim->mNumChannels) {
|
||||
throw DeadlyImportError("CSM: \'$order\' section is required to appear prior to \'$points\'");
|
||||
}
|
||||
|
||||
// If we know how many frames we'll read, we can preallocate some storage
|
||||
unsigned int alloc = 100;
|
||||
if (last != 0x00ffffff)
|
||||
{
|
||||
if (last != 0x00ffffff) {
|
||||
// re-init if the file has last frame data
|
||||
alloc = last-first;
|
||||
alloc += alloc>>2u; // + 25%
|
||||
for (unsigned int i = 0; i < anim->mNumChannels;++i)
|
||||
for (unsigned int i = 0; i < anim->mNumChannels; ++i) {
|
||||
if (anim->mChannels[i]->mPositionKeys != nullptr) delete[] anim->mChannels[i]->mPositionKeys;
|
||||
anim->mChannels[i]->mPositionKeys = new aiVectorKey[alloc];
|
||||
}
|
||||
} else {
|
||||
// default init
|
||||
for (unsigned int i = 0; i < anim->mNumChannels; ++i) {
|
||||
if (anim->mChannels[i]->mPositionKeys != nullptr) continue;
|
||||
anim->mChannels[i]->mPositionKeys = new aiVectorKey[alloc];
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int filled = 0;
|
||||
|
||||
// Now read all point data.
|
||||
while (1) {
|
||||
SkipSpaces(&buffer);
|
||||
if (IsLineEnd(*buffer) && (!SkipSpacesAndLineEnd(&buffer) || *buffer == '$')) {
|
||||
while (true) {
|
||||
SkipSpaces(&buffer, end);
|
||||
if (IsLineEnd(*buffer) && (!SkipSpacesAndLineEnd(&buffer, end) || *buffer == '$')) {
|
||||
break; // next section
|
||||
}
|
||||
|
||||
@@ -210,56 +207,58 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
||||
for (unsigned int i = 0; i < anim->mNumChannels;++i) {
|
||||
|
||||
aiNodeAnim* s = anim->mChannels[i];
|
||||
if (s->mNumPositionKeys == alloc) { /* need to reallocate? */
|
||||
|
||||
if (s->mNumPositionKeys == alloc) {
|
||||
// need to reallocate?
|
||||
aiVectorKey* old = s->mPositionKeys;
|
||||
s->mPositionKeys = new aiVectorKey[s->mNumPositionKeys = alloc*2];
|
||||
s->mPositionKeys = new aiVectorKey[alloc*2];
|
||||
::memcpy(s->mPositionKeys,old,sizeof(aiVectorKey)*alloc);
|
||||
delete[] old;
|
||||
}
|
||||
|
||||
// read x,y,z
|
||||
if(!SkipSpacesAndLineEnd(&buffer))
|
||||
if (!SkipSpacesAndLineEnd(&buffer, end)) {
|
||||
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample x coord");
|
||||
}
|
||||
|
||||
if (TokenMatchI(buffer, "DROPOUT", 7)) {
|
||||
// seems this is invalid marker data; at least the doc says it's possible
|
||||
ASSIMP_LOG_WARN("CSM: Encountered invalid marker data (DROPOUT)");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
aiVectorKey* sub = s->mPositionKeys + s->mNumPositionKeys;
|
||||
sub->mTime = (double)frame;
|
||||
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.x);
|
||||
buffer = fast_atoreal_move(buffer, sub->mValue.x);
|
||||
|
||||
if(!SkipSpacesAndLineEnd(&buffer))
|
||||
if (!SkipSpacesAndLineEnd(&buffer, end)) {
|
||||
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample y coord");
|
||||
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.y);
|
||||
}
|
||||
buffer = fast_atoreal_move(buffer, sub->mValue.y);
|
||||
|
||||
if(!SkipSpacesAndLineEnd(&buffer))
|
||||
if (!SkipSpacesAndLineEnd(&buffer, end)) {
|
||||
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample z coord");
|
||||
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.z);
|
||||
}
|
||||
buffer = fast_atoreal_move(buffer, sub->mValue.z);
|
||||
|
||||
++s->mNumPositionKeys;
|
||||
}
|
||||
}
|
||||
|
||||
// update allocation granularity
|
||||
if (filled == alloc)
|
||||
if (filled == alloc) {
|
||||
alloc *= 2;
|
||||
}
|
||||
|
||||
++filled;
|
||||
}
|
||||
// all channels must be complete in order to continue safely.
|
||||
for (unsigned int i = 0; i < anim->mNumChannels;++i) {
|
||||
|
||||
if (!anim->mChannels[i]->mNumPositionKeys)
|
||||
if (!anim->mChannels[i]->mNumPositionKeys) {
|
||||
throw DeadlyImportError("CSM: Invalid marker track");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// advance to the next line
|
||||
SkipLine(&buffer);
|
||||
SkipLine(&buffer, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,14 +272,20 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
||||
pScene->mRootNode->mNumChildren = anim->mNumChannels;
|
||||
pScene->mRootNode->mChildren = new aiNode* [anim->mNumChannels];
|
||||
|
||||
for (unsigned int i = 0; i < anim->mNumChannels;++i) {
|
||||
for (unsigned int i = 0; i < anim->mNumChannels;++i) {
|
||||
aiNodeAnim* na = anim->mChannels[i];
|
||||
|
||||
aiNode* nd = pScene->mRootNode->mChildren[i] = new aiNode();
|
||||
nd->mName = anim->mChannels[i]->mNodeName;
|
||||
nd->mParent = pScene->mRootNode;
|
||||
|
||||
aiMatrix4x4::Translation(na->mPositionKeys[0].mValue, nd->mTransformation);
|
||||
if (na->mPositionKeys != nullptr && na->mNumPositionKeys > 0) {
|
||||
aiMatrix4x4::Translation(na->mPositionKeys[0].mValue, nd->mTransformation);
|
||||
} else {
|
||||
// Use identity matrix if no valid position data is available
|
||||
nd->mTransformation = aiMatrix4x4();
|
||||
DefaultLogger::get()->warn("CSM: No position keys available for node - using identity transformation");
|
||||
}
|
||||
}
|
||||
|
||||
// Store the one and only animation in the scene
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace Assimp {
|
||||
* Link to file format specification:
|
||||
* <max_8_dvd>\samples\Motion\Docs\CSM.rtf
|
||||
*/
|
||||
class CSMImporter : public BaseImporter {
|
||||
class CSMImporter final : public BaseImporter {
|
||||
public:
|
||||
CSMImporter();
|
||||
~CSMImporter() override;
|
||||
~CSMImporter() override = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
|
||||
@@ -81,9 +81,8 @@ protected:
|
||||
private:
|
||||
bool noSkeletonMesh;
|
||||
|
||||
}; // end of class CSMImporter
|
||||
};
|
||||
|
||||
} // end of namespace Assimp
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // AI_AC3DIMPORTER_H_INC
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -66,13 +65,13 @@ class IOSystem;
|
||||
|
||||
/// Helper class to export a given scene to a Collada file. Just for my personal
|
||||
/// comfort when implementing it.
|
||||
class ColladaExporter {
|
||||
class ColladaExporter final {
|
||||
public:
|
||||
/// Constructor for a specific scene to export
|
||||
ColladaExporter(const aiScene *pScene, IOSystem *pIOSystem, const std::string &path, const std::string &file);
|
||||
|
||||
/// Destructor
|
||||
virtual ~ColladaExporter();
|
||||
virtual ~ColladaExporter() = default;
|
||||
|
||||
protected:
|
||||
/// Starts writing the contents
|
||||
@@ -101,7 +100,7 @@ protected:
|
||||
void WritePointLight(const aiLight *const light);
|
||||
void WriteDirectionalLight(const aiLight *const light);
|
||||
void WriteSpotLight(const aiLight *const light);
|
||||
void WriteAmbienttLight(const aiLight *const light);
|
||||
void WriteAmbientLight(const aiLight *const light);
|
||||
|
||||
/// Writes the controller library
|
||||
void WriteControllerLibrary();
|
||||
@@ -233,7 +232,7 @@ public:
|
||||
Surface ambient, diffuse, specular, emissive, reflective, transparent, normal;
|
||||
Property shininess, transparency, index_refraction;
|
||||
|
||||
Material() {}
|
||||
Material() = default;
|
||||
};
|
||||
|
||||
std::map<unsigned int, std::string> textures;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2025, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -341,7 +341,7 @@ struct SubMesh {
|
||||
|
||||
/// Contains data for a single mesh
|
||||
struct Mesh {
|
||||
Mesh(const std::string &id) :
|
||||
explicit Mesh(const std::string &id) :
|
||||
mId(id) {
|
||||
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||
mNumUVComponents[i] = 2;
|
||||
@@ -621,6 +621,11 @@ struct Animation {
|
||||
|
||||
for (std::vector<Animation *>::iterator it = pParent->mSubAnims.begin(); it != pParent->mSubAnims.end();) {
|
||||
Animation *anim = *it;
|
||||
// Assign the first animation name to the parent if empty.
|
||||
// This prevents the animation name from being lost when animations are combined
|
||||
if (mName.empty()) {
|
||||
mName = anim->mName;
|
||||
}
|
||||
CombineSingleChannelAnimationsRecursively(anim);
|
||||
|
||||
if (childrenAnimationsHaveDifferentChannels && anim->mChannels.size() == 1 &&
|
||||
@@ -661,7 +666,7 @@ struct ChannelEntry {
|
||||
const Collada::Accessor *mTimeAccessor; ///> Collada accessor to the time values
|
||||
const Collada::Data *mTimeData; ///> Source data array for the time values
|
||||
const Collada::Accessor *mValueAccessor; ///> Collada accessor to the key value values
|
||||
const Collada::Data *mValueData; ///> Source datat array for the key value values
|
||||
const Collada::Data *mValueData; ///> Source data array for the key value values
|
||||
|
||||
ChannelEntry() :
|
||||
mChannel(),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user