cstool/mdltool.h
00001 /* 00002 Copyright (C) 2001 by Martin Geisse <mgeisse@gmx.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_MDLTOOL_H__ 00020 #define __CS_MDLTOOL_H__ 00021 00022 #include "csutil/garray.h" 00023 00024 class csString; 00025 struct iObject; 00026 struct iModelData; 00027 struct iModelDataObject; 00028 struct iModelDataPolygon; 00029 00031 struct csModelDataVertexMap 00032 { 00033 int VertexCount, NormalCount, ColorCount, TexelCount; 00034 int *Vertices, *Normals, *Colors, *Texels; 00035 }; 00036 00041 class csSingleIndexVertexSet 00042 { 00043 private: 00044 // delete the lists upon destruction? 00045 bool Delete; 00046 // number of vertices. This is stored outside the lists because not all lists 00047 // may be available, making it hard to get the vertex count from the lists. 00048 int Count; 00049 // the lists 00050 csDirtyAccessArray<int> *Vertices, *Normals, *Colors, *Texels; 00051 00052 public: 00058 csSingleIndexVertexSet (bool ver = true, bool nrm = true, 00059 bool col = true, bool tex = true); 00060 00067 csSingleIndexVertexSet (csDirtyAccessArray<int> *Vertices, 00068 csDirtyAccessArray<int> *Normals, csDirtyAccessArray<int> *Colors, 00069 csDirtyAccessArray<int> *Texels, bool DeleteLists); 00070 00072 ~csSingleIndexVertexSet (); 00073 00079 int Add (int Vertex, int Normal, int Color, int Texel); 00080 00084 void Add (int num, int *Vertices, int *Normal, int *Colors, int *Texels); 00085 00087 int GetVertexCount () const; 00088 00090 int GetVertex (int n) const; 00092 int GetNormal (int n) const; 00094 int GetColor (int n) const; 00096 int GetTexel (int n) const; 00097 }; 00098 00100 struct csModelDataTools 00101 { 00112 static void MergeCopyObject (iModelDataObject *dest, iModelDataObject *src); 00113 00119 static void CopyVerticesMapped (iModelDataObject *dest, 00120 iModelDataObject *src, const csModelDataVertexMap *map); 00121 00127 static void MergeObjects (iModelData *Scene, bool MultiTexture); 00128 00133 static void SplitObjectsByMaterial (iModelData *Scene); 00134 00138 static void Describe (iObject *obj, csString &s); 00139 00144 static void CompressVertices (iModelDataObject *Object); 00145 00150 static void CompressVertices (iModelData *Scene); 00151 00173 static void BuildVertexArray (iModelDataPolygon* poly, 00174 csDirtyAccessArray<int>* SpriteVertices, csDirtyAccessArray<int>* SpriteNormals, 00175 csDirtyAccessArray<int>* SpriteColors, csDirtyAccessArray<int>* SpriteTexels, 00176 csDirtyAccessArray<int>* PolyVertices); 00177 }; 00178 00179 #endif // __CS_MDLTOOL_H__
Generated for Crystal Space by doxygen 1.2.18