CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 "csextern.h"
00023 
00024 #include "csutil/garray.h"
00025 
00026 class csString;
00027 struct iObject;
00028 struct iModelData;
00029 struct iModelDataObject;
00030 struct iModelDataPolygon;
00031 
00033 struct csModelDataVertexMap
00034 {
00035   int VertexCount, NormalCount, ColorCount, TexelCount;
00036   int *Vertices, *Normals, *Colors, *Texels;
00037 };
00038 
00043 class CS_CSTOOL_EXPORT csSingleIndexVertexSet
00044 {
00045 private:
00046   // delete the lists upon destruction?
00047   bool Delete;
00048   // number of vertices. This is stored outside the lists because not all lists
00049   // may be available, making it hard to get the vertex count from the lists.
00050   int Count;
00051   // the lists
00052   csDirtyAccessArray<int> *Vertices, *Normals, *Colors, *Texels;
00053 
00054 public:
00060   csSingleIndexVertexSet (bool ver = true, bool nrm = true,
00061     bool col = true, bool tex = true);
00062 
00069   csSingleIndexVertexSet (csDirtyAccessArray<int> *Vertices,
00070     csDirtyAccessArray<int> *Normals, csDirtyAccessArray<int> *Colors,
00071     csDirtyAccessArray<int> *Texels, bool DeleteLists);
00072 
00074   ~csSingleIndexVertexSet ();
00075 
00081   int Add (int Vertex, int Normal, int Color, int Texel);
00082 
00086   void Add (int num, int *Vertices, int *Normal, int *Colors, int *Texels);
00087 
00089   int GetVertexCount () const;
00090 
00092   int GetVertex (int n) const;
00094   int GetNormal (int n) const;
00096   int GetColor (int n) const;
00098   int GetTexel (int n) const;
00099 };
00100 
00102 struct CS_CSTOOL_EXPORT csModelDataTools
00103 {
00114   static void MergeCopyObject (iModelDataObject *dest, iModelDataObject *src);
00115 
00121   static void CopyVerticesMapped (iModelDataObject *dest,
00122     iModelDataObject *src, const csModelDataVertexMap *map);
00123 
00129   static void MergeObjects (iModelData *Scene, bool MultiTexture);
00130 
00135   static void SplitObjectsByMaterial (iModelData *Scene);
00136 
00140   static void Describe (iObject *obj, csString &s);
00141 
00146   static void CompressVertices (iModelDataObject *Object);
00147 
00152   static void CompressVertices (iModelData *Scene);
00153 
00175   static void BuildVertexArray (iModelDataPolygon* poly,
00176         csDirtyAccessArray<int>* SpriteVertices, csDirtyAccessArray<int>* SpriteNormals,
00177         csDirtyAccessArray<int>* SpriteColors, csDirtyAccessArray<int>* SpriteTexels,
00178         csDirtyAccessArray<int>* PolyVertices);
00179 };
00180 
00181 #endif // __CS_MDLTOOL_H__

Generated for Crystal Space by doxygen 1.2.18