diff options
Diffstat (limited to 'source/blender/freestyle/intern/winged_edge/WEdge.h')
-rw-r--r-- | source/blender/freestyle/intern/winged_edge/WEdge.h | 97 |
1 files changed, 57 insertions, 40 deletions
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index 41525e03d8e..8001342775b 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -68,15 +68,15 @@ class WVertex { protected: int _Id; // an identificator - Vec3r _Vertex; + Vec3f _Vertex; vector<WEdge*> _EdgeList; WShape *_Shape; // the shape to which the vertex belongs bool _Smooth; // flag to indicate whether the Vertex belongs to a smooth edge or not - int _Border; // 1 -> border, 0 -> no border, -1 -> not set + short _Border; // 1 -> border, 0 -> no border, -1 -> not set public: void *userdata; // designed to store specific user data - inline WVertex(const Vec3r &v) + inline WVertex(const Vec3f &v) { _Id = 0; _Vertex = v; @@ -92,7 +92,7 @@ public: virtual ~WVertex() {} /*! accessors */ - inline Vec3r& GetVertex() + inline Vec3f& GetVertex() { return _Vertex; } @@ -120,7 +120,7 @@ public: bool isBoundary(); /*! modifiers */ - inline void setVertex(const Vec3r& v) + inline void setVertex(const Vec3f& v) { _Vertex = v; } @@ -381,8 +381,8 @@ protected: WFace *_pbFace; // when following the edge, face on the left WEdge *_pOwner; // Edge - Vec3r _vec; - real _angle; + Vec3f _vec; + float _angle; public: void *userdata; @@ -457,17 +457,16 @@ public: return _pOwner; } - inline const Vec3r& GetVec() + inline const Vec3f& GetVec() { return _vec; } - inline const real GetAngle() + inline const float GetAngle() { return _angle; } - /*! modifiers */ #if 0 inline void SetaCWEdge(WOEdge *pe) @@ -552,7 +551,7 @@ class WEdge protected: WOEdge *_paOEdge; // first oriented edge WOEdge *_pbOEdge; // second oriented edge - int _nOEdges; // number of oriented edges associated with this edge. (1 means border edge) + short _nOEdges; // number of oriented edges associated with this edge. (1 means border edge) bool _Mark; // user-specified edge mark for feature edge detection int _Id; // Identifier for the edge @@ -633,7 +632,7 @@ public: return _pbOEdge; } - inline int GetNumberOfOEdges() + inline short GetNumberOfOEdges() { return _nOEdges; } @@ -700,7 +699,7 @@ public: } } - inline void setNumberOfOEdges(int n) + inline void setNumberOfOEdges(short n) { _nOEdges = n; } @@ -739,11 +738,11 @@ class WFace { protected: vector<WOEdge *> _OEdgeList; // list of oriented edges of bording the face - Vec3r _Normal; // normal to the face + Vec3f _Normal; // normal to the face // in case there is a normal per vertex. // The normal number i corresponds to the aVertex of the oedge number i, for that face - vector<Vec3r> _VerticesNormals; - vector<Vec2r> _VerticesTexCoords; + vector<Vec3f> _VerticesNormals; + vector<Vec2f> _VerticesTexCoords; int _Id; unsigned _FrsMaterialIndex; @@ -773,7 +772,7 @@ public: return _OEdgeList[i]; } - inline Vec3r& GetNormal() + inline Vec3f& GetNormal() { return _Normal; } @@ -849,30 +848,30 @@ public: return iOEdge->GetaFace(); } - inline vector<Vec3r>& GetPerVertexNormals() + inline vector<Vec3f>& GetPerVertexNormals() { return _VerticesNormals; } - inline vector<Vec2r>& GetPerVertexTexCoords() + inline vector<Vec2f>& GetPerVertexTexCoords() { return _VerticesTexCoords; } /*! Returns the normal of the vertex of index index */ - inline Vec3r& GetVertexNormal(int index) + inline Vec3f& GetVertexNormal(int index) { return _VerticesNormals[index]; } /*! Returns the tex coords of the vertex of index index */ - inline Vec2r& GetVertexTexCoords(int index) + inline Vec2f& GetVertexTexCoords(int index) { return _VerticesTexCoords[index]; } /*! Returns the normal of the vertex iVertex for that face */ - inline Vec3r& GetVertexNormal(WVertex *iVertex) + inline Vec3f& GetVertexNormal(WVertex *iVertex) { int i = 0; int index = 0; @@ -939,17 +938,17 @@ public: _OEdgeList = iEdgeList; } - inline void setNormal(const Vec3r& iNormal) + inline void setNormal(const Vec3f& iNormal) { _Normal = iNormal; } - inline void setNormalList(const vector<Vec3r>& iNormalsList) + inline void setNormalList(const vector<Vec3f>& iNormalsList) { _VerticesNormals = iNormalsList; } - inline void setTexCoordsList(const vector<Vec2r>& iTexCoordsList) + inline void setTexCoordsList(const vector<Vec2f>& iTexCoordsList) { _VerticesTexCoords = iTexCoordsList; } @@ -990,12 +989,12 @@ public: } /*! For triangles, returns the edge opposite to the vertex in e. - * returns flase if the face is not a triangle or if the vertex is not found + * returns false if the face is not a triangle or if the vertex is not found */ bool getOppositeEdge (const WVertex *v, WOEdge *&e); /*! compute the area of the face */ - real getArea (); + float getArea (); WShape *getShape(); virtual void ResetUserData() @@ -1025,17 +1024,23 @@ protected: vector<WEdge *> _EdgeList; vector<WFace *> _FaceList; int _Id; - string _Name; + const char *_Name; static unsigned _SceneCurrentId; - Vec3r _min; - Vec3r _max; +#if 0 + Vec3f _min; + Vec3f _max; +#endif vector<FrsMaterial> _FrsMaterials; - real _meanEdgeSize; +#if 0 + float _meanEdgeSize; +#endif public: inline WShape() { +#if 0 _meanEdgeSize = 0; +#endif _Id = _SceneCurrentId; _SceneCurrentId++; } @@ -1092,11 +1097,13 @@ public: return _Id; } - inline void bbox(Vec3r& min, Vec3r& max) +#if 0 + inline void bbox(Vec3f& min, Vec3f& max) { min = _min; max = _max; } +#endif inline const FrsMaterial& frs_material(unsigned i) const { @@ -1108,12 +1115,14 @@ public: return _FrsMaterials; } - inline const real getMeanEdgeSize() const +#if 0 + inline const float getMeanEdgeSize() const { return _meanEdgeSize; } +#endif - inline const string& getName() const + inline const char *getName() const { return _Name; } @@ -1144,11 +1153,13 @@ public: _Id = id; } - inline void setBBox(const Vec3r& min, const Vec3r& max) +#if 0 + inline void setBBox(const Vec3f& min, const Vec3f& max) { _min = min; _max = max; } +#endif inline void setFrsMaterial(const FrsMaterial& frs_material, unsigned i) { @@ -1160,7 +1171,7 @@ public: _FrsMaterials = iMaterials; } - inline void setName(const string& name) + inline void setName(const char *name) { _Name = name; } @@ -1199,7 +1210,7 @@ public: * The list of tex coords, iTexCoordsList[i] corresponding to the normal of the vertex iVertexList[i] for * that face. */ - virtual WFace *MakeFace(vector<WVertex *>& iVertexList, vector<Vec3r>& iNormalsList, vector<Vec2r>& iTexCoordsList, + virtual WFace *MakeFace(vector<WVertex *>& iVertexList, vector<Vec3f>& iNormalsList, vector<Vec2f>& iTexCoordsList, vector<bool>& iFaceEdgeMarksList, unsigned iMaterialIndex); inline void AddEdge(WEdge *iEdge) @@ -1240,12 +1251,13 @@ public: } } +#if 0 inline void ComputeBBox() { _min = _VertexList[0]->GetVertex(); _max = _VertexList[0]->GetVertex(); - Vec3r v; + Vec3f v; for (vector<WVertex *>::iterator wv = _VertexList.begin(), wvend = _VertexList.end(); wv != wvend; wv++) { for (unsigned int i = 0; i < 3; i++) { v = (*wv)->GetVertex(); @@ -1256,12 +1268,17 @@ public: } } } +#endif - inline real ComputeMeanEdgeSize() +#if 0 + inline float ComputeMeanEdgeSize() { _meanEdgeSize = _meanEdgeSize / _EdgeList.size(); return _meanEdgeSize; } +#else + real ComputeMeanEdgeSize() const; +#endif protected: /*! Builds the face passed as argument (which as already been allocated) @@ -1368,7 +1385,7 @@ inline void WOEdge::setVecAndAngle() if (_paVertex && _pbVertex) { _vec = _pbVertex->GetVertex() - _paVertex->GetVertex(); if (_paFace && _pbFace) { - real sine = (_pbFace->GetNormal() ^ _paFace->GetNormal()) * _vec / _vec.norm(); + float sine = (_pbFace->GetNormal() ^ _paFace->GetNormal()) * _vec / _vec.norm(); if (sine >= 1.0) { _angle = M_PI / 2.0; return; |