Implement the use of the new vmap3-format by Lynx3d (mad props to you for this, and thanks for the talks earlier) + reduced Vmap size to less than one third, and improve precision + indoor/outdoor check which allows automatic unmounting of players + additional area information from WMOAreaTable.dbc, removed existing "hacks" + WMO liquid information for swimming and fishing correctly in buildings/cities/caves/instances (lava and slime WILL hurt from now on!) - buildfiles for windows are not properly done, and will need to be sorted out NOTE: Do NOT annoy Lynx3d about this, any issues with this "port" is entirely our fault ! THIS REVISION IS CONSIDERED UNSTABLE AND CONTAINS WORK IN PROGRESS - USE AT YOUR OWN RISK! --HG-- branch : trunk
83 lines
2.0 KiB
C++
83 lines
2.0 KiB
C++
/**
|
|
@file MeshBuilder.h
|
|
|
|
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
|
|
|
|
@created 2002-02-27
|
|
@edited 2004-10-04
|
|
*/
|
|
#ifndef G3D_MESHBUILDER_H
|
|
#define G3D_MESHBUILDER_H
|
|
|
|
#include "G3D/platform.h"
|
|
#include "G3D/Array.h"
|
|
#include "G3D/Vector3.h"
|
|
#include "G3D/Triangle.h"
|
|
|
|
namespace G3D {
|
|
|
|
/**
|
|
Allows creation of optimized watertight meshes from unoptimized polygon soups.
|
|
See also G3D::MeshAlg for algorithms that operate on the output.
|
|
*/
|
|
class MeshBuilder {
|
|
public:
|
|
|
|
/**
|
|
Set setWeldRadius to AUTO_WELD to weld vertices closer than 1/2
|
|
the smallest edge length in a model.
|
|
*/
|
|
enum {AUTO_WELD = -100};
|
|
|
|
private:
|
|
/** Indices of vertices in <B>or near</B> a grid cell. */
|
|
typedef Array<int> List;
|
|
|
|
std::string name;
|
|
|
|
/**
|
|
All of the triangles, as a long triangle list.
|
|
*/
|
|
Array<Vector3> triList;
|
|
|
|
void centerTriList();
|
|
void computeBounds(Vector3& min, Vector3& max);
|
|
|
|
bool _twoSided;
|
|
|
|
/** Collapse radius */
|
|
double close;
|
|
|
|
public:
|
|
|
|
inline MeshBuilder(bool twoSided = false) : _twoSided(twoSided), close(AUTO_WELD) {}
|
|
|
|
/** Writes the model to the arrays, which can then be used with
|
|
G3D::IFSModel::save and G3D::MeshAlg */
|
|
void commit(std::string& name, Array<int>& indexArray, Array<Vector3>& vertexArray);
|
|
|
|
/**
|
|
Adds a new triangle to the model. (Counter clockwise)
|
|
*/
|
|
void addTriangle(const Vector3& a, const Vector3& b, const Vector3& c);
|
|
|
|
/**
|
|
Adds two new triangles to the model. (Counter clockwise)
|
|
*/
|
|
void addQuad(const Vector3& a, const Vector3& b, const Vector3& c, const Vector3& d);
|
|
|
|
void addTriangle(const Triangle& t);
|
|
|
|
void setName(const std::string& n);
|
|
|
|
/** Vertices within this distance are considered identical.
|
|
Use AUTO_WELD (the default) to have the distance be a function of the model size.*/
|
|
void setWeldRadius(double r) {
|
|
close = r;
|
|
}
|
|
};
|
|
|
|
} // namespace
|
|
|
|
#endif
|