OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::LodOutsideMarker Class Reference

This class will mark vertices of a mesh, which are visible from far away (from outside). More...

#include <OgreLodOutsideMarker.h>

+ Collaboration diagram for Ogre::LodOutsideMarker:

Classes

struct  CHTriangle
 
struct  OutsideData
 

Public Member Functions

 LodOutsideMarker (LodData::VertexList &vertexList, Real boundingSphereRadius, Real walkAngle)
 
MeshPtr createConvexHullMesh (const String &meshName, const String &resourceGroupName=ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)
 Mark vertices, which are visible from outside. More...
 
bool isVertexOutside (LodData::Vertex *v)
 Returns a mesh containing the Convex Hull shape. More...
 
void markOutside ()
 

Private Types

typedef vector< std::pair
< CHVertex *, CHVertex * >
>::type 
CHEdgeList
 
typedef vector< CHTriangle >::type CHTriangleList
 
typedef vector< CHTriangle * >
::type 
CHTrianglePList
 
typedef LodData::Vertex CHVertex
 
typedef vector< OutsideData >::type OutsideDataList
 

Private Member Functions

void addEdge (CHEdgeList &edges, CHVertex *a, CHVertex *b)
 Adds vertex to hull. More...
 
template<typename T >
void addHullTriangleVertices (std::vector< CHVertex * > &stack, T tri)
 if we have the convex hull, this will walk on the faces which have less then 90 degree difference. More...
 
size_t addVertex (CHVertex *vertex)
 Generates the hull. More...
 
void cleanHull ()
 Add edge to the list of removable edges. More...
 
void createTriangle (CHVertex *v1, CHVertex *v2, CHVertex *v3)
 Initializes the hull for expansion. More...
 
void fillHorizon (CHEdgeList &e, CHVertex *target)
 Removes edges, which are not on the horizon. More...
 
void generateHull ()
 
CHVertexgetFurthestVertex (CHTriangle *hull)
 Whether face is visible from point. More...
 
void getHorizon (const CHTrianglePList &tri, CHEdgeList &)
 Adds visible edges to the list, when viewing from target point. More...
 
OutsideDatagetOutsideData (LodData::Vertex *v)
 
Real getPointToLineSqraredDistance (CHVertex *x1, CHVertex *x2, CHVertex *vertex)
 
Real getTetrahedronVolume (CHVertex *v0, CHVertex *v1, CHVertex *v2, CHVertex *v3)
 Sets the vertices of a triangle (called from initHull only). More...
 
LodData::VertexgetVertex (OutsideData *d)
 Angle limit, when walking inside for marking vertices. More...
 
void getVisibleTriangles (const CHVertex *target, CHTrianglePList &visibleTriangles)
 Gets furthest vertex from face. More...
 
void initHull ()
 
bool isInsideLine (const Vector3 &ptarget, const Vector3 &p0, const Vector3 &p1)
 Whether the vertex is inside the triangle. We assume that it is on the same plane. More...
 
bool isInsideTriangle (const Vector3 &ptarget, const CHTriangle &tri)
 
bool isSamePosition (const Vector3 &p0, const Vector3 &p1)
 Whether ptarget is between p0 and p1. Assuming they are on the same line. More...
 
bool isVisible (CHTriangle *triangle, Vector3 &vertex)
 Removes Triangles, which are having CHTriangle::removed = true. More...
 
void markVertices ()
 Caps the hole with faces connecting to target vertex. More...
 
Real pointToLineDir (const Vector3 &ptarget, const Vector3 &p0, const Vector3 &p1, const Vector3 &p2, const Vector3 &n)
 Add triangle to stack (called from markVertices only). More...
 

Private Attributes

Vector3 mCentroid
 
CHEdgeList mEdges
 Temporary vector for addVisibleEdges function (prevent allocation every call). More...
 
const Real mEpsilon
 
CHTriangleList mHull
 Amount of allowed floating point error if 4 vertices are on the same plane. More...
 
OutsideDataList mOutsideData
 Source of input and output of the algorithm. More...
 
LodData::VertexListmVertexListOrig
 Temporary vector for the horizon edges, when inserting a new vertex into the hull. More...
 
CHTrianglePList mVisibleTriangles
 Contains the current triangles of the convex hull. More...
 
Real mWalkAngle
 Centroid of the convex hull. More...
 

Detailed Description

This class will mark vertices of a mesh, which are visible from far away (from outside).

Triangle is visible if each vertex of it is visible.

Definition at line 39 of file OgreLodOutsideMarker.h.

Member Typedef Documentation

typedef vector<std::pair<CHVertex*, CHVertex*> >::type Ogre::LodOutsideMarker::CHEdgeList
private

Definition at line 77 of file OgreLodOutsideMarker.h.

Definition at line 75 of file OgreLodOutsideMarker.h.

Definition at line 76 of file OgreLodOutsideMarker.h.

Definition at line 57 of file OgreLodOutsideMarker.h.

Definition at line 74 of file OgreLodOutsideMarker.h.

Constructor & Destructor Documentation

Ogre::LodOutsideMarker::LodOutsideMarker ( LodData::VertexList vertexList,
Real  boundingSphereRadius,
Real  walkAngle 
)
Parameters
vertexListList of vertices. vertex.position is the input and vertex.isOuterWallVertex is the output of the algorithm.
walkAngleWalk angle in dot product values. Allowed range is from -1 to 1. Default = 0. Smaller value is bigger angle. If you set it to 1 then you can disable walking and it will only mark the vertices on the convex hull.

Member Function Documentation

void Ogre::LodOutsideMarker::addEdge ( CHEdgeList edges,
CHVertex a,
CHVertex b 
)
private

Adds vertex to hull.

template<typename T >
void Ogre::LodOutsideMarker::addHullTriangleVertices ( std::vector< CHVertex * > &  stack,
tri 
)
private

if we have the convex hull, this will walk on the faces which have less then 90 degree difference.

size_t Ogre::LodOutsideMarker::addVertex ( CHVertex vertex)
private

Generates the hull.

void Ogre::LodOutsideMarker::cleanHull ( )
private

Add edge to the list of removable edges.

MeshPtr Ogre::LodOutsideMarker::createConvexHullMesh ( const String meshName,
const String resourceGroupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME 
)

Mark vertices, which are visible from outside.

void Ogre::LodOutsideMarker::createTriangle ( CHVertex v1,
CHVertex v2,
CHVertex v3 
)
private

Initializes the hull for expansion.

void Ogre::LodOutsideMarker::fillHorizon ( CHEdgeList e,
CHVertex target 
)
private

Removes edges, which are not on the horizon.

void Ogre::LodOutsideMarker::generateHull ( )
private
CHVertex* Ogre::LodOutsideMarker::getFurthestVertex ( CHTriangle hull)
private

Whether face is visible from point.

void Ogre::LodOutsideMarker::getHorizon ( const CHTrianglePList tri,
CHEdgeList  
)
private

Adds visible edges to the list, when viewing from target point.

OutsideData* Ogre::LodOutsideMarker::getOutsideData ( LodData::Vertex v)
inlineprivate

Definition at line 95 of file OgreLodOutsideMarker.h.

References Ogre::LodData::getVectorIDFromPointer().

Real Ogre::LodOutsideMarker::getPointToLineSqraredDistance ( CHVertex x1,
CHVertex x2,
CHVertex vertex 
)
private
Real Ogre::LodOutsideMarker::getTetrahedronVolume ( CHVertex v0,
CHVertex v1,
CHVertex v2,
CHVertex v3 
)
private

Sets the vertices of a triangle (called from initHull only).

LodData::Vertex* Ogre::LodOutsideMarker::getVertex ( OutsideData d)
inlineprivate

Angle limit, when walking inside for marking vertices.

Definition at line 92 of file OgreLodOutsideMarker.h.

References Ogre::LodData::getVectorIDFromPointer().

void Ogre::LodOutsideMarker::getVisibleTriangles ( const CHVertex target,
CHTrianglePList visibleTriangles 
)
private

Gets furthest vertex from face.

void Ogre::LodOutsideMarker::initHull ( )
private
bool Ogre::LodOutsideMarker::isInsideLine ( const Vector3 ptarget,
const Vector3 p0,
const Vector3 p1 
)
private

Whether the vertex is inside the triangle. We assume that it is on the same plane.

bool Ogre::LodOutsideMarker::isInsideTriangle ( const Vector3 ptarget,
const CHTriangle tri 
)
private
bool Ogre::LodOutsideMarker::isSamePosition ( const Vector3 p0,
const Vector3 p1 
)
private

Whether ptarget is between p0 and p1. Assuming they are on the same line.

bool Ogre::LodOutsideMarker::isVertexOutside ( LodData::Vertex v)
inline

Returns a mesh containing the Convex Hull shape.

Definition at line 52 of file OgreLodOutsideMarker.h.

bool Ogre::LodOutsideMarker::isVisible ( CHTriangle triangle,
Vector3 vertex 
)
private

Removes Triangles, which are having CHTriangle::removed = true.

void Ogre::LodOutsideMarker::markOutside ( )
void Ogre::LodOutsideMarker::markVertices ( )
private

Caps the hole with faces connecting to target vertex.

Real Ogre::LodOutsideMarker::pointToLineDir ( const Vector3 ptarget,
const Vector3 p0,
const Vector3 p1,
const Vector3 p2,
const Vector3 n 
)
private

Add triangle to stack (called from markVertices only).

Determines whether ptarget is on the same side of the p0-p1 line as p2. Assuming each point is on the same plane.

Member Data Documentation

Vector3 Ogre::LodOutsideMarker::mCentroid
private

Definition at line 89 of file OgreLodOutsideMarker.h.

CHEdgeList Ogre::LodOutsideMarker::mEdges
private

Temporary vector for addVisibleEdges function (prevent allocation every call).

Definition at line 85 of file OgreLodOutsideMarker.h.

const Real Ogre::LodOutsideMarker::mEpsilon
private

Definition at line 82 of file OgreLodOutsideMarker.h.

CHTriangleList Ogre::LodOutsideMarker::mHull
private

Amount of allowed floating point error if 4 vertices are on the same plane.

Definition at line 83 of file OgreLodOutsideMarker.h.

OutsideDataList Ogre::LodOutsideMarker::mOutsideData
private

Source of input and output of the algorithm.

Definition at line 88 of file OgreLodOutsideMarker.h.

LodData::VertexList& Ogre::LodOutsideMarker::mVertexListOrig
private

Temporary vector for the horizon edges, when inserting a new vertex into the hull.

Definition at line 86 of file OgreLodOutsideMarker.h.

CHTrianglePList Ogre::LodOutsideMarker::mVisibleTriangles
private

Contains the current triangles of the convex hull.

Definition at line 84 of file OgreLodOutsideMarker.h.

Real Ogre::LodOutsideMarker::mWalkAngle
private

Centroid of the convex hull.

Definition at line 90 of file OgreLodOutsideMarker.h.


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