| ## Public API Reference

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

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

# iInstancingFactoryState Struct Reference
[Mesh plugins]

This interface describes the API for the instancing mesh factory. More...

`#include <imesh/instmesh.h>`

Inheritance diagram for iInstancingFactoryState:

[legend]
List of all members.

## Public Member Functions
virtual void | AddTriangle (const csTriangle &tri)=0
| Add a triangle.
virtual void | AddVertex (const csVector3 &v, const csVector2 &uv, const csVector3 &normal, const csColor4 &color)=0
| Add a vertex.
virtual void | CalculateNormals (bool compress=true)=0
| Automatically calculate normals based on the current mesh.
virtual void | Compress ()=0
| Compress the vertex table.
virtual void | GenerateBox (const csBox3 &box)=0
| Automatically generate a box.
virtual void | GenerateQuad (const csVector3 &v1, const csVector3 &v2, const csVector3 &v3, const csVector3 &v4)=0
| Automatically generate a qad.
virtual void | GenerateSphere (const csEllipsoid &sphere, int rim_vertices, bool cyl_mapping=false, bool toponly=false, bool reversed=false)=0
| Automatically generate a sphere.
virtual const csColor & | GetColor () const =0
| Get the color.
virtual const csColor4 * | GetColors ()=0
| Get the array of colors.
virtual const csVector3 * | GetNormals ()=0
| Get the array of normals.
virtual const csVector2 * | GetTexels ()=0
| Get the array of texels.
virtual size_t | GetTriangleCount () const =0
| Get the number of triangles for this mesh.
virtual const csTriangle * | GetTriangles ()=0
| Get the array of triangles.
virtual size_t | GetVertexCount () const =0
| Get the number of vertices for this mesh.
virtual const csVector3 * | GetVertices ()=0
| Get the array of vertices.
virtual bool | IsAutoNormals () const =0
| Returns whether normals were autogenerated or manual.
virtual void | SetColor (const csColor &col)=0
| Set the color to use. Will be added to the lighting values.

## Detailed Description

This interface describes the API for the instancing mesh factory.

iInstancingFactoryState inherits from iInstancingMeshCommonState. All methods from iInstancingMeshCommonState as set on the factory will serve as defaults for mesh objects that are created from this factory AFTER the default value is set. So changing such a value on the factory will have no effect on meshes already created. The material wrapper is an exception to this rule. Setting that on the factory will have an effect immediatelly on all mesh objects created from that factory except for those mesh objects that have their own material set.

Main creators of instances implementing this interface:

- Instmesh mesh object plugin (crystalspace.mesh.object.instmesh)
- iMeshObjectType::NewFactory()

Main ways to get pointers to this interface:

- scfQueryInterface() on iMeshFactoryWrapper::GetMeshObjectFactory()

Main users of this interface:

- Instmesh Factory Loader plugin (crystalspace.mesh.loader.factory.instmesh)

Definition at line 153 of file instmesh.h.

## Member Function Documentation

virtual void iInstancingFactoryState::AddTriangle | ( | const csTriangle & | tri | ) | `[pure virtual]`

Add a triangle.

virtual void iInstancingFactoryState::AddVertex | ( | const csVector3 & | v,
|  | const csVector2 & | uv,
|  | const csVector3 & | normal,
|  | const csColor4 & | color |
| ) |  |  | `[pure virtual]`

Add a vertex.

virtual void iInstancingFactoryState::CalculateNormals | ( | bool | compress = `true` | ) | `[pure virtual]`

Automatically calculate normals based on the current mesh.

/param compress if true (default) then calculate the normals based on compressed vertices.

virtual void iInstancingFactoryState::Compress | ( |  | ) | `[pure virtual]`

Compress the vertex table.

This should be called after setting up the geometry.

virtual void iInstancingFactoryState::GenerateBox | ( | const csBox3 & | box | ) | `[pure virtual]`

Automatically generate a box.

This will set the number of vertices to eight and generate vertices, texels, and triangles. The colors and normals are not initialized here.

virtual void iInstancingFactoryState::GenerateQuad | ( | const csVector3 & | v1,
|  | const csVector3 & | v2,
|  | const csVector3 & | v3,
|  | const csVector3 & | v4 |
| ) |  |  | `[pure virtual]`

Automatically generate a qad.

virtual void iInstancingFactoryState::GenerateSphere | ( | const csEllipsoid & | sphere,
|  | int | rim_vertices,
|  | bool | cyl_mapping = `false`,
|  | bool | toponly = `false`,
|  | bool | reversed = `false` |
| ) |  |  | `[pure virtual]`

Automatically generate a sphere.

This will set the apropriate number of vertices and generate vertices, texels, normals, and triangles. The colors are not initialized here.

Parameters:

  | sphere | Properties of the ellipsoid to generate.
  | rim_vertices | Number of vertices on a rim.
  | cyl_mapping | if true then use cylindrical texture mapping.
  | toponly | if true then only generate the top half of the sphere.
  | reversed | if true then generate the sphere so it is visible from the inside.

virtual const csColor& iInstancingFactoryState::GetColor | ( |  | ) | const`[pure virtual]`

Get the color.

virtual const csColor4* iInstancingFactoryState::GetColors | ( |  | ) | `[pure virtual]`

Get the array of colors.

virtual const csVector3* iInstancingFactoryState::GetNormals | ( |  | ) | `[pure virtual]`

Get the array of normals.

virtual const csVector2* iInstancingFactoryState::GetTexels | ( |  | ) | `[pure virtual]`

Get the array of texels.

virtual size_t iInstancingFactoryState::GetTriangleCount | ( |  | ) | const`[pure virtual]`

Get the number of triangles for this mesh.

virtual const csTriangle* iInstancingFactoryState::GetTriangles | ( |  | ) | `[pure virtual]`

Get the array of triangles.

virtual size_t iInstancingFactoryState::GetVertexCount | ( |  | ) | const`[pure virtual]`

Get the number of vertices for this mesh.

virtual const csVector3* iInstancingFactoryState::GetVertices | ( |  | ) | `[pure virtual]`

Get the array of vertices.

virtual bool iInstancingFactoryState::IsAutoNormals | ( |  | ) | const`[pure virtual]`

Returns whether normals were autogenerated or manual.

virtual void iInstancingFactoryState::SetColor | ( | const csColor & | col | ) | `[pure virtual]`

Set the color to use. Will be added to the lighting values.

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

- imesh/instmesh.h