mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
PolyhedronVectorData core membervar cleanups
This commit is contained in:
parent
b415ac8f6b
commit
e126ca1823
11 changed files with 191 additions and 191 deletions
|
|
@ -137,8 +137,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
S32 v1index = -1;
|
||||
bool v1Existed = false;
|
||||
for( U32 nvert = 0; nvert < pointList.size(); ++ nvert )
|
||||
if( pointList[ nvert ].equal( v1, 0.001f ) )
|
||||
for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert )
|
||||
if(mPointList[ nvert ].equal( v1, 0.001f ) )
|
||||
{
|
||||
v1index = nvert;
|
||||
v1Existed = true;
|
||||
|
|
@ -149,8 +149,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
S32 v2index = -1;
|
||||
bool v2Existed = false;
|
||||
for( U32 nvert = 0; nvert < pointList.size(); ++ nvert )
|
||||
if( pointList[ nvert ].equal( v2, 0.001f ) )
|
||||
for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert )
|
||||
if(mPointList[ nvert ].equal( v2, 0.001f ) )
|
||||
{
|
||||
v2index = nvert;
|
||||
v2Existed = true;
|
||||
|
|
@ -161,30 +161,30 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
if( !v1Existed )
|
||||
{
|
||||
v1index = pointList.size();
|
||||
pointList.push_back( v1 );
|
||||
v1index = mPointList.size();
|
||||
mPointList.push_back( v1 );
|
||||
}
|
||||
|
||||
// Add vertex 2, if necessary.
|
||||
|
||||
if( !v2Existed )
|
||||
{
|
||||
v2index = pointList.size();
|
||||
pointList.push_back( v2 );
|
||||
v2index = mPointList.size();
|
||||
mPointList.push_back( v2 );
|
||||
}
|
||||
|
||||
// If both v1 and v2 already existed in the point
|
||||
// set, this must be an edge that we are sharing so try
|
||||
// to find it.
|
||||
|
||||
const U32 thisPlaneIndex = planeList.size();
|
||||
const U32 thisPlaneIndex = mPlaneList.size();
|
||||
bool foundExistingEdge = false;
|
||||
|
||||
if( v1Existed && v2Existed )
|
||||
{
|
||||
for( U32 nedge = 0; nedge < edgeList.size(); ++ nedge )
|
||||
for( U32 nedge = 0; nedge < mEdgeList.size(); ++ nedge )
|
||||
{
|
||||
Edge& edge = edgeList[ nedge ];
|
||||
Edge& edge = mEdgeList[ nedge ];
|
||||
|
||||
if( ( edge.vertex[ 0 ] == v1index && edge.vertex[ 1 ] == v2index ) ||
|
||||
( edge.vertex[ 0 ] == v2index && edge.vertex[ 1 ] == v1index ) )
|
||||
|
|
@ -222,13 +222,13 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
if( !invert )
|
||||
{
|
||||
edgeList.push_back(
|
||||
mEdgeList.push_back(
|
||||
Edge( thisPlaneIndex, 0, v1index, v2index )
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
edgeList.push_back(
|
||||
mEdgeList.push_back(
|
||||
Edge( thisPlaneIndex, 0, v2index, v1index )
|
||||
);
|
||||
}
|
||||
|
|
@ -242,6 +242,6 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
// If this plane produced edges, add it.
|
||||
|
||||
if( haveEdges )
|
||||
planeList.push_back( currentPlane );
|
||||
mPlaneList.push_back( currentPlane );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,42 +124,42 @@ struct PolyhedronVectorData : public PolyhedronData
|
|||
typedef Vector< Edge > EdgeListType;
|
||||
|
||||
/// List of planes. Note that by default, the normals facing *inwards*.
|
||||
PlaneListType planeList;
|
||||
PlaneListType mPlaneList;
|
||||
|
||||
/// List of vertices.
|
||||
PointListType pointList;
|
||||
PointListType mPointList;
|
||||
|
||||
/// List of edges.
|
||||
EdgeListType edgeList;
|
||||
EdgeListType mEdgeList;
|
||||
|
||||
PolyhedronVectorData()
|
||||
{
|
||||
VECTOR_SET_ASSOCIATION( pointList );
|
||||
VECTOR_SET_ASSOCIATION( planeList );
|
||||
VECTOR_SET_ASSOCIATION( edgeList );
|
||||
VECTOR_SET_ASSOCIATION(mPointList);
|
||||
VECTOR_SET_ASSOCIATION(mPlaneList);
|
||||
VECTOR_SET_ASSOCIATION(mEdgeList);
|
||||
}
|
||||
|
||||
/// @name Accessors
|
||||
/// @{
|
||||
|
||||
/// Return the number of planes that make up this polyhedron.
|
||||
U32 getNumPlanes() const { return planeList.size(); }
|
||||
U32 getNumPlanes() const { return mPlaneList.size(); }
|
||||
|
||||
/// Return the planes that make up the polyhedron.
|
||||
/// @note The normals of these planes are facing *inwards*.
|
||||
PlaneF* getPlanes() const { return planeList.address(); }
|
||||
PlaneF* getPlanes() const { return mPlaneList.address(); }
|
||||
|
||||
/// Return the number of points that this polyhedron has.
|
||||
U32 getNumPoints() const { return pointList.size(); }
|
||||
U32 getNumPoints() const { return mPointList.size(); }
|
||||
|
||||
///
|
||||
Point3F* getPoints() const { return pointList.address(); }
|
||||
Point3F* getPoints() const { return mPointList.address(); }
|
||||
|
||||
/// Return the number of edges that this polyhedron has.
|
||||
U32 getNumEdges() const { return edgeList.size(); }
|
||||
U32 getNumEdges() const { return mEdgeList.size(); }
|
||||
|
||||
///
|
||||
Edge* getEdges() const { return edgeList.address(); }
|
||||
Edge* getEdges() const { return mEdgeList.address(); }
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
@ -168,9 +168,9 @@ struct PolyhedronVectorData : public PolyhedronData
|
|||
|
||||
void buildBox( const MatrixF& mat, const Box3F& box, bool invertNormals = false )
|
||||
{
|
||||
pointList.setSize( 8 );
|
||||
planeList.setSize( 6 );
|
||||
edgeList.setSize( 12 );
|
||||
mPointList.setSize( 8 );
|
||||
mPlaneList.setSize( 6 );
|
||||
mEdgeList.setSize( 12 );
|
||||
|
||||
buildBoxData( *this, mat, box, invertNormals );
|
||||
}
|
||||
|
|
@ -190,13 +190,13 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData
|
|||
protected:
|
||||
|
||||
/// List of planes. Note that by default, the normals facing *inwards*.
|
||||
PlaneListType planeList;
|
||||
PlaneListType mPlaneList;
|
||||
|
||||
/// List of vertices.
|
||||
PointListType pointList;
|
||||
PointListType mPointList;
|
||||
|
||||
/// List of edges.
|
||||
EdgeListType edgeList;
|
||||
EdgeListType mEdgeList;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -204,26 +204,26 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData
|
|||
/// @{
|
||||
|
||||
/// Return the number of planes that make up this polyhedron.
|
||||
U32 getNumPlanes() const { return planeList.size(); }
|
||||
U32 getNumPlanes() const { return mPlaneList.size(); }
|
||||
|
||||
/// Return the planes that make up the polyhedron.
|
||||
/// @note The normals of these planes are facing *inwards*.
|
||||
const PlaneF* getPlanes() const { return planeList.address(); }
|
||||
PlaneF* getPlanes() { return planeList.address(); }
|
||||
const PlaneF* getPlanes() const { return mPlaneList.address(); }
|
||||
PlaneF* getPlanes() { return mPlaneList.address(); }
|
||||
|
||||
/// Return the number of points that this polyhedron has.
|
||||
U32 getNumPoints() const { return pointList.size(); }
|
||||
U32 getNumPoints() const { return mPointList.size(); }
|
||||
|
||||
///
|
||||
const Point3F* getPoints() const { return pointList.address(); }
|
||||
Point3F* getPoints() { return pointList.address(); }
|
||||
const Point3F* getPoints() const { return mPointList.address(); }
|
||||
Point3F* getPoints() { return mPointList.address(); }
|
||||
|
||||
/// Return the number of edges that this polyhedron has.
|
||||
U32 getNumEdges() const { return edgeList.size(); }
|
||||
U32 getNumEdges() const { return mEdgeList.size(); }
|
||||
|
||||
///
|
||||
const Edge* getEdges() const { return edgeList.address(); }
|
||||
Edge* getEdges() { return edgeList.address(); }
|
||||
const Edge* getEdges() const { return mEdgeList.address(); }
|
||||
Edge* getEdges() { return mEdgeList.address(); }
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
|
@ -239,13 +239,13 @@ struct PolyhedronFixedVectorData : public PolyhedronData
|
|||
protected:
|
||||
|
||||
/// List of planes. Note that by default, the normals facing *inwards*.
|
||||
PlaneListType planeList;
|
||||
PlaneListType mPlaneList;
|
||||
|
||||
/// List of vertices.
|
||||
PointListType pointList;
|
||||
PointListType mPointList;
|
||||
|
||||
/// List of edges.
|
||||
EdgeListType edgeList;
|
||||
EdgeListType mEdgeList;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -302,9 +302,9 @@ struct PolyhedronImpl : public Base
|
|||
/// Construct a polyhedron described by the given planes and edges.
|
||||
PolyhedronImpl( PlaneListType planes, PointListType points, EdgeListType edges )
|
||||
{
|
||||
this->planeList = planes;
|
||||
this->pointList = points;
|
||||
this->edgeList = edges;
|
||||
this->mPlaneList = planes;
|
||||
this->mPointList = points;
|
||||
this->mEdgeList = edges;
|
||||
}
|
||||
|
||||
/// Return the AABB around the polyhedron.
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B
|
|||
|
||||
// Corner points.
|
||||
|
||||
typename Polyhedron::PointListType& pointList = poly.pointList;
|
||||
typename Polyhedron::PointListType& pointList = poly.mPointList;
|
||||
|
||||
pointList[ 0 ] = min; // near left bottom
|
||||
pointList[ 1 ] = min + yvec; // far left bottom
|
||||
|
|
@ -475,7 +475,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B
|
|||
|
||||
// Side planes.
|
||||
|
||||
typename Polyhedron::PlaneListType& planeList = poly.planeList;
|
||||
typename Polyhedron::PlaneListType& planeList = poly.mPlaneList;
|
||||
|
||||
const F32 pos = invertNormals ? -1.f : 1.f;
|
||||
const F32 neg = - pos;
|
||||
|
|
@ -490,7 +490,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B
|
|||
// The edges are constructed so that the vertices
|
||||
// are oriented clockwise for face[0].
|
||||
|
||||
typename Polyhedron::EdgeType* edge = &poly.edgeList[ 0 ];
|
||||
typename Polyhedron::EdgeType* edge = &poly.mEdgeList[ 0 ];
|
||||
|
||||
for( U32 i = 0; i < 4; ++ i )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue