Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to LWO imports #3

Closed
wants to merge 11 commits into from
Closed

Improvements to LWO imports #3

wants to merge 11 commits into from

Conversation

gellule
Copy link

@gellule gellule commented Dec 7, 2011

There are 7 commits in total.

0ed87cb fixes a mistake in c3dad6a which fixes requesting a single layer from an LWO file.

058be93 and 90427fd go together. This is the big commit on cleaning up the parenting code.

32cabd8 and 855e4bc are rotation order fixes.

0a317b9 is just a node naming tweak.

Next will be fixes on LWS import.

This conversion must respect the LightWave ZXY rotation order.
- The default layer index is set to -1.
- Layers without parents are set to have a parent index of -1.
- apcNodes type is changed from std::vector<aiNode*> to std::map<uint16_t, aiNode*>, in order to match layer and layer index.
…ific layer from an LWO file.

We should have two layers (the requested and the default layer) instead of one.
It is added later by BuildGraph when the aiNode hierarchy is created.
Lightwave's logic is that when the pivot is set in the LWS file, it overwrite any pivot from the loaded object.
The isPivotSet member is added to NodeDesc and set to false by default. It is changed to true if PivotPosition is found in the LWS file.
When building the graph for an object, we always have:
ParentAttachNode -> PivotNode -> AttachNode -> MeshNode -> Meshes
PivotNode receives animations if any.
AttachNode receives the -pivotPos transform, as well as the child nodes,
MeshNode has no transformation and contains the meshes.
MeshNode and Meshes are already converted to RH by LWOLoader.
PivotNode and AttachNode are LH until they get converted to RH later and separately.
The pivot position, when not available in the LWS file is obtained from the LWO object, converted back from RH to LH.
@gellule
Copy link
Author

gellule commented Dec 7, 2011

I've added thee additional commits to this pull request. All three are on the LWSLoader.
8680a5e Is a cosmetic change for the name of a NullObject. The layer ID showed up twice in the name; once is enough.
8913a21 Prepares the fact that we need to know whether the pivot position is set in the LWS file and overwrite the pivot coming from the LWO sub files. This is used only in the next commit.
9178570 Gets the pivot and animation nodes right.

And this is all I have for now for the LWO/LWS update. Hoping this is good to go.

@acgessler
Copy link
Member

This is great, it fixed animations for /test/models-nonbsd/LWS/QuickDraw v.2.2.lws as well as for other LWS files in my 'collection' of test files.

I changed a small bit in the last commit: free() works only because new/delete is implemented in terms of it, but strictly speaking it invokes undefined behaviour, so I reproduced the intent using regular delete.

I think it's fair to add you to CREDITS, any wishes about the naming - gellule?

Bye, Alex

Conflicts:
	code/LWSLoader.cpp
@gellule
Copy link
Author

gellule commented Dec 12, 2011

Great! Thanks for the merge, and for the delete/free fix. By the way, why set to NULL the children above the delete rather than deleting it?

Thanks for the CREDITS, gellule should be perfect.

No idea why my merge showed-up in the pull request. I don't think that I can change where the merge point at on my side.

@acgessler
Copy link
Member

That is because aiNode's destructor deletes all of its children recursively, so I had to NULL out the one to keep it. Calling delete on a NULL-pointer is a no-op.

Bye, Alex

@gellule
Copy link
Author

gellule commented Dec 12, 2011

Indeed, thanks!
Closing pull request...
-Gellule/Julien

@gellule gellule closed this Dec 12, 2011
acgessler pushed a commit that referenced this pull request May 2, 2015
kimkulling pushed a commit that referenced this pull request Sep 27, 2018
merge master to RS build branch
kimkulling pushed a commit that referenced this pull request Apr 30, 2019
fast forward to master
kimkulling pushed a commit that referenced this pull request Aug 31, 2019
function parameter 'name' should be passed by const reference
kimkulling added a commit that referenced this pull request Sep 8, 2019
kimkulling pushed a commit that referenced this pull request Feb 9, 2020
Update to the latest version from upstream
kimkulling pushed a commit that referenced this pull request May 16, 2020
kimkulling pushed a commit that referenced this pull request Aug 9, 2021
Merge Master Branch To My Branch
TarcioV added a commit to TarcioV/assimp that referenced this pull request Aug 23, 2021
aavenel pushed a commit to aavenel/assimp that referenced this pull request Nov 4, 2023
==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
    assimp#1 0x7ffcad83ce69 in Assimp::PLY::DOM::ParseHeader C:\Users\aavenel\Dev\assimp\code\AssetLib\Ply\PlyParser.cpp:428
    assimp#2 0x7ffcad83d58e in Assimp::PLY::DOM::ParseInstanceBinary C:\Users\aavenel\Dev\assimp\code\AssetLib\Ply\PlyParser.cpp:498
    assimp#3 0x7ffcad83302a in Assimp::PLYImporter::InternReadFile C:\Users\aavenel\Dev\assimp\code\AssetLib\Ply\PlyLoader.cpp:189
    assimp#4 0x7ffcad4f2f48 in Assimp::BaseImporter::ReadFile C:\Users\aavenel\Dev\assimp\code\Common\BaseImporter.cpp:135
    assimp#5 0x7ffcad51ee46 in Assimp::Importer::ReadFile C:\Users\aavenel\Dev\assimp\code\Common\Importer.cpp:709
    assimp#6 0x7ff7dd8f9f1a in ImportModel C:\Users\aavenel\Dev\assimp\tools\assimp_cmd\Main.cpp:307
    assimp#7 0x7ff7dd8fdf9e in Assimp_Info C:\Users\aavenel\Dev\assimp\tools\assimp_cmd\Info.cpp:344
    assimp#8 0x7ff7dd8fc04f in main C:\Users\aavenel\Dev\assimp\tools\assimp_cmd\Main.cpp:222
    assimp#9 0x7ff7dd9030eb in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    assimp#10 0x7ffd39e57343 in BaseThreadInitThunk+0x13 (C:\WINDOWS\System32\KERNEL32.DLL+0x180017343)
    assimp#11 0x7ffd3a2626b0 in RtlUserThreadStart+0x20 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x1800526b0)
kimkulling pushed a commit that referenced this pull request Nov 20, 2023
==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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants