PDA

View Full Version : Hirarchical Animation



gerire
11-13-2002, 01:42 PM
I have to draw anything I want and am going to use an Aeroplane (very Basic) would the sad but true face be, to get this to work, to plot points on graph paper and make out the polygons myself or would there be a simpler way of doing this??

jpummill
11-13-2002, 02:20 PM
You could use a 3d modeling package to desing your plane and then use a library to load the 3d data into your application.

Some popular programs are:
3D Studio,
Lightwave,
Blender (freeware),
Milkshape (freeware, I think).

Good luck,
jpummill

d_a_heitbrink
11-14-2002, 01:29 PM
MilkShape is not free but it has a 30 free trial, it can export your stuff to a nice text file. Theres lots of toturials on how to import the file.
Here is a sample file from milk shape:

Frames: 30
Frame: 1

Meshes: 1 //the number of meshes in our model
"Sphere01" 1 0 //name flags, material index
22 //number of verts in the mesh
//flags,x,y,z,u,v,bone index, -1 no bone ascociated with mesh
1 0.000000 0.000000 0.250000 0.000000 1.000000 -1
..
..
..
1 12.216282 38.750000 0.235672 1.000000 0.333333 -1
12 //the normals for mesh- we skip this, don't need it
0.000000 -1.000000 0.000000
..
..
..
0.168657 0.837806 -0.519264
20 //the number of triangle
// triangle: flags, vertex index1, vertex index2, vertex index3, normal index1,
// normal index 2, normal index 3, smoothing group
//you only need the 3 vertex indexes
1 0 1 2 0 1 2 1
..
..
..
1 17 21 19 11 5 1 1
// the next mesh would come here if we had another mesh

Materials: 1 //number of materials
"Material01" //material name
0.200000 0.200000 0.200000 1.000000 //ambient
0.800000 0.800000 0.800000 1.000000 //diffuse
0.000000 0.000000 0.000000 1.000000 //specular
0.000000 0.000000 0.000000 1.000000 //emissive
0.000000 //shine
1.000000 //transparency
".\Fca.tga" //file name
""

Bones: 0 //we can't handle bones yet

basicly what you do is you read in the vert into an array, then the triangle into another. then this code should give you an idea of how you displace it

glBegin(GL_TRIANGLES);
for (i=0 to num of Triangle){
glVertex(vertArray[triangle[i][0]]);
glVertex(vertArray[triangle[i][1]]));
glVertex(vertArray[triangle[i][2]]));
}
glEng();