| ## Public API Reference

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

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

# iTerrainObjectState Struct Reference
[Mesh plugins]

This will override the settings for material in the parent. More...

`#include <imesh/terrain.h>`

Inheritance diagram for iTerrainObjectState:

[legend]
List of all members.

## Public Member Functions
virtual int | CollisionDetect (iMovable *m, csTransform *p)=0
| Detects collision with a specific transform.
virtual bool | GetCastShadows ()=0
| Retrieve whether shadow casting is enabled.
virtual float | GetLODValue (const char *parameter) const =0
| Get a LOD parameter.
virtual const char * | GetMaterialMapFile (int &width, int &height, bool &raw)=0
| Get the name of the materalmap file, the width, height, and if it is raw or a plain image file.
virtual bool | GetStaticLighting ()=0
| Retrieve whether static lighting is enabled.
virtual void | SetCastShadows (bool enable)=0
| Enable or disable shadow casting by this terrain mesh.
virtual bool | SetLODValue (const char *parameter, float value)=0
| Set a LOD parameter.
virtual void | SetMaterialMapFile (const char *file, int width, int height, bool raw=false)=0
| Set the name of the materalmap file, the width, height, and if it is raw or a plain image file.
virtual void | SetStaticLighting (bool enable)=0
| Enable or disable the use of static lighting.
virtual bool | SetMaterialPalette (const csArray< iMaterialWrapper * > &pal)=0
| Set/Get the material palette, this is used to specify materials on a bytemap representing the material makeup of the terrain.
virtual bool | SaveState (const char *filename)=0
| Save/Restore preprocessing information, the algorithm will do some preprocessing based on the material and height information this allows the process to be saved out to a file and cached for later reuse (maybe this should be the caching system) In some cases it may actually memorymap this file.
virtual bool | SetMaterialAlphaMaps (const csArray< csArray< char > > &data, int x, int y)=0
| In short, the materialmap paints the palette onto the terrain like an indexed image format paints a color palette onto the screen It sets the materials per pixel in the material map.
virtual bool | SetMaterialMap (const csArray< char > &data, int x, int y)=0
| In short, the materialmap paints the palette onto the terrain like an indexed image format paints a color palette onto the screen It sets the materials per pixel in the material map.

## Detailed Description

This will override the settings for material in the parent.

Definition at line 44 of file terrain.h.

## Member Function Documentation

virtual int iTerrainObjectState::CollisionDetect | ( | iMovable * | m,
|  | csTransform * | p |
| ) |  |  | `[pure virtual]`

Detects collision with a specific transform.

virtual bool iTerrainObjectState::GetCastShadows | ( |  | ) | `[pure virtual]`

Retrieve whether shadow casting is enabled.

virtual float iTerrainObjectState::GetLODValue | ( | const char * | parameter | ) | const`[pure virtual]`

Get a LOD parameter.

virtual const char* iTerrainObjectState::GetMaterialMapFile | ( | int & | width,
|  | int & | height,
|  | bool & | raw |
| ) |  |  | `[pure virtual]`

Get the name of the materalmap file, the width, height, and if it is raw or a plain image file.

virtual bool iTerrainObjectState::GetStaticLighting | ( |  | ) | `[pure virtual]`

Retrieve whether static lighting is enabled.

virtual bool iTerrainObjectState::SaveState | ( | const char * | filename | ) | `[pure virtual]`

Save/Restore preprocessing information, the algorithm will do some preprocessing based on the material and height information this allows the process to be saved out to a file and cached for later reuse (maybe this should be the caching system) In some cases it may actually memorymap this file.

virtual void iTerrainObjectState::SetCastShadows | ( | bool | enable | ) | `[pure virtual]`

Enable or disable shadow casting by this terrain mesh.

virtual bool iTerrainObjectState::SetLODValue | ( | const char * | parameter,
|  | float | value |
| ) |  |  | `[pure virtual]`

Set a LOD parameter.

The following parameters can be used:

- "lod distance" - The distance at which splatting is no longer in effect and the base texture is the only layer.
- "error tolerance" - The screenspace error tolerance in numbers of pixels. Error will be less than the given tolerance so setting the tolerance to values less than 1 is worthless.

Returns:
  Whether the value was accepted by the terrain object.

virtual bool iTerrainObjectState::SetMaterialAlphaMaps | ( | const csArray< csArray< char > > & | data,
|  | int | x,
|  | int | y |
| ) |  |  | `[pure virtual]`

In short, the materialmap paints the palette onto the terrain like an indexed image format paints a color palette onto the screen It sets the materials per pixel in the material map.

If x and y are not equal to the heightmap the materialmap will scale accordingly. If they are equal than the material map will map a single material to a single high level quad in the final terrain. Note x and y must be 2^n and usually they must be equal This version expects an array of alpha maps (typically gray scale images). For every material in the palette except for the last one(!) there will be an alpha map so this array should have one element less compared to the palette. The alpha map for the last palette entry will be calculated so that the alpha values add up to 100%.

Deprecated:
  This will only work for SimpleFormers. Directories for paging terrain should be set via the respective former state.

virtual bool iTerrainObjectState::SetMaterialMap | ( | const csArray< char > & | data,
|  | int | x,
|  | int | y |
| ) |  |  | `[pure virtual]`

In short, the materialmap paints the palette onto the terrain like an indexed image format paints a color palette onto the screen It sets the materials per pixel in the material map.

If x and y are not equal to the heightmap the materialmap will scale accordingly. If they are equal than the material map will map a single material to a single high level quad in the final terrain. Note x and y must be 2^n and usually they must be equal

Deprecated:
  This will only work for SimpleFormers. Directories for paging terrain should be set via the respective former state.

virtual void iTerrainObjectState::SetMaterialMapFile | ( | const char * | file,
|  | int | width,
|  | int | height,
|  | bool | raw = `false` |
| ) |  |  | `[pure virtual]`

Set the name of the materalmap file, the width, height, and if it is raw or a plain image file.

virtual bool iTerrainObjectState::SetMaterialPalette | ( | const csArray< iMaterialWrapper * > & | pal | ) | `[pure virtual]`

Set/Get the material palette, this is used to specify materials on a bytemap representing the material makeup of the terrain.

virtual void iTerrainObjectState::SetStaticLighting | ( | bool | enable | ) | `[pure virtual]`

Enable or disable the use of static lighting.

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

- imesh/terrain.h