CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File 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 __CS_MDLTOOL_H__
00020 #define __CS_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 
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   csIntArray *Vertices, *Normals, *Colors, *Texels;
00051 public:
00052 
00058   csSingleIndexVertexSet (bool ver = true, bool nrm = true,
00059     bool col = true, bool tex = true);
00060 
00067   csSingleIndexVertexSet (csIntArray *Vertices, csIntArray *Normals,
00068     csIntArray *Colors, csIntArray *Texels, bool DeleteLists);
00069 
00071   ~csSingleIndexVertexSet ();
00072 
00078   int Add (int Vertex, int Normal, int Color, int Texel);
00079 
00083   void Add (int num, int *Vertices, int *Normal, int *Colors, int *Texels);
00084 
00086   int GetVertexCount () const;
00087 
00089   int GetVertex (int n) const;
00091   int GetNormal (int n) const;
00093   int GetColor (int n) const;
00095   int GetTexel (int n) const;
00096 };
00097 
00099 struct csModelDataTools
00100 {
00111   static void MergeCopyObject (iModelDataObject *dest, iModelDataObject *src);
00112 
00118   static void CopyVerticesMapped (iModelDataObject *dest,
00119     iModelDataObject *src, const csModelDataVertexMap *map);
00120 
00126   static void MergeObjects (iModelData *Scene, bool MultiTexture);
00127 
00132   static void SplitObjectsByMaterial (iModelData *Scene);
00133 
00137   static void Describe (iObject *obj, csString &s);
00138 
00143   static void CompressVertices (iModelDataObject *Object);
00144 
00149   static void CompressVertices (iModelData *Scene);
00150 
00172   static void BuildVertexArray (iModelDataPolygon* poly,
00173         csIntArray* SpriteVertices, csIntArray* SpriteNormals,
00174         csIntArray* SpriteColors, csIntArray* SpriteTexels,
00175         csIntArray* PolyVertices);
00176 };
00177 
00178 #endif // __CS_MDLTOOL_H__

Generated for Crystal Space by doxygen 1.2.14