CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | 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 #include "csutil/dirtyaccessarray.h"
00024 #include "csutil/refarr.h"
00025 #include "csutil/cscolor.h"
00026 #include "csgeom/tri.h"
00027 #include "csgeom/vector3.h"
00028 #include "csgeom/vector2.h"
00029 #include "csgeom/box.h"
00030 
00031 struct iMaterialWrapper;
00032 struct iTerraFormer;
00033 struct iLODControl;
00034 
00038 struct csFoliageVertex
00039 {
00040   csVector3 pos;
00041   csVector2 texel;
00042   csColor color;
00043   csVector3 normal;
00044 };
00045 
00046 SCF_VERSION (iFoliageGeometry, 0, 0, 1);
00047 
00051 struct iFoliageGeometry : public iBase
00052 {
00056   virtual size_t AddVertex (const csVector3& pos, const csVector2& texel,
00057         const csColor& color, const csVector3& normal) = 0;
00058 
00062   virtual const csDirtyAccessArray<csFoliageVertex>& GetVertices () const = 0;
00063 
00067   virtual size_t AddTriangle (const csTriangle& tri) = 0;
00068 
00072   virtual const csDirtyAccessArray<csTriangle>& GetTriangles () const = 0;
00073 
00077   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
00078 
00082   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
00083 };
00084 
00085 SCF_VERSION (iFoliageObject, 0, 0, 1);
00086 
00092 struct iFoliageObject : public iBase
00093 {
00097   virtual const char* GetName () const = 0;
00098 
00105   virtual csPtr<iFoliageGeometry> CreateGeometry (size_t lodslot) = 0;
00106 
00118   virtual csPtr<iFoliageGeometry> CreateGeometryLOD (size_t fromslot,
00119       size_t toslot, float factor) = 0;
00120 
00126   virtual iFoliageGeometry* GetGeometry (size_t lodslot) = 0;
00127 
00133   virtual size_t GetMaxLodSlot () const = 0;
00134 
00138   virtual iLODControl* GetLODControl () = 0;
00139 };
00140 
00141 
00142 SCF_VERSION (iFoliageFactoryState, 0, 0, 1);
00143 
00165 struct iFoliageFactoryState : public iBase
00166 {
00170   virtual csPtr<iFoliageObject> CreateObject (const char* name) = 0;
00171 
00175   virtual iFoliageObject* FindObject (const char* name) const = 0;
00176 
00180   virtual const csRefArray<iFoliageObject>& GetObjects () const = 0;
00181 
00196   virtual void AddPaletteEntry (size_t typeidx, const char* objectname,
00197       float relative_density) = 0;
00198 
00202   virtual void ClearPaletteType (size_t typeidx) = 0;
00203 
00207   virtual size_t GetPaletteTypeCount () const = 0;
00208 
00213   virtual size_t GetPaletteEntryCount (size_t typeidx) const = 0;
00214 
00219   virtual const char* GetPaletteEntry (size_t typeidx, size_t entryidx,
00220       float& relative_density) = 0;
00221 
00245   virtual void SetTerraFormer (iTerraFormer* form) = 0;
00249   virtual iTerraFormer* GetTerraFormer () = 0;
00250 
00255   virtual void SetSamplerRegion (const csBox2& region) = 0;
00259   virtual const csBox2& GetSamplerRegion () const = 0;
00260 };
00261 
00262 SCF_VERSION (iFoliageMeshState, 0, 0, 1);
00263 
00281 struct iFoliageMeshState : public iBase
00282 {
00283 };
00284 
00285 #endif // __CS_IMESH_FOLIAGEMESH_H__
00286 

Generated for Crystal Space by doxygen 1.3.9.1