Results 1 to 4 of 4

Thread: <vertices> / <triangles> clarification

  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    9

    <vertices> / <triangles> clarification

    I don't understand why the input to <triangles> normal, color etc can also sometimes show up in <vertices>.

    To add to my confusion both <triangles> and <vertices> handle thier inputs differently.

    Is there a good reason for this that I am missing?

    Thanks

    David.

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    You can have many <triangles> or other primitives in a <mesh> that can share the same information on the <vertices>, or can have their own values for it.

    For example, you may want to share the color information at the vertex, or you may want to have a different color for each polygon sharing the vertex position.

    The <inputs> are handle exactly the same way in <vertices> or <triangles>, what makes you think there is a difference ?

  3. #3
    Junior Member
    Join Date
    May 2007
    Posts
    9
    I guess that make sense except the Maya exporter seems to randomly decide what to put as inputs for <triangles> and <vertices> . (At least it seems random )

    When accessing the input array in <triangles> I can only get domInputLocalOffset_Array but when the inputs are the <vertex> element I can only access domInputLocal_Array? This kind of leads to pretty ugly code as in CrtSceneRead.cpp

    Code :
    CrtInt CrtScene::BuildPrimitivesData(CrtPolyGroup * primitives, domInputLocalOffset_Array & inputs)



    (Checking normal inputs in two different places)

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    When accessing the input array in <triangles> I can only get domInputLocalOffset_Array but when the inputs are the <vertex> element I can only access domInputLocal_Array?
    The schema has two different types to represent <input> elements. One type is InputLocal and the other is InputLocalOffset. The InputLocalOffset elements have "offset" and "set" attributes that aren't applicable to elements of type InputLocal. Because they're distinct types in the schema, the code generator creates distinct classes in the DOM. The common attributes ("semantic" and "source") don't get factored out into a base class unfortunately, but it shouldn't be too hard to write code to work with both.

    You should try to write your code to find the appropriate <input>s no matter where they are. For example the normals input might be in <vertices> or in <triangles>. The best way to handle this would be to write a function domSource* findSource(domInputLocalOffset_Array& inputs, const char* semantic) that looks for an <input> with a specific semantic and then returns the corresponding <source>. If it encounters an input with the "VERTEX" semantic than it should traverse through the linked <vertices> element looking for the <input> you're after. I'm not sure how RT handles this off the top of my head.

Posting Permissions

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