Sign in to follow this  
giugio

[c++]Collada and normals

Recommended Posts

giugio    246
Hy. In a collada file I have a poly(a cube)with 18 normal, i dont know how normal(face or vertex or..???) <source id="Cube-Geometry-Normals"> <float_array count="18" id="Cube-Geometry-Normals-array">0.00000 0.00000 -1.00000 0.00000 0.00000 1.00000 1.00000 -0.00000 0.00000 -0.00000 -1.00000 -0.00000 -1.00000 0.00000 -0.00000 0.00000 1.00000 0.00000</float_array> <technique_common> <accessor count="6" source="#Cube-Geometry-Normals-array" stride="3"> <param type="float" name="X"></param> <param type="float" name="Y"></param> <param type="float" name="Z"></param> </accessor> </technique_common> </source> and 4 index for face: <polygons count="6" material="Material"> <input offset="0" semantic="VERTEX" source="#Cube-Geometry-Vertex"/> <input offset="1" semantic="NORMAL" source="#Cube-Geometry-Normals"/> <input offset="2" semantic="TEXCOORD" source="#Cube-Geometry-UV"/>

0 0 0 1 0 1 2 0 2 3 0 3

4 1 4 7 1 5 6 1 6 5 1 7

0 2 8 4 2 9 5 2 10 1 2 11

1 3 12 5 3 13 6 3 14 2 3 15

2 4 16 6 4 17 7 4 18 3 4 19

4 5 20 0 5 21 3 5 22 7 5 23

</polygons> what kind of normals i have? Because i have 4 normal for face,I suppose that are vertex normals but if i have a normal for vertex i would have 24 normals(6*4 = 24) and i have only 18 normals. Thanks in advance.

Share this post


Link to post
Share on other sites
gzboli    122
<accessor count="6" source="#Cube-Geometry-Normals-array" stride="3">

This tells you there are 6 normal vectors. Each normal vector has 3 components. The three components are:

<param type="float" name="X"></param>
<param type="float" name="Y"></param>
<param type="float" name="Z"></param>

The normals are stored in a float array. So the first normal is stored as the first three floats in the float array.

For the <polygons> you have, there are 6 of them, making 12 indices per polygon. Because you have 3 inputs (vertex,normal,tex), then that means the poygons are quads (12/3 = 4).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this