Results 1 to 2 of 2

Thread: daeTArray<T> programming tip

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Posts
    14

    daeTArray<T> programming tip

    Hi,

    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:

    struct Buffers
    {
    daeTArray<int>* indexBuf;
    daeTArray<float>* vertexBuf;
    //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):

    <mesh>
    <source id="geom-Plane1-positions">
    <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>
    <technique_common>
    <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"/>
    </accessor>
    </technique_common>

    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)

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •