CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

foliage.h

00001 /*
00002     Copyright (C) 2004 by Jorrit Tyberghein
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_IMESH_FOLIAGEMESH_H__
00020 #define __CS_IMESH_FOLIAGEMESH_H__
00021 
00022 #include "csutil/scf.h"
00023 
00024 #include "csgeom/vector2.h"
00025 #include "csgeom/vector3.h"
00026 #include "csutil/cscolor.h"
00027 #include "csutil/dirtyaccessarray.h"
00028 #include "csutil/refarr.h"
00029 
00030 struct iMaterialWrapper;
00031 struct iTerraFormer;
00032 struct iLODControl;
00033 
00034 class csBox2;
00035 class csTriangle;
00036 
00040 struct csFoliageVertex
00041 {
00042   csVector3 pos;
00043   csVector2 texel;
00044   csColor color;
00045   csVector3 normal;
00046 };
00047 
00048 SCF_VERSION (iFoliageGeometry, 0, 0, 1);
00049 
00053 struct iFoliageGeometry : public iBase
00054 {
00058   virtual size_t AddVertex (const csVector3& pos, const csVector2& texel,
00059         const csColor& color, const csVector3& normal) = 0;
00060 
00064   virtual const csDirtyAccessArray<csFoliageVertex>& GetVertices () const = 0;
00065 
00069   virtual size_t AddTriangle (const csTriangle& tri) = 0;
00070 
00074   virtual const csDirtyAccessArray<csTriangle>& GetTriangles () const = 0;
00075 
00079   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
00080 
00084   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
00085 };
00086 
00087 SCF_VERSION (iFoliageObject, 0, 0, 1);
00088 
00094 struct iFoliageObject : public iBase
00095 {
00099   virtual const char* GetName () const = 0;
00100 
00107   virtual csPtr<iFoliageGeometry> CreateGeometry (size_t lodslot) = 0;
00108 
00120   virtual csPtr<iFoliageGeometry> CreateGeometryLOD (size_t fromslot,
00121       size_t toslot, float factor) = 0;
00122 
00128   virtual iFoliageGeometry* GetGeometry (size_t lodslot) = 0;
00129 
00135   virtual size_t GetMaxLodSlot () const = 0;
00136 
00140   virtual iLODControl* GetLODControl () = 0;
00141 };
00142 
00143 
00144 SCF_VERSION (iFoliageFactoryState, 0, 0, 1);
00145 
00167 struct iFoliageFactoryState : public iBase
00168 {
00172   virtual csPtr<iFoliageObject> CreateObject (const char* name) = 0;
00173 
00177   virtual iFoliageObject* FindObject (const char* name) const = 0;
00178 
00182   virtual const csRefArray<iFoliageObject>& GetObjects () const = 0;
00183 
00198   virtual void AddPaletteEntry (size_t typeidx, const char* objectname,
00199       float relative_density) = 0;
00200 
00204   virtual void ClearPaletteType (size_t typeidx) = 0;
00205 
00209   virtual size_t GetPaletteTypeCount () const = 0;
00210 
00215   virtual size_t GetPaletteEntryCount (size_t typeidx) const = 0;
00216 
00221   virtual const char* GetPaletteEntry (size_t typeidx, size_t entryidx,
00222       float& relative_density) = 0;
00223 
00247   virtual void SetTerraFormer (iTerraFormer* form) = 0;
00251   virtual iTerraFormer* GetTerraFormer () = 0;
00252 
00257   virtual void SetSamplerRegion (const csBox2& region) = 0;
00261   virtual const csBox2& GetSamplerRegion () const = 0;
00262 };
00263 
00264 SCF_VERSION (iFoliageMeshState, 0, 0, 1);
00265 
00283 struct iFoliageMeshState : public iBase
00284 {
00285 };
00286 
00287 #endif // __CS_IMESH_FOLIAGEMESH_H__
00288 

Generated for Crystal Space by doxygen 1.4.4