CrystalSpace

Public API Reference

cstool/rendermeshlist.h

Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2003 by Marten Svanfeldt
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_RENDERMESHLIST_H__
00020 #define __CS_RENDERMESHLIST_H__
00021 
00026 #include "csextern.h"
00027 
00028 #include "csgeom/vector3.h"
00029 #include "csutil/parray.h"
00030 
00031 #include "ivideo/graph3d.h"
00032 
00033 struct iEngine;
00034 struct iMeshWrapper;
00035 struct iObjectRegistry;
00036 struct iRenderView;
00037 
00038 struct csRenderMesh;
00039 
00040 
00045 class CS_CRYSTALSPACE_EXPORT csRenderMeshList
00046 {
00047 public:
00053   csRenderMeshList (iEngine* engine);
00054   
00058   ~csRenderMeshList ();
00059 
00063   void AddRenderMeshes (csRenderMesh** meshes, int num, long renderPriority,
00064         csZBufMode z_buf_mode, iMeshWrapper* mesh);
00065 
00070   size_t SortMeshLists (iRenderView *rview);
00071 
00075   void GetSortedMeshes (csRenderMesh** meshes, iMeshWrapper** imeshes);
00076 
00080   void Empty ();
00081 
00082 private:
00083   struct meshListEntry
00084   {
00085     csRenderMesh* rm;
00086     iMeshWrapper* mesh;
00087 
00088     meshListEntry (csRenderMesh* mesh, iMeshWrapper* imesh) 
00089       : rm(mesh), mesh(imesh) {}
00090   };
00091 
00093   struct renderMeshListInfo 
00094   {
00096     long renderPriority;
00097 
00099     int sortingOption;
00100 
00102     csArray<meshListEntry> meshList;
00103 
00104   };
00105 
00106   csPDelArray < renderMeshListInfo > renderList;
00107   iEngine* engine;
00108 
00109   static int SortMeshMaterial (meshListEntry const& me1,
00110         meshListEntry const& me2);
00111   static int SortMeshBack2Front (meshListEntry const& me1,
00112         meshListEntry const& me2);
00113   static int SortMeshFront2Back (meshListEntry const& me1,
00114         meshListEntry const& me2);
00115   static csVector3 sort_CameraPosition;
00116 };
00117 
00118 #endif //__CS_RENDERMESHLIST_H__

Generated for Crystal Space by doxygen 1.4.7