daeTArray<T> programming tip
Lately I've encountered some problem and haven't found any good solution yet.
What I'm trying to do is to use some structure that cointains pointers to daeTArrays for easier use:
//and so on...
So the problem is that those template types are created during compile time just to generate code. I examine the type of data in <source... elements (in <mesh> element):
<float_array id="geom-Plane1-positions-array" count="18">-0.19685 -0.19685 0 0 -0.19685 0 0.19685 -0.19685 0 -0.19685 0.19685 0 0 0.19685 0 0.19685 0.19685 0</float_array>
<accessor source="#geom-Plane1-positions-array" count="6" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
As we can see source can have float_array or maybe sometime int_array (can I consider that it always will be a float_array?)? So do I need to generate two structures (or two pointers to different types in one) staticaly one with vertexBuf of type daeTArray<float> and another with daeTArray<int> then using switch/if? or can I change it dynamically in run time somehow having just one pointer ?
I'm using COLLADA DOM 2.1 (c++) (1.4.1 schema)
Re: daeTArray<T> programming tip
Caching array pointers isn't going to be sufficient to let you read values from a <source> if that's what you're trying to do. The <source> element can contain (0 or 1 of) many types of arrays and an <accessor> that describes the output data stream.