diff options
Diffstat (limited to 'source/blender/freestyle/intern/scene_graph')
-rwxr-xr-x | source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp | 15 | ||||
-rwxr-xr-x | source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h | 11 |
2 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index 98872c6c8ea..aaeba943ab6 100755 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -28,6 +28,7 @@ IndexedFaceSet::IndexedFaceSet() _Normals = NULL; _FrsMaterials = 0; _TexCoords = 0; + _FaceEdgeMarks = 0; _VSize = 0; _NSize = 0; _MSize = 0; @@ -51,6 +52,7 @@ IndexedFaceSet::IndexedFaceSet( real *iVertices, unsigned iVSize, FrsMaterial **iMaterials, unsigned iMSize, real *iTexCoords, unsigned iTSize, unsigned iNumFaces, unsigned *iNumVertexPerFace, TRIANGLES_STYLE *iFaceStyle, + FaceEdgeMark *iFaceEdgeMarks, unsigned *iVIndices, unsigned iVISize, unsigned *iNIndices, unsigned iNISize, unsigned *iMIndices, unsigned iMISize, @@ -89,6 +91,9 @@ IndexedFaceSet::IndexedFaceSet( real *iVertices, unsigned iVSize, _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iFaceStyle, _NumFaces*sizeof(TRIANGLES_STYLE)); + _FaceEdgeMarks = new FaceEdgeMark[_NumFaces]; + memcpy(_FaceEdgeMarks, iFaceEdgeMarks, _NumFaces*sizeof(FaceEdgeMark)); + _VISize = iVISize; _VIndices = new unsigned[_VISize]; memcpy(_VIndices, iVIndices, _VISize*sizeof(unsigned)); @@ -129,6 +134,7 @@ IndexedFaceSet::IndexedFaceSet( real *iVertices, unsigned iVSize, _NumFaces = iNumFaces; _NumVertexPerFace = iNumVertexPerFace; _FaceStyle = iFaceStyle; + _FaceEdgeMarks = iFaceEdgeMarks; _VISize = iVISize; _VIndices = iVIndices; @@ -182,6 +188,9 @@ IndexedFaceSet::IndexedFaceSet( const IndexedFaceSet& iBrother) _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iBrother.trianglesStyle(), _NumFaces*sizeof(TRIANGLES_STYLE)); + + _FaceEdgeMarks = new FaceEdgeMark[_NumFaces]; + memcpy(_FaceEdgeMarks, iBrother.faceEdgeMarks(), _NumFaces*sizeof(FaceEdgeMark)); _VISize = iBrother.visize(); _VIndices = new unsigned[_VISize]; @@ -249,6 +258,12 @@ IndexedFaceSet::~IndexedFaceSet() _FaceStyle = NULL; } + if(NULL != _FaceEdgeMarks) + { + delete [] _FaceEdgeMarks; + _FaceEdgeMarks = NULL; + } + if(NULL != _VIndices) { delete [] _VIndices; diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h index 41db4db4c42..b578dc1257e 100755 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h @@ -45,6 +45,13 @@ public: /*! Triangles description style:*/ enum TRIANGLES_STYLE{TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES}; + /*! User-specified face and edge marks for feature edge detection */ + typedef unsigned char FaceEdgeMark; + static const FaceEdgeMark FACE_MARK = 1; + static const FaceEdgeMark EDGE_MARK_V1V2 = 2; + static const FaceEdgeMark EDGE_MARK_V2V3 = 4; + static const FaceEdgeMark EDGE_MARK_V3V1 = 8; + /*! Builds an empty indexed face set */ IndexedFaceSet(); @@ -109,6 +116,7 @@ public: FrsMaterial **iMaterials, unsigned iMSize, real *iTexCoords, unsigned iTSize, unsigned iNumFaces, unsigned *iNumVertexPerFace, TRIANGLES_STYLE *iFaceStyle, + FaceEdgeMark *iFaceEdgeMarks, unsigned *iVIndices, unsigned iVISize, unsigned *iNIndices, unsigned iNISize, unsigned *iMIndices, unsigned iMISize, @@ -124,6 +132,7 @@ public: std::swap(_Normals, ioOther._Normals); std::swap(_FrsMaterials, ioOther._FrsMaterials); std::swap(_TexCoords, ioOther._TexCoords); + std::swap(_FaceEdgeMarks, ioOther._FaceEdgeMarks); std::swap(_VSize, ioOther._VSize); std::swap(_NSize, ioOther._NSize); @@ -180,6 +189,7 @@ public: virtual const unsigned numFaces() const {return _NumFaces;} virtual const unsigned * numVertexPerFaces() const {return _NumVertexPerFace;} virtual const TRIANGLES_STYLE * trianglesStyle() const {return _FaceStyle;} + virtual const unsigned char * faceEdgeMarks() const {return _FaceEdgeMarks;} virtual const unsigned* vindices() const {return _VIndices;} virtual const unsigned* nindices() const {return _NIndices;} virtual const unsigned* mindices() const {return _MIndices;} @@ -204,6 +214,7 @@ protected: unsigned _NumFaces; unsigned *_NumVertexPerFace; TRIANGLES_STYLE *_FaceStyle; + FaceEdgeMark *_FaceEdgeMarks; unsigned *_VIndices; unsigned *_NIndices; |