BoundingMesh Struct Reference
[Collision Detection]

Inherits BoundingShape.

Inherited by MeshImpl.

List of all members.

Public Methods

virtual bool initialize (int numVerts, int numTris)=0
virtual void setVertexPosition (int i, Float x, Float y, Float z)=0
virtual void setVertexIndex (int i, int vertexIndex)=0
virtual bool build ()=0


Detailed Description

A bounding mesh, composed of triangles. The mesh is built like an indexed vertex buffer: provide a list of vertices, then specify triangles as indices into the vertex list. This example makes a flat plane out of two triangles:
 // C++
 BoundingMesh* mesh = (BoundingMesh*)Core->createA("Collider.BoundingMesh");
 mesh->initialize(4, 2);      // 4 vertices, 2 triangles
 mesh->setVertexPosition(0, -100, 0, -100);
 mesh->setVertexPosition(1, -100, 0,  100);
 mesh->setVertexPosition(2,  100, 0,  100);
 mesh->setVertexPosition(3,  100, 0, -100);
 mesh->setVertexIndex(0, 0);
 mesh->setVertexIndex(1, 1);
 mesh->setVertexIndex(2, 2);
 mesh->setVertexIndex(3, 0);
 mesh->setVertexIndex(4, 2);
 mesh->setVertexIndex(5, 3);
 mesh->build();

 -- Lua
 local mesh = Collider.BoundingMesh(4,2)
 mesh:setVertexPosition(0, -100, 0, -100)
 mesh:setVertexPosition(1, -100, 0,  100)
 mesh:setVertexPosition(2,  100, 0,  100)
 mesh:setVertexPosition(3,  100, 0, -100)
 mesh:setVertexIndex(0, 0)
 mesh:setVertexIndex(1, 1)
 mesh:setVertexIndex(2, 2)
 mesh:setVertexIndex(3, 0)
 mesh:setVertexIndex(4, 2)
 mesh:setVertexIndex(5, 3)
 mesh:build()


Member Function Documentation

virtual bool BoundingMesh::build   [pure virtual]
 

Once all of the vertices and indices have been initialized, call this method to build the bounding box hierarchy.

virtual bool BoundingMesh::initialize int    numVerts,
int    numTris
[pure virtual]
 

Specify the number of vertices and triangles in the mesh.

virtual void BoundingMesh::setVertexIndex int    i,
int    vertexIndex
[pure virtual]
 

Specify a vertex index in the triangle list.

virtual void BoundingMesh::setVertexPosition int    i,
Float    x,
Float    y,
Float    z
[pure virtual]
 

Specify the position of a vertex.


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


Flat Four Engine
Copyright (C) 2001 by 379, Inc.
This page generated by Doxygen