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

Fix/dae2dts tool #340

Open
wants to merge 4 commits into
base: Preview4_0
Choose a base branch
from

Conversation

lukaspj
Copy link
Contributor

@lukaspj lukaspj commented Oct 3, 2020

This fixes the dae2dts tool when compiled using VisualStudio 2012.

The first compilation issue is that the compiler cannot open nfd.h. This is because ${libDir}/nativeFileDialogs/include is not added to the project include paths when TORQUE_SDL is disabled. I fixed this by moving #include <nfd.h> to within the #if defined(TORQUE_SDL) preprocessor directive.

The second compilation issue is that the compiler cannot open al/al.h. This is because openal/win32 is added to the project include paths instead of openal-soft/include. I fixed this by updating the include paths in the core and T3D project generator modules.

The last compilation issue is that Component::setOwner(class Entity *) is undefined. This is because the T3D/components engine source directory is not included. I fixed this by adding it to the T3D project generator module.

After getting the program to compile it then generates a fatal error SimObject::object missing call to SimObject::onRemove when run without specifying a DAE file. This is because the program terminates without shutting down the platform. I fixed this by shutting down the platform before terminating.

When you run the program again with a DAE file, it generates an error when TSShapeLoader initializes the TSShape, as there is no GFX device to initialize the vertex buffers. I fixed this by setting TSShape::smInitOnRead to false and making TSShapeLoader adhere to this setting when initializing the TSShape.

After fixing this the program converts DAE models to DTS shapes successfully, however generates a write access violation error when the program exits. This is because the TSShape resource is not unloaded until it goes out of scope, after the platform has shutdown. I fixed this by adding a block scope to the TSShape resource to ensure it goes out of scope before the platform is shutdown.

To generate the project files I am doing the following:

  • Open the dae2dts directory

  • Run generateProjects.bat

  • Open the buildFiles directory

  • Copy torque.ico and Torque.rc from VisualStudio 2008\projects to VisualStudio 2012\projects

  • Open VisualStudio 2012\dae2dts.sln

  • On the dae2dts project, go to it's properties, then:

    • Change Configuration Properties -> General -> Configuration Type to Application (.exe)
    • Change Configuration Properties -> Linker -> General -> Output File to $(OutDir)dae2dts_DEBUG.exe
    • Remove Configuration Properties -> Linker -> Input -> Module Definition File

I am not sure if this is the correct way to fix all of these issues so please let me know if you have any feedback.

...

I also had to modify TSShapeLoader to prevent clearing the TSShape split vertex lists when TSShape::smInitOnRead is set to false, as the split vertex lists are not being stored in a vertex buffer and are still required.

I tested this using teapot.dae and the --compat command line argument and verified the model loaded correctly in Torque ShowTool Pro.

...

Looks like this solution only works when writing the shape in the old format because the new format depends on the vertex buffers and generates a "vertex size mismatch" error when loaded. Not really sure how to go about solving this.

Original PR from GarageGames repo:
GarageGames/Torque3D#1950

@lukaspj lukaspj added bug Something isn't working C++ Issue is engine code specific question Further information is requested labels Oct 3, 2020
@lukaspj
Copy link
Contributor Author

lukaspj commented Oct 3, 2020

@Areloch or maybe @Azaezel is this still relevant? Or are we using assImp now, rendering this moot?

@Azaezel
Copy link
Contributor

Azaezel commented Oct 3, 2020

still using both, why I held off on rolling that one in this morning till we can beat up any side effects that might have creeped in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C++ Issue is engine code specific question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants