PolyhedronVectorData core membervar cleanups

This commit is contained in:
Azaezel 2018-03-14 15:18:00 -05:00
parent d0e47ee1ee
commit d979cf9d2d
11 changed files with 191 additions and 191 deletions

View file

@ -357,12 +357,12 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
{
mCollisionTriggerPolyhedron = rPolyhedron;
if (mCollisionTriggerPolyhedron.pointList.size() != 0) {
if (mCollisionTriggerPolyhedron.mPointList.size() != 0) {
mObjBox.minExtents.set(1e10, 1e10, 1e10);
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
for (U32 i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) {
mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.pointList[i]);
mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.pointList[i]);
for (U32 i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) {
mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.mPointList[i]);
mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.mPointList[i]);
}
}
else {
@ -374,7 +374,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
setTransform(xform);
mClippedList.clear();
mClippedList.mPlaneList = mCollisionTriggerPolyhedron.planeList;
mClippedList.mPlaneList = mCollisionTriggerPolyhedron.mPlaneList;
// for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++)
// mClippedList.mPlaneList[i].neg();
@ -412,7 +412,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
bool CollisionTrigger::testObject(GameBase* enter)
{
if (mCollisionTriggerPolyhedron.pointList.size() == 0)
if (mCollisionTriggerPolyhedron.mPointList.size() == 0)
return false;
mClippedList.clear();
@ -507,17 +507,17 @@ U32 CollisionTrigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream
// Write the polyhedron
if (stream->writeFlag(mask & PolyMask))
{
stream->write(mCollisionTriggerPolyhedron.pointList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.pointList[i]);
stream->write(mCollisionTriggerPolyhedron.mPointList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.mPointList[i]);
stream->write(mCollisionTriggerPolyhedron.planeList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.planeList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.planeList[i]);
stream->write(mCollisionTriggerPolyhedron.mPlaneList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.mPlaneList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.mPlaneList[i]);
stream->write(mCollisionTriggerPolyhedron.edgeList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.edgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.edgeList[i];
stream->write(mCollisionTriggerPolyhedron.mEdgeList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.mEdgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.mEdgeList[i];
stream->write(rEdge.face[0]);
stream->write(rEdge.face[1]);
@ -555,19 +555,19 @@ void CollisionTrigger::unpackUpdate(NetConnection* con, BitStream* stream)
{
Polyhedron tempPH;
stream->read(&size);
tempPH.pointList.setSize(size);
for (i = 0; i < tempPH.pointList.size(); i++)
mathRead(*stream, &tempPH.pointList[i]);
tempPH.mPointList.setSize(size);
for (i = 0; i < tempPH.mPointList.size(); i++)
mathRead(*stream, &tempPH.mPointList[i]);
stream->read(&size);
tempPH.planeList.setSize(size);
for (i = 0; i < tempPH.planeList.size(); i++)
mathRead(*stream, &tempPH.planeList[i]);
tempPH.mPlaneList.setSize(size);
for (i = 0; i < tempPH.mPlaneList.size(); i++)
mathRead(*stream, &tempPH.mPlaneList[i]);
stream->read(&size);
tempPH.edgeList.setSize(size);
for (i = 0; i < tempPH.edgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
tempPH.mEdgeList.setSize(size);
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
stream->read(&rEdge.face[0]);
stream->read(&rEdge.face[1]);

View file

@ -167,11 +167,11 @@ void OcclusionVolume::buildSilhouette( const SceneCameraState& cameraState, Vect
if( mTransformDirty )
{
const U32 numPoints = mPolyhedron.getNumPoints();
const U32 numPolyPoints = mPolyhedron.getNumPoints();
const PolyhedronType::PointType* points = getPolyhedron().getPoints();
mWSPoints.setSize( numPoints );
for( U32 i = 0; i < numPoints; ++ i )
mWSPoints.setSize(numPolyPoints);
for( U32 i = 0; i < numPolyPoints; ++ i )
{
Point3F p = points[ i ];
p.convolve( getScale() );

View file

@ -283,17 +283,17 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
if (stream->writeFlag(mask & PolyhedronMask))
{
// Write the polyhedron
stream->write(mPolyhedron.pointList.size());
for (i = 0; i < mPolyhedron.pointList.size(); i++)
mathWrite(*stream, mPolyhedron.pointList[i]);
stream->write(mPolyhedron.mPointList.size());
for (i = 0; i < mPolyhedron.mPointList.size(); i++)
mathWrite(*stream, mPolyhedron.mPointList[i]);
stream->write(mPolyhedron.planeList.size());
for (i = 0; i < mPolyhedron.planeList.size(); i++)
mathWrite(*stream, mPolyhedron.planeList[i]);
stream->write(mPolyhedron.mPlaneList.size());
for (i = 0; i < mPolyhedron.mPlaneList.size(); i++)
mathWrite(*stream, mPolyhedron.mPlaneList[i]);
stream->write(mPolyhedron.edgeList.size());
for (i = 0; i < mPolyhedron.edgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i];
stream->write(mPolyhedron.mEdgeList.size());
for (i = 0; i < mPolyhedron.mEdgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mPolyhedron.mEdgeList[i];
stream->write(rEdge.face[0]);
stream->write(rEdge.face[1]);
@ -340,19 +340,19 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
// Read the polyhedron
stream->read(&size);
tempPH.pointList.setSize(size);
for (i = 0; i < tempPH.pointList.size(); i++)
mathRead(*stream, &tempPH.pointList[i]);
tempPH.mPointList.setSize(size);
for (i = 0; i < tempPH.mPointList.size(); i++)
mathRead(*stream, &tempPH.mPointList[i]);
stream->read(&size);
tempPH.planeList.setSize(size);
for (i = 0; i < tempPH.planeList.size(); i++)
mathRead(*stream, &tempPH.planeList[i]);
tempPH.mPlaneList.setSize(size);
for (i = 0; i < tempPH.mPlaneList.size(); i++)
mathRead(*stream, &tempPH.mPlaneList[i]);
stream->read(&size);
tempPH.edgeList.setSize(size);
for (i = 0; i < tempPH.edgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
tempPH.mEdgeList.setSize(size);
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
stream->read(&rEdge.face[0]);
stream->read(&rEdge.face[1]);
@ -408,12 +408,12 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron)
{
mPolyhedron = rPolyhedron;
if (mPolyhedron.pointList.size() != 0) {
if (mPolyhedron.mPointList.size() != 0) {
mObjBox.minExtents.set(1e10, 1e10, 1e10);
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
for (U32 i = 0; i < mPolyhedron.pointList.size(); i++) {
mObjBox.minExtents.setMin(mPolyhedron.pointList[i]);
mObjBox.maxExtents.setMax(mPolyhedron.pointList[i]);
for (U32 i = 0; i < mPolyhedron.mPointList.size(); i++) {
mObjBox.minExtents.setMin(mPolyhedron.mPointList[i]);
mObjBox.maxExtents.setMax(mPolyhedron.mPointList[i]);
}
} else {
mObjBox.minExtents.set(-0.5, -0.5, -0.5);
@ -424,7 +424,7 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron)
setTransform(xform);
mClippedList.clear();
mClippedList.mPlaneList = mPolyhedron.planeList;
mClippedList.mPlaneList = mPolyhedron.mPlaneList;
MatrixF base(true);
base.scale(Point3F(1.0/mObjScale.x,
@ -481,7 +481,7 @@ bool PhysicalZone::testObject(SceneObject* enter)
// all. And whats the point of building a convex if no collision methods
// are implemented?
if (mPolyhedron.pointList.size() == 0)
if (mPolyhedron.mPointList.size() == 0)
return false;
mClippedList.clear();

View file

@ -245,16 +245,16 @@ ConsoleGetType( TypeTriggerPolyhedron )
Polyhedron* pPoly = reinterpret_cast<Polyhedron*>(dptr);
// First point is corner, need to find the three vectors...`
Point3F origin = pPoly->pointList[0];
Point3F origin = pPoly->mPointList[0];
U32 currVec = 0;
Point3F vecs[3];
for (i = 0; i < pPoly->edgeList.size(); i++) {
const U32 *vertex = pPoly->edgeList[i].vertex;
for (i = 0; i < pPoly->mEdgeList.size(); i++) {
const U32 *vertex = pPoly->mEdgeList[i].vertex;
if (vertex[0] == 0)
vecs[currVec++] = pPoly->pointList[vertex[1]] - origin;
vecs[currVec++] = pPoly->mPointList[vertex[1]] - origin;
else
if (vertex[1] == 0)
vecs[currVec++] = pPoly->pointList[vertex[0]] - origin;
vecs[currVec++] = pPoly->mPointList[vertex[0]] - origin;
}
AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron");
@ -302,45 +302,45 @@ ConsoleSetType( TypeTriggerPolyhedron )
// edges with CCW instead of CW order for face[0] and that it b) lets plane
// normals face outwards rather than inwards.
pPoly->pointList.setSize(8);
pPoly->pointList[0] = origin;
pPoly->pointList[1] = origin + vecs[0];
pPoly->pointList[2] = origin + vecs[1];
pPoly->pointList[3] = origin + vecs[2];
pPoly->pointList[4] = origin + vecs[0] + vecs[1];
pPoly->pointList[5] = origin + vecs[0] + vecs[2];
pPoly->pointList[6] = origin + vecs[1] + vecs[2];
pPoly->pointList[7] = origin + vecs[0] + vecs[1] + vecs[2];
pPoly->mPointList.setSize(8);
pPoly->mPointList[0] = origin;
pPoly->mPointList[1] = origin + vecs[0];
pPoly->mPointList[2] = origin + vecs[1];
pPoly->mPointList[3] = origin + vecs[2];
pPoly->mPointList[4] = origin + vecs[0] + vecs[1];
pPoly->mPointList[5] = origin + vecs[0] + vecs[2];
pPoly->mPointList[6] = origin + vecs[1] + vecs[2];
pPoly->mPointList[7] = origin + vecs[0] + vecs[1] + vecs[2];
Point3F normal;
pPoly->planeList.setSize(6);
pPoly->mPlaneList.setSize(6);
mCross(vecs[2], vecs[0], &normal);
pPoly->planeList[0].set(origin, normal);
pPoly->mPlaneList[0].set(origin, normal);
mCross(vecs[0], vecs[1], &normal);
pPoly->planeList[1].set(origin, normal);
pPoly->mPlaneList[1].set(origin, normal);
mCross(vecs[1], vecs[2], &normal);
pPoly->planeList[2].set(origin, normal);
pPoly->mPlaneList[2].set(origin, normal);
mCross(vecs[1], vecs[0], &normal);
pPoly->planeList[3].set(pPoly->pointList[7], normal);
pPoly->mPlaneList[3].set(pPoly->mPointList[7], normal);
mCross(vecs[2], vecs[1], &normal);
pPoly->planeList[4].set(pPoly->pointList[7], normal);
pPoly->mPlaneList[4].set(pPoly->mPointList[7], normal);
mCross(vecs[0], vecs[2], &normal);
pPoly->planeList[5].set(pPoly->pointList[7], normal);
pPoly->mPlaneList[5].set(pPoly->mPointList[7], normal);
pPoly->edgeList.setSize(12);
pPoly->edgeList[0].vertex[0] = 0; pPoly->edgeList[0].vertex[1] = 1; pPoly->edgeList[0].face[0] = 0; pPoly->edgeList[0].face[1] = 1;
pPoly->edgeList[1].vertex[0] = 1; pPoly->edgeList[1].vertex[1] = 5; pPoly->edgeList[1].face[0] = 0; pPoly->edgeList[1].face[1] = 4;
pPoly->edgeList[2].vertex[0] = 5; pPoly->edgeList[2].vertex[1] = 3; pPoly->edgeList[2].face[0] = 0; pPoly->edgeList[2].face[1] = 3;
pPoly->edgeList[3].vertex[0] = 3; pPoly->edgeList[3].vertex[1] = 0; pPoly->edgeList[3].face[0] = 0; pPoly->edgeList[3].face[1] = 2;
pPoly->edgeList[4].vertex[0] = 3; pPoly->edgeList[4].vertex[1] = 6; pPoly->edgeList[4].face[0] = 3; pPoly->edgeList[4].face[1] = 2;
pPoly->edgeList[5].vertex[0] = 6; pPoly->edgeList[5].vertex[1] = 2; pPoly->edgeList[5].face[0] = 2; pPoly->edgeList[5].face[1] = 5;
pPoly->edgeList[6].vertex[0] = 2; pPoly->edgeList[6].vertex[1] = 0; pPoly->edgeList[6].face[0] = 2; pPoly->edgeList[6].face[1] = 1;
pPoly->edgeList[7].vertex[0] = 1; pPoly->edgeList[7].vertex[1] = 4; pPoly->edgeList[7].face[0] = 4; pPoly->edgeList[7].face[1] = 1;
pPoly->edgeList[8].vertex[0] = 4; pPoly->edgeList[8].vertex[1] = 2; pPoly->edgeList[8].face[0] = 1; pPoly->edgeList[8].face[1] = 5;
pPoly->edgeList[9].vertex[0] = 4; pPoly->edgeList[9].vertex[1] = 7; pPoly->edgeList[9].face[0] = 4; pPoly->edgeList[9].face[1] = 5;
pPoly->edgeList[10].vertex[0] = 5; pPoly->edgeList[10].vertex[1] = 7; pPoly->edgeList[10].face[0] = 3; pPoly->edgeList[10].face[1] = 4;
pPoly->edgeList[11].vertex[0] = 7; pPoly->edgeList[11].vertex[1] = 6; pPoly->edgeList[11].face[0] = 3; pPoly->edgeList[11].face[1] = 5;
pPoly->mEdgeList.setSize(12);
pPoly->mEdgeList[0].vertex[0] = 0; pPoly->mEdgeList[0].vertex[1] = 1; pPoly->mEdgeList[0].face[0] = 0; pPoly->mEdgeList[0].face[1] = 1;
pPoly->mEdgeList[1].vertex[0] = 1; pPoly->mEdgeList[1].vertex[1] = 5; pPoly->mEdgeList[1].face[0] = 0; pPoly->mEdgeList[1].face[1] = 4;
pPoly->mEdgeList[2].vertex[0] = 5; pPoly->mEdgeList[2].vertex[1] = 3; pPoly->mEdgeList[2].face[0] = 0; pPoly->mEdgeList[2].face[1] = 3;
pPoly->mEdgeList[3].vertex[0] = 3; pPoly->mEdgeList[3].vertex[1] = 0; pPoly->mEdgeList[3].face[0] = 0; pPoly->mEdgeList[3].face[1] = 2;
pPoly->mEdgeList[4].vertex[0] = 3; pPoly->mEdgeList[4].vertex[1] = 6; pPoly->mEdgeList[4].face[0] = 3; pPoly->mEdgeList[4].face[1] = 2;
pPoly->mEdgeList[5].vertex[0] = 6; pPoly->mEdgeList[5].vertex[1] = 2; pPoly->mEdgeList[5].face[0] = 2; pPoly->mEdgeList[5].face[1] = 5;
pPoly->mEdgeList[6].vertex[0] = 2; pPoly->mEdgeList[6].vertex[1] = 0; pPoly->mEdgeList[6].face[0] = 2; pPoly->mEdgeList[6].face[1] = 1;
pPoly->mEdgeList[7].vertex[0] = 1; pPoly->mEdgeList[7].vertex[1] = 4; pPoly->mEdgeList[7].face[0] = 4; pPoly->mEdgeList[7].face[1] = 1;
pPoly->mEdgeList[8].vertex[0] = 4; pPoly->mEdgeList[8].vertex[1] = 2; pPoly->mEdgeList[8].face[0] = 1; pPoly->mEdgeList[8].face[1] = 5;
pPoly->mEdgeList[9].vertex[0] = 4; pPoly->mEdgeList[9].vertex[1] = 7; pPoly->mEdgeList[9].face[0] = 4; pPoly->mEdgeList[9].face[1] = 5;
pPoly->mEdgeList[10].vertex[0] = 5; pPoly->mEdgeList[10].vertex[1] = 7; pPoly->mEdgeList[10].face[0] = 3; pPoly->mEdgeList[10].face[1] = 4;
pPoly->mEdgeList[11].vertex[0] = 7; pPoly->mEdgeList[11].vertex[1] = 6; pPoly->mEdgeList[11].face[0] = 3; pPoly->mEdgeList[11].face[1] = 5;
}
@ -569,12 +569,12 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
{
mTriggerPolyhedron = rPolyhedron;
if (mTriggerPolyhedron.pointList.size() != 0) {
if (mTriggerPolyhedron.mPointList.size() != 0) {
mObjBox.minExtents.set(1e10, 1e10, 1e10);
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
for (U32 i = 0; i < mTriggerPolyhedron.pointList.size(); i++) {
mObjBox.minExtents.setMin(mTriggerPolyhedron.pointList[i]);
mObjBox.maxExtents.setMax(mTriggerPolyhedron.pointList[i]);
for (U32 i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) {
mObjBox.minExtents.setMin(mTriggerPolyhedron.mPointList[i]);
mObjBox.maxExtents.setMax(mTriggerPolyhedron.mPointList[i]);
}
} else {
mObjBox.minExtents.set(-0.5, -0.5, -0.5);
@ -585,7 +585,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
setTransform(xform);
mClippedList.clear();
mClippedList.mPlaneList = mTriggerPolyhedron.planeList;
mClippedList.mPlaneList = mTriggerPolyhedron.mPlaneList;
// for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++)
// mClippedList.mPlaneList[i].neg();
@ -623,7 +623,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
bool Trigger::testObject(GameBase* enter)
{
if (mTriggerPolyhedron.pointList.size() == 0)
if (mTriggerPolyhedron.mPointList.size() == 0)
return false;
mClippedList.clear();
@ -731,17 +731,17 @@ U32 Trigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
// Write the polyhedron
if( stream->writeFlag( mask & PolyMask ) )
{
stream->write(mTriggerPolyhedron.pointList.size());
for (i = 0; i < mTriggerPolyhedron.pointList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.pointList[i]);
stream->write(mTriggerPolyhedron.mPointList.size());
for (i = 0; i < mTriggerPolyhedron.mPointList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.mPointList[i]);
stream->write(mTriggerPolyhedron.planeList.size());
for (i = 0; i < mTriggerPolyhedron.planeList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.planeList[i]);
stream->write(mTriggerPolyhedron.mPlaneList.size());
for (i = 0; i < mTriggerPolyhedron.mPlaneList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.mPlaneList[i]);
stream->write(mTriggerPolyhedron.edgeList.size());
for (i = 0; i < mTriggerPolyhedron.edgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mTriggerPolyhedron.edgeList[i];
stream->write(mTriggerPolyhedron.mEdgeList.size());
for (i = 0; i < mTriggerPolyhedron.mEdgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mTriggerPolyhedron.mEdgeList[i];
stream->write(rEdge.face[0]);
stream->write(rEdge.face[1]);
@ -779,19 +779,19 @@ void Trigger::unpackUpdate(NetConnection* con, BitStream* stream)
{
Polyhedron tempPH;
stream->read(&size);
tempPH.pointList.setSize(size);
for (i = 0; i < tempPH.pointList.size(); i++)
mathRead(*stream, &tempPH.pointList[i]);
tempPH.mPointList.setSize(size);
for (i = 0; i < tempPH.mPointList.size(); i++)
mathRead(*stream, &tempPH.mPointList[i]);
stream->read(&size);
tempPH.planeList.setSize(size);
for (i = 0; i < tempPH.planeList.size(); i++)
mathRead(*stream, &tempPH.planeList[i]);
tempPH.mPlaneList.setSize(size);
for (i = 0; i < tempPH.mPlaneList.size(); i++)
mathRead(*stream, &tempPH.mPlaneList[i]);
stream->read(&size);
tempPH.edgeList.setSize(size);
for (i = 0; i < tempPH.edgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
tempPH.mEdgeList.setSize(size);
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
stream->read(&rEdge.face[0]);
stream->read(&rEdge.face[1]);

View file

@ -72,11 +72,11 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector)
mPolyPlaneList.clear();
// Determine which faces will be extruded.
mExtrudedList.setSize(pt.planeList.size());
mExtrudedList.setSize(pt.mPlaneList.size());
for (U32 f = 0; f < pt.planeList.size(); f++)
for (U32 f = 0; f < pt.mPlaneList.size(); f++)
{
const PlaneF& face = pt.planeList[f];
const PlaneF& face = pt.mPlaneList[f];
ExtrudedFace& eface = mExtrudedList[f];
F32 dot = mDot(face,vector);
eface.active = dot > EqualEpsilon;
@ -96,9 +96,9 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector)
}
// Produce extruded planes for bounding and internal edges
for (U32 e = 0; e < pt.edgeList.size(); e++)
for (U32 e = 0; e < pt.mEdgeList.size(); e++)
{
Polyhedron::Edge const& edge = pt.edgeList[e];
Polyhedron::Edge const& edge = pt.mEdgeList[e];
ExtrudedFace& ef1 = mExtrudedList[edge.face[0]];
ExtrudedFace& ef2 = mExtrudedList[edge.face[1]];
if (ef1.active || ef2.active)
@ -106,8 +106,8 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector)
// Assumes that the edge points are clockwise
// for face[0].
const Point3F& p1 = pt.pointList[edge.vertex[1]];
const Point3F &p2 = pt.pointList[edge.vertex[0]];
const Point3F& p1 = pt.mPointList[edge.vertex[1]];
const Point3F &p2 = pt.mPointList[edge.vertex[0]];
Point3F p3 = p2 + vector;
mPlaneList.increment(2);

View file

@ -370,12 +370,12 @@ Polyhedron OptimizedPolyList::toPolyhedron() const
for( U32 i = 0; i < numPoints; ++ i )
{
bool isDuplicate = false;
for( U32 npoint = 0; npoint < polyhedron.pointList.size(); ++ npoint )
for( U32 npoint = 0; npoint < polyhedron.mPointList.size(); ++ npoint )
{
if( npoint == i )
continue;
if( !polyhedron.pointList[ npoint ].equal( mPoints[ i ] ) )
if( !polyhedron.mPointList[ npoint ].equal( mPoints[ i ] ) )
continue;
pointRemap[ i ] = npoint;
@ -384,8 +384,8 @@ Polyhedron OptimizedPolyList::toPolyhedron() const
if( !isDuplicate )
{
pointRemap[ i ] = polyhedron.pointList.size();
polyhedron.pointList.push_back( mPoints[ i ] );
pointRemap[ i ] = polyhedron.mPointList.size();
polyhedron.mPointList.push_back( mPoints[ i ] );
}
}
@ -399,13 +399,13 @@ Polyhedron OptimizedPolyList::toPolyhedron() const
// Add the plane.
const U32 polyIndex = polyhedron.planeList.size();
polyhedron.planeList.push_back( mPlaneList[ poly.plane ] );
const U32 polyIndex = polyhedron.mPlaneList.size();
polyhedron.mPlaneList.push_back( mPlaneList[ poly.plane ] );
// Account for polyhedrons expecting planes to
// face inwards.
polyhedron.planeList.last().invert();
polyhedron.mPlaneList.last().invert();
// Gather remapped indices according to the
// current polygon type.
@ -500,7 +500,7 @@ Polyhedron OptimizedPolyList::toPolyhedron() const
U32 lastIndex = 0;
for( S32 n = indexList.size() - 1; n >= 0; -- n )
{
polyhedron.edgeList.push_back(
polyhedron.mEdgeList.push_back(
Polyhedron::Edge(
polyIndex, 0, // face1 filled later
indexList[ lastIndex ], indexList[ n ]
@ -514,16 +514,16 @@ Polyhedron OptimizedPolyList::toPolyhedron() const
// Finally, consolidate the edge list by merging all edges that
// are shared by polygons.
for( U32 i = 0; i < polyhedron.edgeList.size(); ++ i )
for( U32 i = 0; i < polyhedron.mEdgeList.size(); ++ i )
{
Polyhedron::Edge& edge = polyhedron.edgeList[ i ];
Polyhedron::Edge& edge = polyhedron.mEdgeList[ i ];
// Find the corresponding duplicate edge, if any, and merge
// it into our current edge.
for( U32 n = i + 1; n < polyhedron.edgeList.size(); ++ n )
for( U32 n = i + 1; n < polyhedron.mEdgeList.size(); ++ n )
{
const Polyhedron::Edge& thisEdge = polyhedron.edgeList[ n ];
const Polyhedron::Edge& thisEdge = polyhedron.mEdgeList[ n ];
if( ( thisEdge.vertex[ 0 ] == edge.vertex[ 1 ] &&
thisEdge.vertex[ 1 ] == edge.vertex[ 0 ] ) ||
@ -531,7 +531,7 @@ Polyhedron OptimizedPolyList::toPolyhedron() const
thisEdge.vertex[ 1 ] == edge.vertex[ 1 ] ) )
{
edge.face[ 1 ] = thisEdge.face[ 0 ];
polyhedron.edgeList.erase( n );
polyhedron.mEdgeList.erase( n );
break;
}
}

View file

@ -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 );
}
}

View file

@ -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.

View file

@ -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 )
{

View file

@ -215,27 +215,27 @@ void ScenePolyhedralObject< Base, P >::unpackUpdate( NetConnection* connection,
// Read planes.
const U32 numPlanes = stream->readInt( 8 );
mPolyhedron.planeList.setSize( numPlanes );
mPolyhedron.mPlaneList.setSize( numPlanes );
for( U32 i = 0; i < numPlanes; ++ i )
mathRead( *stream, &mPolyhedron.planeList[ i ] );
mathRead( *stream, &mPolyhedron.mPlaneList[ i ] );
// Read points.
const U32 numPoints = stream->readInt( 8 );
mPolyhedron.pointList.setSize( numPoints );
mPolyhedron.mPointList.setSize( numPoints );
for( U32 i = 0; i < numPoints; ++ i )
mathRead( *stream, &mPolyhedron.pointList[ i ] );
mathRead( *stream, &mPolyhedron.mPointList[ i ] );
// Read edges.
const U32 numEdges = stream->readInt( 8 );
mPolyhedron.edgeList.setSize( numEdges );
mPolyhedron.mEdgeList.setSize( numEdges );
for( U32 i = 0; i < numEdges; ++ i )
{
typename PolyhedronType::EdgeType& edge = mPolyhedron.edgeList[ i ];
typename PolyhedronType::EdgeType& edge = mPolyhedron.mEdgeList[ i ];
edge.face[ 0 ] = stream->readInt( 8 );
edge.face[ 1 ] = stream->readInt( 8 );
@ -344,7 +344,7 @@ bool ScenePolyhedralObject< Base, P >::_setPlane( void* object, const char* inde
&plane.d
);
obj->mPolyhedron.planeList.push_back( plane );
obj->mPolyhedron.mPlaneList.push_back( plane );
obj->setMaskBits( PolyMask );
obj->mIsBox = false;
@ -366,7 +366,7 @@ bool ScenePolyhedralObject< Base, P >::_setPoint( void* object, const char* inde
&point[ 2 ]
);
obj->mPolyhedron.pointList.push_back( point );
obj->mPolyhedron.mPointList.push_back( point );
obj->setMaskBits( PolyMask );
obj->mIsBox = false;
@ -389,7 +389,7 @@ bool ScenePolyhedralObject< Base, P >::_setEdge( void* object, const char* index
&edge.vertex[ 1 ]
);
obj->mPolyhedron.edgeList.push_back( edge );
obj->mPolyhedron.mEdgeList.push_back( edge );
obj->setMaskBits( PolyMask );
obj->mIsBox = false;

View file

@ -586,10 +586,10 @@ void SceneContainer::polyhedronFindObjects(const Polyhedron& polyhedron, U32 mas
Box3F box;
box.minExtents.set(1e9, 1e9, 1e9);
box.maxExtents.set(-1e9, -1e9, -1e9);
for (i = 0; i < polyhedron.pointList.size(); i++)
for (i = 0; i < polyhedron.mPointList.size(); i++)
{
box.minExtents.setMin(polyhedron.pointList[i]);
box.maxExtents.setMax(polyhedron.pointList[i]);
box.minExtents.setMin(polyhedron.mPointList[i]);
box.maxExtents.setMax(polyhedron.mPointList[i]);
}
if ( mask == WaterObjectType ||