Skip to content

Make geometry export more efficient by separating position and normal indices #46

@aothms

Description

@aothms

As of now, an index in IfcGeom::Representation::Triangulation refers to a unique {vertex, normal}-pair, as this is the standard for all OpenGL-based rendering. However, file formats such as OBJ and Collada have separate indexing streams. Maintaining index-pairs results in repeated pairs of indices and more vertices and normals emitted than necessary (especially note the many repeated identical normals):

    <source id="representation-2978545-positions">
      <float_array id="representation-2978545-positions-array" count="1548">0.718 0.015 2.5 0.718 0.015 2.936 0.718 0 2.5 0.718 0 2.936 0.718 0 2.5 ...</float_array>
      <technique_common>
        <accessor source="#representation-2978545-positions-array" count="516" stride="3">
          <param name="X" type="float"/>
          <param name="Y" type="float"/>
          <param name="Z" type="float"/>
        </accessor>
      </technique_common>
    </source>
    <source id="representation-2978545-normals">
      <float_array id="representation-2978545-normals-array" count="1548">1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 ...</float_array>
      <technique_common>
        <accessor source="#representation-2978545-normals-array" count="516" stride="3">
          <param name="X" type="float"/>
          <param name="Y" type="float"/>
          <param name="Z" type="float"/>
        </accessor>
      </technique_common>
    </source>
    <vertices id="representation-2978545-vertices">
      <input semantic="POSITION" source="#representation-2978545-positions"/>
    </vertices>
    <triangles material="IfcWindow" count="172">
      <input semantic="VERTEX" source="#representation-2978545-vertices" offset="0"/>
      <input semantic="NORMAL" source="#representation-2978545-normals" offset="1"/>
      <p>0 0 1 1 2 2 5 5 3 3 4 4 8 8 6 6 ...</p>
    </triangles>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions