KeithSloan / GDML

FreeCAD GDML Workbench - AddonManager Installable
Other
49 stars 16 forks source link

Fix usage of Rotation.toEulerAngles() #42

Closed realthunder closed 3 years ago

realthunder commented 3 years ago

Please make sure to test it using my branch. For your workbench, I recommend you to test with my Daily release with experimental renderer enabled (Preference -> Display -> Render cache -> Experiemental). I have just made a new release, make sure to download the image with Daily keyword.

Note that in the code I have reversed order of the return from toEulerAngles(). This is because you are exporting those angles with the wrong order, which I guess is the result of using the older toEuler(). I suggest you remove the use of toEuler() altogether and simply raise an exception if toEulerAngles() is not available, because, well toEuler() won't work anyway.

I also include a second commit to reduce call of recompute(). This is very important to improve performance of import. I have also added a corresponding patch to my branch to disable redraw during recompute. The combined result will greatly improve import performance. With the latest Daily release image, I was able to import the rich_mirror file in #40 in 6 seconds, and about 8 fps rendering performance using the experimental renderer.

The rendering performance is still not great because you are using Link to render large amount of relatively simply geometry, which means lots of matrix operations during rendering. Things will get better when the renderer starts to use shader for instance based rendering, but you can improve on that by yourself as well. For those containers with lots of small linked objects, you can use the group code I gave you to display a compound shape of all children, which will be rendered a lot faster.