| ## Public API Reference

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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iMeshGeneratorGeometry Struct Reference
[Crystal Space 3D Engine]

This interface defines one piece of geometry for the mesh generator. More...

`#include <iengine/meshgen.h>`

Inheritance diagram for iMeshGeneratorGeometry:

[legend]
List of all members.

## Public Member Functions
virtual void | AddDensityMaterialFactor (iMaterialWrapper *material, float factor)=0
| Add a density factor based on a material.
virtual void | AddFactory (iMeshFactoryWrapper *factory, float maxdist)=0
| Add a factory and the maximum distance after which this factory will no longer be used.
virtual void | AddPosition (const csVector2 &pos)=0
| Add position for placing mesh (only material factor will influence it).
virtual float | GetDensity () const =0
| Get the density.
virtual iMeshFactoryWrapper * | GetFactory (size_t idx)=0
| Get a specified factory.
virtual size_t | GetFactoryCount () const =0
| Get the number of factories for this geometry.
virtual float | GetMaximumDistance (size_t idx)=0
| Get a specified maximum distance.
virtual float | GetRadius () const =0
| Get the radius for this object.
virtual void | RemoveFactory (size_t idx)=0
| Remove a factory.
virtual void | SetDefaultDensityMaterialFactor (float factor)=0
| Set the default factor to use in case the material found on the meshes is not any of the ones defined in the material factory table.
virtual void | SetDensity (float density)=0
| Set the density.
virtual void | SetDensityMap (iTerraFormer *map, float factor, const csStringID &type)=0
| Set a density map in grayscale with factor.
virtual void | SetRadius (float radius)=0
| Set the radius for this object.

## Detailed Description

This interface defines one piece of geometry for the mesh generator.

Main creators of instances implementing this interface:

- iMeshGenerator::CreateGeometry()

Main ways to get pointers to this interface:

- iMeshGenerator::GetGeometry()

Main users of this interface:

- iMeshGenerator

Definition at line 50 of file meshgen.h.

## Member Function Documentation

virtual void iMeshGeneratorGeometry::AddDensityMaterialFactor | ( | iMaterialWrapper * | material,
|  | float | factor |
| ) |  |  | `[pure virtual]`

Add a density factor based on a material.

The base density will be used to try a number of positions in every cell. Then for that position it will determine the material that is hit. If that material is listed in the density factor table then that factor will be used to determine if the position should be used or not. Setting a factor of 0 here will disable the material. Setting a factor of 1 will give full density.

virtual void iMeshGeneratorGeometry::AddFactory | ( | iMeshFactoryWrapper * | factory,
|  | float | maxdist |
| ) |  |  | `[pure virtual]`

Add a factory and the maximum distance after which this factory will no longer be used.

The minimum distance will be calculated from the maximum distance used for other factories in this geometry.

virtual void iMeshGeneratorGeometry::AddPosition | ( | const csVector2 & | pos | ) | `[pure virtual]`

Add position for placing mesh (only material factor will influence it).

virtual float iMeshGeneratorGeometry::GetDensity | ( |  | ) | const`[pure virtual]`

Get the density.

virtual iMeshFactoryWrapper* iMeshGeneratorGeometry::GetFactory | ( | size_t | idx | ) | `[pure virtual]`

Get a specified factory.

virtual size_t iMeshGeneratorGeometry::GetFactoryCount | ( |  | ) | const`[pure virtual]`

Get the number of factories for this geometry.

virtual float iMeshGeneratorGeometry::GetMaximumDistance | ( | size_t | idx | ) | `[pure virtual]`

Get a specified maximum distance.

virtual float iMeshGeneratorGeometry::GetRadius | ( |  | ) | const`[pure virtual]`

Get the radius for this object.

virtual void iMeshGeneratorGeometry::RemoveFactory | ( | size_t | idx | ) | `[pure virtual]`

Remove a factory.

virtual void iMeshGeneratorGeometry::SetDefaultDensityMaterialFactor | ( | float | factor | ) | `[pure virtual]`

Set the default factor to use in case the material found on the meshes is not any of the ones defined in the material factory table.

By default the default factor is 0. This means that as soon as you use SetDensityMaterialFactor() above then on every material that is not listed there will be no foliage generated. The default factor is NOT used in case the material factor table is empty.

virtual void iMeshGeneratorGeometry::SetDensity | ( | float | density | ) | `[pure virtual]`

Set the density.

The density is defined as the number of objects in every 1x1 square. Default density is 1.

Todo:
  add density map support.

virtual void iMeshGeneratorGeometry::SetDensityMap | ( | iTerraFormer * | map,
|  | float | factor,
|  | const csStringID & | type |
| ) |  |  | `[pure virtual]`

Set a density map in grayscale with factor.

The base density will be used to try a number of positions in every cell. Density map will be used to affect base density at given point. So for given point density will be based on base density * value from density map * map factor.

virtual void iMeshGeneratorGeometry::SetRadius | ( | float | radius | ) | `[pure virtual]`

Set the radius for this object.

No other objects will be generated within this radius. If this radius is 0 then there is no limitation on object generation (i.e. objects can be put on top of each other if the random generator decides to do that). Default is 0.

The documentation for this struct was generated from the following file:

- iengine/meshgen.h