Compare commits

...

150 Commits

Author SHA1 Message Date
Pichas f4c7606faf
fix no_valid_proc (#5774)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-09-16 09:17:22 +02:00
Kim Kulling 66187a77cf
Update dll_symbol.h (#5781)
- fix compile switch
- closes https://github.com/assimp/assimp/issues/5777
2024-09-15 20:44:32 +02:00
PatrickD 5c7acc968b
Fix naming in aiMaterial comment (#5780) 2024-09-13 14:24:09 +02:00
Lux f81ea6986c
Restored absolute transform calculation due to https://github.com/assimp/assimp/pull/5349 which requires this now. (#5751) 2024-09-11 10:11:15 +02:00
dataisland ab12e8d8ba
Fix stack overflow (#5764)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-09-10 23:15:31 +02:00
dataisland 3bd98611d7
Fix buffer overflow in MD3Loader (#5763)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-09-10 22:10:36 +02:00
dataisland d468e633b1
Fix invalid access (#5765)
* Fix invalid access

* Update SortByPTypeProcess.cpp

Some smaller refactorings.

* Update SortByPTypeProcess.cpp

Small refactorings.

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-09-10 09:12:01 +02:00
Kim Kulling 4024726eca
Fix leak (#5762)
* Fix leak

* Update utLogger.cpp
2024-09-07 21:02:34 +02:00
Kim Kulling cd0ef869e3
Kimkulling/mark blender versions as not supported (#5370)
* Cleanup defs + add deprecated macro

* Remove empty line

* Remove dead code

---------

Co-authored-by: Kim Kulling <kim.kulling@draeger.com>
2024-09-05 23:40:19 +02:00
RichardTea ed3fccd5db
Add option to ignore FBX custom axes (#5754)
AI_CONFIG_IMPORT_FBX_IGNORE_UP_DIRECTION
Default false

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-09-05 21:03:26 +02:00
Matthias Möller ff2dc2fb2e
Prevents PLY from parsing duplicate properties (#5743)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-09-04 11:54:24 +02:00
Tobias Rittig, Ph.D. f69e55058d
Allow usage of pugixml from a superproject (#5752)
When using CMake subprojects with an existing build of pugixml
this prevents Assimp from using its own copy.
2024-09-03 21:45:30 +02:00
RichardTea c1ffbfec06
Zero-length mChildren arrays should be nullptr (#5749)
- Children: Don't allocate a zero-length array
- aiNode::mChildren should be left nullptr instead.
2024-09-03 10:26:27 +02:00
Kim Kulling c35200e38e
prepare v5.4.3 (#5741)
* prepare v5.4.3

- Increase patch level

* Update utVersion.cpp

Fix version test
2024-08-30 20:35:01 +02:00
Kim Kulling 1e09642382
Ply-Importer: Fix vulnerability (#5739) 2024-08-30 19:43:39 +02:00
Kim Kulling edaf87f186
Update ccpp.yml (#5740)
- Add ccache to build
2024-08-30 19:29:32 +02:00
Olivier Chafik 88340d0ce0
`build`: Add ccache support (#5686)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-30 13:22:54 +02:00
Fav 5e912e68da
Update glTF2AssetWriter.inl (#5647)
The total length is incorrect when exporting gltf2

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 23:55:18 +02:00
Vincent Fazio ae0ff8a88a
Update PyAssimp structs with Skeleton & SkeletonBone members (#5734)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 23:45:35 +02:00
Aliaksandr Kasmachou 924106188e
feat: add option for creating XCFramework and configure minimum iOS target (#5648)
* feat: add option for creating XCFramework and configure minimum iOS target with a build parameter

* style: update indents for iOS bash script

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 23:05:32 +02:00
Haixi 389bdedda7
FBX: add metadata as properties (#5675)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 21:38:34 +02:00
Olivier Chafik f39f53e860
Fix casting typo in D3MFExporter::writeBaseMaterials (color channels < 1.0f were zeroed out) (#5681)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 21:27:13 +02:00
OGAWA KenIchi 11daaf79a5
Fix to judge 'multi-configuration' correctly (#5720)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 21:09:17 +02:00
Matthias Möller 3e7e4c8c52
Fix potential memory leak in SceneCombiner for LWS/IRR/MD3 loader (#5721)
* fix potential memory leak in scenecombiner

* also cleansup srclist

* de-duplicates before deleting

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-29 11:21:59 +02:00
Vincent Fazio 4338817ca2
Fix copying private data when source pointer is NULL (#5733) 2024-08-29 00:13:40 +02:00
dependabot[bot] fd7ad4a9d8
Bump softprops/action-gh-release from 1 to 2 (#5730)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-27 21:47:37 +02:00
dependabot[bot] a7a424e0a7
Bump actions/upload-artifact from 1 to 4 (#5731)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v1...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-27 13:04:32 +02:00
dependabot[bot] f0ca4df704
Bump actions/download-artifact from 1 to 4 (#5732)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 1 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v1...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-27 10:36:13 +02:00
imdongye d32370ff12
fix GetShortFilename function (#5728)
when blender export fbx then embedded texture path have slash and back slash.
so GetShortFilename have to check both types of slashes

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-25 17:11:19 +02:00
Sanchikuuus 12ed0286e4
Added more Maya materials (#5101)
* Added more Maya materials

Added Maya materials to list and add setting texture properties for getting lost textures to mesh

* Update utMaterialSystem.cpp

Now new enumerators are handled by a case label in utMaterialSystem.cpp

* Update material.h

- Fix tests: use the correct max material parameter

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-24 11:29:47 +02:00
Kim Kulling bb9db8409f
Sparky kitty studios master (#5727)
* upload contains "windows" in GH Actions

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* buildする方についてwindows-msvcのついている方にした

この二つ、何の違いがあるかいまいち理解してない…
clでビルドするかhunterでビルドするかの違い?

* upload/release対象のartifactを修正

追加当時のIssueを参考に修正(当時はHunterなかったっぽい)
a9a0c30932

* fix ccpp.yml -- fix matrix.name check for artifact

* fix ccpp.yml - build both hunter or not

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Update ccpp.yml

* Fix verbose string + refactorings

* Revert "Fix verbose string + refactorings"

This reverts commit 824db16a68.

* Fix verbose string + refactorings

---------

Co-authored-by: Kazuki Y <6259214+kazu0617@users.noreply.github.com>
Co-authored-by: kazu0617 <kazu0617@protonmail.com>
Co-authored-by: Kim Kulling <kim.kulling@draeger.com>
2024-08-22 11:09:14 +02:00
sacereda d83904e3ee
Expose aiGetEmbeddedTexture to C-API (#5382)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-21 21:15:57 +02:00
Kim Kulling bc6710a116
Fix leak in loader (#5718)
* Fix leak in loader

 Closes https://github.com/assimp/assimp/issues/5717

* Free generated mesh on importer destruction.
2024-08-17 13:49:09 +02:00
OGAWA KenIchi 10e97b2f4a
Fix MSVC build error (#5716)
* add compile option /source-charset:utf-8
2024-08-16 19:33:09 +02:00
Steve M d95a5c60ef
Revert variable name (fix broken build on android) (#5715)
Co-authored-by: Steve M <praktique-tellypresence@yahoo.com>
2024-08-14 12:13:49 +02:00
Matthias Möller 12cdbb712c
Fixes possible out-of-bound read in findDegenerate (#5679)
This is possible, if the option "aiProcess_ValidateDataStructure" is deactivated as postprocessing step, but the option "aiProcess_FindDegenerates" is activated and the mesh contains invalid data structures

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-13 16:24:43 +02:00
Måns Andersen b992ff278b
Remove recursive include (#5705)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-13 16:14:31 +02:00
Måns Andersen 9485d49e93
include Exceptional.h in 3DSExporter.cpp (#5707)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-13 11:17:45 +02:00
RichardTea f950f61a52
Use DRACO_GLTF_BITSTREAM (#5709)
Replaces deprecated DRACO_GLTF cmake option

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-13 10:09:28 +02:00
RichardTea afe06f2298
Fix MSVC PDBs and permit them to be disabled if required (#5710)
* Revert "Remove /Zi compiler flag for MSVC, release config"

This reverts commit 9e1de3ec6e.

* Allow MSVC PDB creation to be disabled

Turn off ASSIMP_INSTALL_PDB to disable PDB creation

* Whitespace cleanup

Assimp uses spaces in cmakelists, not tabs

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-13 09:53:33 +02:00
mkuritsu d41b6b253d
Added AND condition in poly2tri dll_symbol.h to only define macros fo… (#5693)
* Added ADD condition in poly2tri dll_symbol.h to only define macros for dynamic library linking if assimp is ordered to build as DLL

* Reverted last commit to handle this issue in a better way.

* added P2T_STATIC_EXPORTS to compile definitions when building assimp as DLL

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-13 09:39:53 +02:00
Nathan V. Morrical 09b981d943
fixing static build (#5713) 2024-08-13 09:23:14 +02:00
Kimbatt 48c3a0ec46
FBX exporter - handle multiple vertex color channels (#5695)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-08-07 22:43:02 +02:00
Kim Kulling a37d748c17
Update DefaultIOSystem.cpp (#5697)
- closes https://github.com/assimp/assimp/issues/5678
2024-08-02 18:28:29 +02:00
Kim Kulling e63d3ed8e7
Make coord transfor for hs1 files optional (#5687)
* Make coord transfor for hs1 files optional

* Add config switch for HS1 transformation transformation
2024-07-31 18:39:39 +02:00
Kim Kulling 104a70f845
Return false instead of crash (#5685)
- Return false instead of crash
- closes https://github.com/assimp/assimp/issues/5684
2024-07-23 16:32:11 +02:00
Florian Born 76de7cedf4
A fuzzed stride could cause the max count to become negative and hence wrap around uint (#5414)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-23 16:17:54 +02:00
JensEhrhardt-eOPUS c55158cd82
CalcTangents: zero vector is invalid for tangent/bitangent (#5432)
* CalcTangents: zero vector is invalid for tangent/bitangent
2024-07-23 13:13:12 +02:00
Kim Kulling 571ba09dc7
Mosfet80 updatedpoli2tri (#5682)
* updated poli2tri library to last version
2024-07-23 10:41:43 +02:00
Kim Kulling db19f62a0c Merge branch 'master' of https://github.com/assimp/assimp 2024-07-22 09:11:17 +02:00
Stoyan Gaydarov 5d5e0bad3c
Fix a fuzz test heap buffer overflow in mdl material loader (#5658)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-19 21:48:10 +02:00
Kim Kulling 9cf03b4ddc
Introduce interpolation mode to vectro and quaternion keys (#5674)
* Introduce interpolation mode to vectro and quaternion keys

* Update USDLoader.cpp

Fix review finding

* Update USDLoader.h

Fix review finding,
2024-07-18 23:54:31 +02:00
Vincent Fazio 91e93578c7
Update Python structs with missing fields (#5673) 2024-07-17 21:25:16 +02:00
Kim Kulling da281b7f48 Introduce interpolation mode to vectro and quaternion keys 2024-07-17 15:49:17 +02:00
Kim Kulling 35e4f1bf64
Kimkulling/fix double precision tests (#5660)
* Make color single precision

* Fix the unittests for double precision

* Fix merge issues

* Fix issues with Vertex + Color4

* Fix vertex operator, some tests are still red.
2024-07-12 14:37:49 +02:00
Steve M 0cb1693689
[USD] Integrate "tinyusdz" project (#5628)
* Squash development commits for PR

* Fix failing build on armeabi-v7a via android NDK

* Update with blendshape support

* Migrate to auto-cloning and patching tinyusdz (instead of manually copying files)

* Update to latest rendermesh-refactor branch commit

* Remove tracked file

* Update to use recent commit to "dev" branch

"rendermesh-refactor" was merged to "dev" around 9 May 2024 but merge
was not obvious from commit messages

* Add UNUSED() macro

(cherry picked from commit d89fe8f034c353cc5cc5b3ac78cd8845e006de38)

* Update tinyusdz branch

* Prevent per-ABI (x86, x86_64 etc) clone on android

* Add verbose logging cmake option

* Fix macro and patch

* Address compiler warnings

* Address compiler warnings

* Address compiler warnings

* Attempt prevent re-clone/re-patch once downloaded by any ABI build

* Disable tinyusdz clone/build by default

assimp github PR auto-CI checks clone/build the tinyusdz code, and reject PR
due to compiler warnings in the 3rd party external tinyusdz project

---------

Co-authored-by: Steve M <praktique-tellypresence@yahoo.com>
2024-07-12 13:25:35 +02:00
Kim Kulling d3bec44990
Update Readme.md (#5665) 2024-07-11 14:19:09 +02:00
Kim Kulling b0aae04801
Update Readme.md (#5663)
- Add a discord invitation
2024-07-11 10:30:42 +02:00
Stepan Hrbek 206839d4f2
Allow empty slots in mTextureCoords (#5636)
* Allow empty slots in aiMesh::mTextureCoords.
1.Explicitly say in documentation that empty slots are allowed (it was unclear).
2.Change GetNumUVChannels() implementation to allow empty slots.
3.Revert fraction of 2da2835b29 where empty slots are detected and error logged.

* Fix #5632 by reverting fraction of d6aacefa1e where Collada texcoords are renumbered to avoid empty slots.

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-10 09:01:53 +02:00
Kim Kulling 193f2c5d87
Fix compile warning (#5657) 2024-07-08 17:09:17 +02:00
Kim Kulling bff00b15f1
Replace raw pointers by std::string (#5656)
* Replace raw pointers by std::string
2024-07-06 13:59:02 +02:00
Matthias Möller d5cb1fe01f
Fix potential heapbuffer overflow in md5 parsing (#5652) 2024-07-06 08:27:05 +02:00
Kim Kulling fe6e25080b
Docker: Fix security finding (#5655)
- Use --no-install-recommends to avoid getting more deps than needed
2024-07-05 13:43:50 +02:00
Kim Kulling ddb74c2bbd
Fix out of bound access (#5651) 2024-07-03 21:37:24 +02:00
Brad D 625528d02c
Fix: StackAllocator Undefined Reference fix (#5650)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-03 10:05:58 +02:00
Markus Prettner 7e053cc641
Fix names of enum values in docstring of aiProcess_FindDegenerates (#5640)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-02 22:11:52 +02:00
Matthias Möller 35976a4eb4
fixes some uninit bool loads (#5644)
This commit fixes some bool loads which are not initialized. With ubsan and the "option -fsanitize=bool", this results in a runtime error during test execution.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-02 21:54:18 +02:00
ThatOSDev dd1474e280
Update zip.c (#5639)
Now works with GCC without failing the compilation.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-07-02 21:12:58 +02:00
Matthias Möller 0b19b7d73b
fixes potential memory leak on malformed obj file (#5645) 2024-06-29 19:20:10 +02:00
Julian Knodt d0703a5a3a
Fix exporting incorrect bone order (#5435)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-06-28 12:58:09 +02:00
Kim Kulling cdf8394ccc
Fix nullptr dereferencing (#5638)
- closes https://github.com/assimp/assimp/issues/5617
2024-06-25 00:05:31 +02:00
Garux dd10fb6ee4
remove ASE parsing break added in c1968823ad : original intent was to keep parsing (#5634)
crash case (iMaterialCount = 0) is handled by 47dbabadcd
2024-06-24 21:23:59 +02:00
Stepan Hrbek adff2f388a
Fix collada uv channels - temporary was stored and then updated. So all information on uv channels was ignored. (#5630)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-06-21 13:49:19 +02:00
ycn2022 0afd366dcb
Update FBXMeshGeometry.cpp (#5624)
Some FBXs do not have "Materials" information, which can cause parsing errors

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-06-20 21:26:04 +02:00
michaelsctts 77f7706a97
fix PLY binary export color from float to uchar (#5608) 2024-06-19 15:45:15 +02:00
Kim Kulling 5c2a33f230
Make stepfile schema validation more robust. (#5627)
* Make stepfile schema validation more robust.

* Update STEPFile.h
2024-06-18 14:22:12 +02:00
mosfet80 0cef794abd
Update Readme.md (#5618)
link https://bitbucket.org/Starnick/assimpnet/src/master/  is deleted.
reverto to old link

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-06-18 09:30:35 +02:00
Kim Kulling 07ab05cc41
Fix init aistring issue 5622 inpython module (#5625)
* Draft: Update init of aiString

- closes https://github.com/assimp/assimp/issues/5622

* Update types.h

* Fix typo

* Fix another typo

* Adapt usage of AI_MAXLEN

* Fix compare operator

* Add missing renames

* Add missing renames
2024-06-17 23:52:23 +02:00
Kim Kulling a51500ba2b
Draft: Update init of aiString (#5623)
* Draft: Update init of aiString

- closes https://github.com/assimp/assimp/issues/5622

* Update types.h

* Fix typo

* Fix another typo

* Adapt usage of AI_MAXLEN

* Fix compare operator

* Add missing renames
2024-06-17 13:12:54 +02:00
mosfet80 75091d4529
clean HunterGate.cmake (#5619)
removing cmake version control check. The cmake version is always greater than 3.22

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-06-17 11:50:42 +02:00
Kim Kulling 907da122e9
Create inno_setup (#5621) 2024-06-15 12:41:43 +02:00
Kim Kulling 81858f9e62
Update MDLMaterialLoader.cpp (#5620)
* Update MDLMaterialLoader.cpp

- closes https://github.com/assimp/assimp/issues/5239

* Add missing declaration
2024-06-14 12:51:47 +02:00
Kim Kulling 97cbecb859
Move revision.h and revision.h.in to include folder (#5615) 2024-06-12 21:01:03 +02:00
Kim Kulling a722e33027
Move aiScene constructor (#5614) 2024-06-11 21:19:52 +02:00
Kim Kulling 75a10fedd0
Replace duplicated trim (#5613) 2024-06-11 16:30:49 +02:00
Kim Kulling e963a863ce
Add trim to xml string parsing (#5611) 2024-06-10 22:25:28 +02:00
Bradly Landucci 8231d99a85
Converted a size_t to mz_uint that was being treated as an error (#5600)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-06-10 11:19:57 +02:00
Kim Kulling 0d546b3d2e
Build: Fix compilation for VS-2022 debug mode - warning (#5606)
- closes https://github.com/assimp/assimp/issues/5601
2024-05-31 13:08:51 +02:00
Kim Kulling 43634b8b27
Postprocessing: Fix endless loop (#5605)
- closes https://github.com/assimp/assimp/issues/5603
2024-05-31 09:36:14 +02:00
mosfet80 83d7216726
updated zip (#5499)
* updated zip

udated zip from version 1.15 to version 3.0.2

* Check for double defined macro

* Update miniz.h

* Update zip.c

* Update zip.c

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-27 16:19:48 +02:00
Daniel Simon 329fee2f0b
Disabled maybe-uninitialized error for AssetLib/Obj/ObjFileParser.cpp as it seems to be spurious. Also fixed error message for previous GCC build issue modification (#5593)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-26 21:07:13 +02:00
Kim Kulling 4584719362
Update ObjFileParser.cpp (#5598)
Ensure not checking empty strings
2024-05-26 18:39:14 +02:00
Kim Kulling 30466aaf16
Fix possible nullptr dereferencing. (#5595) 2024-05-24 15:36:30 +02:00
vengine ec5242a1a0
Fix a bug that could cause assertion failure. (#5575)
Co-authored-by: macmini <xhnsworks2@icloud.com>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-22 21:20:22 +02:00
Daniel Simon 6fa4f0ff5e
Temporary fix for GCC 13+ build issue -Warray-bounds (#5577)
Added cmake code to remove warnings for array-bounds and stringop-overflow specifically for MDLLoader.cpp on GCC 13 and above.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-19 18:51:02 +02:00
Kim Kulling fd3f092d6e
Optimize readability (#5578) 2024-05-18 22:06:04 +02:00
Jean-Louis Boudrand 787c9afdf7
Assimp viewer fixes (#5582)
* AssimpViewer: Fix statistics reset + rename Time -> Loading time (more explicit)

* AssimpViewer: Fix bug where it was not possible to reload a closed asset

* AssimpViewer: Add a name in combobox for unnamed animations and disable anim UI when there is no animation

* AssimpViewer: Fixes the case where moving the anim cursor can break the animation

* AssimpViewer: Fixes the fact that when you press "play" on the animation after stopping it, there was a time jump in the animation

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-18 19:20:06 +02:00
Kim Kulling 2521909b8c
Fix integer overflow (#5581)
- closes https://github.com/assimp/assimp/issues/5579
2024-05-18 19:05:10 +02:00
Kim Kulling 04afb63d34
fix ci by disabling tests (#5583)
* fix ci by disabling tests

* fix comment brackets
2024-05-18 12:04:50 +02:00
Kim Kulling 942518a4ff
Remove deprecated c++11 warnings (#5576) 2024-05-15 10:22:03 +02:00
Kim Kulling 10df90ec14
Prepare v5.4.1 (#5573)
* [Draft] Prepare v5.4.1

* Update utVersion.cpp

Adapt test to v5.4.1
2024-05-13 13:45:14 +02:00
Julian Uy b6d53a0047
glTF2Importer: Support .vrm extension (#5569)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-13 13:24:41 +02:00
Kim Kulling 001bb01eb2
Make sure for releases revision will be zero (#5571) 2024-05-13 13:00:26 +02:00
Kim Kulling 325b0a543f
Add checks for invalid buffer ans size (#5570) 2024-05-13 08:55:10 +02:00
Garux 47dbabadcd
fix ASE loader crash when *MATERIAL_COUNT or *NUMSUBMTLS is not specified or is 0 (#5559)
code was doing vector[0u - 1] dereference in this case

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-08 10:43:43 +02:00
Kim Kulling c953739487
Kimkulling/fix pyassimp compatibility (#5563)
* Use correct exception message access

* Add missing docs
2024-05-06 21:38:29 +02:00
Garux 00b6db86ab
mention IQM loader in Fileformats.md (#5560)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-05-02 16:34:47 +02:00
陈瑞锋 4621676424
fix a collada import bug (#5561) 2024-05-02 15:32:12 +02:00
Johannes Unterguggenberger 47ef79672e
Reverts the changes introduced by commit ad766cb in February 2022. (#5542)
* Reverts the changes introduced by commit ad766cb in February 2022.
Explanation why the old code was just fine is given in Q&A #5512.

* Added that missing ;

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-29 21:03:57 +02:00
Kim Kulling c05895f3c7
Q3DLoader: Fix possible material string overflow (#5556)
- closes https://github.com/assimp/assimp/issues/5555
2024-04-26 11:11:19 +02:00
Succ3s 7bda0f88ca
SplitByBoneCount had a minor typo that prevented updates to nodes indices (#5550) 2024-04-23 21:40:06 +02:00
Zeun b71b8f77ee
add some ASSIMP_INSTALL checks (#5545) 2024-04-16 23:41:21 +02:00
Kim Kulling 85f084a4ce
Update ComputeUVMappingProcess.cpp (#5541)
* Update ComputeUVMappingProcess.cpp

- closes https://github.com/assimp/assimp/issues/5540

* Update ComputeUVMappingProcess.cpp

Add missing token.
2024-04-11 11:30:36 +01:00
Stephen Gold 08c1adc015
fix issue #5461 (segfault after removing redundant materials) (#5467)
* fix issue #5641 (segfault after removing redundant materials)

* Update RemoveRedundantMaterials.cpp

- Fix 2 possible memleaks.

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-10 00:22:57 +02:00
mosfet80 3ff7851ff9
updated STBIMAGElib (#5500)
2.29  (2023-05-xx) optimizations

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-09 23:31:10 +02:00
mosfet80 64d88276ef
updated minizip to last version (#5498)
Version 1.3.1 has these key changes:

Reject overflows of zip header fields in minizip
Fix bug in inflateSync() for data held in bit buffer
Add LIT_MEM define to use more memory for a small deflate speedup
Fix decision on the emission of Zip64 end records in minizip
Add bounds checking to ERR_MSG() macro, used by zError()
Neutralize zip file traversal attacks in miniunz
Fix a bug in ZLIB_DEBUG compiles in check_match()
Version 1.3 has these key changes:

Building using K&R (pre-ANSI) function definitions is no longer supported.
Fixed a bug in deflateBound() for level 0 and memLevel 9.
Fixed a bug when gzungetc() is used immediately after gzopen().
Fixed a bug when using gzflush() with a very small buffer.
Fixed a crash when gzsetparams() is attempted for a transparent write.
Fixed test/example.c to work with FORCE_STORED.
Fixed minizip to allow it to open an empty zip file.
Fixed reading disk number start on zip64 files in minizip.
Fixed a logic error in minizip argument processing.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-09 00:08:38 +02:00
Alex Rønne Petersen b8aa68a080
CMake: Allow linking draco statically if ASSIMP_BUILD_DRACO_STATIC is set. (#5535)
* CMake: Mark draco as a private dependency since assimp does not publicly expose its interface.

* CMake: Allow linking draco statically if ASSIMP_BUILD_DRACO_STATIC is set.
2024-04-08 23:28:37 +02:00
Kim Kulling 8b9ed34eaa
Update CMakeLists.txt (#5531)
* Update CMakeLists.txt

* Update Version.cpp

* Update CMakeLists.txt

Update minimum version of cmake

* Update utVersion.cpp

Adapt unittest
2024-04-07 23:14:12 +02:00
Kim Kulling b41ffa5561
Remove default destructor definitions from cpp files (#5528) 2024-04-07 21:42:52 +02:00
mosfet80 4a3e0e46ac
updated json (#5501)
fix https://github.com/Tencent/rapidjson/issues/1448

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-07 21:24:57 +02:00
Tom Heaton 1f920ee1fe
Update matrix4x4.h (#5507)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-07 20:16:48 +02:00
mosfet80 778ce90a04
Update hunter into CMakeLists.txt (#5505)
Update 'CURL' to v8.5.0 
Update 'xxHash' to v0.8.2 
Update 're2' to v2023.03.01 
docs: Add SHA1 calculation onliner and fix sums 
docs: fix URLs for FunctionalPlus and PocoCpp 
ceres-solver: update to 2.2.0-p2 with SuiteSparse v7.5.1-1 
SuiteSparse: update to v7.5.1-1

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-07 16:49:55 +02:00
Alejandro González 790aad4b62
Add macOS support to C4D importer (#5516)
The latest Cineware SDK explicitly asserts macOS support in its
documentation, but Assimp's C4D importer only works with Windows MSVC
targets. Let's improve its portability by refactoring importer code to
not depend on MSVC-only data types and quirks, and add support for linking
against the universal macOS static libraries provided in the Cineware
SDK.

Note that the C4D importer still cannot support Linux platforms because
Maxon does not provide the necessary precompiled Cineware libraries for
that platform. Windows MinGW targets are also out of the question as the
MinGW toolchain uses compiled libraries in a different format.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-07 00:25:46 +02:00
RoboSchmied 52c2b6896a
Fix 16 typos (#5518)
Signed-off-by: RoboSchmied <github@roboschmie.de>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-06 21:26:32 +02:00
Oleg Ivanov 9d11b220eb
Fix utDefaultIOStream test under MinGW (#5525) 2024-04-06 12:48:28 +02:00
Julian Knodt 39ce0c0456
Respect merge identical vertices in ObjExporter (#5521)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-04-02 18:31:19 +02:00
Kristjan Skutta feb861f17b
Fix duplicate degrees to radians conversion in fbx importer. (#5427)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-03-22 00:01:57 +01:00
mosfet80 730aa9d0b7
Delete packaging/windows-mkzip directory (#5492)
Removed unused files

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-03-20 11:15:03 +01:00
mosfet80 072320df4f
Delete tools/make directory (#5491)
Delete old .bat files

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-03-18 23:24:51 +01:00
Kim Kulling fcb1444b84
Add correction of fbx model rotation (#5494) 2024-03-17 17:46:28 +01:00
Laura Hermanns 727774f181
Fix compilation for MSVC14. (#5490)
- std::min/max were not defined in StackAllocator.inl; Also added explicit template arguments to break macro expansion if Windows.h is included prior and NOMINMAX macro is not present.
- Made static_assert statements compatible with C++11 in ProcessHelper.cpp.
- Removed unused string_view include in ObjFileParser.cpp.
2024-03-11 09:09:23 +01:00
Bao Anchang bb9101ae9e
Eliminate non-ascii comments in clipper (#5480) 2024-03-04 09:18:08 +01:00
sSsA01 f95050e7aa
Append a setting "AI_CONFIG_EXPORT_FBX_TRANSPARENCY_FACTOR_REFER_TO_OPACITY". (#5450)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-27 20:26:13 +01:00
Kim Kulling 01231d0e60
Add 2024 to copyright infos (#5475) 2024-02-23 22:30:05 +01:00
Kim Kulling 0664882763
Add zlib-header to ZipArchiveIOSystem.h (#5473)
- closes https://github.com/assimp/assimp/issues/5430
2024-02-23 11:30:37 +01:00
Kim Kulling 4d6dd80257
Add correct double zero check (#5471)
* Add correct double zero check

* Use std::fpclassify
2024-02-22 13:58:25 +01:00
Kim Kulling 94bc568d13
Include defs in not cpp-section (#5466)
- closes https://github.com/assimp/assimp/issues/5428
2024-02-16 15:21:49 +01:00
Adam Mizerski 4b9f46dbda
ColladaParser: check values length (#5462)
* ColladaParser: check values length

fixes: #4286

* Refactor calculation of size for data

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-15 13:07:00 +01:00
Séverin Lemaignan a3708e3464
Add ISC LICENSE file (#5465) 2024-02-14 08:32:32 +01:00
Emily Banerjee ff5b0ae575
Fix PyAssimp under Python >= 3.12 and macOS library search support (#5397)
* Fix PyAssimp under Python >= 3.12

* Make PyAssimp search DYLD_LIBRARY_PATH under macOS

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-08 20:46:36 +01:00
fvbj 2d98f6a880
Fix identity matrix check (#5445)
* Fix identity matrix check

Adds an extra epsilon value to check the matrix4x4 identity. The method is also used to export to GLTF/GLTF2 format to check node transformation matrices. The epsilon value can be set using AI_CONFIG_CHECK_IDENTITY_MATRIX_EPSILON with the default value set to 10e-3f for backward compatibility of legacy code.

* Fix type of float values in the unit test

* Update matrix4x4.inl

Fix typo

* Update matrix4x4.inl

Remove dead code.

* Add isIdentity-Test

* Update AssimpAPITest_aiMatrix4x4.cpp

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-06 21:24:41 +01:00
Julian Knodt c877a15140
`Blendshape`->`Geometry` in FBX Export (#5419)
When loading a mesh exported from assimp into Blender, it warns that it has an incorrect class.
While debugging, I traced it back to this being `Blendshape` where `Geometry` was expected. This
is likely because this node describes a `Geometry`, which is used as a blendshape. I'm not sure
if any other DCC tools or places to import it expect `Blendshape` instead (i.e. was this code
ever tested?), but it fixes its use in Blender.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-05 16:55:00 +01:00
mosfet80 1164844ce4
Update CMakeLists.txt (#5379)
* Update CMakeLists.txt

Silence warnings when building with CMake 3.27 by @hjmallon in #717
update gate submodule with fixed CMake 3.27 deprecation warnings as well
glog: add version 0.6.0 and disable new dependencies by @NeroBurner in #719
ceres-solver: update to v2.2.0-p1 by @NeroBurner in #720
Update 'GTest' to v1.14.0 by @hjmallon in #705
Update 'pybind11' to v2.11.1 by @hjmallon in #706
ceres-solver: update to v2.2.0-p0 and fix examples by @NeroBurner in #703
Eigen: explicitly disable Fortran usage by @NeroBurner in #704
OpenSSL: Fix v3 version parsing by @hjmallon in #707
Update 'Boost' to 1.83 by @hjmallon in #708
Update 'OpenSSL' to v3.0.12 and v3.1.4 by @hjmallon in #710
Update 'abseil' to 20230802.1 by @hjmallon in #711
Update 'benchmark' to v1.8.3 by @hjmallon in #712
Update 'sqlite3' to v3.43.2 by @hjmallon in #716
Update 'CURL' to v8.4.0 by @hjmallon in #663
CI: remove macos-10.15 jobs as the macos-10.15 runners are removed by @NeroBurner in #695
ZLIB: update to version v1.3.0-p0 by @NeroBurner in #693
miniz: update to v3.0.2 by @NeroBurner in #692
Update fmt package to 10.1.1 by @JamesEggleton in #697
Update spdlog package to 1.12.0-p0 by @JamesEggleton in #699
Update zstd package to 1.5.5 by @JamesEggleton in #700
SuiteSparse: update to 1.8.0 / 5.4.0-2 by @NeroBurner in #702
OpenCV, Extra, ippicv: update to v4.8.1-p0 by @NeroBurner in #696
hunter_setup_msvc: tolower to fix arm64 vs ARM64 confusion by @NeroBurner in #681
Add various recent LLVM versions by @mrexodia in #517
Update fmt package to 9.1.0 by @apivovarov in #683
Update asio-grpc to v2.6.0 by @Tradias in #686
#685 Minimum cmake version required now 3.5 by @john-forrest in #689

* Update CMakeLists.txt

* Update CMakeLists.txt

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-05 15:40:52 +01:00
dependabot[bot] a8c8e75a17
Bump actions/cache from 3 to 4 (#5431)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-05 15:10:36 +01:00
Florian Born f59a5fab1a
More GLTF loading hardening (#5415)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-04 21:23:31 +01:00
Galen Xiao b7b6601a75
feat:1.add 3mf vertex color read 2.fix 3mf read texture bug (#5361)
* feat:1.add 3mf vertex color read 2.fix 3mf read texture bug

* fix checks failed

* Trigger CI

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-04 20:23:07 +01:00
Stephen Gold bc6673b4b2
Fileformats.md: clarify that import of .blend files is deprecated (#5350)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-04 19:06:07 +01:00
Steve M 005399a671
Fix X importer breakage introduced in commit f844c33 (#5372)
* Update XFileImporter.cpp

Comment out boneIdx conditional which caused massive breakage

* Update XFileImporter.cpp

Fix typo

* Update XFileImporter.cpp

Dummy whitespace change to attempt to re-trigger failing CI tests

---------

Co-authored-by: Steve M <praktique-tellypresence@yahoo.com>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2024-02-04 10:38:07 +01:00
Kim Kulling 3990ec80a1
Kimkulling/fix bahavior of remove redundat mats issue 5438 (#5451)
* Fix crash in viewer

* Fix bevavior when material was not referenced
2024-02-01 21:27:04 +01:00
Kim Kulling 3476c79801
Static code analysis fixes (#5447)
* Static code analysis fixes

- Fix warning in LOW

* Fix possible out of bound access.

* Add default to class declaration
2024-01-31 09:30:54 +01:00
760 changed files with 20827 additions and 7621 deletions

View File

@ -7,10 +7,10 @@ on:
branches: [ master ]
permissions:
contents: read # to fetch code (actions/checkout)
contents: write # to fetch code (actions/checkout),and release
jobs:
job:
build:
name: ${{ matrix.name }}-build-and-test
runs-on: ${{ matrix.os }}
strategy:
@ -37,6 +37,9 @@ jobs:
cc: gcc
steps:
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
- uses: actions/checkout@v4
with:
submodules: true
@ -54,7 +57,7 @@ jobs:
- name: Cache DX SDK
id: dxcache
if: contains(matrix.name, 'windows')
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '${{ github.workspace }}/DX_SDK'
key: ${{ runner.os }}-DX_SDK
@ -70,12 +73,12 @@ jobs:
- 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 -DASSIMP_BUILD_ZLIB=1"
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 "::set-output name=args::-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake"
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
@ -92,7 +95,7 @@ jobs:
- 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"
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 }}
@ -101,5 +104,89 @@ jobs:
- uses: actions/upload-artifact@v4
if: matrix.name == 'windows-msvc'
with:
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
path: build/bin
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@v4
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.
include:
- name: windows-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
- name: ubuntu-gcc-hunter
os: ubuntu-latest
toolchain: ninja-gcc-cxx17-fpic
- name: macos-clang-hunter
os: macos-latest
toolchain: ninja-clang-cxx17-fpic
- 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: 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@v4
with:
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
with:
files: |
*.zip

51
.github/workflows/inno_setup vendored 100644
View File

@ -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.2
with:
path: packaging/windows-innosetup/script_x64.iss
options: /O+

4
.gitignore vendored
View File

@ -120,3 +120,7 @@ tools/assimp_qt_viewer/ui_mainwindow.h
#Generated directory
generated/*
# 3rd party cloned repos/tarballs etc
# tinyusdz repo, automatically cloned via CMake
contrib/tinyusdz/autoclone

View File

@ -1,6 +1,6 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
# Copyright (c) 2006-2023, assimp team
# Copyright (c) 2006-2024, assimp team
#
# All rights reserved.
#
@ -38,9 +38,25 @@ 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 )
# Disabled importers: m3d for 5.1
# 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)
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 or later
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_IMPORTER)
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)
# Toggles the use of the hunter package manager
@ -49,13 +65,13 @@ 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.18.tar.gz"
SHA1 "1292e4d661e1770d6d6ca08c12c07cf34a0bf718"
URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
)
add_definitions(-DASSIMP_USE_HUNTER)
ENDIF()
PROJECT(Assimp VERSION 5.3.0)
PROJECT(Assimp VERSION 5.4.3)
# All supported options ###############################################
@ -131,35 +147,35 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH
IF (WIN32)
OPTION( ASSIMP_BUILD_ZLIB
"Build your own zlib"
"Build your zlib"
ON
)
ELSE()
OPTION( ASSIMP_BUILD_ZLIB
"Build your own zlib"
"Build your zlib"
OFF
)
ENDIF()
IF (WIN32)
# Use subset of Windows.h
# Use a subset of Windows.h
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
IF(MSVC)
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(
@ -249,9 +265,9 @@ 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
# 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
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit Linux
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 )
ENDIF()
ENDIF()
@ -262,7 +278,7 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW AND NOT HAIKU)
IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
IF(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13)
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>")
@ -284,16 +300,23 @@ ELSEIF(MSVC)
ELSE() # msvc
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()
# supress warning for double to float conversion if Double precission is activated
ADD_COMPILE_OPTIONS(/wd4244)
# 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}")
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()
# Source code is encoded in UTF-8
ADD_COMPILE_OPTIONS(/source-charset:utf-8)
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -330,7 +353,7 @@ 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")
@ -338,7 +361,7 @@ ENDIF()
IF (ASSIMP_ASAN)
MESSAGE(STATUS "AddressSanitizer enabled")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
ENDIF()
@ -452,18 +475,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)
@ -481,7 +506,7 @@ IF(ASSIMP_HUNTER_ENABLED)
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()
@ -563,9 +588,9 @@ 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(MSVC143)
SET(C4D_LIB_POSTFIX "_2022")
@ -583,7 +608,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, 14.2, 14.3"
"C4D for Windows is currently only supported with MSVC 10, 11, 12, 14, 14.2, 14.3"
)
ENDIF()
@ -601,15 +626,30 @@ 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)
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"
)
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 with Cineware SDK installed in contrib/Cineware"
"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")
@ -619,7 +659,7 @@ ELSE()
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)
@ -645,22 +685,29 @@ ELSE()
"-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(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(BUILD_SHARED_LIBS)
set(draco_LIBRARIES "draco_shared")
else()
if(ASSIMP_BUILD_DRACO_STATIC)
set(draco_LIBRARIES "draco_static")
else()
set(draco_LIBRARIES "draco_shared")
endif()
endif()
@ -683,15 +730,17 @@ ELSE()
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()
@ -735,8 +784,8 @@ IF ( ASSIMP_INSTALL )
ENDIF()
CONFIGURE_FILE(
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/revision.h
${CMAKE_CURRENT_LIST_DIR}/include/assimp/revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/revision.h
)
CONFIGURE_FILE(

View File

@ -1,6 +1,6 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y ninja-build \
RUN apt-get update && apt-get install --no-install-recommends -y ninja-build \
git cmake build-essential software-properties-common
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update

View File

@ -26,12 +26,11 @@ Clone [our model database](https://github.com/assimp/assimp-mdb).
### Communities ###
- Ask questions at [the Assimp Discussion Board](https://github.com/assimp/assimp/discussions).
- Find us on [https://discord.gg/s9KJfaem](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)
And we also have a Gitter-channel:Gitter [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
#### Supported file formats ####
See [the complete list of supported formats](https://github.com/assimp/assimp/blob/master/doc/Fileformats.md).

View File

@ -22,38 +22,9 @@
# 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)

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -643,11 +643,17 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
}
// Allocate storage for children
pcOut->mNumChildren = (unsigned int)pcIn->mChildren.size();
const unsigned int 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;
@ -709,7 +715,7 @@ 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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -52,6 +52,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>

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -365,14 +365,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),
@ -385,7 +384,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),

View File

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

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -57,6 +57,7 @@ enum class ResourceType {
RT_BaseMaterials,
RT_EmbeddedTexture2D,
RT_Texture2DGroup,
RT_ColorGroup,
RT_Unknown
}; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...)
@ -117,6 +118,21 @@ public:
}
};
class ColorGroup : public Resource {
public:
std::vector<aiColor4D> mColors;
ColorGroup(int id) :
Resource(id){
// empty
}
~ColorGroup() override = default;
ResourceType getType() const override {
return ResourceType::RT_ColorGroup;
}
};
class BaseMaterials : public Resource {
public:
std::vector<unsigned int> mMaterialIndex;

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -98,6 +98,11 @@ namespace XmlTag {
const char *const texture_cuurd_u = "u";
const char *const texture_cuurd_v = "v";
// vertex color definitions
const char *const colorgroup = "m:colorgroup";
const char *const color_item = "m:color";
const char *const color_vaule = "color";
// Meta info tags
const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -249,10 +249,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 {

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -119,9 +119,9 @@ public:
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;

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -57,8 +57,8 @@ 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;
}
@ -75,7 +75,7 @@ aiFace ReadTriangle(XmlNode &node, int &texId0, int &texId1, int &texId2) {
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 = -1;
texId0 = texId1 = texId2 = IdNotSet;
XmlParser::getIntAttribute(node, XmlTag::p1, texId0);
XmlParser::getIntAttribute(node, XmlTag::p2, texId1);
XmlParser::getIntAttribute(node, XmlTag::p3, texId2);
@ -157,8 +157,8 @@ aiMatrix4x4 parseTransformMatrix(const 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;
}
@ -178,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;
}
@ -236,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);
@ -331,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];
}
}
}
}
}
@ -415,27 +457,36 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
for (XmlNode &currentNode : 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);
int texId[3];
Texture2DGroup *group = nullptr;
aiFace face = ReadTriangle(currentNode, texId[0], texId[1], texId[2]);
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) {
mesh->mNumUVComponents[0] = 2;
for (unsigned int i = 1; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
mesh->mNumUVComponents[i] = 0;
}
group = static_cast<Texture2DGroup *>(it->second);
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()) {
@ -443,21 +494,44 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
}
}
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);
}
}
}
// Load texture coordinates into mesh, when any
if (group != nullptr) {
size_t i0 = face.mIndices[0];
size_t i1 = face.mIndices[1];
size_t i2 = face.mIndices[2];
mesh->mTextureCoords[0][i0] = aiVector3D(group->mTex2dCoords[texId[0]].x, group->mTex2dCoords[texId[0]].y, 0.0f);
mesh->mTextureCoords[0][i1] = aiVector3D(group->mTex2dCoords[texId[1]].x, group->mTex2dCoords[texId[1]].y, 0.0f);
mesh->mTextureCoords[0][i2] = aiVector3D(group->mTex2dCoords[texId[2]].x, group->mTex2dCoords[texId[2]].y, 0.0f);
}
faces.push_back(face);
}
}
@ -598,6 +672,38 @@ 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_vaule).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) {
return;

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -57,6 +57,7 @@ class D3MFOpcPackage;
class Object;
class Texture2DGroup;
class EmbeddedTexture;
class ColorGroup;
class XmlSerializer {
public:
@ -78,6 +79,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 {

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -193,7 +193,7 @@ bool AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
// Generate a default name for both the light source and the node
// FIXME - what's the right way to print a size_t? Is 'zu' universally available? stick with the safe version.
light->mName.length = ::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");
@ -696,18 +696,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;
}
}

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -178,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 == '/'));
}
@ -213,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);
@ -403,17 +384,17 @@ void AMFImporter::ParseNode_Instance(XmlNode &node) {
for (auto &currentNode : node.children()) {
const std::string &currentName = 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();

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -168,7 +168,6 @@ public:
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);
void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString);
AMFImporter(const AMFImporter &pScene) = delete;
AMFImporter &operator=(const AMFImporter &pScene) = delete;

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, 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 &currentName = 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();

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, 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(node, als.TextureCoordinate[0].x);
} else if (name == "utex2") {
read_flag[1] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[1].x);
XmlParser::getValueAsReal(node, als.TextureCoordinate[1].x);
} else if (name == "utex3") {
read_flag[2] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[2].x);
XmlParser::getValueAsReal(node, als.TextureCoordinate[2].x);
} else if (name == "vtex1") {
read_flag[3] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[0].y);
XmlParser::getValueAsReal(node, als.TextureCoordinate[0].y);
} else if (name == "vtex2") {
read_flag[4] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[1].y);
XmlParser::getValueAsReal(node, als.TextureCoordinate[1].y);
} else if (name == "vtex3") {
read_flag[5] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[2].y);
XmlParser::getValueAsReal(node, als.TextureCoordinate[2].y);
}
}
ParseHelper_Node_Exit();
} else {
for (pugi::xml_attribute &attr : node.attributes()) {
const std::string name = attr.name();

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, 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:
@ -106,7 +105,6 @@ protected:
}
}; // class IAMFImporter_NodeElement
/// \struct CAMFImporter_NodeElement_Constellation
/// A collection of objects or constellations with specific relative locations.
struct AMFConstellation : public AMFNodeElementBase {
/// Constructor.
@ -116,7 +114,6 @@ struct AMFConstellation : public AMFNodeElementBase {
}; // struct CAMFImporter_NodeElement_Constellation
/// \struct CAMFImporter_NodeElement_Instance
/// Part of constellation.
struct AMFInstance : public AMFNodeElementBase {
@ -135,7 +132,6 @@ struct AMFInstance : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Instance, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Metadata
/// Structure that define metadata node.
struct AMFMetadata : public AMFNodeElementBase {
@ -148,7 +144,6 @@ struct AMFMetadata : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Metadata, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Root
/// Structure that define root node.
struct AMFRoot : public AMFNodeElementBase {
@ -161,7 +156,6 @@ struct AMFRoot : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Root, pParent) {}
};
/// \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.
@ -177,7 +171,6 @@ struct AMFColor : public AMFNodeElementBase {
}
};
/// \struct CAMFImporter_NodeElement_Material
/// Structure that define material node.
struct AMFMaterial : public AMFNodeElementBase {
@ -187,7 +180,6 @@ struct AMFMaterial : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Material, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Object
/// Structure that define object node.
struct AMFObject : public AMFNodeElementBase {
@ -206,7 +198,6 @@ struct AMFMesh : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Mesh, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Vertex
/// Structure that define vertex node.
struct AMFVertex : public AMFNodeElementBase {
/// Constructor.
@ -215,7 +206,6 @@ struct AMFVertex : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Vertex, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Edge
/// Structure that define edge node.
struct AMFEdge : public AMFNodeElementBase {
/// Constructor.
@ -224,7 +214,6 @@ struct AMFEdge : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Edge, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Vertices
/// Structure that define vertices node.
struct AMFVertices : public AMFNodeElementBase {
/// Constructor.
@ -233,7 +222,6 @@ struct AMFVertices : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Vertices, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Volume
/// Structure that define volume node.
struct AMFVolume : public AMFNodeElementBase {
std::string MaterialID; ///< Which material to use.
@ -245,7 +233,6 @@ struct AMFVolume : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Volume, pParent) {}
};
/// \struct CAMFImporter_NodeElement_Coordinates
/// Structure that define coordinates node.
struct AMFCoordinates : public AMFNodeElementBase {
aiVector3D Coordinate; ///< Coordinate.
@ -256,7 +243,6 @@ struct AMFCoordinates : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Coordinates, pParent) {}
};
/// \struct CAMFImporter_NodeElement_TexMap
/// Structure that define texture coordinates node.
struct AMFTexMap : public AMFNodeElementBase {
aiVector3D TextureCoordinate[3]; ///< Texture coordinates.
@ -273,7 +259,6 @@ struct AMFTexMap : public AMFNodeElementBase {
}
};
/// \struct CAMFImporter_NodeElement_Triangle
/// Structure that define triangle node.
struct AMFTriangle : public AMFNodeElementBase {
size_t V[3]; ///< Triangle vertices.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -224,7 +224,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';
@ -867,7 +868,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)

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -124,7 +124,7 @@ void ASEImporter::InternReadFile(const std::string &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;
@ -146,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();
@ -446,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);
}
// ------------------------------------------------------------------------------------------------
@ -506,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
@ -519,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"));
@ -541,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
@ -619,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)

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -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

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -391,11 +391,11 @@ public:
// -------------------------------------------------------------------
//! 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
@ -553,13 +553,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
@ -577,7 +579,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
@ -617,11 +620,8 @@ private:
bool ParseString(std::string &out, const char *szName);
public:
//! Pointer to current data
const char *filePtr;
/// The end pointer of the file data
const char *mEnd;
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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

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

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

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

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -359,7 +359,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();
@ -433,7 +433,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]++));

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -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>
@ -111,7 +107,7 @@ C4DImporter::C4DImporter() = default;
C4DImporter::~C4DImporter() = default;
// ------------------------------------------------------------------------------------------------
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;
@ -305,7 +301,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();
@ -368,8 +364,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;
@ -391,7 +387,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;
@ -434,7 +430,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;
@ -511,7 +507,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;

View File

@ -78,6 +78,8 @@ namespace Assimp {
// -------------------------------------------------------------------------------------------
class C4DImporter : public BaseImporter, public LogFunctions<C4DImporter> {
public:
C4DImporter();
~C4DImporter() override;
bool CanRead( const std::string& pFile, IOSystem*, bool checkSig) const override;
protected:

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -372,9 +372,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;

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -247,7 +247,9 @@ aiNode *ColladaLoader::BuildHierarchy(const ColladaParser &pParser, const Collad
// add children. first the *real* ones
node->mNumChildren = static_cast<unsigned int>(pNode->mChildren.size() + instances.size());
node->mChildren = new aiNode *[node->mNumChildren];
if (node->mNumChildren != 0) {
node->mChildren = new aiNode * [node->mNumChildren];
}
for (size_t a = 0; a < pNode->mChildren.size(); ++a) {
node->mChildren[a] = BuildHierarchy(pParser, pNode->mChildren[a]);
@ -623,16 +625,14 @@ aiMesh *ColladaLoader::CreateMesh(const ColladaParser &pParser, const Mesh *pSrc
}
// same for texture coords, as many as we have
// empty slots are not allowed, need to pack and adjust UV indexes accordingly
for (size_t a = 0, real = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
for (size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
if (pSrcMesh->mTexCoords[a].size() >= pStartVertex + numVertices) {
dstMesh->mTextureCoords[real] = new aiVector3D[numVertices];
dstMesh->mTextureCoords[a] = new aiVector3D[numVertices];
for (size_t b = 0; b < numVertices; ++b) {
dstMesh->mTextureCoords[real][b] = pSrcMesh->mTexCoords[a][pStartVertex + b];
dstMesh->mTextureCoords[a][b] = pSrcMesh->mTexCoords[a][pStartVertex + b];
}
dstMesh->mNumUVComponents[real] = pSrcMesh->mNumUVComponents[a];
++real;
dstMesh->mNumUVComponents[a] = pSrcMesh->mNumUVComponents[a];
}
}

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -635,7 +635,8 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &controlle
const std::string &currentName = currentNode.name();
if (currentName == "morph") {
controller.mType = Morph;
controller.mMeshId = currentNode.attribute("source").as_string();
std::string id = currentNode.attribute("source").as_string();
controller.mMeshId = id.substr(1, id.size() - 1);
int methodIndex = currentNode.attribute("method").as_int();
if (methodIndex > 0) {
std::string method;
@ -967,34 +968,34 @@ void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b);
SkipSpacesAndLineEnd(&content, end);
} else if (currentName == "constant_attenuation") {
XmlParser::getValueAsFloat(currentNode, pLight.mAttConstant);
XmlParser::getValueAsReal(currentNode, pLight.mAttConstant);
} else if (currentName == "linear_attenuation") {
XmlParser::getValueAsFloat(currentNode, pLight.mAttLinear);
XmlParser::getValueAsReal(currentNode, pLight.mAttLinear);
} else if (currentName == "quadratic_attenuation") {
XmlParser::getValueAsFloat(currentNode, pLight.mAttQuadratic);
XmlParser::getValueAsReal(currentNode, pLight.mAttQuadratic);
} else if (currentName == "falloff_angle") {
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle);
XmlParser::getValueAsReal(currentNode, pLight.mFalloffAngle);
} else if (currentName == "falloff_exponent") {
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffExponent);
XmlParser::getValueAsReal(currentNode, pLight.mFalloffExponent);
}
// FCOLLADA extensions
// -------------------------------------------------------
else if (currentName == "outer_cone") {
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
XmlParser::getValueAsReal(currentNode, pLight.mOuterAngle);
} else if (currentName == "penumbra_angle") { // this one is deprecated, now calculated using outer_cone
XmlParser::getValueAsFloat(currentNode, pLight.mPenumbraAngle);
XmlParser::getValueAsReal(currentNode, pLight.mPenumbraAngle);
} else if (currentName == "intensity") {
XmlParser::getValueAsFloat(currentNode, pLight.mIntensity);
XmlParser::getValueAsReal(currentNode, pLight.mIntensity);
}
else if (currentName == "falloff") {
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
XmlParser::getValueAsReal(currentNode, pLight.mOuterAngle);
} else if (currentName == "hotspot_beam") {
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle);
XmlParser::getValueAsReal(currentNode, pLight.mFalloffAngle);
}
// OpenCOLLADA extensions
// -------------------------------------------------------
else if (currentName == "decay_falloff") {
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
XmlParser::getValueAsReal(currentNode, pLight.mOuterAngle);
}
}
}
@ -1009,15 +1010,15 @@ void ColladaParser::ReadCamera(XmlNode &node, Collada::Camera &camera) {
if (currentName == "orthographic") {
camera.mOrtho = true;
} else if (currentName == "xfov" || currentName == "xmag") {
XmlParser::getValueAsFloat(currentNode, camera.mHorFov);
XmlParser::getValueAsReal(currentNode, camera.mHorFov);
} else if (currentName == "yfov" || currentName == "ymag") {
XmlParser::getValueAsFloat(currentNode, camera.mVerFov);
XmlParser::getValueAsReal(currentNode, camera.mVerFov);
} else if (currentName == "aspect_ratio") {
XmlParser::getValueAsFloat(currentNode, camera.mAspect);
XmlParser::getValueAsReal(currentNode, camera.mAspect);
} else if (currentName == "znear") {
XmlParser::getValueAsFloat(currentNode, camera.mZNear);
XmlParser::getValueAsReal(currentNode, camera.mZNear);
} else if (currentName == "zfar") {
XmlParser::getValueAsFloat(currentNode, camera.mZFar);
XmlParser::getValueAsReal(currentNode, camera.mZFar);
}
}
}
@ -1169,15 +1170,15 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
} else if (currentName == "mirrorV") {
XmlParser::getValueAsBool(currentNode, out.mMirrorV);
} else if (currentName == "repeatU") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.x);
XmlParser::getValueAsReal(currentNode, out.mTransform.mScaling.x);
} else if (currentName == "repeatV") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.y);
XmlParser::getValueAsReal(currentNode, out.mTransform.mScaling.y);
} else if (currentName == "offsetU") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.x);
XmlParser::getValueAsReal(currentNode, out.mTransform.mTranslation.x);
} else if (currentName == "offsetV") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.y);
XmlParser::getValueAsReal(currentNode, out.mTransform.mTranslation.y);
} else if (currentName == "rotateUV") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mRotation);
XmlParser::getValueAsReal(currentNode, out.mTransform.mRotation);
} else if (currentName == "blend_mode") {
std::string v;
XmlParser::getValueAsString(currentNode, v);
@ -1197,14 +1198,14 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
// OKINO extensions
// -------------------------------------------------------
else if (currentName == "weighting") {
XmlParser::getValueAsFloat(currentNode, out.mWeighting);
XmlParser::getValueAsReal(currentNode, out.mWeighting);
} else if (currentName == "mix_with_previous_layer") {
XmlParser::getValueAsFloat(currentNode, out.mMixWithPrevious);
XmlParser::getValueAsReal(currentNode, out.mMixWithPrevious);
}
// MAX3D extensions
// -------------------------------------------------------
else if (currentName == "amount") {
XmlParser::getValueAsFloat(currentNode, out.mWeighting);
XmlParser::getValueAsReal(currentNode, out.mWeighting);
}
}
}
@ -1264,13 +1265,13 @@ void ColladaParser::ReadEffectColor(XmlNode &node, aiColor4D &pColor, Sampler &p
// ------------------------------------------------------------------------------------------------
// Reads an effect entry containing a float
void ColladaParser::ReadEffectFloat(XmlNode &node, ai_real &pFloat) {
pFloat = 0.f;
void ColladaParser::ReadEffectFloat(XmlNode &node, ai_real &pReal) {
pReal = 0.f;
XmlNode floatNode = node.child("float");
if (floatNode.empty()) {
return;
}
XmlParser::getValueAsFloat(floatNode, pFloat);
XmlParser::getValueAsReal(floatNode, pReal);
}
// ------------------------------------------------------------------------------------------------
@ -1786,6 +1787,10 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
const Accessor *acc = input.mResolved;
if (!acc->mData) {
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource);
const size_t dataSize = acc->mOffset + acc->mCount * acc->mStride;
if (dataSize > acc->mData->mValues.size()) {
throw DeadlyImportError("Not enough data for accessor");
}
}
}
// and the same for the per-index channels
@ -1810,6 +1815,10 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
const Accessor *acc = input.mResolved;
if (!acc->mData) {
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource);
const size_t dataSize = acc->mOffset + acc->mCount * acc->mStride;
if (dataSize > acc->mData->mValues.size()) {
throw DeadlyImportError("Not enough data for accessor");
}
}
}
@ -2284,9 +2293,9 @@ void ColladaParser::ReadNodeGeometry(XmlNode &node, Node *pNode) {
urlMat++;
s.mMatName = urlMat;
ReadMaterialVertexInputBinding(instanceMatNode, s);
// store the association
instance.mMaterials[group] = s;
ReadMaterialVertexInputBinding(instanceMatNode, s);
}
}
}

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -76,6 +76,53 @@ using namespace Util;
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000LL
static void correctRootTransform(const aiScene *scene) {
if (scene == nullptr) {
return;
}
if (scene->mMetaData == nullptr) {
return;
}
int32_t UpAxis = 1, UpAxisSign = 1, FrontAxis = 2, FrontAxisSign = 1, CoordAxis = 0, CoordAxisSign = 1;
double UnitScaleFactor = 1.0;
for (unsigned MetadataIndex = 0; MetadataIndex < scene->mMetaData->mNumProperties; ++MetadataIndex) {
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UpAxis") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, UpAxis);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UpAxisSign") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, UpAxisSign);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "FrontAxis") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, FrontAxis);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "FrontAxisSign") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, FrontAxisSign);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "CoordAxis") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, CoordAxis);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "CoordAxisSign") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, CoordAxisSign);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UnitScaleFactor") == 0) {
scene->mMetaData->Get<double>(MetadataIndex, UnitScaleFactor);
}
}
aiVector3D upVec, forwardVec, rightVec;
upVec[UpAxis] = UpAxisSign * static_cast<float>(UnitScaleFactor);
forwardVec[FrontAxis] = FrontAxisSign * static_cast<float>(UnitScaleFactor);
rightVec[CoordAxis] = CoordAxisSign * (float)UnitScaleFactor;
aiMatrix4x4 mat(rightVec.x, rightVec.y, rightVec.z, 0.0f,
upVec.x, upVec.y, upVec.z, 0.0f,
forwardVec.x, forwardVec.y, forwardVec.z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
scene->mRootNode->mTransformation *= mat;
}
FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBones) :
defaultMaterialIndex(),
mMeshes(),
@ -133,6 +180,10 @@ FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBo
// need not contain geometry (i.e. camera animations, raw armatures).
if (out->mNumMeshes == 0) {
out->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
} else {
// Apply the FBX axis metadata unless requested not to
if (!doc.Settings().ignoreUpDirection)
correctRootTransform(mSceneOut);
}
}
@ -261,6 +312,8 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
child->mParent = last_parent;
last_parent = child.mNode;
new_abs_transform *= child->mTransformation;
}
// attach geometry
@ -283,6 +336,8 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
postnode->mParent = last_parent;
last_parent = postnode.mNode;
new_abs_transform *= postnode->mTransformation;
}
} else {
// free the nodes we allocated as we don't need them
@ -308,12 +363,12 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
if (nodes.empty()) {
parent->mNumChildren = 0;
parent->mChildren = nullptr;
}
parent->mChildren = new aiNode *[nodes.size()]();
parent->mNumChildren = static_cast<unsigned int>(nodes.size());
for (unsigned int i = 0; i < nodes.size(); ++i) {
parent->mChildren[i] = nodes[i].mOwnership.release();
} else {
parent->mChildren = new aiNode *[nodes.size()]();
parent->mNumChildren = static_cast<unsigned int>(nodes.size());
for (unsigned int i = 0; i < nodes.size(); ++i) {
parent->mChildren[i] = nodes[i].mOwnership.release();
}
}
}
@ -1811,7 +1866,7 @@ aiString FBXConverter::GetTexturePath(const Texture *tex) {
// We need to load all textures before referencing them, as FBX file format order may reference a texture before loading it
// This may occur on this case too, it has to be studied
path.data[0] = '*';
path.length = 1 + ASSIMP_itoa10(path.data + 1, MAXLEN - 1, index);
path.length = 1 + ASSIMP_itoa10(path.data + 1, AI_MAXLEN - 1, index);
}
}
}
@ -2079,6 +2134,10 @@ void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const TextureMap &_
TrySetTextureProperties(out_mat, _textures, "Maya|emissionColor", aiTextureType_EMISSION_COLOR, mesh);
TrySetTextureProperties(out_mat, _textures, "Maya|metalness", aiTextureType_METALNESS, mesh);
TrySetTextureProperties(out_mat, _textures, "Maya|diffuseRoughness", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
TrySetTextureProperties(out_mat, _textures, "Maya|base", aiTextureType_MAYA_BASE, mesh);
TrySetTextureProperties(out_mat, _textures, "Maya|specular", aiTextureType_MAYA_SPECULAR, mesh);
TrySetTextureProperties(out_mat, _textures, "Maya|specularColor", aiTextureType_MAYA_SPECULAR_COLOR, mesh);
TrySetTextureProperties(out_mat, _textures, "Maya|specularRoughness", aiTextureType_MAYA_SPECULAR_ROUGHNESS, mesh);
// Maya stingray
TrySetTextureProperties(out_mat, _textures, "Maya|TEX_color_map", aiTextureType_BASE_COLOR, mesh);
@ -2391,7 +2450,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial *out_mat, const PropertyTa
// setup texture reference string (copied from ColladaLoader::FindFilenameForEffectTexture)
path.data[0] = '*';
path.length = 1 + ASSIMP_itoa10(path.data + 1, MAXLEN - 1, index);
path.length = 1 + ASSIMP_itoa10(path.data + 1, AI_MAXLEN - 1, index);
}
out_mat->AddProperty(&path, (name + "|file").c_str(), aiTextureType_UNKNOWN, 0);
@ -2757,7 +2816,7 @@ void FBXConverter::ProcessMorphAnimDatas(std::map<std::string, morphAnimData *>
auto geoIt = std::find(model->GetGeometry().begin(), model->GetGeometry().end(), geo);
auto geoIndex = static_cast<unsigned int>(std::distance(model->GetGeometry().begin(), geoIt));
auto name = aiString(FixNodeName(model->Name() + "*"));
name.length = 1 + ASSIMP_itoa10(name.data + name.length, MAXLEN - 1, geoIndex);
name.length = 1 + ASSIMP_itoa10(name.data + name.length, AI_MAXLEN - 1, geoIndex);
morphAnimData *animData;
auto animIt = morphAnimDatas->find(name.C_Str());
if (animIt == morphAnimDatas->end()) {
@ -3239,9 +3298,9 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
}
if (keyframeLists[TransformationComp_Rotation].size() > 0) {
InterpolateKeys(outRotations, keytimes, keyframeLists[TransformationComp_Rotation], AI_DEG_TO_RAD(defRotation), maxTime, minTime, rotOrder);
InterpolateKeys(outRotations, keytimes, keyframeLists[TransformationComp_Rotation], defRotation, maxTime, minTime, rotOrder);
} else {
aiQuaternion defQuat = EulerToQuaternion(AI_DEG_TO_RAD(defRotation), rotOrder);
aiQuaternion defQuat = EulerToQuaternion(defRotation, rotOrder);
for (size_t i = 0; i < keyCount; ++i) {
outRotations[i].mTime = CONVERT_FBX_TIME(keytimes[i]) * anim_fps;
outRotations[i].mValue = defQuat;
@ -3263,7 +3322,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
const aiVector3D& preRotation = PropertyGet<aiVector3D>(props, "PreRotation", ok);
if (ok && preRotation.SquareLength() > zero_epsilon) {
const aiQuaternion preQuat = EulerToQuaternion(AI_DEG_TO_RAD(preRotation), Model::RotOrder_EulerXYZ);
const aiQuaternion preQuat = EulerToQuaternion(preRotation, Model::RotOrder_EulerXYZ);
for (size_t i = 0; i < keyCount; ++i) {
outRotations[i].mValue = preQuat * outRotations[i].mValue;
}
@ -3271,7 +3330,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
const aiVector3D& postRotation = PropertyGet<aiVector3D>(props, "PostRotation", ok);
if (ok && postRotation.SquareLength() > zero_epsilon) {
const aiQuaternion postQuat = EulerToQuaternion(AI_DEG_TO_RAD(postRotation), Model::RotOrder_EulerXYZ);
const aiQuaternion postQuat = EulerToQuaternion(postRotation, Model::RotOrder_EulerXYZ);
for (size_t i = 0; i < keyCount; ++i) {
outRotations[i].mValue = outRotations[i].mValue * postQuat;
}

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -69,6 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unordered_set>
#include <utility>
#include <vector>
#include <cmath>
// RESOURCES:
// https://code.blender.org/2013/08/fbx-binary-file-format-specification/
@ -1050,7 +1051,7 @@ aiNode* get_node_for_mesh(unsigned int meshIndex, aiNode* node)
aiMatrix4x4 get_world_transform(const aiNode* node, const aiScene* scene)
{
std::vector<const aiNode*> node_chain;
while (node != scene->mRootNode) {
while (node != scene->mRootNode && node != nullptr) {
node_chain.push_back(node);
node = node->mParent;
}
@ -1062,7 +1063,7 @@ aiMatrix4x4 get_world_transform(const aiNode* node, const aiScene* scene)
}
inline int64_t to_ktime(double ticks, const aiAnimation* anim) {
if (anim->mTicksPerSecond <= 0) {
if (FP_ZERO == std::fpclassify(anim->mTicksPerSecond)) {
return static_cast<int64_t>(ticks) * FBX::SECOND;
}
return (static_cast<int64_t>(ticks / anim->mTicksPerSecond)) * FBX::SECOND;
@ -1088,6 +1089,8 @@ void FBXExporter::WriteObjects ()
bool bJoinIdenticalVertices = mProperties->GetPropertyBool("bJoinIdenticalVertices", true);
std::vector<std::vector<int32_t>> vVertexIndice;//save vertex_indices as it is needed later
const auto bTransparencyFactorReferencedToOpacity = mProperties->GetPropertyBool(AI_CONFIG_EXPORT_FBX_TRANSPARENCY_FACTOR_REFER_TO_OPACITY, false);
// geometry (aiMesh)
mesh_uids.clear();
indent = 1;
@ -1214,10 +1217,8 @@ void FBXExporter::WriteObjects ()
}
// colors, if any
// TODO only one color channel currently
const int32_t colorChannelIndex = 0;
if (m->HasVertexColors(colorChannelIndex)) {
FBX::Node vertexcolors("LayerElementColor", int32_t(colorChannelIndex));
for (size_t ci = 0; ci < m->GetNumColorChannels(); ++ci) {
FBX::Node vertexcolors("LayerElementColor", int32_t(ci));
vertexcolors.Begin(outstream, binary, indent);
vertexcolors.DumpProperties(outstream, binary, indent);
vertexcolors.EndProperties(outstream, binary, indent);
@ -1227,7 +1228,7 @@ void FBXExporter::WriteObjects ()
"Version", int32_t(101), outstream, binary, indent
);
char layerName[8];
snprintf(layerName, sizeof(layerName), "COLOR_%d", colorChannelIndex);
snprintf(layerName, sizeof(layerName), "COLOR_%d", int32_t(ci));
FBX::Node::WritePropertyNode(
"Name", (const char*)layerName, outstream, binary, indent
);
@ -1244,7 +1245,7 @@ void FBXExporter::WriteObjects ()
for (size_t fi = 0; fi < m->mNumFaces; ++fi) {
const aiFace &f = m->mFaces[fi];
for (size_t pvi = 0; pvi < f.mNumIndices; ++pvi) {
const aiColor4D &c = m->mColors[colorChannelIndex][f.mIndices[pvi]];
const aiColor4D &c = m->mColors[ci][f.mIndices[pvi]];
color_data.push_back(c.r);
color_data.push_back(c.g);
color_data.push_back(c.b);
@ -1351,11 +1352,14 @@ void FBXExporter::WriteObjects ()
le.AddChild("Type", "LayerElementNormal");
le.AddChild("TypedIndex", int32_t(0));
layer.AddChild(le);
// TODO only 1 color channel currently
le = FBX::Node("LayerElement");
le.AddChild("Type", "LayerElementColor");
le.AddChild("TypedIndex", int32_t(0));
layer.AddChild(le);
for (size_t ci = 0; ci < m->GetNumColorChannels(); ++ci) {
le = FBX::Node("LayerElement");
le.AddChild("Type", "LayerElementColor");
le.AddChild("TypedIndex", int32_t(ci));
layer.AddChild(le);
}
le = FBX::Node("LayerElement");
le.AddChild("Type", "LayerElementMaterial");
le.AddChild("TypedIndex", int32_t(0));
@ -1444,13 +1448,21 @@ void FBXExporter::WriteObjects ()
// "TransparentColor" / "TransparencyFactor"...
// thanks FBX, for your insightful interpretation of consistency
p.AddP70colorA("TransparentColor", c.r, c.g, c.b);
// TransparencyFactor defaults to 0.0, so set it to 1.0.
// note: Maya always sets this to 1.0,
// so we can't use it sensibly as "Opacity".
// In stead we rely on the legacy "Opacity" value, below.
// Blender also relies on "Opacity" not "TransparencyFactor",
// probably for a similar reason.
p.AddP70numberA("TransparencyFactor", 1.0);
if (!bTransparencyFactorReferencedToOpacity) {
// TransparencyFactor defaults to 0.0, so set it to 1.0.
// note: Maya always sets this to 1.0,
// so we can't use it sensibly as "Opacity".
// In stead we rely on the legacy "Opacity" value, below.
// Blender also relies on "Opacity" not "TransparencyFactor",
// probably for a similar reason.
p.AddP70numberA("TransparencyFactor", 1.0);
}
}
if (bTransparencyFactorReferencedToOpacity) {
if (m->Get(AI_MATKEY_OPACITY, f) == aiReturn_SUCCESS) {
p.AddP70numberA("TransparencyFactor", 1.0 - f);
}
}
if (m->Get(AI_MATKEY_COLOR_REFLECTIVE, c) == aiReturn_SUCCESS) {
p.AddP70colorA("ReflectionColor", c.r, c.g, c.b);
@ -1748,7 +1760,7 @@ void FBXExporter::WriteObjects ()
int64_t blendshape_uid = generate_uid();
mesh_uids.push_back(blendshape_uid);
bsnode.AddProperty(blendshape_uid);
bsnode.AddProperty(blendshape_name + FBX::SEPARATOR + "Blendshape");
bsnode.AddProperty(blendshape_name + FBX::SEPARATOR + "Geometry");
bsnode.AddProperty("Shape");
bsnode.AddChild("Version", int32_t(100));
bsnode.Begin(outstream, binary, indent);
@ -1857,33 +1869,26 @@ void FBXExporter::WriteObjects ()
// one sticky point is that the number of vertices may not match,
// because assimp splits vertices by normal, uv, etc.
// functor for aiNode sorting
struct SortNodeByName
{
bool operator()(const aiNode *lhs, const aiNode *rhs) const
{
return strcmp(lhs->mName.C_Str(), rhs->mName.C_Str()) < 0;
}
};
// first we should mark the skeleton for each mesh.
// the skeleton must include not only the aiBones,
// but also all their parent nodes.
// anything that affects the position of any bone node must be included.
// Use SorNodeByName to make sure the exported result will be the same across all systems
// Otherwise the aiNodes of the skeleton would be sorted based on the pointer address, which isn't consistent
std::vector<std::set<const aiNode*, SortNodeByName>> skeleton_by_mesh(mScene->mNumMeshes);
// note that we want to preserve input order as much as possible here.
// previously, sorting by name lead to consistent output across systems, but was not
// suitable for downstream consumption by some applications.
std::vector<std::vector<const aiNode*>> skeleton_by_mesh(mScene->mNumMeshes);
// at the same time we can build a list of all the skeleton nodes,
// which will be used later to mark them as type "limbNode".
std::unordered_set<const aiNode*> limbnodes;
//actual bone nodes in fbx, without parenting-up
std::unordered_set<std::string> setAllBoneNamesInScene;
for(unsigned int m = 0; m < mScene->mNumMeshes; ++ m)
{
std::vector<std::string> allBoneNames;
for(unsigned int m = 0; m < mScene->mNumMeshes; ++ m) {
aiMesh* pMesh = mScene->mMeshes[m];
for(unsigned int b = 0; b < pMesh->mNumBones; ++ b)
setAllBoneNamesInScene.insert(pMesh->mBones[b]->mName.data);
allBoneNames.push_back(pMesh->mBones[b]->mName.data);
}
aiMatrix4x4 mxTransIdentity;
@ -1891,7 +1896,7 @@ void FBXExporter::WriteObjects ()
std::map<std::string,aiNode*> node_by_bone;
for (size_t mi = 0; mi < mScene->mNumMeshes; ++mi) {
const aiMesh* m = mScene->mMeshes[mi];
std::set<const aiNode*, SortNodeByName> skeleton;
std::vector<const aiNode*> skeleton;
for (size_t bi =0; bi < m->mNumBones; ++bi) {
const aiBone* b = m->mBones[bi];
const std::string name(b->mName.C_Str());
@ -1910,7 +1915,7 @@ void FBXExporter::WriteObjects ()
node_by_bone[name] = n;
limbnodes.insert(n);
}
skeleton.insert(n);
skeleton.push_back(n);
// mark all parent nodes as skeleton as well,
// up until we find the root node,
// or else the node containing the mesh,
@ -1921,7 +1926,7 @@ void FBXExporter::WriteObjects ()
parent = parent->mParent
) {
// if we've already done this node we can skip it all
if (skeleton.count(parent)) {
if (std::find(skeleton.begin(), skeleton.end(), parent) != skeleton.end()) {
break;
}
// ignore fbx transform nodes as these will be collapsed later
@ -1931,7 +1936,7 @@ void FBXExporter::WriteObjects ()
continue;
}
//not a bone in scene && no effect in transform
if(setAllBoneNamesInScene.find(node_name)==setAllBoneNamesInScene.end()
if (std::find(allBoneNames.begin(), allBoneNames.end(), node_name) == allBoneNames.end()
&& parent->mTransformation == mxTransIdentity) {
continue;
}
@ -2016,7 +2021,7 @@ void FBXExporter::WriteObjects ()
aiMatrix4x4 mesh_xform = get_world_transform(mesh_node, mScene);
// now make a subdeformer for each bone in the skeleton
const std::set<const aiNode*, SortNodeByName> skeleton= skeleton_by_mesh[mi];
const auto & skeleton= skeleton_by_mesh[mi];
for (const aiNode* bone_node : skeleton) {
// if there's a bone for this node, find it
const aiBone* b = nullptr;
@ -2482,6 +2487,57 @@ const std::map<std::string,std::pair<std::string,char>> transform_types = {
{"GeometricScalingInverse", {"GeometricScalingInverse", 'i'}}
};
//add metadata to fbx property
void add_meta(FBX::Node& fbx_node, const aiNode* node){
if(node->mMetaData == nullptr) return;
aiMetadata* meta = node->mMetaData;
for (unsigned int i = 0; i < meta->mNumProperties; ++i) {
aiString key = meta->mKeys[i];
aiMetadataEntry* entry = &meta->mValues[i];
switch (entry->mType) {
case AI_BOOL:{
bool val = *static_cast<bool *>(entry->mData);
fbx_node.AddP70bool(key.C_Str(), val);
break;
}
case AI_INT32:{
int32_t val = *static_cast<int32_t *>(entry->mData);
fbx_node.AddP70int(key.C_Str(), val);
break;
}
case AI_UINT64:{
//use string to add uint64
uint64_t val = *static_cast<uint64_t *>(entry->mData);
fbx_node.AddP70string(key.C_Str(), std::to_string(val).c_str());
break;
}
case AI_FLOAT:{
float val = *static_cast<float *>(entry->mData);
fbx_node.AddP70double(key.C_Str(), val);
break;
}
case AI_DOUBLE:{
double val = *static_cast<double *>(entry->mData);
fbx_node.AddP70double(key.C_Str(), val);
break;
}
case AI_AISTRING:{
aiString val = *static_cast<aiString *>(entry->mData);
fbx_node.AddP70string(key.C_Str(), val.C_Str());
break;
}
case AI_AIMETADATA: {
//ignore
break;
}
default:
break;
}
}
}
// write a single model node to the stream
void FBXExporter::WriteModelNode(
StreamWriterLE& outstream,
@ -2549,6 +2605,7 @@ void FBXExporter::WriteModelNode(
}
}
}
add_meta(p, node);
m.AddChild(p);
// not sure what these are for,

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -156,6 +156,9 @@ struct ImportSettings {
/** Set to true to perform a conversion from cm to meter after the import
*/
bool convertToMeters;
// Set to true to ignore the axis configuration in the file
bool ignoreUpDirection = false;
};
} // namespace FBX

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -117,6 +117,7 @@ void FBXImporter::SetupProperties(const Importer *pImp) {
mSettings.useLegacyEmbeddedTextureNaming = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING, false);
mSettings.removeEmptyBones = pImp->GetPropertyBool(AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES, true);
mSettings.convertToMeters = pImp->GetPropertyBool(AI_CONFIG_FBX_CONVERT_TO_M, false);
mSettings.ignoreUpDirection = pImp->GetPropertyBool(AI_CONFIG_IMPORT_FBX_IGNORE_UP_DIRECTION, false);
mSettings.useSkeleton = pImp->GetPropertyBool(AI_CONFIG_FBX_USE_SKELETON_BONE_CONTAINER, false);
}

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.
@ -644,10 +644,12 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
return;
}
// materials are handled separately. First of all, they are assigned per-face
// and not per polyvert. Secondly, ReferenceInformationType=IndexToDirect
// has a slightly different meaning for materials.
ParseVectorDataArray(materials_out,GetRequiredElement(source,"Materials"));
if (source["Materials"]) {
// materials are handled separately. First of all, they are assigned per-face
// and not per polyvert. Secondly, ReferenceInformationType=IndexToDirect
// has a slightly different meaning for materials.
ParseVectorDataArray(materials_out, GetRequiredElement(source, "Materials"));
}
if (MappingInformationType == "AllSame") {
// easy - same material for all faces

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2023, assimp team
Copyright (c) 2006-2024, assimp team
All rights reserved.

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