Support Forum       G3D Web Page     
Public Types | Public Member Functions | List of all members
G3D::MeshBuilder Class Reference


Allows creation of optimized watertight meshes from unoptimized polygon soups. More...

Public Types

enum  { AUTO_WELD = -100 }
 
Set setWeldRadius to AUTO_WELD to weld vertices closer than 1/2 the smallest edge length in a model. More...
 

Public Member Functions

 MeshBuilder (bool twoSided=false, bool scaleAndCenter=true)
 
void addQuad (const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &d)
 
Adds two new triangles to the model. More...
 
void addTriangle (const Vector3 &a, const Vector3 &b, const Vector3 &c)
 
Adds a new triangle to the model. More...
 
void addTriangle (const Triangle &t)
 
void commit (String &name, Array< int > &indexArray, Array< Vector3 > &vertexArray)
 Writes the model to the arrays, which can then be used with G3D::IFSModel::save and G3D::MeshAlg. More...
 
void setName (const String &n)
 
void setWeldRadius (double r)
 Vertices within this distance are considered identical. More...
 

Detailed Description


Allows creation of optimized watertight meshes from unoptimized polygon soups.

See also G3D::MeshAlg for algorithms that operate on the output.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum


Set setWeldRadius to AUTO_WELD to weld vertices closer than 1/2 the smallest edge length in a model.

Enumerator
AUTO_WELD 

Constructor & Destructor Documentation

◆ MeshBuilder()

G3D::MeshBuilder::MeshBuilder ( bool  twoSided = false,
bool  scaleAndCenter = true 
)
inline

Member Function Documentation

◆ addQuad()

void G3D::MeshBuilder::addQuad ( const Vector3 a,
const Vector3 b,
const Vector3 c,
const Vector3 d 
)


Adds two new triangles to the model.

(Counter clockwise)

◆ addTriangle() [1/2]

void G3D::MeshBuilder::addTriangle ( const Vector3 a,
const Vector3 b,
const Vector3 c 
)


Adds a new triangle to the model.

(Counter clockwise)

◆ addTriangle() [2/2]

void G3D::MeshBuilder::addTriangle ( const Triangle t)

◆ commit()

void G3D::MeshBuilder::commit ( String name,
Array< int > &  indexArray,
Array< Vector3 > &  vertexArray 
)

Writes the model to the arrays, which can then be used with G3D::IFSModel::save and G3D::MeshAlg.

◆ setName()

void G3D::MeshBuilder::setName ( const String n)

◆ setWeldRadius()

void G3D::MeshBuilder::setWeldRadius ( double  r)
inline

Vertices within this distance are considered identical.

Use AUTO_WELD (the default) to have the distance be a function of the model size.


documentation generated on Wed Nov 24 2021 08:01:58 using doxygen 1.8.15