【问题标题】:Collada skeleton and controller relationCollada 骨架和控制器关系
【发布时间】:2017-06-10 10:00:46
【问题描述】:

我正在为 android OpenGL ES2 开发一个 collada 加载器,该场景有许多我可以加载的网格和灯光,现在我正在处理加载骨架和动画,我可以从 visual_scene 节点解析骨架并将它们存储在一个列表中对于具有 Id 和 Joint 列表的 Skeleton 类,我从 library_controllers 解析控制器,我可以将其与视觉场景节点的 instance_controller 的网格抛出 url 链接,现在我想将控制器与骨架链接,例如: visual_scene 库中的骨架部分是:

  <node id="Armature_001" name="Armature_001" type="NODE">
    <translate sid="location">0 5 -3.883436</translate>
    <rotate sid="rotationZ">0 0 1 0</rotate>
    <rotate sid="rotationY">0 1 0 0</rotate>
    <rotate sid="rotationX">1 0 0 0</rotate>
    <scale sid="scale">1 1 1</scale>
    <node id="Bone" name="Bone" sid="Bone" type="JOINT">
      <matrix sid="transform">1 0 0 0 0 0 -1 0 0 1 0 0 0 0 0 1</matrix>
      <node id="Bone_001" name="Bone.001" sid="Bone_001" type="JOINT">
        <matrix sid="transform">1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1</matrix>
      </node>
    </node>
  </node>

视觉场景中的网格是:

  <node id="Cube" name="Cube" type="NODE">
    <translate sid="location">0 0 0</translate>
    <rotate sid="rotationZ">0 0 1 0</rotate>
    <rotate sid="rotationY">0 1 0 0</rotate>
    <rotate sid="rotationX">1 0 0 0</rotate>
    <scale sid="scale">1 1 1</scale>
    <instance_controller url="#Armature_001_Cube-skin">
      <skeleton>#Bone</skeleton>
      <bind_material>
        <technique_common>
          <instance_material symbol="Material_001-material" target="#Material_001-material"/>
        </technique_common>
      </bind_material>
    </instance_controller>
  </node>

library_controllers 的控制器是:

<controller id="Armature_Cube_001-skin" name="Armature">
  <skin source="#Cube_001-mesh">
    <bind_shape_matrix>1 0 0 0 0 1 0 -5 0 2.78181e-8 3 -1.39091e-7 0 0 0 1</bind_shape_matrix>
    <source id="Armature_Cube_001-skin-joints">
      <Name_array id="Armature_Cube_001-skin-joints-array" count="2">Bone Bone_002</Name_array>
      <technique_common>
        <accessor source="#Armature_Cube_001-skin-joints-array" count="2" stride="1">
          <param name="JOINT" type="name"/>
        </accessor>
      </technique_common>
    </source>
    <source id="Armature_Cube_001-skin-bind_poses">
      <float_array id="Armature_Cube_001-skin-bind_poses-array" count="32">1 0 0 0 0 0 -1 2.5 0 1 0 5 0 0 0 1 1 0 0 0 0 0 -1 1.5 0 1 0 5 0 0 0 1</float_array>
      <technique_common>
        <accessor source="#Armature_Cube_001-skin-bind_poses-array" count="2" stride="16">
          <param name="TRANSFORM" type="float4x4"/>
        </accessor>
      </technique_common>
    </source>
    <source id="Armature_Cube_001-skin-weights">
      <float_array id="Armature_Cube_001-skin-weights-array" count="20">1 0.9464464 0.05355352 1 0.9444246 0.05557531 1 0.9444246 0.05557531 1 0.9464464 0.05355352 0.02067142 0.9793285 0.02056819 0.9794319 0.02067142 0.9793285 0.02056819 0.9794319</float_array>
      <technique_common>
        <accessor source="#Armature_Cube_001-skin-weights-array" count="20" stride="1">
          <param name="WEIGHT" type="float"/>
        </accessor>
      </technique_common>
    </source>
    <joints>
      <input semantic="JOINT" source="#Armature_Cube_001-skin-joints"/>
      <input semantic="INV_BIND_MATRIX" source="#Armature_Cube_001-skin-bind_poses"/>
    </joints>
    <vertex_weights count="12">
      <input semantic="JOINT" source="#Armature_Cube_001-skin-joints" offset="0"/>
      <input semantic="WEIGHT" source="#Armature_Cube_001-skin-weights" offset="1"/>
      <vcount>1 2 1 2 1 2 1 2 2 2 2 2 </vcount>
      <v>1 0 0 1 1 2 1 3 0 4 1 5 1 6 0 7 1 8 1 9 0 10 1 11 0 12 1 13 0 14 1 15 0 16 1 17 0 18 1 19</v>
    </vertex_weights>
  </skin>
</controller>

我的问题是,如果有许多具有不同骨架和控制器的网格,我可以将控制器和 Id 字符串中的骨架链接起来

【问题讨论】:

    标签: opengl-es-2.0 collada


    【解决方案1】:

    试试 AssimpLib,支持 Collada 和骨骼动画,辛苦了

    【讨论】:

      猜你喜欢
      • 2017-08-10
      • 2011-04-02
      • 2011-10-15
      • 2011-10-09
      • 2013-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多