Compare commits

..

1813 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
Kim Kulling f956351942
Fix crash in viewer (#5446) 2024-01-30 22:14:18 +01:00
Kim Kulling c08e3b4abb
Add bounds checks to the parsing utilities. (#5421)
* Add bounds checks to the parsing utilities.

* Fix merge conflicts in ACLoader.

* Fix loaders

* Fix unittest of AC-Loader.

* Remove dead code.

* Md5Parser fixes

* Fix md5-parsing

* Fix Merge conflict

* Fix merge conflicts.

* Md5: Fix warning: missing return statement.
2024-01-30 14:32:41 +01:00
Kim Kulling d5f35582d4 Introduce aiBuffer
We have a lot of parsing tools which are not doing any kind of bound checking. This is the first approach to solve these issues.
2024-01-30 10:43:03 +01:00
tigertang a02085ea98 Update StbCommon.h to stay up-to-date with stb_image.h.
This enables C++ API users to statically link Assimp into their projects along with stb_image.
2024-01-29 13:52:54 +01:00
Kim Kulling a8d30f7e91 Update DXFLoader.cpp
revert it
2024-01-27 12:14:35 +01:00
Kim Kulling c6fe03f7a5 Update DXFLoader.cpp
- Use constexpr instead of const.
2024-01-27 12:14:35 +01:00
seanth 8cde65bfe8 Updated AIC table
The previous table was in an incorrect order, leading to index references in DXF producing the wrong colours when converted.

Also added other entries to bring the total number of ACI colours up  to the number that can be used in DXF files
2024-01-27 12:14:35 +01:00
seanth 240fa97fed Update DXFLoader.cpp
Changed order of operations for insert positioning and scaling. Need to position the inserts before scaling it, otherwise the position ends up up being position*scale
2024-01-27 12:14:35 +01:00
seanth 727001b0ca Update DXFLoader.cpp
Edited out line suspected to be causing changes in position when changes in scale are made to inserted BLOCKS
2024-01-27 12:14:35 +01:00
julianknodt bdc08dd4a9 Encode full weight as double 2024-01-27 10:10:28 +01:00
Stephen Gold ac29847d56 Readme.md: present the web links in a more uniform style 2024-01-12 10:59:34 +01:00
Robert Reif 81c20a5c61 Improve acc file loading
Add warning and support for tolerating a common problem where objects have wrong kid count.
Add support for empty texture layers.
2024-01-09 21:13:13 +01:00
Andre Schulz 74af43f655 Add unit test for X3D IndexedLineSet
Unit test for issue #3101

Thanks to @mvidiassov for the X3D test file!
2024-01-09 20:55:51 +01:00
Andre Schulz 9d71a275c3 X3D: Don't convert IndexedLineSet polylines with > 2 indices to triangles/polygons
Currently, when the coordIndex attribute of an IndexedLineSet contains a
polyline with > 2 indices, X3DGeoHelper::coordIdx_str2faces_arr() will
incorrectly determine the primitive type to be aiPrimitiveType_TRIANGLE or
aiPrimitiveType_POLYGON instead of aiPrimitiveType_LINE.

To fix this, this commit adds functions to explicitly handle an IndexedLineSet.

Fixes #3101
2024-01-09 20:55:51 +01:00
Kim Kulling c8ca1a48ec Update Dockerfile
- closes https://github.com/assimp/assimp/issues/5403
2024-01-08 10:18:16 +01:00
Steve M ea9aa863ff Increase texture variety 2024-01-07 20:16:19 +01:00
Steve M cb8150b3e8 Add missing textures and reduce texture sprawl 2024-01-07 20:16:19 +01:00
copycd b571501559 @ error
Cause a TypeError when arg is UNSET
2024-01-06 20:57:41 +01:00
Hamza 6a0e1d5467 fix building errors for MinGW 2024-01-05 22:01:58 +01:00
tangxin 9776d47cca fix: KHR_materials_pbrSpecularGlossiness/diffuseFactor convert to pbrMetallicRoughness/baseColorFactor 2024-01-05 21:49:21 +01:00
dependabot[bot] ec122eb348 Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...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>
2023-12-31 12:00:16 +01:00
copycd 6bcdf989fb Triangle value is null-error, I don't know why it happened. 2023-12-31 10:31:44 +01:00
Kim Kulling 5cbdb6c63b Build: Disable building zlib for non-windows
- closes https://github.com/assimp/assimp/issues/5340
2023-12-29 17:37:59 +01:00
Kim Kulling 636fbd65b3 Refactorings: come code cleanups 2023-12-29 16:55:37 +01:00
Kim Kulling 263bebb5ba Add a test before generating the txture folder 2023-12-29 16:55:37 +01:00
Kim Kulling 5d5496f1ad Update MDLMaterialLoader.cpp 2023-12-22 13:23:08 +01:00
Kim Kulling 69dae9599a Fix integer overflow
- closes https://github.com/assimp/assimp/issues/4930
2023-12-22 13:23:08 +01:00
Kim Kulling 9dddef9b9d Update D3MFImporter.cpp 2023-12-22 10:49:54 +01:00
Kim Kulling b9576e6992 Update D3MFImporter.cpp 2023-12-22 10:49:54 +01:00
Kim Kulling 274f64cbf1 Check validity of archive without parsing
- closes https://github.com/assimp/assimp/issues/5392
2023-12-22 10:49:54 +01:00
Kim Kulling 7b54b0f406 Fix leak
- closes https://github.com/assimp/assimp/issues/5390
2023-12-21 21:18:38 +01:00
Alexander Wagner df33d33e8f - removed commented code 2023-12-20 20:55:04 +01:00
Marka Ragnos 3ce8a58d41 Update DefaultIOSystem.cpp
Added missing whitespace
2023-12-20 20:55:04 +01:00
Alexander Wagner d03ab3ef27 - fixed Exist function on Linux 2023-12-20 20:55:04 +01:00
Alexander Wagner e86f1acb9b - fixed q3bsp issue 2023-12-20 20:55:04 +01:00
Alexander Wagner 4034df8b6e - removed unused include 2023-12-20 20:55:04 +01:00
Kim Kulling 88084a67fc Disable Hunter 2023-12-20 20:13:47 +01:00
Alexey Medvedev 762ad8e9b7 glTF KHR_materials_specular fixes 2023-12-11 11:09:18 +01:00
Alexey Medvedev dc399f7343 glTF KHR_materials_specular fixes 2023-12-11 11:09:18 +01:00
Alexey Medvedev a72289b327 glTF KHR_materials_specular fixes 2023-12-11 11:09:18 +01:00
Stephen Gold 213d73ebc6 correct grammar/typographic errors in comments (8 files) 2023-12-04 23:58:54 +01:00
Futuremappermydud a0b3df6dbd Fix target names not being imported on some gLTF2 models 2023-12-04 21:11:55 +01:00
Stephen Gold 769e82ce5e FBXMeshGeometry: solve issue #5116 using patch provided by darktjm 2023-12-04 20:57:10 +01:00
Maksim Kostin d311fa95c6 Fix double free in Video::~Video() 2023-12-01 11:14:22 +01:00
Stephen Gold e765862d24 Readme.md: correct 2 errors in section headers 2023-11-30 16:06:57 +01:00
Maksim Kostin f701d702e4 Fix buffer overflow in FBX::Util::DecodeBase64() 2023-11-29 11:12:39 +01:00
ccn a63a6011c5 Update Build.md
Add more details about the default build.
2023-11-29 10:55:08 +01:00
IOhannes m zmölnig 6f715edfa0 Drop disabled zlib.h inclusion stubs 2023-11-29 09:53:03 +01:00
IOhannes m zmölnig bfdd154d14 Always include "zlib.h" (rather than .../contrib/zlib/zlib.h)
The path to the vendored zlib is set by the build-system,
so there's no need to add additional preprocessor magic
2023-11-29 09:53:03 +01:00
IOhannes m zmölnig 6f70e220e4 always include "utf8.h" (instead of contrib/.../utf8.h) 2023-11-29 09:53:03 +01:00
Kim Kulling 85f64c9131 Use correct time scaling 2023-11-28 21:10:18 +01:00
Kim Kulling 01f2549abe Fix the build 2023-11-28 20:49:10 +01:00
Kim Kulling 384db8686e Update FBXConverter.cpp
- Temporary fix bind pose storage in offset matrix
- Will close https://github.com/assimp/assimp/issues/5132
2023-11-28 20:49:10 +01:00
Kim Kulling 77a8f019e3 Fix: Check if index for mesh access is out of range 2023-11-22 10:14:26 +01:00
ccn 254619901b Update Readme.md
improve link formatting
2023-11-22 09:18:35 +01:00
ccn 56e0ba58e1 Update Readme.md
fix link in readme
2023-11-20 10:24:02 +01:00
Alexandre Avenel e4e2c63e0c Fix heap-buffer overflow in PLY parser 2023-11-20 08:43:17 +01:00
Alexandre Avenel bfe8745b90 Add as unit-test an invalid PLY model triggering heap-buffer-overflow
==23896==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x12f9daec1827 at pc 0x7ffcad83699c bp 0x00c61574c910 sp 0x00c61574c910
READ of size 1 at 0x12f9daec1827 thread T0
==23896==WARNING: Failed to use and restart external symbolizer!
    #0 0x7ffcad83699b in Assimp::IOStreamBuffer<char>::getNextLine C:\Users\aavenel\Dev\assimp\include\assimp\IOStreamBuffer.h:299
    #1 0x7ffcad83ce69 in Assimp::PLY::DOM::ParseHeader C:\Users\aavenel\Dev\assimp\code\AssetLib\Ply\PlyParser.cpp:428
    #2 0x7ffcad83d58e in Assimp::PLY::DOM::ParseInstanceBinary C:\Users\aavenel\Dev\assimp\code\AssetLib\Ply\PlyParser.cpp:498
    #3 0x7ffcad83302a in Assimp::PLYImporter::InternReadFile C:\Users\aavenel\Dev\assimp\code\AssetLib\Ply\PlyLoader.cpp:189
    #4 0x7ffcad4f2f48 in Assimp::BaseImporter::ReadFile C:\Users\aavenel\Dev\assimp\code\Common\BaseImporter.cpp:135
    #5 0x7ffcad51ee46 in Assimp::Importer::ReadFile C:\Users\aavenel\Dev\assimp\code\Common\Importer.cpp:709
    #6 0x7ff7dd8f9f1a in ImportModel C:\Users\aavenel\Dev\assimp\tools\assimp_cmd\Main.cpp:307
    #7 0x7ff7dd8fdf9e in Assimp_Info C:\Users\aavenel\Dev\assimp\tools\assimp_cmd\Info.cpp:344
    #8 0x7ff7dd8fc04f in main C:\Users\aavenel\Dev\assimp\tools\assimp_cmd\Main.cpp:222
    #9 0x7ff7dd9030eb in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #10 0x7ffd39e57343 in BaseThreadInitThunk+0x13 (C:\WINDOWS\System32\KERNEL32.DLL+0x180017343)
    #11 0x7ffd3a2626b0 in RtlUserThreadStart+0x20 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x1800526b0)
2023-11-20 08:43:17 +01:00
Alexandre Avenel aae93691b9 Fix container overflow in MMD parser
Using reserve, buffer size is not updated. Since data is directly inserted and not using push_pack,
this can lead to a container overflow.
2023-11-17 14:33:17 +01:00
Florian Born 6004290dde Use the correct allocator for deleting objects in case of duplicate animation Ids 2023-11-16 10:02:16 +01:00
Wojciech Matyjewicz 069e19487c Fix parsing <init_from> in <image>.
The regression was introduced in 21678df.
2023-11-16 08:50:10 +01:00
Wojciech Matyjewicz 2235518b3c Fix parsing <instance_image> in <sampler2D>.
The regression was introduced in 904f17f.

Since all the cases are now fully handled at the child level,
visiting the whole subtree is changed into iteration over the children.
2023-11-16 08:50:10 +01:00
copycd 8648c2af45 fix mesh-name error. 2023-11-15 13:04:10 +01:00
Kim Kulling f0e7448fdc Remove double delete 2023-11-14 22:09:56 +01:00
julianknodt 9efbbe0a69 Read int from uvwsrc
Previously was reading a uint, which always failed. Since the output was never checked, this
seemed to work, and works fine for most models since they only use UV channel 0.
2023-11-14 16:31:56 +01:00
Kim Kulling 4535e37fc6 Fix namespaces. 2023-11-12 21:09:33 +01:00
Kim Kulling 8cf2d6e588 Refactoring: Some cleanups 2023-11-12 21:09:33 +01:00
Kim Kulling aa3abb3c06 Fix warning: remove printf 2023-11-10 15:36:40 +01:00
Kim Kulling 0b0ec713f6 Fix empty mesh handling 2023-11-10 15:36:40 +01:00
julianknodt 28ab0a094a Fix incorrect deg->radian conversion
It seems that rotation matrices later expect radians.
This conversion breaks it, and was validated on the conversion of
`cesium_man.glb` --> `cesium_man.fbx`
2023-11-07 20:06:16 +01:00
Tárcio Vinícius 46b19cc6a4 utf8 header not found 2023-11-06 16:09:53 +01:00
Martin Aumüller a521b23ab5 link to external minizip with full path
This let's cmake create config files that allow linking to minizip even when
in an unrelated prefix. This can happen with package managers that install
every package into their own prefix, such as [Spack](https://spack.io).
2023-11-06 09:55:25 +01:00
Kim Kulling 108e3192a2 Update FBXBinaryTokenizer.cpp
- closes https://github.com/assimp/assimp/issues/5072
2023-11-05 17:57:29 +01:00
Kim Kulling f844c3397d Fix add checks for indices 2023-11-03 12:40:08 +01:00
Pavel Lukandiy a7cfa3264a Fix: Implicit Conversion Error 2023-11-02 16:19:42 +01:00
Kim Kulling c1deb808fa Fix: Remove incorrect final statements 2023-10-29 10:05:25 +01:00
Kim Kulling 25aee03f66 Fix: Add missing transformation for normalized normals. 2023-10-29 10:05:25 +01:00
Sébastien Loriot c44e3427aa use size in order to be compatible with float and double 2023-10-24 14:02:38 +01:00
julianknodt 1169d3bc8c Fix spelling error 2023-10-24 09:34:36 +01:00
David Marčinković 945c77d699 Fix double free when the mesh contains duplicate bones. 2023-10-21 08:11:37 +01:00
Kim Kulling 020554e213 Update Readme.md
- Fix typos
- Remove deprecated badges
- Add the new experimental viewer
2023-10-14 11:42:24 +01:00
Kim Kulling 2a347014f3 Update ImproveCacheLocality.cpp 2023-10-08 18:35:08 +00:00
Kim Kulling a531c72f7f Update ImproveCacheLocality.cpp
- closes https://github.com/assimp/assimp/issues/5262
2023-10-08 18:35:08 +00:00
Kawashima Satoshi 666ecd3f1f Bug Fix:
Failed to get floating values (e.g. opacity) from scene material when ASSIMP_DOUBLE_PRECISION is defined, so they are not reflected to output fbx file.
2023-10-08 15:21:26 +00:00
Kim Kulling 5d60cf228a Fix: Waning implicite cast 2023-10-08 14:43:53 +00:00
Kim Kulling 2f78d48d6b Fix: Warning implicite convertion 2023-10-08 14:43:53 +00:00
Kim Kulling 3c1423d5a5 Replace uint by unsigned int 2023-10-08 14:43:53 +00:00
Kim Kulling 1ee13872b1 Update utglTF2ImportExport.cpp 2023-10-08 14:43:53 +00:00
Kim Kulling 01322ec831 Fix Warning: Use float instead of double 2023-10-08 14:43:53 +00:00
fvbj 8fcc65a8af Extension of data export to GLB/GLTF format
Allows to export unlimited (more than 4) bones per vertex
Use JOINTS_1,2,.. and WEIGHTS_1,2,...
Added AI_CONFIG_EXPORT_GLTF_UNLIMITED_SKINNING_BONES_PER_VERTEX flag
2023-10-08 14:43:53 +00:00
Kim Kulling 5b8cfa920b Replace an assert by a error log. 2023-10-02 11:31:18 +02:00
Kim Kulling d7cde43367 Fix: Add check for invalid input argument 2023-10-02 10:41:50 +02:00
ockeymm 7b6bf139cf include memory.h to fix compile error 2023-10-01 16:11:20 +02:00
ockeymm b2bfe6d253 Use unique_ptr to release old vertices data. 2023-10-01 16:11:20 +02:00
ockeymm 7a4d8ec412 Reduce memory consumption in JoinVerticesProcess::ProcessMesh() significantly 2023-10-01 16:11:20 +02:00
Begasus 7a26433846 Fix building on Haiku 2023-09-28 13:59:19 +02:00
mosfet80 6a08c39e3a Update CMakeLists.txt
updated cpp-pm/hunter to last version
2023-09-25 16:46:51 +02:00
Stephen Gold 4b193dbee3 contrib/zip/src/zip.h: correct 2 spelling errors 2023-09-25 16:28:24 +02:00
Kim Kulling f9d3e7015b Update types.h
- closes https://github.com/assimp/assimp/issues/5247
2023-09-25 14:22:00 +02:00
mosfet80 f1b8df01d5 fix variable name 2023-09-25 13:37:01 +02:00
Kim Kulling c421247be9 Update utVersion.cpp 2023-09-23 18:35:48 +02:00
Kim Kulling cebb06280d Update script_x86.iss 2023-09-23 18:35:48 +02:00
Kim Kulling 967d61edc5 Update script_x64.iss 2023-09-23 18:35:48 +02:00
Kim Kulling 997d380c3a Update script_vieweronly.iss 2023-09-23 18:35:48 +02:00
Kim Kulling 13945a5c5b Update CMakeLists.txt 2023-09-23 18:35:48 +02:00
Kim Kulling e5e3e07b84 Fix copyrights. 2023-09-23 18:35:48 +02:00
Kim Kulling bad725ec86 Fix: Fix versions 2023-09-23 18:35:48 +02:00
Kim Kulling fb23ef7c02 Update: Update code version 2023-09-23 18:35:48 +02:00
Kim Kulling 0c5138cb39 Update: Set new versions 2023-09-23 18:35:48 +02:00
Kim Kulling 9d12dd6df3 Doc: Add wiki link
- closes https://github.com/assimp/assimp/issues/5240
2023-09-22 11:03:19 +02:00
Kim Kulling 7fb4b24cb5 Update googletest to 1.14.0 2023-09-19 09:01:04 +02:00
Батхишиг fa71b84c1c
ai_epsilon bug fixed in C (#5231) 2023-09-18 14:48:30 +02:00
Kim Kulling 59b1234496
Update GenVertexNormalsProcess.cpp (#5228)
- closes https://github.com/assimp/assimp/issues/5074
2023-09-14 00:37:13 +02:00
FailCake f9f7ab0658
Fix draco build path (#5222)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
2023-09-13 21:42:52 +02:00
dependabot[bot] c7307ae84d
Bump actions/checkout from 3 to 4 (#5224)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  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>
2023-09-12 13:28:14 +02:00
Kim Kulling c4d3c1dd67
Fix: Remove useless parameter to specify c++ lib (#5225)
- closes https://github.com/assimp/assimp/issues/5197
2023-09-11 14:41:22 +02:00
Kim Kulling 2af4247260
Fix: Fix compilation for clang 14.0.3 (#5223)
* Fix: Fix compilation for clang 14.0.3

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

* Update mesh.h

* Update mesh.h

Fix a typo.
2023-09-11 10:51:51 +02:00
Kim Kulling aa1996e143
Mosfet80 clipper update (#5220)
* remove deprecated sprinf

* Update clipper
Updated Clipper to V6.4.2

* Fix the build

* Fix the build

* Disable hunter build

* Fix: Fix hided var.

* Fix invalid use of hunter enabled macro.

* Fix misconfig for hunter

* Disable removing contrib folder

* Update BlenderTessellator.h

* Remove Hunter-based includes

* Refactorings

* Remove final

* Update IFCCurve.cpp

* Update IFCCurve.cpp

---------

Co-authored-by: andrea <realeandrea@yahoo.it>
Co-authored-by: Kim Kulling <kim.kullingk@draeger.com>
2023-09-09 19:29:15 +02:00
Kim Kulling 3cf7d28bc4
Merge pull request #5221 from mosfet80/patch-4
Update sanitizer.yml
2023-09-07 15:58:40 +02:00
mosfet80 c3544f1f98
Update sanitizer.yml
updated actions/checkout to v4
Update default runtime to node20 by @takost in #1436
Support fetching without the --progress option by @simonbaird in #1067
Release 4.0.0 by @takost in #1447
2023-09-06 14:54:46 +02:00
Kim Kulling 0ff0bd7a6e
Merge pull request #5118 from kenichiice/dxf/negative-index
DXF: Support negative index in VERTEX
2023-09-01 15:54:39 +02:00
OGAWA KenIchi 8d8a0a5af7 DXF: Support negative index in VERTEX 2023-09-01 18:26:53 +09:00
Kim Kulling e673d1fd9e
Merge pull request #5216 from assimp/semi-desert-master
Semi desert master
2023-08-30 21:31:55 +02:00
Kim Kulling e41fe74b2a Merge branch 'master' into semi-desert-master 2023-08-30 21:17:25 +02:00
Kim Kulling 8c8f974ea3 Merge branch 'master' of https://github.com/semi-desert/assimp into semi-desert-master 2023-08-30 21:16:21 +02:00
Kim Kulling f623870dd1
Merge pull request #5170 from vulcanozz/vulcano/export_gltf2_with_roughness_texture
Add DIFFUSE_ROUGHNESS_TEXTURE for gltf2 exporter
2023-08-29 15:27:55 +02:00
Kim Kulling e79d105957
Merge branch 'master' into vulcano/export_gltf2_with_roughness_texture 2023-08-29 15:13:43 +02:00
Kim Kulling 0afaf976b9
Merge pull request #5192 from PencilAmazing/irrfix
IRR - Fix UTF-16 file parsing (and possibly more?)
2023-08-29 15:11:06 +02:00
Kim Kulling b52731c707
Merge branch 'master' into irrfix 2023-08-29 14:22:22 +02:00
Kim Kulling 97227d7a4c
Merge pull request #5193 from martinweber/collada-ignore-unit-size-property
Collada: added import property to disable unit size scaling
2023-08-29 14:15:50 +02:00
Kim Kulling cc2c5d3ae3
Merge branch 'master' into collada-ignore-unit-size-property 2023-08-29 14:01:40 +02:00
Kim Kulling 2f6f58707d
Merge pull request #5161 from malytomas/master
fix incorrect default for material::get with aiColor3D
2023-08-28 11:45:54 +02:00
Kim Kulling b9ea538e6f
Merge branch 'master' into master 2023-08-28 11:11:50 +02:00
Kim Kulling 215caa65aa
Merge branch 'master' into irrfix 2023-08-25 00:01:15 +02:00
Kim Kulling 80a03071ba
Merge pull request #5209 from sashashura/openddlparser
bump openddl-parser to v0.5.1
2023-08-25 00:00:39 +02:00
Kim Kulling fa69c47d45
Merge branch 'master' into openddlparser 2023-08-24 23:46:23 +02:00
Kim Kulling fe6730f225
Merge pull request #5212 from guguTang/xin-issue_5211
Ensure that the strength attribute is the same when importing or exporting gltf2
2023-08-24 23:45:41 +02:00
Kim Kulling 60b6d80936
Merge branch 'master' into xin-issue_5211 2023-08-24 21:03:57 +02:00
Kim Kulling c953c9b76f
Merge pull request #5213 from AnyOldName3/pdb-install-fixes
Use correct PDB paths
2023-08-24 20:35:00 +02:00
AnyOldName3 e50233b2c1 Use correct PDB paths
The previously-specified paths were only correct for a static library
build.
I therefore fenced off that code to be specific to static library
builds.

For shared library builds, I added a generator-expression-based
alternative.
Annoyingly, this won't work with static library builds, so we don't get
the concise, reliable version in all circumstances.

I've avoided modifying any of the paths anything ends up at to avoid
breaking changes.

Resolves https://github.com/assimp/assimp/issues/4269
2023-08-23 17:19:01 +01:00
tangxin 4389c3d80c The texture strength attribute in aiMaterial set when importing and exporting gltf files is inconsistent 2023-08-23 14:54:40 +08:00
zhucan d07934bf25 adjust comment 2023-08-18 01:03:49 +08:00
zhucan 554fa8f5e2 code format 2023-08-18 01:03:49 +08:00
zhucan 2b4606c082 add fallback strategy for metallicRoughnessTexture 2023-08-18 01:03:49 +08:00
朱灿 3a03fe31b1 gltf2 export diffuse roughness 2023-08-18 01:03:49 +08:00
zhucan 32716002ac Add DIFFUSE_ROUGHNESS_TEXTURE for gltf2 exporter 2023-08-18 01:03:49 +08:00
Alex 081cae6a95 Fix WIN32_LEAN_AND_MEAN redefinition 2023-08-17 13:25:30 +00:00
Alex 7cbf4c4136 Fix win build 2023-08-17 12:35:44 +00:00
Alex bc7ef58b49 bump openddl-parser to v0.5.1 2023-08-17 12:00:22 +00:00
Kim Kulling 72c10d856f
Merge pull request #5207 from sashashura/4658377717055488
Fix Invalid-free in Assimp::FBX::Scope::Scope
2023-08-17 10:27:36 +02:00
Alex 5c45cdc0ad Fix Invalid-free in Assimp::FBX::Scope::Scope 2023-08-16 07:45:23 +00:00
Kim Kulling 3a02de4d28
Merge pull request #5194 from Gargaj/floatwarn
Fix warning-as-error
2023-08-15 16:53:36 +02:00
Kim Kulling d77903423f
Merge branch 'master' into floatwarn 2023-08-15 12:55:37 +02:00
Aaron 0bfc588c39 Update Triangulate Process [more another case] 2023-08-15 18:01:16 +08:00
PencilAmazing 2e60cb6ae6
Merge branch 'master' into irrfix 2023-08-14 01:50:06 -04:00
Kim Kulling 556c89b5f1
Merge pull request #5199 from sashashura/5513536726761472
Fix UNKNOWN READ in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<ch
2023-08-12 08:20:15 +02:00
Kim Kulling e5d9339c21
Merge branch 'master' into 5513536726761472 2023-08-12 08:05:27 +02:00
Kim Kulling 461601e9ff
Merge pull request #5174 from feuerste/fix_magic
Fix violation of strict aliasing rule in `BaseImporter::CheckMagicToken`.
2023-08-12 08:04:34 +02:00
Kim Kulling 1c5dc86afb
Merge branch 'master' into fix_magic 2023-08-12 07:39:40 +02:00
Martin Weber d8a7399a04
Merge branch 'assimp:master' into collada-ignore-unit-size-property 2023-08-10 08:10:18 +02:00
Kim Kulling df9c5cdb9f
Merge pull request #5191 from sashashura/823345681268736
Fix UNKNOWN READ in Assimp::MDLImporter::InternReadFile_Quake1
2023-08-09 21:17:15 +02:00
Kim Kulling 79dcc289d0
Merge branch 'master' into 823345681268736 2023-08-09 20:58:56 +02:00
Kim Kulling aa5b41446c
Merge pull request #5200 from paroj/master
Be more precise regarding index buffer
2023-08-09 20:09:17 +02:00
Pavel Rojtberg 20a2cc4c94
it is the importer, not the postproc 2023-08-09 02:05:44 +02:00
Pavel Rojtberg 2baadf2fe5
Be more precise regarding index buffer 2023-08-08 18:34:13 +02:00
Alex b9460dd959 Fix UNKNOWN READ in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<ch 2023-08-08 16:01:00 +00:00
Gargaj 49ed0711d1
Fix another warning 2023-08-05 15:43:31 +02:00
Gargaj 8312b31d27
fix warning-as-error 2023-08-05 15:39:47 +02:00
Martin Weber bb1873dd22 Collada: added import property to disable unit size scaling 2023-08-04 09:54:55 +02:00
Alex f7e7f82b9d Add const 2023-08-03 17:10:17 +00:00
PencilAmazing b5032db741 Reverse accidental change with test file 2023-08-02 13:57:21 -04:00
PencilAmazing d6edfad8bb Fix non UTF-8 xml file parsing by passing buffer size manually, as per pugixml documentation 2023-08-02 13:52:40 -04:00
PencilAmazing cf5ffdc366 Merge branch 'master' of https://github.com/assimp/assimp into irrfix 2023-08-01 21:36:40 -04:00
Alex d7dc88e0d0 Fix UNKNOWN READ in Assimp::MDLImporter::InternReadFile_Quake1 2023-08-01 13:04:16 +00:00
Kim Kulling 60989a598e
Merge pull request #5175 from sfjohnston/sfjohnston_mods
Bug fix and improvement to FBX camera field-of-view during import.
2023-07-23 21:31:39 +02:00
Kim Kulling 439b3369c1
Merge branch 'master' into fix_magic 2023-07-23 21:21:29 +02:00
sfjohnston dd40b0ccee Changed #define FBX_FOV_UNKNOWN to const float kFovUnknown 2023-07-23 12:05:01 -07:00
sfjohnston 3ec8a36764
Merge branch 'assimp:master' into sfjohnston_mods 2023-07-23 08:37:47 -07:00
Kim Kulling 131bc61d47
Merge pull request #5186 from feuerste/missing_header
Add missing rapidjson headers to `glTF2Asset.inl`.
2023-07-23 13:51:01 +02:00
Kim Kulling d05dbfa8c9
Merge branch 'master' into missing_header 2023-07-23 13:29:56 +02:00
Kim Kulling 20cb815290
Merge pull request #5188 from assimp/kimkulling/remove_deprecated_swig_files
Remove deprecated swig files.
2023-07-23 13:29:43 +02:00
Kim Kulling 0ab7de70cd Remove deprecated swig files. 2023-07-23 12:49:25 +02:00
Marco Feuerstein 37a1366fb7 Add missing rapidjson headers. 2023-07-21 11:33:06 +02:00
Marco Feuerstein 52e5c3f39e Fix violation of strict aliasing rule. 2023-07-21 09:48:45 +02:00
Kim Kulling 64e0ba2625
Merge branch 'master' into sfjohnston_mods 2023-07-20 09:21:13 +00:00
Kim Kulling bf7ccb6206
Merge pull request #5182 from tellypresence/fix_malformed_irr_files
Fix malformed irr files
2023-07-18 14:29:08 +00:00
Kim Kulling a5a4090989
Merge branch 'master' into fix_malformed_irr_files 2023-07-18 12:31:44 +00:00
Kim Kulling 8c871ed4f0
Merge pull request #5183 from SirLynix/patch-2
Remove /WX from CMakeLists for MSVC
2023-07-17 17:05:16 +02:00
Jérôme Leclercq 46be2d3380
Remove /WX from CMakeLists for MSVC 2023-07-15 15:54:15 +02:00
Steve M ca7f6de671
Merge branch 'master' into fix_malformed_irr_files 2023-07-14 20:40:56 -07:00
Steve M 3161f0e754 Introduce alternate versions with animations disabled to allow sucessful load 2023-07-14 20:19:28 -07:00
Kim Kulling 5b7ff294b8
Merge pull request #5156 from feuerste/cloud_storage_version
Handle gcs cloud storage file extensions with versioning.
2023-07-14 15:07:12 +02:00
Kim Kulling 16021ef9ac
Merge branch 'master' into cloud_storage_version 2023-07-14 11:47:24 +02:00
Marco Feuerstein 0e7cd18c8b Strip aws gcs version string. 2023-07-14 09:37:48 +02:00
Kim Kulling f66a7fd6bf
Merge pull request #5176 from feuerste/gltf_specular
Fix detection of `KHR_materials_specular` on glTF2 export.
2023-07-14 09:23:12 +02:00
Steve M 1e6c7063b6 Fix typos 2023-07-13 20:28:48 -07:00
Marco Feuerstein bf38d67935 Fix detection of KHR_materials_specular. 2023-07-13 11:51:56 +02:00
Kim Kulling cf7d363766
Merge pull request #5159 from mosfet80/patch-4
Update run-cmake into sanitizer.yml
2023-07-11 15:45:55 +02:00
Kim Kulling 11f024b395
Merge branch 'master' into patch-4 2023-07-11 10:19:38 +02:00
Kim Kulling 53846430ce
Merge pull request #5157 from feuerste/file_extension
Unify extension check for importers.
2023-07-11 10:18:49 +02:00
sfjohnston c7afea3cd7
Merge branch 'assimp:master' into sfjohnston_mods 2023-07-10 07:58:21 -07:00
Kim Kulling e2b19ef776
Merge branch 'master' into file_extension 2023-07-10 11:19:27 +02:00
Kim Kulling fe49a9ed94
Merge pull request #5155 from feuerste/alpha_graph
Extend token search flag from alpha to graph.
2023-07-10 11:17:16 +02:00
Marco Feuerstein 87cac888e4 More simplifications. 2023-07-08 12:58:11 +02:00
Marco Feuerstein bdde968677 Address reviewer comment. 2023-07-08 12:58:11 +02:00
Marco Feuerstein 506baa21e6 Unify extension check for importers.
This enables proper checking for all kinds of extensions (including the
ones with multiple dots) for all importers and internal usage.
2023-07-08 12:58:11 +02:00
Marco Feuerstein 0256047168 Extend token search flag from alpha to graph.
This way we can fix Blender exported files being wrongly detected as
obj files.
2023-07-08 12:57:45 +02:00
Kim Kulling 3423949490
Merge branch 'master' into master 2023-07-08 12:37:42 +02:00
Kim Kulling e08cb0b5b8
Merge pull request #5172 from feuerste/missing_header
Add missing header.
2023-07-08 12:36:52 +02:00
PencilAmazing 668db327f4 Fix misplaced quote 2023-07-07 13:27:45 -04:00
Marco Feuerstein 8b005eaa83 Add missing header. 2023-07-07 14:28:05 +02:00
Kim Kulling 6308de6e5b
Merge pull request #5154 from feuerste/gltf_binary
Improve binary check for gltf and gltf2.
2023-07-05 21:29:38 +02:00
Kim Kulling 90ff723b6c
Merge branch 'master' into gltf_binary 2023-07-03 21:31:28 +02:00
Kim Kulling 9a94b26cdc
Merge pull request #5168 from sashashura/4879958521806848
Fix UNKNOWN READ in Assimp::SMDImporter::ParseNodeInfo
2023-07-03 21:08:11 +02:00
Kim Kulling ed903543a7
Merge branch 'master' into 4879958521806848 2023-07-03 19:50:38 +02:00
Kim Kulling d3ee157342
Merge pull request #5166 from PencilAmazing/irrfix
Fix IRR and IRRMESH importers
2023-07-03 11:36:52 +02:00
Kim Kulling a5bb4b59e4
Merge branch 'master' into irrfix 2023-07-03 11:19:53 +02:00
Alex 093e35dd54 Fix eternal loop 2023-07-03 09:12:00 +00:00
Alex edb8375702 Fix integer overflow 2023-07-03 09:11:38 +00:00
Kim Kulling 0dcfe2f72c
Merge pull request #5167 from assimp/kimkulling/add_missing_licence_issue-5144
Create licence.md
2023-07-03 10:04:34 +02:00
Kim Kulling d1ad4e54d7
Create licence.md
- closes https://github.com/assimp/assimp/issues/5144
2023-07-03 08:26:50 +02:00
Kim Kulling 5770faac10
Merge pull request #5162 from feuerste/py_available_formats
[pyassimp] Replace static list of file extensions with the actually supported ones.
2023-07-02 21:26:07 +02:00
PencilAmazing f1561f03ce
Merge branch 'master' into irrfix 2023-07-02 15:10:04 -04:00
PencilAmazing 57306bcd63 Make unit test more useful in case importer breaks again 2023-07-02 14:55:25 -04:00
PencilAmazing 96eb87265e Apply clang-format to unit test 2023-07-02 14:35:22 -04:00
PencilAmazing 0bacc7134d Remove debugging code, clean up some notes 2023-07-02 14:32:17 -04:00
PencilAmazing 19da9cc84d Port mesh loading to pugixml. Untested. 2023-07-02 14:32:12 -04:00
dog 3e1fd74940 Fix up scene loading. pugixml is a breadth-first parser while irrxml is
a depth first. This only parses scene structure, no mesh loading yet.
2023-07-02 14:30:54 -04:00
Kim Kulling 7d542eb795
Merge branch 'master' into py_available_formats 2023-07-02 20:26:16 +02:00
PencilAmazing 537b445a59 Apply clang-format to files 2023-07-02 14:17:52 -04:00
Alex 6f3bfb5b60 Fix memory leak 2023-07-02 14:12:49 -04:00
Alex 3838a8aaf8 Fix unknown write in Assimp::ObjFileMtlImporter::getFloatValue 2023-07-02 14:12:49 -04:00
Kim Kulling e4cac7d00b
Merge pull request #5153 from feuerste/blender_can_read
Unify way to check readable blender files.
2023-07-01 13:14:55 +02:00
Kim Kulling 8a65dcc19e
Merge branch 'master' into blender_can_read 2023-07-01 12:54:45 +02:00
Kim Kulling 3e74453b69
Merge branch 'master' into gltf_binary 2023-06-30 11:16:08 +02:00
Kim Kulling 42386b829c
Merge pull request #5164 from feuerste/py_read_from_memory
[pyassimp] Fix passing of file extension string.
2023-06-30 00:55:27 +02:00
Kim Kulling b44dfd5ecf
Merge branch 'master' into py_read_from_memory 2023-06-29 21:08:25 +02:00
Kim Kulling b61fc49c30
Merge pull request #5163 from thegeeko/fix-gcc-13
Fix: disabled dangling-reference warning in gcc13
2023-06-29 21:07:27 +02:00
Marco Feuerstein 82d3f47432 Unify way to check readable blender files. 2023-06-29 15:10:28 +02:00
Marco Feuerstein b2cad5c58d Use file system encoding. 2023-06-29 14:56:11 +02:00
Marco Feuerstein d1edaa949b Fix passing of file extension string.
Previously only the first letter of the string was passed to c, now it passes the whole extension.
2023-06-29 14:51:16 +02:00
Abdelhadi ac2cf2f71b Fix: disabled dangling-reference warning in gcc13 2023-06-29 10:02:39 +03:00
Marco Feuerstein 59f2620164 Remove unneeded check for empty extension. 2023-06-29 08:21:09 +02:00
Marco Feuerstein 261c7769b8 Replace static list of supported file extensions with the actually supported ones. 2023-06-29 08:21:08 +02:00
Marco Feuerstein 2875de132f Fix compilation on windows. 2023-06-29 08:20:51 +02:00
Marco Feuerstein 17fac97b04 Fix magic token usage. 2023-06-29 08:20:51 +02:00
Marco Feuerstein 1c0f3c5f87 Fix string length calculation. 2023-06-29 08:20:50 +02:00
Marco Feuerstein a2bdfdd05a Improve binary check for gltf and gltf2.
By checking the magic token we don't depend on the extension any more
and follow the official way to detect a gltf file as binary, see also
https://github.com/KhronosGroup/glTF/blob/main/extensions/1.0/Khronos/KHR_binary_glTF/README.md#header
and https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#binary-header.
2023-06-29 08:20:50 +02:00
Kim Kulling 03934128fc
Merge pull request #5149 from mosfet80/UpdatePugiXml
show correct pugixml version
2023-06-28 16:31:48 +02:00
Kim Kulling 7ae88225b3
Merge branch 'master' into UpdatePugiXml 2023-06-28 16:04:49 +02:00
Kim Kulling 5a568d485c
Merge pull request #5147 from mosfet80/UpdateZli
switch to zlib 1.2.13
2023-06-28 16:02:25 +02:00
Kim Kulling 507a3d2f8d
Merge branch 'master' into UpdateZli 2023-06-28 13:06:59 +02:00
Kim Kulling 876b1a0d6e
Merge pull request #5151 from severin-lemaignan/master
[pyassimp] bumped pyassimp version to 5.2.5
2023-06-28 11:40:49 +02:00
Kim Kulling c9111fe89a
Merge branch 'master' into master 2023-06-28 11:24:58 +02:00
Kim Kulling e7a0985886
Merge pull request #5148 from mosfet80/UpdateUtf8cpp
update utf8 from 2.3.4 to 3.2.3
2023-06-28 11:24:16 +02:00
Kim Kulling f55eebad06
Merge branch 'master' into UpdateUtf8cpp 2023-06-27 22:09:20 +02:00
Kim Kulling 8f61427880
Merge pull request #5128 from sashashura/5093294573486080
Fix UNKNOWN READ in Assimp::MDLImporter::ParseSkinLump_3DGS_MDL7
2023-06-27 22:08:29 +02:00
Kim Kulling 1ec3dbd11a
Merge branch 'master' into 5093294573486080 2023-06-27 17:04:58 +02:00
Kim Kulling 1791eac7ff
Merge pull request #5140 from emaame/SupportOBJSpecifiedOnlyAPartOfVertexColors
Fix Objimported supports OBJ partially specified vertex colors
2023-06-27 16:53:46 +02:00
mosfet80 3da92e05eb
Merge branch 'assimp:master' into UpdateUtf8cpp 2023-06-27 16:27:25 +02:00
Kim Kulling f24224fdc5
Merge branch 'master' into SupportOBJSpecifiedOnlyAPartOfVertexColors 2023-06-27 13:44:31 +02:00
Kim Kulling d2411a7ecd
Merge pull request #5127 from sashashura/5921493454815232
Fix Bad-cast to Assimp::D3DS::Material from invalid vptr in Assimp::ASE::Parser::ParseLV2MaterialBlock
2023-06-27 13:43:03 +02:00
Tomas Maly 5d3f3281f4 fix incorrect default for material::get with aiColor3D 2023-06-27 12:40:27 +02:00
Kim Kulling db6c1a8b1c
Merge branch 'master' into 5921493454815232 2023-06-27 11:03:50 +02:00
Kim Kulling 8937248f7c
Merge pull request #5126 from sashashura/5143879191494656
Fix UNKNOWN WRITE in std::__1::list<Assimp::LWO::Envelope, std::__1::allocator<Assimp::LWO::Envelope>
2023-06-27 11:02:07 +02:00
Kim Kulling ef6bf03acd
Merge branch 'master' into 5143879191494656 2023-06-27 10:23:36 +02:00
Kim Kulling 27c4de3419
Merge pull request #5122 from sashashura/5407417422970880
Fix Heap-buffer-overflow READ in Assimp::MD5::MD5Parser::ParseSection
2023-06-27 10:22:46 +02:00
Kim Kulling 141e278e1f
Merge branch 'master' into 5407417422970880 2023-06-27 10:07:21 +02:00
Kim Kulling 41e2b0f5dc
Merge pull request #5121 from sashashura/6521292621217792
Fix Memcpy-param-overlap in unzReadCurrentFile
2023-06-26 23:51:36 +02:00
Kim Kulling 1830a8aad2
Fix; fix old declaration style
- fix compiler warning.
2023-06-26 23:36:20 +02:00
Kim Kulling 47575f759f
Update unzip.c
- Fix compiler warnings
2023-06-26 16:08:12 +02:00
Kim Kulling ff36ea7e23
Merge branch 'master' into 6521292621217792 2023-06-26 09:17:40 +02:00
Kim Kulling bce2fdbbe9
Merge pull request #5119 from sashashura/4508318827937792
Fix unknown write in Assimp::ObjFileMtlImporter::getFloatValue
2023-06-26 09:02:39 +02:00
Kim Kulling b1181b1086
Merge branch 'master' into 4508318827937792 2023-06-25 21:20:02 +02:00
Kim Kulling 96d0c0769e
Merge pull request #5120 from sashashura/6520123362508800
Fix Stack-buffer-overflow READ in aiMaterial::AddBinaryProperty
2023-06-25 21:19:19 +02:00
Kim Kulling 7005a9caa2
Merge branch 'master' into 6520123362508800 2023-06-25 21:07:34 +02:00
Kim Kulling ed0dff2a7e
Merge pull request #5117 from sashashura/6091762766839808
Fix Heap-buffer-overflow READ in Assimp::FileSystemFilter::Cleanup
2023-06-25 21:03:23 +02:00
Kim Kulling 6b1a2e91d5
Merge branch 'master' into 6091762766839808 2023-06-25 20:08:45 +02:00
Kim Kulling 4a658202ca
Merge pull request #5113 from sashashura/6020769077657600
Fix UNKNOWN READ crash in UpdateMeshReferences
2023-06-25 20:06:47 +02:00
Kim Kulling 438f9fe568
Merge branch 'master' into 6020769077657600 2023-06-25 18:11:54 +02:00
Kim Kulling 1477f696e0
Merge pull request #5111 from sashashura/5781186265350144
Fix Heap-buffer-overflow READ in Assimp::ObjFileParser::getFace
2023-06-25 18:11:25 +02:00
Kim Kulling 3545aab937
Merge branch 'master' into 5781186265350144 2023-06-25 17:51:01 +02:00
mosfet80 46ea0a7d7c
Update sanitizer.yml 2023-06-22 21:43:52 +02:00
mosfet80 26c4505c53
Update run-cmake into sanitizer.yml 2023-06-22 21:41:26 +02:00
Séverin Lemaignan a4258929ce [pyassimp] bumped pyassimp version to 5.2.5 2023-06-20 22:33:16 +02:00
Andrea Reale 86c332fec7 show correct pugixml version 2023-06-20 11:52:12 +02:00
Andrea Reale 8a3ec3ca2f updateunzip 2023-06-20 11:40:38 +02:00
Andrea Reale ce59d49dd9 update upf8 from 2.3.4 to 3.2.3
New convenience API for C++ 11 and later compilers. The library still works with C++ 98/03 compliant compilers, just without the new functions.
advance() function works in both directions.
The following deprecated functions were removed:

previous() - deprecated since version 1.02.
is_bom() - deprecated since version 2.3.
Fix of the project version number at CMakeLists.txt
Continuous Integration with Google Tests and CircleCI
A minor release that contains fix for Issue #31 Program fails to link when including utf8.h in multiple files.
This release adds one new API call: unchecked::replace_invalid().
Optional support for C++ 17 std::string_view.
The release contains the fix the inclusion of both cpp11 and cpp17 headers on C++17 compilation. Also some additional tests for using string literals and string objects with modern compilers.
2023-06-20 11:23:28 +02:00
Andrea Reale 8741da2036 switch to zlib 1.2.13
Fix a bug when getting a gzip header extra field with inflateGetHeader(). This remedies CVE-2022-37434.
Fix a bug in block type selection when Z_FIXED used. Now the smallest block type is selected, for better compression.
Fix a configure issue that discarded the provided CC definition.
Correct incorrect inputs provided to the CRC functions. This mitigates a bug in Java.
Repair prototypes and exporting of the new CRC functions.
Fix inflateBack to detect invalid input with distances too far.
Fix a deflate bug when using the Z_FIXED strategy that can result in out-of-bound accesses.
Fix a deflate bug when the window is full in deflate_stored().
Speed up CRC-32 computations by a factor of 1.5 to 3.
Use the hardware CRC-32 instruction on ARMv8 processors.
Speed up crc32_combine() with powers of x tables.
Add crc32_combine_gen() and crc32_combine_op() for fast combines.
2023-06-20 11:12:47 +02:00
Kim Kulling bd65af0d44
Merge branch 'master' into SupportOBJSpecifiedOnlyAPartOfVertexColors 2023-06-20 09:38:53 +02:00
Kim Kulling b94392d199
Merge pull request #5146 from assimp/kimkulling/dxf_handling_for_invisible_faces_issue-2036
Add handling for negative indices.
2023-06-20 09:15:25 +02:00
Kim Kulling 63e1b071df Remove deprecated switch to disable warning. 2023-06-19 23:50:32 +02:00
Kim Kulling 6502b97d3e Fix: Put unused var into comments to later use. 2023-06-19 23:38:57 +02:00
Kim Kulling 3d19cd9362 Fix: Put unused var into comments to later use. 2023-06-19 23:35:50 +02:00
Kim Kulling 9c9d72169f Fix: Put unused var into comments to later use. 2023-06-19 23:34:14 +02:00
Kim Kulling 7f0c388ad8 Fix: Put unused var into comments to later use. 2023-06-19 23:27:32 +02:00
Kim Kulling 10059e6431 Add handling for negative indices. 2023-06-19 23:21:35 +02:00
emaame 22c8d97b54 Support OBJ specified only a part of vertex colors
The omitted vertex colors are treated as (0, 0, 0, 1).

e.g

v  0.0  0.0  0.0
v  0.0  0.0  1.0  0.0  0.0  0.0
v  0.0  1.0  0.0
v  1.0  0.0  0.0  1.0  0.6  0.3
v  1.0  1.0  0.0
2023-06-17 16:31:04 +09:00
Scott Johnston aab3c8010c Correct from full FOV to assimp half-fov in camera. Compute from filmWidth and focalLength if FOV not specified. 2023-06-15 12:16:06 -07:00
Kim Kulling 9c54540a19
Merge pull request #5130 from mosfet80/patch-2
Delete old unused patch
2023-06-15 11:39:12 +02:00
Kim Kulling 693d681813
Merge branch 'master' into patch-2 2023-06-15 10:40:05 +02:00
Kim Kulling 3939d35f18
Merge pull request #5138 from sashashura/4709035804065792
Fix UNKNOWN WRITE in Assimp::SortByPTypeProcess::Execute
2023-06-15 10:39:17 +02:00
Alex 36dfa3bed3 Fix UNKNOWN WRITE in Assimp::SortByPTypeProcess::Execute 2023-06-14 15:50:50 +00:00
Alex b158b716d1 Fix Memcpy-param-overlap in unzReadCurrentFile: bump zlib to 1.2.13 2023-06-14 07:41:41 +02:00
Alex 9ef71fe231
Merge branch 'master' into 5781186265350144 2023-06-14 07:40:47 +02:00
Alex 5bb1c6debd Fix UNKNOWN READ crash in UpdateMeshReferences 2023-06-14 07:40:36 +02:00
Alex b3a1c72c8f Fix Heap-buffer-overflow READ in Assimp::FileSystemFilter::Cleanup 2023-06-14 07:40:28 +02:00
Alex 646d3591b6 Fix memory leak 2023-06-14 07:40:21 +02:00
Alex 496a4bf156 Fix unknown write in Assimp::ObjFileMtlImporter::getFloatValue 2023-06-14 07:40:21 +02:00
Alex 8012657169 Fix Heap-buffer-overflow READ in Assimp::MD5::MD5Parser::ParseSection 2023-06-14 07:38:57 +02:00
Alex dbd15fd351 Fix UNKNOWN WRITE in std::__1::list<Assimp::LWO::Envelope, std::__1::allocator<Assimp::LWO::Envelope> 2023-06-14 07:38:47 +02:00
Alex 86aecf395e Fix Bad-cast to Assimp::D3DS::Material from invalid vptr in Assimp::ASE::Parser::ParseLV2MaterialBlock 2023-06-14 07:38:38 +02:00
Alex c6c95b69f6 Use SizeCheck 2023-06-14 07:38:02 +02:00
Alex 54b0c00418 Fix UNKNOWN READ in Assimp::MDLImporter::ParseSkinLump_3DGS_MDL7 2023-06-14 07:38:02 +02:00
Alex f897b0c461
Merge branch 'master' into 6520123362508800 2023-06-13 22:06:08 +02:00
Kim Kulling 4180b1fd08
Merge pull request #5134 from sashashura/memleak
Fix memory leak
2023-06-13 20:18:37 +02:00
Kim Kulling 3ccf242bdb
Merge branch 'master' into memleak 2023-06-13 19:46:56 +02:00
Kim Kulling feb0303fd0
Merge pull request #5090 from FlorianBorn71/FixSkinnedWeightsAfterVertexRemappingOptimization
Skinning weights in gltf were broken by PR#5003 (vertex remapping)
2023-06-09 00:23:08 +02:00
Kim Kulling bef66deeda
Update glTF2Importer.h 2023-06-08 20:56:14 +02:00
Kim Kulling 1ab4161cd7
Update glTF2Importer.cpp 2023-06-08 20:55:48 +02:00
Kim Kulling 186d7fd606
Merge branch 'master' into FixSkinnedWeightsAfterVertexRemappingOptimization 2023-06-08 13:16:08 +02:00
Kim Kulling 9950bb4ed6
Merge pull request #5110 from sashashura/4890437695700992
Fix Heap-buffer-overflow READ in Assimp::MD5::MD5MeshParser::MD5MeshParser
2023-06-08 13:15:35 +02:00
Kim Kulling 11dede8fc4
Merge branch 'master' into 4890437695700992 2023-06-08 13:02:15 +02:00
Kim Kulling d5844f26b5
Merge pull request #5103 from mosfet80/patch-1
Update cpp-pm / hunter
2023-06-08 13:01:35 +02:00
Kim Kulling 839bed3274
Merge branch 'master' into patch-1 2023-06-07 18:38:57 +02:00
Alex 4c16a6a16b Fix memory leak 2023-06-07 07:02:50 +00:00
Kim Kulling 49a6eec294
Merge pull request #5133 from Biohazard90/Fix-removeEmptyBones-cannot-be-disabled
Fixed missing config property lookup for removal of empty bones.
2023-06-07 08:19:23 +02:00
Kristjan Skutta cb86029153 Fixed missing config property lookup for removal of empty bones. 2023-06-06 14:30:35 +02:00
Kim Kulling d9268dcf96
Merge branch 'master' into patch-1 2023-06-05 18:36:35 +02:00
Kim Kulling 02d5ab294c
Merge pull request #5129 from sashashura/4875566380220416
Fix UNKNOWN READ in aiTexture::~aiTexture
2023-06-05 18:35:56 +02:00
Alex f5683b6f3a
Update MDLMaterialLoader.cpp
Add parentheses
2023-06-05 14:27:21 +02:00
mosfet80 05ab5c2e3b
Delete old unused patch
Remove old file poly2tri_patch.txt
2023-06-04 22:49:12 +02:00
Kim Kulling 513e62e1c9
Merge branch 'master' into 4875566380220416 2023-06-04 20:42:37 +02:00
Alex 23f9990b22 Fix UNKNOWN READ in aiTexture::~aiTexture 2023-06-04 07:50:00 +00:00
Kim Kulling 915e146307
Merge pull request #5125 from mosfet80/updatePugiXML
Update pugiXML library
2023-06-03 21:26:13 +02:00
Alex 5cc4a61d66 Fix Heap-buffer-overflow READ in Assimp::MD5::MD5MeshParser::MD5MeshParser 2023-06-03 16:30:50 +02:00
Alex 6c5fe9d76f Add missing include 2023-06-03 16:28:55 +02:00
Alex 57a55aa4d4 Fix memory leaks 2023-06-03 16:28:55 +02:00
Alex f4d3b6e862 Fix Stack-buffer-overflow READ in aiMaterial::AddBinaryProperty 2023-06-03 16:28:55 +02:00
mosfet80 62cefd5b27 Update pugiXML library
Release highlights:

xml_attribute::set_value, xml_node::set_value and xml_text::set now have overloads that accept pointer to non-null-terminated string and size
Fix error handling in xml_document::save_file that could result in the function succeeding while running out of disk space
Fix memory leak during error handling of some out-of-memory conditions during xml_document::load
2023-06-03 11:16:39 +02:00
Alex d3506c24e7
Update ObjFileParser.cpp 2023-06-02 18:57:53 +02:00
Kim Kulling e30823fb1d
Merge branch 'master' into 5781186265350144 2023-06-01 16:40:46 +02:00
Kim Kulling b6c0fdd6e0
Merge branch 'master' into patch-1 2023-06-01 00:12:26 +02:00
Kim Kulling d9a8837a5b
Merge pull request #5112 from sashashura/6337324114116608
Fix Heap-buffer-overflow WRITE in Assimp::ObjFileImporter::createVertexArray
2023-05-31 23:31:38 +02:00
Kim Kulling 628dde4a91
Merge branch 'master' into 6337324114116608 2023-05-31 21:30:47 +02:00
Kim Kulling c22ddfda2b
Merge pull request #5114 from assimp/kimkulling/update_docker_image
Update_ Use latest ubuntu image and switch to ninja
2023-05-31 21:24:16 +02:00
Kim Kulling 1538669f70 Update_ Use latest ubuntu image and switch to ninja 2023-05-31 20:45:51 +02:00
Alex 4cc70cb73c Optimize 2023-05-31 14:10:57 +00:00
Alex 54f5d01190 Fix Heap-buffer-overflow WRITE in Assimp::ObjFileImporter::createVertexArray 2023-05-31 11:37:15 +00:00
Alex c3e69b5b82 Fix Heap-buffer-overflow READ in Assimp::ObjFileParser::getFace 2023-05-31 08:01:41 +00:00
mosfet80 462755e5ba
Update CMakeLists.txt
fix sha1
2023-05-30 16:26:30 +02:00
mosfet80 1f5c7da822
Update CMakeLists.txt 2023-05-30 16:23:57 +02:00
Kim Kulling bee751b5f9
Merge pull request #5109 from assimp/C-Tech-Development-Corp-gltf2_metadata_export
C tech development corp gltf2 metadata export
2023-05-30 11:38:02 +02:00
Kim Kulling 466f6960ac Merge branch 'gltf2_metadata_export' of https://github.com/C-Tech-Development-Corp/assimp into C-Tech-Development-Corp-gltf2_metadata_export 2023-05-30 08:14:49 +02:00
Kim Kulling 17c1a9125f
Merge branch 'master' into FixSkinnedWeightsAfterVertexRemappingOptimization 2023-05-24 23:36:59 +02:00
Kim Kulling 0b53243b8f
Merge pull request #5083 from Jackie9527/msvc-clang-unused-function
Fix warning related to unused-function.
2023-05-24 23:36:01 +02:00
Kim Kulling f43cfa1fba
Merge branch 'master' into msvc-clang-unused-function 2023-05-24 23:23:40 +02:00
Kim Kulling 0f4667fce4
Merge pull request #5082 from skogler/fix-pbrt-exporter
Fix pbrt exporter coordinate system and FoV
2023-05-24 23:23:00 +02:00
Kim Kulling ca848c5b09
Merge branch 'master' into fix-pbrt-exporter 2023-05-24 22:28:32 +02:00
Kim Kulling 0794b41d55
Merge pull request #5087 from mwestphal/master
Fix librt link
2023-05-24 22:25:34 +02:00
Kim Kulling d73595b85d
Merge branch 'master' into master 2023-05-24 21:35:26 +02:00
mosfet80 e4621a3142
Update cpp-pm / hunter
Fix a lot of CVE vulnerabilities

Update abseil to LTFS 20220623.1 by @butteredmonkey in #656
Fix Hunter on Windows MSVC CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE 'ARM64EC' by @ccmvn in #659
openssl: update openssl to the latest 1.1.1t by @res0nance in #660
ceres-solver: per default disable CUDA support by @NeroBurner in #665
update range-v3 to version 0.12.0 by @alex-tdrn in #670
Update 'pybind11' to 2.10.4 by @hjmallon in #667
cli11: update cli11 to 2.3.2 by @res0nance in #669
openssl: update to v3 as 1.1.1 is almost eol by @res0nance in #668
Fix Hunter on Windows MSVC CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE 'ARM64' by @ccmvn in #655
Boost: Fix building b2 (+ headers) on Apple tvOS with Xcode generator by @hjmallon in #647
assimp: add version 5.2.5 by @NovaSurfer in #640
SuiteSparse: update to v1.6.1 (SuiteSparse v5.4.0), with METIS and OpenBLAS by @NeroBurner in #642
OpenSSL: replace HUNTER_UWP_PLATFORM with CMAKE_SYSTEM_NAME check by @Dargun in #635
asio-grpc: Add version 2.3.0 by @Tradias in #636
Update OpenBLAS to v0.3.21 and add new BUILD_WITHOUT_LAPACK flag by @NeroBurner in #638
OpenBLAS: starting with 0.3.21 build with LAPACK support per default by @NeroBurner in #639
Update 'date' to v3.0.1 by @hjmallon in #615
Update 'SDL_net' package to v2.2.0-p0 by @drodin in #616
Update 'Jpeg' package to v9e-p0 by @drodin in #618
Update 'GTest' package to v1.12.1 by @drodin in #620
Update 'lcms' package to v2.13.1-p0 by @drodin in #621
Update 'giflib' package to v5.2.1-p0 by @drodin in #622
Update package 'WebP' to v1.2.4-p0 by @drodin in #623
Update 'Boost' to 1.80.0 by @tnixeu in #627
Update asio-grpc to 2.2.0 by @Tradias in #629
Update ZLIB to v1.2.13-p0 by @NeroBurner in #628
Add support for iOS simulator only builds by @hjmallon in #610
aws-sdk-cpp: Fix linking OpenSSL Crypto on Linux by @hjmallon in #630 and #631
OpenSSL: Fix build on universal windows platforms, add UWP job to global build matrix by @Dargun in #626
Update asio-grpc to v2.1.0 by @Tradias in #607
Update 'harfbuzz' package to v2.9.1-p0 by @drodin in #608
Update RocksDB to 7.5.3 by @twoentartian in #611
Fix CMAKE_IOS_INSTALL_COMBINED on Xcode 12+ by @hjmallon in #609
CI: Boost: update matrix.json to match general workflow by @NeroBurner in #612
Boost: update to v1.79.0 by @NeroBurner in #599
2023-05-24 17:29:29 +02:00
Samuel Kogler 0fbd2f5894
Merge branch 'master' into fix-pbrt-exporter 2023-05-24 15:24:46 +02:00
Kim Kulling 9f593d70b5
Merge pull request #4786 from Beilinson/refactor/KHR_material_specular
Removed KHR_materials_pbrSpecularGlossiness, added KHR_materials_specular
2023-05-23 12:44:47 +02:00
Kim Kulling b7a8c4ba75
Update glTF2Asset.inl 2023-05-23 10:33:14 +02:00
Kim Kulling 3a09fd0c85
Fix review finding
Test with glossiness disabled and enabled.
2023-05-23 09:50:20 +02:00
Kim Kulling e947471549
Merge branch 'master' into refactor/KHR_material_specular 2023-05-22 09:49:01 +02:00
Kim Kulling 0e06a5f945
Merge pull request #4806 from naota29/master
Updated DirectX Loader to assign appropriate material index in ConvertMaterials Function
2023-05-22 09:48:26 +02:00
Kim Kulling 03163a1dda
Merge branch 'master' into master 2023-05-21 18:26:56 +02:00
Kim Kulling 7e16d4046e
Merge branch 'master' into FixSkinnedWeightsAfterVertexRemappingOptimization 2023-05-21 18:14:29 +02:00
Kim Kulling 0dfd491d97
Merge pull request #5099 from assimp/kimkulling/ase_remove_commented_code
Update ASELoader.cpp
2023-05-20 14:39:40 +02:00
Kim Kulling 9c45f727e3
Update ASELoader.cpp 2023-05-20 14:27:57 +02:00
Kim Kulling 18b6cffe14
Merge pull request #5096 from assimp/FlorianBorn71-SmallAllocationFixInFBXLoader
Florian born71 small allocation fix in fbx loader
2023-05-16 11:00:34 +02:00
Kim Kulling 94905d445f
Revert usage of unique_ptr - error. 2023-05-15 16:06:02 +02:00
Kim Kulling 71a4977dd1
Fix: Try unique_ptr 2023-05-15 15:46:21 +02:00
Kim Kulling 8ad4bb0b2c
Update StackAllocator.inl 2023-05-15 15:09:54 +02:00
Kim Kulling b5b6400320
Fix: Use vector. 2023-05-15 15:08:52 +02:00
Kim Kulling aed43878ef
Merge branch 'master' into FlorianBorn71-SmallAllocationFixInFBXLoader 2023-05-15 14:28:46 +02:00
Kim Kulling ad399adf4b
Add missing include 2023-05-15 13:19:02 +02:00
Kim Kulling 121f09b62a Fix: Fix the build. 2023-05-15 11:02:58 +02:00
Kim Kulling 0c4d5909f8
Merge pull request #5095 from assimp/kimkulling/enable_export_for_fuzzing
Update: Enable export for fuzzer tests
2023-05-15 09:43:48 +02:00
Kim Kulling e627f691a8 Merge branch 'SmallAllocationFixInFBXLoader' of https://github.com/FlorianBorn71/assimp into FlorianBorn71-SmallAllocationFixInFBXLoader 2023-05-15 09:30:57 +02:00
Kim Kulling f3e5a4835d
Merge branch 'master' into kimkulling/enable_export_for_fuzzing 2023-05-15 09:25:56 +02:00
Kim Kulling 478ce8af5a
Update Exporter.cpp 2023-05-15 09:25:44 +02:00
Kim Kulling 9d6b32f5c5 Update: Enable export for fuzzer tests 2023-05-15 09:18:30 +02:00
Kim Kulling 41102eeda6
Merge pull request #5092 from luho383/scene_combiner_copy_metadata_fix
Fix: Copy aiMetadata in SceneCombiner
2023-05-13 12:11:25 +02:00
Lutz Hören 9ea37b5330 copy aiMetadata objects in scene combiner 2023-05-11 08:00:25 +02:00
Kim Kulling ade4514752
Merge branch 'master' into fix-pbrt-exporter 2023-05-10 21:55:00 +02:00
Florian Born d825eb7cf0 Skinning weights i gltf were broken by PR#5003 (vertex remapping) 2023-05-08 20:04:38 +02:00
Mathieu Westphal 69145c8929 Fix librt link 2023-05-05 08:47:14 +02:00
Kim Kulling cb22d531a6
Merge pull request #5086 from assimp/kimkulling/refactoring_geoutils
Kimkulling/refactoring geoutils
2023-05-05 00:08:35 +02:00
Kim Kulling 8cbfb44e9c
Remove dead code 2023-05-04 21:10:51 +02:00
Kim Kulling 1243325f10
Merge branch 'master' into kimkulling/refactoring_geoutils 2023-05-04 21:10:00 +02:00
Kim Kulling 75d024c91b Reafctoring: Add GeoUtils usage 2023-05-04 20:57:20 +02:00
Kim Kulling 167d811ff7 Doc: Add missing doc to GeometryUtils. 2023-05-04 00:04:56 +02:00
Kim Kulling d58201a579 Refactoring: Reuse code from GeometryUtils 2023-05-04 00:00:52 +02:00
Jackie9527 fbf8799cb5 Fix warning related to unused-function.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-05-03 23:02:38 +08:00
Samuel Kogler 55cb19f924 Fix PBRT exporter coordinate system
Was just mirroring the x axis. This uses aiProcess_ConvertToLeftHanded and
rotates the root node to match PBRT.

The problem is apparent when using an environment map texture.
2023-05-03 16:52:33 +02:00
Samuel Kogler f32c21e6b3 Fix PBRT exporter FoV aspect ratio calculation 2023-05-03 16:46:54 +02:00
Kim Kulling b8877798ed
Merge pull request #5078 from showintime/patch-1
fix unreachable code
2023-05-03 11:35:18 +02:00
Kim Kulling c50b87fa6c
Merge branch 'master' into patch-1 2023-05-03 11:19:28 +02:00
Kim Kulling 92aa22e902
Merge pull request #5075 from Jackie9527/msvc-clang-build-fix
Fix build warnings.
2023-05-03 11:13:38 +02:00
ParkBook a923d1f89b
fix unreachable code
fix unreachable code
2023-05-01 00:38:16 +08:00
Jackie9527 92d426de2b Remove unused -Wno-missing-noreturn.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-29 01:05:25 +08:00
Jackie9527 51494e1b4f Remove unused -Wno-deprecated-copy-with-user-provided-dtor.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-29 00:55:13 +08:00
Jackie9527 cdefc9f7aa Remove unused -Wno-deprecated-copy-with-dtor.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-29 00:43:40 +08:00
Jackie9527 cabf3a5d17 Fix warning related to unreachable-code-return.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-29 00:30:21 +08:00
Jackie9527 a8e7c23605 Fix warning related to unreachable-code.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-29 00:29:33 +08:00
Kim Kulling 5c5b0f97b7
Merge pull request #5073 from sutajo/fix_double_precision_build
Add missing cast
2023-04-28 14:33:01 +02:00
Suhajda Tamás 71043ec164 Add missing cast 2023-04-28 11:44:29 +02:00
Kim Kulling cea40f293a
Merge pull request #5070 from Jackie9527/msvc-clang-missing-variable-declarations
Fix warning related to missing-variable-declarations.
2023-04-26 11:29:49 +02:00
Kim Kulling 230bee2e34
Merge branch 'master' into msvc-clang-missing-variable-declarations 2023-04-26 11:15:32 +02:00
Kim Kulling 6442158676
Merge pull request #5063 from danoli3/master
Build Zlib if missing for other platforms
2023-04-26 11:14:34 +02:00
Kim Kulling cf89990569
Merge branch 'master' into master 2023-04-26 10:58:00 +02:00
Kim Kulling 9c2594a1dc
Merge pull request #5051 from Jackie9527/msvc-clang-deprecated-copy-with-dtor
Remove -Wno-deprecated-copy-with-dtor.
2023-04-26 10:57:28 +02:00
Kim Kulling 07aae9eaee
Merge branch 'master' into msvc-clang-deprecated-copy-with-dtor 2023-04-26 10:42:51 +02:00
Kim Kulling 4dc341955a
Merge pull request #5049 from Jackie9527/msvc-clang-inconsistent-missing-destructor-override
Fix warning related to inconsistent-missing-destructor-override.
2023-04-26 10:41:17 +02:00
Kim Kulling 71366fff8e
Merge branch 'master' into msvc-clang-inconsistent-missing-destructor-override 2023-04-26 09:31:55 +02:00
Kim Kulling ee6e05bb86
Merge pull request #5048 from Jackie9527/deprecated-copy-with-user-provided-dtor
Remove unused -Wno-deprecated-copy-with-user-provided-dtor.
2023-04-26 09:31:00 +02:00
Kim Kulling 965ebaf78b
Merge branch 'master' into deprecated-copy-with-user-provided-dtor 2023-04-26 08:22:51 +02:00
Kim Kulling 97addc7cdc
Merge pull request #5047 from Jackie9527/msvc-clang-missing-noreturn
Fix warning related to missing-noreturn.
2023-04-26 00:13:06 +02:00
Kim Kulling 1ecb8e9196
Merge branch 'master' into msvc-clang-missing-noreturn 2023-04-25 23:56:39 +02:00
Dan Rosser cd9de860ce Build Zlib if missing for other platforms 2023-04-25 17:18:20 +10:00
Kim Kulling 87a288ebd3
Merge pull request #5046 from Jackie9527/msvc-clang-unreachable-code-break
Fix warning related to unreachable-code-break.
2023-04-20 17:13:44 +02:00
Jackie9527 ff17f1fe3d Remove -Wno-missing-variable-declarations.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 23:29:03 +08:00
Jackie9527 46677b835c Fix warning related to missing-variable-declarations, add static to global variable.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 23:28:36 +08:00
Jackie9527 1244e58274 Fix warning related to missing-variable-declarations, add static to global variable.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 23:28:08 +08:00
Jackie9527 5738b3d172 Fix warning related to missing-variable-declarations, add static to global variable.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 23:27:23 +08:00
Jackie9527 739cf15a1e Fix warning related to missing-variable-declarations, remove unused global variables.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 23:26:03 +08:00
Jackie9527 c0947b704e Fix warning related to missing-variable-declarations, remove unused global variables.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 23:24:40 +08:00
Jackie9527 1b826afeda Remove -Wno-unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:26:44 +08:00
Jackie9527 4d962057e5 Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:35 +08:00
Jackie9527 12bc34a45c Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:35 +08:00
Jackie9527 0a05a1f17f Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:34 +08:00
Jackie9527 cec41f6dd5 Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:34 +08:00
Jackie9527 7620a69e3e Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:34 +08:00
Jackie9527 9e80dfc42d Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:34 +08:00
Jackie9527 01488046e6 Fix warning related to unreachable-code-break.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-19 22:18:34 +08:00
Kim Kulling b1afa41047
Merge pull request #5045 from Jackie9527/msvc-clang-unreachable-code-return
Fix warning related to unreachable-code-return.
2023-04-18 19:57:16 +02:00
Kim Kulling 1517983ab5
Merge branch 'master' into msvc-clang-unreachable-code-return 2023-04-17 23:38:29 +02:00
Kim Kulling 45946ec01b
Merge pull request #5068 from assimp/kimkulling/fix_overflow_in_inversion_issue-3424
Fix: Avoid integer overflow in inversion operation
2023-04-17 23:37:54 +02:00
Kim Kulling fd59a2209b
Update fast_atof.h 2023-04-17 22:07:49 +02:00
Kim Kulling 9e056218cf
Merge branch 'master' into msvc-clang-unreachable-code-return 2023-04-17 22:04:07 +02:00
Kim Kulling d51f033e20
Fix: Avoid integer overflow in inversion op
- closes https://github.com/assimp/assimp/issues/3424
2023-04-17 21:30:47 +02:00
Kim Kulling 074af85734
Merge pull request #5043 from tellypresence/create-local-textures
Replace relative paths with local assets/textures
2023-04-17 21:25:15 +02:00
Kim Kulling 133f730c11
Merge branch 'master' into create-local-textures 2023-04-17 20:47:54 +02:00
Kim Kulling 0023f9b09a
Merge pull request #5067 from assimp/kimkulling/fix_memory_leak_in_fbx_scope_issue-3421
Fix: Fix leak in Scope class, FBX
2023-04-17 20:40:46 +02:00
Kim Kulling ca937788ee
Fix: Fix leak in Scope class, FBX
- closes https://github.com/assimp/assimp/issues/3421
2023-04-17 20:08:58 +02:00
Kim Kulling 333f7d5ee0
Merge pull request #5066 from assimp/kimkulling/fix_possible_invalid_dereferencing_of-issue-4918
Fix possible dereferencing of invalid pointer.
2023-04-17 15:59:07 +02:00
Kim Kulling aee4df9be8
Fix possible dereferencing of invalid pointer.
- closes https://github.com/assimp/assimp/issues/4918
2023-04-17 15:40:29 +02:00
Kim Kulling 5d841ec9a5 Refactoring: Cleanup post-processing steps. 2023-04-16 18:20:14 +02:00
Kim Kulling 13c9db2310
Merge pull request #5064 from assimp/kimkulling/remove_empty_file_issue-4957
Delete License.txt
2023-04-15 13:03:02 +02:00
Kim Kulling 8bc64ec147
Delete License.txt
- closes https://github.com/assimp/assimp/issues/4957
2023-04-15 11:53:19 +02:00
Kim Kulling 8cf74c7663
Merge branch 'master' into create-local-textures 2023-04-15 11:52:00 +02:00
Kim Kulling 7e8aabcbb4
Merge pull request #5057 from sutajo/master
ConvertToLHProcess now inverts viewing direction
2023-04-15 11:51:15 +02:00
Adam Beili e193220ad8
Merge branch 'master' into refactor/KHR_material_specular 2023-04-06 02:42:18 +02:00
Suhajda Tamás 3dd08cdd60 Added note 2023-04-05 13:01:38 +02:00
Suhajda Tamás 74509ef8bd Revert "FBXConverter : import FbxCamera correctly"
This reverts commit cdfdd75a66.
2023-04-05 12:19:39 +02:00
Jackie9527 d4c21ba9a8 Fix warning related to error=return-type.
/home/runner/work/assimp/assimp/code/AssetLib/Ogre/OgreXmlSerializer.cpp: In member function ‘T Assimp::Ogre::OgreXmlSerializer::ReadAttribute(Assimp::XmlNode&, const char*) const [with T = bool]’:
  Error: /home/runner/work/assimp/assimp/code/AssetLib/Ogre/OgreXmlSerializer.cpp:131:1: error: control reaches end of non-void function [-Werror=return-type]

Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-05 07:39:17 +08:00
Jackie9527 116ceeca31 Remove -Wno-unreachable-code-return.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-05 07:39:12 +08:00
Jackie9527 a7cb3b4dbb Fix warning related to unreachable-code-return, remove redundant return.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-05 07:37:49 +08:00
Jackie9527 55c6eaee0c Fix warning related to unreachable-code-return, remove redundant return.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-05 07:37:48 +08:00
Jackie9527 502bceb6e8 Fix warning related to unreachable-code-return, remove redundant return.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-05 07:37:48 +08:00
Jackie9527 a87585668d Fix warning related to unreachable-code-return, disable warning.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-05 07:37:48 +08:00
Steve M 5b2f78ac20
Merge branch 'master' into create-local-textures 2023-04-04 16:01:20 -07:00
Suhajda Tamás 23a3e8cf2d ConvertToLHProcess noew inverts viewing direction 2023-04-04 19:39:32 +02:00
Kim Kulling 679eb972e6
Merge pull request #5056 from sutajo/fix_pretransform_vertices_with_cameras
Fix pretransform vertices with cameras
2023-04-04 17:35:50 +02:00
Kim Kulling 89ccc89298
Merge branch 'master' into fix_pretransform_vertices_with_cameras 2023-04-04 17:21:05 +02:00
Kim Kulling 8705940801
Merge pull request #5042 from Jackie9527/msvc-clang-unreachable-code
Fix warning related to unreachable-code.
2023-04-04 17:18:55 +02:00
Kim Kulling 1733d9f795
Merge branch 'master' into msvc-clang-unreachable-code 2023-04-04 17:02:22 +02:00
Kim Kulling 17d8e991cc
Merge pull request #5041 from Jackie9527/msvc-clang-format-non-iso
Fix warning related to format-non-iso.
2023-04-04 17:01:27 +02:00
Kim Kulling 17bdd5f9b5
Merge branch 'master' into msvc-clang-format-non-iso 2023-04-04 15:59:27 +02:00
Kim Kulling 414091ab11
Merge pull request #5039 from liedtkeInTUM/fix_getenv_uwp
std::getenv is not supported using uwp
2023-04-04 13:49:15 +02:00
Kim Kulling e6f26fc52e
Remove dead code. 2023-04-04 12:54:26 +02:00
Kim Kulling ccbcf15a21
Merge branch 'master' into fix_getenv_uwp 2023-04-04 12:53:29 +02:00
Kim Kulling 4e34e77226
Merge pull request #5025 from inhosens/master
FBX import: Fix camera rotation
2023-04-04 12:51:08 +02:00
Steve M f68f1f6bf2
Merge branch 'master' into create-local-textures 2023-04-03 16:50:43 -07:00
Suhajda Tamás 9d76493ad8 Fix mLookAt with pretransformed vertices
mLookAt is a position vector inside the nodes reference frame, not a direction vector, so translation should be applied to it.
2023-04-04 00:06:09 +02:00
Kim Kulling a259277498
Merge branch 'master' into master 2023-04-03 23:54:28 +02:00
Kim Kulling f2efcd77bc
Merge pull request #5003 from FlorianBorn71/MemoryOptimizationForGLTFWithSharedAttr
GLTF Importer: Build a list of the actual vertices so it works well with shared attribute lists
2023-04-03 23:39:21 +02:00
Suhajda Tamás 9915e875bf glTF2: Fix incorrect camera position 2023-04-03 23:35:04 +02:00
Kim Kulling 8aa959fa19
Merge branch 'master' into MemoryOptimizationForGLTFWithSharedAttr 2023-04-03 20:48:51 +02:00
Kim Kulling ca79916048
Merge pull request #5040 from Jackie9527/msvc-clang-nested-anon-types
Fix warning related to nested-anon-types.
2023-04-03 20:16:14 +02:00
Kim Kulling d6885d4025
Merge branch 'master' into msvc-clang-nested-anon-types 2023-04-03 19:59:59 +02:00
Kim Kulling 19ff57a6c3
Merge branch 'master' into MemoryOptimizationForGLTFWithSharedAttr 2023-04-03 11:28:10 +02:00
Kim Kulling df21b6799f
Merge pull request #5053 from aniongithub/fix-loadfbxasserterror
Fix Issue #4486 using the fix described by @jianliang79
2023-04-03 09:14:31 +02:00
Ani ae121bfbb0
Merge branch 'master' into fix-loadfbxasserterror 2023-04-02 22:13:33 -07:00
Steve M 70aceb203a
Merge branch 'master' into create-local-textures 2023-04-02 19:31:57 -07:00
liedtkeInTUM 97e31a895e
Merge branch 'master' into fix_getenv_uwp 2023-04-01 23:38:48 +02:00
Kim Kulling 9fba0ee31b
Merge branch 'master' into msvc-clang-deprecated-copy-with-dtor 2023-04-01 20:46:34 +02:00
Kim Kulling acdb6684ba
Merge pull request #5052 from Jackie9527/msvc-clang-shadow-field-in-constructor
Remove unused -Wno-shadow-field-in-constructor.
2023-04-01 20:45:43 +02:00
Steve M 9c5ab67b64 Replace provisional image with original historical image 2023-04-01 09:20:36 -07:00
Jackie9527 dacaebc078 Remove unused -Wno-shadow-field-in-constructor.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 23:49:22 +08:00
Jackie9527 bddb4559a1 Remove -Wno-deprecated-copy-with-dtor.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 22:46:01 +08:00
Jackie9527 7df4efea44 Fix warning related to inconsistent-missing-destructor-override.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 21:49:38 +08:00
Jackie9527 e36812a449 Remove unused -Wno-deprecated-copy-with-user-provided-dtor.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 19:07:13 +08:00
Jackie9527 87c309566f Fix warning related to missing-noreturn.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 18:46:12 +08:00
Steve M 6d668382ec Fix model broken in commit a8a1ca9
Restored broken binary from 4bbc033 (5 Mar 2009)
2023-03-31 23:20:24 -07:00
Steve M e1678f11e6 Replace relative paths with local assets/textures
Relative paths can easily contain typos, lower/upper case errors, and in general are brittle
2023-03-31 22:17:50 -07:00
Jackie9527 20b2f857c5 Remove -Wno-unreachable-code
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 13:07:30 +08:00
Jackie9527 4d2512dcae Fix warning related to unreachable-code.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 13:03:02 +08:00
Jackie9527 04066ece8e Fix warning related to unreachable-code.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 13:02:04 +08:00
Jackie9527 1dcb5da1cd Fix warning related to unreachable-code.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 13:01:22 +08:00
Jackie9527 94067994cc Fix warning related to format-non-iso.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 12:29:42 +08:00
Jackie9527 6b54761310 Fix warning related to nested-anon-types.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-04-01 10:30:10 +08:00
Sven Liedtke 5cf9d3abf7 std::getenv is not supported using uwp 2023-04-01 01:02:21 +02:00
Kim Kulling 7c64b6c599
Merge pull request #4993 from Jackie9527/clang-cl-15.0.1-support
Add build options to fix issues with clang 15.
2023-03-31 18:28:12 +02:00
Kim Kulling 203e1468df
Merge branch 'master' into clang-cl-15.0.1-support 2023-03-30 22:03:30 +02:00
Kim Kulling 9c17c8c39a
Merge pull request #5037 from liedtkeInTUM/fix_crypt_link_issue_uwp
Fix link issue in UWP builds without functional replacement
2023-03-30 21:59:22 +02:00
liedtkeInTUM d032c3162a
Merge branch 'master' into fix_crypt_link_issue_uwp 2023-03-30 09:37:28 +02:00
Sven Liedtke 6d65e9c393 Fix link issue in UWP builds without functional replacement 2023-03-30 09:21:30 +02:00
Kim Kulling 85b470a3ee
Merge branch 'master' into clang-cl-15.0.1-support 2023-03-29 21:20:25 +02:00
Kim Kulling 6fa2f86d6b
Merge pull request #5032 from assimp/kimkulling-patch-1
Update Readme.md
2023-03-29 21:19:42 +02:00
Kim Kulling 4daf8c36bc
Merge branch 'master' into kimkulling-patch-1 2023-03-29 20:41:54 +02:00
aniongithub 4438b3ecc9 Fix Issue #4486 using the fix described by @jianliang79 2023-03-29 18:36:18 +00:00
Kim Kulling 5d6ca9808d
Merge pull request #5035 from assimp/kimkulling/update-readme
Update Readme.md
2023-03-28 17:04:57 +02:00
Kim Kulling 55fa3d4251
Update Readme.md 2023-03-28 15:19:33 +02:00
Kim Kulling 3801d7e78f
Merge pull request #5034 from assimp/kimkulling/update-readme
Update Readme.md
2023-03-28 14:57:03 +02:00
Kim Kulling f4e9930e50
Update Readme.md 2023-03-28 13:45:09 +02:00
Adam Beili 8ac0af5c58
. 2023-03-26 17:13:16 +02:00
Adam Beili b6ecba9114
fix 2023-03-26 17:03:46 +02:00
Adam Beili 83053f3d56
Made usePbrSpecGloss a exportproperty, fixed mat_specular to spec 2023-03-26 16:55:38 +02:00
Adam Beili fa00571049
fixed compilation bug 2023-03-26 14:52:44 +02:00
Kim Kulling d8201bdb6f
Update Readme.md 2023-03-25 16:00:29 +01:00
Adam Beili c9177b7811
Merge branch 'master' into refactor/KHR_material_specular 2023-03-24 21:47:19 +01:00
Turo Lamminen 6832aa227a Add more DXF files to unit tests 2023-03-24 11:32:06 +02:00
Turo Lamminen bed2cf1a23 Add more BVH files to unit tests 2023-03-24 11:32:06 +02:00
Turo Lamminen e8d4a11af5 Add more 3DS files to unit tests 2023-03-24 11:32:06 +02:00
Turo Lamminen 0e657b575b Add more 3D files to unit tests 2023-03-24 11:32:06 +02:00
Kim Kulling e02a1ff577
Merge pull request #5017 from tellypresence/provide-utf8-IRR-files
Add UTF-8 versions of UTF-16LE IRR/IRRMesh files
2023-03-24 00:10:35 +01:00
Kim Kulling e6c63cbee2
Merge branch 'master' into provide-utf8-IRR-files 2023-03-23 22:53:34 +01:00
Kim Kulling 03aee802b2
Merge pull request #5030 from assimp/kimkulling/add-code-of-conduct-1
Create CODE_OF_CONDUCT.md
2023-03-23 17:59:10 +01:00
inhosens 7095c4f52f
Merge branch 'master' into master 2023-03-23 07:30:49 +01:00
Steve M fc1a88deb4
Merge branch 'master' into provide-utf8-IRR-files 2023-03-22 14:49:08 -07:00
Kim Kulling f43281e89b
Merge branch 'master' into kimkulling/add-code-of-conduct-1 2023-03-22 21:48:34 +01:00
Kim Kulling 7437f20d0a
Merge pull request #5026 from turol/amf-tests
Add more AMF unit tests
2023-03-22 20:06:22 +01:00
Kim Kulling c32f4b71b7
Create CODE_OF_CONDUCT.md 2023-03-22 20:00:09 +01:00
Turo Lamminen 5ddd18d1c7 Add more AMF unit tests 2023-03-22 12:06:30 +02:00
inhosens 7cc0c06fdb
Merge branch 'assimp:master' into master 2023-03-22 08:30:52 +01:00
Steve M 9552769f82
Merge branch 'master' into provide-utf8-IRR-files 2023-03-21 13:35:01 -07:00
Kim Kulling c546a4a73a
Merge pull request #4985 from MakerOfWyverns/master
Two bug fixes in Python port.
2023-03-21 20:43:40 +01:00
Kim Kulling 4e645a0412
Merge branch 'master' into master 2023-03-21 19:42:43 +01:00
Kim Kulling cf3c9d515a
Merge pull request #5019 from tellypresence/revert-possibly-corrupted-ply-file
Revert 3D model corrupted by a8a1ca9
2023-03-21 19:40:42 +01:00
Kim Kulling d8e2fc30a0
Merge branch 'master' into revert-possibly-corrupted-ply-file 2023-03-21 17:36:10 +01:00
Steve M d902c2293d
Merge branch 'master' into provide-utf8-IRR-files 2023-03-21 09:27:44 -07:00
Kim Kulling 6360c90ac0
Merge pull request #4981 from Jackie9527/1-1922
bugfix fails to check if point in triangle.
2023-03-21 13:19:31 +01:00
Kim Kulling f81bb90f89
Merge branch 'master' into 1-1922 2023-03-21 12:58:11 +01:00
Turo Lamminen 65440f17a1 Add more ASE model unit tests 2023-03-21 12:09:27 +02:00
Turo Lamminen ea3cc37890 Check node parents in ValidateDataStructure 2023-03-21 11:36:49 +02:00
Turo Lamminen 48d89622ee Use ASSERT_NE to check that scene has loaded
EXPECT_NE tries to continue so it ended up dereferencing
null pointers and crashed.
2023-03-21 11:36:49 +02:00
Inho Lee cdfdd75a66 FBXConverter : import FbxCamera correctly
FbxCamera's default value is correct but its transformed
values are described in each NodeProperties.
2023-03-21 10:35:24 +01:00
Kim Kulling 6da160f14d
Merge pull request #4980 from Jackie9527/1-3193
bugfix remove duplicated data.
2023-03-20 23:58:16 +01:00
Kim Kulling e7e4e3100f
Merge branch 'master' into 1-3193 2023-03-20 14:01:35 +01:00
Turo Lamminen 3a69e353f3 Make Blender MVert no field optional 2023-03-20 12:00:20 +02:00
Steve M 92409a821d Provide dwarf textures for COB model
Duped from B3D and X dwarf folders
2023-03-18 22:44:20 -07:00
Steve M e2063b3ba6 Revert to commit 13 May 2014 (08bacc7)
Changes were introduced to the binary portion of this file at some point
2023-03-17 22:42:17 -07:00
Steve M 95616cf5b5 Add UTF-8 versions of UTF-16LE files
Also duplicate missing textures for local model access
2023-03-17 22:13:40 -07:00
Kim Kulling e394bda707
Merge branch 'master' into 1-1922 2023-03-17 09:37:37 +01:00
Kim Kulling 5a4f7c0a37
Merge pull request #5007 from malortie/fix_hl1_mdl_importer_bone_hierarchy
Fix Half-Life 1 MDL importer bone hierarchy.
2023-03-16 14:20:49 +01:00
Kim Kulling 435181f5f5
Merge branch 'master' into fix_hl1_mdl_importer_bone_hierarchy 2023-03-15 14:38:09 +01:00
Kim Kulling 88f3b950c7
Merge pull request #5011 from assimp/kimkulling/remove-deprecated-badge
Remove alarm badge
2023-03-15 14:35:50 +01:00
Kim Kulling 16f9ba4935
Remove alarm badge 2023-03-15 13:26:24 +01:00
Kim Kulling b5f68d73ab
Merge branch 'master' into fix_hl1_mdl_importer_bone_hierarchy 2023-03-15 11:36:45 +01:00
Kim Kulling da1ec4de91
Merge pull request #5009 from assimp/kimkulling/refactoring_geoutils
Kimkulling/refactoring geoutils
2023-03-15 00:03:29 +01:00
Kim Kulling 7e5a178637 Update: Add missing geo doc. 2023-03-14 23:49:41 +01:00
Kim Kulling c537bd78d0 Refactoring: Code cleanup post-processing. 2023-03-14 23:39:36 +01:00
Kim Kulling 59d9711928 Refactoring: Code cleanup post-processing. 2023-03-14 23:37:10 +01:00
Kim Kulling 45c1da26b3 Refactoring: Code cleanup post-processing. 2023-03-14 23:34:31 +01:00
Kim Kulling 31ae9cde1c Refactoring: Code cleanup post-processing. 2023-03-14 23:32:03 +01:00
Kim Kulling 1147f0c8bd Refactoring: Code cleanup post-processing. 2023-03-14 21:04:43 +01:00
Kim Kulling 2acfc125c3 Refactoring: Make GeoUtils reusable 2023-03-14 20:03:14 +01:00
Marc-Antoine Lortie eb3b48e523 Invert logic in build_bone_children_hierarchy. 2023-03-14 09:21:45 -04:00
Marc-Antoine Lortie 25ab05eb49 Replace typedef by using. 2023-03-14 09:17:39 -04:00
Marc-Antoine Lortie 4c015077b8 Add missing member initializer. 2023-03-13 19:07:14 -04:00
Marc-Antoine Lortie 054dacd068 Improved comments. 2023-03-13 19:07:14 -04:00
Marc-Antoine Lortie 7bc4c12956 Simplified HL1 MDL nodes tests. 2023-03-13 19:07:13 -04:00
Marc-Antoine Lortie d500f60490 Adjust emptyBonesNames test. 2023-03-13 19:06:18 -04:00
Marc-Antoine Lortie 3c2a425869 Added a test to validate HL1 MDL bone hierarchy. 2023-03-13 19:06:18 -04:00
Marc-Antoine Lortie 4b4cb55f22 Fix HL1MDLLoader flattened bone hierarchy. 2023-03-13 19:06:18 -04:00
Kim Kulling fdcc45d010
Merge pull request #4979 from Jackie9527/1-3458
bugfix the three vertices are collinear
2023-03-12 19:17:22 +01:00
Kim Kulling 3840c8bd8d
Merge branch 'master' into 1-3458 2023-03-12 17:06:09 +01:00
Florian Born 8176c6a0e4 Adjusting the unit tests to pass new gltf 2023-03-10 18:36:43 +01:00
Kim Kulling 6e1959f061
Merge pull request #4991 from Jackie9527/1-4489
upgrade stb_image to v2.28.
2023-03-10 16:20:36 +01:00
Kim Kulling c9539f67e3
Merge branch 'master' into 1-4489 2023-03-10 16:10:51 +01:00
Florian Born 60cefdd549 Jan's fedback 2023-03-10 12:10:38 +01:00
Kim Kulling e308474163
Merge pull request #5004 from assimp/kimkulling/capi-cleanup
C-API: Code cleanup
2023-03-10 11:42:33 +01:00
Kim Kulling ffd222334f
Fix: Remove buggy namespace declaration 2023-03-10 09:00:37 +01:00
Kim Kulling 2f7882cb8d
Update: Small code cleanup 2023-03-10 08:49:58 +01:00
Kim Kulling 63dae0a7f2
Fix: Add security asserts. 2023-03-10 08:48:11 +01:00
Kim Kulling c82a6d05b0
Code cleanup 2023-03-10 08:43:12 +01:00
Florian Born dfd70b5c10 GLTF Importer: Build a list of the actual vertices so it works well with shared attribute lists 2023-03-09 19:06:58 +01:00
Kim Kulling 0ed957f70a
Merge pull request #4978 from Jackie9527/draco_1.5.6
upgrade draco to 1.5.6
2023-03-09 14:09:30 +01:00
Kim Kulling 348e672567
Merge branch 'master' into draco_1.5.6 2023-03-09 13:45:44 +01:00
Turo Lamminen f3767a4eb2 Use unordered_map for subdivision process edge map 2023-03-09 14:33:43 +02:00
Turo Lamminen b534584198 Improve unit tests which load subdivision models 2023-03-09 14:33:43 +02:00
Kim Kulling 980e156251
Merge branch 'master' into draco_1.5.6 2023-03-08 13:52:38 +01:00
Kim Kulling 366243f7ef
Merge pull request #4999 from FlorianBorn71/UseNewMetaDataTypesInFBXConverter
After Kim's addition to meta data types, use it in the FBX converter
2023-03-08 11:54:29 +01:00
Kim Kulling 05249353d4
Merge branch 'master' into UseNewMetaDataTypesInFBXConverter 2023-03-08 10:53:00 +01:00
Kim Kulling 8476a2c832
Merge pull request #4994 from urshanselmann/master
remove debug message from MemoryIOStream
2023-03-08 10:17:26 +01:00
Kim Kulling 8c9580cfd3
Merge branch 'master' into UseNewMetaDataTypesInFBXConverter 2023-03-07 21:32:37 +01:00
Urs Hanselmann 8fb83af079
Merge branch 'master' into master 2023-03-07 19:45:45 +01:00
Kim Kulling 3a73ce37e4
Merge pull request #4986 from assimp/kimkulling/fix_sample_utf8_encoding
Fix: Use C++17 compliant utf8 encoding.
2023-03-07 19:27:06 +01:00
Kim Kulling 4f48348af8 Fix: Move c++ include to c++ section 2023-03-07 18:55:18 +01:00
Florian Born 069b3ecdf8 After Kim's addition to meta data types, use it in the FBX converter 2023-03-07 17:44:48 +01:00
Kim Kulling 44c2785663
Make debug message more professional. 2023-03-07 17:01:08 +01:00
Kim Kulling 5082c940d0 Fix: Replace back_inserter usage. 2023-03-06 21:13:40 +01:00
Kim Kulling 8171e041fa Update utf82utf16. 2023-03-06 20:56:09 +01:00
Kim Kulling c089f11768 Update utf82utf16. 2023-03-06 19:56:11 +01:00
Kim Kulling c305b50f13
Merge branch 'master' into draco_1.5.6 2023-03-05 18:44:26 +01:00
Urs Hanselmann dcb89cf107 fix scan_printf script error code handling 2023-03-04 15:00:43 +01:00
Urs Hanselmann 2efd48dee2 disable another debug print message 2023-03-04 14:53:48 +01:00
Urs Hanselmann 4fa433c8ff improve scan_printf ci script error message 2023-03-04 14:52:49 +01:00
Urs Hanselmann 1520aff680 fix scan_printf script in linux bash 2023-03-04 14:41:10 +01:00
Urs Hanselmann 74c406dd26 add ci script to scan for unexpected printf statements 2023-03-04 14:27:58 +01:00
Jackie9527 424f53b4d6 bugfix remove duplicated data.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-03-04 16:25:56 +08:00
Urs Hanselmann 011382424b remove debug message from MemoryIOStream (used by public Importer::ReadFileFromMemory method) 2023-03-03 19:31:50 +01:00
Kim Kulling 7916f87404
Merge branch 'master' into kimkulling/fix_sample_utf8_encoding 2023-03-02 23:35:54 +01:00
Jackie9527 a0c29202be Add build options to fix issues with clang 15.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-03-02 21:12:35 +08:00
Jackie9527 02a4276924 upgrade stb_image to v2.28.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-03-02 09:11:54 +08:00
Kim Kulling 6ed433d011
Merge pull request #4989 from Jackie9527/SimpleTexturedDirectx11-build-error-with-VS2022
Fix build error when building SimpleTexturedDirectx11 with VS2022.
2023-03-01 22:21:33 +01:00
Kim Kulling b82c193dfd Merge branch 'kimkulling/fix_sample_utf8_encoding' of https://github.com/assimp/assimp into kimkulling/fix_sample_utf8_encoding 2023-03-01 21:41:28 +01:00
Kim Kulling 1092f0d94e Fix:Use correct encoding 2023-03-01 21:40:45 +01:00
Jackie9527 09dd0d0c2e Fix build error when building SimpleTexturedDirectx11 with VS2022.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-03-01 15:08:02 +08:00
Jackie9527 f7f54036f2 bugfix the three vertices are collinear when converting a polygon to a triangle.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-03-01 14:26:04 +08:00
Jackie9527 39efe4c832 upgrade draco to 1.5.6
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-03-01 09:43:40 +08:00
Kim Kulling 534ee288c5
Update UTFConverter.h 2023-02-28 23:28:24 +01:00
Kim Kulling 60da5e7e96
Update UTFConverter.cpp 2023-02-28 23:27:46 +01:00
Kim Kulling 7f2760fe2f
Merge branch 'master' into kimkulling/fix_sample_utf8_encoding 2023-02-28 21:54:35 +01:00
Kim Kulling a1aace74e5 Fix: Use C++17 compliant utf8 encoding. 2023-02-28 21:53:18 +01:00
FeeshWyvern f9fcf33aaa Bug fix: We should not be accessing `mPrivate` according to structs.Scene and fixes a crash when `mPrivate` points to invalid data. 2023-02-27 20:06:05 -08:00
FeeshWyvern 94d9773548 Bug fix: Correctly set the name of the attributes. PR #3940 did not seem to update in Master? 2023-02-27 20:02:34 -08:00
Kim Kulling 90333340d6
Merge pull request #4977 from turol/lwo-fixes
LWO fixes
2023-02-27 16:10:27 +01:00
Jackie9527 437958ef91 bugfix fails to check if point in triangle.
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
2023-02-25 19:40:24 +08:00
Turo Lamminen e8f0eb930d Fix loading binary LWO files 2023-02-24 14:40:27 +02:00
Turo Lamminen 3bdc43a216 Add debug logging to LWO node graph generation 2023-02-24 14:40:27 +02:00
Turo Lamminen 657c1d8ad0 Use unique_ptr to store pivot nodes until moved to mapPivot 2023-02-24 14:40:23 +02:00
Turo Lamminen 3bdfecb0ed Destroy mapPivot nodes as we go 2023-02-24 13:26:34 +02:00
Turo Lamminen be28f0949b Whitespace 2023-02-24 13:20:40 +02:00
Turo Lamminen 53c6cc0966 Add a scope so mapPivot is destroyed when no longer used 2023-02-24 13:19:38 +02:00
Turo Lamminen 92f7c50c91 Remove dead code 2023-02-24 13:18:04 +02:00
Turo Lamminen 28d4e394c0 Use std::unique_ptr a bit 2023-02-24 13:17:32 +02:00
Turo Lamminen bb5a6abae0 Add more LWO files to unit tests 2023-02-24 12:43:06 +02:00
Kim Kulling 46ae8534f7
Merge pull request #4963 from avaneyev/fix-fbx-document-duplicate-id-leak
Fix a leak in FBXDocument when duplicate object IDs are found
2023-02-23 10:53:40 +01:00
Kim Kulling eb73464055
Merge branch 'master' into fix-fbx-document-duplicate-id-leak 2023-02-23 10:39:52 +01:00
Kim Kulling a14696b9ec
Merge pull request #4940 from ockeymm123/master
fix regression in join vertices post process.
2023-02-23 10:39:09 +01:00
Kim Kulling 2c3d52a5a1
Merge branch 'master' into master 2023-02-23 10:15:07 +01:00
Kim Kulling 408c41d687
Merge pull request #4971 from mjunix/patch-2
Fix index out of bounds
2023-02-22 21:47:01 +01:00
Kim Kulling c8d50dc83f
Merge branch 'master' into patch-2 2023-02-22 21:33:20 +01:00
Kim Kulling 27225fadc1
Merge pull request #4970 from mjunix/patch-1
Fix index out of bounds
2023-02-22 21:32:56 +01:00
Kim Kulling 4d6b7ff8b4
Merge branch 'master' into patch-1 2023-02-22 20:35:47 +01:00
Kim Kulling 277e19106a
Merge pull request #4974 from assimp/kimkulling/fix_minor_typo_in_doc_issue-4973
Fix: Fix typo in doc
2023-02-22 09:38:16 +01:00
Kim Kulling 009cd6c64a
Merge branch 'master' into patch-2 2023-02-21 21:35:56 +01:00
Kim Kulling 6aac7a2458
Fix: Fix typo in doc
- closes https://github.com/assimp/assimp/issues/4973
2023-02-21 21:34:49 +01:00
Turo Lamminen 2d448616d0 Move string definitions into conditional block to fix unused variable warnings 2023-02-21 12:49:39 +02:00
Kim Kulling 7de21694e9
Merge pull request #4962 from assimp/kimkulling/skeleton_update_doc
Update mesh.h
2023-02-21 10:04:34 +01:00
Kim Kulling 65b0553b8d
Merge branch 'master' into kimkulling/skeleton_update_doc 2023-02-21 09:50:27 +01:00
Johan Mattsson fa4273ee1f
Fix index out of bounds 2023-02-20 19:56:57 +01:00
Johan Mattsson f8132bf17c
Fix index out of bounds 2023-02-20 19:50:06 +01:00
Kim Kulling ad2f0682e7
Merge pull request #4965 from aaronmjacobs/implicit-conversion-fixes
Fix implicit conversion errors on macOS
2023-02-19 20:18:45 +01:00
Kim Kulling 1f0bcdf54c
Merge branch 'master' into implicit-conversion-fixes 2023-02-19 16:00:54 +01:00
Kim Kulling c8a0119e45
Merge pull request #4967 from assimp/kimkulling/add_missing_metadatatypes_issue-4959
Add missing pod types.
2023-02-19 16:00:40 +01:00
Kim Kulling 3ad67771fe Add missing pod types. 2023-02-18 17:09:14 +01:00
Aaron Jacobs 53e5f19b14 Use C++ style casts 2023-02-17 11:20:00 -08:00
Aaron Jacobs e4386d3013 Fix implicit conversion errors on macOS 2023-02-16 15:21:43 -08:00
Anton Vaneev 2cd3da4831
Fix a leak in FBXDocument when duplicate object IDs are found
When a duplicate ID is encountered, existing LazyObject is overwritten. Previously allocated instance leaks.

This change deletes the previously allocated instance before overwriting the pointer.
2023-02-16 11:21:29 +01:00
Kim Kulling 3585dd577d
Fix: Add default parameter to constructor/destructor. 2023-02-16 11:19:23 +01:00
Kim Kulling 7877dab43a
Fix: Fix typo 2023-02-16 10:59:36 +01:00
Kim Kulling bc8a122d88
Review finding: Use constexpr instead of macro 2023-02-16 09:28:35 +01:00
Kim Kulling 4950d02bac
Merge pull request #4960 from shammellee/fix-pyassimp-readme-typo
Fix PyAssimp README typo
2023-02-15 21:22:16 +01:00
Kim Kulling 9898138516
Update mesh.h 2023-02-15 21:02:03 +01:00
Shammel Lee 4c723a4ec8 Fix PyAssimp README typo 2023-02-14 20:21:33 -05:00
Kim Kulling bfa19f6900
Merge pull request #4946 from assimp/kimkulling/skeleton-doc
Add skeleton doc
2023-02-14 21:08:03 +01:00
Kim Kulling 779912e84e
Merge branch 'master' into kimkulling/skeleton-doc 2023-02-13 21:29:32 +01:00
Kim Kulling bb9b583bcf
Merge pull request #4945 from jiannanya/MemoryIOStream-override-mark
the member 'Flush()' need to be marked as override for msvc clang compiling
2023-02-13 10:03:51 +01:00
Kim Kulling 156a393b84
Fix a typo 2023-02-10 08:07:09 +01:00
Kim Kulling bde9a6a3c3
Update mesh.h 2023-02-09 22:36:06 +01:00
Kim Kulling 7b3f70a08b
Add skeleton doc 2023-02-09 21:12:21 +01:00
jiannanya 2390822baf Fix: the member function 'Flush()' of class 'MemoryIOStream' need to be marked as override for msvc clang compiling 2023-02-09 21:30:48 +08:00
Kim Kulling 4cf1ee98f6
Merge pull request #4943 from assimp/kimkulling/fix_leak_issue-3416
Fix: Fix memleak when exiting method by exception
2023-02-08 22:18:01 +01:00
Kim Kulling b7d08fc8f2
Fix review findings. 2023-02-08 21:48:55 +01:00
Kim Kulling b170370e5c Fix: Fix memleak when exiting method by exception 2023-02-08 21:29:54 +01:00
ockeymm123 57fc7144a7
Merge branch 'master' into master 2023-02-08 14:46:27 +08:00
sunjc fb146b7d39 fix typo, use a macro to avoid magic numbers. 2023-02-08 10:13:48 +08:00
Kim Kulling dd6bcecf56
Merge pull request #4941 from assimp/kimkulling/cleanup
Delete .coveralls.yml
2023-02-07 20:54:41 +01:00
Kim Kulling 0c05682baf
Delete .coveralls.yml 2023-02-07 20:02:06 +01:00
sunjc 647f1e47fa fix regression in join vertices post process. 2023-02-07 20:05:39 +08:00
Kim Kulling 487c03f547
Merge pull request #4935 from IOBYTE/master
ACLoader: add support for reading more than one texture per object
2023-02-04 19:28:21 +01:00
Kim Kulling 839cd35a54
Merge branch 'master' into master 2023-02-04 19:08:39 +01:00
Kim Kulling e6877cf20f
Merge pull request #4936 from TinyTinni/issue-4871
Fixes PLY reader when the header ends with \r\n
2023-02-04 19:08:12 +01:00
Kim Kulling e9c95d484e
Update IOStreamBuffer.h 2023-02-04 18:36:36 +01:00
Matthias Möller db72c6ee38 When "getNextBlock" was called after "getNextLine", the pointer could still on the newline.
The pointer to a newline could not advance enough, when the line ended with \r\n. The resulting buffer was correct, as the buffer range went from <start> until \r, but that the pointer increased by just 1 could lead to the problem that the next pointer points at \n, which is still part of the newline and therefore, "getNextBlock" got 1 byte too much.

Refs Issue #4871
2023-02-04 15:16:22 +01:00
Robert Reif 88ef9eecc1 ACLoader: add support for reading more than one texture per object 2023-02-03 20:29:56 -05:00
Kim Kulling 8c6b3fe69a
Merge pull request #4934 from turol/terragen_fix
Fix Terragen loader
2023-02-03 11:42:15 +01:00
Turo Lamminen 9453342491 Re-enable Terragen loader unit test 2023-02-03 11:45:11 +02:00
Turo Lamminen 8d405d60d9 Fix Terragen loader
Fixes e8d2b84017
2023-02-03 11:44:27 +02:00
Kim Kulling dbd0ae8f22
Merge pull request #4932 from turol/unit-test-fix
Unit test warning fixes
2023-02-03 00:15:48 +01:00
Kim Kulling 14b80f1ac4
Merge branch 'master' into unit-test-fix 2023-02-02 22:05:38 +01:00
Kim Kulling ea7321aae2
Merge pull request #4898 from shaunrd0/zlib-nobuild
Don't build zlib if ASSIMP_BUILD_ZLIB=OFF
2023-02-02 20:45:02 +01:00
Turo Lamminen a2273df48e Unit test warning fixes
GCC was warning about possibly uninitialized variables. Initialize them
and use values which are nonzero and distinct from each other and any
real value passed to any set method. This should prevent any false positives
from zero initialization.
2023-02-02 14:07:16 +02:00
Kim Kulling 213b536282
Merge branch 'master' into zlib-nobuild 2023-02-01 20:24:41 +01:00
Kim Kulling 6999caa683
Merge pull request #4899 from PencilAmazing/PLYcomments#4866
Fix issue #4866 by continuing to resetting read loop after hitting a comment
2023-02-01 20:06:59 +01:00
PencilAmazing feb3e9ff7a
Merge branch 'master' into PLYcomments#4866 2023-02-01 13:05:55 -05:00
Kim Kulling ce2f947eb1
Merge branch 'master' into zlib-nobuild 2023-01-31 22:00:49 +01:00
Kim Kulling b55e29b915
Merge pull request #4901 from AdamCichocki/JoinVerticesProcessUsedVerticesMask
Optimized usedVertexIndices in JoinVerticesProcess by using bitmask instead of unordered_set
2023-01-31 21:25:46 +01:00
Kim Kulling 5caae1a86d
Merge branch 'master' into JoinVerticesProcessUsedVerticesMask 2023-01-31 21:03:32 +01:00
Kim Kulling e4c85645c6
Merge pull request #4910 from assimp/kimkulling/ios_remove_deprecated_lib_issue-4906
Fix: Remove deprecated dependency.
2023-01-31 21:02:17 +01:00
Kim Kulling 47303c2d28 Fix:Remove deprecated features from iOS build. 2023-01-31 20:41:18 +01:00
Kim Kulling 5c286b8c13 Fix: Remove deprecated dependency. 2023-01-31 20:12:07 +01:00
Kim Kulling d2d8b84f83
Merge pull request #4880 from krishty/fix-build-without-armaturepopulate-post-process
Fix Build Without ArmaturePopulate Post Process Step
2023-01-31 10:23:44 +01:00
Kim Kulling d6b8d61066
Merge branch 'master' into JoinVerticesProcessUsedVerticesMask 2023-01-30 20:58:21 +01:00
PencilAmazing 527d110917
Merge branch 'master' into PLYcomments#4866 2023-01-30 09:35:57 -05:00
krishty df28e7830f
Merge branch 'master' into fix-build-without-armaturepopulate-post-process 2023-01-29 01:14:33 +01:00
Kim Kulling 77e34eedc0
Merge pull request #4904 from tellypresence/update-morph-documentation
Update morph mesh documentation now that gltf known to work
2023-01-27 10:03:34 +01:00
Steve M eff13f6a40 Update morph mesh documentation now that gltf known to work 2023-01-25 20:52:25 -08:00
Shaun Reed ffbeb2db18 CI 2023-01-25 17:46:10 -05:00
Shaun Reed 37903f8ed2 Don't build zlib if ASSIMP_BUILD_ZLIB=OFF 2023-01-25 17:46:10 -05:00
PencilAmazing 6dc12f57a2
Merge branch 'master' into PLYcomments#4866 2023-01-23 21:50:26 -05:00
Kim Kulling 3e7121e1cc
Merge pull request #4892 from lsnoel/fixLHNormals
Correctly consider aiProcess_FlipWindingOrder and aiProcess_MakeLeftHanded when generating normals
2023-01-24 00:16:21 +01:00
Kim Kulling 57054415cf
Merge branch 'master' into fixLHNormals 2023-01-24 00:04:49 +01:00
Kim Kulling 8463242449
Merge pull request #4889 from krishty/fix-msvc-emplace-warnings
Fix MSVC Warnings With “emplace_back()”
2023-01-24 00:04:21 +01:00
PencilAmazing 4d733d80f1
Merge branch 'master' into PLYcomments#4866 2023-01-23 15:56:04 -05:00
Kim Kulling b31c04e37c
Merge branch 'master' into fix-msvc-emplace-warnings 2023-01-23 21:37:41 +01:00
Kim Kulling 4d5e47a870
Merge pull request #4888 from krishty/clean-up-ctors-dtors
Tidy Up Constructors and Destructors
2023-01-23 21:37:08 +01:00
Kim Kulling f830d7998e
Merge branch 'master' into clean-up-ctors-dtors 2023-01-23 21:21:34 +01:00
Kim Kulling a7c4399c26
Merge pull request #4887 from krishty/remove-stray-semicolon
Remove Stray Semicolon
2023-01-23 20:26:10 +01:00
PencilAmazing cb8320945d Fix issue #4866 by continuing to resetting read loop after hitting a comment 2023-01-23 14:18:50 -05:00
Kim Kulling 036f2b3771
Merge branch 'master' into remove-stray-semicolon 2023-01-23 20:06:43 +01:00
Kim Kulling a9ce8a967d
Merge pull request #4886 from shimaowo/fix_gltf2_camera_fov
Fix: fix incorrect math for calculating the horizontal FOV of a perspective camera in gltf2 import #4435
2023-01-23 20:06:06 +01:00
Kim Kulling 3e20502e0f
Merge branch 'master' into fix_gltf2_camera_fov 2023-01-23 19:14:42 +01:00
Kim Kulling ff9b6c8d79
Merge pull request #4885 from krishty/replace-variables-with-literals
Replace Variables With Literals
2023-01-23 19:10:15 +01:00
Kim Kulling 3bd2f788f6
Merge branch 'master' into replace-variables-with-literals 2023-01-23 18:55:20 +01:00
AdamCichocki 5ed09b7ab6 usedVertexIndicesMask is now based on vector<boo> instead of vector<uint> 2023-01-23 16:39:06 +01:00
AdamCichocki 72b178b9fc Optimized usedVertexIndices by using bitmask instead of unordered_set 2023-01-23 14:51:02 +01:00
Kim Kulling cff81568f3
Merge pull request #4884 from krishty/remove-useless-virtual
Remove Useless “virtual”
2023-01-22 20:40:36 +01:00
Kim Kulling f2f967b8ba
Merge branch 'master' into remove-useless-virtual 2023-01-22 20:25:45 +01:00
Kim Kulling c48507beea
Merge pull request #4882 from krishty/trim-whitespace
Trim Trailing Whitespace
2023-01-22 17:17:53 +01:00
Kim Kulling f8bc8293ce
Update FBXMeshGeometry.h 2023-01-22 16:48:45 +01:00
Kim Kulling 303c30668f
Merge branch 'master' into trim-whitespace 2023-01-22 16:37:43 +01:00
Kim Kulling bf57eef8f2
Merge pull request #4897 from assimp/kimkulling/ensure_initializer_exists
Ensure initializer exists
2023-01-20 20:38:30 +01:00
Kim Kulling 7ad36b8925
Merge branch 'master' into kimkulling/ensure_initializer_exists 2023-01-20 20:01:41 +01:00
Kim Kulling 43d336311e
Merge pull request #4896 from assimp/kimkulling/remove_Zi_flag_msvc_issue-4845
Remove /Zi compiler flag for MSVC, release config
2023-01-20 20:00:51 +01:00
Kim Kulling 5ed01bcfa3
Ensure initializer exists
- Fixing a Codaxy finding.
2023-01-20 20:00:36 +01:00
Kim Kulling 9e1de3ec6e
Remove /Zi compiler flag for MSVC, release config
- closes https://github.com/assimp/assimp/issues/4845
2023-01-20 19:45:45 +01:00
Kim Kulling 288d49b721
Merge pull request #4895 from assimp/kimkulling/make_remove_empty_bones_optional_issue-4840
Update LimitBoneWeightsProcess.cpp
2023-01-20 19:33:41 +01:00
Kim Kulling 81cf1369db
Set correct number of bones in mesh instance 2023-01-20 19:20:06 +01:00
Kim Kulling ab0a119626
Update LimitBoneWeightsProcess.cpp
- Removing empty bones only if AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES is enabled.
- closes https://github.com/assimp/assimp/issues/4840
2023-01-20 19:14:04 +01:00
lsnoel 8d1256f472 Comments about winding order fix for gen normals 2023-01-20 14:55:06 +00:00
Kim Kulling d331a7e5d4
Merge branch 'master' into fix-build-without-armaturepopulate-post-process 2023-01-20 13:52:13 +01:00
lsnoel eb5d3c51e8 Correctly consider aiProcess_FlipWindingOrder AND aiProcess_MakeLeftHanded when generating normals 2023-01-19 16:46:29 +00:00
Krishty 72f360710a Fix MSVC Warnings With “emplace_back()”
Several places in the code call `std::vector<aiVector3D>.emplace_back(0, 0, 0)`. The constructor of `aiVector3D` actually expects arguments of the type `ai_real`, (alias of `float` if compiling without `ASSIMP_DOUBLE_PRECISION`) but the literal `0` is of type `int`.

`emplace_back()` does support promotion, but `int` to `float` is a potentially lossy conversion. tl;dr: On warning level 4, MSVC spits out a very deeply nested `warning C4244: 'argument': conversion from '_Ty' to 'TReal', possible loss of data with _Ty=int and TReal=ai_real`.
2023-01-18 00:08:38 +01:00
shimaowo 20acfeaf97
Merge branch 'master' into fix_gltf2_camera_fov 2023-01-17 14:39:54 -08:00
Kim Kulling 67eae8ee5a
Merge pull request #4878 from MMory/f-FixWhitespaceBetweenTagAndNum
Fix #4877
2023-01-17 20:04:47 +01:00
shimaowo b298b79a46 add missing parens 2023-01-17 10:53:41 -08:00
Martin Mory 7f6e96747b
Merge branch 'master' into f-FixWhitespaceBetweenTagAndNum 2023-01-17 13:32:39 +01:00
Kim Kulling d640a89035
Merge pull request #4879 from krishty/fix-build-with-m3d-import-only
Fix #4262 Build With M3D Import Only
2023-01-17 12:14:23 +01:00
Martin Mory a89d5c7cea
Merge branch 'master' into f-FixWhitespaceBetweenTagAndNum 2023-01-17 12:10:46 +01:00
Kim Kulling e9f95e5ab6
Merge branch 'master' into fix-build-with-m3d-import-only 2023-01-17 11:22:00 +01:00
Kim Kulling 6a8f169103
Merge pull request #4872 from drbct/fixJoinVerticesProcess
Generalize JoinVerticesProcess for multiple UV and color channels
2023-01-17 11:05:57 +01:00
Kim Kulling 19dec716d3
Merge branch 'master' into fixJoinVerticesProcess 2023-01-17 09:11:43 +01:00
Krishty 36305cf987 Tidy Up Constructors and Destructors
This commit does not add or remove c’tors or d’tors, so it is *not* ABI-breaking.

If a c’tor/d’tor does nothing else than the default behavior, this commit replaces it with “= default”.

If an initializer list entry does nothing else than the default behavior, this commit removes it. First and foremost, remove default c’tor calls of base classes (always called by the compiler if no other base c’tor is explicitly called) and c’tor calls of members with complex types (e.g. “std::vector”).

In a few instances, user-defined copy c’tors / move c’tors / assignment operators / move assignment operators were replaced with “= default”, too. I only did this if I had a clear understanding of what’s going on.
2023-01-16 21:47:11 +01:00
Krishty 43a062a5d7 Remove Stray Semicolon 2023-01-16 20:45:00 +01:00
shimaowo 39cbef1e21 Fix: fix incorrect math for calculating the horizontal FOV of a perspective camera in GLTF2 import #4435 2023-01-16 11:39:13 -08:00
Krishty 3d3e856925 Trim Trailing Whitespace 2023-01-16 09:12:35 +01:00
Krishty 793284a766 Fix Build Without ArmaturePopulate Post Process Step
This post process step introduced new attributes into `aiSkeletonBone`. Said attributes are only defined with the process enabled, i.e. when the `ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS` macro has not been defined.

Some code, however, accessed the variables unconditionally, leading to build failures if `ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS` was defined.

This commit adds the missing checks.
2023-01-16 08:42:50 +01:00
Krishty 5cbc00a595 Fix Build With M3D Import Only
`M3DWrapper.h` is designed to omit the definition of `class M3DWrapper` if neither M3D import nor M3D export are compiled.
608bccd9cf touched the corresponding preprocessor checks and introduced a bug:
```
#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
#if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER)
class M3DWrapper {
```
When compiling
- with M3D import enabled,
- but with either export generally disabled or M3D export disabled specifically,
These checks evaluate to the wrong result and skip the definition, leading to a build failure in dependent code.
```
#if 1 // import enabled
#if !(1 || 1) // export disabled and M3D export disabled
```
This commit fixes the check to compile the definition if neither import is disabled.
2023-01-16 08:29:49 +01:00
Krishty bad76fd0f1 Replace Variables With Literals 2023-01-16 08:18:36 +01:00
Krishty e5c02e8d45 Remove Useless “virtual”
These functions are already marked “override”, and their neighbors had “virtual” removed as well.
2023-01-16 08:12:24 +01:00
Martin Mory 43c0f8bb3d Remove whitespace between a <v> tag and the first number, otherwise first call to strtoul10() returns 0 and the indices are broken, leading to possible out-of-bound access and memory corruption/crash 2023-01-15 23:03:41 +01:00
Kim Kulling 70edec0efb
Merge pull request #4876 from assimp/kimkulling/remove_deprecated_comment_issue-4869
Remove deprecated comment
2023-01-15 20:42:31 +01:00
Kim Kulling 2d37f49f51
Remove deprecated comment
- closes https://github.com/assimp/assimp/issues/4869
2023-01-15 19:12:24 +01:00
Kim Kulling eb328ce69d
Merge pull request #4873 from tellypresence/improve-mMethod-typing
Change mMethod type to enum aiMorphingMethod
2023-01-13 10:31:45 +01:00
Steve M b2672c082d Change mMethod type to enum aiMorphingMethod
Address sanitizer warning
2023-01-12 12:35:28 -08:00
Daniel Rösner 74af523b3e Generalize JoinVerticesProcess for multiple UV and color channels 2023-01-12 13:13:46 +01:00
Kim Kulling 33c32b6b35
Merge pull request #4855 from asmaloney/spelling
Fix several spelling mistakes
2023-01-08 21:00:39 +01:00
Kim Kulling b393132b58
Merge branch 'master' into spelling 2023-01-08 17:43:55 +01:00
Kim Kulling 9ace81a3d2
Merge pull request #4863 from assimp/kimkulling/update_readme
Update the getting help section
2023-01-05 12:56:17 +01:00
Kim Kulling f6457e1c87
Update Readme.md 2023-01-05 11:34:12 +01:00
Kim Kulling fa7d3aa0c0
Update the getting help section 2023-01-05 11:32:01 +01:00
Kim Kulling 2af29f4836
Merge pull request #4861 from assimp/kimkulling/LWOAnimation_fix_division_by_zero_issue-4860
Fix: Fix possible division by zero
2023-01-04 09:37:41 +01:00
Kim Kulling 96b071bdb1
Fix: Fix possible division by zero
- closes https://github.com/assimp/assimp/issues/4860
2023-01-04 09:19:37 +01:00
Kim Kulling 767644cd3f
Merge pull request #4859 from assimp/kimkulling/fix_signed_unsigned_mismatch_warning-issue-4854
Fix: Fix signed unsigned mismatch
2023-01-03 21:24:17 +01:00
Kim Kulling df8a9bb2b8
Fix: Fix signed unsigned mismatch
- closes https://github.com/assimp/assimp/issues/4854
2023-01-03 21:11:09 +01:00
Kim Kulling 35162c19b2
Merge branch 'master' into spelling 2023-01-03 20:32:41 +01:00
Kim Kulling 8c57382b20
Merge pull request #4858 from asmaloney/cmake-remove-dead-code
{cmake} Remove dead code
2023-01-03 19:30:12 +01:00
Andy Maloney 465566a87e {cmake} Remove dead code
BUILD_LIB_TYPE isn't used anywhere.

I think the intent with "add_definitions" here was to affect cmake (?), but it's actually just adding "#define DDL_STATIC_LIBRARY OFF" which isn't used in the code anywhere.
2023-01-03 05:04:25 -05:00
Andy Maloney e893248e7c Fix several spelling mistakes & a comment 2023-01-01 13:31:48 -05:00
Kim Kulling 05279f8bbd
Merge pull request #4852 from sfjohnston/sfjohnston_mods
sprintf to snprintf with known MAXLEN for buffer.
2022-12-31 15:29:24 +01:00
sfjohnston 25f0146f44 sprintf to snprintf with known MAXLEN for buffer. 2022-12-28 12:32:11 -08:00
Kim Kulling 7eadcebc9f
Merge pull request #4850 from assimp/kimkulling/move_asserthandler_to_include_issue-4779
Refactoring: Move asserthandler header to include
2022-12-23 16:57:37 +01:00
Kim Kulling ef5dd8c451
Merge branch 'master' into kimkulling/move_asserthandler_to_include_issue-4779 2022-12-23 16:29:30 +01:00
Kim Kulling a8e50be781 Refactoring: Move asserthandler header to include 2022-12-23 16:19:39 +01:00
Kim Kulling 883667c61a
Merge pull request #4848 from assimp/kimkulling/unzip_fix_compiler_warning
Update unzip.c
2022-12-23 14:07:04 +01:00
Kim Kulling 89b5011759
Update unzip.c
- Fix compiler warning.
2022-12-23 13:50:16 +01:00
Kim Kulling 022c385571
Merge pull request #4846 from rohit-kumar-j/patch-1
illegal token on right-side-of ::Windows
2022-12-19 09:49:20 +01:00
Kim Kulling 76de8ba1f4
Update material.inl 2022-12-19 08:58:45 +01:00
RKJ 6743274b31
illegal token on right-side-of ::Windows
Error without:
```
assimp\material.inl(101,47): message : error recovery skipped: ') ?'
```

Reference : https://stackoverflow.com/questions/2561368/illegal-token-on-right-side-of
2022-12-19 04:06:36 +05:30
Kim Kulling 1e2cff6383
Merge pull request #4824 from umesh-huawei/master
Fixed bug when exporting binary FBX
2022-12-16 11:25:31 +01:00
Kim Kulling 376f66a06d
Merge branch 'master' into master 2022-12-16 10:11:56 +01:00
Kim Kulling 5c763f471c
Merge pull request #4838 from sashashura/patch-10
Fixes Heap-buffer-overflow READ 1 in Assimp::ObjFileParser::getFace
2022-12-16 09:18:23 +01:00
Kim Kulling c3d15a3f51
Fix minor review findings. 2022-12-16 09:03:40 +01:00
Kim Kulling c92b84e38d
Merge branch 'master' into patch-10 2022-12-16 09:00:41 +01:00
Kim Kulling 7c6e33fef1
Merge pull request #4837 from sashashura/patch-9
Fixes Heap-buffer-overflow READ 1 in Assimp::MD5::MD5Parser::ParseHeader
2022-12-15 15:08:16 +01:00
Kim Kulling db8ff41679
Update MD5Parser.cpp 2022-12-15 14:06:57 +01:00
Kim Kulling 2612950b7b
Merge branch 'master' into patch-9 2022-12-15 14:05:35 +01:00
Kim Kulling ee02c389ca
Merge pull request #4836 from sashashura/patch-8
Fixes Heap-buffer-overflow READ 4 in Assimp::ScenePreprocessor::ProcssMesh
2022-12-15 14:04:19 +01:00
sashashura 917352dd8b
Fixes Heap-buffer-overflow READ 1 in Assimp::ObjFileParser::getFace
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49274
2022-12-11 01:54:57 +01:00
Alex 90769ef3e6
Fixes Heap-buffer-overflow READ 1 in Assimp::MD5::MD5Parser::ParseHeader
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49422
When it reaches the `SkipSpacesAndLineEnd`, `in` already points past `bufferEnd` and it leads to out of bounds memory read.
2022-12-11 00:02:09 +00:00
Alex d5294be00b
Fixes Heap-buffer-overflow READ 4 in Assimp::ScenePreprocessor::ProcessMesh
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49797
2022-12-10 01:22:00 +00:00
Umesh Rajesh Ramchandani 2d372b302f Fixed bug when exporting binary FBX
Fixed vector subscript out of range bug when NULL_RECORD is passed to PutString and is actually null
2022-12-08 14:59:25 +01:00
Kim Kulling 0fdae2879d
Merge pull request #4825 from Gargaj/floatwarnings
fix warnings-as-errors for msvc 2019 x64
2022-12-08 14:48:54 +01:00
Kim Kulling fec39154ed
Merge branch 'master' into floatwarnings 2022-12-08 14:18:35 +01:00
Kim Kulling b2b85bf971
Merge pull request #4832 from assimp/kimkulling/fix_heap_overflow_issue-4831
Ensure face pointer is not nullptr
2022-12-08 09:50:24 +01:00
Kim Kulling 769b47ed0e
Ensure face pointer is not nullptr
- closes https://github.com/assimp/assimp/issues/4831
2022-12-08 09:35:11 +01:00
Kim Kulling 3f66b92797
Merge branch 'master' into master 2022-12-06 20:34:51 +01:00
Kim Kulling 65bedac389
Merge pull request #4829 from assimp/kimkulling/avoid_undefined_shift_issue-4822
Avoid undefined-shift in Assimp::ASE::Parser::ParseLV4MeshFace.
2022-12-05 13:31:31 +01:00
Kim Kulling 9d57ac9cc5 Fix:Add missing semicolon. 2022-12-05 13:15:42 +01:00
Kim Kulling 81f85a6f93 Avoid undefined-shift in Assimp::ASE::Parser::ParseLV4MeshFace. 2022-12-05 13:07:52 +01:00
Gargaj 9c839f2d9a more fixes 2022-12-03 20:44:57 +01:00
Gargaj 07d4e83f43 fix warnings-as-errors for msvc x64 2022-12-03 20:27:00 +01:00
Kim Kulling 28c155bfb4
Merge pull request #4820 from assimp/kimkulling/MDL_fix_division_by_zero_issue-4819
FIX: Fix possible division by zero
2022-12-02 10:00:12 +01:00
Kim Kulling f8bb7704ad
Fix: MAke quaternion check in unittest more robust
Just add an epsilon test by using the correct comparator from gtest.
2022-12-02 09:43:59 +01:00
Kim Kulling 62486c6e7c
FIX: Fix possible division by zero
- closes https://github.com/assimp/assimp/issues/4819
2022-12-02 09:24:51 +01:00
Kim Kulling d8b9e2b64b
Merge branch 'master' into master 2022-12-02 08:41:43 +01:00
Kim Kulling b0987f4513
Merge pull request #4816 from tkoeppe/explspec
[BlenderDNA.h] Declare explicit specializations
2022-11-30 15:07:11 +01:00
Kim Kulling f578b15759
Merge branch 'master' into explspec 2022-11-30 14:03:09 +01:00
Kim Kulling 497e286cfa
Merge pull request #4792 from Skylion007/modernize-smartptrs-literals
Modernize smartptrs and use C++11 literals
2022-11-29 20:32:02 +01:00
Thomas Köppe 7d06d798af [BlenderDNA.h] Declare explicit specializations
It is an ODR violation to use a template specialization for which an
explicit specialization is defined somewhere whose declaration is not
visible at the point of use.

Found via clang's -Wundefined-func-template warning.
2022-11-29 18:38:33 +00:00
Adam Beili 54068637ee
Merge branch 'master' into refactor/KHR_material_specular 2022-11-29 17:35:52 +01:00
Kim Kulling 8fb7ba3444
Merge branch 'master' into modernize-smartptrs-literals 2022-11-29 09:58:17 +01:00
Kim Kulling 6f6f77232e
Merge pull request #4813 from assimp/kimkulling/improve_github_parallel_build
Introduce --parallel instead of .j
2022-11-29 09:57:52 +01:00
Kim Kulling 22cff318dc
Introduce --parallel instead of .j
Just use parallel command to improve the readability.
2022-11-29 09:34:56 +01:00
Kim Kulling f3f533c390
Merge branch 'master' into master 2022-11-23 23:00:29 +01:00
Kim Kulling b6adb9f2dd
Merge pull request #4805 from CMDR-JohnAlex/patch-1
Fixed some grammar and spelling mistakes
2022-11-22 23:49:46 +01:00
Kim Kulling 8f0e2db974
Merge branch 'master' into patch-1 2022-11-22 20:51:07 +01:00
Kim Kulling 10b99dc4ca
Merge pull request #4807 from DavidKorczynski/cifuzz-int
Add CIFuzz GitHub action
2022-11-22 20:46:51 +01:00
Kim Kulling 1476d50c7d
Merge branch 'master' into cifuzz-int 2022-11-22 19:10:03 +01:00
naota29 ab82428bb5
Merge branch 'master' into master 2022-11-22 07:15:38 -08:00
Kim Kulling 88041152ac
Merge pull request #4809 from assimp/kimkulling/fix_possible_overflow_issue-3422
Add overfolow check for invalid data.
2022-11-22 11:04:51 +01:00
Kim Kulling 5689ac7869
Add overfolow check for invalid data.
- closes https://github.com/assimp/assimp/issues/3422
2022-11-22 10:50:52 +01:00
David Korczynski 355ebbedf3 Add CIFuzz GitHub action 2022-11-21 16:45:38 -08:00
Justice Colby 371d5c78f4 Updated ConvertMaterials function to assign appopriate material index when using material references. 2022-11-21 15:49:48 -08:00
Kim Kulling b3daec65a0
Merge pull request #4787 from Beilinson/KHR_materials_emissive_strength
Added support for KHR_materials_emissive_strength
2022-11-21 23:51:55 +01:00
John Alexander Le Roux 80449dd014
Fixed some grammar and spelling mistakes 2022-11-21 15:51:21 -05:00
Kim Kulling 1d1cd93371
Merge branch 'master' into KHR_materials_emissive_strength 2022-11-21 20:55:13 +01:00
Adam Beili 5441f07d05
Merge branch 'master' into refactor/KHR_material_specular 2022-11-19 17:40:22 +02:00
Kim Kulling 6392dbfe4d
Merge pull request #4801 from jakrams/fbx-out-of-memory-fix
Don't hide out-of-memory during FBX import
2022-11-18 20:40:59 +01:00
Adam 1cd5841b2f . 2022-11-18 17:24:37 +02:00
Adam Beili 3b5e34ab30
Merge branch 'master' into refactor/KHR_material_specular 2022-11-18 16:10:39 +02:00
Adam Beili 863637a27e
Merge branch 'master' into KHR_materials_emissive_strength 2022-11-18 16:04:32 +02:00
Jan Krassnigg 08f2f0f82f Don't hide out-of-memory during FBX import 2022-11-18 13:50:33 +01:00
Kim Kulling 11fe77c446
Merge pull request #4800 from assimp/kimkulling/add_missing_header_issue-4720
Add missing header for Ubuntu 16 and Mac
2022-11-18 11:57:57 +01:00
Kim Kulling 3c51eafaf4
Add missing headerh will be needed on Ubuntu
- closes https://github.com/assimp/assimp/issues/4720
2022-11-18 11:39:51 +01:00
Adam Beili b8b515cbed
Merge branch 'master' into refactor/KHR_material_specular 2022-11-17 20:31:40 +02:00
Aaron Gokaslan b2cfe47d4e
Merge branch 'master' into modernize-smartptrs-literals 2022-11-17 12:22:08 -05:00
Kim Kulling 7f35bfb9e3
Merge branch 'master' into KHR_materials_emissive_strength 2022-11-15 21:37:36 +01:00
Kim Kulling 97d7f685ba
Merge pull request #4794 from assimp/kimkulling/prepare_submodule_update
Update dependabot.yml
2022-11-13 20:48:44 +01:00
Kim Kulling 49b3649264
Add submodule update. 2022-11-13 19:33:12 +01:00
Kim Kulling bea3924fce
Update dependabot.yml
- Add update of submodules
2022-11-13 19:32:09 +01:00
Adam ffaf378ee6 fixed misnamed matkey 2022-11-10 20:37:46 +02:00
Adam Beili ce7a52fd19
Merge branch 'master' into refactor/KHR_material_specular 2022-11-10 20:21:30 +02:00
Adam 822b240694 Support both pbrSpecGlos and materials_specular 2022-11-08 23:09:50 +02:00
Adam Beili 95d98ec98b
fixed indentation error 2022-11-08 20:55:20 +02:00
Adam Beili 49bc22ddb5
Merge branch 'master' into KHR_materials_emissive_strength 2022-11-08 20:51:20 +02:00
Aaron Gokaslan 3730b7414f Use make_shared in IFCBoolean 2022-11-08 11:30:53 -05:00
Aaron Gokaslan d635bc6914 Fix some indentation 2022-11-08 11:19:12 -05:00
Aaron Gokaslan ccfb175460 Apply various clang-tidy checks for smartprs and modern C++ types 2022-11-08 11:03:55 -05:00
Kim Kulling cfed74516b
Merge pull request #4785 from Skylion007/add-missing-std-move
chore: add missing std moves and perfect forwards
2022-11-08 15:03:29 +01:00
Kim Kulling b717b1cd3e
Retrigger the build
Fix review findings
2022-11-08 13:39:56 +01:00
Aaron Gokaslan 97cb1c6b15 Fix perfect fowards 2022-11-07 11:01:16 -05:00
Aaron Gokaslan 5a0df03d2b Fix another missing move in glTFCommon.h 2022-11-07 09:34:00 -05:00
Adam Beili 945d93b46a fixed indentation 2022-11-04 09:37:28 -07:00
Adam 852ea8325c Added support for KHR_materials_emissive_strength
according to spec https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_emissive_strength
2022-11-03 23:11:21 +02:00
Aaron Gokaslan 899f8e1d17 Remove redundant ctor 2022-11-03 12:46:40 -04:00
Aaron Gokaslan 02378b5e70 Add one more missing move 2022-11-03 12:36:58 -04:00
Aaron Gokaslan 8da3d277c7 add missing std moves 2022-11-03 12:35:10 -04:00
Kim Kulling 9a5d628232
Merge pull request #4776 from assimp/kimkulling/fix_nullptr_dereferecing_issue-4771
Fix: Avoid nullptr dereferencing + refactorings.
2022-10-29 17:25:06 +02:00
Kim Kulling 99e515fbfd Fix:Fix possible nullptr dereferencing + refactorings. 2022-10-29 17:08:26 +02:00
Kim Kulling c2967cf79a
Merge pull request #4759 from Let0s/trailing_zero_fix_collada_exporter
Fixed error with trailing zero symbol as placeholder character
2022-10-23 18:34:28 +02:00
Sergey ac87b9ce7e fixed error with trailing zero symbol as placeholder character 2022-10-19 09:30:32 +03:00
Kim Kulling f8f12c8609
Merge pull request #4755 from emvivre/master
* fix bug reading ply file in case of presence of "end_header\n<BINARY_DATA>..." with <BINARY_DATA> starting by "\n"
2022-10-18 21:13:35 +02:00
Kim Kulling 35136bc90c
Merge branch 'master' into master 2022-10-18 19:25:14 +02:00
Kim Kulling 57c156019f
Merge pull request #4761 from assimp/kimkulling/fix_missing_double_export_for_json_issue-4677
Fix: Add missing ahndling for double export in json
2022-10-18 19:22:01 +02:00
Kim Kulling 07aef23d24 Fix: Add missing ahndling for double export in json 2022-10-18 19:05:04 +02:00
emvivre a77dcffb19
Merge branch 'master' into master 2022-10-17 11:20:33 +02:00
Kim Kulling a3c209f2ca
Merge pull request #4757 from assimp/kimkulling/Fix_link_openddl_static_when_enabling_static_lib_issue-4516
Use correct flags for openddl for static libs
2022-10-16 18:46:22 +02:00
Kim Kulling e7cea5a283 Use correct flags for openddl for static libs 2022-10-16 18:30:45 +02:00
emvivre 0bef3a2e0b
Merge branch 'master' into master 2022-10-16 15:05:54 +02:00
Kim Kulling 565539bb68
Merge pull request #4756 from assimp/kimkulling/fix_use_correct_eps_in_interpolation_issue-4751
FIX: Use correct epsilon
2022-10-15 18:12:56 +02:00
emvivre fad49e0d12
Merge branch 'master' into master 2022-10-15 18:08:08 +02:00
Kim Kulling 4ac3b1fef5 FIX: Use correct epsilon 2022-10-15 16:11:02 +02:00
Kim Kulling e2f54d3c48
Merge pull request #4754 from rhabacker/master
Fix build error: ‘temp’ may be used uninitialized in this function
2022-10-15 09:16:36 +02:00
François Lozes e17976e6e2 * fix bug reading ply file in case of presence of "end_header\n<BINARY_DATA>..." with <BINARY_DATA> starting by "\n" 2022-10-14 13:16:18 +02:00
Ralf Habacker 3705336467 Fix build error: ‘temp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Fixes #4753
2022-10-13 08:30:04 +02:00
Kim Kulling 5a89d6fee1
Merge pull request #4744 from slinky55/clang-fix
Fixed issue with clang complaining about sprintf and vsprintf being depreciated
2022-10-06 08:13:53 +02:00
Kim Kulling 2e6c2315a2
Merge branch 'master' into clang-fix 2022-10-05 16:54:19 +02:00
Kim Kulling 002d50a54d
Merge pull request #4745 from cwoac/fix_defaults
fix incorrect documentation of defaults
2022-10-04 20:47:04 +02:00
Oliver Matthews 29032b176b
fix incorrect documentation of defaults 2022-10-03 11:49:38 +00:00
slinky55 e0fb1674d1 Merge branch 'clang-fix' of github.com:slinky55/assimp into clang-fix 2022-09-30 22:04:11 -04:00
slinky55 38ccb7e6c9 Used sizeof for buffer sizes instead of hardcoding values 2022-09-30 22:03:59 -04:00
slinky55 5f28370f7f
Merge branch 'master' into clang-fix 2022-09-30 21:57:32 -04:00
Kim Kulling b70277e1ab
Merge pull request #4738 from FlorianBorn71/MakeFBXParserResilientToMissingStreams
Make FBX parser resilient to missing data streams
2022-09-30 10:05:42 +02:00
slinky55 e2e45f7a14 Fixed issue with clang complaining about sprintf being depreciated 2022-09-30 00:34:33 -04:00
Kim Kulling 981677d4b9
Merge branch 'master' into MakeFBXParserResilientToMissingStreams 2022-09-30 00:13:45 +02:00
Kim Kulling 4b65d65af3
Merge pull request #4742 from feishengfei/master
FIX: C++ std::tuple constexpr initial list on old compiler
2022-09-29 22:20:15 +02:00
felix 0be5c567c9 FIX: C++ std::tuple constexpr initial list on old compiler [cont 1] 2022-09-29 23:34:23 +08:00
Kim Kulling 232d809ecc
Merge branch 'master' into master 2022-09-29 16:48:45 +02:00
Kim Kulling 816b8e6156
Update utglTF2ImportExport.cpp
Needed some change of scenery and optimized this a little bit.
2022-09-29 16:48:15 +02:00
feishengfei 789168ba31 FIX: C++ std::tuple constexpr initial list on old compiler 2022-09-29 09:38:40 +08:00
Kim Kulling ca11fceb65
Merge pull request #4734 from sashashura/patch-7
GitHub Workflows security hardening
2022-09-27 15:31:54 +02:00
Kim Kulling 92c7419a28
Merge branch 'master' into patch-7 2022-09-27 14:37:18 +02:00
Kim Kulling e477533a6d
Merge pull request #4737 from p12tic/prefix-stb-image-symbols
Prefix symbols from stb_image.h
2022-09-27 13:58:32 +02:00
Povilas Kanapickas f6a590065c Prefix symbols from stb_image.h
This makes it possible to link assimp statically into an executable with
another static library that includes stb_image.h without hiding its
symbols.
2022-09-23 04:08:21 +03:00
Povilas Kanapickas 22494bde17 Don't include stm_image implementation if using stb library from Hunter
Hunter compiles its own stb library binaries. Currently a second copy is
compiled by defining STB_IMAGE_IMPLEMENTATION in Assimp.cpp. This may
cause hard to understand bugs if this compiled copy ever becomes
different from what Hunter supplies.
2022-09-23 04:08:20 +03:00
Kim Kulling 9510132f3d
Merge branch 'master' into MakeFBXParserResilientToMissingStreams 2022-09-21 14:40:37 +02:00
Kim Kulling 9a11cabb06
Merge pull request #4739 from assimp/kimkulling/update-newer-visualsudio-versions
Introduce newer versions for MSVC Version
2022-09-21 14:39:38 +02:00
Kim Kulling 18cbe89a4c
Introduce newer versions for MSVC Version 2022-09-21 13:45:21 +02:00
Florian Born 7eb9edf0b9 Make FBX parser resilient to missing data streams 2022-09-21 11:45:54 +02:00
Kim Kulling 65b14ef79d
Merge pull request #4736 from assimp/kimkulling/fix_heap-buffer-overflow_in_md5_issue-4965
FIX: Fix head overflow in MD5-parser.
2022-09-20 21:52:13 +02:00
Kim Kulling 6415c0bfc9 FIX: Use attribute to fix warning. 2022-09-20 21:39:09 +02:00
Kim Kulling 1f61f0c3de FIX: Caculate buffer end pointer after initing all attributes 2022-09-20 21:35:44 +02:00
Kim Kulling f1766c4bd5 FIX: Fix head overflow in MD5-parser. 2022-09-20 21:03:58 +02:00
Alex 79c9c82026 build: harden sanitizer.yml permissions
Signed-off-by: Alex <aleksandrosansan@gmail.com>
2022-09-19 23:32:11 +02:00
Alex f39606589e build: harden ccpp.yml permissions
Signed-off-by: Alex <aleksandrosansan@gmail.com>
2022-09-19 23:31:58 +02:00
Kim Kulling a165dbc6ff
Merge pull request #4732 from assimp/kimkulling/reorganize_doc
IMP: Reorganize doc
2022-09-18 21:05:07 +02:00
Kim Kulling 295b0f4dbf
Merge branch 'master' into kimkulling/reorganize_doc 2022-09-18 20:50:40 +02:00
Kim Kulling c976ceec90
Merge pull request #4730 from waebbl/fix-version
Adjust cmake version
2022-09-18 19:32:53 +02:00
Kim Kulling be2eaac5a7 IMP: Reorganize doc 2022-09-18 19:31:48 +02:00
Kim Kulling 9d797c1489
Merge branch 'master' into fix-version 2022-09-18 19:11:34 +02:00
Kim Kulling 8d9a0f777d
Merge pull request #4731 from assimp/kimkulling/add_check_for_wall_enable_issue-4652
Add check for wall switch from cmake
2022-09-18 18:57:44 +02:00
Kim Kulling 704a187c90 FIX: Fix not initialized enums in unittest. 2022-09-18 18:10:56 +02:00
Kim Kulling 34eaf2d092 FIX: Initialize uninitialized enum in unittest. 2022-09-18 17:36:21 +02:00
Kim Kulling f59dd695c8 FIX: try to undefined behaviour by static_cast. 2022-09-18 16:03:54 +02:00
Kim Kulling 128922a798 FIX: Update unity build include file for gtest 2022-09-18 13:17:35 +02:00
Kim Kulling 2324e1ea51 Add missing file from gtest 2022-09-18 10:08:14 +02:00
Kim Kulling 09fe87b6d4 Googletest: Update to 1.12.1 2022-09-18 09:58:12 +02:00
Kim Kulling b3c7bdbdd6 Add check for wall switch from cmake 2022-09-17 18:16:42 +02:00
Bernd Waibel 8ce6f5ad27 Adjust cmake version
Closes: https://github.com/assimp/assimp/issues/4729
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
2022-09-17 15:21:57 +02:00
Kim Kulling 1944c45944
Merge pull request #4728 from assimp/kimkulling/fix_treeview_issue-4726
Fix: Use ASCII treeview in assimp-cmd.
2022-09-17 08:57:23 +02:00
Kim Kulling 93e356b47d
Merge branch 'master' into kimkulling/fix_treeview_issue-4726 2022-09-17 01:34:36 +02:00
Kim Kulling ff0c50236b
Merge pull request #4723 from ranpro/patch-1
Missing path
2022-09-16 23:55:04 +02:00
Kim Kulling c67ff12b06
Merge branch 'master' into patch-1 2022-09-16 23:12:19 +02:00
Kim Kulling 4804101f1d
Merge pull request #4721 from assimp/kimkulling/fix-pointcloud-config-doc
Fix config documentation for STL pointcloud export
2022-09-16 23:12:05 +02:00
Kim Kulling 7ebe21958d FIX: Fix review findings 2022-09-16 22:13:58 +02:00
Kim Kulling e4c77aa4fa Fix: Use ASCII treeview in assimp-cmd. 2022-09-16 21:55:14 +02:00
曾是然 9fab0af16a
Missing path 2022-09-16 14:54:20 +08:00
Kim Kulling 0dd5cfe3bf
Fix config documentation for STL pointcloud export 2022-09-12 18:32:28 +02:00
Kim Kulling 7be7e5d93e
Merge pull request #4717 from Skylion007/perfect-forward-utMaybe
Perfect forward val to utMaybe.cpp
2022-09-12 10:15:03 +02:00
Kim Kulling b2ea018fd5
Use user-define element destructor. 2022-09-11 17:04:58 +02:00
Aaron Gokaslan 20755f4200 Perfect forward val to utMaybe 2022-09-09 10:55:45 -04:00
Kim Kulling 7b874983d0
Merge branch 'master' into SmallAllocationFixInFBXLoader 2022-09-08 20:15:52 +02:00
Kim Kulling 9519a62dd2
Merge pull request #4715 from assimp/kimkulling/cleanup_after_review
Kimkulling/cleanup after review
2022-09-08 20:13:43 +02:00
Kim Kulling 6a1a7c43cc
Update utMaybe.cpp 2022-09-08 19:32:42 +02:00
Kim Kulling ad1d0fcb45
Merge branch 'master' into kimkulling/cleanup_after_review 2022-09-08 19:09:49 +02:00
Kim Kulling 3af53a42aa
Fix typo 2022-09-08 19:06:05 +02:00
Kim Kulling fff977c0b5
Fix review findings. 2022-09-08 18:54:08 +02:00
Kim Kulling d475c132bf
Merge pull request #4716 from HiMemX/master
Minor obj export bugfix
2022-09-08 12:51:31 +02:00
HiMemX 4c9d270a5e
-Vertex export fix 2022-09-07 23:10:31 +02:00
HiMemX 7872297ab7
Delete ObjExporter.cpp 2022-09-07 23:10:06 +02:00
HiMemX 396e7bcdb4
-Obj vertex fix 2022-09-07 23:09:50 +02:00
Kim Kulling 7116f46672 Add missing file 2022-09-07 21:28:04 +02:00
Kim Kulling 8895ecf243
Merge branch 'master' into kimkulling/cleanup_after_review 2022-09-07 21:26:54 +02:00
Kim Kulling 362ff08855 Add doc + small unittest 2022-09-07 21:25:46 +02:00
Kim Kulling edaf7fb7eb
Merge pull request #4713 from ChrisBlueStone/master
Fix aiBone.mOffsetMatrix documentation
2022-09-05 19:47:02 +02:00
Kim Kulling af0b29f30d
Merge branch 'master' into master 2022-09-05 19:09:19 +02:00
Kim Kulling 57f4163c67
Merge pull request #4702 from Gargaj/assbinlights
add missing light data to assbin import/export
2022-09-05 18:29:59 +02:00
Chris 4b0e38e44f Fix aiBone.mOffsetMatrix documentation
Fixed the comment on the `mOffsetMatrix` property to be correct.
See https://assimp-docs.readthedocs.io/en/latest/API/API-Documentation.html#_CPPv46aiBone
See also https://stackoverflow.com/a/73603994
2022-09-05 11:00:57 -05:00
Gargaj d15b4ad7ef add missing light data to assbin import/export 2022-09-05 16:09:24 +02:00
Kim Kulling fd6c534efc
Merge pull request #4707 from Gargaj/patch-1
fix vertices being joined duplicating weights
2022-09-04 10:51:07 +02:00
Kim Kulling 2a667cc637
Merge branch 'master' into patch-1 2022-09-04 09:52:42 +02:00
Kim Kulling de83245f42
Merge pull request #4703 from Skylion007/explicitly-default-dtors
clang-tidy: explicitly default all empty ctors and dtors
2022-09-03 21:25:20 +02:00
Aaron Gokaslan 411171fa45 Apply some more modernize-use-emplace 2022-09-02 11:20:02 -04:00
Aaron Gokaslan e3b01e10db apply fixes to more headers 2022-09-01 12:28:45 -04:00
Aaron Gokaslan 4c6652f5b0 Add a handful of missing fixes 2022-09-01 11:37:53 -04:00
Gargaj a22aa75bca
fix vertices being joined duplicating weights
This bug causes weights to duplicate, i.e. one bone will have several (equal) weights assigned to the same vertex - which then has the potential to cause even bigger problems when combined with `LimitBoneWeightsProcess`.
2022-08-31 22:27:34 +02:00
Kim Kulling f527e56f22
Merge branch 'master' into explicitly-default-dtors 2022-08-30 22:21:06 +02:00
Kim Kulling 80ae9afe4e Add missing documentation. 2022-08-30 21:55:52 +02:00
Kim Kulling 2c3538fc46
Merge pull request #4705 from assimp/kimkulling/cleanup_after_review
[WIP] Code cleanup and some new unittests for edgecases.
2022-08-30 21:54:14 +02:00
Kim Kulling fbb69df8be
Update utBaseProcess.cpp 2022-08-30 20:54:23 +02:00
Kim Kulling 25d7510b8c
Merge branch 'master' into kimkulling/cleanup_after_review 2022-08-29 22:17:39 +02:00
Kim Kulling 6539b8685f
Update utBaseProcess.cpp 2022-08-29 17:48:57 +02:00
Kim Kulling e34becff62
Enable portable linkage to fix build 2022-08-29 11:43:32 +02:00
Kim Kulling 8352f0478a
Merge pull request #4704 from JG-Adams/patch-1
Wrong object is created here!
2022-08-29 11:23:38 +02:00
Kim Kulling 0571ee21fb Introduce unittest for BaseProcess. 2022-08-28 20:58:52 +02:00
Kim Kulling 02e6c425f9 Fix ordering of initalizer list 2022-08-27 15:20:53 +02:00
Kim Kulling e4c383324a Use string for constexpr 2022-08-27 15:11:54 +02:00
Kim Kulling 14186bcd6b Code cleanup and some new unittests for edgecases. 2022-08-27 14:07:45 +02:00
J.G.Adams 9cd723e282
Wrong object is created here!
If I'm not mistaken. Because this is originally push_back(aniMeshVertex) instead of push_back(v).
And the fact that aniMeshVertex is just getting created and destroyed for nothing.
It need to be replaced with this then? A Clang-tidy syntax to create the same aniMeshVertex.

I found this in pull request #4527 I think it may need to be reviewed too.
2022-08-26 19:12:11 -04:00
Aaron Gokaslan e93fa6699a Manually fix up 100 more instances where it should be defaulted 2022-08-25 12:20:13 -04:00
Aaron Gokaslan 6fa21dcc6e Explicitly default all empty dtors 2022-08-25 11:32:59 -04:00
Kim Kulling 46e571e497
Merge pull request #4700 from Skylion007/skylion007/modernize-use-emplace
Apply modernize-use-emplace clang-tidy rule
2022-08-25 10:50:11 +02:00
Kim Kulling 2b30b7e062
Merge branch 'master' into skylion007/modernize-use-emplace 2022-08-24 11:48:30 +02:00
Kim Kulling 066f3f5f14
Merge pull request #4701 from turol/x3d-fixes
Fix out of bounds reads in X3D importer
2022-08-24 11:44:50 +02:00
Kim Kulling 659195d852
Fix the fixme
- Based on the implementation in top of the last one I guess I know how to fix that.
- Replacing push_back by emplace_back
2022-08-24 11:17:10 +02:00
Turo Lamminen 0d8723a3eb Add FIXME comment 2022-08-24 10:43:40 +03:00
Turo Lamminen 654ae3af4e Fix out of bounds access in X3D loader 2022-08-24 10:42:01 +03:00
Kim Kulling 88c69d4edc
Merge pull request #4693 from vkaytsanov/master
Remove exception on glTF 2.0 loading
2022-08-23 23:36:26 +02:00
Aaron Gokaslan 25add7baa2
Merge branch 'master' into skylion007/modernize-use-emplace 2022-08-23 15:14:48 -04:00
Kim Kulling 87f601531c
Merge branch 'master' into master 2022-08-23 21:14:45 +02:00
Kim Kulling aa521569f7
Merge pull request #4699 from turol/smd-fixes
SMD fixes
2022-08-23 21:08:42 +02:00
Aaron Gokaslan b176061c41 Remove extra space in emplace insertions 2022-08-23 11:46:30 -04:00
Aaron Gokaslan 27edb43600 Apply modernize-use-emplace clang-tidy rule 2022-08-23 11:41:49 -04:00
Turo Lamminen f890bc791f Fix out of bounds write 2022-08-23 14:38:27 +03:00
Turo Lamminen 68bc6a06b9 Use unique_ptr for aaiBones instead of explicit delete[] 2022-08-23 14:17:56 +03:00
Turo Lamminen 03397d42e2 Use unique_ptr for aaiFaces instead of explicit delete[] 2022-08-23 14:15:06 +03:00
Turo Lamminen 795c0abcc8 Apply modernize-loop-convert to the simplified loop 2022-08-23 14:10:23 +03:00
Turo Lamminen 1ca44acebc Simplify a for loop 2022-08-23 14:10:23 +03:00
Turo Lamminen 712671e81a Apply modernize-loop-convert again 2022-08-23 14:10:20 +03:00
Turo Lamminen 5f28c51c03 Apply clang-tidy modernize-loop-convert transformation 2022-08-23 13:59:42 +03:00
Kim Kulling 04997ccbf3
Merge pull request #4697 from assimp/kimkulling/patch-issue-4676
[WIP] Use ai_Real to write correct accuracy
2022-08-18 19:04:28 +02:00
Kim Kulling 2013ae114a
[WIP] Use ai_Real to write correct accuracy
- closes https://github.com/assimp/assimp/issues/4676
2022-08-18 17:41:07 +02:00
Turo Lamminen 94c3ec57af
Merge pull request #4679 from turol/blender-fixes
(Mostly) Blender fixes
2022-08-18 15:49:16 +03:00
vkaytsanov 4c143eb581
Merge branch 'master' into master 2022-08-17 12:01:44 +03:00
Turo Lamminen 1c59de42fc Make some blender fields warn if missing instead of error 2022-08-17 11:42:32 +03:00
Turo Lamminen d2dc0401c3 Use weak pointer for ModifierData prev to avoid memory leak 2022-08-17 11:42:32 +03:00
Turo Lamminen 30555282fe Use weak pointer for ElemBase last to avoid memory leak 2022-08-17 11:42:32 +03:00
Turo Lamminen 219dbbd4af Fix crash of "assimp info" with no parameters 2022-08-17 11:42:32 +03:00
Turo Lamminen 56b6446913 Use weak pointer for MirrorModifierData mirror_ob to avoid memory leak 2022-08-17 11:42:32 +03:00
Turo Lamminen 90d1464405 Remove set but unused variables 2022-08-17 11:42:32 +03:00
Turo Lamminen 2e64880abf Inherit SubsurfModifierData and MirrorModifierData from SharedModifierData
This makes the cast in BlenderModifierShowcase::ApplyModifiers work
correctly and not invoke UB.
2022-08-17 11:42:32 +03:00
Turo Lamminen e43e3e11b9 Move SharedModifierData definition to BlenderScene.h 2022-08-17 11:42:32 +03:00
Turo Lamminen 2c1943cd10 Improve BlenderDNA error message 2022-08-17 11:42:32 +03:00
Kim Kulling a0f375162d
Merge pull request #4453 from Promit/master
Added support for more bone weights in GLTF2
2022-08-16 21:20:23 +02:00
Kim Kulling 89c4640744
Merge branch 'master' into master 2022-08-16 20:53:45 +02:00
vkaytsanov d469c7b161 Remove exception on glTF 2.0 loading 2022-08-16 15:52:43 +03:00
Kim Kulling 0dabe020a9
Merge pull request #4681 from Koekto-code/master
Fix problems setting DirectX_LIBRARY
2022-08-15 15:25:41 +02:00
Kim Kulling c9fc957535
Merge branch 'master' into master 2022-08-15 15:05:19 +02:00
Kim Kulling bd64cc88df
Merge pull request #4678 from villevoutilainen/master
Use unqualified uint32_t everywhere in FBXBinaryTokenizer
2022-08-13 08:33:46 +02:00
Kim Kulling baf14f6c16
Merge branch 'master' into master 2022-08-12 14:09:04 +02:00
Koekto-code 0e4ba1fdd1
Fix problems setting DirectX_LIBRARY
DirectX_LIBRARY was always clearing, though DirectX_PREFIX_PATH was not changed. This is because I had some semicolons at begin of DirectX_PREFIX_PATH and the macro `clear_if_changed` discarded them. Now it saves all extra semicolons and check passes.
2022-08-11 22:10:16 +03:00
Kim Kulling 888468e8f7
Merge pull request #4680 from sashashura/patch-6
Fixes Heap-buffer-overflow READ in Assimp::ASE::Parser::ParseLV1SoftSkinBlock
2022-08-11 11:47:48 +02:00
Bengt Rosenberger 76daadb95d
Merge branch 'master' into gltf2_metadata_export 2022-08-10 23:06:41 +02:00
Aleks L 4b85eb59c2
Fixes Heap-buffer-overflow READ in Assimp::ASE::Parser::ParseLV1SoftSkinBlock 2022-08-10 15:30:07 +01:00
Ville Voutilainen 253f8bfa62 Use unqualified uint32_t everywhere in FBXBinaryTokenizer
The use of qualified std::uint32_t requires including <cstdint> instead
of <stdint.h> on some implementations, and that breaks the build of Qt 6
on GCC 13. Just use the unqualified name everywhere.
2022-08-09 01:54:31 +03:00
Kim Kulling 17c6491c91
Merge pull request #4674 from assimp/kimkulling/do_not_add_dot_when_extension_is_empty_issue-4670
Kimkulling/do not add dot when extension is empty issue 4670
2022-08-06 21:22:54 +02:00
Kim Kulling e419d6898c Merge branch 'master' into kimkulling/do_not_add_dot_when_extension_is_empty_issue-4670 2022-08-06 18:40:07 +02:00
Kim Kulling 4aaa807704 Add dot only when the extension is not empty. 2022-08-06 18:37:12 +02:00
Kim Kulling b3b064eb69
Merge pull request #4673 from assimp/kimkulling/introduce-fallthroughs_issue-4654
Use  [[fallthrough]]; to mark whished fallthroughs
2022-08-06 09:07:30 +02:00
Kim Kulling ec131d0345
Update CMakeLists.txt 2022-08-05 21:47:58 +02:00
Kim Kulling 1b0682297d
Update to c++17 2022-08-05 21:06:10 +02:00
Kim Kulling 5084a4d155
Use [[fallthrough]]; to mark whished fallthroughs
- closes https://github.com/assimp/assimp/issues/4654
2022-08-05 20:49:37 +02:00
Kim Kulling 0422dff537
Merge pull request #4668 from Fiskmans/patch-1
Fixed typo
2022-08-03 21:15:59 +02:00
Kim Kulling 2c4f51e863
Merge branch 'master' into patch-1 2022-08-03 14:53:39 +02:00
Kim Kulling 9e0261ea7a
Merge pull request #4669 from assimp/kimkulling/parallel-github-action
Experiment: try to enable parallel build
2022-08-03 14:53:31 +02:00
Bengt Rosenberger abfe8ad413 Added suggested changes and fixed automated check errors 2022-08-01 14:39:10 +02:00
Bengt Rosenberger f20071d740 Merge remote-tracking branch 'origin/gltf2_metadata_export' into gltf2_metadata_export 2022-08-01 14:12:33 +02:00
Bengt Rosenberger da58fbe8fb Got rid of gltf2::ExtrasValue and used gltf2::CustomExtension instead 2022-08-01 14:12:27 +02:00
Bengt Rosenberger cb4d0ab7aa Added missing member copy in gltf2::ExtrasValue ctor. 2022-08-01 14:12:27 +02:00
Bengt Rosenberger 233198baef Fixed extras presence check in gltf2 import. 2022-08-01 14:12:27 +02:00
Bengt Rosenberger 99c3104588 Rewrote gltf2 node extras import and added node extras export.
No support for AI_AIVECTOR3D metadata type. No support for json arrays of metadata, just json objects.
2022-08-01 14:12:27 +02:00
Kim Kulling 8c63ed0455
Experiment: try< to enable parallel build 2022-08-01 09:46:08 +02:00
Måns Andersen 0ada8b3b5e
Fixed typo 2022-07-31 22:08:27 +02:00
Kim Kulling dabaa7bdae
Merge pull request #4666 from assimp/kimkulling/waveform_obj_optimizations
Improvements and optimizations for the obj-parsers.
2022-07-31 21:09:44 +02:00
Kim Kulling eac0876c9b Refactoring: Use correct prefix for attributes in ObjImport. 2022-07-31 20:54:58 +02:00
Kim Kulling dddfb74902 Fix another mem-leak 2022-07-31 13:37:42 +02:00
Kim Kulling c349035cd1 Fix face memleak. 2022-07-31 12:10:43 +02:00
Kim Kulling 85f86ec076 Revert using face as pod type 2022-07-30 21:52:33 +02:00
Kim Kulling 0513eff44f
Merge branch 'master' into kimkulling/waveform_obj_optimizations 2022-07-30 13:15:42 +02:00
Kim Kulling f6bcb160d0 Improvements of obj-parsers. 2022-07-30 12:58:09 +02:00
Kim Kulling 75e678a0c5
Merge pull request #4656 from waebbl/update-version-tag
Update version tag
2022-07-30 09:31:14 +02:00
Bernd Waibel fb653e8381 Update version tag
Closes: https://github.com/assimp/assimp/issues/4655
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
2022-07-29 23:10:42 +02:00
Kim Kulling 46aa7a548c
Merge pull request #4632 from enginmanap/master
Fix warnings that are causing build fails with specific build flags
2022-07-29 21:20:07 +02:00
Kim Kulling 340d800739
Merge branch 'master' into master 2022-07-29 20:42:56 +02:00
Kim Kulling 8abacebad7
Merge pull request #4635 from Koekto-code/Koekto-code-patch-1
Fix mingw include in assimp_cmd.rc
2022-07-29 20:37:34 +02:00
Kim Kulling 173fad738f
Merge branch 'master' into Koekto-code-patch-1 2022-07-29 19:54:41 +02:00
Kim Kulling cb43690aad
Merge pull request #4538 from luca-della-vedova/fix/collada_parser_sid
ColladaParser - Store sid in mSID field
2022-07-29 19:47:57 +02:00
Kim Kulling 4f6640278a
Merge branch 'master' into fix/collada_parser_sid 2022-07-29 19:17:43 +02:00
Kim Kulling 53a4b43ec1
Merge pull request #4643 from sashashura/patch-1
Fixes Heap-buffer-overflow in SuperFastHash
2022-07-29 19:15:58 +02:00
Kim Kulling b0210cb3cf
Merge branch 'master' into patch-1 2022-07-29 17:48:14 +02:00
Bengt Rosenberger 2b804c638f
Merge branch 'master' into gltf2_metadata_export 2022-07-25 21:48:46 +02:00
Engin Manap 7c75a4c59b
Merge branch 'master' into master 2022-07-24 12:31:36 -07:00
Kim Kulling 3c253ca3e5
Merge pull request #4644 from sashashura/patch-2
Fixes Heap-use-after-free in Assimp::DXFImporter::ExpandBlockReferences
2022-07-24 12:23:34 +02:00
Kim Kulling 73542f3830
Merge branch 'master' into patch-2 2022-07-24 12:11:18 +02:00
Kim Kulling 9bd2b4da50
Merge pull request #4645 from sashashura/patch-3
Fixes Heap-buffer-overflow in std::__1::basic_string<char, std::__1::…
2022-07-24 12:08:51 +02:00
Bengt Rosenberger bdee65e577 Got rid of gltf2::ExtrasValue and used gltf2::CustomExtension instead 2022-07-22 01:33:05 +02:00
Bengt Rosenberger 517fd3c76c Added missing member copy in gltf2::ExtrasValue ctor. 2022-07-22 01:07:42 +02:00
Bengt Rosenberger 5a2b811ba3 Fixed extras presence check in gltf2 import. 2022-07-22 01:04:05 +02:00
Bengt Rosenberger 417481d17f Rewrote gltf2 node extras import and added node extras export.
No support for AI_AIVECTOR3D metadata type. No support for json arrays of metadata, just json objects.
2022-07-22 00:44:51 +02:00
Kim Kulling f07bc2c5b9
Merge branch 'master' into patch-3 2022-07-18 15:19:27 +02:00
Kim Kulling 749fe898b1
Merge pull request #4646 from sashashura/patch-4
Fixes Heap-buffer-overflow in Assimp::ObjFileParser::getFace
2022-07-18 15:18:59 +02:00
Kim Kulling 05ececc387
Merge branch 'master' into patch-4 2022-07-18 14:06:29 +02:00
Kim Kulling 316f6e841c
Merge pull request #4647 from sashashura/patch-5
Fixes Crash in Assimp::ObjFileMtlImporter::getFloatValue
2022-07-18 14:05:50 +02:00
sashashura 9ddc3a64d7
Fixes Crash in Assimp::ObjFileMtlImporter::getFloatValue 2022-07-16 13:55:08 +01:00
sashashura 772cfdc757
Fixes Heap-buffer-overflow in Assimp::ObjFileParser::getFace 2022-07-16 13:50:54 +01:00
sashashura 94c0e9d890
Fixes Heap-buffer-overflow in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<ch 2022-07-16 13:48:39 +01:00
sashashura a4274930e4
Fixes Heap-use-after-free in Assimp::DXFImporter::ExpandBlockReferences 2022-07-16 13:46:50 +01:00
sashashura 0c07ea7c71
Fixes Heap-buffer-overflow in SuperFastHash 2022-07-16 13:44:46 +01:00
Kim Kulling 0a9a23a056
Merge pull request #4642 from assimp/kimkulling/fix_stb_header
Fix uninitialized variable.
2022-07-16 14:15:53 +02:00
Kim Kulling bc6acedb33
Fix uninitialized variable. 2022-07-16 13:57:51 +02:00
Engin Manap 684909a691 Fix comments on PR
1) Use default instead of empty destructor
2) Remove debug code
2022-07-09 17:23:40 +02:00
Engin Manap 3e424f8119
Merge branch 'assimp:master' into master 2022-07-09 17:17:01 +02:00
Koekto-code d109db152c
Use winresrc.h for mingw 2022-07-09 15:32:24 +03:00
Kim Kulling d8f42279a6
Merge pull request #4630 from tanolino/fix_stl_for_over_4GB
Fix stl for over 4 gb
2022-07-09 10:46:34 +02:00
Kim Kulling 6ad8ea395a
Merge branch 'master' into fix_stl_for_over_4GB 2022-07-09 09:58:10 +02:00
Engin Manap e63426b89c Fix collada parser fails on Mixamo exports 2022-07-08 23:42:41 +02:00
Engin Manap 8a90ba8a39 Don't optimize on debug builds 2022-07-08 23:42:16 +02:00
Kim Kulling b2d0ac18cf
Merge pull request #4631 from robertosfield/master
Build fix for compiling against minizip.
2022-07-08 20:53:40 +02:00
Engin Manap 3890b5dff5 Add missing = operator
implicit assignment operator is depricated, these classes were missing
explicit definitions of this operator.
It is causing warnings, specifically  -Werror=deprecated-copy
2022-07-08 18:16:02 +02:00
Engin Manap c3a89fd2d0 Fix non virtual destructor use 2022-07-08 18:16:02 +02:00
Engin Manap ae276987a0 Remove unnecessary const qualifiers
These changes are part of enable -Wall, this specific changes are for
-Werror=ignored-qualifiers
2022-07-08 18:16:02 +02:00
Engin Manap a10abe0283 Add fallthrough comment to switch case
This allows gcc to identify intentional fallthroughs, which are part all
-Wall. Specifically -Werror=implicit-fallthrough
2022-07-08 18:16:02 +02:00
Robert Osfield 8e062792cd Build fix for compiling against minizip. 2022-07-08 12:46:27 +01:00
Kim Kulling 1c646057ce
Merge pull request #4621 from hectorPiteau/patch-1
Fix typo in installation instructions for ubuntu.
2022-07-08 11:43:11 +02:00
Kim Kulling ee3aaf7446
Merge branch 'master' into patch-1 2022-07-08 11:14:22 +02:00
Kim Kulling ab4223f671
Merge pull request #4629 from assimp/kimkulling/fix_leak_in_D3MFOpcPackage_issue-4628
Fix memory leak in D3MFOpcPackage
2022-07-08 11:13:41 +02:00
tanolino c23146bb20
Use size_t for the file size in cpp file
This pointer juggling in combination with STL files >4GB caused some nasty illegal memory access bugs here. So let's fix it.
2022-07-08 10:26:03 +02:00
Kim Kulling c5dfcac08a
Update D3MFOpcPackage.cpp 2022-07-08 10:25:40 +02:00
tanolino 24d110199a
Use size_t for file size instead of unsigned int
This is one step to help us open files with more then 4 GB size.
2022-07-08 10:19:50 +02:00
Kim Kulling e254f80a3a
Fix memory leak in D3MFOpcPackage
- closes https://github.com/assimp/assimp/issues/4628
2022-07-08 10:17:11 +02:00
Kim Kulling a1f9a299e9
Merge pull request #4627 from assimp/kimkulling/remove_assert_from_parser_issue-4626
Remove assertion test
2022-07-08 10:11:44 +02:00
Kim Kulling e59b8fb448
Fix typo 2022-07-08 09:50:04 +02:00
Kim Kulling 70b2db19a8
Remove assertion test
- Code cleanup
- closes https://github.com/assimp/assimp/issues/4626
2022-07-08 09:47:33 +02:00
Hector Piteau e77ab52dba
Merge branch 'master' into patch-1 2022-07-08 14:56:21 +09:00
Kim Kulling 7e4a20f843
Merge pull request #4541 from blackhorse-reddog/master
I ran into an error while processing coloured binary stl. Just a type but better be fixed
2022-07-07 14:37:24 +02:00
Kim Kulling e9b08f35b2
Merge branch 'master' into master 2022-07-07 13:21:08 +02:00
Kim Kulling bac3432733
Merge pull request #4611 from assimp/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
2022-07-07 11:10:49 +02:00
Hector Piteau 579bd6b13e
Fix typo in installation instructions for ubuntu. 2022-07-07 17:11:58 +09:00
Kim Kulling e3c94c6412
Merge branch 'master' into dependabot/github_actions/actions/checkout-3 2022-07-07 09:26:05 +02:00
Kim Kulling 3ae1a37a41
Merge pull request #4610 from assimp/dependabot/github_actions/actions/upload-artifact-3
Bump actions/upload-artifact from 2 to 3
2022-07-07 09:25:51 +02:00
Kim Kulling 8d5ed5dfe5
Merge branch 'master' into dependabot/github_actions/actions/upload-artifact-3 2022-07-07 09:09:51 +02:00
Kim Kulling 395b9f535e
Merge pull request #4619 from assimp/kimkulling/fix_texture_loading_3mp_issue-4568
Kimkulling/fix texture loading 3MF, reladed issue-4568
2022-07-06 21:21:55 +02:00
Kim Kulling 77a2cdee76 Fix texture fetch for embedded textures in 3mf-files. 2022-07-06 20:59:42 +02:00
Kim Kulling 0db8b3daae Use default destructor. 2022-07-06 20:59:17 +02:00
dependabot[bot] 9a3bde0e6d
Bump actions/upload-artifact from 2 to 3
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
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>
2022-07-06 11:41:23 +00:00
Kim Kulling 422ed5279a
Merge branch 'master' into dependabot/github_actions/actions/checkout-3 2022-07-06 13:40:51 +02:00
Kim Kulling 44fad544e6
Merge pull request #4612 from assimp/dependabot/github_actions/actions/cache-3
Bump actions/cache from 2 to 3
2022-07-06 13:40:40 +02:00
dependabot[bot] 15030fb7b1
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-06 07:37:31 +00:00
Kim Kulling 744ed2256b
Merge branch 'master' into dependabot/github_actions/actions/cache-3 2022-07-06 09:37:07 +02:00
Kim Kulling ec2db278e3
Merge pull request #4613 from assimp/dependabot/github_actions/JesseTG/rm-1.0.3
Bump JesseTG/rm from 1.0.2 to 1.0.3
2022-07-06 09:36:49 +02:00
Kim Kulling 2ee7727d86
Merge branch 'master' into dependabot/github_actions/JesseTG/rm-1.0.3 2022-07-06 08:59:58 +02:00
Kim Kulling 13bee0d5e6
Merge pull request #4614 from assimp/kimkulling/fix_bad_alloc_issue-3417
Fix possible bad_alloc exception for invalid file
2022-07-06 00:10:02 +02:00
Kim Kulling eeae6eac26
Update Q3DLoader.cpp 2022-07-05 23:01:18 +02:00
Kim Kulling 2d994e1a28
Fix possible bad_alloc exception for invalid file
- Fuzzer finding
- closes https://github.com/assimp/assimp/issues/3417
2022-07-05 22:50:54 +02:00
dependabot[bot] b05ff26569
Bump JesseTG/rm from 1.0.2 to 1.0.3
Bumps [JesseTG/rm](https://github.com/JesseTG/rm) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/JesseTG/rm/releases)
- [Commits](https://github.com/JesseTG/rm/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: JesseTG/rm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 20:00:56 +00:00
dependabot[bot] 200e43b99d
Bump actions/cache from 2 to 3
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [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/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 20:00:53 +00:00
Kim Kulling c1012b4af0
Merge pull request #4569 from turrisxyz/Dependabot-GitHub-Actions
chore: Included githubactions in the dependabot config
2022-07-05 22:00:22 +02:00
Kim Kulling 4a5ad50828
Merge branch 'master' into Dependabot-GitHub-Actions 2022-07-05 20:50:28 +02:00
Kim Kulling f4c8b55b33
Merge pull request #4597 from luca-della-vedova/fix/collada_empty_animation_name
Fix nested animation name being lost in Collada
2022-07-05 20:50:03 +02:00
Kim Kulling 90b75cd6e7
Merge branch 'master' into fix/collada_empty_animation_name 2022-07-05 20:39:19 +02:00
Kim Kulling 50638f98f5
Merge pull request #4609 from assimp/kimkulling/fix-issue-4238
Try to fix issue 4238
2022-07-05 20:36:57 +02:00
Kim Kulling 5bce9e8ce5
Update MDLMaterialLoader.cpp 2022-07-05 20:09:16 +02:00
Kim Kulling a6b1a35748
Try to fix issue 4238
- Fix possible nullptr dereferencing.
- closes https://github.com/assimp/assimp/issues/4238
2022-07-05 20:05:10 +02:00
Kim Kulling 6d26e91fc1
Merge branch 'master' into fix/collada_empty_animation_name 2022-07-05 09:28:39 +02:00
Kim Kulling 245cd66d11
Merge pull request #4605 from assimp/kimkulling/fix_memleak_in_xmlparser
Fix a memory leak
2022-07-03 08:33:27 +02:00
Kim Kulling 636d8bffe5
Merge branch 'master' into kimkulling/fix_memleak_in_xmlparser 2022-07-02 21:32:24 +02:00
Kim Kulling 9063216893 Fix a memory leak 2022-07-02 21:21:31 +02:00
Kim Kulling 43f060663f
Merge pull request #4601 from assimp/kimkulling/fix_mingw_compilation_issue4586
Use mingw.include
2022-06-30 21:46:55 +02:00
Kim Kulling 55625d1af5 Use mingw.include 2022-06-30 20:58:34 +02:00
Kim Kulling be700a0480
Merge pull request #4598 from assimp/kimkulling/fix-win32-build-with-no-dxsdk9-issue4593
Disable build for tools per default
2022-06-29 15:20:41 +02:00
Kim Kulling eee6269cd1
Diable build for tools per default
- closes https://github.com/assimp/assimp/issues/4593
2022-06-29 11:15:29 +02:00
Luca Della Vedova 0924c4710b
Fix nested animation name being lost in Collada
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
2022-06-29 11:09:54 +08:00
Kim Kulling e1e8477732
Merge pull request #4596 from assimp/kimkulling/fix_invalid_opengex_token_match
Kimkulling/fix invalid opengex token match
2022-06-28 20:59:37 +02:00
Kim Kulling 96ccaa03a0
Merge branch 'master' into kimkulling/fix_invalid_opengex_token_match 2022-06-28 20:39:54 +02:00
Kim Kulling f76be1a631
Replace debug code by a real test 2022-06-28 20:38:36 +02:00
kimmi 3d692c72ba Fix name of test 2022-06-28 20:31:55 +02:00
kimmi d3c8201614 Fix token match string checks. 2022-06-28 20:31:03 +02:00
Kim Kulling b6f3c8eb15
Merge pull request #4595 from assimp/kimkulling/fix-doc
Update name of package
2022-06-28 18:04:22 +02:00
Kim Kulling 2de95c77a4
Update name of package
- closes https://github.com/assimp/assimp/issues/4594
2022-06-28 17:48:06 +02:00
Kim Kulling 33b672288c
Merge pull request #4542 from hgdagon/master
Fix GNUC check on Windows
2022-06-24 11:02:25 +02:00
Kim Kulling 5598356157
Merge branch 'master' into master 2022-06-24 09:56:09 +02:00
Kim Kulling 6cebe2c1f1
Merge pull request #4581 from Gargaj/w32fix
Fix Windows 32-bit builds
2022-06-24 09:04:47 +02:00
Kim Kulling 855537f232
Merge branch 'master' into master 2022-06-24 09:04:37 +02:00
Kim Kulling be2e6a1b24
Merge branch 'master' into w32fix 2022-06-24 08:31:41 +02:00
Kim Kulling 038ae8c028
Merge pull request #4585 from onurtore/otore19/sandbox
Utilizies AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES flag for Collada meshes.
2022-06-23 16:03:02 +02:00
Onur Berk Töre b392ff5ad1
Merge branch 'master' into otore19/sandbox 2022-06-21 21:34:50 +03:00
Onur Berk Tore 4f06c41802
Fix: Collada header updated 2022-06-21 21:08:11 +03:00
Kim Kulling 3f3f4dc6b7
Merge pull request #4534 from tanolino/patch-2
Inifinite loop on bad import files
2022-06-21 14:01:18 +02:00
Gargaj bca5650578 fix windows 32 bit builds 2022-06-21 13:40:49 +02:00
Kim Kulling fff74a4ac0
Merge branch 'master' into patch-2 2022-06-21 13:39:23 +02:00
Kim Kulling ad2a1546eb
Merge pull request #4584 from kovacsv/delete_unused_variable
Remove unused variable.
2022-06-21 13:38:08 +02:00
Onur Berk Tore c2060a1f7e
Deletion: Removed unnessary header 2022-06-20 23:48:00 +03:00
Onur Berk Tore 1b53f41787
Feature: Utilizes removeEmptyBones flag for Collada 2022-06-20 23:46:29 +03:00
kovacsv 2486a681c1 Remove unused variable. 2022-06-20 21:07:34 +02:00
Kim Kulling 67fe6643c3
Merge pull request #4578 from PercentBoat4164/master
Add support for GCC v12
2022-06-20 00:03:59 +02:00
PercentBoat4164 487a9aca2f Add support for GCC v12 2022-06-16 19:23:55 -04:00
Luca Della Vedova 079b7deb33 Merge branch 'master' of https://github.com/assimp/assimp into fix/collada_parser_sid 2022-06-13 10:20:46 +08:00
hgdagon ce8081bd0a
Merge branch 'master' into master 2022-06-13 00:15:31 +04:00
Kim Kulling b8812d2b4f
Merge pull request #4552 from assimp/kimkulling/create_skeleton_data_issue_4015
[Experimental] New skeleton container for bones
2022-06-11 21:57:41 +02:00
Kim Kulling 5adea2dbcf
Merge branch 'master' into kimkulling/create_skeleton_data_issue_4015 2022-06-11 21:40:44 +02:00
Kim Kulling aaa19903c6 Fix merge conflicts 2022-06-11 18:50:18 +02:00
naveen a5a38775f1 chore: Included githubactions in the dependabot config
This should help with keeping the GitHub actions updated on new releases. This will also help with keeping it secure.

Dependabot helps in keeping the supply chain secure https://docs.github.com/en/code-security/dependabot

GitHub actions up to date https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

https://github.com/ossf/scorecard/blob/main/docs/checks.md#dependency-update-tool
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-06-10 01:30:07 +00:00
Kim Kulling 0768a13057
Merge pull request #4567 from assimp/kimkulling/fix_nullptr_exception_opnglb_export_issue4418
Fix  possible nullptr exception
2022-06-08 08:13:16 +02:00
Kim Kulling 02b0c89fa4
Fix usage of validation 2022-06-08 00:10:13 +02:00
Kim Kulling 4fb5cf4ba6
Fix possible nullptr exception
- closes https://github.com/assimp/assimp/issues/4418
2022-06-07 23:33:56 +02:00
Kim Kulling 34cb936844
Merge pull request #4546 from matthewclendening/fix_FBXConverter_double_precision
Fixed FBXConverter build error when using double precision
2022-06-07 22:30:33 +02:00
Kim Kulling b9fdf6d3ca
Merge branch 'master' into fix_FBXConverter_double_precision 2022-06-07 22:08:56 +02:00
Kim Kulling bc2786d830
Merge pull request #4564 from ethaninfinity/master
Pragma warnings cause build fail with MinGW
2022-06-07 22:08:03 +02:00
Kim Kulling e7daa5759b
Merge branch 'master' into master 2022-06-07 22:01:00 +02:00
Kim Kulling 7a64f751ab
Merge branch 'master' into master 2022-06-07 21:29:33 +02:00
Kim Kulling 988b5c1f36
Merge pull request #4565 from assimp/kimkulling-create-security-vulnerability
Create SECURITY.md
2022-06-07 21:10:44 +02:00
Kim Kulling 096aee2c25
Create SECURITY.md
- Prepare a first contact point for security vulnerability
2022-06-07 20:58:45 +02:00
ethaninfinity d018c3b555 Added back pragma warnings and changed to be MSVC-specific 2022-06-07 11:42:09 -04:00
ethaninfinity c5b6b26b8b Revert "Removed pragma warnings"
This reverts commit 4961241c09.
2022-06-07 11:27:12 -04:00
ethaninfinity 4961241c09 Removed pragma warnings 2022-06-06 14:53:03 -04:00
Matthew Clendening aca02190a7
Merge branch 'master' into fix_FBXConverter_double_precision 2022-06-06 10:01:13 -04:00
Kim Kulling 49fdd12fdf
Merge pull request #4554 from Nor-s/fix_fbx
Fix Import a specific FBX model will freeze the app #4395
2022-06-03 13:48:35 +02:00
Kim Kulling 680ea6b0e0
Merge branch 'master' into fix_fbx 2022-06-03 11:21:41 +02:00
Kim Kulling 39a4627519
Merge branch 'master' into kimkulling/create_skeleton_data_issue_4015 2022-06-02 21:47:29 +02:00
Kim Kulling 530ae2b192
Merge pull request #4555 from Underdisc/issue4516
Remove dllexport tags from static library builds.
2022-06-02 20:01:51 +02:00
Kim Kulling 638fda66da
Merge branch 'master' into issue4516 2022-06-01 20:47:13 +02:00
nsg 96d2052ed0
Merge branch 'master' into fix_fbx 2022-06-02 02:31:32 +09:00
Kim Kulling 7fcd961a20
Merge pull request #4549 from Gargaj/msvcfix
fix msvc warnings-as-errors
2022-06-01 17:39:01 +02:00
Kim Kulling 03532eaec3
Merge branch 'master' into msvcfix 2022-06-01 17:11:06 +02:00
Underdisc 17289985a4 Update comment 2022-06-01 12:45:40 +02:00
Underdisc 02e0d1d05c Remove dllexport tags from static library builds. 2022-06-01 12:26:04 +02:00
nsg 681eb3e91e Fix Import a specific FBX model 2022-06-01 17:41:27 +09:00
Kim Kulling 2e944686f8
Merge pull request #4478 from assimp/kimkulling/link_stb_image_statically_issue_4467
Link static linkage for std_image.
2022-06-01 00:01:00 +02:00
Kim Kulling b7a70ac707 Add compiler switgxh for using static linkage for std_image 2022-05-31 23:24:31 +02:00
Kim Kulling 43c767dd62
Merge branch 'master' into msvcfix 2022-05-31 22:06:57 +02:00
Kim Kulling 05867f4752 Merge branch 'kimkulling/link_stb_image_statically_issue_4467' of https://github.com/assimp/assimp into kimkulling/link_stb_image_statically_issue_4467 2022-05-31 20:08:39 +02:00
Kim Kulling de4fe01c94 Fix clang build 2022-05-31 20:08:26 +02:00
Kim Kulling e28becbaf5
Update Assimp.cpp 2022-05-31 19:17:08 +02:00
Kim Kulling e5cd85ac0c
Update M3DWrapper.h 2022-05-31 19:16:46 +02:00
Kim Kulling 4b25eb6c4b
Update Assimp.cpp 2022-05-31 19:09:22 +02:00
Kim Kulling c0e141a6a9
Update StbCommon.h 2022-05-31 19:08:46 +02:00
Kim Kulling b00923ebcd
Update Assimp.cpp 2022-05-31 19:08:29 +02:00
Kim Kulling 4e22635406
Update PbrtExporter.cpp 2022-05-31 18:31:19 +02:00
Kim Kulling 472e15c405
Merge branch 'master' into kimkulling/link_stb_image_statically_issue_4467 2022-05-31 17:47:43 +02:00
Kim Kulling 4b923f0603
Merge pull request #4537 from assimp/kimkulling/fix_compiler_warning
Cleanups
2022-05-31 17:47:21 +02:00
Kim Kulling 234e55fbb1
Use size_t 2022-05-31 07:29:54 +02:00
Gargaj f612865f22 fix msvc warnings-as-errors 2022-05-29 01:35:48 +02:00
Matthew Clendening 26233f1b77 Fixed FBXConverter build error (warning as error) when ASSIMP_DOUBLE_PRECISION is defined 2022-05-26 15:06:23 -04:00
Piroska Gabor ddc63119b5 Using hex instead of decimal 2022-05-26 10:11:30 +02:00
hgdagon efbcdccac9
Fix GNUC check on Windows (2nd attempt) 2022-05-25 09:18:42 -07:00
hgdagon affa85a36b
Fix GNUC check on Windows 2022-05-25 07:59:01 -07:00
Piroska Gabor 7ce447294f I ran into an error while processing colored binary stl. Just a type but
better be fixed.
2022-05-24 19:47:24 +02:00
Luca Della Vedova 6b0a7a21a4
Store SID in SID field
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
2022-05-23 14:24:56 +08:00
Kim Kulling ed3e218550 Bugfix: fix not initialized member attributes 2022-05-21 19:08:43 +02:00
Kim Kulling e0696486b2 Update gtest 2022-05-21 11:09:46 +02:00
Kim Kulling e5a2b00719 Fix comparison signed unsigned warning. 2022-05-21 09:47:54 +02:00
tanolino 002d6dc016
Inifinite loop on bad import files
I had an import file that caused an infinite loop. I don't exactly know how this algorithm works here but maybe we should change it more.
Probably calculate the amount of steps and chop linear.
2022-05-18 15:22:11 +02:00
Kim Kulling 4d451fe437
Merge pull request #4532 from assimp/kimkulling/fix_undefined_behaviour_in_superfasthast_issue4531
Add unittest to reproduce undefined behaviour
2022-05-17 22:08:54 +02:00
Kim Kulling c623a363a6 Add unittest to reproduce undefined behaviour: left shift on negative value 2022-05-17 20:48:35 +02:00
Kim Kulling c8dafe0d28
Merge pull request #4527 from motazmuhammad/master
Accelerate the Merge vertex post processing step
2022-05-14 11:54:06 +02:00
Kim Kulling 58af6ba9db
Fix compier warning 2022-05-14 09:59:07 +02:00
Kim Kulling deb1698cbe
Fixed formattings. 2022-05-14 09:56:38 +02:00
motazmuhammad 78dbef8711
Merge branch 'master' into master 2022-05-13 20:15:55 +01:00
motazmuhammad 36d730fc4e add more comments 2022-05-13 20:10:19 +01:00
motazmuhammad 5d8b1649a4 Revert "use unordered_set to accelerate the vertix merging"
This reverts commit 0ffb91fbf1.
2022-05-13 19:59:16 +01:00
Kim Kulling 1b3e9e4e01 Add testmodel 2022-05-13 19:44:14 +02:00
Kim Kulling e284fe67b8 Adapt file for skeleton unittest 2022-05-13 19:43:46 +02:00
motazmuhammad 0ffb91fbf1 use unordered_set to accelerate the vertix merging 2022-05-13 18:14:49 +01:00
Kim Kulling f44a94e118
Merge pull request #4510 from hgdagon/assimp_resource
[Feedback needed]Resource script updates
2022-05-12 11:30:39 +02:00
Kim Kulling 9e4fc9a40c
Merge branch 'master' into assimp_resource 2022-05-12 10:38:03 +02:00
Kim Kulling 16b7b35b04
Merge pull request #4484 from RedSkittleFox/MMD_Fixes
MMD (pmx) fixes
2022-05-12 10:36:40 +02:00
Kim Kulling 0f780fe141
Merge branch 'master' into MMD_Fixes 2022-05-12 10:00:00 +02:00
Kim Kulling eeb524a76b
Merge pull request #4525 from Skylion007/skylion007/assimp-perf-clang-tidy
Clang-Tidy performance fixes (make values const-ref where needed).
2022-05-12 09:56:19 +02:00
Aaron Gokaslan 787fcc160a Clang-Tidy performance fixes 2022-05-11 14:03:45 -04:00
hgdagon cd9f417b84
Merge branch 'master' into assimp_resource 2022-05-10 23:19:36 +04:00
Kim Kulling ff43768d24
Merge pull request #4524 from assimp/kimkulling/update-readme
Add badge to show open issue in percentage
2022-05-10 10:00:01 +02:00
Kim Kulling 31c9a8b0ed
Add badge to show open issue in percentage 2022-05-10 09:15:57 +02:00
Kim Kulling 6c943471f9
Merge pull request #4511 from hgdagon/assimp_viewer
[Fedback needed]Minor updates to ASSIMP Viewer
2022-05-09 21:33:33 +02:00
hgdagon 7338833f3b
Merge branch 'master' into assimp_viewer 2022-05-07 18:04:18 +04:00
hgdagon 85d47dc359
Merge branch 'master' into assimp_resource 2022-05-07 18:03:44 +04:00
Kim Kulling 25118d230e
Merge pull request #4509 from hgdagon/assimp_warnings_as_errors
Add an option to treat warnings as errors
2022-05-06 19:41:06 +02:00
Kim Kulling 39f5b723f3
Merge branch 'master' into assimp_warnings_as_errors 2022-05-06 19:28:17 +02:00
Kim Kulling 1f68f66162
Merge pull request #4514 from ALittleStardust/master
Update pugixml dependency to  v1.12.1
2022-05-06 13:43:58 +02:00
ALittleStardust 7bda8b7a77
Updated pugixml to version 1.12.1 2022-05-06 13:39:05 +07:00
hgdagon f86700f6f4
Merge branch 'master' into assimp_resource 2022-05-04 02:12:08 +04:00
hgdagon 1c2caec2bd
Reverted copyright text back to static text
Windres handles it just fine, with the intended result, but RC doesn't seem to like it.
2022-05-03 14:45:24 -07:00
hgdagon 26ab3ce480
Update assimp_view.rc
Removed dead link and updated copyright string in the About dialog.
2022-05-03 14:16:51 -07:00
hgdagon e59326a738
Merge branch 'master' into assimp_viewer 2022-05-04 00:44:53 +04:00
hgdagon 936cc791f2
Move `ASSIMP_WARNINGS_AS_ERRORS` check 2022-05-03 13:01:20 -07:00
hgdagon e1f0f50010
Update CMakeLists.txt 2022-05-03 12:57:45 -07:00
hgdagon 18bfbaeee1
Actually set `ASSIMP_WARNINGS_AS_ERRORS` to ON by default
Whoops....
2022-05-03 12:31:09 -07:00
hgdagon e97e7574ae
Merge branch 'master' into assimp_warnings_as_errors 2022-05-03 23:24:52 +04:00
hgdagon 4faae3d0e9
Updated build options in Build.md 2022-05-03 12:24:34 -07:00
hgdagon 209c302f56
Merged `ASSIMP_WARNINGS_AS_ERRORS` and `ASSIMP_WARNINGS_MAX`
And set it ON by default.
2022-05-03 12:23:33 -07:00
Kim Kulling abfb26ab6f
Merge pull request #4508 from hgdagon/master
Fixed library names for MinGW/MSYS2
2022-05-03 17:48:22 +02:00
Kim Kulling 3dd2dbd916
Merge branch 'master' into master 2022-05-03 17:19:06 +02:00
Kim Kulling f4b1a23010
Merge branch 'master' into assimp_viewer 2022-05-03 17:18:05 +02:00
Kim Kulling bfb46ca5ef
Fix protocol type. 2022-05-03 17:16:25 +02:00
Kim Kulling e8abb0fc1c
Merge pull request #4512 from umlaeute/aiTextureTypeToString
Rename TextureTypeToString() to aiTextureTypeToString()
2022-05-02 10:14:41 +02:00
IOhannes m zmölnig 1d3d5c4bb6 Rename TextureTypeToString() to aiTextureTypeToString()
Closes: https://github.com/assimp/assimp/issues/4493
2022-05-01 13:27:42 +02:00
Kim Kulling d5c798f325 Fix leak 2022-04-30 21:02:48 +02:00
hgdagon bf32c4c408
Fixed `ASSIMP_WARNINGS_MAX` reference 2022-04-30 08:40:48 -07:00
U-DESKTOP-0R560PH\George a7e2b3ad30 Fixed library names for MinGW/MSYS2 2022-04-30 08:14:16 -07:00
U-DESKTOP-0R560PH\George 63183a048c Minor updates to ASSIMP Viewer 2022-04-30 08:10:47 -07:00
U-DESKTOP-0R560PH\George 694dc8a0c3 Add an option to treat warnings as errors 2022-04-30 08:08:34 -07:00
U-DESKTOP-0R560PH\George 94ebe71969 Resource script updates 2022-04-30 08:01:15 -07:00
Kim Kulling 64a6968254 Add skeleton generation to aiScene 2022-04-28 21:43:02 +02:00
Kim Kulling 0afb594f40 Generate container for skeleton during FBX-Import 2022-04-28 21:19:10 +02:00
Kim Kulling 6cdd1d3cc6 Generate container for skeleton during FBX-Import 2022-04-28 21:12:26 +02:00
Kim Kulling 461370946c
Merge pull request #4506 from assimp/kimkulling/remove_deprecated_readme_issue4505
Delete README
2022-04-28 10:41:37 +02:00
Kim Kulling 1a47f52eb8
Merge branch 'master' into kimkulling/remove_deprecated_readme_issue4505 2022-04-28 10:26:27 +02:00
Kim Kulling 92bdb993e9
Merge pull request #4507 from assimp/kimkulling/disable_ifc_curve_floating_assertion_issue4450
Disable assertion tests floating point against inf for Intel oneAPI
2022-04-28 10:26:13 +02:00
Kim Kulling 1ac9173e8c
Disable assertion tests floating point against inf for Intel oneAPI
- closes https://github.com/assimp/assimp/issues/4450
2022-04-28 10:08:01 +02:00
Kim Kulling 0b3232ce10
Delete README
- closes https://github.com/assimp/assimp/issues/4505
2022-04-28 09:22:02 +02:00
Kim Kulling 66cfe0cdf4
Merge pull request #4502 from assimp/kimkulling/out_of_range_access_error_issue4495
Fix out-of-range access in ASE-Parser
2022-04-27 20:33:06 +02:00
Kim Kulling 174b2fcf59
Fix invalid use of material reference. 2022-04-27 20:21:30 +02:00
Kim Kulling 37ec378b60
Fixx out-of-range access in ASE-Parser
- closes https://github.com/assimp/assimp/issues/4495
2022-04-27 19:52:23 +02:00
Kim Kulling 458a0314aa
Merge pull request #4501 from assimp/kimkulling-patch-1
Document fuzz folder
2022-04-27 15:34:36 +02:00
Kim Kulling 6c2f1378e3
Document fuzz folder
- closes https://github.com/assimp/assimp/issues/4497
2022-04-27 15:09:30 +02:00
Kim Kulling d3a8306f59
Merge pull request #4481 from hgdagon/master
Some Windows/MSYS2-specific fixes
2022-04-27 10:31:27 +02:00
Kim Kulling cce62fded1
Merge branch 'master' into master 2022-04-27 08:45:16 +02:00
Kim Kulling 88a9598ded
Merge pull request #4490 from Mykhailo418/master
FbxConverter: update bone mOffsetMatrix
2022-04-25 21:35:34 +02:00
Kim Kulling d14bff5a9f
Merge branch 'master' into master 2022-04-24 18:17:33 +02:00
Kim Kulling f3c9c7b413
Merge branch 'master' into SmallAllocationFixInFBXLoader 2022-04-22 08:37:58 +02:00
Florian Born a415f33fb5 merge failure, parts in this file were missing 2022-04-21 16:09:28 +02:00
Florian Born 7f0509ae87 Stack allocator is now inline 2022-04-21 11:33:04 +02:00
Kim Kulling 02f070667a
Merge pull request #4483 from lgmcode/master
Fix draco building error when import assimp with cmake add_subdirectory #3663
2022-04-20 23:22:05 +02:00
Kim Kulling d6aa3db4ef
Merge branch 'master' into master 2022-04-20 21:59:17 +02:00
Kim Kulling 41fbc5e715
Merge pull request #4488 from HadesD/patch-1
Fix ogre xml serializer
2022-04-20 21:58:49 +02:00
Florian Born 0355ae967f compile fix on other platforms 2022-04-20 17:57:03 +02:00
Florian Born 320775b939 Compile fix 2022-04-20 16:39:36 +02:00
Florian Born d3646c3118 Proper destruction of individual objects 2022-04-20 16:11:09 +02:00
Florian Born 2b3c49cb93 All allocation changes 2022-04-20 12:33:39 +02:00
Florian Born 1d6ed840fb Replace single allocations in fbx loader by block allocation 2022-04-20 12:14:35 +02:00
Kim Kulling 37be87b0bd Some minor findings 2022-04-19 23:37:16 +02:00
Kim Kulling 7f913c180b
Merge branch 'master' into master 2022-04-19 15:23:09 +02:00
Mykhailo418 8a1dc87b4c remove absolute_transform in FBXConverter 2022-04-18 18:10:59 +03:00
Mykhailo418 e3def37f42 assing absolute_transform to matrix 2022-04-18 17:26:37 +03:00
Mykhailo418 863e3e0ccb FbxConverter, bone mOffsetMatrix update 2022-04-18 16:02:17 +03:00
Ichiro 9ab6ebd363
Fix foreach 2022-04-18 04:11:06 +09:00
Ichiro 128242e371
Fix ogre xml serializer 2022-04-18 01:28:03 +09:00
RedSkittleFox feec92022f
Merge branch 'master' into MMD_Fixes 2022-04-13 21:07:58 +02:00
RedSkittleFox 5ab1be8d04 Fixed deprecated class usage; removed unsupported C++17 feature 2022-04-13 11:38:57 +02:00
Kim Kulling b699d3a26a
Merge pull request #4440 from sacereda/obj-pbr-explicit
Avoid setting PBR properties when they are not found on mtl file
2022-04-13 10:11:53 +02:00
RedSkittleFox f26dc74f21 Fixed MMD Importer not loading files from buffer and enabled unit test 2022-04-13 02:51:12 +02:00
RedSkittleFox b38c25fe09 Reuploaded (fixed) mmd model 2022-04-13 02:50:31 +02:00
Kim Kulling aa814a522d
Merge branch 'master' into obj-pbr-explicit 2022-04-12 11:12:58 +02:00
Kim Kulling dc8ba61095
Merge pull request #4463 from jakrams/user/jakras/bitangent-fuzzer-fix
Prevent nullptr access to normals-array in bitangent computation
2022-04-12 11:10:47 +02:00
Kim Kulling ae9f5b6fc5
Merge branch 'master' into user/jakras/bitangent-fuzzer-fix 2022-04-12 10:41:43 +02:00
Kim Kulling 26e471ad62
Merge pull request #4454 from mpcarlos87/Android-Script-Update
Updated Android build script
2022-04-12 10:41:13 +02:00
Guangmo Lin 778ac976b2
Fix draco building error when import assimp with cmake add_subdirectory #3663 2022-04-11 15:08:20 +08:00
Kim Kulling 6943e59886
Merge branch 'master' into obj-pbr-explicit 2022-04-08 14:36:57 +02:00
hgdagon 518d50d2e6 Fixes for Windows/MSYS2 2022-04-07 03:07:57 -07:00
Kim Kulling e5747dad9b First concepts 2022-04-05 20:07:22 +02:00
Kim Kulling 5c438963c0
Disable correct compiler-warning: unused-function. 2022-04-05 19:59:36 +02:00
Kim Kulling 97c7ab3c05 Move stb_image header into its own header file. 2022-04-05 19:53:41 +02:00
Kim Kulling fa5a8476ee Fix gcc warning: unused function 2022-04-05 19:04:29 +02:00
Kim Kulling b8658cefe0 Link std_image statically. 2022-04-05 18:48:45 +02:00
Carlos Martinez Perez 2bfb78f91d
Merge branch 'master' into Android-Script-Update 2022-04-03 12:25:04 +02:00
Kim Kulling 75ab2beb06
Merge pull request #4466 from ifiddynine/patch-3
Detect Roughness factor exported by Blender
2022-04-02 21:54:06 +02:00
Kim Kulling 88dadd6c40
Merge branch 'master' into patch-3 2022-04-02 11:22:33 +02:00
Kim Kulling 8109689dc2
Merge branch 'master' into Android-Script-Update 2022-04-01 14:57:47 +02:00
Kim Kulling 42adc82354
Merge pull request #4473 from xiaohunqupo/master
Fix compile error: When enable macro ASSIMP_DOUBLE_PRECISION
2022-03-31 18:35:07 +02:00
xiaohunqupo a050dee096 Fix compile error:When enable macro ASSIMP_DOUBLE_PRECISION 2022-03-31 16:08:39 +08:00
xiaohunqupo de6e90a657 Fix commit error 2022-03-31 15:36:57 +08:00
xiaohunqupo 2152aae2a3 Fix compile error due to namespace conflicts in VC140. 2022-03-31 15:34:49 +08:00
xiaohunqupo b08c04b87a Fix compile errro in VC140 2022-03-31 15:08:12 +08:00
xiaohunqupo cc515746f7 Fix v140 compile errror 2022-03-31 14:58:31 +08:00
Danny许 8e075ce713
Update ObjFileParser.cpp 2022-03-31 14:53:33 +08:00
Danny许 18c4ebaa13
Fix compile in VC140 2022-03-31 14:28:35 +08:00
Danny许 f985fe12cc
Fix compile error
When enable macro ASSIMP_DOUBLE_PRECISION
2022-03-31 11:20:18 +08:00
Danny许 422a45694a
Merge pull request #4 from assimp/master
Merge
2022-03-31 11:18:37 +08:00
Filip Lundgren 4175198d04
Detect Roughness factor exported by Blender
Matches the logic used by Blender's own FBX exporter / importer.
2022-03-26 22:33:10 +01:00
Carlos Martinez Perez 257927d7cf
Merge branch 'master' into Android-Script-Update 2022-03-24 18:59:16 +01:00
Kim Kulling ba6c67c328
Merge pull request #4464 from assimp/kimkulling/revert_static_runtime_Selection_for_all
Use static runtime only on option is selected
2022-03-24 08:01:49 +01:00
Kim Kulling 0a56065962
Use static runtime only on option is selected 2022-03-24 00:41:07 +01:00
Jan Krassnigg 537c46a42a Prevent nullptr access to normals-array in bitangent computation 2022-03-23 15:45:09 +01:00
Carlos Martinez Perez 90a24440db - Adapted bat file to new NDK and toolchain
- Able to build x86, x86_64, armv8, armv7 for android
- Automatically detects latest ndk on your system
2022-03-18 17:01:45 +01:00
Promit Roy 5ec7e57b99
Merge branch 'assimp:master' into master 2022-03-17 15:00:09 -04:00
Promit Roy 68d33a6e13 Added support for more bone weights in GLTF2
The GLTF2 importer doesn't actually read beyond the first four bone weights (first attribute). This patch expands the parser to store as many bone weights as are available in the file.
2022-03-17 14:55:26 -04:00
Kim Kulling 19f2a624a9
Merge pull request #4451 from Promit/promit/gltf-attrib-bug-fix
GLTF2 attribute name/parse bug fix
2022-03-17 11:35:44 +01:00
Promit Roy 765b38cf04 Update glTF2Asset.inl
Fixing mistakes in attribute names for GLTF. This causes attribute index to not be parsed out correctly (e.g. JOINTS_1) and fails the scene load.
2022-03-16 16:49:45 -04:00
Kim Kulling a916a0eda5
Merge pull request #4448 from assimp/kimkulling/MDL-fix_stackoverflow-issue4447
Fix stack-overflow in MDLLoader
2022-03-16 14:14:46 +01:00
Kim Kulling c2b05acaa6
Fix stack-overflow in MDLLoader
- Use correct len to copy filename.
- Closes https://github.com/assimp/assimp/issues/4447
2022-03-16 13:59:21 +01:00
Kim Kulling a828114a1d
Merge pull request #4446 from assimp/kimkulling/mdlimporter_fix_nullptr_dereferencing
Fix nullptr dereferencing
2022-03-16 10:23:29 +01:00
Kim Kulling 552f3a308d
Fix nullptr dereferencing
- Check if we have any texture coordinates before calculating them
- closes https://github.com/assimp/assimp/issues/4445
2022-03-16 10:08:20 +01:00
Kim Kulling 784d9615f5
Merge pull request #4444 from EYHN/windows-crt
Add USE_STATIC_CRT option
2022-03-15 21:55:21 +01:00
Kim Kulling 6484dd6825
Merge branch 'master' into windows-crt 2022-03-15 21:29:21 +01:00
Kim Kulling d594e6eea4
Merge branch 'master' into obj-pbr-explicit 2022-03-15 14:30:24 +01:00
Kim Kulling bcee205542
Merge pull request #4437 from jaefunk/issue_4349
add ifndef guard for resolve to fails to compile
2022-03-15 14:28:43 +01:00
Kim Kulling 0904490150
Merge branch 'master' into issue_4349 2022-03-15 14:11:57 +01:00
Kim Kulling 7919461951
Merge pull request #4441 from assimp/kimkulling/fix_doxygen_version
Update version in doxy-config
2022-03-15 14:11:38 +01:00
Kim Kulling e4fb0e0960
Merge branch 'master' into kimkulling/fix_doxygen_version 2022-03-15 13:33:54 +01:00
Kim Kulling d87111983a
Merge pull request #4431 from TerenceRussell/master
Added missing ObjMaterial.h to CMakeLists
2022-03-15 13:33:13 +01:00
Kim Kulling b1dc8cfe56
Merge branch 'master' into master 2022-03-15 11:58:45 +01:00
Kim Kulling 7296ffc3f5
Merge pull request #4426 from sacereda/info-material-properties
Add properties information on assimp info command line
2022-03-15 11:57:58 +01:00
Kim Kulling b567497a17
Merge branch 'master' into info-material-properties 2022-03-15 10:57:14 +01:00
Kim Kulling e1dae1402e
Merge pull request #4425 from sacereda/metallic-roughness-split
glTF2: Metallic roughness split
2022-03-15 10:56:43 +01:00
Kim Kulling 68f3386c7b
Merge branch 'master' into metallic-roughness-split 2022-03-15 08:38:38 +01:00
Kim Kulling 9e0357a8b6
Merge pull request #4423 from youkeyao/parse_obj_anisotropy
Fix getting anisotropy in obj
2022-03-15 08:38:13 +01:00
Kim Kulling 72888c49f6
Merge branch 'master' into parse_obj_anisotropy 2022-03-15 08:13:35 +01:00
eyhn cd7df53a72 Add USE_STATIC_CRT option 2022-03-15 14:50:01 +08:00
jaefunk 4457d9300a
Merge branch 'master' into issue_4349 2022-03-14 15:41:20 +09:00
Kim Kulling 0ef830d2b1
Update version in doxy-config 2022-03-12 16:57:27 +01:00
Sergio Acereda 729ab8ae33 Trying to fix reorder error 2022-03-12 08:15:11 +01:00
Sergio Acereda 26bb601d8f Fix includes 2022-03-12 08:03:27 +01:00
Sergio Acereda 51e248909f Avoid setting metallic/roughness/sheen/clearcoat properties when they are not found on mtl file. 2022-03-11 22:29:59 +01:00
jaefunk e02d51ec24 add ifndef guard for resolve to fails to compile 2022-03-11 10:51:13 +09:00
Kim Kulling a305d14b8f
Merge pull request #4421 from RichardTea/update_ai_texture_type_max
Update AI_TEXTURE_TYPE_MAX
2022-03-10 13:54:55 +01:00
Kim Kulling 5e69517742
Merge branch 'master' into update_ai_texture_type_max 2022-03-10 11:37:46 +01:00
Kim Kulling 1b3ae63527
Merge pull request #4434 from karjonas/always_true
Fix 'i >= 0' always true bug
2022-03-10 11:37:03 +01:00
Kim Kulling 47f004517f
Add missing cast. 2022-03-10 10:33:29 +01:00
Jonas Karlsson c14eccefaf Fix 'i >= 0' always true bug
If 'disk_filename' does not contain a dot (.) then 'i' would overflow.
Making 'i' an int makes sure the for loop works as intended.
2022-03-09 23:05:47 +01:00
Terence Russell efe92e9ec1
Merge branch 'assimp:master' into master 2022-03-09 10:15:41 -07:00
Kim Kulling 1bf5dd2731
Merge pull request #4432 from assimp/kimkulling/init_fbx_texture_members_issue4429
Fix missing members and do some small refactorings.
2022-03-09 11:35:01 +01:00
kimkulling 26598dc6bd Forget to save file. 2022-03-09 11:00:05 +01:00
kimkulling 76e10b96fc Fix missing members and do some small refactorings. 2022-03-09 10:51:37 +01:00
Terence Russell b35879989c Added missing ObjMaterial.h to CMakeLists 2022-03-08 20:00:22 -07:00
Kim Kulling 7aa87a9765 Merge branch 'master' into kimkulling/create_skeleton_data_issue_4015 2022-03-08 19:10:53 +01:00
Kim Kulling 40d896ccc1
Merge pull request #4403 from JaroslavPribyl/fix/obj_with_bspline_crash
Fix parsing OBJ with free-form curve/surface body statements
2022-03-07 21:39:38 +01:00
Kim Kulling ba379c20e1
Merge branch 'master' into fix/obj_with_bspline_crash 2022-03-06 17:39:57 +01:00
Kim Kulling 92b5c284ce
Merge pull request #4203 from RichardTea/deprecated_gltfpbr_macros
Reinstate a deprecated gltfpbr macro: AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS
2022-03-06 17:39:35 +01:00
Kim Kulling 9ca9254445
Merge branch 'master' into deprecated_gltfpbr_macros 2022-03-06 11:15:49 +01:00
Kim Kulling 7eb5fd0e4e
Merge pull request #4427 from assimp/smartday-master
Smartday master
2022-03-05 23:00:21 +01:00
Kim Kulling 80a8807c47 Fix compiler warnings 2022-03-05 20:37:34 +01:00
Kim Kulling d4527d4e87
Merge branch 'master' into master 2022-03-05 14:00:32 +01:00
Sergio Acereda a2543e7151 Add properties information on assimp info command line 2022-03-04 17:09:29 +01:00
Sergio Acereda a1e03e3481 clang-format 2022-03-04 14:31:06 +01:00
Sergio Acereda cfe84b9260 Use generic METALNESS and DIFFUSE_ROUGHNESS texture types 2022-03-03 16:18:25 +01:00
Sergio Acereda 52008ec989 Apply clang-format 2022-03-03 15:42:23 +01:00
youkeyao 9b227fc262 Fix getting anisotropy in obj 2022-03-03 01:01:34 +08:00
RichardTea 8a6a1fc2df Update AI_TEXTURE_TYPE_MAX
Must be equal to the largest aiTextureType_XXX enum
2022-03-01 12:12:07 +00:00
RichardTea d704824be3 Merge branch 'master' into deprecated_gltfpbr_macros 2022-03-01 10:01:43 +00:00
Kim Kulling bbcefbd034
Merge pull request #4417 from rbsheth/rbsheth_fix_hunter
Update version of Hunter to v0.24.0 that supports VS 2022
2022-02-28 23:48:19 +01:00
Jaroslav Pribyl 62930076af
Merge branch 'master' into fix/obj_with_bspline_crash 2022-02-26 04:03:59 +01:00
Rahul Sheth e368a69824
Merge branch 'master' into rbsheth_fix_hunter 2022-02-25 14:58:07 -06:00
Kim Kulling 3957fbba8b
Merge pull request #4416 from SolaToucher/master
Optimize the problem of excessive memory allocation in FBX import
2022-02-25 21:03:47 +01:00
Rahul Sheth 8e59287b94 Update version of Hunter to v0.24.0 that supports VS 2022 2022-02-25 13:52:18 -06:00
sola c73ff82fc4 FBXConvert::ConvertMeshMultiMaterial: allocate memory using variable count_vertices 2022-02-25 19:58:44 +08:00
Kim Kulling 04858c5d89
Merge pull request #4409 from TerenceRussell/master
Expose the original OBJ "illum" value
2022-02-25 00:06:12 +01:00
Kim Kulling 94178df61b
Merge branch 'master' into master 2022-02-24 19:31:31 +01:00
Kim Kulling 1b2f705ee4
Merge pull request #4415 from assimp/kimkulling/fix_negative_offset_in_hast_access-issue4414
Fix possible negative array access
2022-02-24 17:20:03 +01:00
Kim Kulling 0dc24ab3a7
Fix declaration of offset 2022-02-24 17:04:39 +01:00
Kim Kulling cf96639119
Fix possible negative array access
- Return when the calculated offset gets negative
- closes https://github.com/assimp/assimp/issues/4414
2022-02-24 16:49:35 +01:00
Kim Kulling 72da1e6d7b
Merge branch 'master' into master 2022-02-23 21:20:39 +01:00
Kim Kulling e3001f1eb7
Merge pull request #4408 from assimp/kimkulling/fix_ordering_of_gltf2_issue4407
Fix ordering of member initialization
2022-02-23 21:19:33 +01:00
Kim Kulling 6f31254ae1 Ensure dictionary for LazyDics is created before adding content to it 2022-02-23 20:57:15 +01:00
Terence Russell 3a09d19374
Merge branch 'master' into master 2022-02-22 18:43:11 -07:00
Terence Russell 4ddacdb5df Expose the original OBJ illum model as a material property. 2022-02-22 17:55:41 -07:00
Kim Kulling 466b34cf53
Merge branch 'master' into kimkulling/fix_ordering_of_gltf2_issue4407 2022-02-22 21:09:11 +01:00
Kim Kulling aa04ee89f1 Fix init order to fix build 2022-02-22 21:07:42 +01:00
Kim Kulling a6808b868c Small code cleanup 2022-02-22 21:07:23 +01:00
Jaroslav Přibyl 480d6fee2a cleanup 2022-02-22 01:46:47 +01:00
Jaroslav Přibyl 62c9347985 fixed obj parsing with cstype 2022-02-22 01:32:41 +01:00
Kim Kulling ba785910d1
Merge pull request #4402 from assimp/kimkulling/warn_when_viewer_shall_be_build_on_non_win32
Show warning when assimp_viewer cannot be build on target platform
2022-02-21 15:39:11 +01:00
Kim Kulling caaeef2b56
Update CMakeLists.txt
- Show a cmake-warning if assimp_view shall be build for linux / mac
2022-02-21 15:17:23 +01:00
Kim Kulling a34688230d
Merge pull request #4393 from TerenceRussell/master
Added support for "map_Bump -bm"
2022-02-20 20:14:21 +01:00
Kim Kulling 52b106bf7e
Merge branch 'master' into master 2022-02-20 19:04:32 +01:00
Kim Kulling eed5570c39
Merge pull request #4399 from assimp/kimkulling/fix_typo_in_cmake
Update CMakeLists.txt
2022-02-20 18:45:06 +01:00
Kim Kulling 3e7294feeb
Merge branch 'master' into kimkulling/fix_typo_in_cmake 2022-02-20 15:33:54 +01:00
Kim Kulling 2c33ed1087
Merge pull request #4397 from youkeyao/issue_3191
update the calculation and orthogonalization for bitangent
2022-02-20 15:32:41 +01:00
Kim Kulling b625961197
Merge branch 'master' into issue_3191 2022-02-20 15:14:46 +01:00
Kim Kulling 03f44cd983
Merge branch 'master' into kimkulling/fix_typo_in_cmake 2022-02-20 14:17:27 +01:00
Kim Kulling 5c53726c8e
Merge pull request #4394 from BA7LYA/master
udpate build script to fit "Visual Studio 16 2019" Generator
2022-02-20 14:07:49 +01:00
Kim Kulling 96522bc114
Update CMakeLists.txt 2022-02-20 14:06:11 +01:00
Kim Kulling b825740df7
Merge branch 'master' into master 2022-02-20 12:53:26 +01:00
Kim Kulling f952100dbb
Merge pull request #4398 from assimp/kimkulling-patch-1
Fix stat for 32-biut linuxes
2022-02-20 12:19:06 +01:00
Kim Kulling 14874d26f4
Fix stat for 32-biut linuxes
- Reenable fix to ensure that stat works correctly on 32-bit linuxes again
  - stat will return 32-bit inodes when checking a file. So when this call will be used on a 64-bit linux this will cause errors like:
Error writing to foo: Value too large for defined data type
File I/O error: foo
- closes https://github.com/assimp/assimp/issues/4390
2022-02-20 11:53:26 +01:00
youkeyao ad766cb738 update the calculation and orthogonalization for bitangent 2022-02-20 17:15:11 +08:00
ChenJunshuai efc60076dc udpate build script to fit "Visual Studio 16 2019" Generator 2022-02-18 19:01:47 +08:00
Terence Russell 17123ed4a1 Add support for bump -bm (bump/normal multiplier) 2022-02-17 22:10:46 -07:00
Kim Kulling dff3620138
Merge pull request #4391 from jcfr/fix-assimp-target-install-rule-fully-specifying-components
cmake: Fix assimp target install rule fully specifying component
2022-02-17 23:13:43 +01:00
Jean-Christophe Fillion-Robin 33a48c6ca6
cmake: Fix assimp target install rule fully specifying component
This commit ensures generated install rules for the assimp target are
all consistently associated with components named after LIBASSIMP_COMPONENT
or LIBASSIMP-DEV_COMPONENT CMake variables.

It streamlines the packaging of specific components of assimp in client
projects leveraging the CPACK_INSTALL_CMAKE_PROJECTS variable.

Failing to do so leads to "/path/to/assimp-build/code/cmake_install.cmake"
file having install rules associated with a component called "Unspecified".

See https://cmake.org/cmake/help/v3.10/command/install.html#installing-targets
and https://cmake.org/cmake/help/v3.22/module/CPack.html#variable:CPACK_INSTALL_CMAKE_PROJECTS
2022-02-17 05:47:34 -05:00
Kim Kulling 510504a2c6
Merge pull request #4387 from assimp/kimkulling/fbx_use_ai_epsilon
Refactoring: add usage of ai_epsilon to fbx.
2022-02-16 22:38:34 +01:00
Kim Kulling 9bf5d01469 Fix invalid initialization of constexpr. 2022-02-16 21:22:35 +01:00
Kim Kulling 9e23d771bc Fix invalid initialization of constexpr. 2022-02-16 21:19:17 +01:00
Kim Kulling 76a7614c4b Adapt ai_epsilon to code 2022-02-16 20:07:27 +01:00
Kim Kulling 50d7e6fc61 Add definition for skeleton 2022-02-16 00:18:32 +01:00
Kim Kulling 067c5d9ec4 Refactoring: add usage of ai_epsilon to fbx. 2022-02-16 00:17:26 +01:00
Kim Kulling 884bb39391
Merge pull request #4381 from assimp/kimkulling/introduce_compression
Kimkulling/introduce compression
2022-02-15 19:09:52 +01:00
Kim Kulling 5d8e5fd130
Update XFileParser.cpp
Fix typo
2022-02-15 16:10:33 +01:00
Kim Kulling 7c13b16d30 Add missing flush modes supported by zlib 2022-02-14 20:51:06 +01:00
Kim Kulling 416f823866 Merge branch 'kimkulling/introduce_compression' of https://github.com/assimp/assimp into kimkulling/introduce_compression 2022-02-14 20:25:27 +01:00
Kim Kulling c718500c55 Fix last review findings and finish windows bits 2022-02-14 20:25:18 +01:00
Kim Kulling 9a585d7b3c
Merge branch 'master' into kimkulling/introduce_compression 2022-02-13 19:58:22 +01:00
Kim Kulling 52b6c4f7c0 Fix broken importer and add some review findings2 2022-02-13 18:44:22 +01:00
Kim Kulling 3e09d462fa Fix compression for fbx 2022-02-12 09:25:45 +01:00
Kim Kulling 97c7e084c2
Merge pull request #4380 from malytomas/tomas/fixsizet
fix missing include for size_t
2022-02-11 08:55:35 +01:00
Kim Kulling 23b43d1825 Fix X-Importer decompress algorithm 2022-02-08 21:43:14 +01:00
Kim Kulling 27bcddfb1a Migrate more importers to compression class 2022-02-08 20:43:47 +01:00
Tomas Maly acf73659d8 fix missing include for size_t 2022-02-08 00:08:46 +01:00
Kim Kulling dcd5c1dcfd
Merge pull request #4375 from assimp/kimkulling/introduce_compression
Introduce compression class to encapsulate compression via zlib
2022-02-07 10:23:23 +01:00
Kim Kulling ce61ea56a5
Merge branch 'master' into kimkulling/introduce_compression 2022-02-07 10:02:51 +01:00
Kim Kulling ed8612ea35
Merge pull request #4376 from assimp/kimkulling-lwo-enum-validation_issue4236-1
LWO: validate enum value before parsing it
2022-02-07 10:02:13 +01:00
Kim Kulling 389fc11e5b
Merge branch 'master' into kimkulling-lwo-enum-validation_issue4236-1 2022-02-07 09:38:36 +01:00
Kim Kulling a9e2864cb4
Merge pull request #4378 from assimp/kimkulling-temporary-disable-hunter
Update ccpp.yml
2022-02-07 09:36:16 +01:00
Kim Kulling 836d12b9af
Update ccpp.yml
- Temporary disable hunter for windows
- closes https://github.com/assimp/assimp/issues/4377
2022-02-07 09:23:59 +01:00
Kim Kulling 9a15ca1007
LWO: validate enum value before parsing it
- Check for valid enum values
- closes https://github.com/assimp/assimp/issues/4236
2022-02-07 09:08:23 +01:00
Kim Kulling eb5a7938e0 Remove dead code 2022-02-06 21:16:04 +01:00
Kim Kulling 9335cc30ab INtroduce compression class to encapsulate compression via zlib 2022-02-06 20:42:58 +01:00
Kim Kulling ecfb9757d0
Merge pull request #4371 from assimp/kimkulling-remove_travis
Delete .travis.sh
2022-02-03 14:24:53 +01:00
Kim Kulling d643146192
Delete .travis.yml 2022-02-03 14:03:50 +01:00
Kim Kulling a595cdad06
Delete .travis.sh 2022-02-03 14:03:20 +01:00
Kim Kulling ce880331df
Merge pull request #4366 from malytomas/master
fix compilation with clangcl on windows
2022-02-02 22:36:01 +01:00
Kim Kulling 4141260fc9
Merge branch 'master' into master 2022-02-02 21:21:01 +01:00
Kim Kulling 6c4addf158
Merge pull request #4367 from umlaeute/bugfix/bigendian
use fully qualified namespace in byteswap macros
2022-01-31 23:48:41 +01:00
IOhannes m zmölnig (Debian/GNU) ed6b6cd65c use fully qualified namespace in byteswap macros
Closes: https://github.com/assimp/assimp/issues/4358
2022-01-31 14:42:59 +01:00
Tomas Maly 3976f9a092 fix compilation with clangcl on windows 2022-01-30 22:04:41 +01:00
Kim Kulling a214b0833f
Merge pull request #4359 from assimp/kimkulling-hmp_fix_override_issue4235
HMP: Fix override during copying position data
2022-01-27 00:09:20 +01:00
Kim Kulling f217bd4b5f
Update HMPLoader.cpp 2022-01-26 19:42:09 +01:00
Kim Kulling 305d1f45aa
Add some constants and fix compile 2022-01-26 19:36:38 +01:00
Kim Kulling 50b00d33b5
HMP: Fix override during copying position data
- Fix override
- closes https://github.com/assimp/assimp/issues/4235
2022-01-26 19:22:52 +01:00
Kim Kulling 5698d41bf9
Merge pull request #4355 from assimp/kimkulling_fix_win64_warning_unreachable_code
ASE: Fix warning unreachable code
2022-01-24 20:43:34 +01:00
Kim Kulling 06fffb4f83 ASE: Fix warning unreachable code 2022-01-24 20:05:25 +01:00
Kim Kulling 83d4ab8563
Merge pull request #4353 from assimp/kimkulling-preparation_v5.2.0
Udate version to 5.2.0
2022-01-23 23:30:08 +01:00
Kim Kulling 91737f1cc9
Fix copyright: last year 2022-01-23 21:18:31 +01:00
Kim Kulling c4a66ae988
Update utVersion.cpp 2022-01-23 21:10:19 +01:00
Kim Kulling 1d34cb2c72
Udate version to 5.2.0 2022-01-23 21:09:20 +01:00
Kim Kulling c5634be708
Merge pull request #4338 from leonvictor/respect-cmake-output-variables
CMAKE: Respect top-level CMAKE_*_OUTPUT_DIRECTORY variables
2022-01-23 19:03:36 +01:00
Kim Kulling 6cc469a5ae
Merge branch 'master' into respect-cmake-output-variables 2022-01-23 18:11:47 +01:00
Kim Kulling 8b1d94d6b1
Merge branch 'master' into deprecated_gltfpbr_macros 2022-01-23 12:16:49 +01:00
Kim Kulling d45af75a5e
Merge pull request #4344 from revu-design/bensewell-fixifcopening4343
IFC Reading: Fix opening reading.
2022-01-23 12:15:38 +01:00
Ben Sewell 3e6fc3a64b Merge remote-tracking branch 'origin/master' into bensewell-fixifcopening4343 2022-01-20 09:43:45 +00:00
Kim Kulling c142676908
Merge pull request #4346 from assimp/kimkulling-fuzzer_ase_outofbounds_issue_4232
ASE: Fix material parsing
2022-01-20 10:40:00 +01:00
Kim Kulling c1968823ad
ASE: Fix material parsing
- Fuzzer error found when material access get's an out-of-bound access.
- Break parsing when material index gets out of range.
- closes https://github.com/assimp/assimp/issues/4232
2022-01-20 10:25:52 +01:00
Kim Kulling 985a5b9667
Merge pull request #4342 from assimp/krishty-new-file-detection
Krishty new file detection
2022-01-19 23:05:27 +01:00
Kim Kulling cbc4459dda Fix compile error: missing var 2022-01-19 22:03:11 +01:00
Kim Kulling 43763f53d6 Fix compile error: missing var 2022-01-19 22:00:53 +01:00
Kim Kulling 15b08f643a Fix warning: unused variable 2022-01-19 21:55:24 +01:00
Kim Kulling 17d5633a5b Add missing SImpleExtensionCheck 2022-01-19 21:42:14 +01:00
Kim Kulling 4cb76e6a18
Update UnrealLoader.cpp 2022-01-18 22:29:55 +01:00
Kim Kulling 12b01dd575
Update SMDLoader.cpp 2022-01-18 22:28:54 +01:00
Kim Kulling 7b24437f06
Update SIBImporter.cpp 2022-01-18 22:27:19 +01:00
Kim Kulling ec63fe74ee
Update RawLoader.cpp 2022-01-18 22:26:16 +01:00
Kim Kulling 088658b359
Update Q3BSPFileImporter.cpp 2022-01-18 22:25:43 +01:00
Kim Kulling b4dee9220d
Update Q3BSPFileImporter.cpp 2022-01-18 22:25:22 +01:00
Kim Kulling ffc13f18ba
NFF: reenable canRead 2022-01-18 22:24:11 +01:00
Kim Kulling 331cb5ac72
Update M3DImporter.cpp 2022-01-18 22:23:01 +01:00
Kim Kulling c3b91dd766
C4D. Fix merge conflicts 2022-01-18 22:21:58 +01:00
Kim Kulling ea5996307a
Update B3DImporter.cpp 2022-01-18 22:20:37 +01:00
Kim Kulling efd1d36aa9
Merge branch 'master' into krishty-new-file-detection 2022-01-18 22:17:50 +01:00
Kim Kulling 959af1ac4d
Revert change 2022-01-18 21:37:49 +01:00
Kim Kulling 7350baea93
Revert change 2022-01-18 21:36:55 +01:00
Kim Kulling cf47411742
Revert change 2022-01-18 21:36:02 +01:00
Kim Kulling 1e80630d5d
Revert change. 2022-01-18 21:35:09 +01:00
Kim Kulling 037732c429
Revert change 2022-01-18 21:34:18 +01:00
Kim Kulling cff213d4dd
Revert change 2022-01-18 21:33:05 +01:00
Kim Kulling 9d0006fecb
Revert change 2022-01-18 21:32:06 +01:00
Kim Kulling 5af79cac1d Fix unittests + small refactorings 2022-01-18 21:23:43 +01:00
Kim Kulling 141c6ca270
Merge pull request #4339 from Esri/jere9309/read_collada_materials
Collada: Read all instance_material child nodes
2022-01-18 20:28:39 +01:00
Jeremy Sigrist 59f28e168e
Merge branch 'master' into jere9309/read_collada_materials 2022-01-18 09:55:33 -08:00
Kim Kulling 3cca102531
Merge pull request #4265 from Garux/IQM
add Inter-Quake Model (IQM) Importer
2022-01-17 21:43:33 +01:00
Kim Kulling 6e50b04ae0
Merge branch 'master' into IQM 2022-01-17 18:33:37 +01:00
Kim Kulling f21ff66505
Merge pull request #4323 from tanolino/patch-1
Locale independent meter scale
2022-01-17 18:32:24 +01:00
Kim Kulling f16e4fadc7
Merge branch 'master' into patch-1 2022-01-17 18:18:16 +01:00
Ben Sewell 415b0e19d9 Changes for gcc compatibility 2022-01-17 16:39:50 +00:00
Ben Sewell 65f2353105 IFC Reading: Fix opening reading. 2022-01-17 15:49:11 +00:00
Kim Kulling cbde086bfb Merge branch 'krishty-new-file-detection' of https://github.com/assimp/assimp into krishty-new-file-detection 2022-01-16 20:58:07 +01:00
Kim Kulling acd70b35a0 Fix merge issues 2022-01-16 20:57:56 +01:00
Kim Kulling 6ad7505376
Merge branch 'master' into krishty-new-file-detection 2022-01-16 20:43:57 +01:00
Kim Kulling 05746acb07 Merge branch 'new-file-detection' of https://github.com/krishty/assimp into krishty-new-file-detection 2022-01-16 20:41:24 +01:00
Léon db162939b2
Merge branch 'master' into respect-cmake-output-variables 2022-01-16 16:19:03 +01:00
Kim Kulling 41cfcc7d16
Merge pull request #4336 from kovacsv/common_base64
Move Base64 encode/decode functionality to the common folder
2022-01-16 14:44:54 +01:00
Kim Kulling f8253c3e3c
Update Base64.hpp 2022-01-16 13:21:01 +01:00
Kim Kulling 7eec3f0d8f
Update copyrights. 2022-01-16 13:19:25 +01:00
Viktor Kovacs c8ab39dd04
Merge branch 'master' into common_base64 2022-01-15 23:42:56 +01:00
Léon fe40ddf9a9
Merge branch 'master' into respect-cmake-output-variables 2022-01-14 16:45:27 +01:00
Kim Kulling 5976d54437
Merge pull request #4204 from TThulesen/so-unloading
Allow dlclose of so library by avoiding unique symbols.
2022-01-13 20:32:02 +01:00
Kim Kulling d3e24196c0
Merge branch 'master' into so-unloading 2022-01-13 20:19:23 +01:00
Jeremy Sigrist 5aac72791d
Merge branch 'master' into jere9309/read_collada_materials 2022-01-12 10:12:58 -08:00
Jeremy Sigrist e671d087e1 Collada: Read all instance_material child nodes 2022-01-12 09:52:12 -08:00
Léon 8a7576b85c Check for variable definition rather than empty string 2022-01-12 15:04:41 +01:00
Viktor Kovacs c71f4bc95a
Merge branch 'master' into common_base64 2022-01-11 18:46:08 +01:00
Léon 7f2ab47b5a Respect top-level CMAKE_*_OUTPUT_DIRECTORY variables 2022-01-11 18:36:05 +01:00
Kim Kulling 6a640a2de8
Merge pull request #4330 from danoli3/master
Assimp Patch Android LTS NDK 23 Fix
2022-01-11 10:30:40 +01:00
Kim Kulling 9d06bd4678
Merge branch 'master' into master 2022-01-11 10:13:22 +01:00
Kim Kulling 5dcaf445c3
Merge pull request #4337 from lopsided98/patch-1
Fix imported target include directory
2022-01-11 10:13:02 +01:00
tanolino f8abb015de
Merge branch 'master' into patch-1 2022-01-11 09:55:19 +01:00
Dan Rosser e6cc187a7e
Merge branch 'master' into master 2022-01-11 13:51:59 +11:00
Kim Kulling d68224f2ed
Merge branch 'master' into patch-1 2022-01-10 23:45:03 +01:00
Kim Kulling a2c2b64877
Merge pull request #4335 from assimp/update_copyrights
Update copyrights
2022-01-10 21:53:59 +01:00
Kim Kulling f63b10bf45 OpenGEX: Fix usage of texture specular token 2022-01-10 21:22:44 +01:00
Viktor Kovacs 6b9732721a
Merge branch 'assimp:master' into common_base64 2022-01-10 21:15:31 +01:00
Kim Kulling 50c7301a38 Update copyrights 2022-01-10 21:13:43 +01:00
Dan Rosser 00bf74ad6d
Merge branch 'master' into master 2022-01-10 14:04:24 +11:00
Ben Wolsieffer 629c8850ec Fix imported target include directory
Fix the imported target include directory when the headers are not installed in '${CMAKE_INSTALL_PREFIX}/include'.
2022-01-09 20:59:14 -05:00
Kim Kulling 8134cae998
Merge pull request #4333 from assimp/kimkulling-prepare_v5.1.6
Update to 5.1.6
2022-01-09 23:45:44 +01:00
Kim Kulling 30f1583dde
Update utVersion.cpp 2022-01-09 21:06:05 +01:00
Kim Kulling 1d8667bfdc
Update to 5.1.6 2022-01-09 18:06:33 +01:00
Dan Rosser 9c4255b486 Assimp Android LTS NDK 23 Fix 2022-01-09 18:19:33 +11:00
Kim Kulling cb3e846a19
Merge pull request #4318 from vpzomtrrfrt/fix-bone-fit-check
Fix bone fitted check in gltf2 exporter
2022-01-08 12:59:21 +01:00
Kim Kulling 8cb5ab69b0
Merge branch 'master' into fix-bone-fit-check 2022-01-08 11:35:59 +01:00
Kim Kulling b40d9abdb9
Merge pull request #4328 from assimp/kimkulling-x3d_fix_nullptr_exception
Fix nullptr-dereferencing
2022-01-08 11:35:45 +01:00
Kim Kulling 776130534b
Fix nullptr-dereferencing
- Fix a possible nullptr-exception.
2022-01-06 22:35:32 +01:00
Kim Kulling 6a1f720f68
Merge pull request #4324 from alpire/master
Fix fuzzer crashes
2022-01-06 20:43:38 +01:00
Alex Rebert b14b34d2b8
LWSLoader: Fix out of bounds iterator access
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38947
Fix #4222
2022-01-05 15:43:16 -05:00
Alex Rebert 310c81aaa2
Add support for spanned archives
Without it, assimp would crash on some inputs by jumping to a NULL
opendisk function. This commit adds an opendisk implementation, which
required adding a filename member to ZipFile.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38873
Fix #4229
2022-01-05 15:43:10 -05:00
Alex Rebert 34d8fba100
Fix stack overflow in ZipArchiveIOSystem::MapArchive
The function allocates a filename buffer of 256, and copies the filename
extracted from the zip file into it. However, a filename might be larger
than 256 characters, in which case the function would write out of bounds.

This commit skips any file whose name is larger than 256 to avoid the
overflow.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38870
Fix #4228
2022-01-05 10:01:46 -05:00
tanolino 089fc7311a
GCC might have an issue with value type Errors 2022-01-05 10:34:27 +01:00
tanolino 04d2d13172
Locale independent meter scale
`XmlParser::getRealAttribute(...)` will call `strtod` (or `wcstod`) which are both locale dependent. So on a German locale system a scale of 0.01 meter will be parsed to 0. In order to avoid that I use the `fast_atoreal_move<ai_real>()` method.
2022-01-05 10:10:38 +01:00
Kim Kulling 1d815fc23e
Merge pull request #4321 from assimp/kimkulling_update_morphing_method_doc_issue4320
Add link to used enum for a better understandability
2022-01-04 17:46:37 +01:00
Kim Kulling a591944c04 Add link to used enum for a better understandability for the mesh morphing method. 2022-01-04 17:32:18 +01:00
Colin Reeder 87e9dbac40
Fix bone fitted check in gltf2 exporter 2022-01-03 16:32:34 -07:00
kovacsv 125acf9ec8 Merge remote-tracking branch 'origin/master' into common_base64 2022-01-02 19:47:57 +01:00
kovacsv bbe12240ca Move Base64 encode/decode functionality to the common folder. 2022-01-02 19:47:43 +01:00
Kim Kulling c2375a4ff0
Merge pull request #4272 from errissa/pbr-obj
Support PBR properties/maps in Obj importer
2021-12-31 10:38:50 +01:00
Kim Kulling ab19cff328
Merge branch 'master' into pbr-obj 2021-12-31 08:33:30 +01:00
Kim Kulling 049a241855
Merge pull request #4314 from pseiderer/ps-devel-fix-namespace-001
RFC: BlenderScene: use explicit namespace instead of using namespace
2021-12-31 08:32:54 +01:00
Kim Kulling a86ab45161
Merge branch 'master' into ps-devel-fix-namespace-001 2021-12-31 08:20:24 +01:00
Peter Seiderer a099fe7cd3 BlenderScene: use explicit namespace instead of using namespace
Fixes (using g++ Sourcery CodeBench Lite 2014.05-29 - 4.8.3 20140320):

  .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderScene.cpp:101:33: error: specialization of 'template<class T> void Assimp::Blender::Structure::Convert(T&, const Assimp::Blender::FileDatabase&) const' in different namespace [-fpermissive]
           const FileDatabase &db) const {
                                   ^
 In file included from .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderScene.h:49:0,
                   from .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderScene.cpp:47:
  .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderDNA.h:266:10: error:   from definition of 'template<class T> void Assimp::Blender::Structure::Convert(T&, const Assimp::Blender::FileDatabase&) const' [-fpermissive]
       void Convert(T &dest, const FileDatabase &db) const;
            ^
  .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderScene.cpp:121:33: error: specialization of 'template<class T> void Assimp::Blender::Structure::Convert(T&, const Assimp::Blender::FileDatabase&) const' in different namespace [-fpermissive]
           const FileDatabase &db) const {
                                   ^
  In file included from .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderScene.h:49:0,
                   from .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderScene.cpp:47:
  .../build/assimp-5.1.4/code/AssetLib/Blender/BlenderDNA.h:266:10: error:   from definition of 'template<class T> void Assimp::Blender::Structure::Convert(T&, const Assimp::Blender::FileDatabase&) const' [-fpermissive]
       void Convert(T &dest, const FileDatabase &db) const;
            ^

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2021-12-30 18:01:54 +01:00
Kim Kulling 85dd84cc78
Merge pull request #4259 from VyacheslavVanin/fix-fbx-metalness-import
fix fbx import metalness
2021-12-29 20:35:46 +01:00
Kim Kulling 0a5bd792de
Merge branch 'master' into fix-fbx-metalness-import 2021-12-29 19:08:16 +01:00
Kim Kulling c882731688
Merge pull request #4311 from SirLynix/fix-mingw
CMake: Replace CMAKE_COMPILER_IS_MINGW by MINGW
2021-12-29 17:31:12 +01:00
Jérôme Leclercq 81fc50f612 CMake: Replace CMAKE_COMPILER_IS_MINGW by MINGW
See https://discourse.cmake.org/t/cmake-compiler-is-mingw-removed/4539 and https://cmake.org/cmake/help/latest/variable/MINGW.html
2021-12-28 15:58:37 +01:00
Vyacheslav Vanin 2da06dd41a
Merge branch 'master' into fix-fbx-metalness-import 2021-12-26 17:31:33 +03:00
Kim Kulling 54a8da1d55
Merge pull request #4293 from assimp/add_colsole_progresshandler_issue_963
Add console progresshandler
2021-12-26 11:38:24 +01:00
Kim Kulling d44641398f Add console progresshandler 2021-12-26 11:16:02 +01:00
Garux d11d2fc60d fix Inter-Quake Model (IQM) Importer MSVC warnings 2021-12-24 18:36:25 +03:00
Kim Kulling 4d7e817bd8
Merge pull request #4284 from assimp/kimkulling-skip_empty_embedded_textures_issue4238
MDL: Do not try to copy empty embedded texture
2021-12-23 13:03:43 +01:00
Kim Kulling db2500c393
MDL: Do not try to copy empty embedded texture
- When an embedded texture is empty, skip it instead of trying to copy it. This must fail.
- closes https://github.com/assimp/assimp/issues/4238
- Found from the Google fuzzer.
2021-12-23 12:28:43 +01:00
Kim Kulling 64af16c427
Merge pull request #4283 from assimp/kimkulling-avoid_invalid_string_access_issue4222
LWS-Import: Avoid access to empty string token
2021-12-22 21:28:42 +01:00
Kim Kulling 635153b3a4
LWS-Import: Avoid access to empty string token
- Fix invalid access to string pointer when string token is empty
- closes https://github.com/assimp/assimp/issues/4222
2021-12-22 21:08:28 +01:00
Kim Kulling 7ec52e9e02
Merge pull request #4282 from assimp/kimkulling-fix_heap_overflow_during_utf8_issue4230
Make sure no overflow can happen
2021-12-22 20:56:39 +01:00
Kim Kulling 2c66d4d3a2
Optimize the check 2021-12-22 20:43:44 +01:00
Kim Kulling 215f4e1f4d
Fix typo 2021-12-22 20:02:29 +01:00
Kim Kulling 2eb86d75b8
Make sure no overflow can happen
- During UTF32 LE with BOM make sure that the byteswap operation will have enough space when iterating through the text buffer, which shall get encoded.
- closes https://github.com/assimp/assimp/issues/4230
2021-12-22 19:45:19 +01:00
Rene Sepulveda 19371af6e6 Support PBR properties/maps in Obj importer 2021-12-20 13:43:46 -05:00
Kim Kulling cab7b330ee
Merge branch 'master' into so-unloading 2021-12-20 17:58:18 +01:00
Kim Kulling 80b0b897ed
Merge pull request #4266 from assimp/kimkulling-patch-1
Update version to 5.1.4
2021-12-18 21:42:19 +01:00
Kim Kulling 572e31ddcb
Update version to 5.1.4 2021-12-18 21:30:04 +01:00
Kim Kulling 9dfd401624
Merge pull request #4263 from RivIs-sssa01/fix_X3DImporter.cpp_closingBraces
Fix compile error when ASSIMP_BUILD_NO_X3D_IMPORTER is define.
2021-12-18 21:28:32 +01:00
Kim Kulling 5a46597e47
Merge branch 'master' into fix_X3DImporter.cpp_closingBraces 2021-12-18 21:17:23 +01:00
Kim Kulling 01f68dd916
Merge pull request #4264 from Garux/IMAGE1.bmp_jpg
fix test/models/3DS/IMAGE1.bmp: is jpg
2021-12-18 21:16:59 +01:00
Garux 46f618a6ef add Inter-Quake Model (IQM) Importer 2021-12-18 15:34:58 +03:00
Garux 7fc4603579 fix test/models/3DS/IMAGE1.bmp: is jpg 2021-12-18 14:32:46 +03:00
sssaoi d7bf8d6e07 Fix compile error when ASSIMP_BUILD_NO_X3D_IMPORTER is define. 2021-12-18 14:50:22 +09:00
Vyacheslav Vanin 53968550e4
Merge branch 'master' into fix-fbx-metalness-import 2021-12-17 12:08:55 +03:00
Kim Kulling 6693e7e08c
Merge pull request #4256 from rumgot/cmake_no_known_features_error_fix
Fixed cmake error: No known features for C compiler when using the assimp library from another project
2021-12-16 21:35:52 +01:00
Kim Kulling 3e97329fa1
Merge branch 'master' into cmake_no_known_features_error_fix 2021-12-16 20:27:58 +01:00
Kim Kulling c72e3905c2
Merge pull request #4261 from assimp/kimkulling-enable_language_support_issue4257-2
Enable C++11 and C99
2021-12-16 20:27:17 +01:00
Kim Kulling 2ffa0c59eb
Switch to C++11 until gtest gets an update. 2021-12-16 19:54:40 +01:00
Kim Kulling af42d53c92
Enable C++17 and C99
- closes https://github.com/assimp/assimp/issues/4257
2021-12-16 19:41:15 +01:00
Kim Kulling c4d858cf4d
Merge pull request #4260 from assimp/kimkulling-patch-1
Fix a typo in the Visual-Studio Dll-Versions
2021-12-16 15:39:01 +01:00
Kim Kulling 7a29147095
Fix a typo 2021-12-16 14:55:23 +01:00
Kim Kulling efdaf603b0
Merge branch 'master' into so-unloading 2021-12-16 14:52:58 +01:00
Kim Kulling 46b28a442b
Merge pull request #4226 from umlaeute/bugfix/import-crashes
Bugfix/import crashes
2021-12-16 14:51:34 +01:00
Vyacheslav.Vanin 1afe7e6255 fix fbx import metalness
Can't import metalness textures in fbx importer
2021-12-16 12:09:06 +03:00
Kim Kulling 26dc168449
Merge branch 'master' into bugfix/import-crashes 2021-12-15 07:54:48 +01:00
rumgot 92aef9236f Fixed cmake error: No known features for C compiler when using the assimp library from another project. 2021-12-14 23:54:36 +03:00
Kim Kulling 8322e393c5
Merge pull request #4244 from kovacsv/copyscene_fix
Bug: Export crashes when any of the meshes contains texture coordinate names #4243
2021-12-14 00:14:42 +01:00
Kim Kulling 003942aafe
Merge branch 'master' into copyscene_fix 2021-12-13 21:19:08 +01:00
Kim Kulling 0491eb3591
Merge pull request #4253 from assimp/kimkulling_fix_double_prec_build_issue4248
Use correct XmlParser-methods and add some missing casts
2021-12-13 21:17:15 +01:00
Viktor Kovacs d619f7015a
Merge branch 'master' into copyscene_fix 2021-12-13 20:08:45 +01:00
Kim Kulling 65bc801734 Some fixes for possible divisions by zero 2021-12-13 18:48:58 +01:00
Kim Kulling e4f38810ca Add missing static casts 2021-12-13 18:12:19 +01:00
Kim Kulling cb657e4c13 Use correct XmlParser-methods and add some missing casts 2021-12-13 18:06:23 +01:00
Kim Kulling 052594568a
Merge pull request #4247 from inhosens/master
Revert "FBXConverter : Fix timescales of FBX animations"
2021-12-12 21:42:14 +01:00
Kim Kulling 54e60b031e
Merge branch 'master' into master 2021-12-12 21:12:37 +01:00
Viktor Kovacs 4959924dab
Merge branch 'master' into copyscene_fix 2021-12-10 20:10:25 +01:00
Kim Kulling 819d9f7257
Merge pull request #4250 from assimp/kimkulling-fix_division_by_zero_issue4235-1
Update HMPLoader.cpp
2021-12-10 15:03:01 +01:00
Inho Lee c2297e9199 Revert "FBXConverter : Fix timescales of FBX animations"
The previous patch was made by misunderstanding about mTime.
It is not real time value, but time ticks.

This reverts commit b8bf1eac04.
2021-12-09 10:57:39 +01:00
Viktor Kovacs d2c8cb755e
Merge branch 'master' into copyscene_fix 2021-12-08 14:29:31 +01:00
kovacsv 2be6bac4b0 Bug: Export crashes when any of the meshes contains texture coordinate names #4243 2021-12-07 20:42:43 +01:00
IOhannes m zmölnig 9a7ee0ac14 Throw a DeadlyImportError rather than an assertion if all materials are redundant and thus removed
Closes: https://github.com/assimp/assimp/issues/4224
Closes: https://github.com/assimp/assimp/issues/4225
2021-12-07 12:35:15 +01:00
IOhannes m zmölnig 6e090c88b8 fix index variable for surfaces
Closes: https://github.com/assimp/assimp/issues/4209
2021-12-07 12:13:31 +01:00
RichardTea 75e7d0f6ef
Merge branch 'master' into deprecated_gltfpbr_macros 2021-12-07 09:01:50 +00:00
Kim Kulling 5b4829155c
Merge branch 'master' into so-unloading 2021-12-04 20:28:12 +01:00
Kim Kulling 690e558b88
Update IOSystem.cpp 2021-11-25 09:32:52 +01:00
Thomas Nicky Thulesen 8b78a63b50 Allow dlclose of so library by avoiding unique symbols. 2021-11-23 20:39:48 +01:00
RichardTea d18709b899 Small float values should be true 2021-11-23 14:15:32 +00:00
RichardTea 5143044cc8 redefine AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS
This key is deprecated but is used by Qt5 & Qt 6.2.1 QtQuick3D
2021-11-23 13:55:27 +00:00
RichardTea 2fdf52488f float and integer material property bool conversion
All reading float and integer material property values as bool
Zero => False
Non-Zero => True
2021-11-23 13:53:58 +00:00
RichardTea 42766af702 Merge branch 'master' into deprecated_gltfpbr_macros 2021-11-23 12:03:23 +00:00
Kim Kulling bf1f142a72 Fix warnings 2021-11-20 18:40:38 +01:00
Kim Kulling 6439305379
Remove dead code 2021-08-24 20:53:55 +02:00
Kim Kulling 61ba320a04
Merge branch 'master' into master 2021-08-24 20:53:04 +02:00
bearbit 408b5053a4 update LWO importer(available lwo3) 2021-08-03 20:18:14 +03:00
Kim Kulling b82d9f4bc7
Merge branch 'master' into new-file-detection 2021-05-05 15:59:25 +02:00
Krishty d5cde96fbd Merge branch 'new-file-detection' of https://github.com/krishty/assimp into new-file-detection 2021-05-05 13:14:35 +02:00
Krishty b546dfccc7 fix for 0f3e6e2941
Visual Studio’s Search All Files ignores ObjFileImporter.cpp and now I’m sure that’s a bug
2021-05-05 13:14:25 +02:00
Kim Kulling 6dcbd0d566
Merge branch 'master' into new-file-detection 2021-05-05 09:37:52 +02:00
Krishty deca47225f Merge branch 'new-file-detection' of https://github.com/krishty/assimp into new-file-detection 2021-05-05 00:59:20 +02:00
Krishty ae93f53b51 fixed signature-based detection on unknown extensions 2021-05-05 00:57:43 +02:00
Krishty b79b84d34e Merge branch 'master' into new-file-detection 2021-05-05 00:09:42 +02:00
Krishty 0f3e6e2941 replaced std::size() with AI_COUNT_OF for pre-C++20 compilers 2021-05-05 00:08:54 +02:00
Kim Kulling 88d64388f8
Update AMFImporter.cpp 2021-05-03 20:57:17 +02:00
Kim Kulling b87f67db4c
Add missing include 2021-05-03 20:49:14 +02:00
Kim Kulling 60b99501a9
Merge branch 'master' into new-file-detection 2021-05-03 20:44:27 +02:00
Krishty 628cba9490 fixed warning 2021-04-24 00:44:50 +02:00
Krishty b00de10eb3 Simplified importer search and fixed a few bugs
The search for a matching importer had a few issues, see #3791. There were two different mechanisms to determine whether an importer accepts a specific file extension:
1. `aiImporterDesc::mFileExtensions`, which was forwarded to the UI via `BaseImporter::GetExtensionList()`.
2. `BaseImporter::CanRead()` when called with `checkSig == false`, which determines whether to actually use that importer.
Both were redundant and got out of sync repeatedly. I removed 2. completely and replaced it with 1., thereby syncing UI/import and shortening all `BaseImporter::CanRead()` implementations.

Further bugfixes:
- fixed glTF2 importer throwing exceptions when checking whether it can load a file
- removed `BaseImporter::SimpleExtensionCheck()` because it is no longer used and had a bug with case sensitivity

Since the `checkSig` parameter in `BaseImporter::CanRead()` is now useless, it can be removed completely. I’m not sure if this would break ABI compatiblity, so I’ll submit it with a later pull request.
2021-04-24 00:17:50 +02:00
1693 changed files with 196332 additions and 92392 deletions

View File

@ -1,2 +0,0 @@
service_name: travis-pro
repo_token: GZXuNlublKFy7HAewHAZLk5ZwgipTFAOA

11
.github/dependabot.yml vendored 100644
View File

@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gitsubmodule"
directory: "/" # the .gitmodules file must be placed at the top-level directory of a git working tree
schedule:
interval: "weekly"
open-pull-requests-limit: 15 # Assimp has 15 dependencies

View File

@ -6,12 +6,140 @@ on:
pull_request: pull_request:
branches: [ master ] branches: [ master ]
permissions:
contents: write # to fetch code (actions/checkout),and release
jobs: jobs:
job: build:
name: ${{ matrix.name }}-build-and-test name: ${{ matrix.name }}-build-and-test
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix:
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++]
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
include:
- name: windows-latest-cl.exe
os: windows-latest
cxx: cl.exe
cc: cl.exe
- name: ubuntu-latest-clang++
os: ubuntu-latest
cxx: clang++
cc: clang
- name: macos-latest-clang++
os: macos-latest
cxx: clang++
cc: clang
- name: ubuntu-latest-g++
os: ubuntu-latest
cxx: g++
cc: gcc
steps:
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
- uses: actions/checkout@v4
with:
submodules: true
- uses: lukka/get-cmake@latest
- uses: ilammy/msvc-dev-cmd@v1
- name: Set Compiler Environment
uses: lukka/set-shell-env@v1
with:
CXX: ${{ matrix.cxx }}
CC: ${{ matrix.cc }}
- name: Cache DX SDK
id: dxcache
if: contains(matrix.name, 'windows')
uses: actions/cache@v4
with:
path: '${{ github.workspace }}/DX_SDK'
key: ${{ runner.os }}-DX_SDK
restore-keys: |
${{ runner.os }}-DX_SDK
- name: Download DXSetup
if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true'
run: |
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
- name: Set Windows specific CMake arguments
if: contains(matrix.name, 'windows')
id: windows_extra_cmake_args
run: echo ":set-output name=args::=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT
- name: Set Hunter specific CMake arguments
if: contains(matrix.name, 'hunter')
id: hunter_extra_cmake_args
run: echo "args=-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake" >> $GITHUB_OUTPUT
- name: configure and build
uses: lukka/run-cmake@v3
env:
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
buildWithCMakeArgs: '--parallel 24 -v'
buildDirectory: '${{ github.workspace }}/build/'
- name: Exclude certain tests in Hunter specific builds
if: contains(matrix.name, 'hunter')
id: hunter_extra_test_args
run: echo "args=--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest" >> $GITHUB_OUTPUT
- name: test
run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
shell: bash
- uses: actions/upload-artifact@v4
if: matrix.name == 'windows-msvc'
with:
name: 'assimp-bins-${{ matrix.name }}'
path: build/bin/assimp*.exe
- uses: marvinpinto/action-automatic-releases@latest
if: contains(matrix.name, 'windows-msvc-hunter')
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "master"
prerelease: true
title: "AutoRelease"
files: |
build/bin/assimp*.exe
create-release:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
with:
tag_name: '${{github.ref}}'
release_name: 'Release ${{github.ref}}'
draft: false
prerelease: true
- run: |
echo '${{steps.create-release.outputs.upload_url}}' > release_upload_url.txt
- uses: actions/upload-artifact@v4
with:
name: create-release
path: release_upload_url.txt
upload-release:
strategy:
matrix: matrix:
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter] 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. # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
@ -42,88 +170,23 @@ jobs:
os: windows-latest os: windows-latest
toolchain: ninja-vs-win64-cxx17 toolchain: ninja-vs-win64-cxx17
needs: [create-release]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps: steps:
- uses: actions/checkout@v2 - uses: softprops/action-gh-release@v2
- uses: lukka/get-cmake@latest
- uses: ilammy/msvc-dev-cmd@v1
- name: Set Compiler Environment
if: "!endsWith(matrix.name, 'hunter')"
uses: lukka/set-shell-env@v1
with: with:
CXX: ${{ matrix.cxx }} name: create-release
CC: ${{ matrix.cc }} - id: upload-url
- name: Set Compiler Environment for Hunter on Windows
if: startsWith(matrix.name, 'windows') && endsWith(matrix.name, 'hunter')
uses: lukka/set-shell-env@v1
with:
VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools
- name: Checkout Hunter toolchains
if: endsWith(matrix.name, 'hunter')
uses: actions/checkout@v2
with:
repository: cpp-pm/polly
path: cmake/polly
- name: Remove contrib directory for Hunter builds
if: contains(matrix.name, 'hunter')
uses: JesseTG/rm@v1.0.2
with:
path: contrib
- name: Cache DX SDK
id: dxcache
if: contains(matrix.name, 'windows')
uses: actions/cache@v2
with:
path: '${{ github.workspace }}/DX_SDK'
key: ${{ runner.os }}-DX_SDK
restore-keys: |
${{ runner.os }}-DX_SDK
- name: Download DXSetup
if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true'
run: | run: |
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe echo "url=$(cat create-release/release_upload_url.txt)" >> $GITHUB_OUTPUT
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK" - uses: actions/download-artifact@v4
- name: Set Windows specific CMake arguments
if: contains(matrix.name, 'windows')
id: windows_extra_cmake_args
run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1"
- name: Set Hunter specific CMake arguments
if: contains(matrix.name, 'hunter')
id: hunter_extra_cmake_args
run: echo "::set-output name=args::-DBUILD_SHARED_LIBS=OFF -DASSIMP_HUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/polly/${{ matrix.toolchain }}.cmake"
- name: configure and build
uses: lukka/run-cmake@v3
env:
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }} ${{ steps.hunter_extra_cmake_args.outputs.args }}'
buildWithCMakeArgs: '-- -v'
buildDirectory: '${{ github.workspace }}/build/'
- name: Exclude certain tests in Hunter specific builds
if: contains(matrix.name, 'hunter')
id: hunter_extra_test_args
run: echo "::set-output name=args::--gtest_filter=-utOpenGEXImportExport.Importissue1340_EmptyCameraObject:utColladaZaeImportExport.importBlenFromFileTest"
- name: test
run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }}
shell: bash
- uses: actions/upload-artifact@v2
if: matrix.name == 'windows-msvc'
with: with:
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
path: build/bin - uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
with:
files: |
*.zip

26
.github/workflows/cifuzz.yml vendored 100644
View File

@ -0,0 +1,26 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'assimp'
dry-run: false
language: c++
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'assimp'
fuzz-seconds: 300
dry-run: false
language: c++
- name: Upload Crash
uses: actions/upload-artifact@v4
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts

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+

View File

@ -6,12 +6,15 @@ on:
pull_request: pull_request:
branches: [ master ] branches: [ master ]
permissions:
contents: read # to fetch code (actions/checkout)
jobs: jobs:
job1: job1:
name: adress-sanitizer name: adress-sanitizer
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: lukka/get-cmake@latest - uses: lukka/get-cmake@latest
- uses: lukka/set-shell-env@v1 - uses: lukka/set-shell-env@v1
with: with:
@ -35,7 +38,7 @@ jobs:
name: undefined-behavior-sanitizer name: undefined-behavior-sanitizer
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: lukka/get-cmake@latest - uses: lukka/get-cmake@latest
- uses: lukka/set-shell-env@v1 - uses: lukka/set-shell-env@v1
with: with:
@ -43,7 +46,7 @@ jobs:
CC: clang CC: clang
- name: configure and build - name: configure and build
uses: lukka/run-cmake@v2 uses: lukka/run-cmake@v3
with: with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
@ -54,3 +57,13 @@ jobs:
- name: test - name: test
run: cd build/bin && ./unit run: cd build/bin && ./unit
shell: bash shell: bash
job3:
name: printf-sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: run scan_printf script
run: ./scripts/scan_printf.sh
shell: bash

4
.gitignore vendored
View File

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

View File

@ -1,67 +0,0 @@
#---------------------------------------------------------------------------
#Open Asset Import Library (assimp)
#---------------------------------------------------------------------------
# Copyright (c) 2006-2020, assimp team
#
# License see LICENSE file
#
function generate() {
OPTIONS="-DASSIMP_WERROR=ON"
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"
if [ "$DISABLE_EXPORTERS" = "YES" ] ; then
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=YES"
else
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"
fi
if [ "$SHARED_BUILD" = "ON" ] ; then
OPTIONS="$OPTIONS -DBUILD_SHARED_LIBS=ON"
else
OPTIONS="$OPTIONS -DBUILD_SHARED_LIBS=OFF"
fi
if [ "$ENABLE_COVERALLS" = "ON" ] ; then
OPTIONS="$OPTIONS -DASSIMP_COVERALLS=ON"
else
OPTIONS="$OPTIONS -DASSIMP_COVERALLS=OFF"
fi
if [ "$ASAN" = "ON" ] ; then
OPTIONS="$OPTIONS -DASSIMP_ASAN=ON"
else
OPTIONS="$OPTIONS -DASSIMP_ASAN=OFF"
fi
if [ "$UBSAN" = "ON" ] ; then
OPTIONS="$OPTIONS -DASSIMP_UBSAN=ON"
fi
cmake -G "Unix Makefiles" $OPTIONS
}
# build and run unittests, if not android
if [ $ANDROID ]; then
ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni
fi
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ $ANALYZE = "ON" ] ; then
if [ "$CC" = "clang" ]; then
scan-build cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_TESTS=OFF
scan-build --status-bugs make -j2
else
cppcheck --version
generate \
&& cppcheck --error-exitcode=1 -j2 -Iinclude -Icode code 2> cppcheck.txt
if [ -s cppcheck.txt ]; then
cat cppcheck.txt
exit 1
fi
fi
else
generate \
&& make -j4 \
&& sudo make install \
&& sudo ldconfig \
&& (cd test/unit; ../../bin/unit)
fi
fi

View File

@ -1,78 +0,0 @@
sudo: required
language: cpp
cache: ccache
before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq && sudo apt-get install cmake cppcheck && sudo apt-get install cmake python3 && sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; fi
- 'if [ "$TRAVIS_OS_NAME" = "osx" ]; then
if brew ls --versions cmake > /dev/null; then
echo cmake already installed.;
else
brew install cmake;
fi;
brew install python3;
brew install homebrew/x11/freeglut;
fi'
- echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h
# install latest LCOV (1.9 was failing)
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz && tar xf lcov_1.11.orig.tar.gz && sudo make -C lcov-1.11/ install && gem install coveralls-lcov && lcov --version && g++ --version ; fi
os:
- linux
compiler:
- gcc
- clang
env:
global:
- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc="
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
git:
depth: 1
matrix:
include:
- os: linux
compiler: clang
env: ASAN=ON
- os: linux
compiler: clang
env: UBSAN=ON
- os: linux
compiler: clang
env: SHARED_BUILD=ON
- os: linux
compiler: gcc
env: ANALYZE=ON
- os: linux
compiler: gcc
env: ENABLE_COVERALLS=ON
- os: linux
compiler: gcc
env: SHARED_BUILD=ON
install:
- if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi
before_script:
cmake . -DASSIMP_ENABLE_BOOST_WORKAROUND=YES
script:
- export COVERALLS_SERVICE_NAME=travis-ci
- export COVERALLS_REPO_TOKEN=abc12345
- . ./.travis.sh
after_success:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && lcov --directory . --capture --output-file coverage.info && lcov --remove coverage.info '/usr/*' 'contrib/*' 'test/*' --output-file coverage.info && lcov --list coverage.info && coveralls-lcov --source-encoding=ISO-8859-1 --repo-token=${COVERALLS_TOKEN} coverage.info ; fi
addons:
coverity_scan:
project:
name: "assimp/assimp"
notification_email: kim.kulling@googlemail.com
build_command_prepend: "cmake ./"
build_command: "make -j4"
branch_pattern: coverity_scan

View File

@ -10,16 +10,15 @@
:: Also see: https://github.com/assimp/assimp/pull/2646 :: Also see: https://github.com/assimp/assimp/pull/2646
SET SOURCE_DIR=. SET SOURCE_DIR=.
SET GENERATOR=Visual Studio 16 2019
:: For generators see "cmake --help" SET BINARIES_DIR="./build/Win32"
SET GENERATOR=Visual Studio 15 2017 cmake . -G "%GENERATOR%" -A Win32 -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config debug
SET BINARIES_DIR="./BINARIES/Win32"
cmake CMakeLists.txt -G "%GENERATOR%" -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config release cmake --build %BINARIES_DIR% --config release
SET BINARIES_DIR="./BINARIES/x64" SET BINARIES_DIR="./build/x64"
cmake CMakeLists.txt -G "%GENERATOR% Win64" -S %SOURCE_DIR% -B %BINARIES_DIR% cmake . -G "%GENERATOR%" -A x64 -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config debug cmake --build %BINARIES_DIR% --config debug
cmake --build %BINARIES_DIR% --config release cmake --build %BINARIES_DIR% --config release

View File

@ -7,14 +7,15 @@ You can download and install assimp using the [vcpkg](https://github.com/Microso
cd vcpkg cd vcpkg
./bootstrap-vcpkg.sh ./bootstrap-vcpkg.sh
./vcpkg integrate install ./vcpkg integrate install
vcpkg install assimp ./vcpkg install assimp
``` ```
The assimp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. The assimp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
## Install on Ubuntu ## Install on Ubuntu
You can install the Asset-Importer-Lib via apt: You can install the Asset-Importer-Lib via apt:
``` ```
sudo apt-get install assimp sudo apt-get update
sudo apt-get install libassimp-dev
``` ```
## Install pyassimp ## Install pyassimp
@ -26,7 +27,7 @@ pip install pyassimp
## Manual build instructions ## Manual build instructions
### Install CMake ### Install CMake
Asset-Importer-Lib can be build for a lot of different platforms. We are using cmake to generate the build environment for these via cmake. So you have to make sure that you have a working cmake-installation on your system. You can download it at https://cmake.org/ or for linux install it via Asset-Importer-Lib can be built for a lot of different platforms. We are using cmake to generate the build environment for these via cmake. So you have to make sure that you have a working cmake-installation on your system. You can download it at https://cmake.org/ or for linux install it via
```bash ```bash
sudo apt-get install cmake sudo apt-get install cmake
``` ```
@ -42,15 +43,16 @@ cd assimp
cmake CMakeLists.txt cmake CMakeLists.txt
cmake --build . cmake --build .
``` ```
Note that by default this builds a shared library into the `bin` directory. If you want to build it as a static library see the build options at the bottom of this file.
### Build instructions for Windows with Visual-Studio ### Build instructions for Windows with Visual-Studio
First you have to install Visual-Studio on your windows-system. You can get the Community-Version for free here: https://visualstudio.microsoft.com/de/downloads/ First, you have to install Visual-Studio on your windows-system. You can get the Community-Version for free here: https://visualstudio.microsoft.com/de/downloads/
To generate the build environment for your IDE open a command prompt, navigate to your repo and type: To generate the build environment for your IDE open a command prompt, navigate to your repo and type:
```bash ```bash
cmake CMakeLists.txt cmake CMakeLists.txt
``` ```
This will generate the project files for the visual studio. All dependencies used to build Asset-IMporter-Lib shall be part of the repo. If you want to use you own zlib.installation this is possible as well. Check the options for it. This will generate the project files for the visual studio. All dependencies used to build Asset-Importer-Lib shall be part of the repo. If you want to use you own zlib installation this is possible as well. Check the options for it.
### Build instructions for Windows with UWP ### Build instructions for Windows with UWP
See <https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app> See <https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app>
@ -62,9 +64,9 @@ Open a terminal and got to your repository. You can generate the makefiles and b
cmake CMakeLists.txt cmake CMakeLists.txt
make -j4 make -j4
``` ```
The option -j descripes the number of parallel processes for the build. In this case make will try to use 4 cores for the build. The option -j describes the number of parallel processes for the build. In this case make will try to use 4 cores for the build.
If you want to use a IDE for linux you can try QTCreator for instance. If you want to use an IDE for linux you can try QTCreator for instance.
### Build instructions for MinGW ### Build instructions for MinGW
Older versions of MinGW's compiler (e.g. 5.1.0) do not support the -mbig_obj flag Older versions of MinGW's compiler (e.g. 5.1.0) do not support the -mbig_obj flag
@ -84,23 +86,28 @@ Besides the toolchain, compilation should be the same as for Linux / Unix.
### CMake build options ### CMake build options
The cmake-build-environment provides options to configure the build. The following options can be used: The cmake-build-environment provides options to configure the build. The following options can be used:
- **BUILD_SHARED_LIBS ( default ON )**: Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib. - **ASSIMP_HUNTER_ENABLED (default OFF)**: Enable Hunter package manager support.
- **BUILD_FRAMEWORK ( default OFF, MacOnly)**: Build package as Mac OS X Framework bundle - **BUILD_SHARED_LIBS (default ON)**: Generation of shared libs (dll for windows, so for Linux). Set this to OFF to get a static lib.
- **ASSIMP_DOUBLE_PRECISION( default OFF )**: All data will be stored as double values. - **ASSIMP_BUILD_FRAMEWORK (default OFF, MacOnly)**: Build package as Mac OS X Framework bundle.
- **ASSIMP_OPT_BUILD_PACKAGES ( default OFF)**: Set to ON to generate CPack configuration files and packaging targets - **ASSIMP_DOUBLE_PRECISION (default OFF)**: All data will be stored as double values.
- **ASSIMP_ANDROID_JNIIOSYSTEM ( default OFF )**: Android JNI IOSystem support is active - **ASSIMP_OPT_BUILD_PACKAGES (default OFF)**: Set to ON to generate CPack configuration files and packaging targets.
- **ASSIMP_NO_EXPORT ( default OFF )**: Disable Assimp's export functionality - **ASSIMP_ANDROID_JNIIOSYSTEM (default OFF)**: Android JNI IOSystem support is active.
- **ASSIMP_BUILD_ZLIB ( default OFF )**: Build your own zlib - **ASSIMP_NO_EXPORT (default OFF)**: Disable Assimp's export functionality.
- **ASSIMP_BUILD_ASSIMP_TOOLS ( default ON )**: If the supplementary tools for Assimp are built in addition to the library. - **ASSIMP_BUILD_ZLIB (default OFF)**: Build our own zlib.
- **ASSIMP_BUILD_SAMPLES ( default OFF )**: If the official samples are built as well (needs Glut). - **ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all exporters enabled.
- **ASSIMP_BUILD_TESTS ( default ON )**: If the test suite for Assimp is built in addition to the library. - **ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all importers enabled.
- **ASSIMP_COVERALLS ( default OFF )**: Enable this to measure test coverage. - **ASSIMP_BUILD_ASSIMP_TOOLS (default OFF)**: If the supplementary tools for Assimp are built in addition to the library.
- **ASSIMP_ERROR_MAX( default OFF)**: Enable all warnings. - **ASSIMP_BUILD_SAMPLES (default OFF)**: If the official samples are built as well (needs Glut).
- **ASSIMP_WERROR( default OFF )**: Treat warnings as errors. - **ASSIMP_BUILD_TESTS (default ON)**: If the test suite for Assimp is built in addition to the library.
- **ASSIMP_ASAN ( default OFF )**: Enable AddressSanitizer. - **ASSIMP_COVERALLS (default OFF)**: Enable this to measure test coverage.
- **ASSIMP_UBSAN ( default OFF )**: Enable Undefined Behavior sanitizer. - **ASSIMP_INSTALL (default ON)**: Install Assimp library. Disable this if you want to use Assimp as a submodule.
- **SYSTEM_IRRXML ( default OFF )**: Use system installed Irrlicht/IrrXML library. - **ASSIMP_WARNINGS_AS_ERRORS (default ON)**: Treat all warnings as errors.
- **BUILD_DOCS ( default OFF )**: Build documentation using Doxygen. - **ASSIMP_ASAN (default OFF)**: Enable AddressSanitizer.
- **INJECT_DEBUG_POSTFIX( default ON )**: Inject debug postfix in .a/.so lib names - **ASSIMP_UBSAN (default OFF)**: Enable Undefined Behavior sanitizer.
- **IGNORE_GIT_HASH ( default OFF )**: Don't call git to get the hash. - **ASSIMP_BUILD_DOCS (default OFF)**: Build documentation using Doxygen. OBSOLETE, see https://github.com/assimp/assimp-docs
- **ASSIMP_INSTALL_PDB ( default ON )**: Install MSVC debug files. - **ASSIMP_INJECT_DEBUG_POSTFIX (default ON)**: Inject debug postfix in .a/.so/.lib/.dll lib names
- **ASSIMP_IGNORE_GIT_HASH (default OFF)**: Don't call git to get the hash.
- **ASSIMP_INSTALL_PDB (default ON)**: Install MSVC debug files.
- **USE_STATIC_CRT (default OFF)**: Link against the static MSVC runtime libraries.
- **ASSIMP_BUILD_DRACO (default OFF)**: Build Draco libraries. Primarily for glTF.
- **ASSIMP_BUILD_ASSIMP_VIEW (default ON, if DirectX found, OFF otherwise)**: Build Assimp view tool (requires DirectX).

View File

@ -1,6 +1,6 @@
# Open Asset Import Library (assimp) # Open Asset Import Library (assimp)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Copyright (c) 2006-2021, assimp team # Copyright (c) 2006-2024, assimp team
# #
# All rights reserved. # All rights reserved.
# #
@ -38,9 +38,25 @@ SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW) SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0092 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_IMPORTER)
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)
# Toggles the use of the hunter package manager # Toggles the use of the hunter package manager
@ -49,14 +65,13 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
IF(ASSIMP_HUNTER_ENABLED) IF(ASSIMP_HUNTER_ENABLED)
include("cmake-modules/HunterGate.cmake") include("cmake-modules/HunterGate.cmake")
HunterGate( HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.311.tar.gz" URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
SHA1 "1a82b9b73055879181cb1466b2ab5d48ee8ae410" SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
) )
add_definitions(-DASSIMP_USE_HUNTER) add_definitions(-DASSIMP_USE_HUNTER)
ENDIF() ENDIF()
PROJECT(Assimp VERSION 5.1.3) PROJECT(Assimp VERSION 5.4.3)
# All supported options ############################################### # All supported options ###############################################
@ -84,13 +99,9 @@ OPTION( ASSIMP_NO_EXPORT
"Disable Assimp's export functionality." "Disable Assimp's export functionality."
OFF OFF
) )
OPTION( ASSIMP_BUILD_ZLIB
"Build your own zlib"
OFF
)
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
"If the supplementary tools for Assimp are built in addition to the library." "If the supplementary tools for Assimp are built in addition to the library."
ON OFF
) )
OPTION ( ASSIMP_BUILD_SAMPLES OPTION ( ASSIMP_BUILD_SAMPLES
"If the official samples are built as well (needs Glut)." "If the official samples are built as well (needs Glut)."
@ -108,9 +119,9 @@ OPTION( ASSIMP_INSTALL
"Disable this if you want to use assimp as a submodule." "Disable this if you want to use assimp as a submodule."
ON ON
) )
OPTION ( ASSIMP_ERROR_MAX OPTION ( ASSIMP_WARNINGS_AS_ERRORS
"Enable all warnings." "Treat all warnings as errors."
OFF ON
) )
OPTION ( ASSIMP_ASAN OPTION ( ASSIMP_ASAN
"Enable AddressSanitizer." "Enable AddressSanitizer."
@ -134,22 +145,45 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH
OFF OFF
) )
IF ( WIN32 ) IF (WIN32)
# Use subset of Windows.h OPTION( ASSIMP_BUILD_ZLIB
"Build your zlib"
ON
)
ELSE()
OPTION( ASSIMP_BUILD_ZLIB
"Build your zlib"
OFF
)
ENDIF()
IF (WIN32)
# Use a subset of Windows.h
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN ) ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
IF(MSVC) IF(MSVC)
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW
"If the Assimp view tool is built. (requires DirectX)"
OFF )
OPTION( ASSIMP_INSTALL_PDB OPTION( ASSIMP_INSTALL_PDB
"Install MSVC debug files." "Create MSVC debug symbol files and add to Install target."
ON ) ON )
IF(NOT (MSVC_VERSION LESS 1900)) 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 ) ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
ENDIF() ENDIF()
# 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 overridden by some Visual Studio generators, so we use an alternative
# global method here:
if (${USE_STATIC_CRT})
add_compile_options(
$<$<CONFIG:>:/MT>
$<$<CONFIG:Debug>:/MTd>
$<$<CONFIG:Release>:/MT>
)
endif()
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -169,6 +203,7 @@ ENDIF()
IF(NOT BUILD_SHARED_LIBS) IF(NOT BUILD_SHARED_LIBS)
MESSAGE(STATUS "Shared libraries disabled") MESSAGE(STATUS "Shared libraries disabled")
SET(LINK_SEARCH_START_STATIC TRUE) SET(LINK_SEARCH_START_STATIC TRUE)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
ELSE() ELSE()
MESSAGE(STATUS "Shared libraries enabled") MESSAGE(STATUS "Shared libraries enabled")
ENDIF() ENDIF()
@ -181,10 +216,9 @@ SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VER
SET (ASSIMP_SOVERSION 5) SET (ASSIMP_SOVERSION 5)
SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" ) SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )
if(NOT ASSIMP_HUNTER_ENABLED) set(CMAKE_CXX_STANDARD 17)
# Enable C++11 support globally set(CMAKE_CXX_STANDARD_REQUIRED ON)
set_property( GLOBAL PROPERTY CXX_STANDARD 11 ) set(CMAKE_C_STANDARD 99)
endif()
IF(NOT ASSIMP_IGNORE_GIT_HASH) IF(NOT ASSIMP_IGNORE_GIT_HASH)
# Get the current working branch # Get the current working branch
@ -214,16 +248,6 @@ IF(ASSIMP_DOUBLE_PRECISION)
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION) ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
ENDIF() ENDIF()
CONFIGURE_FILE(
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/revision.h
)
CONFIGURE_FILE(
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
)
INCLUDE_DIRECTORIES( BEFORE INCLUDE_DIRECTORIES( BEFORE
./ ./
code/ code/
@ -241,14 +265,24 @@ SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
IF( UNIX ) IF( UNIX )
# Use GNUInstallDirs for Unix predefined directories # Use GNUInstallDirs for Unix predefined directories
INCLUDE(GNUInstallDirs) INCLUDE(GNUInstallDirs)
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit Linux
IF(NOT ${OPERATING_SYSTEM} MATCHES "Android")
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit Linux
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 )
ENDIF()
ENDIF()
ENDIF() ENDIF()
# Grouped compiler settings ######################################## # Grouped compiler settings ########################################
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW AND NOT HAIKU)
IF(NOT ASSIMP_HUNTER_ENABLED) IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON) SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF() 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>")
ENDIF()
# hide all not-exported symbols # hide all not-exported symbols
IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" ) IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" )
SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
@ -262,36 +296,48 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
ELSEIF(MSVC) ELSEIF(MSVC)
# enable multi-core compilation with MSVC # enable multi-core compilation with MSVC
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
ADD_COMPILE_OPTIONS(/bigobj /W4 /WX ) ADD_COMPILE_OPTIONS(/bigobj)
ELSE() # msvc ELSE() # msvc
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX) ADD_COMPILE_OPTIONS(/MP /bigobj)
ENDIF() ENDIF()
# disable "elements of array '' will be default initialized" warning on MSVC2013 # disable "elements of array '' will be default initialized" warning on MSVC2013
IF(MSVC12) IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351) ADD_COMPILE_OPTIONS(/wd4351)
ENDIF() ENDIF()
ADD_COMPILE_OPTIONS(/wd4244) #supress warning for double to float conversion if Double precission is activated # supress warning for double to float conversion if Double precision is activated
ADD_COMPILE_OPTIONS(/wd4244)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
# Allow user to disable PDBs
if(ASSIMP_INSTALL_PDB)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") 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") 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" ) ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED) IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON) SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF() ENDIF()
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" ) SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ELSEIF( CMAKE_COMPILER_IS_MINGW ) ELSEIF( MINGW )
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message(FATAL_ERROR "MinGW is too old to be supported. Please update MinGW and try again.") message(FATAL_ERROR "MinGW is too old to be supported. Please update MinGW and try again.")
ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3) ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
message(WARNING "MinGW is old, if you experience errors, update MinGW.") message(WARNING "MinGW is old, if you experience errors, update MinGW.")
ENDIF() ENDIF()
IF(NOT ASSIMP_HUNTER_ENABLED) IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "-std=gnu++17 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
ENDIF() ENDIF()
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}") IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -g ${CMAKE_CXX_FLAGS}")
ELSE()
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
ENDIF()
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ENDIF() ENDIF()
@ -302,35 +348,27 @@ IF ( IOS AND NOT ASSIMP_HUNTER_ENABLED)
ELSE() ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
# Experimental for pdb generation
ENDIF() ENDIF()
ENDIF() ENDIF()
IF (ASSIMP_COVERALLS) IF (ASSIMP_COVERALLS)
MESSAGE(STATUS "Coveralls enabled") MESSAGE(STATUS "Coveralls enabled")
INCLUDE(Coveralls) INCLUDE(Coveralls)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") 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") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
ENDIF() ENDIF()
IF (ASSIMP_ERROR_MAX)
MESSAGE(STATUS "Turning on all warnings")
IF (MSVC)
ADD_COMPILE_OPTIONS(/W4) # NB: there is a /Wall option, pedantic mode
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
ENDIF()
ENDIF()
IF (ASSIMP_ASAN) IF (ASSIMP_ASAN)
MESSAGE(STATUS "AddressSanitizer enabled") MESSAGE(STATUS "AddressSanitizer enabled")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
ENDIF() ENDIF()
IF (ASSIMP_UBSAN) IF (ASSIMP_UBSAN)
MESSAGE(STATUS "Undefined Behavior sanitizer enabled") MESSAGE(STATUS "Undefined Behavior sanitizer enabled")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
ENDIF() ENDIF()
@ -339,9 +377,24 @@ INCLUDE (FindPkgMacros)
INCLUDE (PrecompiledHeader) INCLUDE (PrecompiledHeader)
# Set Assimp project output directory variables. # Set Assimp project output directory variables.
SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for runtime output files") # Will respect top-level CMAKE_*_OUTPUT_DIRECTORY variables if any are set.
SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for library output files") IF(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" CACHE STRING "Path for archive output files") SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for runtime output files")
ELSE()
SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files")
ENDIF()
IF(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for library output files")
ELSE()
SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files")
ENDIF()
IF(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" CACHE STRING "Path for library output files")
ELSE()
SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files")
ENDIF()
# Macro used to set the output directories of a target to the # Macro used to set the output directories of a target to the
# respective Assimp output directories. # respective Assimp output directories.
@ -368,13 +421,6 @@ IF (NOT TARGET uninstall AND ASSIMP_INSTALL)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF() ENDIF()
# cmake configuration files
if(${BUILD_SHARED_LIBS})
set(BUILD_LIB_TYPE SHARED)
else()
set(BUILD_LIB_TYPE STATIC)
endif()
IF( UNIX ) IF( UNIX )
# Use GNUInstallDirs for Unix predefined directories # Use GNUInstallDirs for Unix predefined directories
INCLUDE(GNUInstallDirs) INCLUDE(GNUInstallDirs)
@ -429,18 +475,20 @@ configure_package_config_file(
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}" INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
) )
install( if(ASSIMP_INSTALL)
install(
FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
DESTINATION "${CONFIG_INSTALL_DIR}" DESTINATION "${CONFIG_INSTALL_DIR}"
COMPONENT ${LIBASSIMP-DEV_COMPONENT} COMPONENT ${LIBASSIMP-DEV_COMPONENT}
) )
install( install(
EXPORT "${TARGETS_EXPORT_NAME}" EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${NAMESPACE}" NAMESPACE "${NAMESPACE}"
DESTINATION "${CONFIG_INSTALL_DIR}" DESTINATION "${CONFIG_INSTALL_DIR}"
COMPONENT ${LIBASSIMP-DEV_COMPONENT} COMPONENT ${LIBASSIMP-DEV_COMPONENT}
) )
endif()
IF( ASSIMP_BUILD_DOCS ) IF( ASSIMP_BUILD_DOCS )
ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(doc)
@ -458,7 +506,7 @@ IF(ASSIMP_HUNTER_ENABLED)
set(ASSIMP_BUILD_MINIZIP TRUE) set(ASSIMP_BUILD_MINIZIP TRUE)
ELSE() ELSE()
# If the zlib is already found outside, add an export in case assimpTargets can't find it. # 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 INSTALL( TARGETS zlib zlibstatic
EXPORT "${TARGETS_EXPORT_NAME}") EXPORT "${TARGETS_EXPORT_NAME}")
ENDIF() ENDIF()
@ -467,7 +515,11 @@ ELSE()
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
ENDIF() ENDIF()
IF( NOT ZLIB_FOUND ) IF ( NOT ZLIB_FOUND AND NOT ASSIMP_BUILD_ZLIB )
message( FATAL_ERROR
"Build configured with -DASSIMP_BUILD_ZLIB=OFF but unable to find zlib"
)
ELSEIF( NOT ZLIB_FOUND )
MESSAGE(STATUS "compiling zlib from sources") MESSAGE(STATUS "compiling zlib from sources")
INCLUDE(CheckIncludeFile) INCLUDE(CheckIncludeFile)
INCLUDE(CheckTypeSize) INCLUDE(CheckTypeSize)
@ -536,11 +588,15 @@ SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
) )
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) 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 # pick the correct prebuilt library
IF(MSVC15) IF(MSVC143)
SET(C4D_LIB_POSTFIX "_2022")
ELSEIF(MSV142)
SET(C4D_LIB_POSTFIX "_2019")
ELSEIF(MSVC15)
SET(C4D_LIB_POSTFIX "_2017") SET(C4D_LIB_POSTFIX "_2017")
ELSEIF(MSVC14) ELSEIF(MSVC14)
SET(C4D_LIB_POSTFIX "_2015") SET(C4D_LIB_POSTFIX "_2015")
@ -552,7 +608,7 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
SET(C4D_LIB_POSTFIX "_2010") SET(C4D_LIB_POSTFIX "_2010")
ELSE() ELSE()
MESSAGE( FATAL_ERROR MESSAGE( FATAL_ERROR
"C4D is currently only supported with MSVC 10, 11, 12, 14" "C4D for Windows is currently only supported with MSVC 10, 11, 12, 14, 14.2, 14.3"
) )
ENDIF() ENDIF()
@ -570,15 +626,30 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
# winsock and winmm are necessary (and undocumented) dependencies of Cineware SDK because # winsock and winmm are necessary (and undocumented) dependencies of Cineware SDK because
# it can be used to communicate with a running Cinema 4D instance # it can be used to communicate with a running Cinema 4D instance
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib) 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 () ELSE ()
MESSAGE( FATAL_ERROR 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 () ENDIF ()
ELSE () ELSE ()
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER ) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
ENDIF () ENDIF ()
if(ASSIMP_BUILD_DRACO_STATIC)
set(ASSIMP_BUILD_DRACO ON)
endif()
# Draco requires cmake 3.12 # Draco requires cmake 3.12
IF (DEFINED CMAKE_VERSION AND "${CMAKE_VERSION}" VERSION_LESS "3.12") IF (DEFINED CMAKE_VERSION AND "${CMAKE_VERSION}" VERSION_LESS "3.12")
message(NOTICE "draco requires cmake 3.12 or newer, cmake is ${CMAKE_VERSION} . Draco is disabled") message(NOTICE "draco requires cmake 3.12 or newer, cmake is ${CMAKE_VERSION} . Draco is disabled")
@ -588,7 +659,7 @@ ELSE()
IF ( ASSIMP_BUILD_DRACO ) IF ( ASSIMP_BUILD_DRACO )
# Primarily for glTF v2 # Primarily for glTF v2
# Enable Draco glTF feature set # 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 # Disable unnecessary or omitted components
set(DRACO_JS_GLUE OFF CACHE BOOL "" FORCE) set(DRACO_JS_GLUE OFF CACHE BOOL "" FORCE)
set(DRACO_WASM OFF CACHE BOOL "" FORCE) set(DRACO_WASM OFF CACHE BOOL "" FORCE)
@ -614,22 +685,29 @@ ELSE()
"-Wno-sign-compare" "-Wno-sign-compare"
"-Wno-unused-local-typedefs" "-Wno-unused-local-typedefs"
) )
if(NOT ASSIMP_BUILD_DRACO_STATIC)
# Draco 1.4.1 does not explicitly export any symbols under GCC/clang # Draco 1.4.1 does not explicitly export any symbols under GCC/clang
list(APPEND DRACO_CXX_FLAGS list(APPEND DRACO_CXX_FLAGS
"-fvisibility=default" "-fvisibility=default"
) )
endif()
ENDIF() ENDIF()
# Don't build or install all of Draco by default # Don't build or install all of Draco by default
ADD_SUBDIRECTORY( "contrib/draco" EXCLUDE_FROM_ALL ) 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) if(MSVC OR WIN32)
set(draco_LIBRARIES "draco") set(draco_LIBRARIES "draco")
else() else()
if(BUILD_SHARED_LIBS) if(ASSIMP_BUILD_DRACO_STATIC)
set(draco_LIBRARIES "draco_shared")
else()
set(draco_LIBRARIES "draco_static") set(draco_LIBRARIES "draco_static")
else()
set(draco_LIBRARIES "draco_shared")
endif() endif()
endif() endif()
@ -652,6 +730,7 @@ ELSE()
set(draco_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/draco/src") set(draco_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/draco/src")
# This is probably wrong # This is probably wrong
if (ASSIMP_INSTALL)
INSTALL( TARGETS ${draco_LIBRARIES} INSTALL( TARGETS ${draco_LIBRARIES}
EXPORT "${TARGETS_EXPORT_NAME}" EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
@ -661,20 +740,24 @@ ELSE()
COMPONENT ${LIBASSIMP_COMPONENT} COMPONENT ${LIBASSIMP_COMPONENT}
INCLUDES DESTINATION include INCLUDES DESTINATION include
) )
endif()
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
# Main assimp code # Main assimp code
ADD_SUBDIRECTORY( code/ ) ADD_SUBDIRECTORY( code/ )
IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
# The viewer for windows only # The viewer for windows only
IF ( WIN32 ) IF (WIN32)
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" OFF ) FIND_PACKAGE(DirectX)
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
IF ( ASSIMP_BUILD_ASSIMP_VIEW ) IF ( ASSIMP_BUILD_ASSIMP_VIEW )
ADD_SUBDIRECTORY( tools/assimp_view/ ) ADD_SUBDIRECTORY( tools/assimp_view/ )
ENDIF () ENDIF ()
ELSE()
MESSAGE("Building Assimp Viewer only supported on Windows.")
ENDIF () ENDIF ()
# The command line tool # The command line tool
ADD_SUBDIRECTORY( tools/assimp_cmd/ ) ADD_SUBDIRECTORY( tools/assimp_cmd/ )
@ -694,12 +777,22 @@ IF ( ASSIMP_BUILD_TESTS )
ADD_SUBDIRECTORY( test/ ) ADD_SUBDIRECTORY( test/ )
ENDIF () ENDIF ()
# Generate a pkg-config .pc for the Assimp library. # Generate a pkg-config .pc, revision.h, and config.h for the Assimp library.
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY ) CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
IF ( ASSIMP_INSTALL ) IF ( ASSIMP_INSTALL )
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT}) INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
ENDIF() ENDIF()
CONFIGURE_FILE(
${CMAKE_CURRENT_LIST_DIR}/include/assimp/revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/revision.h
)
CONFIGURE_FILE(
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
)
IF ( ASSIMP_INSTALL ) IF ( ASSIMP_INSTALL )
IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES) IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
# Packing information # Packing information
@ -733,7 +826,7 @@ IF ( ASSIMP_INSTALL )
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" ) SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS) SET(CPACK_DEBIAN_PACKAGE_SUGGESTS)
SET(cPACK_DEBIAN_PACKAGE_NAME "assimp") SET(CPACK_DEBIAN_PACKAGE_NAME "assimp")
SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/gtest contrib/zlib workspaces test doc obj samples packaging) SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/gtest contrib/zlib workspaces test doc obj samples packaging)
SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force) SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
SET(CPACK_DEBIAN_CHANGELOG) SET(CPACK_DEBIAN_CHANGELOG)
@ -762,7 +855,7 @@ if(WIN32)
IF(MSVC_TOOLSET_VERSION) IF(MSVC_TOOLSET_VERSION)
SET(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}") SET(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
SET(ASSIMP_MSVC_VERSION ${MCVS_PREFIX}) SET(ASSIMP_MSVC_VERSION ${MSVC_PREFIX})
ELSE() ELSE()
IF(MSVC12) IF(MSVC12)
SET(ASSIMP_MSVC_VERSION "vc120") SET(ASSIMP_MSVC_VERSION "vc120")
@ -770,6 +863,10 @@ if(WIN32)
SET(ASSIMP_MSVC_VERSION "vc140") SET(ASSIMP_MSVC_VERSION "vc140")
ELSEIF(MSVC15) ELSEIF(MSVC15)
SET(ASSIMP_MSVC_VERSION "vc141") SET(ASSIMP_MSVC_VERSION "vc141")
ELSEIF(MSV142)
SET(ASSIMP_MSVC_VERSION "vc142")
ELSEIF(MSVC143)
SET(ASSIMP_MSVC_VERSION "vc143")
ENDIF() ENDIF()
ENDIF() ENDIF()

128
CODE_OF_CONDUCT.md 100644
View File

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,16 +1,12 @@
FROM ubuntu:14.04 FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install --no-install-recommends -y ninja-build \
git cmake build-essential software-properties-common git cmake build-essential software-properties-common
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update && apt-get install -y gcc-4.9 g++-4.9 && \ RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update
cd /usr/bin && \
rm gcc g++ cpp && \
ln -s gcc-4.9 gcc && \
ln -s g++-4.9 g++ && \
ln -s cpp-4.9 cpp
WORKDIR /opt WORKDIR /opt
RUN apt install zlib1g-dev
# Build Assimp # Build Assimp
RUN git clone https://github.com/assimp/assimp.git /opt/assimp RUN git clone https://github.com/assimp/assimp.git /opt/assimp
@ -19,7 +15,8 @@ WORKDIR /opt/assimp
RUN git checkout master \ RUN git checkout master \
&& mkdir build && cd build && \ && mkdir build && cd build && \
cmake \ cmake -G 'Ninja' \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DASSIMP_BUILD_ASSIMP_TOOLS=ON \
.. && \ .. && \
make && make install ninja -j4 && ninja install

View File

@ -14,4 +14,4 @@ https://assimp-docs.readthedocs.io/en/latest/
Building Assimp Building Assimp
------------------------------ ------------------------------
Just check the build-instaructions which you can find here: https://github.com/assimp/assimp/blob/master/Build.md Just check the build-instructions which you can find here: https://github.com/assimp/assimp/blob/master/Build.md

1
README
View File

@ -1 +0,0 @@
See Readme.md

View File

@ -1,40 +1,41 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
================================== ==================================
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
### Current project status ### ### Current project status ###
[![Financial Contributors on Open Collective](https://opencollective.com/assimp/all/badge.svg?label=financial+contributors)](https://opencollective.com/assimp) [![Financial Contributors on Open Collective](https://opencollective.com/assimp/all/badge.svg?label=financial+contributors)](https://opencollective.com/assimp)
![C/C++ CI](https://github.com/assimp/assimp/workflows/C/C++%20CI/badge.svg) ![C/C++ CI](https://github.com/assimp/assimp/workflows/C/C++%20CI/badge.svg)
<a href="https://scan.coverity.com/projects/5607">
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/5607/badge.svg"/>
</a>
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9973693b7bdd4543b07084d5d9cf4745)](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=assimp/assimp&amp;utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/9973693b7bdd4543b07084d5d9cf4745)](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=assimp/assimp&amp;utm_campaign=Badge_Grade)
[![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master)
[![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![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)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue") [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
[![Total alerts](https://img.shields.io/lgtm/alerts/g/assimp/assimp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/assimp/assimp/alerts/) [![Percentage of issues still open](http://isitmaintained.com/badge/open/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Percentage of issues still open")
<br> <br>
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS. APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more. Additionally, assimp features various __mesh post-processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
### Latest Doc's ### ### Documentation ###
Please check the latest documents at [Asset-Importer-Lib-Doc](https://assimp-docs.readthedocs.io/en/latest/). Read [our latest documentation](https://assimp-docs.readthedocs.io/en/latest/).
### Get involved ### ### Pre-built binaries ###
This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases). Download binaries from [our Itchi Projectspace](https://kimkulling.itch.io/the-asset-importer-lib).
<br>
You find a bug in the docs? Use [Doc-Repo](https://github.com/assimp/assimp-docs).
<br>
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
If you want to check our Model-Database, use the following repo: https://github.com/assimp/assimp-mdb ### Test data ###
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)
#### Supported file formats #### #### Supported file formats ####
You can find the complete list of supported file-formats [here](https://github.com/assimp/assimp/blob/master/doc/Fileformats.md) See [the complete list of supported formats](https://github.com/assimp/assimp/blob/master/doc/Fileformats.md).
### Building ### ### Building ###
Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file. We are available in vcpkg, and our build system is CMake; if you used CMake before there is a good chance you know what to do. Start by reading [our build instructions](https://github.com/assimp/assimp/blob/master/Build.md). We are available in vcpkg, and our build system is CMake; if you used CMake before there is a good chance you know what to do.
### Ports ### ### Ports ###
* [Android](port/AndroidJNI/README.md) * [Android](port/AndroidJNI/README.md)
@ -51,36 +52,31 @@ Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file.
### Other tools ### ### Other tools ###
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities. [open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
[Assimp-Viewer](https://github.com/assimp/assimp_view) is an experimental implementation for an Asset-Viewer based on ImGUI and Assimp (experimental).
#### Repository structure #### #### Repository structure ####
Open Asset Import Library is implemented in C++. The directory structure looks like: Open Asset Import Library is implemented in C++. The directory structure looks like this:
/code Source code /code Source code
/contrib Third-party libraries /contrib Third-party libraries
/doc Documentation (doxysource and pre-compiled docs) /doc Documentation (doxysource and pre-compiled docs)
/fuzz Contains the test code for the Google Fuzzer project
/include Public header C and C++ header files /include Public header C and C++ header files
/scripts Scripts used to generate the loading code for some formats /scripts Scripts are used to generate the loading code for some formats
/port Ports to other languages and scripts to maintain those. /port Ports to other languages and scripts to maintain those.
/test Unit- and regression tests, test suite of models /test Unit- and regression tests, test suite of models
/tools Tools (old assimp viewer, command line `assimp`) /tools Tools (old assimp viewer, command line `assimp`)
/samples A small number of samples to illustrate possible /samples A small number of samples to illustrate possible use cases for Assimp
use cases for Assimp
The source code is organized in the following way: The source code is organized in the following way:
code/Common The base implementation for importers and the infrastructure code/Common The base implementation for importers and the infrastructure
code/CApi Special implementations which are only used for the C-API
code/Geometry A collection of geometry tools
code/Material The material system
code/PBR An exporter for physical-based models
code/PostProcessing The post-processing steps code/PostProcessing The post-processing steps
code/AssetLib/<FormatName> Implementation for import and export for the format code/AssetLib/<FormatName> Implementation for import and export of the format
### Where to get help ###
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
If the docs don't solve your problem, ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
And we also have a Gitter-channel:Gitter [![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>
### Contributing ### ### Contributing ###
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
@ -117,4 +113,4 @@ and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you ma
For the legal details, see the `LICENSE` file. For the legal details, see the `LICENSE` file.
### Why this name ### ### Why this name ###
Sorry, we're germans :-), no english native speakers ... Sorry, we're germans :-), no English native speakers ...

16
SECURITY.md 100644
View File

@ -0,0 +1,16 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.2.4 | :white_check_mark: |
## Reporting a Vulnerability
If you have found any security vulnerability you can contact us via
kim.kulling@googlemail.com

View File

@ -55,7 +55,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
endif(CMAKE_CL_64) endif(CMAKE_CL_64)
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXERR_LIBRARY NAMES DxErr DxErr9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})

View File

@ -54,7 +54,7 @@ macro(clear_if_changed TESTVAR)
set(${var} "NOTFOUND" CACHE STRING "x" FORCE) set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
endforeach(var) endforeach(var)
endif () endif ()
set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE) set(${TESTVAR}_INT_CHECK "${${TESTVAR}}" CACHE INTERNAL "x" FORCE)
endmacro(clear_if_changed) endmacro(clear_if_changed)
# Try to get some hints from pkg-config, if available # Try to get some hints from pkg-config, if available

View File

@ -22,38 +22,9 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # 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. # 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) 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 include(CMakeParseArguments) # cmake_parse_arguments
option(HUNTER_STATUS_PRINT "Print working status" ON) option(HUNTER_STATUS_PRINT "Print working status" ON)

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -52,9 +52,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cctype> #include <cctype>
#include <memory> #include <memory>
using namespace Assimp; namespace Assimp {
static const unsigned int NotSet = 0xcdcdcdcd; static constexpr unsigned int NotSet = 0xcdcdcdcd;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Setup final material indices, generae a default material if necessary // Setup final material indices, generae a default material if necessary
@ -68,7 +68,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
unsigned int idx(NotSet); unsigned int idx(NotSet);
for (unsigned int i = 0; i < mScene->mMaterials.size(); ++i) { for (unsigned int i = 0; i < mScene->mMaterials.size(); ++i) {
std::string s = mScene->mMaterials[i].mName; std::string s = mScene->mMaterials[i].mName;
for (char & it : s) { for (char &it : s) {
it = static_cast<char>(::tolower(static_cast<unsigned char>(it))); it = static_cast<char>(::tolower(static_cast<unsigned char>(it)));
} }
@ -262,6 +262,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
unsigned int iWire = 1; unsigned int iWire = 1;
mat.AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME); mat.AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME);
} }
[[fallthrough]];
case D3DS::Discreet3DS::Gouraud: case D3DS::Discreet3DS::Gouraud:
eShading = aiShadingMode_Gouraud; eShading = aiShadingMode_Gouraud;
@ -592,7 +593,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
// Cameras or lights define their transformation in their parent node and in the // Cameras or lights define their transformation in their parent node and in the
// corresponding light or camera chunks. However, we read and process the latter // corresponding light or camera chunks. However, we read and process the latter
// to to be able to return valid cameras/lights even if no scenegraph is given. // to be able to return valid cameras/lights even if no scenegraph is given.
for (unsigned int n = 0; n < pcSOut->mNumCameras; ++n) { for (unsigned int n = 0; n < pcSOut->mNumCameras; ++n) {
if (pcSOut->mCameras[n]->mName == pcOut->mName) { if (pcSOut->mCameras[n]->mName == pcOut->mName) {
pcSOut->mCameras[n]->mLookAt = aiVector3D(0.f, 0.f, 1.f); pcSOut->mCameras[n]->mLookAt = aiVector3D(0.f, 0.f, 1.f);
@ -642,11 +643,17 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
} }
// Allocate storage for children // 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()]; pcOut->mChildren = new aiNode *[pcIn->mChildren.size()];
// Recursively process all children // Recursively process all children
const unsigned int size = static_cast<unsigned int>(pcIn->mChildren.size());
for (unsigned int i = 0; i < size; ++i) { for (unsigned int i = 0; i < size; ++i) {
pcOut->mChildren[i] = new aiNode(); pcOut->mChildren[i] = new aiNode();
pcOut->mChildren[i]->mParent = pcOut; pcOut->mChildren[i]->mParent = pcOut;
@ -708,7 +715,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene *pcOut) {
pcNode->mNumMeshes = 1; pcNode->mNumMeshes = 1;
// Build a name for the node // 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 // Build dummy nodes for all cameras
@ -804,4 +811,6 @@ void Discreet3DSImporter::ConvertScene(aiScene *pcOut) {
} }
} }
} // namespace Assimp
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER #endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. 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/StringComparison.h>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/Exporter.hpp> #include <assimp/Exporter.hpp>
#include <assimp/Exceptional.h>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <memory> #include <memory>
@ -209,9 +210,7 @@ Discreet3DSExporter::Discreet3DSExporter(std::shared_ptr<IOStream> &outfile, con
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Discreet3DSExporter::~Discreet3DSExporter() { Discreet3DSExporter::~Discreet3DSExporter() = default;
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
int Discreet3DSExporter::WriteHierarchy(const aiNode &node, int seq, int sibling_level) { int Discreet3DSExporter::WriteHierarchy(const aiNode &node, int seq, int sibling_level) {

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -57,8 +56,7 @@ struct aiNode;
struct aiMaterial; struct aiMaterial;
struct aiMesh; struct aiMesh;
namespace Assimp namespace Assimp {
{
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
/** /**
@ -88,7 +86,7 @@ private:
std::map<const aiNode*, aiMatrix4x4> trafos; std::map<const aiNode*, aiMatrix4x4> trafos;
typedef std::multimap<const aiNode*, unsigned int> MeshesByNodeMap; using MeshesByNodeMap = std::multimap<const aiNode*, unsigned int>;
MeshesByNodeMap meshes; MeshesByNodeMap meshes;
}; };

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -322,7 +322,6 @@ struct Texture {
//! Default constructor //! Default constructor
Texture() AI_NO_EXCEPT Texture() AI_NO_EXCEPT
: mTextureBlend(0.0f), : mTextureBlend(0.0f),
mMapName(),
mOffsetU(0.0), mOffsetU(0.0),
mOffsetV(0.0), mOffsetV(0.0),
mScaleU(1.0), mScaleU(1.0),
@ -334,51 +333,11 @@ struct Texture {
mTextureBlend = get_qnan(); mTextureBlend = get_qnan();
} }
Texture(const Texture &other) : Texture(const Texture &other) = default;
mTextureBlend(other.mTextureBlend),
mMapName(other.mMapName),
mOffsetU(other.mOffsetU),
mOffsetV(other.mOffsetV),
mScaleU(other.mScaleU),
mScaleV(other.mScaleV),
mRotation(other.mRotation),
mMapMode(other.mMapMode),
bPrivate(other.bPrivate),
iUVSrc(other.iUVSrc) {
// empty
}
Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend), Texture(Texture &&other) AI_NO_EXCEPT = default;
mMapName(std::move(other.mMapName)),
mOffsetU(other.mOffsetU),
mOffsetV(other.mOffsetV),
mScaleU(other.mScaleU),
mScaleV(other.mScaleV),
mRotation(other.mRotation),
mMapMode(other.mMapMode),
bPrivate(other.bPrivate),
iUVSrc(other.iUVSrc) {
// empty
}
Texture &operator=(Texture &&other) AI_NO_EXCEPT { Texture &operator=(Texture &&other) AI_NO_EXCEPT = default;
if (this == &other) {
return *this;
}
mTextureBlend = other.mTextureBlend;
mMapName = std::move(other.mMapName);
mOffsetU = other.mOffsetU;
mOffsetV = other.mOffsetV;
mScaleU = other.mScaleU;
mScaleV = other.mScaleV;
mRotation = other.mRotation;
mMapMode = other.mMapMode;
bPrivate = other.bPrivate;
iUVSrc = other.iUVSrc;
return *this;
}
//! Specifies the blend factor for the texture //! Specifies the blend factor for the texture
ai_real mTextureBlend; ai_real mTextureBlend;
@ -406,14 +365,13 @@ struct Texture {
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#endif // _MSC_VER #endif // _MSC_VER
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Helper structure representing a 3ds material */ /** Helper structure representing a 3ds material */
struct Material { struct Material {
//! Default constructor has been deleted //! Default constructor has been deleted
Material() : Material() :
mName(), 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)), mSpecularExponent(ai_real(0.0)),
mShininessStrength(ai_real(1.0)), mShininessStrength(ai_real(1.0)),
mShading(Discreet3DS::Gouraud), mShading(Discreet3DS::Gouraud),
@ -426,7 +384,7 @@ struct Material {
//! Constructor with explicit name //! Constructor with explicit name
explicit Material(const std::string &name) : explicit Material(const std::string &name) :
mName(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)), mSpecularExponent(ai_real(0.0)),
mShininessStrength(ai_real(1.0)), mShininessStrength(ai_real(1.0)),
mShading(Discreet3DS::Gouraud), mShading(Discreet3DS::Gouraud),
@ -436,83 +394,9 @@ struct Material {
// empty // empty
} }
Material(const Material &other) : Material(const Material &other) = default;
mName(other.mName),
mDiffuse(other.mDiffuse),
mSpecularExponent(other.mSpecularExponent),
mShininessStrength(other.mShininessStrength),
mSpecular(other.mSpecular),
mAmbient(other.mAmbient),
mShading(other.mShading),
mTransparency(other.mTransparency),
sTexDiffuse(other.sTexDiffuse),
sTexOpacity(other.sTexOpacity),
sTexSpecular(other.sTexSpecular),
sTexReflective(other.sTexReflective),
sTexBump(other.sTexBump),
sTexEmissive(other.sTexEmissive),
sTexShininess(other.sTexShininess),
mBumpHeight(other.mBumpHeight),
mEmissive(other.mEmissive),
sTexAmbient(other.sTexAmbient),
mTwoSided(other.mTwoSided) {
// empty
}
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it virtual ~Material() = default;
Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)),
mDiffuse(other.mDiffuse),
mSpecularExponent(other.mSpecularExponent),
mShininessStrength(other.mShininessStrength),
mSpecular(other.mSpecular),
mAmbient(other.mAmbient),
mShading(other.mShading),
mTransparency(other.mTransparency),
sTexDiffuse(std::move(other.sTexDiffuse)),
sTexOpacity(std::move(other.sTexOpacity)),
sTexSpecular(std::move(other.sTexSpecular)),
sTexReflective(std::move(other.sTexReflective)),
sTexBump(std::move(other.sTexBump)),
sTexEmissive(std::move(other.sTexEmissive)),
sTexShininess(std::move(other.sTexShininess)),
mBumpHeight(other.mBumpHeight),
mEmissive(other.mEmissive),
sTexAmbient(std::move(other.sTexAmbient)),
mTwoSided(other.mTwoSided) {
// empty
}
Material &operator=(Material &&other) AI_NO_EXCEPT {
if (this == &other) {
return *this;
}
mName = std::move(other.mName);
mDiffuse = other.mDiffuse;
mSpecularExponent = other.mSpecularExponent;
mShininessStrength = other.mShininessStrength,
mSpecular = other.mSpecular;
mAmbient = other.mAmbient;
mShading = other.mShading;
mTransparency = other.mTransparency;
sTexDiffuse = std::move(other.sTexDiffuse);
sTexOpacity = std::move(other.sTexOpacity);
sTexSpecular = std::move(other.sTexSpecular);
sTexReflective = std::move(other.sTexReflective);
sTexBump = std::move(other.sTexBump);
sTexEmissive = std::move(other.sTexEmissive);
sTexShininess = std::move(other.sTexShininess);
mBumpHeight = other.mBumpHeight;
mEmissive = other.mEmissive;
sTexAmbient = std::move(other.sTexAmbient);
mTwoSided = other.mTwoSided;
return *this;
}
virtual ~Material() {
// empty
}
//! Name of the material //! Name of the material
std::string mName; std::string mName;

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -54,9 +54,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
using namespace Assimp; namespace Assimp {
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"Discreet 3DS Importer", "Discreet 3DS Importer",
"", "",
"", "",
@ -103,28 +103,11 @@ Discreet3DSImporter::Discreet3DSImporter() :
// empty // empty
} }
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
Discreet3DSImporter::~Discreet3DSImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
std::string extension = GetExtension(pFile); static const uint16_t token[] = { 0x4d4d, 0x3dc2 /*, 0x3daa */ };
if (extension == "3ds" || extension == "prj") { return CheckMagicToken(pIOHandler, pFile, token, AI_COUNT_OF(token), 0, sizeof token[0]);
return true;
}
if (!extension.length() || checkSig) {
uint16_t token[3];
token[0] = 0x4d4d;
token[1] = 0x3dc2;
//token[2] = 0x3daa;
return CheckMagicToken(pIOHandler, pFile, token, 2, 0, 2);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -279,8 +262,15 @@ void Discreet3DSImporter::ParseMainChunk() {
}; };
ASSIMP_3DS_END_CHUNK(); ASSIMP_3DS_END_CHUNK();
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code-return"
#endif
// recursively continue processing this hierarchy level // recursively continue processing this hierarchy level
return ParseMainChunk(); return ParseMainChunk();
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -330,7 +320,7 @@ void Discreet3DSImporter::ParseObjectChunk() {
case Discreet3DS::CHUNK_MAT_MATERIAL: case Discreet3DS::CHUNK_MAT_MATERIAL:
// Add a new material to the list // Add a new material to the list
mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size())))); mScene->mMaterials.emplace_back(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size())));
ParseMaterialChunk(); ParseMaterialChunk();
break; break;
@ -375,13 +365,13 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
// IMPLEMENTATION NOTE; // IMPLEMENTATION NOTE;
// Cameras or lights define their transformation in their parent node and in the // Cameras or lights define their transformation in their parent node and in the
// corresponding light or camera chunks. However, we read and process the latter // corresponding light or camera chunks. However, we read and process the latter
// to to be able to return valid cameras/lights even if no scenegraph is given. // to be able to return valid cameras/lights even if no scenegraph is given.
// get chunk type // get chunk type
switch (chunk.Flag) { switch (chunk.Flag) {
case Discreet3DS::CHUNK_TRIMESH: { case Discreet3DS::CHUNK_TRIMESH: {
// this starts a new triangle mesh // this starts a new triangle mesh
mScene->mMeshes.push_back(D3DS::Mesh(std::string(name, num))); mScene->mMeshes.emplace_back(std::string(name, num));
// Read mesh chunks // Read mesh chunks
ParseMeshChunk(); ParseMeshChunk();
@ -1010,7 +1000,7 @@ void Discreet3DSImporter::ParseMeshChunk() {
mMesh.mFaces.reserve(num); mMesh.mFaces.reserve(num);
while (num-- > 0) { while (num-- > 0) {
// 3DS faces are ALWAYS triangles // 3DS faces are ALWAYS triangles
mMesh.mFaces.push_back(D3DS::Face()); mMesh.mFaces.emplace_back();
D3DS::Face &sFace = mMesh.mFaces.back(); D3DS::Face &sFace = mMesh.mFaces.back();
sFace.mIndices[0] = (uint16_t)stream->GetI2(); sFace.mIndices[0] = (uint16_t)stream->GetI2();
@ -1295,7 +1285,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
switch (chunk.Flag) { switch (chunk.Flag) {
case Discreet3DS::CHUNK_LINRGBF: case Discreet3DS::CHUNK_LINRGBF:
bGamma = true; bGamma = true;
// fallthrough
case Discreet3DS::CHUNK_RGBF: case Discreet3DS::CHUNK_RGBF:
if (sizeof(float) * 3 > diff) { if (sizeof(float) * 3 > diff) {
*out = clrError; *out = clrError;
@ -1308,6 +1298,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
case Discreet3DS::CHUNK_LINRGBB: case Discreet3DS::CHUNK_LINRGBB:
bGamma = true; bGamma = true;
// fallthrough
case Discreet3DS::CHUNK_RGBB: { case Discreet3DS::CHUNK_RGBB: {
if (sizeof(char) * 3 > diff) { if (sizeof(char) * 3 > diff) {
*out = clrError; *out = clrError;
@ -1344,4 +1335,6 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
(void)bGamma; (void)bGamma;
} }
} // namespace Assimp
#endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER #endif // !! ASSIMP_BUILD_NO_3DS_IMPORTER

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -59,7 +59,6 @@ struct aiNode;
namespace Assimp { namespace Assimp {
using namespace D3DS; using namespace D3DS;
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------
@ -68,7 +67,7 @@ using namespace D3DS;
class Discreet3DSImporter : public BaseImporter { class Discreet3DSImporter : public BaseImporter {
public: public:
Discreet3DSImporter(); Discreet3DSImporter();
~Discreet3DSImporter(); ~Discreet3DSImporter() override = default;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -57,6 +57,7 @@ enum class ResourceType {
RT_BaseMaterials, RT_BaseMaterials,
RT_EmbeddedTexture2D, RT_EmbeddedTexture2D,
RT_Texture2DGroup, RT_Texture2DGroup,
RT_ColorGroup,
RT_Unknown RT_Unknown
}; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...) }; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...)
@ -69,9 +70,7 @@ public:
// empty // empty
} }
virtual ~Resource() { virtual ~Resource() = default;
// empty
}
virtual ResourceType getType() const { virtual ResourceType getType() const {
return ResourceType::RT_Unknown; return ResourceType::RT_Unknown;
@ -95,7 +94,7 @@ public:
// empty // empty
} }
~EmbeddedTexture() = default; ~EmbeddedTexture() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_EmbeddedTexture2D; return ResourceType::RT_EmbeddedTexture2D;
@ -112,13 +111,28 @@ public:
// empty // empty
} }
~Texture2DGroup() = default; ~Texture2DGroup() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_Texture2DGroup; return ResourceType::RT_Texture2DGroup;
} }
}; };
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 { class BaseMaterials : public Resource {
public: public:
std::vector<unsigned int> mMaterialIndex; std::vector<unsigned int> mMaterialIndex;
@ -129,7 +143,7 @@ public:
// empty // empty
} }
~BaseMaterials() = default; ~BaseMaterials() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_BaseMaterials; return ResourceType::RT_BaseMaterials;
@ -154,7 +168,7 @@ public:
// empty // empty
} }
~Object() = default; ~Object() override = default;
ResourceType getType() const override { ResourceType getType() const override {
return ResourceType::RT_Object; return ResourceType::RT_Object;

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -74,6 +74,8 @@ namespace XmlTag {
const char* const pid = "pid"; const char* const pid = "pid";
const char* const pindex = "pindex"; const char* const pindex = "pindex";
const char* const p1 = "p1"; const char* const p1 = "p1";
const char *const p2 = "p2";
const char *const p3 = "p3";
const char* const name = "name"; const char* const name = "name";
const char* const type = "type"; const char* const type = "type";
const char* const build = "build"; const char* const build = "build";
@ -96,6 +98,11 @@ namespace XmlTag {
const char *const texture_cuurd_u = "u"; const char *const texture_cuurd_u = "u";
const char *const texture_cuurd_v = "v"; 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 // Meta info tags
const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml"; const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels"; const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -83,7 +83,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen
namespace D3MF { namespace D3MF {
D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) : D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) :
mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene), mModelOutput(), mRelOutput(), mContentOutput(), mBuildItems(), mRelations() { mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene) {
// empty // empty
} }
@ -249,10 +249,10 @@ void D3MFExporter::writeBaseMaterials() {
if (color.r <= 1 && color.g <= 1 && color.b <= 1 && color.a <= 1) { if (color.r <= 1 && color.g <= 1 && color.b <= 1 && color.a <= 1) {
hexDiffuseColor = ai_rgba2hex( hexDiffuseColor = ai_rgba2hex(
(int)((ai_real)color.r) * 255, (int)(((ai_real)color.r) * 255),
(int)((ai_real)color.g) * 255, (int)(((ai_real)color.g) * 255),
(int)((ai_real)color.b) * 255, (int)(((ai_real)color.b) * 255),
(int)((ai_real)color.a) * 255, (int)(((ai_real)color.a) * 255),
true); true);
} else { } else {

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -68,7 +68,7 @@ namespace Assimp {
using namespace D3MF; using namespace D3MF;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"3mf Importer", "3mf Importer",
"", "",
"", "",
@ -81,33 +81,17 @@ static const aiImporterDesc desc = {
"3mf" "3mf"
}; };
D3MFImporter::D3MFImporter() : bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool ) const {
BaseImporter() {
// empty
}
D3MFImporter::~D3MFImporter() {
// empty
}
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool checkSig) const {
const std::string extension(GetExtension(filename));
if (extension == desc.mFileExtensions) {
return true;
}
if (!extension.length() || checkSig) {
if (nullptr == pIOHandler) {
return false;
}
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
return false; return false;
} }
D3MFOpcPackage opcPackage(pIOHandler, filename); static const char *const ModelRef = "3D/3dmodel.model";
return opcPackage.validate(); ZipArchiveIOSystem archive(pIOHandler, filename);
if (!archive.Exists(ModelRef)) {
return false;
} }
return false; return true;
} }
void D3MFImporter::SetupProperties(const Importer*) { void D3MFImporter::SetupProperties(const Importer*) {

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -56,10 +56,10 @@ namespace Assimp {
class D3MFImporter : public BaseImporter { class D3MFImporter : public BaseImporter {
public: public:
/// @brief The default class constructor. /// @brief The default class constructor.
D3MFImporter(); D3MFImporter() = default;
/// @brief The class destructor. /// @brief The class destructor.
~D3MFImporter() override; ~D3MFImporter() override = default;
/// @brief Performs the data format detection. /// @brief Performs the data format detection.
/// @param pFile The filename to check. /// @param pFile The filename to check.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -68,7 +68,7 @@ using OpcPackageRelationshipPtr = std::shared_ptr<OpcPackageRelationship>;
class OpcPackageRelationshipReader { class OpcPackageRelationshipReader {
public: public:
OpcPackageRelationshipReader(XmlParser &parser) : OpcPackageRelationshipReader(XmlParser &parser) :
m_relationShips() { mRelations() {
XmlNode root = parser.getRootNode(); XmlNode root = parser.getRootNode();
ParseRootNode(root); ParseRootNode(root);
} }
@ -108,20 +108,20 @@ public:
relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string(); relPtr->type = currentNode.attribute(XmlTag::RELS_ATTRIB_TYPE).as_string();
relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string(); relPtr->target = currentNode.attribute(XmlTag::RELS_ATTRIB_TARGET).as_string();
if (validateRels(relPtr)) { if (validateRels(relPtr)) {
m_relationShips.push_back(relPtr); mRelations.push_back(relPtr);
} }
} }
} }
} }
std::vector<OpcPackageRelationshipPtr> m_relationShips; std::vector<OpcPackageRelationshipPtr> mRelations;
}; };
static bool IsEmbeddedTexture( const std::string &filename ) { static bool IsEmbeddedTexture( const std::string &filename ) {
const std::string extension = BaseImporter::GetExtension(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"); std::string::size_type pos = filename.find("thumbnail");
if (pos == std::string::npos) { if (pos != std::string::npos) {
return false; return false;
} }
return true; return true;
@ -214,11 +214,11 @@ std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
OpcPackageRelationshipReader reader(xmlParser); OpcPackageRelationshipReader reader(xmlParser);
auto itr = std::find_if(reader.m_relationShips.begin(), reader.m_relationShips.end(), [](const OpcPackageRelationshipPtr &rel) { auto itr = std::find_if(reader.mRelations.begin(), reader.mRelations.end(), [](const OpcPackageRelationshipPtr &rel) {
return rel->type == XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE; return rel->type == XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE;
}); });
if (itr == reader.m_relationShips.end()) { if (itr == reader.mRelations.end()) {
throw DeadlyImportError("Cannot find ", XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE); throw DeadlyImportError("Cannot find ", XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE);
} }

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -44,19 +44,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "3MFTypes.h" #include "3MFTypes.h"
#include <assimp/scene.h> #include <assimp/scene.h>
#include <utility>
namespace Assimp { namespace Assimp {
namespace D3MF { namespace D3MF {
static const int IdNotSet = -1; static constexpr int IdNotSet = -1;
namespace { namespace {
static const size_t ColRGBA_Len = 9; static constexpr size_t ColRGBA_Len = 9;
static const size_t ColRGB_Len = 7; static constexpr size_t ColRGB_Len = 7;
// format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1) // format of the color string: #RRGGBBAA or #RRGGBB (3MF Core chapter 5.1.1)
bool validateColorString(const char *color) { bool validateColorString(const std::string color) {
const size_t len = strlen(color); const size_t len = color.size();
if (ColRGBA_Len != len && ColRGB_Len != len) { if (ColRGBA_Len != len && ColRGB_Len != len) {
return false; return false;
} }
@ -64,7 +66,7 @@ bool validateColorString(const char *color) {
return true; return true;
} }
aiFace ReadTriangle(XmlNode &node) { aiFace ReadTriangle(XmlNode &node, int &texId0, int &texId1, int &texId2) {
aiFace face; aiFace face;
face.mNumIndices = 3; face.mNumIndices = 3;
@ -73,6 +75,11 @@ aiFace ReadTriangle(XmlNode &node) {
face.mIndices[1] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v2).as_string())); face.mIndices[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())); face.mIndices[2] = static_cast<unsigned int>(std::atoi(node.attribute(XmlTag::v3).as_string()));
texId0 = texId1 = texId2 = IdNotSet;
XmlParser::getIntAttribute(node, XmlTag::p1, texId0);
XmlParser::getIntAttribute(node, XmlTag::p2, texId1);
XmlParser::getIntAttribute(node, XmlTag::p3, texId2);
return face; return face;
} }
@ -106,7 +113,7 @@ bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &va
return false; return false;
} }
aiMatrix4x4 parseTransformMatrix(std::string matrixStr) { aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) {
// split the string // split the string
std::vector<float> numbers; std::vector<float> numbers;
std::string currentNumber; std::string currentNumber;
@ -150,8 +157,8 @@ aiMatrix4x4 parseTransformMatrix(std::string matrixStr) {
return transformMatrix; return transformMatrix;
} }
bool parseColor(const char *color, aiColor4D &diffuse) { bool parseColor(const std::string &color, aiColor4D &diffuse) {
if (nullptr == color) { if (color.empty()) {
return false; return false;
} }
@ -171,7 +178,7 @@ bool parseColor(const char *color, aiColor4D &diffuse) {
char b[3] = { color[5], color[6], '\0' }; char b[3] = { color[5], color[6], '\0' };
diffuse.b = static_cast<ai_real>(strtol(b, nullptr, 16)) / ai_real(255.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) { if (ColRGB_Len == len) {
return true; return true;
} }
@ -229,6 +236,8 @@ void XmlSerializer::ImportXml(aiScene *scene) {
ReadBaseMaterials(currentNode); ReadBaseMaterials(currentNode);
} else if (currentNodeName == XmlTag::meta) { } else if (currentNodeName == XmlTag::meta) {
ReadMetadata(currentNode); ReadMetadata(currentNode);
} else if (currentNodeName == XmlTag::colorgroup) {
ReadColorGroup(currentNode);
} }
} }
StoreMaterialsInScene(scene); StoreMaterialsInScene(scene);
@ -324,9 +333,49 @@ void XmlSerializer::ReadObject(XmlNode &node) {
if (hasPid) { if (hasPid) {
auto it = mResourcesDictionnary.find(pid); auto it = mResourcesDictionnary.find(pid);
if (hasPindex && it != mResourcesDictionnary.end() && it->second->getType() == ResourceType::RT_BaseMaterials) { if (hasPindex && it != mResourcesDictionnary.end()) {
if (it->second->getType() == ResourceType::RT_BaseMaterials) {
BaseMaterials *materials = static_cast<BaseMaterials *>(it->second); BaseMaterials *materials = static_cast<BaseMaterials *>(it->second);
mesh->mMaterialIndex = materials->mMaterialIndex[pindex]; mesh->mMaterialIndex = materials->mMaterialIndex[pindex];
} else if (it->second->getType() == ResourceType::RT_Texture2DGroup) {
Texture2DGroup *group = static_cast<Texture2DGroup *>(it->second);
if (mesh->mTextureCoords[0] == nullptr) {
mesh->mNumUVComponents[0] = 2;
for (unsigned int i = 1; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
mesh->mNumUVComponents[i] = 0;
}
const std::string name = ai_to_string(group->mTexId);
for (size_t i = 0; i < mMaterials.size(); ++i) {
if (name == mMaterials[i]->GetName().C_Str()) {
mesh->mMaterialIndex = static_cast<unsigned int>(i);
}
}
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
for (unsigned int vertex_idx = 0; vertex_idx < mesh->mNumVertices; vertex_idx++) {
mesh->mTextureCoords[0][vertex_idx] =
aiVector3D(group->mTex2dCoords[pindex].x, group->mTex2dCoords[pindex].y, 0.0f);
}
} else {
for (unsigned int vertex_idx = 0; vertex_idx < mesh->mNumVertices; vertex_idx++) {
if (mesh->mTextureCoords[0][vertex_idx].z < 0) {
// use default
mesh->mTextureCoords[0][vertex_idx] =
aiVector3D(group->mTex2dCoords[pindex].x, group->mTex2dCoords[pindex].y, 0.0f);
}
}
}
}else if (it->second->getType() == ResourceType::RT_ColorGroup) {
if (mesh->mColors[0] == nullptr) {
mesh->mColors[0] = new aiColor4D[mesh->mNumVertices];
ColorGroup *group = static_cast<ColorGroup *>(it->second);
for (unsigned int vertex_idx = 0; vertex_idx < mesh->mNumVertices; vertex_idx++) {
mesh->mColors[0][vertex_idx] = group->mColors[pindex];
}
}
}
} }
} }
@ -408,35 +457,81 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
for (XmlNode &currentNode : node.children()) { for (XmlNode &currentNode : node.children()) {
const std::string currentName = currentNode.name(); const std::string currentName = currentNode.name();
if (currentName == XmlTag::triangle) { if (currentName == XmlTag::triangle) {
int pid = IdNotSet, p1 = IdNotSet; int pid = IdNotSet;
bool hasPid = getNodeAttribute(currentNode, D3MF::XmlTag::pid, pid); bool hasPid = getNodeAttribute(currentNode, D3MF::XmlTag::pid, pid);
bool hasP1 = getNodeAttribute(currentNode, D3MF::XmlTag::p1, p1);
if (hasPid && hasP1) { int pindex[3];
aiFace face = ReadTriangle(currentNode, pindex[0], pindex[1], pindex[2]);
if (hasPid && (pindex[0] != IdNotSet || pindex[1] != IdNotSet || pindex[2] != IdNotSet)) {
auto it = mResourcesDictionnary.find(pid); auto it = mResourcesDictionnary.find(pid);
if (it != mResourcesDictionnary.end()) { if (it != mResourcesDictionnary.end()) {
if (it->second->getType() == ResourceType::RT_BaseMaterials) { if (it->second->getType() == ResourceType::RT_BaseMaterials) {
BaseMaterials *baseMaterials = static_cast<BaseMaterials *>(it->second); 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) { } 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) { if (mesh->mTextureCoords[0] == nullptr) {
Texture2DGroup *group = static_cast<Texture2DGroup *>(it->second); mesh->mNumUVComponents[0] = 2;
for (unsigned int i = 1; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
mesh->mNumUVComponents[i] = 0;
}
const std::string name = ai_to_string(group->mTexId); const std::string name = ai_to_string(group->mTexId);
for (size_t i = 0; i < mMaterials.size(); ++i) { for (size_t i = 0; i < mMaterials.size(); ++i) {
if (name == mMaterials[i]->GetName().C_Str()) { if (name == mMaterials[i]->GetName().C_Str()) {
mesh->mMaterialIndex = static_cast<unsigned int>(i); mesh->mMaterialIndex = static_cast<unsigned int>(i);
} }
} }
mesh->mTextureCoords[0] = new aiVector3D[group->mTex2dCoords.size()]; mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
for (unsigned int i = 0; i < group->mTex2dCoords.size(); ++i) { for (unsigned int vertex_index = 0; vertex_index < mesh->mNumVertices; vertex_index++) {
mesh->mTextureCoords[0][i] = aiVector3D(group->mTex2dCoords[i].x, group->mTex2dCoords[i].y, 0); mesh->mTextureCoords[0][vertex_index].z = IdNotSet;//mark not set
} }
} }
auto update_texture = [&](int idx) {
if (pindex[idx] != IdNotSet) {
size_t vertex_index = face.mIndices[idx];
mesh->mTextureCoords[0][vertex_index] =
aiVector3D(group->mTex2dCoords[pindex[idx]].x, group->mTex2dCoords[pindex[idx]].y, 0.0f);
}
};
update_texture(0);
update_texture(1);
update_texture(2);
} else if (it->second->getType() == ResourceType::RT_ColorGroup) {
// Load vertex color into mesh, when any
ColorGroup *group = static_cast<ColorGroup *>(it->second);
if (mesh->mColors[0] == nullptr) {
mesh->mColors[0] = new aiColor4D[mesh->mNumVertices];
}
auto update_color = [&](int idx) {
if (pindex[idx] != IdNotSet) {
size_t vertex_index = face.mIndices[idx];
mesh->mColors[0][vertex_index] = group->mColors[pindex[idx]];
}
};
update_color(0);
update_color(1);
update_color(2);
} }
} }
} }
aiFace face = ReadTriangle(currentNode);
faces.push_back(face); faces.push_back(face);
} }
} }
@ -563,7 +658,7 @@ aiMaterial *XmlSerializer::readMaterialDef(XmlNode &node, unsigned int basemater
stdMaterialName += strId; stdMaterialName += strId;
stdMaterialName += "_"; stdMaterialName += "_";
if (hasName) { if (hasName) {
stdMaterialName += std::string(name); stdMaterialName += name;
} else { } else {
stdMaterialName += "basemat_"; stdMaterialName += "basemat_";
stdMaterialName += ai_to_string(mMaterials.size()); stdMaterialName += ai_to_string(mMaterials.size());
@ -577,12 +672,48 @@ aiMaterial *XmlSerializer::readMaterialDef(XmlNode &node, unsigned int basemater
return material; 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) { void XmlSerializer::StoreMaterialsInScene(aiScene *scene) {
if (nullptr == scene || mMaterials.empty()) { if (nullptr == scene) {
return; return;
} }
scene->mNumMaterials = static_cast<unsigned int>(mMaterials.size()); scene->mNumMaterials = static_cast<unsigned int>(mMaterials.size());
if (scene->mNumMaterials == 0) {
return;
}
scene->mMaterials = new aiMaterial *[scene->mNumMaterials]; scene->mMaterials = new aiMaterial *[scene->mNumMaterials];
for (size_t i = 0; i < mMaterials.size(); ++i) { for (size_t i = 0; i < mMaterials.size(); ++i) {
scene->mMaterials[i] = mMaterials[i]; scene->mMaterials[i] = mMaterials[i];

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -57,6 +57,7 @@ class D3MFOpcPackage;
class Object; class Object;
class Texture2DGroup; class Texture2DGroup;
class EmbeddedTexture; class EmbeddedTexture;
class ColorGroup;
class XmlSerializer { class XmlSerializer {
public: public:
@ -78,6 +79,8 @@ private:
void ReadTextureGroup(XmlNode &node); void ReadTextureGroup(XmlNode &node);
aiMaterial *readMaterialDef(XmlNode &node, unsigned int basematerialsId); aiMaterial *readMaterialDef(XmlNode &node, unsigned int basematerialsId);
void StoreMaterialsInScene(aiScene *scene); void StoreMaterialsInScene(aiScene *scene);
void ReadColorGroup(XmlNode &node);
void ReadColor(XmlNode &node, ColorGroup *colorGroup);
private: private:
struct MetaEntry { struct MetaEntry {

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -60,9 +60,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
#include <memory> #include <memory>
using namespace Assimp; namespace Assimp {
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"AC3D Importer", "AC3D Importer",
"", "",
"", "",
@ -77,8 +77,8 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// skip to the next token // skip to the next token
inline const char *AcSkipToNextToken(const char *buffer) { inline const char *AcSkipToNextToken(const char *buffer, const char *end) {
if (!SkipSpaces(&buffer)) { if (!SkipSpaces(&buffer, end)) {
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL");
} }
return buffer; return buffer;
@ -86,13 +86,13 @@ inline const char *AcSkipToNextToken(const char *buffer) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// read a string (may be enclosed in double quotation marks). buffer must point to " // read a string (may be enclosed in double quotation marks). buffer must point to "
inline const char *AcGetString(const char *buffer, std::string &out) { inline const char *AcGetString(const char *buffer, const char *end, std::string &out) {
if (*buffer == '\0') { if (*buffer == '\0') {
throw DeadlyImportError("AC3D: Unexpected EOF in string"); throw DeadlyImportError("AC3D: Unexpected EOF in string");
} }
++buffer; ++buffer;
const char *sz = buffer; const char *sz = buffer;
while ('\"' != *buffer) { while ('\"' != *buffer && buffer != end) {
if (IsLineEnd(*buffer)) { if (IsLineEnd(*buffer)) {
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL in string"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL in string");
out = "ERROR"; out = "ERROR";
@ -112,8 +112,8 @@ inline const char *AcGetString(const char *buffer, std::string &out) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// read 1 to n floats prefixed with an optional predefined identifier // read 1 to n floats prefixed with an optional predefined identifier
template <class T> template <class T>
inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *name, size_t name_length, size_t num, T *out) { inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *end, const char *name, size_t name_length, size_t num, T *out) {
buffer = AcSkipToNextToken(buffer); buffer = AcSkipToNextToken(buffer, end);
if (0 != name_length) { if (0 != name_length) {
if (0 != strncmp(buffer, name, name_length) || !IsSpace(buffer[name_length])) { if (0 != strncmp(buffer, name, name_length) || !IsSpace(buffer[name_length])) {
ASSIMP_LOG_ERROR("AC3D: Unexpected token. ", name, " was expected."); ASSIMP_LOG_ERROR("AC3D: Unexpected token. ", name, " was expected.");
@ -122,7 +122,7 @@ inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *name
buffer += name_length + 1; buffer += name_length + 1;
} }
for (unsigned int _i = 0; _i < num; ++_i) { for (unsigned int _i = 0; _i < num; ++_i) {
buffer = AcSkipToNextToken(buffer); buffer = AcSkipToNextToken(buffer, end);
buffer = fast_atoreal_move<float>(buffer, ((float *)out)[_i]); buffer = fast_atoreal_move<float>(buffer, ((float *)out)[_i]);
} }
@ -132,7 +132,7 @@ inline const char *TAcCheckedLoadFloatArray(const char *buffer, const char *name
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
AC3DImporter::AC3DImporter() : AC3DImporter::AC3DImporter() :
buffer(), mBuffer(),
configSplitBFCull(), configSplitBFCull(),
configEvalSubdivision(), configEvalSubdivision(),
mNumMeshes(), mNumMeshes(),
@ -146,24 +146,13 @@ AC3DImporter::AC3DImporter() :
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
AC3DImporter::~AC3DImporter() { AC3DImporter::~AC3DImporter() = default;
// nothing to be done here
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool AC3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { bool AC3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
std::string extension = GetExtension(pFile); static const uint32_t tokens[] = { AI_MAKE_MAGIC("AC3D") };
return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
// fixme: are acc and ac3d *really* used? Some sources say they are
if (extension == "ac" || extension == "ac3d" || extension == "acc") {
return true;
}
if (!extension.length() || checkSig) {
uint32_t token = AI_MAKE_MAGIC("AC3D");
return CheckMagicToken(pIOHandler, pFile, &token, 1, 0);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -175,25 +164,25 @@ const aiImporterDesc *AC3DImporter::GetInfo() const {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Get a pointer to the next line from the file // Get a pointer to the next line from the file
bool AC3DImporter::GetNextLine() { bool AC3DImporter::GetNextLine() {
SkipLine(&buffer); SkipLine(&mBuffer.data, mBuffer.end);
return SkipSpaces(&buffer); return SkipSpaces(&mBuffer.data, mBuffer.end);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Parse an object section in an AC file // Parse an object section in an AC file
void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) { bool AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
if (!TokenMatch(buffer, "OBJECT", 6)) if (!TokenMatch(mBuffer.data, "OBJECT", 6))
return; return false;
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
++mNumMeshes; ++mNumMeshes;
objects.push_back(Object()); objects.emplace_back();
Object &obj = objects.back(); Object &obj = objects.back();
aiLight *light = nullptr; aiLight *light = nullptr;
if (!ASSIMP_strincmp(buffer, "light", 5)) { if (!ASSIMP_strincmp(mBuffer.data, "light", 5)) {
// This is a light source. Add it to the list // This is a light source. Add it to the list
mLights->push_back(light = new aiLight()); mLights->push_back(light = new aiLight());
@ -204,65 +193,71 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
// Generate a default name for both the light source and the node // 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. // 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); obj.name = std::string(light->mName.data);
ASSIMP_LOG_VERBOSE_DEBUG("AC3D: Light source encountered"); ASSIMP_LOG_VERBOSE_DEBUG("AC3D: Light source encountered");
obj.type = Object::Light; obj.type = Object::Light;
} else if (!ASSIMP_strincmp(buffer, "group", 5)) { } else if (!ASSIMP_strincmp(mBuffer.data, "group", 5)) {
obj.type = Object::Group; obj.type = Object::Group;
} else if (!ASSIMP_strincmp(buffer, "world", 5)) { } else if (!ASSIMP_strincmp(mBuffer.data, "world", 5)) {
obj.type = Object::World; obj.type = Object::World;
} else } else
obj.type = Object::Poly; obj.type = Object::Poly;
while (GetNextLine()) { while (GetNextLine()) {
if (TokenMatch(buffer, "kids", 4)) { if (TokenMatch(mBuffer.data, "kids", 4)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
unsigned int num = strtoul10(buffer, &buffer); unsigned int num = strtoul10(mBuffer.data, &mBuffer.data);
GetNextLine(); GetNextLine();
if (num) { if (num) {
// load the children of this object recursively // load the children of this object recursively
obj.children.reserve(num); obj.children.reserve(num);
for (unsigned int i = 0; i < num; ++i) for (unsigned int i = 0; i < num; ++i) {
LoadObjectSection(obj.children); if (!LoadObjectSection(obj.children)) {
ASSIMP_LOG_WARN("AC3D: wrong number of kids");
break;
} }
return; }
} else if (TokenMatch(buffer, "name", 4)) { }
SkipSpaces(&buffer); return true;
buffer = AcGetString(buffer, obj.name); } else if (TokenMatch(mBuffer.data, "name", 4)) {
SkipSpaces(&mBuffer.data, mBuffer.data);
mBuffer.data = AcGetString(mBuffer.data, mBuffer.end, obj.name);
// If this is a light source, we'll also need to store // If this is a light source, we'll also need to store
// the name of the node in it. // the name of the node in it.
if (light) { if (light) {
light->mName.Set(obj.name); light->mName.Set(obj.name);
} }
} else if (TokenMatch(buffer, "texture", 7)) { } else if (TokenMatch(mBuffer.data, "texture", 7)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
buffer = AcGetString(buffer, obj.texture); std::string texture;
} else if (TokenMatch(buffer, "texrep", 6)) { mBuffer.data = AcGetString(mBuffer.data, mBuffer.end, texture);
SkipSpaces(&buffer); obj.textures.push_back(texture);
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &obj.texRepeat); } else if (TokenMatch(mBuffer.data, "texrep", 6)) {
SkipSpaces(&mBuffer.data, mBuffer.end);
mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 2, &obj.texRepeat);
if (!obj.texRepeat.x || !obj.texRepeat.y) if (!obj.texRepeat.x || !obj.texRepeat.y)
obj.texRepeat = aiVector2D(1.f, 1.f); obj.texRepeat = aiVector2D(1.f, 1.f);
} else if (TokenMatch(buffer, "texoff", 6)) { } else if (TokenMatch(mBuffer.data, "texoff", 6)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &obj.texOffset); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 2, &obj.texOffset);
} else if (TokenMatch(buffer, "rot", 3)) { } else if (TokenMatch(mBuffer.data, "rot", 3)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 9, &obj.rotation); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 9, &obj.rotation);
} else if (TokenMatch(buffer, "loc", 3)) { } else if (TokenMatch(mBuffer.data, "loc", 3)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 3, &obj.translation); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 3, &obj.translation);
} else if (TokenMatch(buffer, "subdiv", 6)) { } else if (TokenMatch(mBuffer.data, "subdiv", 6)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
obj.subDiv = strtoul10(buffer, &buffer); obj.subDiv = strtoul10(mBuffer.data, &mBuffer.data);
} else if (TokenMatch(buffer, "crease", 6)) { } else if (TokenMatch(mBuffer.data, "crease", 6)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
obj.crease = fast_atof(buffer); obj.crease = fast_atof(mBuffer.data);
} else if (TokenMatch(buffer, "numvert", 7)) { } else if (TokenMatch(mBuffer.data, "numvert", 7)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
unsigned int t = strtoul10(buffer, &buffer); unsigned int t = strtoul10(mBuffer.data, &mBuffer.data);
if (t >= AI_MAX_ALLOC(aiVector3D)) { if (t >= AI_MAX_ALLOC(aiVector3D)) {
throw DeadlyImportError("AC3D: Too many vertices, would run out of memory"); throw DeadlyImportError("AC3D: Too many vertices, would run out of memory");
} }
@ -271,59 +266,59 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
if (!GetNextLine()) { if (!GetNextLine()) {
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: not all vertices have been parsed yet"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: not all vertices have been parsed yet");
break; break;
} else if (!IsNumeric(*buffer)) { } else if (!IsNumeric(*mBuffer.data)) {
ASSIMP_LOG_ERROR("AC3D: Unexpected token: not all vertices have been parsed yet"); ASSIMP_LOG_ERROR("AC3D: Unexpected token: not all vertices have been parsed yet");
--buffer; // make sure the line is processed a second time --mBuffer.data; // make sure the line is processed a second time
break; break;
} }
obj.vertices.push_back(aiVector3D()); obj.vertices.emplace_back();
aiVector3D &v = obj.vertices.back(); aiVector3D &v = obj.vertices.back();
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 3, &v.x); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 3, &v.x);
} }
} else if (TokenMatch(buffer, "numsurf", 7)) { } else if (TokenMatch(mBuffer.data, "numsurf", 7)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
bool Q3DWorkAround = false; bool Q3DWorkAround = false;
const unsigned int t = strtoul10(buffer, &buffer); const unsigned int t = strtoul10(mBuffer.data, &mBuffer.data);
obj.surfaces.reserve(t); obj.surfaces.reserve(t);
for (unsigned int i = 0; i < t; ++i) { for (unsigned int i = 0; i < t; ++i) {
GetNextLine(); GetNextLine();
if (!TokenMatch(buffer, "SURF", 4)) { if (!TokenMatch(mBuffer.data, "SURF", 4)) {
// FIX: this can occur for some files - Quick 3D for // FIX: this can occur for some files - Quick 3D for
// example writes no surf chunks // example writes no surf chunks
if (!Q3DWorkAround) { if (!Q3DWorkAround) {
ASSIMP_LOG_WARN("AC3D: SURF token was expected"); ASSIMP_LOG_WARN("AC3D: SURF token was expected");
ASSIMP_LOG_VERBOSE_DEBUG("Continuing with Quick3D Workaround enabled"); ASSIMP_LOG_VERBOSE_DEBUG("Continuing with Quick3D Workaround enabled");
} }
--buffer; // make sure the line is processed a second time --mBuffer.data; // make sure the line is processed a second time
// break; --- see fix notes above // break; --- see fix notes above
Q3DWorkAround = true; Q3DWorkAround = true;
} }
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
obj.surfaces.push_back(Surface()); obj.surfaces.emplace_back();
Surface &surf = obj.surfaces.back(); Surface &surf = obj.surfaces.back();
surf.flags = strtoul_cppstyle(buffer); surf.flags = strtoul_cppstyle(mBuffer.data);
while (1) { while (true) {
if (!GetNextLine()) { if (!GetNextLine()) {
throw DeadlyImportError("AC3D: Unexpected EOF: surface is incomplete"); throw DeadlyImportError("AC3D: Unexpected EOF: surface is incomplete");
} }
if (TokenMatch(buffer, "mat", 3)) { if (TokenMatch(mBuffer.data, "mat", 3)) {
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
surf.mat = strtoul10(buffer); surf.mat = strtoul10(mBuffer.data);
} else if (TokenMatch(buffer, "refs", 4)) { } else if (TokenMatch(mBuffer.data, "refs", 4)) {
// --- see fix notes above // --- see fix notes above
if (Q3DWorkAround) { if (Q3DWorkAround) {
if (!surf.entries.empty()) { if (!surf.entries.empty()) {
buffer -= 6; mBuffer.data -= 6;
break; break;
} }
} }
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
const unsigned int m = strtoul10(buffer); const unsigned int m = strtoul10(mBuffer.data);
surf.entries.reserve(m); surf.entries.reserve(m);
obj.numRefs += m; obj.numRefs += m;
@ -333,15 +328,15 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: surface references are incomplete"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: surface references are incomplete");
break; break;
} }
surf.entries.push_back(Surface::SurfaceEntry()); surf.entries.emplace_back();
Surface::SurfaceEntry &entry = surf.entries.back(); Surface::SurfaceEntry &entry = surf.entries.back();
entry.first = strtoul10(buffer, &buffer); entry.first = strtoul10(mBuffer.data, &mBuffer.data);
SkipSpaces(&buffer); SkipSpaces(&mBuffer.data, mBuffer.end);
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &entry.second); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "", 0, 2, &entry.second);
} }
} else { } else {
--buffer; // make sure the line is processed a second time --mBuffer.data; // make sure the line is processed a second time
break; break;
} }
} }
@ -349,6 +344,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
} }
} }
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: \'kids\' line was expected"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: \'kids\' line was expected");
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -362,8 +358,8 @@ void AC3DImporter::ConvertMaterial(const Object &object,
s.Set(matSrc.name); s.Set(matSrc.name);
matDest.AddProperty(&s, AI_MATKEY_NAME); matDest.AddProperty(&s, AI_MATKEY_NAME);
} }
if (object.texture.length()) { if (!object.textures.empty()) {
s.Set(object.texture); s.Set(object.textures[0]);
matDest.AddProperty(&s, AI_MATKEY_TEXTURE_DIFFUSE(0)); matDest.AddProperty(&s, AI_MATKEY_TEXTURE_DIFFUSE(0));
// UV transformation // UV transformation
@ -454,7 +450,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
idx = 0; idx = 0;
} }
if ((*it).entries.empty()) { if ((*it).entries.empty()) {
ASSIMP_LOG_WARN("AC3D: surface her zero vertex references"); ASSIMP_LOG_WARN("AC3D: surface has zero vertex references");
} }
// validate all vertex indices to make sure we won't crash here // validate all vertex indices to make sure we won't crash here
@ -472,16 +468,15 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
} }
switch ((*it).GetType()) { switch ((*it).GetType()) {
// closed line case Surface::ClosedLine: // closed line
case Surface::ClosedLine: needMat[idx].first += static_cast<unsigned int>((*it).entries.size());
needMat[idx].first += (unsigned int)(*it).entries.size(); needMat[idx].second += static_cast<unsigned int>((*it).entries.size() << 1u);
needMat[idx].second += (unsigned int)(*it).entries.size() << 1u;
break; break;
// unclosed line // unclosed line
case Surface::OpenLine: case Surface::OpenLine:
needMat[idx].first += (unsigned int)(*it).entries.size() - 1; needMat[idx].first += static_cast<unsigned int>((*it).entries.size() - 1);
needMat[idx].second += ((unsigned int)(*it).entries.size() - 1) << 1u; needMat[idx].second += static_cast<unsigned int>(((*it).entries.size() - 1) << 1u);
break; break;
// triangle strip // triangle strip
@ -543,7 +538,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
// allocate UV coordinates, but only if the texture name for the // allocate UV coordinates, but only if the texture name for the
// surface is not empty // surface is not empty
aiVector3D *uv = nullptr; aiVector3D *uv = nullptr;
if (object.texture.length()) { if (!object.textures.empty()) {
uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
mesh->mNumUVComponents[0] = 2; mesh->mNumUVComponents[0] = 2;
} }
@ -583,15 +578,6 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
const Surface::SurfaceEntry &entry2 = src.entries[i + 1]; const Surface::SurfaceEntry &entry2 = src.entries[i + 1];
const Surface::SurfaceEntry &entry3 = src.entries[i + 2]; const Surface::SurfaceEntry &entry3 = src.entries[i + 2];
// skip degenerate triangles
if (object.vertices[entry1.first] == object.vertices[entry2.first] ||
object.vertices[entry1.first] == object.vertices[entry3.first] ||
object.vertices[entry2.first] == object.vertices[entry3.first]) {
mesh->mNumFaces--;
mesh->mNumVertices -= 3;
continue;
}
aiFace &face = *faces++; aiFace &face = *faces++;
face.mNumIndices = 3; face.mNumIndices = 3;
face.mIndices = new unsigned int[face.mNumIndices]; face.mIndices = new unsigned int[face.mNumIndices];
@ -710,18 +696,18 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
// generate a name depending on the type of the node // generate a name depending on the type of the node
switch (object.type) { switch (object.type) {
case Object::Group: 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; break;
case Object::Poly: 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; break;
case Object::Light: 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; break;
// there shouldn't be more than one world, but we don't care // there shouldn't be more than one world, but we don't care
case Object::World: 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; break;
} }
} }
@ -761,7 +747,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb")); std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file // Check whether we can read from the file
if (file.get() == nullptr) { if (file == nullptr) {
throw DeadlyImportError("Failed to open AC3D file ", pFile, "."); throw DeadlyImportError("Failed to open AC3D file ", pFile, ".");
} }
@ -769,17 +755,18 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
std::vector<char> mBuffer2; std::vector<char> mBuffer2;
TextFileToBuffer(file.get(), mBuffer2); TextFileToBuffer(file.get(), mBuffer2);
buffer = &mBuffer2[0]; mBuffer.data = &mBuffer2[0];
mBuffer.end = &mBuffer2[0] + mBuffer2.size();
mNumMeshes = 0; mNumMeshes = 0;
mLightsCounter = mPolysCounter = mWorldsCounter = mGroupsCounter = 0; mLightsCounter = mPolysCounter = mWorldsCounter = mGroupsCounter = 0;
if (::strncmp(buffer, "AC3D", 4)) { if (::strncmp(mBuffer.data, "AC3D", 4)) {
throw DeadlyImportError("AC3D: No valid AC3D file, magic sequence not found"); throw DeadlyImportError("AC3D: No valid AC3D file, magic sequence not found");
} }
// print the file format version to the console // print the file format version to the console
unsigned int version = HexDigitToDecimal(buffer[4]); unsigned int version = HexDigitToDecimal(mBuffer.data[4]);
char msg[3]; char msg[3];
ASSIMP_itoa10(msg, 3, version); ASSIMP_itoa10(msg, 3, version);
ASSIMP_LOG_INFO("AC3D file format version: ", msg); ASSIMP_LOG_INFO("AC3D file format version: ", msg);
@ -794,35 +781,36 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
mLights = &lights; mLights = &lights;
while (GetNextLine()) { while (GetNextLine()) {
if (TokenMatch(buffer, "MATERIAL", 8)) { if (TokenMatch(mBuffer.data, "MATERIAL", 8)) {
materials.push_back(Material()); materials.emplace_back();
Material &mat = materials.back(); Material &mat = materials.back();
// manually parse the material ... sscanf would use the buldin atof ... // manually parse the material ... sscanf would use the buldin atof ...
// Format: (name) rgb %f %f %f amb %f %f %f emis %f %f %f spec %f %f %f shi %d trans %f // Format: (name) rgb %f %f %f amb %f %f %f emis %f %f %f spec %f %f %f shi %d trans %f
buffer = AcSkipToNextToken(buffer); mBuffer.data = AcSkipToNextToken(mBuffer.data, mBuffer.end);
if ('\"' == *buffer) { if ('\"' == *mBuffer.data) {
buffer = AcGetString(buffer, mat.name); mBuffer.data = AcGetString(mBuffer.data, mBuffer.end, mat.name);
buffer = AcSkipToNextToken(buffer); mBuffer.data = AcSkipToNextToken(mBuffer.data, mBuffer.end);
} }
buffer = TAcCheckedLoadFloatArray(buffer, "rgb", 3, 3, &mat.rgb); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "rgb", 3, 3, &mat.rgb);
buffer = TAcCheckedLoadFloatArray(buffer, "amb", 3, 3, &mat.amb); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "amb", 3, 3, &mat.amb);
buffer = TAcCheckedLoadFloatArray(buffer, "emis", 4, 3, &mat.emis); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "emis", 4, 3, &mat.emis);
buffer = TAcCheckedLoadFloatArray(buffer, "spec", 4, 3, &mat.spec); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "spec", 4, 3, &mat.spec);
buffer = TAcCheckedLoadFloatArray(buffer, "shi", 3, 1, &mat.shin); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "shi", 3, 1, &mat.shin);
buffer = TAcCheckedLoadFloatArray(buffer, "trans", 5, 1, &mat.trans); mBuffer.data = TAcCheckedLoadFloatArray(mBuffer.data, mBuffer.end, "trans", 5, 1, &mat.trans);
} } else {
LoadObjectSection(rootObjects); LoadObjectSection(rootObjects);
} }
}
if (rootObjects.empty() || !mNumMeshes) { if (rootObjects.empty() || mNumMeshes == 0u) {
throw DeadlyImportError("AC3D: No meshes have been loaded"); throw DeadlyImportError("AC3D: No meshes have been loaded");
} }
if (materials.empty()) { if (materials.empty()) {
ASSIMP_LOG_WARN("AC3D: No material has been found"); ASSIMP_LOG_WARN("AC3D: No material has been found");
materials.push_back(Material()); materials.emplace_back();
} }
mNumMeshes += (mNumMeshes >> 2u) + 1; mNumMeshes += (mNumMeshes >> 2u) + 1;
@ -833,7 +821,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
materials.reserve(mNumMeshes); materials.reserve(mNumMeshes);
// generate a dummy root if there are multiple objects on the top layer // generate a dummy root if there are multiple objects on the top layer
Object *root; Object *root = nullptr;
if (1 == rootObjects.size()) if (1 == rootObjects.size())
root = &rootObjects[0]; root = &rootObjects[0];
else { else {
@ -846,7 +834,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
delete root; delete root;
} }
if (!::strncmp(pScene->mRootNode->mName.data, "Node", 4)) { if (::strncmp(pScene->mRootNode->mName.data, "Node", 4) == 0) {
pScene->mRootNode->mName.Set("<AC3DWorld>"); pScene->mRootNode->mName.Set("<AC3DWorld>");
} }
@ -865,10 +853,12 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
// copy lights // copy lights
pScene->mNumLights = (unsigned int)lights.size(); pScene->mNumLights = (unsigned int)lights.size();
if (lights.size()) { if (!lights.empty()) {
pScene->mLights = new aiLight *[lights.size()]; pScene->mLights = new aiLight *[lights.size()];
::memcpy(pScene->mLights, &lights[0], lights.size() * sizeof(void *)); ::memcpy(pScene->mLights, &lights[0], lights.size() * sizeof(void *));
} }
} }
} // namespace Assimp
#endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER #endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -125,7 +125,6 @@ public:
type(World), type(World),
name(), name(),
children(), children(),
texture(),
texRepeat(1.f, 1.f), texRepeat(1.f, 1.f),
texOffset(0.0f, 0.0f), texOffset(0.0f, 0.0f),
rotation(), rotation(),
@ -151,7 +150,8 @@ public:
std::vector<Object> children; std::vector<Object> children;
// texture to be assigned to all surfaces of the object // texture to be assigned to all surfaces of the object
std::string texture; // the .acc format supports up to 4 textures
std::vector<std::string> textures;
// texture repat factors (scaling for all coordinates) // texture repat factors (scaling for all coordinates)
aiVector2D texRepeat, texOffset; aiVector2D texRepeat, texOffset;
@ -216,7 +216,7 @@ private:
* load subobjects, the method returns after a 'kids 0' was * load subobjects, the method returns after a 'kids 0' was
* encountered. * encountered.
* @objects List of output objects*/ * @objects List of output objects*/
void LoadObjectSection(std::vector<Object> &objects); bool LoadObjectSection(std::vector<Object> &objects);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Convert all objects into meshes and nodes. /** Convert all objects into meshes and nodes.
@ -242,7 +242,7 @@ private:
private: private:
// points to the next data line // points to the next data line
const char *buffer; aiBuffer mBuffer;
// Configuration option: if enabled, up to two meshes // Configuration option: if enabled, up to two meshes
// are generated per material: those faces who have // are generated per material: those faces who have

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
const aiImporterDesc AMFImporter::Description = { static constexpr aiImporterDesc Description = {
"Additive manufacturing file format(AMF) Importer", "Additive manufacturing file format(AMF) Importer",
"smalcom", "smalcom",
"", "",
@ -83,11 +83,7 @@ void AMFImporter::Clear() {
AMFImporter::AMFImporter() AI_NO_EXCEPT : AMFImporter::AMFImporter() AI_NO_EXCEPT :
mNodeElement_Cur(nullptr), mNodeElement_Cur(nullptr),
mXmlParser(nullptr), mXmlParser(nullptr) {
mUnit(),
mVersion(),
mMaterial_Converted(),
mTexture_Converted() {
// empty // empty
} }
@ -182,28 +178,6 @@ bool AMFImporter::XML_SearchNode(const std::string &nodeName) {
return nullptr != mXmlParser->findNode(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) { static bool ParseHelper_Decode_Base64_IsBase64(const char pChar) {
return (isalnum((unsigned char)pChar) || (pChar == '+') || (pChar == '/')); return (isalnum((unsigned char)pChar) || (pChar == '+') || (pChar == '/'));
} }
@ -217,7 +191,10 @@ void AMFImporter::ParseHelper_Decode_Base64(const std::string &pInputBase64, std
uint8_t arr4[4], arr3[3]; uint8_t arr4[4], arr3[3];
// check input data // 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 // prepare output place
pOutputData.clear(); pOutputData.clear();
pOutputData.reserve(pInputBase64.size() / 4 * 3); pOutputData.reserve(pInputBase64.size() / 4 * 3);
@ -261,7 +238,7 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) {
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb")); std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file // Check whether we can read from the file
if (file.get() == nullptr) { if (file == nullptr) {
throw DeadlyImportError("Failed to open AMF file ", pFile, "."); throw DeadlyImportError("Failed to open AMF file ", pFile, ".");
} }
@ -407,17 +384,17 @@ void AMFImporter::ParseNode_Instance(XmlNode &node) {
for (auto &currentNode : node.children()) { for (auto &currentNode : node.children()) {
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "deltax") { if (currentName == "deltax") {
XmlParser::getValueAsFloat(currentNode, als.Delta.x); XmlParser::getValueAsReal(currentNode, als.Delta.x);
} else if (currentName == "deltay") { } else if (currentName == "deltay") {
XmlParser::getValueAsFloat(currentNode, als.Delta.y); XmlParser::getValueAsReal(currentNode, als.Delta.y);
} else if (currentName == "deltaz") { } else if (currentName == "deltaz") {
XmlParser::getValueAsFloat(currentNode, als.Delta.z); XmlParser::getValueAsReal(currentNode, als.Delta.z);
} else if (currentName == "rx") { } else if (currentName == "rx") {
XmlParser::getValueAsFloat(currentNode, als.Delta.x); XmlParser::getValueAsReal(currentNode, als.Delta.x);
} else if (currentName == "ry") { } else if (currentName == "ry") {
XmlParser::getValueAsFloat(currentNode, als.Delta.y); XmlParser::getValueAsReal(currentNode, als.Delta.y);
} else if (currentName == "rz") { } else if (currentName == "rz") {
XmlParser::getValueAsFloat(currentNode, als.Delta.z); XmlParser::getValueAsReal(currentNode, als.Delta.z);
} }
} }
ParseHelper_Node_Exit(); ParseHelper_Node_Exit();
@ -503,19 +480,9 @@ void AMFImporter::ParseNode_Metadata(XmlNode &node) {
mNodeElement_List.push_back(ne); // and to node element list because its a new object in graph. mNodeElement_List.push_back(ne); // and to node element list because its a new object in graph.
} }
bool AMFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const { bool AMFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*pCheckSig*/) const {
const std::string extension = GetExtension(pFile); static const char *tokens[] = { "<amf" };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
if (extension == "amf") {
return true;
}
if (extension.empty() || pCheckSig) {
static const char * const tokens[] = { "<amf" };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
}
return false;
} }
const aiImporterDesc *AMFImporter::GetInfo() const { const aiImporterDesc *AMFImporter::GetInfo() const {

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -98,8 +98,12 @@ namespace Assimp {
/// old - <map> and children <u1>, <u2>, <u3>, <v1>, <v2>, <v3> /// old - <map> and children <u1>, <u2>, <u3>, <v1>, <v2>, <v3>
/// ///
class AMFImporter : public BaseImporter { class AMFImporter : public BaseImporter {
private: using AMFMetaDataArray = std::vector<AMFMetadata *>;
struct SPP_Material; // forward declaration using MeshArray = std::vector<aiMesh *>;
using NodeArray = std::vector<aiNode *>;
public:
struct SPP_Material;
/// Data type for post-processing step. More suitable container for part of material's composition. /// Data type for post-processing step. More suitable container for part of material's composition.
struct SPP_Composite { struct SPP_Composite {
@ -107,22 +111,6 @@ private:
std::string Formula; ///< Formula for calculating ratio of \ref Material. std::string Formula; ///< Formula for calculating ratio of \ref Material.
}; };
/// \struct SPP_Material
/// Data type for post-processing step. More suitable container for material.
struct SPP_Material {
std::string ID; ///< Material ID.
std::list<AMFMetadata *> Metadata; ///< Metadata of material.
AMFColor *Color; ///< Color of material.
std::list<SPP_Composite> Composition; ///< List of child materials if current material is composition of few another.
/// Return color calculated for specified coordinate.
/// \param [in] pX - "x" coordinate.
/// \param [in] pY - "y" coordinate.
/// \param [in] pZ - "z" coordinate.
/// \return calculated color.
aiColor4D GetColor(const float pX, const float pY, const float pZ) const;
};
/// Data type for post-processing step. More suitable container for texture. /// Data type for post-processing step. More suitable container for texture.
struct SPP_Texture { struct SPP_Texture {
std::string ID; std::string ID;
@ -139,10 +127,51 @@ private:
const AMFTexMap *TexMap; ///< Face texture mapping data. Equal to nullptr if texture mapping is not set for the face. const AMFTexMap *TexMap; ///< Face texture mapping data. Equal to nullptr if texture mapping is not set for the face.
}; };
using AMFMetaDataArray = std::vector<AMFMetadata*>; /// Data type for post-processing step. More suitable container for material.
using MeshArray = std::vector<aiMesh*>; struct SPP_Material {
using NodeArray = std::vector<aiNode*>; std::string ID; ///< Material ID.
std::list<AMFMetadata *> Metadata; ///< Metadata of material.
AMFColor *Color; ///< Color of material.
std::list<SPP_Composite> Composition; ///< List of child materials if current material is composition of few another.
/// Return color calculated for specified coordinate.
/// \param [in] pX - "x" coordinate.
/// \param [in] pY - "y" coordinate.
/// \param [in] pZ - "z" coordinate.
/// \return calculated color.
aiColor4D GetColor(const float pX, const float pY, const float pZ) const;
};
/// Default constructor.
AMFImporter() AI_NO_EXCEPT;
/// Default destructor.
~AMFImporter() override;
/// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
/// Also exception can be thrown if trouble will found.
/// \param [in] pFile - name of file to be parsed.
/// \param [in] pIOHandler - pointer to IO helper object.
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
void ParseHelper_Node_Exit();
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const override;
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
const aiImporterDesc *GetInfo() const override;
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
AI_WONT_RETURN void Throw_CloseNotFound(const std::string &nodeName) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN void Throw_ID_NotFound(const std::string &pID) const AI_WONT_RETURN_SUFFIX;
void XML_CheckNode_MustHaveChildren(pugi::xml_node &node);
bool XML_SearchNode(const std::string &nodeName);
AMFImporter(const AMFImporter &pScene) = delete;
AMFImporter &operator=(const AMFImporter &pScene) = delete;
private:
/// Clear all temporary data. /// Clear all temporary data.
void Clear(); void Clear();
@ -262,40 +291,9 @@ private:
/// \param [in] pUseOldName - if true then use old name of node(and children) - <map>, instead of new name - <texmap>. /// \param [in] pUseOldName - if true then use old name of node(and children) - <map>, instead of new name - <texmap>.
void ParseNode_TexMap(XmlNode &node, const bool pUseOldName = false); void ParseNode_TexMap(XmlNode &node, const bool pUseOldName = false);
public:
/// Default constructor.
AMFImporter() AI_NO_EXCEPT;
/// Default destructor.
~AMFImporter() override;
/// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
/// Also exception can be thrown if trouble will found.
/// \param [in] pFile - name of file to be parsed.
/// \param [in] pIOHandler - pointer to IO helper object.
void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
void ParseHelper_Node_Enter(AMFNodeElementBase *child);
void ParseHelper_Node_Exit();
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const override;
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
const aiImporterDesc *GetInfo() const override;
bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;
void Throw_CloseNotFound(const std::string &nodeName);
void Throw_IncorrectAttr(const std::string &nodeName, const std::string &pAttrName);
void Throw_IncorrectAttrValue(const std::string &nodeName, const std::string &pAttrName);
void Throw_MoreThanOnceDefined(const std::string &nodeName, const std::string &pNodeType, const std::string &pDescription);
void Throw_ID_NotFound(const std::string &pID) const;
void XML_CheckNode_MustHaveChildren(pugi::xml_node &node);
bool XML_SearchNode(const std::string &nodeName);
void ParseHelper_FixTruncatedFloatString(const char *pInStr, std::string &pOutString);
AMFImporter(const AMFImporter &pScene) = delete;
AMFImporter &operator=(const AMFImporter &pScene) = delete;
private: private:
static const aiImporterDesc Description;
AMFNodeElementBase *mNodeElement_Cur; ///< Current element. AMFNodeElementBase *mNodeElement_Cur; ///< Current element.
std::list<AMFNodeElementBase *> mNodeElement_List; ///< All elements of scene graph. std::list<AMFNodeElementBase *> mNodeElement_List; ///< All elements of scene graph.
XmlParser *mXmlParser; XmlParser *mXmlParser;

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -167,11 +167,11 @@ void AMFImporter::ParseNode_Coordinates(XmlNode &node) {
AMFCoordinates &als = *((AMFCoordinates *)ne); // alias for convenience AMFCoordinates &als = *((AMFCoordinates *)ne); // alias for convenience
const std::string &currentName = ai_tolower(currentNode.name()); const std::string &currentName = ai_tolower(currentNode.name());
if (currentName == "x") { if (currentName == "x") {
XmlParser::getValueAsFloat(currentNode, als.Coordinate.x); XmlParser::getValueAsReal(currentNode, als.Coordinate.x);
} else if (currentName == "y") { } else if (currentName == "y") {
XmlParser::getValueAsFloat(currentNode, als.Coordinate.y); XmlParser::getValueAsReal(currentNode, als.Coordinate.y);
} else if (currentName == "z") { } else if (currentName == "z") {
XmlParser::getValueAsFloat(currentNode, als.Coordinate.z); XmlParser::getValueAsReal(currentNode, als.Coordinate.z);
} }
} }
ParseHelper_Node_Exit(); ParseHelper_Node_Exit();

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -263,26 +263,25 @@ void AMFImporter::ParseNode_TexMap(XmlNode &node, const bool pUseOldName) {
const std::string &name = currentNode.name(); const std::string &name = currentNode.name();
if (name == "utex1") { if (name == "utex1") {
read_flag[0] = true; read_flag[0] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[0].x); XmlParser::getValueAsReal(node, als.TextureCoordinate[0].x);
} else if (name == "utex2") { } else if (name == "utex2") {
read_flag[1] = true; read_flag[1] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[1].x); XmlParser::getValueAsReal(node, als.TextureCoordinate[1].x);
} else if (name == "utex3") { } else if (name == "utex3") {
read_flag[2] = true; read_flag[2] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[2].x); XmlParser::getValueAsReal(node, als.TextureCoordinate[2].x);
} else if (name == "vtex1") { } else if (name == "vtex1") {
read_flag[3] = true; read_flag[3] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[0].y); XmlParser::getValueAsReal(node, als.TextureCoordinate[0].y);
} else if (name == "vtex2") { } else if (name == "vtex2") {
read_flag[4] = true; read_flag[4] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[1].y); XmlParser::getValueAsReal(node, als.TextureCoordinate[1].y);
} else if (name == "vtex3") { } else if (name == "vtex3") {
read_flag[5] = true; read_flag[5] = true;
XmlParser::getValueAsFloat(node, als.TextureCoordinate[2].y); XmlParser::getValueAsReal(node, als.TextureCoordinate[2].y);
} }
} }
ParseHelper_Node_Exit(); ParseHelper_Node_Exit();
} else { } else {
for (pugi::xml_attribute &attr : node.attributes()) { for (pugi::xml_attribute &attr : node.attributes()) {
const std::string name = attr.name(); const std::string name = attr.name();

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -56,7 +56,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string> #include <string>
#include <vector> #include <vector>
/// \class CAMFImporter_NodeElement
/// Base class for elements of nodes. /// Base class for elements of nodes.
class AMFNodeElementBase { class AMFNodeElementBase {
public: public:
@ -88,9 +87,7 @@ public:
std::list<AMFNodeElementBase *> Child; ///< Child elements. std::list<AMFNodeElementBase *> Child; ///< Child elements.
public: /// Destructor, virtual.. public: /// Destructor, virtual..
virtual ~AMFNodeElementBase() { virtual ~AMFNodeElementBase() = default;
// empty
}
/// Disabled copy constructor and co. /// Disabled copy constructor and co.
AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete; AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete;
@ -103,12 +100,11 @@ protected:
/// \param [in] pType - element type. /// \param [in] pType - element type.
/// \param [in] pParent - parent element. /// \param [in] pParent - parent element.
AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) : AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) :
Type(pType), ID(), Parent(pParent), Child() { Type(pType), Parent(pParent) {
// empty // empty
} }
}; // class IAMFImporter_NodeElement }; // class IAMFImporter_NodeElement
/// \struct CAMFImporter_NodeElement_Constellation
/// A collection of objects or constellations with specific relative locations. /// A collection of objects or constellations with specific relative locations.
struct AMFConstellation : public AMFNodeElementBase { struct AMFConstellation : public AMFNodeElementBase {
/// Constructor. /// Constructor.
@ -118,7 +114,6 @@ struct AMFConstellation : public AMFNodeElementBase {
}; // struct CAMFImporter_NodeElement_Constellation }; // struct CAMFImporter_NodeElement_Constellation
/// \struct CAMFImporter_NodeElement_Instance
/// Part of constellation. /// Part of constellation.
struct AMFInstance : public AMFNodeElementBase { struct AMFInstance : public AMFNodeElementBase {
@ -137,7 +132,6 @@ struct AMFInstance : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Instance, pParent) {} AMFNodeElementBase(ENET_Instance, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Metadata
/// Structure that define metadata node. /// Structure that define metadata node.
struct AMFMetadata : public AMFNodeElementBase { struct AMFMetadata : public AMFNodeElementBase {
@ -150,7 +144,6 @@ struct AMFMetadata : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Metadata, pParent) {} AMFNodeElementBase(ENET_Metadata, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Root
/// Structure that define root node. /// Structure that define root node.
struct AMFRoot : public AMFNodeElementBase { struct AMFRoot : public AMFNodeElementBase {
@ -163,7 +156,6 @@ struct AMFRoot : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Root, pParent) {} AMFNodeElementBase(ENET_Root, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Color
/// Structure that define object node. /// Structure that define object node.
struct AMFColor : public AMFNodeElementBase { 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. bool Composed; ///< Type of color stored: if true then look for formula in \ref Color_Composed[4], else - in \ref Color.
@ -174,12 +166,11 @@ struct AMFColor : public AMFNodeElementBase {
/// @brief Constructor. /// @brief Constructor.
/// @param [in] pParent - pointer to parent node. /// @param [in] pParent - pointer to parent node.
AMFColor(AMFNodeElementBase *pParent) : AMFColor(AMFNodeElementBase *pParent) :
AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() { AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() {
// empty // empty
} }
}; };
/// \struct CAMFImporter_NodeElement_Material
/// Structure that define material node. /// Structure that define material node.
struct AMFMaterial : public AMFNodeElementBase { struct AMFMaterial : public AMFNodeElementBase {
@ -189,7 +180,6 @@ struct AMFMaterial : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Material, pParent) {} AMFNodeElementBase(ENET_Material, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Object
/// Structure that define object node. /// Structure that define object node.
struct AMFObject : public AMFNodeElementBase { struct AMFObject : public AMFNodeElementBase {
@ -208,7 +198,6 @@ struct AMFMesh : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Mesh, pParent) {} AMFNodeElementBase(ENET_Mesh, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Vertex
/// Structure that define vertex node. /// Structure that define vertex node.
struct AMFVertex : public AMFNodeElementBase { struct AMFVertex : public AMFNodeElementBase {
/// Constructor. /// Constructor.
@ -217,7 +206,6 @@ struct AMFVertex : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Vertex, pParent) {} AMFNodeElementBase(ENET_Vertex, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Edge
/// Structure that define edge node. /// Structure that define edge node.
struct AMFEdge : public AMFNodeElementBase { struct AMFEdge : public AMFNodeElementBase {
/// Constructor. /// Constructor.
@ -226,7 +214,6 @@ struct AMFEdge : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Edge, pParent) {} AMFNodeElementBase(ENET_Edge, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Vertices
/// Structure that define vertices node. /// Structure that define vertices node.
struct AMFVertices : public AMFNodeElementBase { struct AMFVertices : public AMFNodeElementBase {
/// Constructor. /// Constructor.
@ -235,7 +222,6 @@ struct AMFVertices : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Vertices, pParent) {} AMFNodeElementBase(ENET_Vertices, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Volume
/// Structure that define volume node. /// Structure that define volume node.
struct AMFVolume : public AMFNodeElementBase { struct AMFVolume : public AMFNodeElementBase {
std::string MaterialID; ///< Which material to use. std::string MaterialID; ///< Which material to use.
@ -247,7 +233,6 @@ struct AMFVolume : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Volume, pParent) {} AMFNodeElementBase(ENET_Volume, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_Coordinates
/// Structure that define coordinates node. /// Structure that define coordinates node.
struct AMFCoordinates : public AMFNodeElementBase { struct AMFCoordinates : public AMFNodeElementBase {
aiVector3D Coordinate; ///< Coordinate. aiVector3D Coordinate; ///< Coordinate.
@ -258,7 +243,6 @@ struct AMFCoordinates : public AMFNodeElementBase {
AMFNodeElementBase(ENET_Coordinates, pParent) {} AMFNodeElementBase(ENET_Coordinates, pParent) {}
}; };
/// \struct CAMFImporter_NodeElement_TexMap
/// Structure that define texture coordinates node. /// Structure that define texture coordinates node.
struct AMFTexMap : public AMFNodeElementBase { struct AMFTexMap : public AMFNodeElementBase {
aiVector3D TextureCoordinate[3]; ///< Texture coordinates. aiVector3D TextureCoordinate[3]; ///< Texture coordinates.
@ -270,12 +254,11 @@ struct AMFTexMap : public AMFNodeElementBase {
/// Constructor. /// Constructor.
/// \param [in] pParent - pointer to parent node. /// \param [in] pParent - pointer to parent node.
AMFTexMap(AMFNodeElementBase *pParent) : AMFTexMap(AMFNodeElementBase *pParent) :
AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() { AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} {
// empty // empty
} }
}; };
/// \struct CAMFImporter_NodeElement_Triangle
/// Structure that define triangle node. /// Structure that define triangle node.
struct AMFTriangle : public AMFNodeElementBase { struct AMFTriangle : public AMFNodeElementBase {
size_t V[3]; ///< Triangle vertices. size_t V[3]; ///< Triangle vertices.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -224,7 +224,8 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string &
} }
// Create format hint. // 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 (!r.empty()) converted_texture.FormatHint[4] = '8';
if (!g.empty()) converted_texture.FormatHint[5] = '8'; if (!g.empty()) converted_texture.FormatHint[5] = '8';
if (!b.empty()) converted_texture.FormatHint[6] = '8'; if (!b.empty()) converted_texture.FormatHint[6] = '8';
@ -815,6 +816,7 @@ nl_clean_loop:
for (; next_it != nodeArray.end(); ++next_it) { for (; next_it != nodeArray.end(); ++next_it) {
if ((*next_it)->FindNode((*nl_it)->mName) != nullptr) { if ((*next_it)->FindNode((*nl_it)->mName) != nullptr) {
// if current top node(nl_it) found in another top node then erase it from node_list and restart search loop. // if current top node(nl_it) found in another top node then erase it from node_list and restart search loop.
// FIXME: this leaks memory on test models test8.amf and test9.amf
nodeArray.erase(nl_it); nodeArray.erase(nl_it);
goto nl_clean_loop; goto nl_clean_loop;
@ -866,7 +868,7 @@ nl_clean_loop:
pScene->mTextures[idx]->mHeight = static_cast<unsigned int>(tex_convd.Height); pScene->mTextures[idx]->mHeight = static_cast<unsigned int>(tex_convd.Height);
pScene->mTextures[idx]->pcData = (aiTexel *)tex_convd.Data; pScene->mTextures[idx]->pcData = (aiTexel *)tex_convd.Data;
// texture format description. // texture format description.
strcpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint); strncpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint, HINTMAXTEXTURELEN);
idx++; idx++;
} // for(const SPP_Texture& tex_convd: mTexture_Converted) } // for(const SPP_Texture& tex_convd: mTexture_Converted)

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -44,7 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
// internal headers // internal headers
@ -64,10 +63,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// utilities // utilities
#include <assimp/fast_atof.h> #include <assimp/fast_atof.h>
using namespace Assimp; namespace Assimp {
using namespace Assimp::ASE; using namespace Assimp::ASE;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"ASE Importer", "ASE Importer",
"", "",
"", "",
@ -87,27 +86,11 @@ ASEImporter::ASEImporter() :
// empty // empty
} }
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
ASEImporter::~ASEImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool ASEImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool cs) const { bool ASEImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
// check file extension static const char *tokens[] = { "*3dsmax_asciiexport" };
const std::string extension = GetExtension(pFile); return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
if (extension == "ase" || extension == "ask") {
return true;
}
if ((!extension.length() || cs) && pIOHandler) {
static const char * const tokens[] = { "*3dsmax_asciiexport" };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -134,14 +117,14 @@ void ASEImporter::InternReadFile(const std::string &pFile,
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb")); std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
// Check whether we can read from the file // Check whether we can read from the file
if (file.get() == nullptr) { if (file == nullptr) {
throw DeadlyImportError("Failed to open ASE file ", pFile, "."); throw DeadlyImportError("Failed to open ASE file ", pFile, ".");
} }
// Allocate storage and copy the contents of the file to a memory buffer // Allocate storage and copy the contents of the file to a memory buffer
std::vector<char> mBuffer2; std::vector<char> mBuffer2;
TextFileToBuffer(file.get(), mBuffer2); TextFileToBuffer(file.get(), mBuffer2);
const size_t fileSize = mBuffer2.size();
this->mBuffer = &mBuffer2[0]; this->mBuffer = &mBuffer2[0];
this->pcScene = pScene; this->pcScene = pScene;
@ -163,7 +146,7 @@ void ASEImporter::InternReadFile(const std::string &pFile,
}; };
// Construct an ASE parser and parse the file // Construct an ASE parser and parse the file
ASE::Parser parser(mBuffer, defaultFormat); ASE::Parser parser(mBuffer, fileSize, defaultFormat);
mParser = &parser; mParser = &parser;
mParser->Parse(); mParser->Parse();
@ -275,7 +258,7 @@ void ASEImporter::GenerateDefaultMaterial() {
} }
if (bHas || mParser->m_vMaterials.empty()) { if (bHas || mParser->m_vMaterials.empty()) {
// add a simple material without submaterials to the parser's list // add a simple material without submaterials to the parser's list
mParser->m_vMaterials.push_back(ASE::Material(AI_DEFAULT_MATERIAL_NAME)); mParser->m_vMaterials.emplace_back(AI_DEFAULT_MATERIAL_NAME);
ASE::Material &mat = mParser->m_vMaterials.back(); ASE::Material &mat = mParser->m_vMaterials.back();
mat.mDiffuse = aiColor3D(0.6f, 0.6f, 0.6f); mat.mDiffuse = aiColor3D(0.6f, 0.6f, 0.6f);
@ -338,21 +321,6 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode *> &nodes) {
aiNodeAnim *nd = pcAnim->mChannels[iNum++] = new aiNodeAnim(); aiNodeAnim *nd = pcAnim->mChannels[iNum++] = new aiNodeAnim();
nd->mNodeName.Set(me->mName + ".Target"); nd->mNodeName.Set(me->mName + ".Target");
// If there is no input position channel we will need
// to supply the default position from the node's
// local transformation matrix.
/*TargetAnimationHelper helper;
if (me->mAnim.akeyPositions.empty())
{
aiMatrix4x4& mat = (*i)->mTransform;
helper.SetFixedMainAnimationChannel(aiVector3D(
mat.a4, mat.b4, mat.c4));
}
else helper.SetMainAnimationChannel (&me->mAnim.akeyPositions);
helper.SetTargetAnimationChannel (&me->mTargetAnim.akeyPositions);
helper.Process(&me->mTargetAnim.akeyPositions);*/
// Allocate the key array and fill it // Allocate the key array and fill it
nd->mNumPositionKeys = (unsigned int)me->mTargetAnim.akeyPositions.size(); nd->mNumPositionKeys = (unsigned int)me->mTargetAnim.akeyPositions.size();
nd->mPositionKeys = new aiVectorKey[nd->mNumPositionKeys]; nd->mPositionKeys = new aiVectorKey[nd->mNumPositionKeys];
@ -478,10 +446,9 @@ void ASEImporter::BuildLights() {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, aiNode *pcParent, const std::string &name) {
aiNode *pcParent, const char *szName) {
aiMatrix4x4 m; aiMatrix4x4 m;
AddNodes(nodes, pcParent, szName, m); AddNodes(nodes, pcParent, name, m);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -538,10 +505,9 @@ void ASEImporter::AddMeshes(const ASE::BaseNode *snode, aiNode *node) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Add child nodes to a given parent node // Add child nodes to a given parent node
void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes, aiNode *pcParent, const std::string &name,
aiNode *pcParent, const char *szName,
const aiMatrix4x4 &mat) { 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); ai_assert(4 <= AI_MAX_NUMBER_OF_COLOR_SETS);
// Receives child nodes for the pcParent node // Receives child nodes for the pcParent node
@ -551,16 +517,18 @@ void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
// which has *us* as parent. // which has *us* as parent.
for (std::vector<BaseNode *>::const_iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) { for (std::vector<BaseNode *>::const_iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) {
const BaseNode *snode = *it; const BaseNode *snode = *it;
if (szName) { if (!name.empty()) {
if (len != snode->mParent.length() || ::strcmp(szName, snode->mParent.c_str())) if (len != snode->mParent.length() || name != snode->mParent.c_str()) {
continue; continue;
} else if (snode->mParent.length()) }
} else if (snode->mParent.length()) {
continue; continue;
}
(*it)->mProcessed = true; (*it)->mProcessed = true;
// Allocate a new node and add it to the output data structure // 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(); aiNode *node = apcNodes.back();
node->mName.Set((snode->mName.length() ? snode->mName.c_str() : "Unnamed_Node")); node->mName.Set((snode->mName.length() ? snode->mName.c_str() : "Unnamed_Node"));
@ -573,7 +541,7 @@ void ASEImporter::AddNodes(const std::vector<BaseNode *> &nodes,
// Add sub nodes - prevent stack overflow due to recursive parenting // Add sub nodes - prevent stack overflow due to recursive parenting
if (node->mName != node->mParent->mName && node->mName != node->mParent->mParent->mName) { 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 // Further processing depends on the type of the node
@ -651,7 +619,8 @@ void ASEImporter::BuildNodes(std::vector<BaseNode *> &nodes) {
} }
// add all 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 // now iterate through al nodes and find those that have not yet
// been added to the nodegraph (= their parent could not be recognized) // been added to the nodegraph (= their parent could not be recognized)
@ -880,6 +849,7 @@ void ASEImporter::ConvertMaterial(ASE::Material &mat) {
unsigned int iWire = 1; unsigned int iWire = 1;
mat.pcInstance->AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME); mat.pcInstance->AddProperty<int>((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME);
} }
// fallthrough
case D3DS::Discreet3DS::Gouraud: case D3DS::Discreet3DS::Gouraud:
eShading = aiShadingMode_Gouraud; eShading = aiShadingMode_Gouraud;
break; break;
@ -935,7 +905,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh &mesh, std::vector<aiMesh *> &avOutMes
ASSIMP_LOG_WARN("Material index is out of range"); ASSIMP_LOG_WARN("Material index is out of range");
} }
// If the material the mesh is assigned to is consisting of submeshes, split it // If the material the mesh is assigned to consists of submeshes, split it
if (!mParser->m_vMaterials[mesh.iMaterialIndex].avSubMaterials.empty()) { if (!mParser->m_vMaterials[mesh.iMaterialIndex].avSubMaterials.empty()) {
std::vector<ASE::Material> vSubMaterials = mParser->m_vMaterials[mesh.iMaterialIndex].avSubMaterials; std::vector<ASE::Material> vSubMaterials = mParser->m_vMaterials[mesh.iMaterialIndex].avSubMaterials;
@ -1014,8 +984,8 @@ void ASEImporter::ConvertMeshes(ASE::Mesh &mesh, std::vector<aiMesh *> &avOutMes
blubb != mesh.mBoneVertices[iIndex2].mBoneWeights.end(); ++blubb) { blubb != mesh.mBoneVertices[iIndex2].mBoneWeights.end(); ++blubb) {
// NOTE: illegal cases have already been filtered out // NOTE: illegal cases have already been filtered out
avOutputBones[(*blubb).first].push_back(std::pair<unsigned int, float>( avOutputBones[(*blubb).first].emplace_back(
iBase, (*blubb).second)); iBase, (*blubb).second);
} }
} }
} }
@ -1293,6 +1263,8 @@ bool ASEImporter::GenerateNormals(ASE::Mesh &mesh) {
return false; return false;
} }
}
#endif // ASSIMP_BUILD_NO_3DS_IMPORTER #endif // ASSIMP_BUILD_NO_3DS_IMPORTER
#endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER #endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -62,7 +62,7 @@ namespace Assimp {
class ASEImporter : public BaseImporter { class ASEImporter : public BaseImporter {
public: public:
ASEImporter(); ASEImporter();
~ASEImporter() override; ~ASEImporter() override = default;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
@ -153,13 +153,13 @@ private:
* \param matrix Current transform * \param matrix Current transform
*/ */
void AddNodes(const std::vector<ASE::BaseNode*>& nodes, 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, void AddNodes(const std::vector<ASE::BaseNode*>& nodes,
aiNode* pcParent,const char* szName, aiNode* pcParent, const std::string &name,
const aiMatrix4x4& matrix); 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 /** Generate a default material and add it to the parser's list
@ -188,5 +188,4 @@ protected:
} // end of namespace Assimp } // end of namespace Assimp
#endif // AI_3DSIMPORTER_H_INC #endif // AI_3DSIMPORTER_H_INC

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -116,7 +115,7 @@ struct Material : public D3DS::Material {
return *this; return *this;
} }
~Material() {} ~Material() = default;
//! Contains all sub materials of this material //! Contains all sub materials of this material
std::vector<Material> avSubMaterials; std::vector<Material> avSubMaterials;
@ -385,20 +384,18 @@ struct Dummy : public BaseNode {
/** \brief Class to parse ASE files /** \brief Class to parse ASE files
*/ */
class Parser { class Parser {
private:
Parser() AI_NO_EXCEPT {
// empty
}
public: public:
/// @brief No default constructor.
Parser() = delete;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Construct a parser from a given input file which is //! Construct a parser from a given input file which is
//! guaranteed to be terminated with zero. //! 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 //! @param fileFormatDefault Assumed file format version. If the
//! file format is specified in the file the new value replaces //! file format is specified in the file the new value replaces
//! the default value. //! 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 //! Parses the file into the parsers internal representation
@ -556,13 +553,15 @@ private:
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...) //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
//! \param apOut Output buffer (3 floats) //! \param apOut Output buffer (3 floats)
//! \param rIndexOut Output index //! \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 //! Parse a *MESH_VERT block in a file
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...) //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
//! \param apOut Output buffer (3 floats) //! \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 //! Parse a *MESH_TFACE block in a file
@ -580,7 +579,8 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Parse a single float element //! Parse a single float element
//! \param fOut Output float //! \param fOut Output float
void ParseLV4MeshFloat(ai_real &fOut); void ParseLV4MeshReal(ai_real &fOut);
void ParseLV4MeshFloat(float &fOut);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Parse a single int element //! Parse a single int element
@ -620,8 +620,8 @@ private:
bool ParseString(std::string &out, const char *szName); bool ParseString(std::string &out, const char *szName);
public: public:
//! Pointer to current data const char *mFilePtr; ////< Pointer to current data
const char *filePtr; const char *mEnd; ///< The end pointer of the file data
//! background color to be passed to the viewer //! background color to be passed to the viewer
//! QNAN if none was found //! QNAN if none was found

View File

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

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -50,11 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/version.h> #include <assimp/version.h>
#include <assimp/IOStream.hpp> #include <assimp/IOStream.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB #include "zlib.h"
#include <zlib.h>
#else
#include "../contrib/zlib/zlib.h"
#endif
#include <ctime> #include <ctime>
@ -130,7 +126,7 @@ inline size_t Write<double>(IOStream *stream, const double &f) {
// Serialize a vec3 // Serialize a vec3
template <> template <>
inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) { inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
size_t t = Write<float>(stream, v.x); size_t t = Write<ai_real>(stream, v.x);
t += Write<float>(stream, v.y); t += Write<float>(stream, v.y);
t += Write<float>(stream, v.z); t += Write<float>(stream, v.z);
@ -141,7 +137,7 @@ inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
// Serialize a color value // Serialize a color value
template <> template <>
inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) { inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
size_t t = Write<float>(stream, v.r); size_t t = Write<ai_real>(stream, v.r);
t += Write<float>(stream, v.g); t += Write<float>(stream, v.g);
t += Write<float>(stream, v.b); t += Write<float>(stream, v.b);
@ -152,7 +148,7 @@ inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
// Serialize a color value // Serialize a color value
template <> template <>
inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) { inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
size_t t = Write<float>(stream, v.r); size_t t = Write<ai_real>(stream, v.r);
t += Write<float>(stream, v.g); t += Write<float>(stream, v.g);
t += Write<float>(stream, v.b); t += Write<float>(stream, v.b);
t += Write<float>(stream, v.a); t += Write<float>(stream, v.a);
@ -164,7 +160,7 @@ inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
// Serialize a quaternion // Serialize a quaternion
template <> template <>
inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) { inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) {
size_t t = Write<float>(stream, v.w); size_t t = Write<ai_real>(stream, v.w);
t += Write<float>(stream, v.x); t += Write<float>(stream, v.x);
t += Write<float>(stream, v.y); t += Write<float>(stream, v.y);
t += Write<float>(stream, v.z); t += Write<float>(stream, v.z);
@ -182,17 +178,19 @@ inline size_t Write<aiVertexWeight>(IOStream *stream, const aiVertexWeight &v) {
return t + Write<float>(stream, v.mWeight); return t + Write<float>(stream, v.mWeight);
} }
constexpr size_t MatrixSize = 64;
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
// Serialize a mat4x4 // Serialize a mat4x4
template <> template <>
inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) { inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) {
for (unsigned int i = 0; i < 4; ++i) { for (unsigned int i = 0; i < 4; ++i) {
for (unsigned int i2 = 0; i2 < 4; ++i2) { for (unsigned int i2 = 0; i2 < 4; ++i2) {
Write<float>(stream, m[i][i2]); Write<ai_real>(stream, m[i][i2]);
} }
} }
return 64; return MatrixSize;
} }
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
@ -640,6 +638,10 @@ protected:
Write<aiString>(&chunk, l->mName); Write<aiString>(&chunk, l->mName);
Write<unsigned int>(&chunk, l->mType); Write<unsigned int>(&chunk, l->mType);
Write<aiVector3D>(&chunk, l->mPosition);
Write<aiVector3D>(&chunk, l->mDirection);
Write<aiVector3D>(&chunk, l->mUp);
if (l->mType != aiLightSource_DIRECTIONAL) { if (l->mType != aiLightSource_DIRECTIONAL) {
Write<float>(&chunk, l->mAttenuationConstant); Write<float>(&chunk, l->mAttenuationConstant);
Write<float>(&chunk, l->mAttenuationLinear); Write<float>(&chunk, l->mAttenuationLinear);

View File

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

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -65,7 +65,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp; using namespace Assimp;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"Assimp Binary Importer", "Assimp Binary Importer",
"Gargaj / Conspiracy", "Gargaj / Conspiracy",
"", "",
@ -556,6 +556,10 @@ void AssbinImporter::ReadBinaryLight(IOStream *stream, aiLight *l) {
l->mName = Read<aiString>(stream); l->mName = Read<aiString>(stream);
l->mType = (aiLightSourceType)Read<unsigned int>(stream); l->mType = (aiLightSourceType)Read<unsigned int>(stream);
l->mPosition = Read<aiVector3D>(stream);
l->mDirection = Read<aiVector3D>(stream);
l->mUp = Read<aiVector3D>(stream);
if (l->mType != aiLightSource_DIRECTIONAL) { if (l->mType != aiLightSource_DIRECTIONAL) {
l->mAttenuationConstant = Read<float>(stream); l->mAttenuationConstant = Read<float>(stream);
l->mAttenuationLinear = Read<float>(stream); l->mAttenuationLinear = Read<float>(stream);

View File

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

View File

@ -7,7 +7,7 @@ For details, see http://sourceforge.net/projects/libb64
#include "cencode.h" // changed from <B64/cencode.h> #include "cencode.h" // changed from <B64/cencode.h>
const int CHARS_PER_LINE = 72; static const int CHARS_PER_LINE = 72;
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)

View File

@ -10,6 +10,7 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER #ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/ai_assert.h>
#include <assimp/Exporter.hpp> #include <assimp/Exporter.hpp>
#include <assimp/IOStream.hpp> #include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
@ -23,16 +24,15 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information
#define CURRENT_FORMAT_VERSION 100 #define CURRENT_FORMAT_VERSION 100
// grab scoped_ptr from assimp to avoid a dependency on boost.
//#include <assimp/../../code/BoostWorkaround/boost/scoped_ptr.hpp>
#include "mesh_splitter.h" #include "mesh_splitter.h"
extern "C" { extern "C" {
#include "cencode.h" # include "cencode.h"
} }
namespace Assimp { namespace Assimp {
// Forward declarations
void ExportAssimp2Json(const char *, Assimp::IOSystem *, const aiScene *, const Assimp::ExportProperties *); void ExportAssimp2Json(const char *, Assimp::IOSystem *, const aiScene *, const Assimp::ExportProperties *);
// small utility class to simplify serializing the aiScene to Json // small utility class to simplify serializing the aiScene to Json
@ -179,7 +179,6 @@ private:
// escape backslashes and single quotes, both would render the JSON invalid if left as is // escape backslashes and single quotes, both would render the JSON invalid if left as is
t.reserve(s.length); t.reserve(s.length);
for (size_t i = 0; i < s.length; ++i) { for (size_t i = 0; i < s.length; ++i) {
if (s.data[i] == '\\' || s.data[i] == '\'' || s.data[i] == '\"') { if (s.data[i] == '\\' || s.data[i] == '\'' || s.data[i] == '\"') {
t.push_back('\\'); t.push_back('\\');
} }
@ -241,7 +240,7 @@ private:
unsigned int flags; unsigned int flags;
}; };
void Write(JSONWriter &out, const aiVector3D &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiVector3D &ai, bool is_elem = true) {
out.StartArray(is_elem); out.StartArray(is_elem);
out.Element(ai.x); out.Element(ai.x);
out.Element(ai.y); out.Element(ai.y);
@ -249,7 +248,7 @@ void Write(JSONWriter &out, const aiVector3D &ai, bool is_elem = true) {
out.EndArray(); out.EndArray();
} }
void Write(JSONWriter &out, const aiQuaternion &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiQuaternion &ai, bool is_elem = true) {
out.StartArray(is_elem); out.StartArray(is_elem);
out.Element(ai.w); out.Element(ai.w);
out.Element(ai.x); out.Element(ai.x);
@ -258,7 +257,7 @@ void Write(JSONWriter &out, const aiQuaternion &ai, bool is_elem = true) {
out.EndArray(); out.EndArray();
} }
void Write(JSONWriter &out, const aiColor3D &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiColor3D &ai, bool is_elem = true) {
out.StartArray(is_elem); out.StartArray(is_elem);
out.Element(ai.r); out.Element(ai.r);
out.Element(ai.g); out.Element(ai.g);
@ -266,7 +265,7 @@ void Write(JSONWriter &out, const aiColor3D &ai, bool is_elem = true) {
out.EndArray(); out.EndArray();
} }
void Write(JSONWriter &out, const aiMatrix4x4 &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiMatrix4x4 &ai, bool is_elem = true) {
out.StartArray(is_elem); out.StartArray(is_elem);
for (unsigned int x = 0; x < 4; ++x) { for (unsigned int x = 0; x < 4; ++x) {
for (unsigned int y = 0; y < 4; ++y) { for (unsigned int y = 0; y < 4; ++y) {
@ -276,7 +275,7 @@ void Write(JSONWriter &out, const aiMatrix4x4 &ai, bool is_elem = true) {
out.EndArray(); out.EndArray();
} }
void Write(JSONWriter &out, const aiBone &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiBone &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -297,7 +296,7 @@ void Write(JSONWriter &out, const aiBone &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiFace &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiFace &ai, bool is_elem = true) {
out.StartArray(is_elem); out.StartArray(is_elem);
for (unsigned int i = 0; i < ai.mNumIndices; ++i) { for (unsigned int i = 0; i < ai.mNumIndices; ++i) {
out.Element(ai.mIndices[i]); out.Element(ai.mIndices[i]);
@ -305,7 +304,7 @@ void Write(JSONWriter &out, const aiFace &ai, bool is_elem = true) {
out.EndArray(); out.EndArray();
} }
void Write(JSONWriter &out, const aiMesh &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiMesh &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -416,7 +415,7 @@ void Write(JSONWriter &out, const aiMesh &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiNode &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiNode &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -446,7 +445,7 @@ void Write(JSONWriter &out, const aiNode &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("properties"); out.Key("properties");
@ -477,7 +476,17 @@ void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
out.SimpleValue(*reinterpret_cast<float *>(prop->mData)); out.SimpleValue(*reinterpret_cast<float *>(prop->mData));
} }
break; break;
case aiPTI_Double:
if (prop->mDataLength / sizeof(double) > 1) {
out.StartArray();
for (unsigned int ii = 0; ii < prop->mDataLength / sizeof(double); ++ii) {
out.Element(reinterpret_cast<double*>(prop->mData)[ii]);
}
out.EndArray();
} else {
out.SimpleValue(*reinterpret_cast<double*>(prop->mData));
}
break;
case aiPTI_Integer: case aiPTI_Integer:
if (prop->mDataLength / sizeof(int) > 1) { if (prop->mDataLength / sizeof(int) > 1) {
out.StartArray(); out.StartArray();
@ -490,17 +499,21 @@ void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
} }
break; break;
case aiPTI_String: { case aiPTI_String:
{
aiString s; aiString s;
aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s); aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s);
out.SimpleValue(s); out.SimpleValue(s);
} break; }
case aiPTI_Buffer: { break;
case aiPTI_Buffer:
{
// binary data is written as series of hex-encoded octets // binary data is written as series of hex-encoded octets
out.SimpleValue(prop->mData, prop->mDataLength); out.SimpleValue(prop->mData, prop->mDataLength);
} break; }
break;
default: default:
assert(false); ai_assert(false);
} }
out.EndObj(); out.EndObj();
@ -510,7 +523,7 @@ void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiTexture &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiTexture &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("width"); out.Key("width");
@ -546,7 +559,7 @@ void Write(JSONWriter &out, const aiTexture &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiLight &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiLight &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -594,7 +607,7 @@ void Write(JSONWriter &out, const aiLight &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiNodeAnim &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiNodeAnim &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -647,7 +660,7 @@ void Write(JSONWriter &out, const aiNodeAnim &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiAnimation &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiAnimation &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -668,7 +681,7 @@ void Write(JSONWriter &out, const aiAnimation &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiCamera &ai, bool is_elem = true) { static void Write(JSONWriter &out, const aiCamera &ai, bool is_elem = true) {
out.StartObj(is_elem); out.StartObj(is_elem);
out.Key("name"); out.Key("name");
@ -695,7 +708,7 @@ void Write(JSONWriter &out, const aiCamera &ai, bool is_elem = true) {
out.EndObj(); out.EndObj();
} }
void WriteFormatInfo(JSONWriter &out) { static void WriteFormatInfo(JSONWriter &out) {
out.StartObj(); out.StartObj();
out.Key("format"); out.Key("format");
out.SimpleValue("\"assimp2json\""); out.SimpleValue("\"assimp2json\"");
@ -704,7 +717,7 @@ void WriteFormatInfo(JSONWriter &out) {
out.EndObj(); out.EndObj();
} }
void Write(JSONWriter &out, const aiScene &ai) { static void Write(JSONWriter &out, const aiScene &ai) {
out.StartObj(); out.StartObj();
out.Key("__metadata__"); out.Key("__metadata__");

View File

@ -304,7 +304,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
} }
// add the newly created mesh to the list // add the newly created mesh to the list
source_mesh_map.push_back(std::make_pair(out_mesh,a)); source_mesh_map.emplace_back(out_mesh,a);
if (base == in_mesh->mNumFaces) { if (base == in_mesh->mNumFaces) {
break; break;

View File

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

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -365,7 +365,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
ioprintf(io, "\t\t\t<MatProperty key=\"%s\" \n\t\t\ttype=\"%s\" tex_usage=\"%s\" tex_index=\"%u\"", ioprintf(io, "\t\t\t<MatProperty key=\"%s\" \n\t\t\ttype=\"%s\" tex_usage=\"%s\" tex_index=\"%u\"",
prop->mKey.data, sz, prop->mKey.data, sz,
::TextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex); ::aiTextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex);
if (prop->mType == aiPTI_Float) { if (prop->mType == aiPTI_Float) {
ioprintf(io, " size=\"%i\">\n\t\t\t\t", ioprintf(io, " size=\"%i\">\n\t\t\t\t",
@ -652,7 +652,7 @@ void DumpSceneToAssxml(
const char *pFile, const char *cmd, IOSystem *pIOSystem, const char *pFile, const char *cmd, IOSystem *pIOSystem,
const aiScene *pScene, bool shortened) { const aiScene *pScene, bool shortened) {
std::unique_ptr<IOStream> file(pIOSystem->Open(pFile, "wt")); std::unique_ptr<IOStream> file(pIOSystem->Open(pFile, "wt"));
if (!file.get()) { if (!file) {
throw std::runtime_error("Unable to open output file " + std::string(pFile) + '\n'); throw std::runtime_error("Unable to open output file " + std::string(pFile) + '\n');
} }

View File

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

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -59,10 +59,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory> #include <memory>
using namespace Assimp; namespace Assimp {
using namespace std; using namespace std;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"BlitzBasic 3D Importer", "BlitzBasic 3D Importer",
"", "",
"", "",
@ -79,7 +79,7 @@ static const aiImporterDesc desc = {
#pragma warning(disable : 4018) #pragma warning(disable : 4018)
#endif #endif
//#define DEBUG_B3D // #define DEBUG_B3D
template <typename T> template <typename T>
void DeleteAllBarePointers(std::vector<T> &x) { void DeleteAllBarePointers(std::vector<T> &x) {
@ -88,12 +88,10 @@ void DeleteAllBarePointers(std::vector<T> &x) {
} }
} }
B3DImporter::~B3DImporter() { B3DImporter::~B3DImporter() = default;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool B3DImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { bool B3DImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
size_t pos = pFile.find_last_of('.'); size_t pos = pFile.find_last_of('.');
if (pos == string::npos) { if (pos == string::npos) {
return false; return false;
@ -118,7 +116,7 @@ void B3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile)); std::unique_ptr<IOStream> file(pIOHandler->Open(pFile));
// Check whether we can read from the file // Check whether we can read from the file
if (file.get() == nullptr) { if (file == nullptr) {
throw DeadlyImportError("Failed to open B3D file ", pFile, "."); throw DeadlyImportError("Failed to open B3D file ", pFile, ".");
} }
@ -152,7 +150,7 @@ AI_WONT_RETURN void B3DImporter::Fail(const string &str) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
int B3DImporter::ReadByte() { int B3DImporter::ReadByte() {
if (_pos > _buf.size()) { if (_pos >= _buf.size()) {
Fail("EOF"); Fail("EOF");
} }
@ -255,7 +253,7 @@ size_t B3DImporter::ChunkSize() {
template <class T> template <class T>
T *B3DImporter::to_array(const vector<T> &v) { T *B3DImporter::to_array(const vector<T> &v) {
if (v.empty()) { if (v.empty()) {
return 0; return nullptr;
} }
T *p = new T[v.size()]; T *p = new T[v.size()];
for (size_t i = 0; i < v.size(); ++i) { for (size_t i = 0; i < v.size(); ++i) {
@ -268,7 +266,7 @@ T *B3DImporter::to_array(const vector<T> &v) {
template <class T> template <class T>
T **unique_to_array(vector<std::unique_ptr<T>> &v) { T **unique_to_array(vector<std::unique_ptr<T>> &v) {
if (v.empty()) { if (v.empty()) {
return 0; return nullptr;
} }
T **p = new T *[v.size()]; T **p = new T *[v.size()];
for (size_t i = 0; i < v.size(); ++i) { for (size_t i = 0; i < v.size(); ++i) {
@ -331,7 +329,7 @@ void B3DImporter::ReadBRUS() {
mat->AddProperty(&i, 1, AI_MATKEY_TWOSIDED); mat->AddProperty(&i, 1, AI_MATKEY_TWOSIDED);
} }
//Textures // Textures
for (int i = 0; i < n_texs; ++i) { for (int i = 0; i < n_texs; ++i) {
int texid = ReadInt(); int texid = ReadInt();
if (texid < -1 || (texid >= 0 && texid >= static_cast<int>(_textures.size()))) { if (texid < -1 || (texid >= 0 && texid >= static_cast<int>(_textures.size()))) {
@ -374,7 +372,7 @@ void B3DImporter::ReadVRTS() {
} }
if (_vflags & 2) { if (_vflags & 2) {
ReadQuat(); //skip v 4bytes... ReadQuat(); // skip v 4bytes...
} }
for (int j = 0; j < _tcsets; ++j) { for (int j = 0; j < _tcsets; ++j) {
@ -420,7 +418,6 @@ void B3DImporter::ReadTRIS(int v0) {
ASSIMP_LOG_ERROR("Bad triangle index: i0=", i0, ", i1=", i1, ", i2=", i2); ASSIMP_LOG_ERROR("Bad triangle index: i0=", i0, ", i1=", i1, ", i2=", i2);
#endif #endif
Fail("Bad triangle index"); Fail("Bad triangle index");
continue;
} }
face->mNumIndices = 3; face->mNumIndices = 3;
face->mIndices = new unsigned[3]; face->mIndices = new unsigned[3];
@ -479,13 +476,13 @@ void B3DImporter::ReadKEYS(aiNodeAnim *nodeAnim) {
while (ChunkSize()) { while (ChunkSize()) {
int frame = ReadInt(); int frame = ReadInt();
if (flags & 1) { if (flags & 1) {
trans.push_back(aiVectorKey(frame, ReadVec3())); trans.emplace_back(frame, ReadVec3());
} }
if (flags & 2) { if (flags & 2) {
scale.push_back(aiVectorKey(frame, ReadVec3())); scale.emplace_back(frame, ReadVec3());
} }
if (flags & 4) { if (flags & 4) {
rot.push_back(aiQuatKey(frame, ReadQuat())); rot.emplace_back(frame, ReadQuat());
} }
} }
@ -619,7 +616,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
} else if (chunk == "BRUS") { } else if (chunk == "BRUS") {
ReadBRUS(); ReadBRUS();
} else if (chunk == "NODE") { } else if (chunk == "NODE") {
ReadNODE(0); ReadNODE(nullptr);
} }
ExitChunk(); ExitChunk();
} }
@ -644,7 +641,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
int n_tris = mesh->mNumFaces; int n_tris = mesh->mNumFaces;
int n_verts = mesh->mNumVertices = n_tris * 3; int n_verts = mesh->mNumVertices = n_tris * 3;
aiVector3D *mv = mesh->mVertices = new aiVector3D[n_verts], *mn = 0, *mc = 0; aiVector3D *mv = mesh->mVertices = new aiVector3D[n_verts], *mn = nullptr, *mc = nullptr;
if (_vflags & 1) { if (_vflags & 1) {
mn = mesh->mNormals = new aiVector3D[n_verts]; mn = mesh->mNormals = new aiVector3D[n_verts];
} }
@ -673,7 +670,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
int bone = v.bones[k]; int bone = v.bones[k];
float weight = v.weights[k]; float weight = v.weights[k];
vweights[bone].push_back(aiVertexWeight(vertIdx + faceIndex, weight)); vweights[bone].emplace_back(vertIdx + faceIndex, weight);
} }
} }
++face; ++face;
@ -707,22 +704,22 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
} }
} }
//nodes // nodes
scene->mRootNode = _nodes[0]; scene->mRootNode = _nodes[0];
_nodes.clear(); // node ownership now belongs to scene _nodes.clear(); // node ownership now belongs to scene
//material // material
if (!_materials.size()) { if (!_materials.size()) {
_materials.emplace_back(std::unique_ptr<aiMaterial>(new aiMaterial)); _materials.emplace_back(std::unique_ptr<aiMaterial>(new aiMaterial));
} }
scene->mNumMaterials = static_cast<unsigned int>(_materials.size()); scene->mNumMaterials = static_cast<unsigned int>(_materials.size());
scene->mMaterials = unique_to_array(_materials); scene->mMaterials = unique_to_array(_materials);
//meshes // meshes
scene->mNumMeshes = static_cast<unsigned int>(_meshes.size()); scene->mNumMeshes = static_cast<unsigned int>(_meshes.size());
scene->mMeshes = unique_to_array(_meshes); scene->mMeshes = unique_to_array(_meshes);
//animations // animations
if (_animations.size() == 1 && _nodeAnims.size()) { if (_animations.size() == 1 && _nodeAnims.size()) {
aiAnimation *anim = _animations.back().get(); aiAnimation *anim = _animations.back().get();
@ -741,4 +738,6 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
flip.Execute(scene); flip.Execute(scene);
} }
} // namespace Assimp
#endif // !! ASSIMP_BUILD_NO_B3D_IMPORTER #endif // !! ASSIMP_BUILD_NO_B3D_IMPORTER

View File

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

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
@ -55,10 +55,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map> #include <map>
#include <memory> #include <memory>
using namespace Assimp; namespace Assimp {
using namespace Assimp::Formatter; using namespace Assimp::Formatter;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"BVH Importer (MoCap)", "BVH Importer (MoCap)",
"", "",
"", "",
@ -73,8 +74,8 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Aborts the file reading with an exception // Aborts the file reading with an exception
template<typename... T> template <typename... T>
AI_WONT_RETURN void BVHLoader::ThrowException(T&&... args) { AI_WONT_RETURN void BVHLoader::ThrowException(T &&...args) {
throw DeadlyImportError(mFileName, ":", mLine, " - ", args...); throw DeadlyImportError(mFileName, ":", mLine, " - ", args...);
} }
@ -88,22 +89,13 @@ BVHLoader::BVHLoader() :
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
BVHLoader::~BVHLoader() {} BVHLoader::~BVHLoader() = default;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool BVHLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool cs) const { bool BVHLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
// check file extension static const char *tokens[] = { "HIERARCHY" };
const std::string extension = GetExtension(pFile); return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
if (extension == "bvh")
return true;
if ((!extension.length() || cs) && pIOHandler) {
static const char * const tokens[] = { "HIERARCHY" };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -124,7 +116,7 @@ void BVHLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IOSyst
// read file into memory // read file into memory
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile)); std::unique_ptr<IOStream> file(pIOHandler->Open(pFile));
if (file.get() == nullptr) { if (file == nullptr) {
throw DeadlyImportError("Failed to open file ", pFile, "."); throw DeadlyImportError("Failed to open file ", pFile, ".");
} }
@ -195,12 +187,12 @@ aiNode *BVHLoader::ReadNode() {
std::vector<aiNode *> childNodes; std::vector<aiNode *> childNodes;
// and create an bone entry for it // and create an bone entry for it
mNodes.push_back(Node(node)); mNodes.emplace_back(node);
Node &internNode = mNodes.back(); Node &internNode = mNodes.back();
// now read the node's contents // now read the node's contents
std::string siteToken; std::string siteToken;
while (1) { while (true) {
std::string token = GetNextToken(); std::string token = GetNextToken();
// node offset to parent node // node offset to parent node
@ -256,7 +248,7 @@ aiNode *BVHLoader::ReadEndSite(const std::string &pParentName) {
// now read the node's contents. Only possible entry is "OFFSET" // now read the node's contents. Only possible entry is "OFFSET"
std::string token; std::string token;
while (1) { while (true) {
token.clear(); token.clear();
token = GetNextToken(); token = GetNextToken();
@ -435,7 +427,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
nodeAnim->mNodeName.Set(nodeName); nodeAnim->mNodeName.Set(nodeName);
std::map<BVHLoader::ChannelType, int> channelMap; std::map<BVHLoader::ChannelType, int> channelMap;
//Build map of channels // Build map of channels
for (unsigned int channel = 0; channel < node.mChannels.size(); ++channel) { for (unsigned int channel = 0; channel < node.mChannels.size(); ++channel) {
channelMap[node.mChannels[channel]] = channel; channelMap[node.mChannels[channel]] = channel;
} }
@ -450,7 +442,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
// Now compute all translations // Now compute all translations
for (BVHLoader::ChannelType channel = Channel_PositionX; channel <= Channel_PositionZ; channel = (BVHLoader::ChannelType)(channel + 1)) { for (BVHLoader::ChannelType channel = Channel_PositionX; channel <= Channel_PositionZ; channel = (BVHLoader::ChannelType)(channel + 1)) {
//Find channel in node // Find channel in node
std::map<BVHLoader::ChannelType, int>::iterator mapIter = channelMap.find(channel); std::map<BVHLoader::ChannelType, int>::iterator mapIter = channelMap.find(channel);
if (mapIter == channelMap.end()) if (mapIter == channelMap.end())
@ -494,26 +486,23 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
for (unsigned int fr = 0; fr < mAnimNumFrames; ++fr) { for (unsigned int fr = 0; fr < mAnimNumFrames; ++fr) {
aiMatrix4x4 temp; aiMatrix4x4 temp;
aiMatrix3x3 rotMatrix; aiMatrix3x3 rotMatrix;
for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++ channelIdx) { for (unsigned int channelIdx = 0; channelIdx < node.mChannels.size(); ++channelIdx) {
switch (node.mChannels[channelIdx]) { switch (node.mChannels[channelIdx]) {
case Channel_RotationX: case Channel_RotationX: {
{
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f; const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
aiMatrix4x4::RotationX( angle, temp); rotMatrix *= aiMatrix3x3( temp); aiMatrix4x4::RotationX(angle, temp);
} rotMatrix *= aiMatrix3x3(temp);
break; } break;
case Channel_RotationY: case Channel_RotationY: {
{
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f; const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
aiMatrix4x4::RotationY( angle, temp); rotMatrix *= aiMatrix3x3( temp); aiMatrix4x4::RotationY(angle, temp);
} rotMatrix *= aiMatrix3x3(temp);
break; } break;
case Channel_RotationZ: case Channel_RotationZ: {
{
const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f; const float angle = node.mChannelValues[fr * node.mChannels.size() + channelIdx] * float(AI_MATH_PI) / 180.0f;
aiMatrix4x4::RotationZ( angle, temp); rotMatrix *= aiMatrix3x3( temp); aiMatrix4x4::RotationZ(angle, temp);
} rotMatrix *= aiMatrix3x3(temp);
break; } break;
default: default:
break; break;
} }
@ -534,4 +523,6 @@ void BVHLoader::CreateAnimation(aiScene *pScene) {
} }
} }
} // namespace Assimp
#endif // !! ASSIMP_BUILD_NO_BVH_IMPORTER #endif // !! ASSIMP_BUILD_NO_BVH_IMPORTER

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
template <> template <>
const char *LogFunctions<BlenderBMeshConverter>::Prefix() { const char *LogFunctions<BlenderBMeshConverter>::Prefix() {
static auto prefix = "BLEND_BMESH: "; return "BLEND_BMESH: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp
@ -140,7 +139,7 @@ void BlenderBMeshConverter::ConvertPolyToFaces(const MPoly &poly) {
ThrowException("BMesh uv loop array has incorrect size"); ThrowException("BMesh uv loop array has incorrect size");
} }
const MLoopUV *loopUV = &BMesh->mloopuv[poly.loopstart]; const MLoopUV *loopUV = &BMesh->mloopuv[poly.loopstart];
AddTFace(loopUV[0].uv, loopUV[1].uv, loopUV[2].uv, poly.totloop == 4 ? loopUV[3].uv : 0); AddTFace(loopUV[0].uv, loopUV[1].uv, loopUV[2].uv, poly.totloop == 4 ? loopUV[3].uv : nullptr);
} }
} else if (poly.totloop > 4) { } else if (poly.totloop > 4) {
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE #if ASSIMP_BLEND_WITH_GLU_TESSELLATE

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -80,7 +80,7 @@ namespace Assimp
void DestroyTriMesh( ); void DestroyTriMesh( );
void ConvertPolyToFaces( const Blender::MPoly& poly ); void ConvertPolyToFaces( const Blender::MPoly& poly );
void AddFace( int v1, int v2, int v3, int v4 = 0 ); void AddFace( int v1, int v2, int v3, int v4 = 0 );
void AddTFace( const float* uv1, const float* uv2, const float *uv3, const float* uv4 = 0 ); void AddTFace(const float *uv1, const float *uv2, const float *uv3, const float *uv4 = nullptr);
const Blender::Mesh* BMesh; const Blender::Mesh* BMesh;
Blender::Mesh* triMesh; Blender::Mesh* triMesh;

View File

@ -96,7 +96,8 @@ struct CustomDataTypeDescription {
* other (like CD_ORCO, ...) uses arrays of rawtypes or even arrays of Structures * other (like CD_ORCO, ...) uses arrays of rawtypes or even arrays of Structures
* use a special readfunction for that cases * use a special readfunction for that cases
*/ */
std::array<CustomDataTypeDescription, CD_NUMTYPES> customDataTypeDescriptions = { { DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MVert), static std::array<CustomDataTypeDescription, CD_NUMTYPES> customDataTypeDescriptions = { {
DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MVert),
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION, DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION,
DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION, DECL_UNSUPPORTED_CUSTOMDATATYPEDESCRIPTION,
DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MEdge), DECL_STRUCT_CUSTOMDATATYPEDESCRIPTION(MEdge),

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -72,7 +72,7 @@ struct Type {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DNAParser::Parse() { void DNAParser::Parse() {
StreamReaderAny &stream = *db.reader.get(); StreamReaderAny &stream = *db.reader;
DNA &dna = db.dna; DNA &dna = db.dna;
if (!match4(stream, "SDNA")) { if (!match4(stream, "SDNA")) {
@ -325,10 +325,10 @@ void SectionParser ::Next() {
stream.SetCurrentPos(current.start + current.size); stream.SetCurrentPos(current.start + current.size);
const char tmp[] = { const char tmp[] = {
(const char)stream.GetI1(), (char)stream.GetI1(),
(const char)stream.GetI1(), (char)stream.GetI1(),
(const char)stream.GetI1(), (char)stream.GetI1(),
(const char)stream.GetI1() (char)stream.GetI1()
}; };
current.id = std::string(tmp, tmp[3] ? 4 : tmp[2] ? 3 : tmp[1] ? 2 : 1); current.id = std::string(tmp, tmp[3] ? 4 : tmp[2] ? 3 : tmp[1] ? 2 : 1);

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -106,9 +106,7 @@ struct ElemBase {
// empty // empty
} }
virtual ~ElemBase() { virtual ~ElemBase() = default;
// empty
}
/** Type name of the element. The type /** Type name of the element. The type
* string points is the `c_str` of the `name` attribute of the * string points is the `c_str` of the `name` attribute of the
@ -416,10 +414,10 @@ template <>
struct Structure::_defaultInitializer<ErrorPolicy_Fail> { struct Structure::_defaultInitializer<ErrorPolicy_Fail> {
template <typename T> template <typename T>
void operator()(T & /*out*/, const char * = "") { void operator()(T & /*out*/, const char *message = "") {
// obviously, it is crucial that _DefaultInitializer is used // obviously, it is crucial that _DefaultInitializer is used
// only from within a catch clause. // only from within a catch clause.
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error"); throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error: ", message);
} }
}; };
@ -431,6 +429,17 @@ inline bool Structure ::ResolvePointer<std::shared_ptr, ElemBase>(std::shared_pt
const Field &f, const Field &f,
bool) const; bool) const;
template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(
std::shared_ptr<ElemBase>& out, const Pointer & ptrval,
const FileDatabase& db, const Field&, bool) const;
template <> inline void Structure :: Convert<int> (int& dest,const FileDatabase& db) const;
template<> inline void Structure :: Convert<short> (short& dest,const FileDatabase& db) const;
template <> inline void Structure :: Convert<char> (char& dest,const FileDatabase& db) const;
template <> inline void Structure::Convert<unsigned char>(unsigned char& dest, const FileDatabase& db) const;
template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const;
template <> inline void Structure :: Convert<double> (double& dest,const FileDatabase& db) const;
template <> inline void Structure :: Convert<Pointer> (Pointer& dest,const FileDatabase& db) const;
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Represents the full data structure information for a single BLEND file. /** Represents the full data structure information for a single BLEND file.
* This data is extracted from the DNA1 chunk in the file. * This data is extracted from the DNA1 chunk in the file.

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -65,8 +65,7 @@ namespace Blender {
struct TempArray { struct TempArray {
typedef TCLASS< T*,std::allocator<T*> > mywrap; typedef TCLASS< T*,std::allocator<T*> > mywrap;
TempArray() { TempArray() = default;
}
~TempArray () { ~TempArray () {
for(T* elem : arr) { for(T* elem : arr) {

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -63,22 +63,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/StringComparison.h> #include <assimp/StringComparison.h>
#include <cctype> #include <cctype>
#include <memory>
#include <utility>
// zlib is needed for compressed blend files // zlib is needed for compressed blend files
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
# ifdef ASSIMP_BUILD_NO_OWN_ZLIB #include "Common/Compression.h"
# include <zlib.h>
# else
# include "../contrib/zlib/zlib.h"
# endif
#endif #endif
namespace Assimp { namespace Assimp {
template <> template <>
const char *LogFunctions<BlenderImporter>::Prefix() { const char *LogFunctions<BlenderImporter>::Prefix() {
static auto prefix = "BLEND: "; return "BLEND: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp
@ -87,7 +84,7 @@ using namespace Assimp;
using namespace Assimp::Blender; using namespace Assimp::Blender;
using namespace Assimp::Formatter; using namespace Assimp::Formatter;
static const aiImporterDesc blenderDesc = { static constexpr aiImporterDesc blenderDesc = {
"Blender 3D Importer (http://www.blender3d.org)", "Blender 3D Importer (http://www.blender3d.org)",
"", "",
"", "",
@ -113,23 +110,12 @@ BlenderImporter::~BlenderImporter() {
delete modifier_cache; delete modifier_cache;
} }
static const char * const Tokens[] = { "BLENDER" }; static const char Token[] = "BLENDER";
static const char * const TokensForSearch[] = { "blender" };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
const std::string &extension = GetExtension(pFile); return ParseMagicToken(pFile, pIOHandler).error.empty();
if (extension == "blend") {
return true;
}
if ((!extension.length() || checkSig) && pIOHandler) {
// note: this won't catch compressed files
return SearchFileHeaderForToken(pIOHandler, pFile, TokensForSearch, 1);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -148,98 +134,25 @@ void BlenderImporter::SetupProperties(const Importer * /*pImp*/) {
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void BlenderImporter::InternReadFile(const std::string &pFile, void BlenderImporter::InternReadFile(const std::string &pFile,
aiScene *pScene, IOSystem *pIOHandler) { aiScene *pScene, IOSystem *pIOHandler) {
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
std::vector<Bytef> uncompressed;
#endif
FileDatabase file; FileDatabase file;
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb")); StreamOrError streamOrError = ParseMagicToken(pFile, pIOHandler);
if (!stream) { if (!streamOrError.error.empty()) {
ThrowException("Could not open file for reading"); ThrowException(streamOrError.error);
} }
std::shared_ptr<IOStream> stream = std::move(streamOrError.stream);
char magic[8] = { 0 }; char version[4] = { 0 };
stream->Read(magic, 7, 1); file.i64bit = (stream->Read(version, 1, 1), version[0] == '-');
if (strcmp(magic, Tokens[0])) { file.little = (stream->Read(version, 1, 1), version[0] == 'v');
// Check for presence of the gzip header. If yes, assume it is a
// compressed blend file and try uncompressing it, else fail. This is to
// avoid uncompressing random files which our loader might end up with.
#ifdef ASSIMP_BUILD_NO_COMPRESSED_BLEND
ThrowException("BLENDER magic bytes are missing, is this file compressed (Assimp was built without decompression support)?");
#else
if (magic[0] != 0x1f || static_cast<uint8_t>(magic[1]) != 0x8b) { stream->Read(version, 3, 1);
ThrowException("BLENDER magic bytes are missing, couldn't find GZIP header either"); version[3] = '\0';
}
LogDebug("Found no BLENDER magic word but a GZIP header, might be a compressed file"); LogInfo("Blender version is ", version[0], ".", version + 1,
if (magic[2] != 8) {
ThrowException("Unsupported GZIP compression method");
}
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
stream->Seek(0L, aiOrigin_SET);
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
// build a zlib stream
z_stream zstream;
zstream.opaque = Z_NULL;
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.data_type = Z_BINARY;
// http://hewgill.com/journal/entries/349-how-to-decompress-gzip-stream-with-zlib
inflateInit2(&zstream, 16 + MAX_WBITS);
zstream.next_in = reinterpret_cast<Bytef *>(reader->GetPtr());
zstream.avail_in = (uInt)reader->GetRemainingSize();
size_t total = 0l;
// TODO: be smarter about this, decompress directly into heap buffer
// and decompress the data .... do 1k chunks in the hope that we won't kill the stack
#define MYBLOCK 1024
Bytef block[MYBLOCK];
int ret;
do {
zstream.avail_out = MYBLOCK;
zstream.next_out = block;
ret = inflate(&zstream, Z_NO_FLUSH);
if (ret != Z_STREAM_END && ret != Z_OK) {
ThrowException("Failure decompressing this file using gzip, seemingly it is NOT a compressed .BLEND file");
}
const size_t have = MYBLOCK - zstream.avail_out;
total += have;
uncompressed.resize(total);
memcpy(uncompressed.data() + total - have, block, have);
} while (ret != Z_STREAM_END);
// terminate zlib
inflateEnd(&zstream);
// replace the input stream with a memory stream
stream.reset(new MemoryIOStream(reinterpret_cast<uint8_t *>(uncompressed.data()), total));
// .. and retry
stream->Read(magic, 7, 1);
if (strcmp(magic, "BLENDER")) {
ThrowException("Found no BLENDER magic word in decompressed GZIP file");
}
#endif
}
file.i64bit = (stream->Read(magic, 1, 1), magic[0] == '-');
file.little = (stream->Read(magic, 1, 1), magic[0] == 'v');
stream->Read(magic, 3, 1);
magic[3] = '\0';
LogInfo("Blender version is ", magic[0], ".", magic + 1,
" (64bit: ", file.i64bit ? "true" : "false", " (64bit: ", file.i64bit ? "true" : "false",
", little endian: ", file.little ? "true" : "false", ")"); ", little endian: ", file.little ? "true" : "false", ")");
ParseBlendFile(file, stream); ParseBlendFile(file, std::move(stream));
Scene scene; Scene scene;
ExtractScene(scene, file); ExtractScene(scene, file);
@ -256,7 +169,7 @@ void BlenderImporter::ParseBlendFile(FileDatabase &out, std::shared_ptr<IOStream
out.entries.reserve(128); out.entries.reserve(128);
{ // even small BLEND files tend to consist of many file blocks { // even small BLEND files tend to consist of many file blocks
SectionParser parser(*out.reader.get(), out.i64bit); SectionParser parser(*out.reader, out.i64bit);
// first parse the file in search for the DNA and insert all other sections into the database // first parse the file in search for the DNA and insert all other sections into the database
while ((parser.Next(), 1)) { while ((parser.Next(), 1)) {
@ -319,7 +232,7 @@ void BlenderImporter::ExtractScene(Scene &out, const FileDatabase &file) {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr<Collection> collection, ConversionData &conv_data) { void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr<Collection>& collection, ConversionData &conv_data) {
std::deque<Object *> root_objects; std::deque<Object *> root_objects;
// Count number of objects // Count number of objects
@ -446,7 +359,7 @@ void BlenderImporter::ResolveImage(aiMaterial *out, const Material *mat, const M
// check if the file contents are bundled with the BLEND file // check if the file contents are bundled with the BLEND file
if (img->packedfile) { if (img->packedfile) {
name.data[0] = '*'; 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()); conv_data.textures->push_back(new aiTexture());
aiTexture *curTex = conv_data.textures->back(); aiTexture *curTex = conv_data.textures->back();
@ -520,7 +433,7 @@ void BlenderImporter::AddSentinelTexture(aiMaterial *out, const Material *mat, c
(void)conv_data; (void)conv_data;
aiString name; 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)); GetTextureTypeDisplayString(tex->tex->type));
out->AddProperty(&name, AI_MATKEY_TEXTURE_DIFFUSE( out->AddProperty(&name, AI_MATKEY_TEXTURE_DIFFUSE(
conv_data.next_texture[aiTextureType_DIFFUSE]++)); conv_data.next_texture[aiTextureType_DIFFUSE]++));
@ -1024,7 +937,7 @@ void BlenderImporter::ConvertMesh(const Scene & /*in*/, const Object * /*obj*/,
// key is material number, value is the TextureUVMapping for the material // key is material number, value is the TextureUVMapping for the material
typedef std::map<uint32_t, TextureUVMapping> MaterialTextureUVMappings; typedef std::map<uint32_t, TextureUVMapping> MaterialTextureUVMappings;
MaterialTextureUVMappings matTexUvMappings; MaterialTextureUVMappings matTexUvMappings;
const uint32_t maxMat = static_cast<const uint32_t>(mesh->mat.size()); const uint32_t maxMat = static_cast<uint32_t>(mesh->mat.size());
for (uint32_t m = 0; m < maxMat; ++m) { for (uint32_t m = 0; m < maxMat; ++m) {
// get material by index // get material by index
const std::shared_ptr<Material> pMat = mesh->mat[m]; const std::shared_ptr<Material> pMat = mesh->mat[m];
@ -1375,4 +1288,55 @@ aiNode *BlenderImporter::ConvertNode(const Scene &in, const Object *obj, Convers
return node.release(); return node.release();
} }
BlenderImporter::StreamOrError BlenderImporter::ParseMagicToken(const std::string &pFile, IOSystem *pIOHandler) const {
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
if (stream == nullptr) {
return {{}, {}, "Could not open file for reading"};
}
char magic[8] = { 0 };
stream->Read(magic, 7, 1);
if (strcmp(magic, Token) == 0) {
return {stream, {}, {}};
}
// Check for presence of the gzip header. If yes, assume it is a
// compressed blend file and try uncompressing it, else fail. This is to
// avoid uncompressing random files which our loader might end up with.
#ifdef ASSIMP_BUILD_NO_COMPRESSED_BLEND
return {{}, {}, "BLENDER magic bytes are missing, is this file compressed (Assimp was built without decompression support)?"};
#else
if (magic[0] != 0x1f || static_cast<uint8_t>(magic[1]) != 0x8b) {
return {{}, {}, "BLENDER magic bytes are missing, couldn't find GZIP header either"};
}
LogDebug("Found no BLENDER magic word but a GZIP header, might be a compressed file");
if (magic[2] != 8) {
return {{}, {}, "Unsupported GZIP compression method"};
}
// http://www.gzip.org/zlib/rfc-gzip.html#header-trailer
stream->Seek(0L, aiOrigin_SET);
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
size_t total = 0;
Compression compression;
auto uncompressed = std::make_shared<std::vector<char>>();
if (compression.open(Compression::Format::Binary, Compression::FlushMode::NoFlush, 16 + Compression::MaxWBits)) {
total = compression.decompress((unsigned char *)reader->GetPtr(), reader->GetRemainingSize(), *uncompressed);
compression.close();
}
// replace the input stream with a memory stream
stream = std::make_shared<MemoryIOStream>(reinterpret_cast<uint8_t *>(uncompressed->data()), total);
// .. and retry
stream->Read(magic, 7, 1);
if (strcmp(magic, Token) == 0) {
return {stream, uncompressed, {}};
}
return {{}, {}, "Found no BLENDER magic word in decompressed GZIP file"};
#endif
}
#endif // ASSIMP_BUILD_NO_BLEND_IMPORTER #endif // ASSIMP_BUILD_NO_BLEND_IMPORTER

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -117,7 +117,7 @@ protected:
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr<IOStream> stream); void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr<IOStream> stream);
void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file); void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file);
void ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr<Blender::Collection> collection, Blender::ConversionData &conv_data); void ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr<Blender::Collection>& collection, Blender::ConversionData &conv_data);
void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file); void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file);
private: private:
@ -180,6 +180,19 @@ private:
const Blender::MTex *tex, const Blender::MTex *tex,
Blender::ConversionData &conv_data); Blender::ConversionData &conv_data);
// TODO: Move to a std::variant, once c++17 is supported.
struct StreamOrError {
std::shared_ptr<IOStream> stream;
std::shared_ptr<std::vector<char>> input;
std::string error;
};
// Returns either a stream (and optional input data for the stream) or
// an error if it can't parse the magic token.
StreamOrError ParseMagicToken(
const std::string &pFile,
IOSystem *pIOHandler) const;
private: // static stuff, mostly logging and error reporting. private: // static stuff, mostly logging and error reporting.
// -------------------- // --------------------
static void CheckActualType(const Blender::ElemBase *dt, static void CheckActualType(const Blender::ElemBase *dt,

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -71,10 +71,6 @@ static const fpCreateModifier creators[] = {
nullptr // sentinel nullptr // sentinel
}; };
// ------------------------------------------------------------------------------------------------
struct SharedModifierData : ElemBase {
ModifierData modifier;
};
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderModifierShowcase::ApplyModifiers(aiNode &out, ConversionData &conv_data, const Scene &in, const Object &orig_object) { void BlenderModifierShowcase::ApplyModifiers(aiNode &out, ConversionData &conv_data, const Scene &in, const Object &orig_object) {
@ -157,6 +153,7 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
// hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers() // hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers()
const MirrorModifierData &mir = static_cast<const MirrorModifierData &>(orig_modifier); const MirrorModifierData &mir = static_cast<const MirrorModifierData &>(orig_modifier);
ai_assert(mir.modifier.type == ModifierData::eModifierType_Mirror); ai_assert(mir.modifier.type == ModifierData::eModifierType_Mirror);
std::shared_ptr<Object> mirror_ob = mir.mirror_ob.lock();
conv_data.meshes->reserve(conv_data.meshes->size() + out.mNumMeshes); conv_data.meshes->reserve(conv_data.meshes->size() + out.mNumMeshes);
@ -171,8 +168,8 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
const float ys = mir.flag & MirrorModifierData::Flags_AXIS_Y ? -1.f : 1.f; const float ys = mir.flag & MirrorModifierData::Flags_AXIS_Y ? -1.f : 1.f;
const float zs = mir.flag & MirrorModifierData::Flags_AXIS_Z ? -1.f : 1.f; const float zs = mir.flag & MirrorModifierData::Flags_AXIS_Z ? -1.f : 1.f;
if (mir.mirror_ob) { if (mirror_ob) {
const aiVector3D center(mir.mirror_ob->obmat[3][0], mir.mirror_ob->obmat[3][1], mir.mirror_ob->obmat[3][2]); const aiVector3D center(mirror_ob->obmat[3][0], mirror_ob->obmat[3][1], mirror_ob->obmat[3][2]);
for (unsigned int j = 0; j < mesh->mNumVertices; ++j) { for (unsigned int j = 0; j < mesh->mNumVertices; ++j) {
aiVector3D &v = mesh->mVertices[j]; aiVector3D &v = mesh->mVertices[j];
@ -286,6 +283,11 @@ void BlenderModifier_Subdivision ::DoIt(aiNode &out, ConversionData &conv_data,
if (conv_data.meshes->empty()) { if (conv_data.meshes->empty()) {
return; return;
} }
const size_t meshIndex = conv_data.meshes->size() - out.mNumMeshes;
if (meshIndex >= conv_data.meshes->size()) {
ASSIMP_LOG_ERROR("Invalid index detected.");
return;
}
aiMesh **const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes]; aiMesh **const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
std::unique_ptr<aiMesh *[]> tempmeshes(new aiMesh *[out.mNumMeshes]()); std::unique_ptr<aiMesh *[]> tempmeshes(new aiMesh *[out.mNumMeshes]());

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -62,9 +62,7 @@ public:
/** /**
* The class destructor, virtual. * The class destructor, virtual.
*/ */
virtual ~BlenderModifier() { virtual ~BlenderModifier() = default;
// empty
}
// -------------------- // --------------------
/** /**

View File

@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderDNA.h" #include "BlenderDNA.h"
#include "BlenderSceneGen.h" #include "BlenderSceneGen.h"
using namespace Assimp; namespace Assimp {
using namespace Assimp::Blender; namespace Blender {
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
template <> template <>
@ -102,10 +102,6 @@ void Structure::Convert<CollectionObject>(
ReadFieldPtr<ErrorPolicy_Fail>(dest.next, "*next", db); ReadFieldPtr<ErrorPolicy_Fail>(dest.next, "*next", db);
{ {
//std::shared_ptr<CollectionObject> prev;
//ReadFieldPtr<ErrorPolicy_Fail>(prev, "*prev", db);
//dest.prev = prev.get();
std::shared_ptr<Object> ob; std::shared_ptr<Object> ob;
ReadFieldPtr<ErrorPolicy_Igno>(ob, "*ob", db); ReadFieldPtr<ErrorPolicy_Igno>(ob, "*ob", db);
dest.ob = ob.get(); dest.ob = ob.get();
@ -301,7 +297,7 @@ void Structure ::Convert<Base>(
const FileDatabase &db) const { const FileDatabase &db) const {
// note: as per https://github.com/assimp/assimp/issues/128, // note: as per https://github.com/assimp/assimp/issues/128,
// reading the Object linked list recursively is prone to stack overflow. // reading the Object linked list recursively is prone to stack overflow.
// This structure converter is therefore an hand-written exception that // This structure converter is therefore a hand-written exception that
// does it iteratively. // does it iteratively.
const int initial_pos = db.reader->GetCurrentPos(); const int initial_pos = db.reader->GetCurrentPos();
@ -569,7 +565,7 @@ void Structure ::Convert<MVert>(
const FileDatabase &db) const { const FileDatabase &db) const {
ReadFieldArray<ErrorPolicy_Fail>(dest.co, "co", db); ReadFieldArray<ErrorPolicy_Fail>(dest.co, "co", db);
ReadFieldArray<ErrorPolicy_Fail>(dest.no, "no", db); ReadFieldArray<ErrorPolicy_Warn>(dest.no, "no", db);
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db); ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
//ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db); //ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db);
ReadField<ErrorPolicy_Igno>(dest.bweight, "bweight", db); ReadField<ErrorPolicy_Igno>(dest.bweight, "bweight", db);
@ -624,7 +620,9 @@ void Structure ::Convert<ListBase>(
const FileDatabase &db) const { const FileDatabase &db) const {
ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db); ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.last, "*last", db); std::shared_ptr<ElemBase> last;
ReadFieldPtr<ErrorPolicy_Igno>(last, "*last", db);
dest.last = last;
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
@ -648,7 +646,9 @@ void Structure ::Convert<ModifierData>(
const FileDatabase &db) const { const FileDatabase &db) const {
ReadFieldPtr<ErrorPolicy_Warn>(dest.next, "*next", db); ReadFieldPtr<ErrorPolicy_Warn>(dest.next, "*next", db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.prev, "*prev", db); std::shared_ptr<ElemBase> prev;
ReadFieldPtr<ErrorPolicy_Warn>(prev, "*prev", db);
dest.prev = prev;
ReadField<ErrorPolicy_Igno>(dest.type, "type", db); ReadField<ErrorPolicy_Igno>(dest.type, "type", db);
ReadField<ErrorPolicy_Igno>(dest.mode, "mode", db); ReadField<ErrorPolicy_Igno>(dest.mode, "mode", db);
ReadFieldArray<ErrorPolicy_Igno>(dest.name, "name", db); ReadFieldArray<ErrorPolicy_Igno>(dest.name, "name", db);
@ -772,7 +772,9 @@ void Structure ::Convert<MirrorModifierData>(
ReadField<ErrorPolicy_Igno>(dest.axis, "axis", db); ReadField<ErrorPolicy_Igno>(dest.axis, "axis", db);
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db); ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Igno>(dest.tolerance, "tolerance", db); ReadField<ErrorPolicy_Igno>(dest.tolerance, "tolerance", db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mirror_ob, "*mirror_ob", db); std::shared_ptr<Object> mirror_ob;
ReadFieldPtr<ErrorPolicy_Igno>(mirror_ob, "*mirror_ob", db);
dest.mirror_ob = mirror_ob;
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
@ -833,9 +835,9 @@ void Structure::Convert<CustomDataLayer>(
ReadField<ErrorPolicy_Fail>(dest.flag, "flag", db); ReadField<ErrorPolicy_Fail>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Fail>(dest.active, "active", db); ReadField<ErrorPolicy_Fail>(dest.active, "active", db);
ReadField<ErrorPolicy_Fail>(dest.active_rnd, "active_rnd", db); ReadField<ErrorPolicy_Fail>(dest.active_rnd, "active_rnd", db);
ReadField<ErrorPolicy_Fail>(dest.active_clone, "active_clone", db); ReadField<ErrorPolicy_Warn>(dest.active_clone, "active_clone", db);
ReadField<ErrorPolicy_Fail>(dest.active_mask, "active_mask", db); ReadField<ErrorPolicy_Warn>(dest.active_mask, "active_mask", db);
ReadField<ErrorPolicy_Fail>(dest.uid, "uid", db); ReadField<ErrorPolicy_Warn>(dest.uid, "uid", db);
ReadFieldArray<ErrorPolicy_Warn>(dest.name, "name", db); ReadFieldArray<ErrorPolicy_Warn>(dest.name, "name", db);
ReadCustomDataPtr<ErrorPolicy_Fail>(dest.data, dest.type, "*data", db); ReadCustomDataPtr<ErrorPolicy_Fail>(dest.data, dest.type, "*data", db);
@ -885,4 +887,7 @@ void DNA::RegisterConverters() {
converters["CollectionObject"] = DNA::FactoryPair(&Structure::Allocate<CollectionObject>, &Structure::Convert<CollectionObject>); converters["CollectionObject"] = DNA::FactoryPair(&Structure::Allocate<CollectionObject>, &Structure::Convert<CollectionObject>);
} }
} // namespace Blender
} //namespace Assimp
#endif // ASSIMP_BUILD_NO_BLEND_IMPORTER #endif // ASSIMP_BUILD_NO_BLEND_IMPORTER

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -124,7 +124,7 @@ struct ID : ElemBase {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct ListBase : ElemBase { struct ListBase : ElemBase {
std::shared_ptr<ElemBase> first; std::shared_ptr<ElemBase> first;
std::shared_ptr<ElemBase> last; std::weak_ptr<ElemBase> last;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -182,7 +182,7 @@ struct MVert : ElemBase {
int bweight; int bweight;
MVert() : MVert() :
ElemBase(), flag(0), mat_nr(0), bweight(0) {} flag(0), mat_nr(0), bweight(0) {}
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -417,7 +417,6 @@ struct CustomDataLayer : ElemBase {
std::shared_ptr<ElemBase> data; // must be converted to real type according type member std::shared_ptr<ElemBase> data; // must be converted to real type according type member
CustomDataLayer() : CustomDataLayer() :
ElemBase(),
type(0), type(0),
offset(0), offset(0),
flag(0), flag(0),
@ -642,14 +641,21 @@ struct ModifierData : ElemBase {
}; };
std::shared_ptr<ElemBase> next WARN; std::shared_ptr<ElemBase> next WARN;
std::shared_ptr<ElemBase> prev WARN; std::weak_ptr<ElemBase> prev WARN;
int type, mode; int type, mode;
char name[32]; char name[32];
}; };
// ------------------------------------------------------------------------------------------------
struct SharedModifierData : ElemBase {
ModifierData modifier;
};
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct SubsurfModifierData : ElemBase { struct SubsurfModifierData : SharedModifierData {
enum Type { enum Type {
@ -662,7 +668,6 @@ struct SubsurfModifierData : ElemBase {
FLAGS_SubsurfUV = 1 << 3 FLAGS_SubsurfUV = 1 << 3
}; };
ModifierData modifier FAIL;
short subdivType WARN; short subdivType WARN;
short levels FAIL; short levels FAIL;
short renderLevels; short renderLevels;
@ -670,7 +675,7 @@ struct SubsurfModifierData : ElemBase {
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct MirrorModifierData : ElemBase { struct MirrorModifierData : SharedModifierData {
enum Flags { enum Flags {
Flags_CLIPPING = 1 << 0, Flags_CLIPPING = 1 << 0,
@ -682,11 +687,9 @@ struct MirrorModifierData : ElemBase {
Flags_VGROUP = 1 << 6 Flags_VGROUP = 1 << 6
}; };
ModifierData modifier FAIL;
short axis, flag; short axis, flag;
float tolerance; float tolerance;
std::shared_ptr<Object> mirror_ob; std::weak_ptr<Object> mirror_ob;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -725,7 +728,7 @@ struct Object : ElemBase {
ListBase modifiers; ListBase modifiers;
Object() : Object() :
ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() { type(Type_EMPTY), parent(nullptr) {
// empty // empty
} }
}; };
@ -737,8 +740,7 @@ struct Base : ElemBase {
std::shared_ptr<Object> object WARN; std::shared_ptr<Object> object WARN;
Base() : Base() :
ElemBase(), prev(nullptr), next(), object() { prev(nullptr) {
// empty
// empty // empty
} }
}; };
@ -754,10 +756,7 @@ struct Scene : ElemBase {
ListBase base; ListBase base;
Scene() : Scene() = default;
ElemBase(), camera(), world(), basact(), master_collection() {
// empty
}
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -787,10 +786,7 @@ struct Image : ElemBase {
short gen_x, gen_y, gen_type; short gen_x, gen_y, gen_type;
Image() : Image() = default;
ElemBase() {
// empty
}
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -880,7 +876,7 @@ struct Tex : ElemBase {
//char use_nodes; //char use_nodes;
Tex() : Tex() :
ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() { imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) {
// empty // empty
} }
}; };
@ -972,10 +968,7 @@ struct MTex : ElemBase {
//float shadowfac; //float shadowfac;
//float zenupfac, zendownfac, blendfac; //float zenupfac, zendownfac, blendfac;
MTex() : MTex() = default;
ElemBase() {
// empty
}
}; };
} // namespace Blender } // namespace Blender

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -40,10 +39,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file BlenderTessellator.cpp /// @file BlenderTessellator.cpp
* @brief A simple tessellation wrapper /// @brief A simple tessellation wrapper
*/
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER #ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
@ -62,8 +59,7 @@ namspace Assimp
{ {
template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix() template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix()
{ {
static auto prefix = "BLEND_TESS_GL: "; return "BLEND_TESS_GL: ";
return prefix;
} }
} }
@ -81,9 +77,7 @@ BlenderTessellatorGL::BlenderTessellatorGL( BlenderBMeshConverter& converter ):
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
BlenderTessellatorGL::~BlenderTessellatorGL( ) BlenderTessellatorGL::~BlenderTessellatorGL() = default;
{
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices ) void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )
@ -259,8 +253,7 @@ namespace Assimp
{ {
template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix() template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix()
{ {
static auto prefix = "BLEND_TESS_P2T: "; return "BLEND_TESS_P2T: ";
return prefix;
} }
} }
@ -274,9 +267,7 @@ BlenderTessellatorP2T::BlenderTessellatorP2T( BlenderBMeshConverter& converter )
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
BlenderTessellatorP2T::~BlenderTessellatorP2T( )
{
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderTessellatorP2T::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices ) void BlenderTessellatorP2T::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -144,11 +143,7 @@ namespace Assimp
#if ASSIMP_BLEND_WITH_POLY_2_TRI #if ASSIMP_BLEND_WITH_POLY_2_TRI
#ifdef ASSIMP_USE_HUNTER #include "contrib/poly2tri/poly2tri/poly2tri.h"
# include <poly2tri/poly2tri.h>
#else
# include "../contrib/poly2tri/poly2tri/poly2tri.h"
#endif
namespace Assimp namespace Assimp
{ {
@ -186,7 +181,7 @@ namespace Assimp
{ {
public: public:
BlenderTessellatorP2T( BlenderBMeshConverter& converter ); BlenderTessellatorP2T( BlenderBMeshConverter& converter );
~BlenderTessellatorP2T( ); ~BlenderTessellatorP2T( ) = default;
void Tessellate( const Blender::MLoop* polyLoop, int vertexCount, const std::vector< Blender::MVert >& vertices ); void Tessellate( const Blender::MLoop* polyLoop, int vertexCount, const std::vector< Blender::MVert >& vertices );

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 // no #ifdefing here, Cinema4D support is carried out in a branch of assimp
// where it is turned on in the CMake settings. // where it is turned on in the CMake settings.
#ifndef _MSC_VER
# error C4D support is currently MSVC only
#endif
#include "C4DImporter.h" #include "C4DImporter.h"
#include <memory> #include <memory>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
@ -86,8 +82,7 @@ void GetWriterInfo(int &id, String &appname) {
namespace Assimp { namespace Assimp {
template<> const char* LogFunctions<C4DImporter>::Prefix() { template<> const char* LogFunctions<C4DImporter>::Prefix() {
static auto prefix = "C4D: "; return "C4D: ";
return prefix;
} }
} }
@ -105,6 +100,12 @@ static const aiImporterDesc desc = {
}; };
// ------------------------------------------------------------------------------------------------
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); const std::string& extension = GetExtension(pFile);
@ -300,7 +301,7 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent) {
// based on Cineware sample code // based on Cineware sample code
while (object) { while (object) {
const LONG type = object->GetType(); const Int32 type = object->GetType();
const Matrix& ml = object->GetMl(); const Matrix& ml = object->GetMl();
aiNode* const nd = new aiNode(); aiNode* const nd = new aiNode();
@ -363,8 +364,8 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
PolygonObject* const polyObject = dynamic_cast<PolygonObject*>(object); PolygonObject* const polyObject = dynamic_cast<PolygonObject*>(object);
ai_assert(polyObject != nullptr); ai_assert(polyObject != nullptr);
const LONG pointCount = polyObject->GetPointCount(); const Int32 pointCount = polyObject->GetPointCount();
const LONG polyCount = polyObject->GetPolygonCount(); const Int32 polyCount = polyObject->GetPolygonCount();
if(!polyObject || !pointCount) { if(!polyObject || !pointCount) {
LogWarn("ignoring mesh with zero vertices or faces"); LogWarn("ignoring mesh with zero vertices or faces");
return nullptr; return nullptr;
@ -386,7 +387,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
unsigned int vcount = 0; unsigned int vcount = 0;
// first count vertices // first count vertices
for (LONG i = 0; i < polyCount; i++) for (Int32 i = 0; i < polyCount; i++)
{ {
vcount += 3; vcount += 3;
@ -429,7 +430,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
} }
// copy vertices and extra channels over and populate faces // 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); ai_assert(polys[i].a < pointCount && polys[i].a >= 0);
const Vector& pointA = points[polys[i].a]; const Vector& pointA = points[polys[i].a];
verts->x = pointA.x; verts->x = pointA.x;
@ -506,7 +507,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
if (tangents_src) { if (tangents_src) {
for(unsigned int k = 0; k < face->mNumIndices; ++k) { for(unsigned int k = 0; k < face->mNumIndices; ++k) {
LONG l; Int32 l;
switch(k) { switch(k) {
case 0: case 0:
l = polys[i].a; l = polys[i].a;

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -61,11 +61,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory> #include <memory>
using namespace Assimp; namespace Assimp {
using namespace Assimp::COB; using namespace Assimp::COB;
using namespace Assimp::Formatter; using namespace Assimp::Formatter;
static const float units[] = { static constexpr float units[] = {
1000.f, 1000.f,
100.f, 100.f,
1.f, 1.f,
@ -76,7 +76,7 @@ static const float units[] = {
1.f / 1609.344f 1.f / 1609.344f
}; };
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"TrueSpace Object Importer", "TrueSpace Object Importer",
"", "",
"", "",
@ -89,31 +89,11 @@ static const aiImporterDesc desc = {
"cob scn" "cob scn"
}; };
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
COBImporter::COBImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
COBImporter::~COBImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool COBImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { bool COBImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
const std::string &extension = GetExtension(pFile); static const char *tokens[] = { "Caligary" };
if (extension == "cob" || extension == "scn" || extension == "COB" || extension == "SCN") { return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
return true;
}
else if ((!extension.length() || checkSig) && pIOHandler) {
static const char * const tokens[] = { "Caligary" };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -170,7 +150,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// sort faces by material indices // sort faces by material indices
for (std::shared_ptr<Node> &n : scene.nodes) { for (std::shared_ptr<Node> &n : scene.nodes) {
if (n->type == Node::TYPE_MESH) { if (n->type == Node::TYPE_MESH) {
Mesh &mesh = (Mesh &)(*n.get()); Mesh &mesh = (Mesh &)(*n);
for (Face &f : mesh.faces) { for (Face &f : mesh.faces) {
mesh.temp_map[f.material].push_back(&f); mesh.temp_map[f.material].push_back(&f);
} }
@ -180,7 +160,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// count meshes // count meshes
for (std::shared_ptr<Node> &n : scene.nodes) { for (std::shared_ptr<Node> &n : scene.nodes) {
if (n->type == Node::TYPE_MESH) { if (n->type == Node::TYPE_MESH) {
Mesh &mesh = (Mesh &)(*n.get()); Mesh &mesh = (Mesh &)(*n);
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) { if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
pScene->mNumMeshes += static_cast<unsigned int>(mesh.temp_map.size()); pScene->mNumMeshes += static_cast<unsigned int>(mesh.temp_map.size());
} }
@ -223,7 +203,7 @@ void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
} }
} }
pScene->mRootNode = BuildNodes(*root.get(), scene, pScene); pScene->mRootNode = BuildNodes(*root, scene, pScene);
//flip normals after import //flip normals after import
FlipWindingOrderProcess flip; FlipWindingOrderProcess flip;
flip.Execute(pScene); flip.Execute(pScene);
@ -392,10 +372,12 @@ aiNode *COBImporter::BuildNodes(const Node &root, const Scene &scin, aiScene *fi
} }
// add children recursively // add children recursively
if (!root.temp_children.empty()) {
nd->mChildren = new aiNode *[root.temp_children.size()](); nd->mChildren = new aiNode *[root.temp_children.size()]();
for (const Node *n : root.temp_children) { for (const Node *n : root.temp_children) {
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n, scin, fill))->mParent = nd; (nd->mChildren[nd->mNumChildren++] = BuildNodes(*n, scin, fill))->mParent = nd;
} }
}
return nd; return nd;
} }
@ -493,8 +475,9 @@ void COBImporter::ReadBasicNodeInfo_Ascii(Node &msh, LineSplitter &splitter, con
} else if (splitter.match_start("Transform")) { } else if (splitter.match_start("Transform")) {
for (unsigned int y = 0; y < 4 && ++splitter; ++y) { for (unsigned int y = 0; y < 4 && ++splitter; ++y) {
const char *s = splitter->c_str(); const char *s = splitter->c_str();
const char *end = s + splitter->size();
for (unsigned int x = 0; x < 4; ++x) { for (unsigned int x = 0; x < 4; ++x) {
SkipSpaces(&s); SkipSpaces(&s, end);
msh.transform[y][x] = fast_atof(&s); msh.transform[y][x] = fast_atof(&s);
} }
} }
@ -506,12 +489,12 @@ void COBImporter::ReadBasicNodeInfo_Ascii(Node &msh, LineSplitter &splitter, con
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
void COBImporter::ReadFloat3Tuple_Ascii(T &fill, const char **in) { void COBImporter::ReadFloat3Tuple_Ascii(T &fill, const char **in, const char *end) {
const char *rgb = *in; const char *rgb = *in;
for (unsigned int i = 0; i < 3; ++i) { for (unsigned int i = 0; i < 3; ++i) {
SkipSpaces(&rgb); SkipSpaces(&rgb, end);
if (*rgb == ',') ++rgb; if (*rgb == ',') ++rgb;
SkipSpaces(&rgb); SkipSpaces(&rgb, end);
fill[i] = fast_atof(&rgb); fill[i] = fast_atof(&rgb);
} }
@ -530,7 +513,7 @@ void COBImporter::ReadMat1_Ascii(Scene &out, LineSplitter &splitter, const Chunk
return; return;
} }
out.materials.push_back(Material()); out.materials.emplace_back();
Material &mat = out.materials.back(); Material &mat = out.materials.back();
mat = nfo; mat = nfo;
@ -558,7 +541,7 @@ void COBImporter::ReadMat1_Ascii(Scene &out, LineSplitter &splitter, const Chunk
} }
const char *rgb = splitter[1]; const char *rgb = splitter[1];
ReadFloat3Tuple_Ascii(mat.rgb, &rgb); ReadFloat3Tuple_Ascii(mat.rgb, &rgb, splitter.getEnd());
++splitter; ++splitter;
if (!splitter.match_start("alpha ")) { if (!splitter.match_start("alpha ")) {
@ -637,20 +620,21 @@ void COBImporter::ReadLght_Ascii(Scene &out, LineSplitter &splitter, const Chunk
} }
const char *rgb = splitter[1]; const char *rgb = splitter[1];
ReadFloat3Tuple_Ascii(msh.color, &rgb); const char *end = splitter.getEnd();
ReadFloat3Tuple_Ascii(msh.color, &rgb, end);
SkipSpaces(&rgb); SkipSpaces(&rgb, end);
if (strncmp(rgb, "cone angle", 10) != 0) { if (strncmp(rgb, "cone angle", 10) != 0) {
ASSIMP_LOG_WARN("Expected `cone angle` entity in `color` line in `Lght` chunk ", nfo.id); ASSIMP_LOG_WARN("Expected `cone angle` entity in `color` line in `Lght` chunk ", nfo.id);
} }
SkipSpaces(rgb + 10, &rgb); SkipSpaces(rgb + 10, &rgb, end);
msh.angle = fast_atof(&rgb); msh.angle = fast_atof(&rgb);
SkipSpaces(&rgb); SkipSpaces(&rgb, end);
if (strncmp(rgb, "inner angle", 11) != 0) { if (strncmp(rgb, "inner angle", 11) != 0) {
ASSIMP_LOG_WARN("Expected `inner angle` entity in `color` line in `Lght` chunk ", nfo.id); ASSIMP_LOG_WARN("Expected `inner angle` entity in `color` line in `Lght` chunk ", nfo.id);
} }
SkipSpaces(rgb + 11, &rgb); SkipSpaces(rgb + 11, &rgb, end);
msh.inner_angle = fast_atof(&rgb); msh.inner_angle = fast_atof(&rgb);
// skip the rest for we can't handle this kind of physically-based lighting information. // skip the rest for we can't handle this kind of physically-based lighting information.
@ -723,14 +707,14 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
for (unsigned int cur = 0; cur < cnt && ++splitter; ++cur) { for (unsigned int cur = 0; cur < cnt && ++splitter; ++cur) {
const char *s = splitter->c_str(); const char *s = splitter->c_str();
const char *end = splitter.getEnd();
aiVector3D &v = msh.vertex_positions[cur]; aiVector3D &v = msh.vertex_positions[cur];
SkipSpaces(&s); SkipSpaces(&s, end);
v.x = fast_atof(&s); v.x = fast_atof(&s);
SkipSpaces(&s); SkipSpaces(&s, end);
v.y = fast_atof(&s); v.y = fast_atof(&s);
SkipSpaces(&s); SkipSpaces(&s, end);
v.z = fast_atof(&s); v.z = fast_atof(&s);
} }
} else if (splitter.match_start("Texture Vertices")) { } else if (splitter.match_start("Texture Vertices")) {
@ -739,12 +723,13 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
for (unsigned int cur = 0; cur < cnt && ++splitter; ++cur) { for (unsigned int cur = 0; cur < cnt && ++splitter; ++cur) {
const char *s = splitter->c_str(); const char *s = splitter->c_str();
const char *end = splitter.getEnd();
aiVector2D &v = msh.texture_coords[cur]; aiVector2D &v = msh.texture_coords[cur];
SkipSpaces(&s); SkipSpaces(&s, end);
v.x = fast_atof(&s); v.x = fast_atof(&s);
SkipSpaces(&s); SkipSpaces(&s, end);
v.y = fast_atof(&s); v.y = fast_atof(&s);
} }
} else if (splitter.match_start("Faces")) { } else if (splitter.match_start("Faces")) {
@ -761,7 +746,7 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
ThrowException("Expected Face line"); ThrowException("Expected Face line");
} }
msh.faces.push_back(Face()); msh.faces.emplace_back();
Face &face = msh.faces.back(); Face &face = msh.faces.back();
face.indices.resize(strtoul10(splitter[2])); face.indices.resize(strtoul10(splitter[2]));
@ -769,8 +754,9 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
face.material = strtoul10(splitter[6]); face.material = strtoul10(splitter[6]);
const char *s = (++splitter)->c_str(); const char *s = (++splitter)->c_str();
const char *end = splitter.getEnd();
for (size_t i = 0; i < face.indices.size(); ++i) { for (size_t i = 0; i < face.indices.size(); ++i) {
if (!SkipSpaces(&s)) { if (!SkipSpaces(&s, end)) {
ThrowException("Expected EOL token in Face entry"); ThrowException("Expected EOL token in Face entry");
} }
if ('<' != *s++) { if ('<' != *s++) {
@ -880,7 +866,7 @@ void COBImporter::ReadBinaryFile(Scene &out, StreamReaderLE *reader) {
return; return;
} }
while (1) { while (true) {
std::string type; std::string type;
type += reader->GetI1(); type += reader->GetI1();
type += reader->GetI1(); type += reader->GetI1();
@ -964,7 +950,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const
ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id); ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id);
} }
} else } else
msh.faces.push_back(Face()); msh.faces.emplace_back();
Face &f = msh.faces.back(); Face &f = msh.faces.back();
const size_t num = reader.GetI2(); const size_t num = reader.GetI2();
@ -976,7 +962,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const
} }
for (size_t x = 0; x < num; ++x) { for (size_t x = 0; x < num; ++x) {
f.indices.push_back(VertexIndex()); f.indices.emplace_back();
VertexIndex &v = f.indices.back(); VertexIndex &v = f.indices.back();
v.pos_idx = reader.GetI4(); v.pos_idx = reader.GetI4();
@ -1016,7 +1002,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
const chunk_guard cn(nfo, reader); const chunk_guard cn(nfo, reader);
out.materials.push_back(Material()); out.materials.emplace_back();
Material &mat = out.materials.back(); Material &mat = out.materials.back();
mat = nfo; mat = nfo;
@ -1066,7 +1052,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
id[0] = reader.GetI1(), id[1] = reader.GetI1(); id[0] = reader.GetI1(), id[1] = reader.GetI1();
if (id[0] == 'e' && id[1] == ':') { if (id[0] == 'e' && id[1] == ':') {
mat.tex_env.reset(new Texture()); mat.tex_env = std::make_shared<Texture>();
reader.GetI1(); reader.GetI1();
ReadString_Binary(mat.tex_env->path, reader); ReadString_Binary(mat.tex_env->path, reader);
@ -1076,7 +1062,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
} }
if (id[0] == 't' && id[1] == ':') { if (id[0] == 't' && id[1] == ':') {
mat.tex_color.reset(new Texture()); mat.tex_color = std::make_shared<Texture>();
reader.GetI1(); reader.GetI1();
ReadString_Binary(mat.tex_color->path, reader); ReadString_Binary(mat.tex_color->path, reader);
@ -1092,7 +1078,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
} }
if (id[0] == 'b' && id[1] == ':') { if (id[0] == 'b' && id[1] == ':') {
mat.tex_bump.reset(new Texture()); mat.tex_bump = std::make_shared<Texture>();
reader.GetI1(); reader.GetI1();
ReadString_Binary(mat.tex_bump->path, reader); ReadString_Binary(mat.tex_bump->path, reader);
@ -1184,4 +1170,6 @@ void COBImporter::ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const
ASSIMP_LOG_WARN("`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist"); ASSIMP_LOG_WARN("`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
} }
}
#endif // ASSIMP_BUILD_NO_COB_IMPORTER #endif // ASSIMP_BUILD_NO_COB_IMPORTER

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -56,16 +56,16 @@ class LineSplitter;
// TinyFormatter.h // TinyFormatter.h
namespace Formatter { namespace Formatter {
template <typename T, typename TR, typename A> template <typename T, typename TR, typename A>
class basic_formatter; class basic_formatter;
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format; typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
} // namespace Formatter } // namespace Formatter
// COBScene.h // COBScene.h
namespace COB { namespace COB {
struct ChunkInfo; struct ChunkInfo;
struct Node; struct Node;
struct Scene; struct Scene;
} // namespace COB } // namespace COB
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
@ -75,8 +75,8 @@ struct Scene;
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
class COBImporter : public BaseImporter { class COBImporter : public BaseImporter {
public: public:
COBImporter(); COBImporter() = default;
~COBImporter() override; ~COBImporter() override = default;
// -------------------- // --------------------
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
@ -120,7 +120,7 @@ private:
void ReadChunkInfo_Ascii(COB::ChunkInfo &out, const LineSplitter &splitter); void ReadChunkInfo_Ascii(COB::ChunkInfo &out, const LineSplitter &splitter);
void ReadBasicNodeInfo_Ascii(COB::Node &msh, LineSplitter &splitter, const COB::ChunkInfo &nfo); void ReadBasicNodeInfo_Ascii(COB::Node &msh, LineSplitter &splitter, const COB::ChunkInfo &nfo);
template <typename T> template <typename T>
void ReadFloat3Tuple_Ascii(T &fill, const char **in); void ReadFloat3Tuple_Ascii(T &fill, const char **in, const char *end);
void ReadPolH_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo); void ReadPolH_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
void ReadBitM_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo); void ReadBitM_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -107,7 +107,7 @@ struct Node : public ChunkInfo
TYPE_MESH,TYPE_GROUP,TYPE_LIGHT,TYPE_CAMERA,TYPE_BONE TYPE_MESH,TYPE_GROUP,TYPE_LIGHT,TYPE_CAMERA,TYPE_BONE
}; };
virtual ~Node() {} virtual ~Node() = default;
Node(Type type) : type(type), unit_scale(1.f){} Node(Type type) : type(type), unit_scale(1.f){}
Type type; Type type;

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
@ -44,9 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file CSMLoader.cpp /** @file CSMLoader.cpp
* Implementation of the CSM importer class. * Implementation of the CSM importer class.
*/ */
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER #ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
#include "CSMLoader.h" #include "CSMLoader.h"
@ -63,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp; using namespace Assimp;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"CharacterStudio Motion Importer (MoCap)", "CharacterStudio Motion Importer (MoCap)",
"", "",
"", "",
@ -79,43 +76,26 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
CSMImporter::CSMImporter() CSMImporter::CSMImporter() : noSkeletonMesh(){
: noSkeletonMesh() // empty
{} }
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
CSMImporter::~CSMImporter()
{}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const {
{ static const char* tokens[] = {"$Filename"};
// check file extension return SearchFileHeaderForToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens));
const std::string extension = GetExtension(pFile);
if( extension == "csm")
return true;
if ((checkSig || !extension.length()) && pIOHandler) {
static const char * const tokens[] = {"$Filename"};
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Build a string of all file extensions supported // Build a string of all file extensions supported
const aiImporterDesc* CSMImporter::GetInfo () const const aiImporterDesc* CSMImporter::GetInfo () const {
{
return &desc; return &desc;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Setup configuration properties for the loader // Setup configuration properties for the loader
void CSMImporter::SetupProperties(const Importer* pImp) void CSMImporter::SetupProperties(const Importer* pImp) {
{
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0; noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
} }
@ -127,7 +107,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb")); std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
// Check whether we can read from the file // Check whether we can read from the file
if( file.get() == nullptr) { if (file == nullptr) {
throw DeadlyImportError( "Failed to open CSM file ", pFile, "."); throw DeadlyImportError( "Failed to open CSM file ", pFile, ".");
} }
@ -135,38 +115,38 @@ void CSMImporter::InternReadFile( const std::string& pFile,
std::vector<char> mBuffer2; std::vector<char> mBuffer2;
TextFileToBuffer(file.get(),mBuffer2); TextFileToBuffer(file.get(),mBuffer2);
const char* buffer = &mBuffer2[0]; const char* buffer = &mBuffer2[0];
const char *end = &mBuffer2[mBuffer2.size() - 1] + 1;
std::unique_ptr<aiAnimation> anim(new aiAnimation()); std::unique_ptr<aiAnimation> anim(new aiAnimation());
int first = 0, last = 0x00ffffff; int first = 0, last = 0x00ffffff;
// now process the file and look out for '$' sections // now process the file and look out for '$' sections
while (1) { while (true) {
SkipSpaces(&buffer); SkipSpaces(&buffer, end);
if ('\0' == *buffer) if ('\0' == *buffer)
break; break;
if ('$' == *buffer) { if ('$' == *buffer) {
++buffer; ++buffer;
if (TokenMatchI(buffer,"firstframe",10)) { if (TokenMatchI(buffer,"firstframe",10)) {
SkipSpaces(&buffer); SkipSpaces(&buffer, end);
first = strtol10(buffer,&buffer); first = strtol10(buffer,&buffer);
} }
else if (TokenMatchI(buffer,"lastframe",9)) { else if (TokenMatchI(buffer,"lastframe",9)) {
SkipSpaces(&buffer); SkipSpaces(&buffer, end);
last = strtol10(buffer,&buffer); last = strtol10(buffer,&buffer);
} }
else if (TokenMatchI(buffer,"rate",4)) { else if (TokenMatchI(buffer,"rate",4)) {
SkipSpaces(&buffer); SkipSpaces(&buffer, end);
float d; float d = { 0.0f };
buffer = fast_atoreal_move<float>(buffer,d); buffer = fast_atoreal_move<float>(buffer,d);
anim->mTicksPerSecond = d; anim->mTicksPerSecond = d;
} }
else if (TokenMatchI(buffer,"order",5)) { else if (TokenMatchI(buffer,"order",5)) {
std::vector< aiNodeAnim* > anims_temp; std::vector< aiNodeAnim* > anims_temp;
anims_temp.reserve(30); anims_temp.reserve(30);
while (1) { while (true) {
SkipSpaces(&buffer); SkipSpaces(&buffer, end);
if (IsLineEnd(*buffer) && SkipSpacesAndLineEnd(&buffer) && *buffer == '$') if (IsLineEnd(*buffer) && SkipSpacesAndLineEnd(&buffer, end) && *buffer == '$')
break; // next section break; // next section
// Construct a new node animation channel and setup its name // Construct a new node animation channel and setup its name
@ -174,41 +154,43 @@ void CSMImporter::InternReadFile( const std::string& pFile,
aiNodeAnim* nda = anims_temp.back(); aiNodeAnim* nda = anims_temp.back();
char* ot = nda->mNodeName.data; char* ot = nda->mNodeName.data;
while (!IsSpaceOrNewLine(*buffer)) while (!IsSpaceOrNewLine(*buffer)) {
*ot++ = *buffer++; *ot++ = *buffer++;
}
*ot = '\0'; *ot = '\0';
nda->mNodeName.length = static_cast<ai_uint32>(ot-nda->mNodeName.data); nda->mNodeName.length = static_cast<ai_uint32>(ot-nda->mNodeName.data);
} }
anim->mNumChannels = static_cast<unsigned int>(anims_temp.size()); anim->mNumChannels = static_cast<unsigned int>(anims_temp.size());
if (!anim->mNumChannels) if (!anim->mNumChannels) {
throw DeadlyImportError("CSM: Empty $order section"); throw DeadlyImportError("CSM: Empty $order section");
}
// copy over to the output animation // copy over to the output animation
anim->mChannels = new aiNodeAnim*[anim->mNumChannels]; anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
::memcpy(anim->mChannels,&anims_temp[0],sizeof(aiNodeAnim*)*anim->mNumChannels); ::memcpy(anim->mChannels,&anims_temp[0],sizeof(aiNodeAnim*)*anim->mNumChannels);
} } else if (TokenMatchI(buffer,"points",6)) {
else if (TokenMatchI(buffer,"points",6)) { if (!anim->mNumChannels) {
if (!anim->mNumChannels)
throw DeadlyImportError("CSM: \'$order\' section is required to appear prior to \'$points\'"); throw DeadlyImportError("CSM: \'$order\' section is required to appear prior to \'$points\'");
}
// If we know how many frames we'll read, we can preallocate some storage // If we know how many frames we'll read, we can preallocate some storage
unsigned int alloc = 100; unsigned int alloc = 100;
if (last != 0x00ffffff) if (last != 0x00ffffff) {
{
alloc = last-first; alloc = last-first;
alloc += alloc>>2u; // + 25% alloc += alloc>>2u; // + 25%
for (unsigned int i = 0; i < anim->mNumChannels;++i) for (unsigned int i = 0; i < anim->mNumChannels; ++i) {
anim->mChannels[i]->mPositionKeys = new aiVectorKey[alloc]; anim->mChannels[i]->mPositionKeys = new aiVectorKey[alloc];
} }
}
unsigned int filled = 0; unsigned int filled = 0;
// Now read all point data. // Now read all point data.
while (1) { while (true) {
SkipSpaces(&buffer); SkipSpaces(&buffer, end);
if (IsLineEnd(*buffer) && (!SkipSpacesAndLineEnd(&buffer) || *buffer == '$')) { if (IsLineEnd(*buffer) && (!SkipSpacesAndLineEnd(&buffer, end) || *buffer == '$')) {
break; // next section break; // next section
} }
@ -219,8 +201,8 @@ void CSMImporter::InternReadFile( const std::string& pFile,
for (unsigned int i = 0; i < anim->mNumChannels;++i) { for (unsigned int i = 0; i < anim->mNumChannels;++i) {
aiNodeAnim* s = anim->mChannels[i]; aiNodeAnim* s = anim->mChannels[i];
if (s->mNumPositionKeys == alloc) { /* need to reallocate? */ if (s->mNumPositionKeys == alloc) {
// need to reallocate?
aiVectorKey* old = s->mPositionKeys; aiVectorKey* old = s->mPositionKeys;
s->mPositionKeys = new aiVectorKey[s->mNumPositionKeys = alloc*2]; s->mPositionKeys = new aiVectorKey[s->mNumPositionKeys = alloc*2];
::memcpy(s->mPositionKeys,old,sizeof(aiVectorKey)*alloc); ::memcpy(s->mPositionKeys,old,sizeof(aiVectorKey)*alloc);
@ -228,24 +210,26 @@ void CSMImporter::InternReadFile( const std::string& pFile,
} }
// read x,y,z // read x,y,z
if(!SkipSpacesAndLineEnd(&buffer)) if (!SkipSpacesAndLineEnd(&buffer, end)) {
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample x coord"); throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample x coord");
}
if (TokenMatchI(buffer, "DROPOUT", 7)) { if (TokenMatchI(buffer, "DROPOUT", 7)) {
// seems this is invalid marker data; at least the doc says it's possible // seems this is invalid marker data; at least the doc says it's possible
ASSIMP_LOG_WARN("CSM: Encountered invalid marker data (DROPOUT)"); ASSIMP_LOG_WARN("CSM: Encountered invalid marker data (DROPOUT)");
} } else {
else {
aiVectorKey* sub = s->mPositionKeys + s->mNumPositionKeys; aiVectorKey* sub = s->mPositionKeys + s->mNumPositionKeys;
sub->mTime = (double)frame; sub->mTime = (double)frame;
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.x); buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.x);
if(!SkipSpacesAndLineEnd(&buffer)) if (!SkipSpacesAndLineEnd(&buffer, end)) {
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample y coord"); throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample y coord");
}
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.y); buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.y);
if(!SkipSpacesAndLineEnd(&buffer)) if (!SkipSpacesAndLineEnd(&buffer, end)) {
throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample z coord"); throw DeadlyImportError("CSM: Unexpected EOF occurred reading sample z coord");
}
buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.z); buffer = fast_atoreal_move<float>(buffer, (float&)sub->mValue.z);
++s->mNumPositionKeys; ++s->mNumPositionKeys;
@ -253,22 +237,22 @@ void CSMImporter::InternReadFile( const std::string& pFile,
} }
// update allocation granularity // update allocation granularity
if (filled == alloc) if (filled == alloc) {
alloc *= 2; alloc *= 2;
}
++filled; ++filled;
} }
// all channels must be complete in order to continue safely. // all channels must be complete in order to continue safely.
for (unsigned int i = 0; i < anim->mNumChannels;++i) { for (unsigned int i = 0; i < anim->mNumChannels;++i) {
if (!anim->mChannels[i]->mNumPositionKeys) {
if (!anim->mChannels[i]->mNumPositionKeys)
throw DeadlyImportError("CSM: Invalid marker track"); throw DeadlyImportError("CSM: Invalid marker track");
} }
} }
} }
else { } else {
// advance to the next line // advance to the next line
SkipLine(&buffer); SkipLine(&buffer, end);
} }
} }

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -61,7 +61,7 @@ namespace Assimp {
class CSMImporter : public BaseImporter { class CSMImporter : public BaseImporter {
public: public:
CSMImporter(); CSMImporter();
~CSMImporter() override; ~CSMImporter() override = default;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
@ -81,9 +81,8 @@ protected:
private: private:
bool noSkeletonMesh; bool noSkeletonMesh;
}; // end of class CSMImporter };
} // end of namespace Assimp } // namespace Assimp
#endif // AI_AC3DIMPORTER_H_INC #endif // AI_AC3DIMPORTER_H_INC

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -91,7 +91,7 @@ void ExportSceneCollada(const char *pFile, IOSystem *pIOSystem, const aiScene *p
// Encodes a string into a valid XML ID using the xsd:ID schema qualifications. // Encodes a string into a valid XML ID using the xsd:ID schema qualifications.
static const std::string XMLIDEncode(const std::string &name) { static const std::string XMLIDEncode(const std::string &name) {
const char XML_ID_CHARS[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-."; const char XML_ID_CHARS[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.";
const unsigned int XML_ID_CHARS_COUNT = sizeof(XML_ID_CHARS) / sizeof(char); const unsigned int XML_ID_CHARS_COUNT = sizeof(XML_ID_CHARS) / sizeof(char) - 1;
if (name.length() == 0) { if (name.length() == 0) {
return name; return name;
@ -154,8 +154,7 @@ ColladaExporter::ColladaExporter(const aiScene *pScene, IOSystem *pIOSystem, con
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor // Destructor
ColladaExporter::~ColladaExporter() { ColladaExporter::~ColladaExporter() = default;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Starts writing the contents // Starts writing the contents
@ -247,7 +246,7 @@ void ColladaExporter::WriteHeader() {
} }
// Assimp root nodes can have meshes, Collada Scenes cannot // Assimp root nodes can have meshes, Collada Scenes cannot
if (mScene->mRootNode->mNumChildren == 0 || mScene->mRootNode->mMeshes != 0) { if (mScene->mRootNode->mNumChildren == 0 || mScene->mRootNode->mMeshes != nullptr) {
mAdd_root_node = true; mAdd_root_node = true;
} }
@ -449,7 +448,7 @@ void ColladaExporter::WriteLight(size_t pIndex) {
PushTag(); PushTag();
switch (light->mType) { switch (light->mType) {
case aiLightSource_AMBIENT: case aiLightSource_AMBIENT:
WriteAmbienttLight(light); WriteAmbientLight(light);
break; break;
case aiLightSource_DIRECTIONAL: case aiLightSource_DIRECTIONAL:
WriteDirectionalLight(light); WriteDirectionalLight(light);
@ -544,7 +543,7 @@ void ColladaExporter::WriteSpotLight(const aiLight *const light) {
mOutput << startstr << "</spot>" << endstr; mOutput << startstr << "</spot>" << endstr;
} }
void ColladaExporter::WriteAmbienttLight(const aiLight *const light) { void ColladaExporter::WriteAmbientLight(const aiLight *const light) {
const aiColor3D &color = light->mColorAmbient; const aiColor3D &color = light->mColorAmbient;
mOutput << startstr << "<ambient>" << endstr; mOutput << startstr << "<ambient>" << endstr;
@ -1330,9 +1329,9 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex) {
std::vector<std::string> names; std::vector<std::string> names;
for (size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) { for (size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
if (nodeAnim->mPreState == aiAnimBehaviour_DEFAULT || nodeAnim->mPreState == aiAnimBehaviour_LINEAR || nodeAnim->mPreState == aiAnimBehaviour_REPEAT) { if (nodeAnim->mPreState == aiAnimBehaviour_DEFAULT || nodeAnim->mPreState == aiAnimBehaviour_LINEAR || nodeAnim->mPreState == aiAnimBehaviour_REPEAT) {
names.push_back("LINEAR"); names.emplace_back("LINEAR");
} else if (nodeAnim->mPostState == aiAnimBehaviour_CONSTANT) { } else if (nodeAnim->mPostState == aiAnimBehaviour_CONSTANT) {
names.push_back("STEP"); names.emplace_back("STEP");
} }
} }

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -101,7 +101,7 @@ protected:
void WritePointLight(const aiLight *const light); void WritePointLight(const aiLight *const light);
void WriteDirectionalLight(const aiLight *const light); void WriteDirectionalLight(const aiLight *const light);
void WriteSpotLight(const aiLight *const light); void WriteSpotLight(const aiLight *const light);
void WriteAmbienttLight(const aiLight *const light); void WriteAmbientLight(const aiLight *const light);
/// Writes the controller library /// Writes the controller library
void WriteControllerLibrary(); void WriteControllerLibrary();
@ -233,7 +233,7 @@ public:
Surface ambient, diffuse, specular, emissive, reflective, transparent, normal; Surface ambient, diffuse, specular, emissive, reflective, transparent, normal;
Property shininess, transparency, index_refraction; Property shininess, transparency, index_refraction;
Material() {} Material() = default;
}; };
std::map<unsigned int, std::string> textures; std::map<unsigned int, std::string> textures;

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -621,6 +621,11 @@ struct Animation {
for (std::vector<Animation *>::iterator it = pParent->mSubAnims.begin(); it != pParent->mSubAnims.end();) { for (std::vector<Animation *>::iterator it = pParent->mSubAnims.begin(); it != pParent->mSubAnims.end();) {
Animation *anim = *it; Animation *anim = *it;
// Assign the first animation name to the parent if empty.
// This prevents the animation name from being lost when animations are combined
if (mName.empty()) {
mName = anim->mName;
}
CombineSingleChannelAnimationsRecursively(anim); CombineSingleChannelAnimationsRecursively(anim);
if (childrenAnimationsHaveDifferentChannels && anim->mChannels.size() == 1 && if (childrenAnimationsHaveDifferentChannels && anim->mChannels.size() == 1 &&
@ -661,7 +666,7 @@ struct ChannelEntry {
const Collada::Accessor *mTimeAccessor; ///> Collada accessor to the time values const Collada::Accessor *mTimeAccessor; ///> Collada accessor to the time values
const Collada::Data *mTimeData; ///> Source data array for the time values const Collada::Data *mTimeData; ///> Source data array for the time values
const Collada::Accessor *mValueAccessor; ///> Collada accessor to the key value values const Collada::Accessor *mValueAccessor; ///> Collada accessor to the key value values
const Collada::Data *mValueData; ///> Source datat array for the key value values const Collada::Data *mValueData; ///> Source data array for the key value values
ChannelEntry() : ChannelEntry() :
mChannel(), mChannel(),

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -64,7 +64,7 @@ namespace Assimp {
using namespace Assimp::Formatter; using namespace Assimp::Formatter;
using namespace Assimp::Collada; using namespace Assimp::Collada;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"Collada Importer", "Collada Importer",
"", "",
"", "",
@ -92,67 +92,34 @@ inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
ColladaLoader::ColladaLoader() : ColladaLoader::ColladaLoader() :
mFileName(),
mMeshIndexByID(),
mMaterialIndexByName(),
mMeshes(),
newMats(),
mCameras(),
mLights(),
mTextures(),
mAnims(),
noSkeletonMesh(false), noSkeletonMesh(false),
removeEmptyBones(false),
ignoreUpDirection(false), ignoreUpDirection(false),
ignoreUnitSize(false),
useColladaName(false), useColladaName(false),
mNodeNameCounter(0) { mNodeNameCounter(0) {
// empty // empty
} }
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
ColladaLoader::~ColladaLoader() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool ColladaLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { bool ColladaLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
// check file extension
const std::string extension = GetExtension(pFile);
const bool readSig = checkSig && (pIOHandler != nullptr);
if (!readSig) {
if (extension == "dae" || extension == "zae") {
return true;
}
} else {
// Look for a DAE file inside, but don't extract it // Look for a DAE file inside, but don't extract it
ZipArchiveIOSystem zip_archive(pIOHandler, pFile); ZipArchiveIOSystem zip_archive(pIOHandler, pFile);
if (zip_archive.isOpen()) { if (zip_archive.isOpen()) {
return !ColladaParser::ReadZaeManifest(zip_archive).empty(); return !ColladaParser::ReadZaeManifest(zip_archive).empty();
} }
}
// XML - too generic, we need to open the file and search for typical keywords static const char *tokens[] = { "<collada" };
if (extension == "xml" || !extension.length() || checkSig) { return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
// If CanRead() is called in order to check whether we
// support a specific file extension in general pIOHandler
// might be nullptr and it's our duty to return true here.
if (nullptr == pIOHandler) {
return true;
}
static const char * const tokens[] = {
"<collada"
};
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ColladaLoader::SetupProperties(const Importer *pImp) { void ColladaLoader::SetupProperties(const Importer *pImp) {
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES, 0) != 0; noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES, 0) != 0;
removeEmptyBones = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES, true) != 0;
ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION, 0) != 0; ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION, 0) != 0;
ignoreUnitSize = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UNIT_SIZE, 0) != 0;
useColladaName = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES, 0) != 0; useColladaName = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES, 0) != 0;
} }
@ -201,12 +168,15 @@ void ColladaLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IO
// ... then fill the materials with the now adjusted settings // ... then fill the materials with the now adjusted settings
FillMaterials(parser, pScene); FillMaterials(parser, pScene);
if (!ignoreUnitSize) {
// Apply unit-size scale calculation // Apply unit-size scale calculation
pScene->mRootNode->mTransformation *= aiMatrix4x4(
pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0, 0, 0,
0, parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0, 0,
0, 0, parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0,
0, 0, 0, 1); 0, 0, 0, 1);
}
if (!ignoreUpDirection) { if (!ignoreUpDirection) {
// Convert to Y_UP, if different orientation // Convert to Y_UP, if different orientation
if (parser.mUpDirection == ColladaParser::UP_X) { if (parser.mUpDirection == ColladaParser::UP_X) {
@ -277,7 +247,9 @@ aiNode *ColladaLoader::BuildHierarchy(const ColladaParser &pParser, const Collad
// add children. first the *real* ones // add children. first the *real* ones
node->mNumChildren = static_cast<unsigned int>(pNode->mChildren.size() + instances.size()); 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) { for (size_t a = 0; a < pNode->mChildren.size(); ++a) {
node->mChildren[a] = BuildHierarchy(pParser, pNode->mChildren[a]); node->mChildren[a] = BuildHierarchy(pParser, pNode->mChildren[a]);
@ -379,9 +351,9 @@ void ColladaLoader::BuildLightsForNode(const ColladaParser &pParser, const Node
out->mAngleInnerCone = AI_DEG_TO_RAD(srcLight->mFalloffAngle); out->mAngleInnerCone = AI_DEG_TO_RAD(srcLight->mFalloffAngle);
// ... some extension magic. // ... some extension magic.
if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET * (1 - 1e-6f)) { if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET * (1 - ai_epsilon)) {
// ... some deprecation magic. // ... some deprecation magic.
if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET * (1 - 1e-6f)) { if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET * (1 - ai_epsilon)) {
// Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess .... // Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess ....
// epsilon chosen to be 0.1 // epsilon chosen to be 0.1
float f = 1.0f; float f = 1.0f;
@ -653,16 +625,14 @@ aiMesh *ColladaLoader::CreateMesh(const ColladaParser &pParser, const Mesh *pSrc
} }
// same for texture coords, as many as we have // 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; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
for (size_t a = 0, real = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
if (pSrcMesh->mTexCoords[a].size() >= pStartVertex + numVertices) { 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) { 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]; dstMesh->mNumUVComponents[a] = pSrcMesh->mNumUVComponents[a];
++real;
} }
} }
@ -820,9 +790,10 @@ aiMesh *ColladaLoader::CreateMesh(const ColladaParser &pParser, const Mesh *pSrc
// count the number of bones which influence vertices of the current submesh // count the number of bones which influence vertices of the current submesh
size_t numRemainingBones = 0; size_t numRemainingBones = 0;
for (const auto & dstBone : dstBones) { for (const auto & dstBone : dstBones) {
if (!dstBone.empty()) { if (dstBone.empty() && removeEmptyBones) {
++numRemainingBones; continue;
} }
++numRemainingBones;
} }
// create bone array and copy bone weights one by one // create bone array and copy bone weights one by one
@ -831,7 +802,7 @@ aiMesh *ColladaLoader::CreateMesh(const ColladaParser &pParser, const Mesh *pSrc
size_t boneCount = 0; size_t boneCount = 0;
for (size_t a = 0; a < numBones; ++a) { for (size_t a = 0; a < numBones; ++a) {
// omit bones without weights // omit bones without weights
if (dstBones[a].empty()) { if (dstBones[a].empty() && removeEmptyBones) {
continue; continue;
} }
@ -1087,7 +1058,7 @@ void insertMorphTimeValue(std::vector<MorphTimeValues> &values, float time, floa
return; return;
} }
for (unsigned int i = 0; i < values.size(); i++) { for (unsigned int i = 0; i < values.size(); i++) {
if (std::abs(time - values[i].mTime) < 1e-6f) { if (std::abs(time - values[i].mTime) < ai_epsilon) {
values[i].mKeys.push_back(k); values[i].mKeys.push_back(k);
return; return;
} else if (time > values[i].mTime && time < values[i + 1].mTime) { } else if (time > values[i].mTime && time < values[i + 1].mTime) {
@ -1285,12 +1256,12 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
// now for every unique point in time, find or interpolate the key values for that time // now for every unique point in time, find or interpolate the key values for that time
// and apply them to the transform chain. Then the node's present transformation can be calculated. // and apply them to the transform chain. Then the node's present transformation can be calculated.
ai_real time = startTime; ai_real time = startTime;
while (1) { while (true) {
for (ChannelEntry & e : entries) { for (ChannelEntry & e : entries) {
// find the keyframe behind the current point in time // find the keyframe behind the current point in time
size_t pos = 0; size_t pos = 0;
ai_real postTime = 0.0; ai_real postTime = 0.0;
while (1) { while (true) {
if (pos >= e.mTimeAccessor->mCount) { if (pos >= e.mTimeAccessor->mCount) {
break; break;
} }
@ -1701,7 +1672,7 @@ aiString ColladaLoader::FindFilenameForEffectTexture(const ColladaParser &pParse
// recurse through the param references until we end up at an image // recurse through the param references until we end up at an image
std::string name = pName; std::string name = pName;
while (1) { while (true) {
// the given string is a param entry. Find it // the given string is a param entry. Find it
Effect::ParamLibrary::const_iterator it = pEffect.mParams.find(name); Effect::ParamLibrary::const_iterator it = pEffect.mParams.find(name);
// if not found, we're at the end of the recursion. The resulting string should be the image ID // if not found, we're at the end of the recursion. The resulting string should be the image ID

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -86,7 +86,7 @@ public:
ColladaLoader(); ColladaLoader();
/// The class destructor. /// The class destructor.
~ColladaLoader() override; ~ColladaLoader() override = default;
/// Returns whether the class can handle the format of the given file. /// Returns whether the class can handle the format of the given file.
/// @see BaseImporter::CanRead() for more details. /// @see BaseImporter::CanRead() for more details.
@ -237,7 +237,9 @@ protected:
std::vector<aiAnimation *> mAnims; std::vector<aiAnimation *> mAnims;
bool noSkeletonMesh; bool noSkeletonMesh;
bool removeEmptyBones;
bool ignoreUpDirection; bool ignoreUpDirection;
bool ignoreUnitSize;
bool useColladaName; bool useColladaName;
/** Used by FindNameForNode() to generate unique node names */ /** Used by FindNameForNode() to generate unique node names */

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/IOSystem.hpp> #include <assimp/IOSystem.hpp>
#include <memory> #include <memory>
#include <utility>
using namespace Assimp; using namespace Assimp;
using namespace Assimp::Collada; using namespace Assimp::Collada;
@ -67,7 +68,7 @@ static void ReportWarning(const char *msg, ...) {
va_start(args, msg); va_start(args, msg);
char szBuffer[3000]; char szBuffer[3000];
const int iLen = vsprintf(szBuffer, msg, args); const int iLen = vsnprintf(szBuffer, sizeof(szBuffer), msg, args);
ai_assert(iLen > 0); ai_assert(iLen > 0);
va_end(args); va_end(args);
@ -144,7 +145,7 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) :
} else { } else {
// attempt to open the file directly // attempt to open the file directly
daefile.reset(pIOHandler->Open(pFile)); daefile.reset(pIOHandler->Open(pFile));
if (daefile.get() == nullptr) { if (daefile == nullptr) {
throw DeadlyImportError("Failed to open file '", pFile, "'."); throw DeadlyImportError("Failed to open file '", pFile, "'.");
} }
} }
@ -331,7 +332,16 @@ void ColladaParser::ReadAssetInfo(XmlNode &node) {
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "unit") { if (currentName == "unit") {
mUnitSize = 1.f; mUnitSize = 1.f;
XmlParser::getRealAttribute(currentNode, "meter", mUnitSize); std::string tUnitSizeString;
if (XmlParser::getStdStrAttribute(currentNode, "meter", tUnitSizeString)) {
try {
fast_atoreal_move<ai_real>(tUnitSizeString.data(), mUnitSize);
} catch (const DeadlyImportError& die) {
std::string warning("Collada: Failed to parse meter parameter to real number. Exception:\n");
warning.append(die.what());
ASSIMP_LOG_WARN(warning.data());
}
}
} else if (currentName == "up_axis") { } else if (currentName == "up_axis") {
std::string v; std::string v;
if (!XmlParser::getValueAsString(currentNode, v)) { if (!XmlParser::getValueAsString(currentNode, v)) {
@ -625,7 +635,8 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &controlle
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "morph") { if (currentName == "morph") {
controller.mType = 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(); int methodIndex = currentNode.attribute("method").as_int();
if (methodIndex > 0) { if (methodIndex > 0) {
std::string method; std::string method;
@ -644,12 +655,13 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &controlle
std::string v; std::string v;
XmlParser::getValueAsString(currentNode, v); XmlParser::getValueAsString(currentNode, v);
const char *content = v.c_str(); const char *content = v.c_str();
const char *end = content + v.size();
for (unsigned int a = 0; a < 16; a++) { for (unsigned int a = 0; a < 16; a++) {
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
// read a number // read a number
content = fast_atoreal_move<ai_real>(content, controller.mBindShapeMatrix[a]); content = fast_atoreal_move<ai_real>(content, controller.mBindShapeMatrix[a]);
// skip whitespace after it // skip whitespace after it
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} }
} else if (currentName == "source") { } else if (currentName == "source") {
ReadSource(currentNode); ReadSource(currentNode);
@ -730,7 +742,9 @@ void ColladaParser::ReadControllerWeights(XmlNode &node, Collada::Controller &pC
throw DeadlyImportError("Unknown semantic \"", attrSemantic, "\" in <vertex_weights> data <input> element"); throw DeadlyImportError("Unknown semantic \"", attrSemantic, "\" in <vertex_weights> data <input> element");
} }
} else if (currentName == "vcount" && vertexCount > 0) { } else if (currentName == "vcount" && vertexCount > 0) {
const char *text = currentNode.text().as_string(); const std::string stdText = currentNode.text().as_string();
const char *text = stdText.c_str();
const char *end = text + stdText.size();
size_t numWeights = 0; size_t numWeights = 0;
for (std::vector<size_t>::iterator it = pController.mWeightCounts.begin(); it != pController.mWeightCounts.end(); ++it) { for (std::vector<size_t>::iterator it = pController.mWeightCounts.begin(); it != pController.mWeightCounts.end(); ++it) {
if (*text == 0) { if (*text == 0) {
@ -739,7 +753,7 @@ void ColladaParser::ReadControllerWeights(XmlNode &node, Collada::Controller &pC
*it = strtoul10(text, &text); *it = strtoul10(text, &text);
numWeights += *it; numWeights += *it;
SkipSpacesAndLineEnd(&text); SkipSpacesAndLineEnd(&text, end);
} }
// reserve weight count // reserve weight count
pController.mWeights.resize(numWeights); pController.mWeights.resize(numWeights);
@ -748,17 +762,19 @@ void ColladaParser::ReadControllerWeights(XmlNode &node, Collada::Controller &pC
std::string stdText; std::string stdText;
XmlParser::getValueAsString(currentNode, stdText); XmlParser::getValueAsString(currentNode, stdText);
const char *text = stdText.c_str(); const char *text = stdText.c_str();
const char *end = text + stdText.size();
for (std::vector<std::pair<size_t, size_t>>::iterator it = pController.mWeights.begin(); it != pController.mWeights.end(); ++it) { for (std::vector<std::pair<size_t, size_t>>::iterator it = pController.mWeights.begin(); it != pController.mWeights.end(); ++it) {
if (text == 0) { if (text == nullptr) {
throw DeadlyImportError("Out of data while reading <vertex_weights>"); throw DeadlyImportError("Out of data while reading <vertex_weights>");
} }
SkipSpacesAndLineEnd(&text, end);
it->first = strtoul10(text, &text); it->first = strtoul10(text, &text);
SkipSpacesAndLineEnd(&text); SkipSpacesAndLineEnd(&text, end);
if (*text == 0) { if (*text == 0) {
throw DeadlyImportError("Out of data while reading <vertex_weights>"); throw DeadlyImportError("Out of data while reading <vertex_weights>");
} }
it->second = strtoul10(text, &text); it->second = strtoul10(text, &text);
SkipSpacesAndLineEnd(&text); SkipSpacesAndLineEnd(&text, end);
} }
} }
} }
@ -803,7 +819,6 @@ void ColladaParser::ReadImage(XmlNode &node, Collada::Image &pImage) {
if (!pImage.mFileName.length()) { if (!pImage.mFileName.length()) {
pImage.mFileName = "unknown_texture"; pImage.mFileName = "unknown_texture";
} }
}
} else if (mFormat == FV_1_5_n) { } else if (mFormat == FV_1_5_n) {
std::string value; std::string value;
XmlNode refChild = currentNode.child("ref"); XmlNode refChild = currentNode.child("ref");
@ -839,6 +854,7 @@ void ColladaParser::ReadImage(XmlNode &node, Collada::Image &pImage) {
} }
} }
} }
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -941,44 +957,45 @@ void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
std::string v; std::string v;
XmlParser::getValueAsString(currentNode, v); XmlParser::getValueAsString(currentNode, v);
const char *content = v.c_str(); const char *content = v.c_str();
const char *end = content + v.size();
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.r); content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.r);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.g); content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.g);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b); content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} else if (currentName == "constant_attenuation") { } else if (currentName == "constant_attenuation") {
XmlParser::getValueAsFloat(currentNode, pLight.mAttConstant); XmlParser::getValueAsReal(currentNode, pLight.mAttConstant);
} else if (currentName == "linear_attenuation") { } else if (currentName == "linear_attenuation") {
XmlParser::getValueAsFloat(currentNode, pLight.mAttLinear); XmlParser::getValueAsReal(currentNode, pLight.mAttLinear);
} else if (currentName == "quadratic_attenuation") { } else if (currentName == "quadratic_attenuation") {
XmlParser::getValueAsFloat(currentNode, pLight.mAttQuadratic); XmlParser::getValueAsReal(currentNode, pLight.mAttQuadratic);
} else if (currentName == "falloff_angle") { } else if (currentName == "falloff_angle") {
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle); XmlParser::getValueAsReal(currentNode, pLight.mFalloffAngle);
} else if (currentName == "falloff_exponent") { } else if (currentName == "falloff_exponent") {
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffExponent); XmlParser::getValueAsReal(currentNode, pLight.mFalloffExponent);
} }
// FCOLLADA extensions // FCOLLADA extensions
// ------------------------------------------------------- // -------------------------------------------------------
else if (currentName == "outer_cone") { 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 } 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") { } else if (currentName == "intensity") {
XmlParser::getValueAsFloat(currentNode, pLight.mIntensity); XmlParser::getValueAsReal(currentNode, pLight.mIntensity);
} }
else if (currentName == "falloff") { else if (currentName == "falloff") {
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle); XmlParser::getValueAsReal(currentNode, pLight.mOuterAngle);
} else if (currentName == "hotspot_beam") { } else if (currentName == "hotspot_beam") {
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle); XmlParser::getValueAsReal(currentNode, pLight.mFalloffAngle);
} }
// OpenCOLLADA extensions // OpenCOLLADA extensions
// ------------------------------------------------------- // -------------------------------------------------------
else if (currentName == "decay_falloff") { else if (currentName == "decay_falloff") {
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle); XmlParser::getValueAsReal(currentNode, pLight.mOuterAngle);
} }
} }
} }
@ -993,15 +1010,15 @@ void ColladaParser::ReadCamera(XmlNode &node, Collada::Camera &camera) {
if (currentName == "orthographic") { if (currentName == "orthographic") {
camera.mOrtho = true; camera.mOrtho = true;
} else if (currentName == "xfov" || currentName == "xmag") { } else if (currentName == "xfov" || currentName == "xmag") {
XmlParser::getValueAsFloat(currentNode, camera.mHorFov); XmlParser::getValueAsReal(currentNode, camera.mHorFov);
} else if (currentName == "yfov" || currentName == "ymag") { } else if (currentName == "yfov" || currentName == "ymag") {
XmlParser::getValueAsFloat(currentNode, camera.mVerFov); XmlParser::getValueAsReal(currentNode, camera.mVerFov);
} else if (currentName == "aspect_ratio") { } else if (currentName == "aspect_ratio") {
XmlParser::getValueAsFloat(currentNode, camera.mAspect); XmlParser::getValueAsReal(currentNode, camera.mAspect);
} else if (currentName == "znear") { } else if (currentName == "znear") {
XmlParser::getValueAsFloat(currentNode, camera.mZNear); XmlParser::getValueAsReal(currentNode, camera.mZNear);
} else if (currentName == "zfar") { } else if (currentName == "zfar") {
XmlParser::getValueAsFloat(currentNode, camera.mZFar); XmlParser::getValueAsReal(currentNode, camera.mZFar);
} }
} }
} }
@ -1153,15 +1170,15 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
} else if (currentName == "mirrorV") { } else if (currentName == "mirrorV") {
XmlParser::getValueAsBool(currentNode, out.mMirrorV); XmlParser::getValueAsBool(currentNode, out.mMirrorV);
} else if (currentName == "repeatU") { } else if (currentName == "repeatU") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.x); XmlParser::getValueAsReal(currentNode, out.mTransform.mScaling.x);
} else if (currentName == "repeatV") { } else if (currentName == "repeatV") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.y); XmlParser::getValueAsReal(currentNode, out.mTransform.mScaling.y);
} else if (currentName == "offsetU") { } else if (currentName == "offsetU") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.x); XmlParser::getValueAsReal(currentNode, out.mTransform.mTranslation.x);
} else if (currentName == "offsetV") { } else if (currentName == "offsetV") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.y); XmlParser::getValueAsReal(currentNode, out.mTransform.mTranslation.y);
} else if (currentName == "rotateUV") { } else if (currentName == "rotateUV") {
XmlParser::getValueAsFloat(currentNode, out.mTransform.mRotation); XmlParser::getValueAsReal(currentNode, out.mTransform.mRotation);
} else if (currentName == "blend_mode") { } else if (currentName == "blend_mode") {
std::string v; std::string v;
XmlParser::getValueAsString(currentNode, v); XmlParser::getValueAsString(currentNode, v);
@ -1181,14 +1198,14 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
// OKINO extensions // OKINO extensions
// ------------------------------------------------------- // -------------------------------------------------------
else if (currentName == "weighting") { else if (currentName == "weighting") {
XmlParser::getValueAsFloat(currentNode, out.mWeighting); XmlParser::getValueAsReal(currentNode, out.mWeighting);
} else if (currentName == "mix_with_previous_layer") { } else if (currentName == "mix_with_previous_layer") {
XmlParser::getValueAsFloat(currentNode, out.mMixWithPrevious); XmlParser::getValueAsReal(currentNode, out.mMixWithPrevious);
} }
// MAX3D extensions // MAX3D extensions
// ------------------------------------------------------- // -------------------------------------------------------
else if (currentName == "amount") { else if (currentName == "amount") {
XmlParser::getValueAsFloat(currentNode, out.mWeighting); XmlParser::getValueAsReal(currentNode, out.mWeighting);
} }
} }
} }
@ -1209,18 +1226,19 @@ void ColladaParser::ReadEffectColor(XmlNode &node, aiColor4D &pColor, Sampler &p
std::string v; std::string v;
XmlParser::getValueAsString(currentNode, v); XmlParser::getValueAsString(currentNode, v);
const char *content = v.c_str(); const char *content = v.c_str();
const char *end = v.c_str() + v.size() + 1;
content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.r); content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.r);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.g); content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.g);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.b); content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.b);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.a); content = fast_atoreal_move<ai_real>(content, (ai_real &)pColor.a);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} else if (currentName == "texture") { } else if (currentName == "texture") {
// get name of source texture/sampler // get name of source texture/sampler
XmlParser::getStdStrAttribute(currentNode, "texture", pSampler.mName); XmlParser::getStdStrAttribute(currentNode, "texture", pSampler.mName);
@ -1247,13 +1265,13 @@ void ColladaParser::ReadEffectColor(XmlNode &node, aiColor4D &pColor, Sampler &p
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Reads an effect entry containing a float // Reads an effect entry containing a float
void ColladaParser::ReadEffectFloat(XmlNode &node, ai_real &pFloat) { void ColladaParser::ReadEffectFloat(XmlNode &node, ai_real &pReal) {
pFloat = 0.f; pReal = 0.f;
XmlNode floatNode = node.child("float"); XmlNode floatNode = node.child("float");
if (floatNode.empty()) { if (floatNode.empty()) {
return; return;
} }
XmlParser::getValueAsFloat(floatNode, pFloat); XmlParser::getValueAsReal(floatNode, pReal);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1263,9 +1281,7 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
return; return;
} }
XmlNodeIterator xmlIt(node, XmlNodeIterator::PreOrderMode); for (XmlNode &currentNode : node.children()) {
XmlNode currentNode;
while (xmlIt.getNext(currentNode)) {
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "surface") { if (currentName == "surface") {
// image ID given inside <init_from> tags // image ID given inside <init_from> tags
@ -1278,22 +1294,24 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
} }
} else if (currentName == "sampler2D" && (FV_1_4_n == mFormat || FV_1_3_n == mFormat)) { } else if (currentName == "sampler2D" && (FV_1_4_n == mFormat || FV_1_3_n == mFormat)) {
// surface ID is given inside <source> tags // surface ID is given inside <source> tags
const char *content = currentNode.value(); XmlNode source = currentNode.child("source");
if (source) {
std::string v;
XmlParser::getValueAsString(source, v);
pParam.mType = Param_Sampler; pParam.mType = Param_Sampler;
pParam.mReference = content; pParam.mReference = v.c_str();
}
} else if (currentName == "sampler2D") { } else if (currentName == "sampler2D") {
// surface ID is given inside <instance_image> tags // surface ID is given inside <instance_image> tags
XmlNode instance_image = currentNode.child("instance_image");
if (instance_image) {
std::string url; std::string url;
XmlParser::getStdStrAttribute(currentNode, "url", url); XmlParser::getStdStrAttribute(instance_image, "url", url);
if (url[0] != '#') { if (url[0] != '#') {
throw DeadlyImportError("Unsupported URL format in instance_image"); throw DeadlyImportError("Unsupported URL format in instance_image");
} }
pParam.mType = Param_Sampler; pParam.mType = Param_Sampler;
pParam.mReference = url.c_str() + 1; pParam.mReference = url.c_str() + 1;
} else if (currentName == "source") {
const char *source = currentNode.child_value();
if (nullptr != source) {
pParam.mReference = source;
} }
} }
} }
@ -1334,6 +1352,7 @@ void ColladaParser::ReadGeometry(XmlNode &node, Collada::Mesh &pMesh) {
if (node.empty()) { if (node.empty()) {
return; return;
} }
for (XmlNode &currentNode : node.children()) { for (XmlNode &currentNode : node.children()) {
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "mesh") { if (currentName == "mesh") {
@ -1404,6 +1423,7 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
XmlParser::getValueAsString(node, v); XmlParser::getValueAsString(node, v);
v = ai_trim(v); v = ai_trim(v);
const char *content = v.c_str(); const char *content = v.c_str();
const char *end = content + v.size();
// read values and store inside an array in the data library // read values and store inside an array in the data library
mDataLibrary[id] = Data(); mDataLibrary[id] = Data();
@ -1422,11 +1442,13 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
} }
s.clear(); s.clear();
while (!IsSpaceOrNewLine(*content)) while (!IsSpaceOrNewLine(*content)) {
s += *content++; s += *content;
content++;
}
data.mStrings.push_back(s); data.mStrings.push_back(s);
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} }
} else { } else {
data.mValues.reserve(count); data.mValues.reserve(count);
@ -1441,7 +1463,7 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
content = fast_atoreal_move<ai_real>(content, value); content = fast_atoreal_move<ai_real>(content, value);
data.mValues.push_back(value); data.mValues.push_back(value);
// skip whitespace after it // skip whitespace after it
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} }
} }
} }
@ -1606,7 +1628,10 @@ void ColladaParser::ReadIndexData(XmlNode &node, Mesh &pMesh) {
std::string v; std::string v;
XmlParser::getValueAsString(currentNode, v); XmlParser::getValueAsString(currentNode, v);
const char *content = v.c_str(); const char *content = v.c_str();
const char *end = content + v.size();
vcount.reserve(numPrimitives); vcount.reserve(numPrimitives);
SkipSpacesAndLineEnd(&content, end);
for (unsigned int a = 0; a < numPrimitives; a++) { for (unsigned int a = 0; a < numPrimitives; a++) {
if (*content == 0) { if (*content == 0) {
throw DeadlyImportError("Expected more values while reading <vcount> contents."); throw DeadlyImportError("Expected more values while reading <vcount> contents.");
@ -1614,7 +1639,7 @@ void ColladaParser::ReadIndexData(XmlNode &node, Mesh &pMesh) {
// read a number // read a number
vcount.push_back((size_t)strtoul10(content, &content)); vcount.push_back((size_t)strtoul10(content, &content));
// skip whitespace after it // skip whitespace after it
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} }
} }
} }
@ -1723,14 +1748,16 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
std::string v; std::string v;
XmlParser::getValueAsString(node, v); XmlParser::getValueAsString(node, v);
const char *content = v.c_str(); const char *content = v.c_str();
SkipSpacesAndLineEnd(&content); const char *end = content + v.size();
SkipSpacesAndLineEnd(&content, end);
while (*content != 0) { while (*content != 0) {
// read a value. // read a value.
// Hack: (thom) Some exporters put negative indices sometimes. We just try to carry on anyways. // Hack: (thom) Some exporters put negative indices sometimes. We just try to carry on anyways.
int value = std::max(0, strtol10(content, &content)); int value = std::max(0, strtol10(content, &content));
indices.push_back(size_t(value)); indices.push_back(size_t(value));
// skip whitespace after it // skip whitespace after it
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
} }
} }
@ -1760,6 +1787,10 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
const Accessor *acc = input.mResolved; const Accessor *acc = input.mResolved;
if (!acc->mData) { if (!acc->mData) {
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource); 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 // and the same for the per-index channels
@ -1784,13 +1815,19 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
const Accessor *acc = input.mResolved; const Accessor *acc = input.mResolved;
if (!acc->mData) { if (!acc->mData) {
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource); 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");
}
} }
} }
// For continued primitives, the given count does not come all in one <p>, but only one primitive per <p> // For continued primitives, the given count does not come all in one <p>, but only one primitive per <p>
size_t numPrimitives = pNumPrimitives; size_t numPrimitives = pNumPrimitives;
if (pPrimType == Prim_TriFans || pPrimType == Prim_Polygon) if (pPrimType == Prim_TriFans || pPrimType == Prim_Polygon) {
numPrimitives = 1; numPrimitives = 1;
}
// For continued primitives, the given count is actually the number of <p>'s inside the parent tag // For continued primitives, the given count is actually the number of <p>'s inside the parent tag
if (pPrimType == Prim_TriStrips) { if (pPrimType == Prim_TriStrips) {
size_t numberOfVertices = indices.size() / numOffsets; size_t numberOfVertices = indices.size() / numOffsets;
@ -1843,7 +1880,6 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
default: default:
// LineStrip is not supported due to expected index unmangling // LineStrip is not supported due to expected index unmangling
throw DeadlyImportError("Unsupported primitive type."); throw DeadlyImportError("Unsupported primitive type.");
break;
} }
// store the face size to later reconstruct the face from // store the face size to later reconstruct the face from
@ -1856,7 +1892,7 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
///@note This function won't work correctly if both PerIndex and PerVertex channels have same channels. ///@note This function won't work correctly if both PerIndex and PerVertex channels have same channels.
///For example if TEXCOORD present in both <vertices> and <polylist> tags this function will create wrong uv coordinates. ///For example if TEXCOORD present in both <vertices> and <polylist> tags this function will create wrong uv coordinates.
///It's not clear from COLLADA documentation is this allowed or not. For now only exporter fixed to avoid such behavior ///It's not clear from COLLADA documentation whether this is allowed or not. For now only exporter fixed to avoid such behavior
void ColladaParser::CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Mesh &pMesh, void ColladaParser::CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Mesh &pMesh,
std::vector<InputChannel> &pPerIndexChannels, size_t currentPrimitive, const std::vector<size_t> &indices) { std::vector<InputChannel> &pPerIndexChannels, size_t currentPrimitive, const std::vector<size_t> &indices) {
// calculate the base offset of the vertex whose attributes we ant to copy // calculate the base offset of the vertex whose attributes we ant to copy
@ -1919,7 +1955,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
switch (pInput.mType) { switch (pInput.mType) {
case IT_Position: // ignore all position streams except 0 - there can be only one position case IT_Position: // ignore all position streams except 0 - there can be only one position
if (pInput.mIndex == 0) { if (pInput.mIndex == 0) {
pMesh.mPositions.push_back(aiVector3D(obj[0], obj[1], obj[2])); pMesh.mPositions.emplace_back(obj[0], obj[1], obj[2]);
} else { } else {
ASSIMP_LOG_ERROR("Collada: just one vertex position stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex position stream supported");
} }
@ -1931,7 +1967,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// ignore all normal streams except 0 - there can be only one normal // ignore all normal streams except 0 - there can be only one normal
if (pInput.mIndex == 0) { if (pInput.mIndex == 0) {
pMesh.mNormals.push_back(aiVector3D(obj[0], obj[1], obj[2])); pMesh.mNormals.emplace_back(obj[0], obj[1], obj[2]);
} else { } else {
ASSIMP_LOG_ERROR("Collada: just one vertex normal stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex normal stream supported");
} }
@ -1943,7 +1979,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// ignore all tangent streams except 0 - there can be only one tangent // ignore all tangent streams except 0 - there can be only one tangent
if (pInput.mIndex == 0) { if (pInput.mIndex == 0) {
pMesh.mTangents.push_back(aiVector3D(obj[0], obj[1], obj[2])); pMesh.mTangents.emplace_back(obj[0], obj[1], obj[2]);
} else { } else {
ASSIMP_LOG_ERROR("Collada: just one vertex tangent stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex tangent stream supported");
} }
@ -1956,7 +1992,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// ignore all bitangent streams except 0 - there can be only one bitangent // ignore all bitangent streams except 0 - there can be only one bitangent
if (pInput.mIndex == 0) { if (pInput.mIndex == 0) {
pMesh.mBitangents.push_back(aiVector3D(obj[0], obj[1], obj[2])); pMesh.mBitangents.emplace_back(obj[0], obj[1], obj[2]);
} else { } else {
ASSIMP_LOG_ERROR("Collada: just one vertex bitangent stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex bitangent stream supported");
} }
@ -1969,7 +2005,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
pMesh.mTexCoords[pInput.mIndex].insert(pMesh.mTexCoords[pInput.mIndex].end(), pMesh.mTexCoords[pInput.mIndex].insert(pMesh.mTexCoords[pInput.mIndex].end(),
pMesh.mPositions.size() - pMesh.mTexCoords[pInput.mIndex].size() - 1, aiVector3D(0, 0, 0)); pMesh.mPositions.size() - pMesh.mTexCoords[pInput.mIndex].size() - 1, aiVector3D(0, 0, 0));
pMesh.mTexCoords[pInput.mIndex].push_back(aiVector3D(obj[0], obj[1], obj[2])); pMesh.mTexCoords[pInput.mIndex].emplace_back(obj[0], obj[1], obj[2]);
if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) { if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) {
pMesh.mNumUVComponents[pInput.mIndex] = 3; pMesh.mNumUVComponents[pInput.mIndex] = 3;
} }
@ -2048,7 +2084,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
XmlParser::getStdStrAttribute(currentNode, "id", child->mID); XmlParser::getStdStrAttribute(currentNode, "id", child->mID);
} }
if (XmlParser::hasAttribute(currentNode, "sid")) { if (XmlParser::hasAttribute(currentNode, "sid")) {
XmlParser::getStdStrAttribute(currentNode, "id", child->mSID); XmlParser::getStdStrAttribute(currentNode, "sid", child->mSID);
} }
if (XmlParser::hasAttribute(currentNode, "name")) { if (XmlParser::hasAttribute(currentNode, "name")) {
XmlParser::getStdStrAttribute(currentNode, "name", child->mName); XmlParser::getStdStrAttribute(currentNode, "name", child->mName);
@ -2103,7 +2139,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
if (s[0] != '#') { if (s[0] != '#') {
ASSIMP_LOG_ERROR("Collada: Unresolved reference format of node"); ASSIMP_LOG_ERROR("Collada: Unresolved reference format of node");
} else { } else {
pNode->mNodeInstances.push_back(NodeInstance()); pNode->mNodeInstances.emplace_back();
pNode->mNodeInstances.back().mNode = s.c_str() + 1; pNode->mNodeInstances.back().mNode = s.c_str() + 1;
} }
} }
@ -2119,7 +2155,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
throw DeadlyImportError("Unknown reference format in <instance_light> element"); throw DeadlyImportError("Unknown reference format in <instance_light> element");
} }
pNode->mLights.push_back(LightInstance()); pNode->mLights.emplace_back();
pNode->mLights.back().mLight = url.c_str() + 1; pNode->mLights.back().mLight = url.c_str() + 1;
} }
} else if (currentName == "instance_camera") { } else if (currentName == "instance_camera") {
@ -2130,7 +2166,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
if (url[0] != '#') { if (url[0] != '#') {
throw DeadlyImportError("Unknown reference format in <instance_camera> element"); throw DeadlyImportError("Unknown reference format in <instance_camera> element");
} }
pNode->mCameras.push_back(CameraInstance()); pNode->mCameras.emplace_back();
pNode->mCameras.back().mCamera = url.c_str() + 1; pNode->mCameras.back().mCamera = url.c_str() + 1;
} }
} }
@ -2155,15 +2191,15 @@ void ColladaParser::ReadNodeTransformation(XmlNode &node, Node *pNode, Transform
} }
// how many parameters to read per transformation type // how many parameters to read per transformation type
static const unsigned int sNumParameters[] = { 9, 4, 3, 3, 7, 16 }; static constexpr unsigned int sNumParameters[] = { 9, 4, 3, 3, 7, 16 };
std::string value; std::string value;
XmlParser::getValueAsString(node, value); XmlParser::getValueAsString(node, value);
const char *content = value.c_str(); const char *content = value.c_str();
const char *end = value.c_str() + value.size();
// read as many parameters and store in the transformation // read as many parameters and store in the transformation
for (unsigned int a = 0; a < sNumParameters[pType]; a++) { for (unsigned int a = 0; a < sNumParameters[pType]; a++) {
// skip whitespace before the number // skip whitespace before the number
SkipSpacesAndLineEnd(&content); SkipSpacesAndLineEnd(&content, end);
// read a number // read a number
content = fast_atoreal_move<ai_real>(content, tf.f[a]); content = fast_atoreal_move<ai_real>(content, tf.f[a]);
} }
@ -2242,7 +2278,11 @@ void ColladaParser::ReadNodeGeometry(XmlNode &node, Node *pNode) {
if (currentName == "bind_material") { if (currentName == "bind_material") {
XmlNode techNode = currentNode.child("technique_common"); XmlNode techNode = currentNode.child("technique_common");
if (techNode) { if (techNode) {
XmlNode instanceMatNode = techNode.child("instance_material"); for (XmlNode instanceMatNode = techNode.child("instance_material"); instanceMatNode; instanceMatNode = instanceMatNode.next_sibling())
{
const std::string &instance_name = instanceMatNode.name();
if (instance_name == "instance_material")
{
// read ID of the geometry subgroup and the target material // read ID of the geometry subgroup and the target material
std::string group; std::string group;
XmlParser::getStdStrAttribute(instanceMatNode, "symbol", group); XmlParser::getStdStrAttribute(instanceMatNode, "symbol", group);
@ -2253,9 +2293,11 @@ void ColladaParser::ReadNodeGeometry(XmlNode &node, Node *pNode) {
urlMat++; urlMat++;
s.mMatName = urlMat; s.mMatName = urlMat;
ReadMaterialVertexInputBinding(instanceMatNode, s);
// store the association // store the association
instance.mMaterials[group] = s; instance.mMaterials[group] = s;
ReadMaterialVertexInputBinding(instanceMatNode, s); }
}
} }
} }
} }
@ -2289,7 +2331,7 @@ void ColladaParser::ReadScene(XmlNode &node) {
// find the referred scene, skip the leading # // find the referred scene, skip the leading #
NodeLibrary::const_iterator sit = mNodeLibrary.find(url.c_str() + 1); NodeLibrary::const_iterator sit = mNodeLibrary.find(url.c_str() + 1);
if (sit == mNodeLibrary.end()) { if (sit == mNodeLibrary.end()) {
throw DeadlyImportError("Unable to resolve visual_scene reference \"", std::string(url), "\" in <instance_visual_scene> element."); throw DeadlyImportError("Unable to resolve visual_scene reference \"", std::string(std::move(url)), "\" in <instance_visual_scene> element.");
} }
mRootNode = sit->second; mRootNode = sit->second;
} }

View File

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

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -65,7 +65,6 @@ public:
LineReader(StreamReaderLE& reader) LineReader(StreamReaderLE& reader)
: splitter(reader,false,true) : splitter(reader,false,true)
, groupcode( 0 ) , groupcode( 0 )
, value()
, end() { , end() {
// empty // empty
} }
@ -186,8 +185,7 @@ struct InsertBlock {
InsertBlock() InsertBlock()
: pos() : pos()
, scale(1.f,1.f,1.f) , scale(1.f,1.f,1.f)
, angle() , angle() {
, name() {
// empty // empty
} }

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of the DXF importer class * @brief Implementation of the DXF importer class
*/ */
#ifndef ASSIMP_BUILD_NO_DXF_IMPORTER #ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
#include "AssetLib/DXF/DXFLoader.h" #include "AssetLib/DXF/DXFLoader.h"
@ -57,6 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h> #include <assimp/importerdesc.h>
#include <numeric> #include <numeric>
#include <utility>
using namespace Assimp; using namespace Assimp;
@ -67,26 +67,269 @@ static constexpr size_t AI_DXF_BINARY_IDENT_LEN = sizeof AI_DXF_BINARY_IDENT;
// default vertex color that all uncolored vertices will receive // default vertex color that all uncolored vertices will receive
static const aiColor4D AI_DXF_DEFAULT_COLOR(aiColor4D(0.6f, 0.6f, 0.6f, 0.6f)); static const aiColor4D AI_DXF_DEFAULT_COLOR(aiColor4D(0.6f, 0.6f, 0.6f, 0.6f));
// color indices for DXF - 16 are supported, the table is // color indices for DXF - 256 are supported, the table is
// taken directly from the DXF spec. // taken directly from the AutoCad Index (ACI) table
static aiColor4D g_aclrDxfIndexColors[] = { // https://gohtx.com/acadcolors.php
aiColor4D (0.6f, 0.6f, 0.6f, 1.0f), //STH 2024-0126
aiColor4D (1.0f, 0.0f, 0.0f, 1.0f), // red static const aiColor4D g_aclrDxfIndexColors[256] = {
aiColor4D (0.0f, 1.0f, 0.0f, 1.0f), // green aiColor4D (0.0f, 0.0f ,0.0f, 1.0f), //dxf color code 0
aiColor4D (0.0f, 0.0f, 1.0f, 1.0f), // blue aiColor4D (1.0f, 0.0f ,0.0f, 1.0f), //dxf color code 1
aiColor4D (0.3f, 1.0f, 0.3f, 1.0f), // light green aiColor4D (1.0f, 1.0f ,0.0f, 1.0f), //dxf color code 2
aiColor4D (0.3f, 0.3f, 1.0f, 1.0f), // light blue aiColor4D (0.0f, 1.0f ,0.0f, 1.0f), //dxf color code 3
aiColor4D (1.0f, 0.3f, 0.3f, 1.0f), // light red aiColor4D (0.0f, 1.0f ,1.0f, 1.0f), //dxf color code 4
aiColor4D (1.0f, 0.0f, 1.0f, 1.0f), // pink aiColor4D (0.0f, 0.0f ,1.0f, 1.0f), //dxf color code 5
aiColor4D (1.0f, 0.6f, 0.0f, 1.0f), // orange aiColor4D (1.0f, 0.0f ,1.0f, 1.0f), //dxf color code 6
aiColor4D (0.6f, 0.3f, 0.0f, 1.0f), // dark orange aiColor4D (1.0f, 1.0f ,1.0f, 1.0f), //dxf color code 7
aiColor4D (1.0f, 1.0f, 0.0f, 1.0f), // yellow aiColor4D (0.3f, 0.3f ,0.3f, 1.0f), //dxf color code 8
aiColor4D (0.3f, 0.3f, 0.3f, 1.0f), // dark gray aiColor4D (0.5f, 0.5f ,0.5f, 1.0f), //dxf color code 9
aiColor4D (0.8f, 0.8f, 0.8f, 1.0f), // light gray aiColor4D (1.0f, 0.0f ,0.0f, 1.0f), //dxf color code 10
aiColor4D (0.0f, 00.f, 0.0f, 1.0f), // black aiColor4D (1.0f, 0.7f ,0.7f, 1.0f), //dxf color code 11
aiColor4D (1.0f, 1.0f, 1.0f, 1.0f), // white aiColor4D (0.7f, 0.0f ,0.0f, 1.0f), //dxf color code 12
aiColor4D (0.6f, 0.0f, 1.0f, 1.0f) // violet aiColor4D (0.7f, 0.5f ,0.5f, 1.0f), //dxf color code 13
aiColor4D (0.5f, 0.0f ,0.0f, 1.0f), //dxf color code 14
aiColor4D (0.5f, 0.3f ,0.3f, 1.0f), //dxf color code 15
aiColor4D (0.4f, 0.0f ,0.0f, 1.0f), //dxf color code 16
aiColor4D (0.4f, 0.3f ,0.3f, 1.0f), //dxf color code 17
aiColor4D (0.3f, 0.0f ,0.0f, 1.0f), //dxf color code 18
aiColor4D (0.3f, 0.2f ,0.2f, 1.0f), //dxf color code 19
aiColor4D (1.0f, 0.2f ,0.0f, 1.0f), //dxf color code 20
aiColor4D (1.0f, 0.7f ,0.7f, 1.0f), //dxf color code 21
aiColor4D (0.7f, 0.2f ,0.0f, 1.0f), //dxf color code 22
aiColor4D (0.7f, 0.6f ,0.5f, 1.0f), //dxf color code 23
aiColor4D (0.5f, 0.1f ,0.0f, 1.0f), //dxf color code 24
aiColor4D (0.5f, 0.4f ,0.3f, 1.0f), //dxf color code 25
aiColor4D (0.4f, 0.1f ,0.0f, 1.0f), //dxf color code 26
aiColor4D (0.4f, 0.3f ,0.3f, 1.0f), //dxf color code 27
aiColor4D (0.3f, 0.1f ,0.0f, 1.0f), //dxf color code 28
aiColor4D (0.3f, 0.2f ,0.2f, 1.0f), //dxf color code 29
aiColor4D (1.0f, 0.5f ,0.0f, 1.0f), //dxf color code 30
aiColor4D (1.0f, 0.8f ,0.7f, 1.0f), //dxf color code 31
aiColor4D (0.7f, 0.4f ,0.0f, 1.0f), //dxf color code 32
aiColor4D (0.7f, 0.6f ,0.5f, 1.0f), //dxf color code 33
aiColor4D (0.5f, 0.3f ,0.0f, 1.0f), //dxf color code 34
aiColor4D (0.5f, 0.4f ,0.3f, 1.0f), //dxf color code 35
aiColor4D (0.4f, 0.2f ,0.0f, 1.0f), //dxf color code 36
aiColor4D (0.4f, 0.3f ,0.3f, 1.0f), //dxf color code 37
aiColor4D (0.3f, 0.2f ,0.0f, 1.0f), //dxf color code 38
aiColor4D (0.3f, 0.3f ,0.2f, 1.0f), //dxf color code 39
aiColor4D (1.0f, 0.7f ,0.0f, 1.0f), //dxf color code 40
aiColor4D (1.0f, 0.9f ,0.7f, 1.0f), //dxf color code 41
aiColor4D (0.7f, 0.6f ,0.0f, 1.0f), //dxf color code 42
aiColor4D (0.7f, 0.7f ,0.5f, 1.0f), //dxf color code 43
aiColor4D (0.5f, 0.4f ,0.0f, 1.0f), //dxf color code 44
aiColor4D (0.5f, 0.5f ,0.3f, 1.0f), //dxf color code 45
aiColor4D (0.4f, 0.3f ,0.0f, 1.0f), //dxf color code 46
aiColor4D (0.4f, 0.4f ,0.3f, 1.0f), //dxf color code 47
aiColor4D (0.3f, 0.2f ,0.0f, 1.0f), //dxf color code 48
aiColor4D (0.3f, 0.3f ,0.2f, 1.0f), //dxf color code 49
aiColor4D (1.0f, 1.0f ,0.0f, 1.0f), //dxf color code 50
aiColor4D (1.0f, 1.0f ,0.7f, 1.0f), //dxf color code 51
aiColor4D (0.7f, 0.7f ,0.0f, 1.0f), //dxf color code 52
aiColor4D (0.7f, 0.7f ,0.5f, 1.0f), //dxf color code 53
aiColor4D (0.5f, 0.5f ,0.0f, 1.0f), //dxf color code 54
aiColor4D (0.5f, 0.5f ,0.3f, 1.0f), //dxf color code 55
aiColor4D (0.4f, 0.4f ,0.0f, 1.0f), //dxf color code 56
aiColor4D (0.4f, 0.4f ,0.3f, 1.0f), //dxf color code 57
aiColor4D (0.3f, 0.3f ,0.0f, 1.0f), //dxf color code 58
aiColor4D (0.3f, 0.3f ,0.2f, 1.0f), //dxf color code 59
aiColor4D (0.7f, 1.0f ,0.0f, 1.0f), //dxf color code 60
aiColor4D (0.9f, 1.0f ,0.7f, 1.0f), //dxf color code 61
aiColor4D (0.6f, 0.7f ,0.0f, 1.0f), //dxf color code 62
aiColor4D (0.7f, 0.7f ,0.5f, 1.0f), //dxf color code 63
aiColor4D (0.4f, 0.5f ,0.0f, 1.0f), //dxf color code 64
aiColor4D (0.5f, 0.5f ,0.3f, 1.0f), //dxf color code 65
aiColor4D (0.3f, 0.4f ,0.0f, 1.0f), //dxf color code 66
aiColor4D (0.4f, 0.4f ,0.3f, 1.0f), //dxf color code 67
aiColor4D (0.2f, 0.3f ,0.0f, 1.0f), //dxf color code 68
aiColor4D (0.3f, 0.3f ,0.2f, 1.0f), //dxf color code 69
aiColor4D (0.5f, 1.0f ,0.0f, 1.0f), //dxf color code 70
aiColor4D (0.8f, 1.0f ,0.7f, 1.0f), //dxf color code 71
aiColor4D (0.4f, 0.7f ,0.0f, 1.0f), //dxf color code 72
aiColor4D (0.6f, 0.7f ,0.5f, 1.0f), //dxf color code 73
aiColor4D (0.3f, 0.5f ,0.0f, 1.0f), //dxf color code 74
aiColor4D (0.4f, 0.5f ,0.3f, 1.0f), //dxf color code 75
aiColor4D (0.2f, 0.4f ,0.0f, 1.0f), //dxf color code 76
aiColor4D (0.3f, 0.4f ,0.3f, 1.0f), //dxf color code 77
aiColor4D (0.2f, 0.3f ,0.0f, 1.0f), //dxf color code 78
aiColor4D (0.3f, 0.3f ,0.2f, 1.0f), //dxf color code 79
aiColor4D (0.2f, 1.0f ,0.0f, 1.0f), //dxf color code 80
aiColor4D (0.7f, 1.0f ,0.7f, 1.0f), //dxf color code 81
aiColor4D (0.2f, 0.7f ,0.0f, 1.0f), //dxf color code 82
aiColor4D (0.6f, 0.7f ,0.5f, 1.0f), //dxf color code 83
aiColor4D (0.1f, 0.5f ,0.0f, 1.0f), //dxf color code 84
aiColor4D (0.4f, 0.5f ,0.3f, 1.0f), //dxf color code 85
aiColor4D (0.1f, 0.4f ,0.0f, 1.0f), //dxf color code 86
aiColor4D (0.3f, 0.4f ,0.3f, 1.0f), //dxf color code 87
aiColor4D (0.1f, 0.3f ,0.0f, 1.0f), //dxf color code 88
aiColor4D (0.2f, 0.3f ,0.2f, 1.0f), //dxf color code 89
aiColor4D (0.0f, 1.0f ,0.0f, 1.0f), //dxf color code 90
aiColor4D (0.7f, 1.0f ,0.7f, 1.0f), //dxf color code 91
aiColor4D (0.0f, 0.7f ,0.0f, 1.0f), //dxf color code 92
aiColor4D (0.5f, 0.7f ,0.5f, 1.0f), //dxf color code 93
aiColor4D (0.0f, 0.5f ,0.0f, 1.0f), //dxf color code 94
aiColor4D (0.3f, 0.5f ,0.3f, 1.0f), //dxf color code 95
aiColor4D (0.0f, 0.4f ,0.0f, 1.0f), //dxf color code 96
aiColor4D (0.3f, 0.4f ,0.3f, 1.0f), //dxf color code 97
aiColor4D (0.0f, 0.3f ,0.0f, 1.0f), //dxf color code 98
aiColor4D (0.2f, 0.3f ,0.2f, 1.0f), //dxf color code 99
aiColor4D (0.0f, 1.0f ,0.2f, 1.0f), //dxf color code 100
aiColor4D (0.7f, 1.0f ,0.7f, 1.0f), //dxf color code 101
aiColor4D (0.0f, 0.7f ,0.2f, 1.0f), //dxf color code 102
aiColor4D (0.5f, 0.7f ,0.6f, 1.0f), //dxf color code 103
aiColor4D (0.0f, 0.5f ,0.1f, 1.0f), //dxf color code 104
aiColor4D (0.3f, 0.5f ,0.4f, 1.0f), //dxf color code 105
aiColor4D (0.0f, 0.4f ,0.1f, 1.0f), //dxf color code 106
aiColor4D (0.3f, 0.4f ,0.3f, 1.0f), //dxf color code 107
aiColor4D (0.0f, 0.3f ,0.1f, 1.0f), //dxf color code 108
aiColor4D (0.2f, 0.3f ,0.2f, 1.0f), //dxf color code 109
aiColor4D (0.0f, 1.0f ,0.5f, 1.0f), //dxf color code 110
aiColor4D (0.7f, 1.0f ,0.8f, 1.0f), //dxf color code 111
aiColor4D (0.0f, 0.7f ,0.4f, 1.0f), //dxf color code 112
aiColor4D (0.5f, 0.7f ,0.6f, 1.0f), //dxf color code 113
aiColor4D (0.0f, 0.5f ,0.3f, 1.0f), //dxf color code 114
aiColor4D (0.3f, 0.5f ,0.4f, 1.0f), //dxf color code 115
aiColor4D (0.0f, 0.4f ,0.2f, 1.0f), //dxf color code 116
aiColor4D (0.3f, 0.4f ,0.3f, 1.0f), //dxf color code 117
aiColor4D (0.0f, 0.3f ,0.2f, 1.0f), //dxf color code 118
aiColor4D (0.2f, 0.3f ,0.3f, 1.0f), //dxf color code 119
aiColor4D (0.0f, 1.0f ,0.7f, 1.0f), //dxf color code 120
aiColor4D (0.7f, 1.0f ,0.9f, 1.0f), //dxf color code 121
aiColor4D (0.0f, 0.7f ,0.6f, 1.0f), //dxf color code 122
aiColor4D (0.5f, 0.7f ,0.7f, 1.0f), //dxf color code 123
aiColor4D (0.0f, 0.5f ,0.4f, 1.0f), //dxf color code 124
aiColor4D (0.3f, 0.5f ,0.5f, 1.0f), //dxf color code 125
aiColor4D (0.0f, 0.4f ,0.3f, 1.0f), //dxf color code 126
aiColor4D (0.3f, 0.4f ,0.4f, 1.0f), //dxf color code 127
aiColor4D (0.0f, 0.3f ,0.2f, 1.0f), //dxf color code 128
aiColor4D (0.2f, 0.3f ,0.3f, 1.0f), //dxf color code 129
aiColor4D (0.0f, 1.0f ,1.0f, 1.0f), //dxf color code 130
aiColor4D (0.7f, 1.0f ,1.0f, 1.0f), //dxf color code 131
aiColor4D (0.0f, 0.7f ,0.7f, 1.0f), //dxf color code 132
aiColor4D (0.5f, 0.7f ,0.7f, 1.0f), //dxf color code 133
aiColor4D (0.0f, 0.5f ,0.5f, 1.0f), //dxf color code 134
aiColor4D (0.3f, 0.5f ,0.5f, 1.0f), //dxf color code 135
aiColor4D (0.0f, 0.4f ,0.4f, 1.0f), //dxf color code 136
aiColor4D (0.3f, 0.4f ,0.4f, 1.0f), //dxf color code 137
aiColor4D (0.0f, 0.3f ,0.3f, 1.0f), //dxf color code 138
aiColor4D (0.2f, 0.3f ,0.3f, 1.0f), //dxf color code 139
aiColor4D (0.0f, 0.7f ,1.0f, 1.0f), //dxf color code 140
aiColor4D (0.7f, 0.9f ,1.0f, 1.0f), //dxf color code 141
aiColor4D (0.0f, 0.6f ,0.7f, 1.0f), //dxf color code 142
aiColor4D (0.5f, 0.7f ,0.7f, 1.0f), //dxf color code 143
aiColor4D (0.0f, 0.4f ,0.5f, 1.0f), //dxf color code 144
aiColor4D (0.3f, 0.5f ,0.5f, 1.0f), //dxf color code 145
aiColor4D (0.0f, 0.3f ,0.4f, 1.0f), //dxf color code 146
aiColor4D (0.3f, 0.4f ,0.4f, 1.0f), //dxf color code 147
aiColor4D (0.0f, 0.2f ,0.3f, 1.0f), //dxf color code 148
aiColor4D (0.2f, 0.3f ,0.3f, 1.0f), //dxf color code 149
aiColor4D (0.0f, 0.5f ,1.0f, 1.0f), //dxf color code 150
aiColor4D (0.7f, 0.8f ,1.0f, 1.0f), //dxf color code 151
aiColor4D (0.0f, 0.4f ,0.7f, 1.0f), //dxf color code 152
aiColor4D (0.5f, 0.6f ,0.7f, 1.0f), //dxf color code 153
aiColor4D (0.0f, 0.3f ,0.5f, 1.0f), //dxf color code 154
aiColor4D (0.3f, 0.4f ,0.5f, 1.0f), //dxf color code 155
aiColor4D (0.0f, 0.2f ,0.4f, 1.0f), //dxf color code 156
aiColor4D (0.3f, 0.3f ,0.4f, 1.0f), //dxf color code 157
aiColor4D (0.0f, 0.2f ,0.3f, 1.0f), //dxf color code 158
aiColor4D (0.2f, 0.3f ,0.3f, 1.0f), //dxf color code 159
aiColor4D (0.0f, 0.2f ,1.0f, 1.0f), //dxf color code 160
aiColor4D (0.7f, 0.7f ,1.0f, 1.0f), //dxf color code 161
aiColor4D (0.0f, 0.2f ,0.7f, 1.0f), //dxf color code 162
aiColor4D (0.5f, 0.6f ,0.7f, 1.0f), //dxf color code 163
aiColor4D (0.0f, 0.1f ,0.5f, 1.0f), //dxf color code 164
aiColor4D (0.3f, 0.4f ,0.5f, 1.0f), //dxf color code 165
aiColor4D (0.0f, 0.1f ,0.4f, 1.0f), //dxf color code 166
aiColor4D (0.3f, 0.3f ,0.4f, 1.0f), //dxf color code 167
aiColor4D (0.0f, 0.1f ,0.3f, 1.0f), //dxf color code 168
aiColor4D (0.2f, 0.2f ,0.3f, 1.0f), //dxf color code 169
aiColor4D (0.0f, 0.0f ,1.0f, 1.0f), //dxf color code 170
aiColor4D (0.7f, 0.7f ,1.0f, 1.0f), //dxf color code 171
aiColor4D (0.0f, 0.0f ,0.7f, 1.0f), //dxf color code 172
aiColor4D (0.5f, 0.5f ,0.7f, 1.0f), //dxf color code 173
aiColor4D (0.0f, 0.0f ,0.5f, 1.0f), //dxf color code 174
aiColor4D (0.3f, 0.3f ,0.5f, 1.0f), //dxf color code 175
aiColor4D (0.0f, 0.0f ,0.4f, 1.0f), //dxf color code 176
aiColor4D (0.3f, 0.3f ,0.4f, 1.0f), //dxf color code 177
aiColor4D (0.0f, 0.0f ,0.3f, 1.0f), //dxf color code 178
aiColor4D (0.2f, 0.2f ,0.3f, 1.0f), //dxf color code 179
aiColor4D (0.2f, 0.0f ,1.0f, 1.0f), //dxf color code 180
aiColor4D (0.7f, 0.7f ,1.0f, 1.0f), //dxf color code 181
aiColor4D (0.2f, 0.0f ,0.7f, 1.0f), //dxf color code 182
aiColor4D (0.6f, 0.5f ,0.7f, 1.0f), //dxf color code 183
aiColor4D (0.1f, 0.0f ,0.5f, 1.0f), //dxf color code 184
aiColor4D (0.4f, 0.3f ,0.5f, 1.0f), //dxf color code 185
aiColor4D (0.1f, 0.0f ,0.4f, 1.0f), //dxf color code 186
aiColor4D (0.3f, 0.3f ,0.4f, 1.0f), //dxf color code 187
aiColor4D (0.1f, 0.0f ,0.3f, 1.0f), //dxf color code 188
aiColor4D (0.2f, 0.2f ,0.3f, 1.0f), //dxf color code 189
aiColor4D (0.5f, 0.0f ,1.0f, 1.0f), //dxf color code 190
aiColor4D (0.8f, 0.7f ,1.0f, 1.0f), //dxf color code 191
aiColor4D (0.4f, 0.0f ,0.7f, 1.0f), //dxf color code 192
aiColor4D (0.6f, 0.5f ,0.7f, 1.0f), //dxf color code 193
aiColor4D (0.3f, 0.0f ,0.5f, 1.0f), //dxf color code 194
aiColor4D (0.4f, 0.3f ,0.5f, 1.0f), //dxf color code 195
aiColor4D (0.2f, 0.0f ,0.4f, 1.0f), //dxf color code 196
aiColor4D (0.3f, 0.3f ,0.4f, 1.0f), //dxf color code 197
aiColor4D (0.2f, 0.0f ,0.3f, 1.0f), //dxf color code 198
aiColor4D (0.3f, 0.2f ,0.3f, 1.0f), //dxf color code 199
aiColor4D (0.7f, 0.0f ,1.0f, 1.0f), //dxf color code 200
aiColor4D (0.9f, 0.7f ,1.0f, 1.0f), //dxf color code 201
aiColor4D (0.6f, 0.0f ,0.7f, 1.0f), //dxf color code 202
aiColor4D (0.7f, 0.5f ,0.7f, 1.0f), //dxf color code 203
aiColor4D (0.4f, 0.0f ,0.5f, 1.0f), //dxf color code 204
aiColor4D (0.5f, 0.3f ,0.5f, 1.0f), //dxf color code 205
aiColor4D (0.3f, 0.0f ,0.4f, 1.0f), //dxf color code 206
aiColor4D (0.4f, 0.3f ,0.4f, 1.0f), //dxf color code 207
aiColor4D (0.2f, 0.0f ,0.3f, 1.0f), //dxf color code 208
aiColor4D (0.3f, 0.2f ,0.3f, 1.0f), //dxf color code 209
aiColor4D (1.0f, 0.0f ,1.0f, 1.0f), //dxf color code 210
aiColor4D (1.0f, 0.7f ,1.0f, 1.0f), //dxf color code 211
aiColor4D (0.7f, 0.0f ,0.7f, 1.0f), //dxf color code 212
aiColor4D (0.7f, 0.5f ,0.7f, 1.0f), //dxf color code 213
aiColor4D (0.5f, 0.0f ,0.5f, 1.0f), //dxf color code 214
aiColor4D (0.5f, 0.3f ,0.5f, 1.0f), //dxf color code 215
aiColor4D (0.4f, 0.0f ,0.4f, 1.0f), //dxf color code 216
aiColor4D (0.4f, 0.3f ,0.4f, 1.0f), //dxf color code 217
aiColor4D (0.3f, 0.0f ,0.3f, 1.0f), //dxf color code 218
aiColor4D (0.3f, 0.2f ,0.3f, 1.0f), //dxf color code 219
aiColor4D (1.0f, 0.0f ,0.7f, 1.0f), //dxf color code 220
aiColor4D (1.0f, 0.7f ,0.9f, 1.0f), //dxf color code 221
aiColor4D (0.7f, 0.0f ,0.6f, 1.0f), //dxf color code 222
aiColor4D (0.7f, 0.5f ,0.7f, 1.0f), //dxf color code 223
aiColor4D (0.5f, 0.0f ,0.4f, 1.0f), //dxf color code 224
aiColor4D (0.5f, 0.3f ,0.5f, 1.0f), //dxf color code 225
aiColor4D (0.4f, 0.0f ,0.3f, 1.0f), //dxf color code 226
aiColor4D (0.4f, 0.3f ,0.4f, 1.0f), //dxf color code 227
aiColor4D (0.3f, 0.0f ,0.2f, 1.0f), //dxf color code 228
aiColor4D (0.3f, 0.2f ,0.3f, 1.0f), //dxf color code 229
aiColor4D (1.0f, 0.0f ,0.5f, 1.0f), //dxf color code 230
aiColor4D (1.0f, 0.7f ,0.8f, 1.0f), //dxf color code 231
aiColor4D (0.7f, 0.0f ,0.4f, 1.0f), //dxf color code 232
aiColor4D (0.7f, 0.5f ,0.6f, 1.0f), //dxf color code 233
aiColor4D (0.5f, 0.0f ,0.3f, 1.0f), //dxf color code 234
aiColor4D (0.5f, 0.3f ,0.4f, 1.0f), //dxf color code 235
aiColor4D (0.4f, 0.0f ,0.2f, 1.0f), //dxf color code 236
aiColor4D (0.4f, 0.3f ,0.3f, 1.0f), //dxf color code 237
aiColor4D (0.3f, 0.0f ,0.2f, 1.0f), //dxf color code 238
aiColor4D (0.3f, 0.2f ,0.3f, 1.0f), //dxf color code 239
aiColor4D (1.0f, 0.0f ,0.2f, 1.0f), //dxf color code 240
aiColor4D (1.0f, 0.7f ,0.7f, 1.0f), //dxf color code 241
aiColor4D (0.7f, 0.0f ,0.2f, 1.0f), //dxf color code 242
aiColor4D (0.7f, 0.5f ,0.6f, 1.0f), //dxf color code 243
aiColor4D (0.5f, 0.0f ,0.1f, 1.0f), //dxf color code 244
aiColor4D (0.5f, 0.3f ,0.4f, 1.0f), //dxf color code 245
aiColor4D (0.4f, 0.0f ,0.1f, 1.0f), //dxf color code 246
aiColor4D (0.4f, 0.3f ,0.3f, 1.0f), //dxf color code 247
aiColor4D (0.3f, 0.0f ,0.1f, 1.0f), //dxf color code 248
aiColor4D (0.3f, 0.2f ,0.2f, 1.0f), //dxf color code 249
aiColor4D (0.2f, 0.2f ,0.2f, 1.0f), //dxf color code 250
aiColor4D (0.3f, 0.3f ,0.3f, 1.0f), //dxf color code 251
aiColor4D (0.4f, 0.4f ,0.4f, 1.0f), //dxf color code 252
aiColor4D (0.5f, 0.5f ,0.5f, 1.0f), //dxf color code 253
aiColor4D (0.7f, 0.7f ,0.7f, 1.0f), //dxf color code 254
aiColor4D (1.0f, 1.0f ,1.0f, 1.0f) //dxf color code 255
}; };
#define AI_DXF_NUM_INDEX_COLORS (sizeof(g_aclrDxfIndexColors)/sizeof(g_aclrDxfIndexColors[0])) #define AI_DXF_NUM_INDEX_COLORS (sizeof(g_aclrDxfIndexColors)/sizeof(g_aclrDxfIndexColors[0]))
#define AI_DXF_ENTITIES_MAGIC_BLOCK "$ASSIMP_ENTITIES_MAGIC" #define AI_DXF_ENTITIES_MAGIC_BLOCK "$ASSIMP_ENTITIES_MAGIC"
@ -95,7 +338,7 @@ static const int GroupCode_XComp = 10;
static const int GroupCode_YComp = 20; static const int GroupCode_YComp = 20;
static const int GroupCode_ZComp = 30; static const int GroupCode_ZComp = 30;
static const aiImporterDesc desc = { static constexpr aiImporterDesc desc = {
"Drawing Interchange Format (DXF) Importer", "Drawing Interchange Format (DXF) Importer",
"", "",
"", "",
@ -108,33 +351,11 @@ static const aiImporterDesc desc = {
"dxf" "dxf"
}; };
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
DXFImporter::DXFImporter()
: BaseImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
DXFImporter::~DXFImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool DXFImporter::CanRead( const std::string& filename, IOSystem* pIOHandler, bool checkSig ) const { bool DXFImporter::CanRead( const std::string& filename, IOSystem* pIOHandler, bool /*checkSig*/ ) const {
const std::string& extension = GetExtension( filename ); static const char *tokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" };
if ( extension == desc.mFileExtensions ) { return SearchFileHeaderForToken(pIOHandler, filename, tokens, AI_COUNT_OF(tokens), 32);
return true;
}
if ( extension.empty() || checkSig ) {
static const char * const pTokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" };
return SearchFileHeaderForToken(pIOHandler, filename, pTokens, 4, 32 );
}
return false;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -149,7 +370,7 @@ void DXFImporter::InternReadFile( const std::string& filename, aiScene* pScene,
std::shared_ptr<IOStream> file = std::shared_ptr<IOStream>( pIOHandler->Open( filename) ); std::shared_ptr<IOStream> file = std::shared_ptr<IOStream>( pIOHandler->Open( filename) );
// Check whether we can read the file // Check whether we can read the file
if( file.get() == nullptr ) { if (file == nullptr) {
throw DeadlyImportError( "Failed to open DXF file ", filename, ""); throw DeadlyImportError( "Failed to open DXF file ", filename, "");
} }
@ -164,7 +385,7 @@ void DXFImporter::InternReadFile( const std::string& filename, aiScene* pScene,
// DXF files can grow very large, so read them via the StreamReader, // DXF files can grow very large, so read them via the StreamReader,
// which will choose a suitable strategy. // which will choose a suitable strategy.
file->Seek(0,aiOrigin_SET); file->Seek(0,aiOrigin_SET);
StreamReaderLE stream( file ); StreamReaderLE stream( std::move(file) );
DXF::LineReader reader (stream); DXF::LineReader reader (stream);
DXF::FileData output; DXF::FileData output;
@ -242,7 +463,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output) {
ASSIMP_LOG_VERBOSE_DEBUG("DXF: Unexpanded polycount is ", icount, ", vertex count is ", vcount); ASSIMP_LOG_VERBOSE_DEBUG("DXF: Unexpanded polycount is ", icount, ", vertex count is ", vcount);
} }
if (! output.blocks.size() ) { if (output.blocks.empty()) {
throw DeadlyImportError("DXF: no data blocks loaded"); throw DeadlyImportError("DXF: no data blocks loaded");
} }
@ -377,7 +598,9 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
// XXX this would be the place to implement recursive expansion if needed. // XXX this would be the place to implement recursive expansion if needed.
const DXF::Block& bl_src = *(*it).second; const DXF::Block& bl_src = *(*it).second;
for (std::shared_ptr<const DXF::PolyLine> pl_in : bl_src.lines) { const size_t size = bl_src.lines.size(); // the size may increase in the loop
for (size_t i = 0; i < size; ++i) {
std::shared_ptr<const DXF::PolyLine> pl_in = bl_src.lines[i];
if (!pl_in) { if (!pl_in) {
ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping."); ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping.");
continue; continue;
@ -390,8 +613,12 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
// XXX order // XXX order
aiMatrix4x4 trafo, tmp; aiMatrix4x4 trafo, tmp;
aiMatrix4x4::Translation(-bl_src.base,trafo); aiMatrix4x4::Translation(-bl_src.base,trafo);
trafo *= aiMatrix4x4::Scaling(insert.scale,tmp); //Need to translate position before scaling the insert
//otherwise the position ends up being the position*scaling
//STH 2024.01.17
trafo *= aiMatrix4x4::Translation(insert.pos,tmp); trafo *= aiMatrix4x4::Translation(insert.pos,tmp);
trafo *= aiMatrix4x4::Scaling(insert.scale,tmp);
//trafo *= aiMatrix4x4::Translation(insert.pos,tmp);
// XXX rotation currently ignored - I didn't find an appropriate sample model. // XXX rotation currently ignored - I didn't find an appropriate sample model.
if (insert.angle != 0.f) { if (insert.angle != 0.f) {
@ -482,7 +709,7 @@ void DXFImporter::ParseBlocks(DXF::LineReader& reader, DXF::FileData& output) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output) { void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output) {
// push a new block onto the stack. // push a new block onto the stack.
output.blocks.push_back( DXF::Block() ); output.blocks.emplace_back();
DXF::Block& block = output.blocks.back(); DXF::Block& block = output.blocks.back();
while( !reader.End() && !reader.Is(0,"ENDBLK")) { while( !reader.End() && !reader.Is(0,"ENDBLK")) {
@ -527,7 +754,7 @@ void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output) { void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output) {
// Push a new block onto the stack. // Push a new block onto the stack.
output.blocks.push_back( DXF::Block() ); output.blocks.emplace_back();
DXF::Block& block = output.blocks.back(); DXF::Block& block = output.blocks.back();
block.name = AI_DXF_ENTITIES_MAGIC_BLOCK; block.name = AI_DXF_ENTITIES_MAGIC_BLOCK;
@ -557,7 +784,7 @@ void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output)
} }
void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output) { void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output) {
output.blocks.back().insertions.push_back( DXF::InsertBlock() ); output.blocks.back().insertions.emplace_back();
DXF::InsertBlock& bl = output.blocks.back().insertions.back(); DXF::InsertBlock& bl = output.blocks.back().insertions.back();
while( !reader.End() && !reader.Is(0)) { while( !reader.End() && !reader.Is(0)) {
@ -598,10 +825,11 @@ void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output)
} }
} }
#define DXF_POLYLINE_FLAG_CLOSED 0x1 static constexpr unsigned int DXF_POLYLINE_FLAG_CLOSED = 0x1;
#define DXF_POLYLINE_FLAG_3D_POLYLINE 0x8 // Currently unused
#define DXF_POLYLINE_FLAG_3D_POLYMESH 0x10 //static constexpr unsigned int DXF_POLYLINE_FLAG_3D_POLYLINE = 0x8;
#define DXF_POLYLINE_FLAG_POLYFACEMESH 0x40 //static constexpr unsigned int DXF_POLYLINE_FLAG_3D_POLYMESH = 0x10;
static constexpr unsigned int DXF_POLYLINE_FLAG_POLYFACEMESH = 0x40;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output) { void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output) {
@ -650,12 +878,6 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
reader++; reader++;
} }
//if (!(line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH)) {
// DefaultLogger::get()->warn((Formatter::format("DXF: polyline not currently supported: "),line.flags));
// output.blocks.back().lines.pop_back();
// return;
//}
if (vguess && line.positions.size() != vguess) { if (vguess && line.positions.size() != vguess) {
ASSIMP_LOG_WARN("DXF: unexpected vertex count in polymesh: ", ASSIMP_LOG_WARN("DXF: unexpected vertex count in polymesh: ",
line.positions.size(),", expected ", vguess ); line.positions.size(),", expected ", vguess );
@ -745,12 +967,18 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
case 71: case 71:
case 72: case 72:
case 73: case 73:
case 74: case 74: {
if (cnti == 4) { if (cnti == 4) {
ASSIMP_LOG_WARN("DXF: more than 4 indices per face not supported; ignoring"); ASSIMP_LOG_WARN("DXF: more than 4 indices per face not supported; ignoring");
break; break;
} }
indices[cnti++] = reader.ValueAsUnsignedInt(); const int index = reader.ValueAsSignedInt();
if (index >= 0) {
indices[cnti++] = static_cast<unsigned int>(index);
} else {
indices[cnti++] = static_cast<unsigned int>(-index);
}
}
break; break;
// color // color
@ -788,8 +1016,7 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output) void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output) {
{
// (note) this is also used for for parsing line entities, so we // (note) this is also used for for parsing line entities, so we
// must handle the vertex_count == 2 case as well. // must handle the vertex_count == 2 case as well.
@ -806,8 +1033,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
if (reader.GroupCode() == 0) { if (reader.GroupCode() == 0) {
break; break;
} }
switch (reader.GroupCode()) switch (reader.GroupCode()) {
{
// 8 specifies the layer // 8 specifies the layer
case 8: case 8:

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -68,8 +68,8 @@ namespace DXF {
*/ */
class DXFImporter : public BaseImporter { class DXFImporter : public BaseImporter {
public: public:
DXFImporter(); DXFImporter() = default;
~DXFImporter() override; ~DXFImporter() override = default;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team Copyright (c) 2006-2024, assimp team
All rights reserved. All rights reserved.
@ -87,11 +86,6 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element &element, const std::s
} }
} }
// ------------------------------------------------------------------------------------------------
AnimationCurve::~AnimationCurve() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element &element, const std::string &name, AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element &element, const std::string &name,
const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/, const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/,
@ -147,11 +141,6 @@ AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element &element, cons
props = GetPropertyTable(doc, "AnimationCurveNode.FbxAnimCurveNode", element, sc, false); props = GetPropertyTable(doc, "AnimationCurveNode.FbxAnimCurveNode", element, sc, false);
} }
// ------------------------------------------------------------------------------------------------
AnimationCurveNode::~AnimationCurveNode() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const AnimationCurveMap &AnimationCurveNode::Curves() const { const AnimationCurveMap &AnimationCurveNode::Curves() const {
if (curves.empty()) { if (curves.empty()) {
@ -193,11 +182,6 @@ AnimationLayer::AnimationLayer(uint64_t id, const Element &element, const std::s
props = GetPropertyTable(doc, "AnimationLayer.FbxAnimLayer", element, sc, true); props = GetPropertyTable(doc, "AnimationLayer.FbxAnimLayer", element, sc, true);
} }
// ------------------------------------------------------------------------------------------------
AnimationLayer::~AnimationLayer() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNodeList AnimationLayer::Nodes(const char *const *target_prop_whitelist /*= nullptr*/, AnimationCurveNodeList AnimationLayer::Nodes(const char *const *target_prop_whitelist /*= nullptr*/,
size_t whitelist_size /*= 0*/) const { size_t whitelist_size /*= 0*/) const {
@ -279,11 +263,6 @@ AnimationStack::AnimationStack(uint64_t id, const Element &element, const std::s
} }
} }
// ------------------------------------------------------------------------------------------------
AnimationStack::~AnimationStack() {
// empty
}
} // namespace FBX } // namespace FBX
} // namespace Assimp } // namespace Assimp

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