diff --git a/include/SurfaceVertex.h b/include/SurfaceVertex.h index 129ccf8c..46ef516f 100644 --- a/include/SurfaceVertex.h +++ b/include/SurfaceVertex.h @@ -37,8 +37,6 @@ namespace Ogre class SurfaceVertex { public: - SurfaceEdgeIterator edge; - SurfaceVertex(); SurfaceVertex(UIntVector3 positionToSet); SurfaceVertex(UIntVector3 positionToSet, Vector3 normalToSet); @@ -46,18 +44,23 @@ namespace Ogre friend bool operator==(const SurfaceVertex& lhs, const SurfaceVertex& rhs); friend bool operator < (const SurfaceVertex& lhs, const SurfaceVertex& rhs); - const UIntVector3& getPosition(void) const; - + float getAlpha(void) const; + const SurfaceEdgeIterator& getEdge(void) const; const Vector3& getNormal(void) const; - void setNormal(const Vector3& normalToSet); + const UIntVector3& getPosition(void) const; + + void setAlpha(float alphaToSet); + void setEdge(const SurfaceEdgeIterator& edgeToSet); + void setNormal(const Vector3& normalToSet); std::string toString(void); - float alpha; private: UIntVector3 position; Vector3 normal; - + float alpha; + + SurfaceEdgeIterator edge; unsigned long m_uHash; }; diff --git a/source/PolyVoxSceneManager.cpp b/source/PolyVoxSceneManager.cpp index 4e86972b..c6918b0b 100644 --- a/source/PolyVoxSceneManager.cpp +++ b/source/PolyVoxSceneManager.cpp @@ -770,25 +770,25 @@ namespace Ogre SurfaceVertex surfaceVertex0(vertex0); if(material0 == material) - surfaceVertex0.alpha = 1.0; + surfaceVertex0.setAlpha(1.0); else - surfaceVertex0.alpha = 0.0; + surfaceVertex0.setAlpha(0.0); //surfaceVertex0.normal = Vector3(1.0,1.0,1.0); surfaceVertex0.setNormal(Vector3(0.0,0.0,0.0)); SurfaceVertex surfaceVertex1(vertex1); if(material1 == material) - surfaceVertex1.alpha = 1.0; + surfaceVertex1.setAlpha(1.0); else - surfaceVertex1.alpha = 0.0; + surfaceVertex1.setAlpha(0.0); //surfaceVertex1.normal = Vector3(1.0,1.0,1.0); surfaceVertex1.setNormal(Vector3(0.0,0.0,0.0)); SurfaceVertex surfaceVertex2(vertex2); if(material2 == material) - surfaceVertex2.alpha = 1.0; + surfaceVertex2.setAlpha(1.0); else - surfaceVertex2.alpha = 0.0; + surfaceVertex2.setAlpha(0.0); //surfaceVertex2.normal = Vector3(1.0,1.0,1.0); surfaceVertex2.setNormal(Vector3(0.0,0.0,0.0)); diff --git a/source/SurfacePatch.cpp b/source/SurfacePatch.cpp index 8ee04383..35083fb0 100644 --- a/source/SurfacePatch.cpp +++ b/source/SurfacePatch.cpp @@ -73,9 +73,9 @@ namespace Ogre SurfaceEdgeIterator v1v2Iter = findOrAddEdge(v1Iter,v2Iter); SurfaceEdgeIterator v2v0Iter = findOrAddEdge(v2Iter,v0Iter); - v0Iter->edge = v0v1Iter; - v1Iter->edge = v1v2Iter; - v2Iter->edge = v2v0Iter; + v0Iter->setEdge(v0v1Iter); + v1Iter->setEdge(v1v2Iter); + v2Iter->setEdge(v2v0Iter); v0v1Iter->nextHalfEdge = v1v2Iter; v1v2Iter->nextHalfEdge = v2v0Iter; @@ -345,7 +345,7 @@ namespace Ogre std::list result; //LogManager::getSingleton().logMessage("findConnectedVertices " + vertexIter->toString()); - SurfaceEdgeIterator firstEdge = vertexIter->edge; + SurfaceEdgeIterator firstEdge = vertexIter->getEdge(); SurfaceEdgeIterator nextEdge = firstEdge; SurfaceEdgeIterator previousEdge = firstEdge; int ct = 0; diff --git a/source/SurfacePatchRenderable.cpp b/source/SurfacePatchRenderable.cpp index 6837c198..f6569ef5 100644 --- a/source/SurfacePatchRenderable.cpp +++ b/source/SurfacePatchRenderable.cpp @@ -87,7 +87,7 @@ namespace Ogre *prPos++ = verticesToSet[i].getNormal().y; *prPos++ = verticesToSet[i].getNormal().z; - *prPos++ = verticesToSet[i].alpha; + *prPos++ = verticesToSet[i].getAlpha(); if(verticesToSet[i].getPosition().x < vaabMin.x) vaabMin.x = verticesToSet[i].getPosition().x; diff --git a/source/SurfaceVertex.cpp b/source/SurfaceVertex.cpp index d6c55497..9c4df628 100644 --- a/source/SurfaceVertex.cpp +++ b/source/SurfaceVertex.cpp @@ -24,9 +24,14 @@ namespace Ogre m_uHash = (position.x*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.y*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.z); } - const UIntVector3& SurfaceVertex::getPosition(void) const + float SurfaceVertex::getAlpha(void) const { - return position; + return alpha; + } + + const SurfaceEdgeIterator& SurfaceVertex::getEdge(void) const + { + return edge; } const Vector3& SurfaceVertex::getNormal(void) const @@ -34,11 +39,26 @@ namespace Ogre return normal; } + const UIntVector3& SurfaceVertex::getPosition(void) const + { + return position; + } + + void SurfaceVertex::setAlpha(float alphaToSet) + { + alpha = alphaToSet; + } + + void SurfaceVertex::setEdge(const SurfaceEdgeIterator& edgeToSet) + { + edge = edgeToSet; + } + void SurfaceVertex::setNormal(const Vector3& normalToSet) { normal = normalToSet; normal.normalise(); - } + } std::string SurfaceVertex::toString(void) {