Advertisement
miguelmartins1987

Simple 2D triangle in COLLADA

Nov 25th, 2012
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.85 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
  2. <!-- Simple 2D triangle in COLLADA -->
  3. <!-- by miguelmartins1987 -->
  4.  
  5. <COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  6.     <!-- Z axis = UP axis -->
  7.     <asset>
  8.         <up_axis>Z_UP</up_axis>
  9.     </asset>
  10.     <!-- Define a Google SketchUp scene (which shall be the only scene) -->
  11.     <library_visual_scenes>
  12.         <visual_scene id="MyScene">
  13.             <node name="SketchUp">
  14.                 <instance_geometry url="#MyTriangle"/>
  15.             </node>
  16.         </visual_scene>
  17.     </library_visual_scenes>
  18.     <!-- Begin defining geometries -->
  19.     <library_geometries>
  20.         <!-- Just a simple triangle (including normal) -->
  21.         <geometry id="MyTriangle">
  22.             <mesh>
  23.                 <!-- Define a triangle with coordinates
  24.                (0,0,0) (1,0,0) (0,1,0) -->
  25.                 <source id="MyTrianglePosition">
  26.                     <float_array id="MyTriangleCoordinates" count="9">0 0 0 1 0 0 0 1 0</float_array>
  27.                     <technique_common>
  28.                         <accessor count="3" source="#MyTriangleCoordinates" stride="3">
  29.                             <param name="X" type="float" />
  30.                             <param name="Y" type="float" />
  31.                             <param name="Z" type="float" />
  32.                         </accessor>
  33.                     </technique_common>
  34.                 </source>
  35.                 <!-- The normal shall be (0,0,-1) (parallel to the Z axis) -->
  36.                 <source id="MyTriangleNormal">
  37.                     <float_array id="MyTriangleNormalCoordinates" count="9">0 0 -1 0 0 -1 0 0 -1</float_array>
  38.                     <technique_common>
  39.                         <accessor count="3" source="#MyTriangleNormalCoordinates" stride="3">
  40.                             <param name="X" type="float" />
  41.                             <param name="Y" type="float" />
  42.                             <param name="Z" type="float" />
  43.                         </accessor>
  44.                     </technique_common>
  45.                 </source>
  46.                 <!-- Reference the position and the normal defined before -->
  47.                 <vertices id="MyTriangleVertices">
  48.                     <input semantic="POSITION" source="#MyTrianglePosition" />
  49.                     <input semantic="NORMAL" source="#MyTriangleNormal" />
  50.                 </vertices>
  51.                 <!-- The triangles contained by this geometry -->
  52.                 <triangles count="1">
  53.                     <input offset="0" semantic="VERTEX" source="#MyTriangleVertices" />
  54.                     <p>0 1 2</p>
  55.                 </triangles>
  56.             </mesh>
  57.         </geometry>
  58.     </library_geometries>
  59.     <!-- Allow the application to render our only scene -->
  60.     <scene>
  61.         <instance_visual_scene url="#MyScene" />
  62.     </scene>
  63. </COLLADA>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement