cstool/rendermeshlist.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 #include "ivideo/rendermesh.h"
    00033
    00034 struct iEngine;
    00035 struct iMeshWrapper;
    00036 struct iObjectRegistry;
    00037 struct iRenderView;
    00038
    00043 class CS_CRYSTALSPACE_EXPORT csRenderMeshList
    00044 {
    00045 public:
    00051   csRenderMeshList (iEngine* engine);
    00052
    00056   ~csRenderMeshList ();
    00057
    00061   void AddRenderMeshes (CS::Graphics::RenderMesh** meshes, int num,
    00062     CS::Graphics::RenderPriority defaultRenderPriority,
    00063     csZBufMode z_buf_mode, iMeshWrapper* mesh);
    00064
    00069   size_t SortMeshLists (iRenderView *rview);
    00070
    00074   void GetSortedMeshes (CS::Graphics::RenderMesh** meshes, iMeshWrapper** imeshes);
    00075
    00079   void Empty ();
    00080
    00081 private:
    00082   struct meshListEntry
    00083   {
    00084     CS::Graphics::RenderMesh* rm;
    00085     iMeshWrapper* mesh;
    00086
    00087     meshListEntry (CS::Graphics::RenderMesh* mesh, iMeshWrapper* imesh)
    00088       : rm(mesh), mesh(imesh) {}
    00089   };
    00090
    00092   struct renderMeshListInfo
    00093   {
    00095     long renderPriority;
    00096
    00098     int sortingOption;
    00099
    00101     csArray<meshListEntry> meshList;
    00102
    00103   };
    00104
    00105   csPDelArray < renderMeshListInfo > renderList;
    00106   iEngine* engine;
    00107
    00108   static int SortMeshMaterial (meshListEntry const& me1,
    00109         meshListEntry const& me2);
    00110   static int SortMeshBack2Front (meshListEntry const& me1,
    00111         meshListEntry const& me2);
    00112   static int SortMeshFront2Back (meshListEntry const& me1,
    00113         meshListEntry const& me2);
    00114   static csVector3 sort_CameraPosition;
    00115 };
    00116
    00117 #endif //__CS_RENDERMESHLIST_H__