diff options
author | Hans Lambermont <hans@lambermont.dyndns.org> | 2002-10-12 15:37:38 +0400 |
---|---|---|
committer | Hans Lambermont <hans@lambermont.dyndns.org> | 2002-10-12 15:37:38 +0400 |
commit | 12315f4d0e0ae993805f141f64cb8c73c5297311 (patch) | |
tree | 59b45827cd8293cfb727758989c7a74b40183974 /source/gameengine/Physics/Sumo/convert.txt |
Initial revisionv2.25
Diffstat (limited to 'source/gameengine/Physics/Sumo/convert.txt')
-rw-r--r-- | source/gameengine/Physics/Sumo/convert.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/gameengine/Physics/Sumo/convert.txt b/source/gameengine/Physics/Sumo/convert.txt new file mode 100644 index 00000000000..81f8f602cde --- /dev/null +++ b/source/gameengine/Physics/Sumo/convert.txt @@ -0,0 +1,35 @@ +static DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj) +{ + DT_ShapeHandle shape = DT_NewComplexShape(); + int numpolys = meshobj->NumPolygons(); + int numvalidpolys = 0; + + for (int p=0; p<numpolys; p++) + { + RAS_Polygon* poly = meshobj->GetPolygon(p); + + // only add polygons that have the collisionflag set + if (poly->IsCollider()) + { + DT_Begin(); + for (int v=0; v<poly->VertexCount(); v++) { + MT_Point3 pt = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, + poly->GetVertexIndexBase().m_indexarray[v], + poly->GetMaterial()->GetPolyMaterial())->xyz(); + DT_Vertex(pt[0],pt[1],pt[2]); + } + DT_End(); + + numvalidpolys++; + } + } + + DT_EndComplexShape(); + + if (numvalidpolys==0) { + delete shape; + return NULL; + } else { + return shape; + } +} |