Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h')
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h403
1 files changed, 201 insertions, 202 deletions
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
index fbe0ee8be0f..6f3604a1029 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
@@ -26,13 +26,13 @@
#include <utility>
#include <vector>
-#if 0 // soc
-#if defined(__GNUC__) && (__GNUC__ >= 3)
+#if 0 // soc
+# if defined(__GNUC__) && (__GNUC__ >= 3)
//hash_map is not part of the C++ standard anymore; hash_map.h has been kept though for backward compatibility
-# include <hash_map.h>
-#else
-# include <hash_map>
-#endif
+# include <hash_map.h>
+# else
+# include <hash_map>
+# endif
#endif
#include "Interface1D.h"
@@ -42,7 +42,7 @@
#include "../system/FreestyleConfig.h"
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
using namespace std;
@@ -54,117 +54,112 @@ using namespace Geometry;
class SVertex;
/*! Defines a hash table used for searching the SVertex */
-struct SVertexHasher
-{
+struct SVertexHasher {
#define _MUL 950706376UL
#define _MOD 2147483647UL
- inline size_t operator()(const Vec3r& p) const
- {
- size_t res = ((unsigned long)(p[0] * _MUL)) % _MOD;
- res = ((res + (unsigned long)(p[1]) * _MUL)) % _MOD;
- return ((res +(unsigned long)(p[2]) * _MUL)) % _MOD;
- }
+ inline size_t operator()(const Vec3r &p) const
+ {
+ size_t res = ((unsigned long)(p[0] * _MUL)) % _MOD;
+ res = ((res + (unsigned long)(p[1]) * _MUL)) % _MOD;
+ return ((res + (unsigned long)(p[2]) * _MUL)) % _MOD;
+ }
#undef _MUL
#undef _MOD
};
// Key_compare predicate for hash_map. In particular, return false if equal.
-struct epsilonEquals
-{
- bool operator()(const Vec3r& v1, const Vec3r& v2) const
- {
- real norm = (v1 - v2).norm();
- return (norm < 1.0e-06);
- }
+struct epsilonEquals {
+ bool operator()(const Vec3r &v1, const Vec3r &v2) const
+ {
+ real norm = (v1 - v2).norm();
+ return (norm < 1.0e-06);
+ }
};
-
// typedef hash_map<Vec3r, SVertex*, SVertexHasher, epsilonEquals> SVertexMap;
typedef map<Vec3r, SVertex *> SVertexMap;
class WXFaceLayer;
/*! class to describe an oriented smooth edge */
-class OWXFaceLayer
-{
-public:
- WXFaceLayer *fl;
- bool order;
-
- OWXFaceLayer()
- {
- fl = NULL;
- order = true;
- }
-
- OWXFaceLayer(WXFaceLayer *ifl, bool iOrder = true)
- {
- fl = ifl;
- order = iOrder;
- }
-
- OWXFaceLayer& operator=(const OWXFaceLayer& iBrother)
- {
- fl = iBrother.fl;
- order = iBrother.order;
- return *this;
- }
-
- bool operator==(const OWXFaceLayer& b)
- {
- return ((fl == b.fl) && (order == b.order));
- }
-
- bool operator!=(const OWXFaceLayer& b)
- {
- return !(*this == b);
- }
+class OWXFaceLayer {
+ public:
+ WXFaceLayer *fl;
+ bool order;
+
+ OWXFaceLayer()
+ {
+ fl = NULL;
+ order = true;
+ }
+
+ OWXFaceLayer(WXFaceLayer *ifl, bool iOrder = true)
+ {
+ fl = ifl;
+ order = iOrder;
+ }
+
+ OWXFaceLayer &operator=(const OWXFaceLayer &iBrother)
+ {
+ fl = iBrother.fl;
+ order = iBrother.order;
+ return *this;
+ }
+
+ bool operator==(const OWXFaceLayer &b)
+ {
+ return ((fl == b.fl) && (order == b.order));
+ }
+
+ bool operator!=(const OWXFaceLayer &b)
+ {
+ return !(*this == b);
+ }
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:OWXFaceLayer")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:OWXFaceLayer")
#endif
};
class WXEdge;
/*! class to describe an oriented sharp edge */
-class OWXEdge
-{
-public:
- WXEdge *e;
- bool order;
-
- OWXEdge()
- {
- e = NULL;
- order = true;
- }
-
- OWXEdge(WXEdge *ie, bool iOrder = true)
- {
- e = ie;
- order = iOrder;
- }
-
- OWXEdge& operator=(const OWXEdge& iBrother)
- {
- e = iBrother.e;
- order = iBrother.order;
- return *this;
- }
-
- bool operator==(const OWXEdge& b)
- {
- return ((e == b.e) && (order == b.order));
- }
-
- bool operator!=(const OWXEdge& b)
- {
- return !(*this == b);
- }
+class OWXEdge {
+ public:
+ WXEdge *e;
+ bool order;
+
+ OWXEdge()
+ {
+ e = NULL;
+ order = true;
+ }
+
+ OWXEdge(WXEdge *ie, bool iOrder = true)
+ {
+ e = ie;
+ order = iOrder;
+ }
+
+ OWXEdge &operator=(const OWXEdge &iBrother)
+ {
+ e = iBrother.e;
+ order = iBrother.order;
+ return *this;
+ }
+
+ bool operator==(const OWXEdge &b)
+ {
+ return ((e == b.e) && (order == b.order));
+ }
+
+ bool operator!=(const OWXEdge &b)
+ {
+ return !(*this == b);
+ }
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:OWXEdge")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:OWXEdge")
#endif
};
@@ -177,117 +172,121 @@ class ViewVertex;
class ViewEdge;
class ViewShape;
-class ViewEdgeXBuilder
-{
-protected:
- int _currentViewId; // Id for view edges
- int _currentFId; // Id for FEdges
- int _currentSVertexId; // Id for SVertex
-
-public:
- inline ViewEdgeXBuilder()
- {
- _currentViewId = 1;
- _currentFId = 0;
- _currentSVertexId = 0;
- }
-
- virtual ~ViewEdgeXBuilder() {}
-
- /*! Builds a view shape from a WXShape in which the feature edges are flagged
- * Builds chains of feature edges (so ViewEdges) from a WXShape
- * iWShape
- * The Winged Edge structure in which all silhouette edges and vertices are flagged.
- * oViewShape
- * The Silhouette Shape in which the chains must be added.
- * ioVEdges
- * The list of new ViewEdges.
- * ioVVertices
- * THe new ViewVertices
- * ioFEdges
- * A list in which all new FEdges are added
- * ioSVertices
- * A list of SVertex where all created SVertex are added.
- */
- virtual void BuildViewEdges(WXShape *iWShape, ViewShape *oVShape, std::vector<ViewEdge*>& ioVEdges,
- std::vector<ViewVertex*>& ioVVertices, std::vector<FEdge*>& ioFEdges,
- std::vector<SVertex*>& ioSVertices);
-
- /*! Builds a smooth view edge, starting the face iFace. */
- ViewEdge *BuildSmoothViewEdge(const OWXFaceLayer& iFaceLayer);
-
- /*! Makes a sharp viewedge */
- ViewEdge *BuildSharpViewEdge(const OWXEdge& iWEdge);
-
-public:
- /*! accessors */
- inline int currentViewId() const
- {
- return _currentViewId;
- }
-
- inline int currentFId() const
- {
- return _currentFId;
- }
-
- inline int currentSVertexId() const
- {
- return _currentSVertexId;
- }
-
- /*! modifiers */
- inline void setCurrentViewId(int id)
- {
- _currentViewId = id;
- }
-
- inline void setCurrentFId(int id)
- {
- _currentFId = id;
- }
-
- inline void setCurrentSVertexId(int id)
- {
- _currentSVertexId = id;
- }
-
-protected:
- /*! Init the view edges building */
- virtual void Init(ViewShape *oVShape);
-
- // SMOOTH //
- /*! checks whether a face has already been processed or not */
- bool stopSmoothViewEdge(WXFaceLayer *iFaceLayer);
- OWXFaceLayer FindNextFaceLayer(const OWXFaceLayer& iFaceLayer);
- OWXFaceLayer FindPreviousFaceLayer(const OWXFaceLayer& iFaceLayer);
- FEdge *BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer& ifl);
-
- // SHARP //
- /*! checks whether a WEdge has already been processed or not */
- bool stopSharpViewEdge(WXEdge *iFace);
- int retrieveFaceMarks(WXEdge *iEdge);
- OWXEdge FindNextWEdge(const OWXEdge& iEdge);
- OWXEdge FindPreviousWEdge(const OWXEdge& iEdge);
- FEdge *BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe);
-
- // GENERAL //
- /*! Instanciate a SVertex */
- SVertex *MakeSVertex(Vec3r& iPoint);
- /*! Instanciate a SVertex if it hasn't been already created */
- SVertex *MakeSVertex(Vec3r& iPoint, bool shared);
- /*! instanciate a ViewVertex from a SVertex, if it doesn't exist yet */
- ViewVertex *MakeViewVertex(SVertex *iSVertex);
-
- //oldtmp values
- //IdHashTable _hashtable;
- //VVIdHashTable _multivertexHashTable;
- SVertexMap _SVertexMap;
- SShape *_pCurrentSShape;
- ViewShape *_pCurrentVShape;
+class ViewEdgeXBuilder {
+ protected:
+ int _currentViewId; // Id for view edges
+ int _currentFId; // Id for FEdges
+ int _currentSVertexId; // Id for SVertex
+
+ public:
+ inline ViewEdgeXBuilder()
+ {
+ _currentViewId = 1;
+ _currentFId = 0;
+ _currentSVertexId = 0;
+ }
+
+ virtual ~ViewEdgeXBuilder()
+ {
+ }
+
+ /*! Builds a view shape from a WXShape in which the feature edges are flagged
+ * Builds chains of feature edges (so ViewEdges) from a WXShape
+ * iWShape
+ * The Winged Edge structure in which all silhouette edges and vertices are flagged.
+ * oViewShape
+ * The Silhouette Shape in which the chains must be added.
+ * ioVEdges
+ * The list of new ViewEdges.
+ * ioVVertices
+ * THe new ViewVertices
+ * ioFEdges
+ * A list in which all new FEdges are added
+ * ioSVertices
+ * A list of SVertex where all created SVertex are added.
+ */
+ virtual void BuildViewEdges(WXShape *iWShape,
+ ViewShape *oVShape,
+ std::vector<ViewEdge *> &ioVEdges,
+ std::vector<ViewVertex *> &ioVVertices,
+ std::vector<FEdge *> &ioFEdges,
+ std::vector<SVertex *> &ioSVertices);
+
+ /*! Builds a smooth view edge, starting the face iFace. */
+ ViewEdge *BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer);
+
+ /*! Makes a sharp viewedge */
+ ViewEdge *BuildSharpViewEdge(const OWXEdge &iWEdge);
+
+ public:
+ /*! accessors */
+ inline int currentViewId() const
+ {
+ return _currentViewId;
+ }
+
+ inline int currentFId() const
+ {
+ return _currentFId;
+ }
+
+ inline int currentSVertexId() const
+ {
+ return _currentSVertexId;
+ }
+
+ /*! modifiers */
+ inline void setCurrentViewId(int id)
+ {
+ _currentViewId = id;
+ }
+
+ inline void setCurrentFId(int id)
+ {
+ _currentFId = id;
+ }
+
+ inline void setCurrentSVertexId(int id)
+ {
+ _currentSVertexId = id;
+ }
+
+ protected:
+ /*! Init the view edges building */
+ virtual void Init(ViewShape *oVShape);
+
+ // SMOOTH //
+ /*! checks whether a face has already been processed or not */
+ bool stopSmoothViewEdge(WXFaceLayer *iFaceLayer);
+ OWXFaceLayer FindNextFaceLayer(const OWXFaceLayer &iFaceLayer);
+ OWXFaceLayer FindPreviousFaceLayer(const OWXFaceLayer &iFaceLayer);
+ FEdge *BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer &ifl);
+
+ // SHARP //
+ /*! checks whether a WEdge has already been processed or not */
+ bool stopSharpViewEdge(WXEdge *iFace);
+ int retrieveFaceMarks(WXEdge *iEdge);
+ OWXEdge FindNextWEdge(const OWXEdge &iEdge);
+ OWXEdge FindPreviousWEdge(const OWXEdge &iEdge);
+ FEdge *BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe);
+
+ // GENERAL //
+ /*! Instanciate a SVertex */
+ SVertex *MakeSVertex(Vec3r &iPoint);
+ /*! Instanciate a SVertex if it hasn't been already created */
+ SVertex *MakeSVertex(Vec3r &iPoint, bool shared);
+ /*! instanciate a ViewVertex from a SVertex, if it doesn't exist yet */
+ ViewVertex *MakeViewVertex(SVertex *iSVertex);
+
+ //oldtmp values
+ //IdHashTable _hashtable;
+ //VVIdHashTable _multivertexHashTable;
+ SVertexMap _SVertexMap;
+ SShape *_pCurrentSShape;
+ ViewShape *_pCurrentVShape;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewEdgeXBuilder")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewEdgeXBuilder")
#endif
};