OpenCOLLADA icon indicating copy to clipboard operation
OpenCOLLADA copied to clipboard

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

Open Stanislav96 opened this issue 4 years ago • 0 comments

  1. In COLLADAStreamWriter <float_array>'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 <float_array>'s "digits" attribute is ignored. Namely, SourceArrayLoader::begin__float_array ignores float_array__AttributeData::digits field. It always calls beginArray<FloatSource>, while it, probably, should call beginArray<DoubleSource> 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 <float_array>'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.

Stanislav96 avatar Jun 18 '21 11:06 Stanislav96