Open Stinkfist0 opened 10 years ago
Yes please :)
Should be fairly trivial too, util func to remove all trailing 0
s.
Here https://github.com/realXtend/tundra/blob/tundra2/src/Core/TundraCore/Scene/IAttribute.cpp#L158-163
Then float2/3/4/Quat in the MGL classes https://github.com/realXtend/tundra/blob/tundra2/src/Core/TundraCore/Scene/IAttribute.cpp#L170
Btw is it ok to modify the MGL classes in Tundra? I mean there is some kind of manual merge/diffing step each time we want a new version of MGL in? Are these mods going to make that harder for @cadaver or whoever does that?
Actually maybe its better to just do the to string logic in IAttribute (copying the format from matlib) and do all that stuff via QString::number()
etc. So we dont have to touch the math classes.
Yeah it's probably better to do in IAttribute
Yes, the more we mod MGL, the more troublesome it is to merge a new version. That is a manual process as Tundra's MGL is just files in the Tundra repo.
Therefore this is indeed preferable to do in eg. IAttribute.
However, I see no harm in pinging clb regarding this matter; maybe he'd prefer to have this in MGL.
I'm sure the only thing where Jukka uses strings is debug prints if even there, but still reading that stuff is much nicer without extra zeros.
@juj Any input? :)
There were functions X::SerializeToString() added to MathGeoLib some time ago, see here https://github.com/juj/MathGeoLib/commit/40d39819f4068333a23c69557be275bf4f328d8a
Those functions have the two features:
Try that form, in particular the %.9g
should omit trailing zeros, as opposed to the older %f
that was used.
Ok, nice, I think we can pretty safely modify our MGL copy to use the 'g' modifier.
Sure would be nice to sync whole MGL into Tundra again, seems out last update has been 1 year ago :( SerializeToCodeString
also looks it might be useful in Tundra code.
What was the main reason of keeping a copy in Tundra source tree instead of using it as a pre-built dependency?
Currently f.ex. a default constructed Transform attribute looks like this in TXML:
By omitting unnecessary leading zeros in floats we would save a lot of bytes: