iMeshGenerator 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
iMeshGenerator Struct Reference
Crystal Space 3D Engine

iMeshGenerator defines the interface for a mesh generator. More...

`#include <iengine/meshgen.h>`

Inheritance diagram for iMeshGenerator:

List of all members.

## Public Member Functions
virtual void | AddDensityFactorMap (const char *factorMapID, iImage *mapImage, const CS::Math::Matrix4 &worldToMap)=0
| Add a density factor map in grayscale.
virtual void | AddMesh (iMeshWrapper *mesh)=0
| Add a mesh on which we will map our geometry.
virtual void | ClearPosition (const csVector3 &pos)=0
| Clear the block at a certain position.
virtual iMeshGeneratorGeometry * | CreateGeometry ()=0
| Create a geometry specification for this mesh generator.
virtual int | GetBlockCount () const =0
| Get the block count.
virtual int | GetCellCount () const =0
| Get the cell count.
virtual float | GetDefaultDensityFactor () const =0
| Get the default density factor.
virtual int | GetDensityFactorMapHeight (const char *factorMapID) const =0
| Get the height of the density factory map.
virtual int | GetDensityFactorMapWidth (const char *factorMapID) const =0
| Get the width of the density factory map.
virtual iMeshGeneratorGeometry * | GetGeometry (size_t idx)=0
| Get a specific geometry.
virtual size_t | GetGeometryCount () const =0
| Get the number of geometry specifications.
virtual iMeshWrapper * | GetMesh (size_t idx)=0
| Get a specific mesh.
virtual size_t | GetMeshCount () const =0
| Get the number of meshes.
virtual const csBox3 & | GetSampleBox () const =0
| Get the sample box.
virtual const CS::Math::Matrix4 & | GetWorldToMapTransform (const char *factorMapID) const =0
| Return the world to map transform of a density factor map.
virtual bool | IsValidDensityFactorMap (const char *factorMapID) const =0
| Check if a given density factor map exists.
virtual iObject * | QueryObject ()=0
| Get the iObject for this mesh generator.
virtual void | RemoveGeometry (size_t idx)=0
| Remove a geometry.
virtual void | RemoveMesh (size_t idx)=0
| Remove a mesh.
virtual void | SetAlphaScale (float mindist, float maxdist)=0
| Set the alpha scale.
virtual void | SetBlockCount (int number)=0
| Set the maximum number of blocks to keep in memory at the same time.
virtual void | SetCellCount (int number)=0
| Set the number of cells to use in one direction.
virtual void | SetDefaultDensityFactor (float factor)=0
| Set a default density factor.
virtual void | SetDensityScale (float mindist, float maxdist, float maxdensityfactor)=0
virtual void | SetSampleBox (const csBox3 &box)=0
| Get the box where where we will sample.
virtual void | UpdateDensityFactorMap (const char *factorMapID, iImage *mapImage)=0
| Update a density factor map from an image.

## Detailed Description

iMeshGenerator defines the interface for a mesh generator.

Main creators of instances implementing this interface:

- iSector::CreateMeshGenerator()

Main ways to get pointers to this interface:

- iSector::GetMeshGenerator()

Main users of this interface:

- engine

Definition at line 229 of file meshgen.h.

## Member Function Documentation

virtual void iMeshGenerator::AddDensityFactorMap | ( | const char * | factorMapID,
|  | iImage * | mapImage,
|  | const CS::Math::Matrix4 & | worldToMap
| ) |  | `[pure virtual]`

Add a density factor map in grayscale.

These can be used by geometries to influence the density at some given point.

Parameters:

  factorMapID | Identifier by which this map is referenced. Used to link factor maps to geometries.
  mapImage | Image with density data.
  worldToMap | Transformation to map world coordinates into normalized image coordinates. Transform is applied to coordinates for which the density is to be determined, and the X and Y components of the transformed coordinates are used as image coordinates.

virtual void iMeshGenerator::AddMesh | ( | iMeshWrapper * | mesh | ) | `[pure virtual]`

Add a mesh on which we will map our geometry.

virtual void iMeshGenerator::ClearPosition | ( | const csVector3 & | pos | ) | `[pure virtual]`

Clear the block at a certain position.

This is useful for regenerating the block after making changes to the density map (for example).

virtual iMeshGeneratorGeometry* iMeshGenerator::CreateGeometry | ( |  | ) | `[pure virtual]`

Create a geometry specification for this mesh generator.

virtual int iMeshGenerator::GetBlockCount | ( |  | ) | const`[pure virtual]`

Get the block count.

virtual int iMeshGenerator::GetCellCount | ( |  | ) | const`[pure virtual]`

Get the cell count.

virtual float iMeshGenerator::GetDefaultDensityFactor | ( |  | ) | const`[pure virtual]`

Get the default density factor.

virtual int iMeshGenerator::GetDensityFactorMapHeight | ( | const char * | factorMapID | ) | const`[pure virtual]`

Get the height of the density factory map.

If the map doesn't exist then this will return 0.

virtual int iMeshGenerator::GetDensityFactorMapWidth | ( | const char * | factorMapID | ) | const`[pure virtual]`

Get the width of the density factory map.

If the map doesn't exist then this will return 0.

virtual iMeshGeneratorGeometry* iMeshGenerator::GetGeometry | ( | size_t | idx | ) | `[pure virtual]`

Get a specific geometry.

virtual size_t iMeshGenerator::GetGeometryCount | ( |  | ) | const`[pure virtual]`

Get the number of geometry specifications.

virtual iMeshWrapper* iMeshGenerator::GetMesh | ( | size_t | idx | ) | `[pure virtual]`

Get a specific mesh.

virtual size_t iMeshGenerator::GetMeshCount | ( |  | ) | const`[pure virtual]`

Get the number of meshes.

virtual const csBox3& iMeshGenerator::GetSampleBox | ( |  | ) | const`[pure virtual]`

Get the sample box.

virtual const CS::Math::Matrix4& iMeshGenerator::GetWorldToMapTransform | ( | const char * | factorMapID | ) | const`[pure virtual]`

Return the world to map transform of a density factor map.

This function does not attempt to check if the factor map actually exists so use IsValidDensityFactorMap() first!

virtual bool iMeshGenerator::IsValidDensityFactorMap | ( | const char * | factorMapID | ) | const`[pure virtual]`

Check if a given density factor map exists.

virtual iObject* iMeshGenerator::QueryObject | ( |  | ) | `[pure virtual]`

Get the iObject for this mesh generator.

virtual void iMeshGenerator::RemoveGeometry | ( | size_t | idx | ) | `[pure virtual]`

Remove a geometry.

virtual void iMeshGenerator::RemoveMesh | ( | size_t | idx | ) | `[pure virtual]`

Remove a mesh.

virtual void iMeshGenerator::SetAlphaScale | ( | float | mindist,
|  | float | maxdist
| ) |  | `[pure virtual]`

Set the alpha scale.

If this is set then objects in the distance will use alpha mode.

Parameters:

  mindist | is the minimum distance at which alpha scale starts. At this distance the alpha factor will be 1 (meaning no alpha).
  maxdist | is the maximum distance at which alpha scale ends. At this distance the alpha factor will be equal to '0'.

virtual void iMeshGenerator::SetBlockCount | ( | int | number | ) | `[pure virtual]`

Set the maximum number of blocks to keep in memory at the same time.

A block contains generated positions. Generating a block may be expensive (depending on density and size of the cells) so it may be good to have a high number here. Having a high number means more memory usage though. Default is 100.

virtual void iMeshGenerator::SetCellCount | ( | int | number | ) | `[pure virtual]`

Set the number of cells to use in one direction.

Total cells will be 'number*number'. A cell is a logical unit that can keep a number of generated positions. Using bigger (fewer) cells means that more positions are generated at once (possibly causing hickups when this happens). Smaller cells may mean more runtime overhead. Default is 50.

virtual void iMeshGenerator::SetDefaultDensityFactor | ( | float | factor | ) | `[pure virtual]`

Set a default density factor.

This factor is the final multiplier for density and so it can be used to control global density to cater for higher/lower-end hardware more easily. The default is 1.0.

virtual void iMeshGenerator::SetDensityScale | ( | float | mindist,
|  | float | maxdist,
|  | float | maxdensityfactor
| ) |  | `[pure virtual]`

Deprecated:
  Feature removed in 2.1.

Similar functionality can be achieved by using multiple geometries with different densities.

virtual void iMeshGenerator::SetSampleBox | ( | const csBox3 & | box | ) | `[pure virtual]`

Get the box where where we will sample.

We will sample starting at the highest y value of the box and pointing down to the lowest y value of the box.

Todo:
  In future support other directions for the mapping beam.

virtual void iMeshGenerator::UpdateDensityFactorMap | ( | const char * | factorMapID,
|  | iImage * | mapImage
| ) |  | `[pure virtual]`

Update a density factor map from an image.

This function does nothing if the factor map doesn't exist.

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

- iengine/meshgen.h