iMeshGeneratorGeometry Struct Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
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:

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 | GetMaximumOpaqueDistance ()=0
| Get the maximum distance at which meshes appear opaque.
virtual float | GetMinimumDrawDistance ()=0
| Get the minimum drawing distance for any mesh in this geometry.
virtual float | GetMinimumOpaqueDistance ()=0
| Get the minimum distance at which meshes appear opaque.
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 | SetMaximumOpaqueDistance (float dist)=0
| Set the maximum distance at which meshes appear opaque.
virtual void | SetMinimumDrawDistance (float dist)=0
| Set the minimum drawing distance for any mesh in this geometry.
virtual void | SetMinimumOpaqueDistance (float dist)=0
| Set the minimum distance at which meshes appear opaque.
virtual void | SetRadius (float radius)=0
| Set the radius for this object.
virtual void | SetWindBias (float bias)=0
| Set the swing bias of simulated wind.
virtual void | SetWindDirection (float x, float z)=0
| Set the direction that simulated wind will blow towards.
virtual void | SetWindSpeed (float speed)=0
| Set the swing speed of simulated wind.
virtual bool | UseDensityFactorMap (const char *factorMapID, float factor)=0
| Use a density factor map.

## 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.

See also:
  SetMinimumDrawDistance to set a minimum drawing distance for all factories.

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::GetMaximumOpaqueDistance | ( |  | ) | `[pure virtual]`

Get the maximum distance at which meshes appear opaque.

virtual float iMeshGeneratorGeometry::GetMinimumDrawDistance | ( |  | ) | `[pure virtual]`

Get the minimum drawing distance for any mesh in this geometry.

virtual float iMeshGeneratorGeometry::GetMinimumOpaqueDistance | ( |  | ) | `[pure virtual]`

Get the minimum distance at which meshes appear opaque.

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::SetMaximumOpaqueDistance | ( | float | dist | ) | `[pure virtual]`

Set the maximum distance at which meshes appear opaque.

A mesh, at the maximum opacity distance, is drawn fully opaque and is faded out until it reaches the maximum drawing distance (where it is drawn fully transparent).

Remarks:
  If the mesh generator has distances to fade in between set (with iMeshGenerator::SetAlphaScale), the closer of the per-generator and per-geometry distances are used for fading.

virtual void iMeshGeneratorGeometry::SetMinimumDrawDistance | ( | float | dist | ) | `[pure virtual]`

Set the minimum drawing distance for any mesh in this geometry.

A mesh is not displayed if it is closer than this distance.

virtual void iMeshGeneratorGeometry::SetMinimumOpaqueDistance | ( | float | dist | ) | `[pure virtual]`

Set the minimum distance at which meshes appear opaque.

A mesh, at the minimum drawing distance, is drawn fully transparent and is faded in until it reaches the minimum opacity distance (where it is drawn fully opaque).

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.

virtual void iMeshGeneratorGeometry::SetWindBias | ( | float | bias | ) | `[pure virtual]`

Set the swing bias of simulated wind.

A higher bias equals a lower back swing on foliage. Min bias of 1.0;

Parameters:

  bias | is the value of the wind bias.

virtual void iMeshGeneratorGeometry::SetWindDirection | ( | float | x,
|  | float | z
| ) |  | `[pure virtual]`

Set the direction that simulated wind will blow towards.

Parameters:

  x | is the x coordinate direction.
  z | is the z coordinate direction.

virtual void iMeshGeneratorGeometry::SetWindSpeed | ( | float | speed | ) | `[pure virtual]`

Set the swing speed of simulated wind.

Min speed of 0.0;

Parameters:

  speed | is the value of the wind speed.

virtual bool iMeshGeneratorGeometry::UseDensityFactorMap | ( | const char * | factorMapID,
|  | float | factor
| ) |  | `[pure virtual]`

Use a density factor map.

The sum of all densities from factor maps will affect the density at a given point. The value from the map will be scaled by the given factor. The final density will be based on base density * sum of density factor map values.

Parameters:

  factorMapID | The identifier with which the map was added to the mesh generator.
  factor | Factor by which the density from the image is multiplied.

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

- iengine/meshgen.h