Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

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 __MDLTOOL_H__
00020 #define __MDLTOOL_H__
00021 
00022 #include "csutil/intarray.h"
00023 
00024 class csString;
00025 struct iObject;
00026 struct iModelData;
00027 struct iModelDataObject;
00028 struct iModelDataPolygon;
00029 
00030 struct csModelDataVertexMap
00031 {
00032   int VertexCount, NormalCount, ColorCount, TexelCount;
00033   int *Vertices, *Normals, *Colors, *Texels;
00034 };
00035 
00040 class csSingleIndexVertexSet
00041 {
00042 private:
00043   // delete the lists upon destruction?
00044   bool Delete;
00045   // number of vertices. This is stored outside the lists because not all lists
00046   // may be available, making it hard to get the vertex count from the lists.
00047   int Count;
00048   // the lists
00049   csIntArray *Vertices, *Normals, *Colors, *Texels;
00050 public:
00051 
00057   csSingleIndexVertexSet (bool ver = true, bool nrm = true,
00058     bool col = true, bool tex = true);
00059 
00066   csSingleIndexVertexSet (csIntArray *Vertices, csIntArray *Normals,
00067     csIntArray *Colors, csIntArray *Texels, bool DeleteLists);
00068 
00070   ~csSingleIndexVertexSet ();
00071 
00077   int Add (int Vertex, int Normal, int Color, int Texel);
00078 
00082   void Add (int num, int *Vertices, int *Normal, int *Colors, int *Texels);
00083 
00085   int GetVertexCount () const;
00086 
00088   int GetVertex (int n) const;
00090   int GetNormal (int n) const;
00092   int GetColor (int n) const;
00094   int GetTexel (int n) const;
00095 };
00096 
00098 struct csModelDataTools
00099 {
00110   static void MergeCopyObject (iModelDataObject *dest, iModelDataObject *src);
00111 
00117   static void CopyVerticesMapped (iModelDataObject *dest,
00118     iModelDataObject *src, const csModelDataVertexMap *map);
00119 
00125   static void MergeObjects (iModelData *Scene, bool MultiTexture);
00126 
00131   static void SplitObjectsByMaterial (iModelData *Scene);
00132 
00136   static void Describe (iObject *obj, csString &s);
00137 
00142   static void CompressVertices (iModelDataObject *Object);
00143 
00148   static void CompressVertices (iModelData *Scene);
00149 
00171   static void BuildVertexArray (iModelDataPolygon* poly,
00172         csIntArray* SpriteVertices, csIntArray* SpriteNormals,
00173         csIntArray* SpriteColors, csIntArray* SpriteTexels,
00174         csIntArray* PolyVertices);
00175 };
00176 
00177 #endif // __MDLTOOL_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000