KhronosGroup / KhronosGroup/OpenCOLLADA

<float_array>'s "digits" attribute is ignored both in Loader and Writer

Open
#652 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
260
PR merge metrics
No merged PRs in 30d

Description

1. In COLLADAStreamWriter 's "digits" attribute is not written even if StreamWriter::mDoublePrecision is true. According to the specification "digits" should be set to 16-17 significant decimal digits for double instead of default value of 6 digits. I guess Source class in COLLADASWSource.h should write this attribute in prepareToAppendValues() depending on Type: 7-8 digits for float, 16-17 for double. const String CSWC::CSW_ATTRIBUTE_DIGITS = "digits"; should be also added to COLLADASWConstants.
2. In COLLADASaxFrameworkLoader 's "digits" attribute is ignored. Namely, SourceArrayLoader::begin__float_array ignores float_array__AttributeData::digits field. It always calls `beginArray`, while it, probably, should call `beginArray` if digits is big enough (more than 7-8). Ideally, Source class should also store digits value to truncate exact value by the number of digits (e.g., in data__float_array). In any case, data__float_array should accept `const double* data` parameter and be able to determine mCurrentSoure type (btw, there is a typo in its name). Moreover, ColladaParserAutoGen14Private::_data__float_array as well as ColladaParserAutoGen15Private::_data__float_array should use characterData2DoubleData instead of characterData2FloatData so that 's string values can be read as double values. Unfortunately, ColladaParserAutoGen14Private::_data__float_array doesn't know "digits" value so it probably can't determine whether to use float-s or double-s in each case.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with Source::prepareToAppendValues() in COLLADASWSource.h and the constants in COLLADASWConstants, then trace SourceArrayLoader::begin__float_array and the generated _data__float_array methods in the COLLADASaxFrameworkLoader. Done means the writer emits the appropriate digits value and the loader preserves the declared precision, selects float or double handling appropriately, and parses array values without losing precision.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.