CrystalSpace

Public API Reference

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

iFoliageFactoryState Struct Reference

The foliage mesh can be used to make foliage (plants, boulders, ...) that fits nicely with a terrain. More...

#include <imesh/foliage.h>

Inheritance diagram for iFoliageFactoryState:

iBase List of all members.

Public Member Functions

virtual csPtr< iFoliageObjectCreateObject (const char *name)=0
 Create a new foliage object.
virtual iFoliageObjectFindObject (const char *name) const =0
 Find a foliage object by name.
virtual const csRefArray<
iFoliageObject > & 
GetObjects () const =0
 Return all foliage objects.
virtual void AddPaletteEntry (size_t typeidx, const char *objectname, float relative_density)=0
 Add a foliage object name to a palette index.
virtual void ClearPaletteType (size_t typeidx)=0
 Clear a given palette type.
virtual size_t GetPaletteTypeCount () const =0
 Get the total number of palette types.
virtual size_t GetPaletteEntryCount (size_t typeidx) const =0
 For a given palette type, return the number of objects in this palette.
virtual const char * GetPaletteEntry (size_t typeidx, size_t entryidx, float &relative_density)=0
 For a given palette type and entry index, return the object name and density.
virtual void SetTerraFormer (iTerraFormer *form)=0
 The terraformer defines various properties for this foliage mesh.
virtual iTerraFormerGetTerraFormer ()=0
 Get the terraformer.
virtual void SetSamplerRegion (const csBox2 &region)=0
 This specifies the max region the foliage mesh will sample from (from the terraformer).
virtual const csBox2GetSamplerRegion () const =0
 Get the sampler region.

Detailed Description

The foliage mesh can be used to make foliage (plants, boulders, ...) that fits nicely with a terrain.

The general API for the foliage factory. Here you define the actual geometry which is shared between all foliage mesh instances.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface: Main users of this interface:

Definition at line 165 of file foliage.h.


Member Function Documentation

virtual void iFoliageFactoryState::AddPaletteEntry size_t  typeidx,
const char *  objectname,
float  relative_density
[pure virtual]
 

Add a foliage object name to a palette index.

Palette indices are selected by the 'foliage_types' map (see SetTerraFormer()). Every foliage palette can contain zero or more object names. When a certain block in the landscape uses a specific palette index then the density given in the density map is multiplied with the normalized densities for the objects in that specific foliage palette and this will give the distribution of objects at that spot.

Parameters:
typeidx is the palette index (or type index) as it corresponds with the values from the 'foliage_types' map.
objectname is the name of the object to use in this type.
relative_density is the relative density.

virtual void iFoliageFactoryState::ClearPaletteType size_t  typeidx  )  [pure virtual]
 

Clear a given palette type.

virtual csPtr<iFoliageObject> iFoliageFactoryState::CreateObject const char *  name  )  [pure virtual]
 

Create a new foliage object.

virtual iFoliageObject* iFoliageFactoryState::FindObject const char *  name  )  const [pure virtual]
 

Find a foliage object by name.

virtual const csRefArray<iFoliageObject>& iFoliageFactoryState::GetObjects  )  const [pure virtual]
 

Return all foliage objects.

virtual const char* iFoliageFactoryState::GetPaletteEntry size_t  typeidx,
size_t  entryidx,
float &  relative_density
[pure virtual]
 

For a given palette type and entry index, return the object name and density.

virtual size_t iFoliageFactoryState::GetPaletteEntryCount size_t  typeidx  )  const [pure virtual]
 

For a given palette type, return the number of objects in this palette.

virtual size_t iFoliageFactoryState::GetPaletteTypeCount  )  const [pure virtual]
 

Get the total number of palette types.

virtual const csBox2& iFoliageFactoryState::GetSamplerRegion  )  const [pure virtual]
 

Get the sampler region.

virtual iTerraFormer* iFoliageFactoryState::GetTerraFormer  )  [pure virtual]
 

Get the terraformer.

virtual void iFoliageFactoryState::SetSamplerRegion const csBox2 region  )  [pure virtual]
 

This specifies the max region the foliage mesh will sample from (from the terraformer).

virtual void iFoliageFactoryState::SetTerraFormer iTerraFormer form  )  [pure virtual]
 

The terraformer defines various properties for this foliage mesh.

The terraformer needs to support the following properties:

  • 'heights': this basically comes directly from the heightmap and is returned as an array of floats. The normal simpleformer (as is used by the landscape engine) supports this automatically.
  • 'vertices': this basically comes directly from the heightmap and is returned as an array of csVector3's. The normal simpleformer (as is used by the landscape engine) supports this automatically.
  • 'foliage_density': this is another float map which represents the density of foliage at that point. The number represents the number of foliage objects in one 1x1 unit. So using a uniform density of 1 will place one object in every 1x1 square. This map must have same resolution as the heightmap.
  • 'foliage_types': this is an int map which indicates the types of foliage to use for every block in the heightmap. These numbers correspond with the foliage palette numbers. If this map contains palette indices that are not defined then no foliage will be generated on that spot. This map must have same resolution as the heightmap.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1