00001 00002 /* 00003 TSGL - Teddy Space Game Library 00004 Copyright (C) 2002 Timo Suoranta 00005 tksuoran@cc.helsinki.fi 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 $Id: FrontierMesh.h,v 1.1 2002/01/08 20:47:05 tksuoran Exp $ 00022 */ 00023 00024 00025 #ifndef TEDDY__SPACE_GAME__FRONTIER_MESH_H 00026 #define TEDDY__SPACE_GAME__FRONTIER_MESH_H 00027 00028 00029 #include "Teddy/Models/Mesh.h" 00030 #include "Teddy/Models/Face.h" 00031 #include "Teddy/SysSupport/StdMap.h" 00032 using namespace Teddy::Models; 00033 00034 00035 namespace Teddy { 00036 namespace SpaceGame { 00037 00038 00039 typedef map<int, Vertex *, less<int> > int_to_Vertex; 00040 00041 00042 class FrontierFile; 00043 00044 00046 class FrontierMesh : public Mesh { 00047 public: 00048 FrontierMesh( FrontierFile *f, int ob_id, const char *name ); 00049 00050 virtual void debug ( Uint32 command, void *data ); 00051 00052 protected: 00053 void faceBegin (); 00054 void faceInsertVertex( int index ); 00055 void faceInsertSpline( int p1, int p2, int c1, int c2 ); 00056 void faceClose ( int normal_index = -1 ); 00057 void makeVertex ( Vertex &v1, Vertex &v2 ); 00058 void parseObject ( const int object_index ); 00059 void parseVertices (); 00060 void parseNormals (); 00061 void parseSpecs (); 00062 void parseElements (); 00063 00064 void printVertices (); 00065 00066 // Object struct 00067 char *mesh_pointer; 00068 char *vertex_pointer; 00069 Sint32 vertex_count; 00070 char *normal_pointer; 00071 Uint32 normal_count; 00072 Uint32 unknown_2; 00073 Uint32 unknown_3; 00074 Uint32 radius; 00075 Sint32 primitive_count; 00076 Uint32 unknown_4; 00077 Uint32 unknown_5; 00078 Uint32 unknown_6; 00079 Uint32 unknown_7; 00080 char *collision_pointer; 00081 char *spec_pointer; 00082 Uint32 unknown_8; 00083 Uint32 unknown_9; 00084 00085 FrontierFile *f; 00086 Face *face; 00087 bool face_open; 00088 bool face_good; 00089 int face_num_vertices; 00090 int last_vertex_index; 00091 int_to_Vertex vertices; 00092 int_to_Vertex normals; 00093 list<Element*>::const_iterator debug_selected_element_it; 00094 }; 00095 00096 00097 }; // namespace SpaceGame 00098 }; // namespace Teddy 00099 00100 00101 #endif // TEDDY__SPACE_GAME__FRONTIER_MESH_H 00102