aboulianne - 2008-12-01

The accessor tag defines mechanics on how to read from arrays. Is there a high-level helper class or function which allows easier browsing through arrays using these accessors, or does everybody who wants to browse them have to reimplement the mechanics?

Let me illustrate a little.
From this partial collada:
<source id="aaa-vertices">
  <float_array id="aaa-vertices-array" count="9">0 0 0 1 1 1 2 2 2</float_array>
    <accessor source="#aaa-vertices-array" count="3" stride="3">
      <param name="X" type="float">
      <param name="Y" type="float">
      <param name="Z" type="float">

a helper class could provide something like
  float myY;
  AccessorHelper.GetValue( 1, "Y", myY );

which would put the Y component of the 2nd (0-based) vector in the value myY. By templating that function and specializing, one can verify that the type of the third parameter does match the type specified by the targetted <param> type. The goal is to provide typed array access mechanics.

Is there such a helper class somewhere in the library? is it planned? Would there be anyone who already coded one and would want to share it? I'll start writing my own in the meanwhile, but I believe this kind of tool would greatly benefit everyone.