CS::Geometry::Primitives Class 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

Static Public Member Functions
CS::Geometry::Primitives Class Reference

A primitive mesh generator. More...

`#include <cstool/primitives.h>`

Inheritance diagram for CS::Geometry::Primitives:

List of all members.

## Static Public Member Functions
static void | GenerateBox (const csBox3 &box, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, uint32 flags=CS_PRIMBOX_SMOOTH, TextureMapper *mapper=0)
| Generate a box with 24 vertices and 12 triangles so that the normals of every face point in or outwards (the normals of the vertices belonging to a face will point with the correct normal of the face).
static void | GenerateCapsule (float l, float r, uint sides, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, TextureMapper *mapper=0)
| Generate a capsule of given length and radius.
static void | GenerateCone (float l, float r, uint sides, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, TextureMapper *mapper=0)
| Generate a cone of given length and radius.
static void | GenerateCylinder (float l, float r, uint sides, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, TextureMapper *mapper=0)
| Generate a cylinder of given length and radius.
static void | GenerateQuad (const csVector3 &v1, const csVector3 &v2, const csVector3 &v3, const csVector3 &v4, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, TextureMapper *mapper=0)
| Generate a double-sided quad.
static void | GenerateSphere (const csEllipsoid &ellips, int num, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, bool cyl_mapping=false, bool toponly=false, bool reversed=false, TextureMapper *mapper=0)
| Generate a sphere with 'num' vertices on the rim.
static void | GenerateTesselatedQuad (const csVector3 &v0, const csVector3 &v1, const csVector3 &v2, int tesselations, csDirtyAccessArray< csVector3 > &mesh_vertices, csDirtyAccessArray< csVector2 > &mesh_texels, csDirtyAccessArray< csVector3 > &mesh_normals, csDirtyAccessArray< csTriangle > &mesh_triangles, TextureMapper *mapper=0)
| Generate a single-sided tesselations quad.

## Detailed Description

A primitive mesh generator.

Definition at line 106 of file primitives.h.

## Member Function Documentation

static void CS::Geometry::Primitives::GenerateBox | ( | const csBox3 & | box,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | uint32 | flags = `CS_PRIMBOX_SMOOTH`,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a box with 24 vertices and 12 triangles so that the normals of every face point in or outwards (the normals of the vertices belonging to a face will point with the correct normal of the face).

Parameters:

  flags | is a combination of BoxFlags enumeration values. Default is CS_PRIMBOX_SMOOTH.
  mapper | is an optional texture mapper. If not given the default TableTextureMapper is used with boxTable.

static void CS::Geometry::Primitives::GenerateCapsule | ( | float | l,
|  | float | r,
|  | uint | sides,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a capsule of given length and radius.

Parameters:

  l | Capsule length.
  r | Capsule radius.
  sides | Number of sides.
  mapper | is an optional texture mapper. If not given the default capsule texture mapping will be used (currently not implemented, you have to specify a mapper).

static void CS::Geometry::Primitives::GenerateCone | ( | float | l,
|  | float | r,
|  | uint | sides,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a cone of given length and radius.

Parameters:

  l | Cone length.
  r | Cone radius.
  sides | Number of sides.
  mapper | is an optional texture mapper. If not given the default Cone texture mapping will be used (currently not implemented, you have to specify a mapper).

static void CS::Geometry::Primitives::GenerateCylinder | ( | float | l,
|  | float | r,
|  | uint | sides,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a cylinder of given length and radius.

Parameters:

  l | Cylinder length.
  r | Cylinder radius.
  sides | Number of sides.
  mapper | is an optional texture mapper. If not given the default cylinder texture mapping will be used (currently not implemented, you have to specify a mapper).

static void CS::Geometry::Primitives::GenerateQuad | ( | const csVector3 & | v1,
|  | const csVector3 & | v2,
|  | const csVector3 & | v3,
|  | const csVector3 & | v4,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a double-sided quad.

Parameters:

  mapper | is an optional texture mapper. If not given the default TableTextureMapper is used with quadTable.

static void CS::Geometry::Primitives::GenerateSphere | ( | const csEllipsoid & | ellips,
|  | int | num,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | bool | cyl_mapping = `false`,
|  | bool | toponly = `false`,
|  | bool | reversed = `false`,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a sphere with 'num' vertices on the rim.

Parameters:

  ellips | Properties of the ellipsoid to create.
  num | Number of vertices in the generated mesh.
  mesh_vertices | Returns the generated vertices.
  mesh_texels | Returns the generated texture coordinates.
  mesh_normals | Returns the generated normals.
  mesh_triangles | Returns the generated triangles.
  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.
  mapper | is an optional texture mapper. If not given the mapping as defined by the 'cyl_mapping' flag will be used.

static void CS::Geometry::Primitives::GenerateTesselatedQuad | ( | const csVector3 & | v0,
|  | const csVector3 & | v1,
|  | const csVector3 & | v2,
|  | int | tesselations,
|  | csDirtyAccessArray< csVector3 > & | mesh_vertices,
|  | csDirtyAccessArray< csVector2 > & | mesh_texels,
|  | csDirtyAccessArray< csVector3 > & | mesh_normals,
|  | csDirtyAccessArray< csTriangle > & | mesh_triangles,
|  | TextureMapper * | mapper = `0`
| ) |  | `[static]`

Generate a single-sided tesselations quad.

v0-v1 and v0-v2 should be oriented clockwise from the visible side.

Parameters:

  v0 | is the origin of the quad.
  v1 | is the first axis.
  v2 | is the second axis.
  tesselations | is the number of tesselations.
  mapper | is an optional texture mapper. If not given the default DensityTextureMapper is used with density 1.

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

- cstool/primitives.h