diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-03 13:51:53 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-03 13:54:59 +0400 |
commit | b7f085d9c128f31d576c732c6439b5a71e8922ee (patch) | |
tree | 8a1fdc2e95470f61d9121b18b125dc272e87d536 /source/blender/freestyle/intern/stroke/StrokeRep.h | |
parent | 6ec2d72eca618be05e9bf0723886b10e6d5efa46 (diff) |
Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Reviewers: brecht, kjym3, #freestyle
Reviewed By: brecht, kjym3
Differential Revision: https://developer.blender.org/D246
Diffstat (limited to 'source/blender/freestyle/intern/stroke/StrokeRep.h')
-rw-r--r-- | source/blender/freestyle/intern/stroke/StrokeRep.h | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h index d01b27215fe..8bbbd9240cb 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.h +++ b/source/blender/freestyle/intern/stroke/StrokeRep.h @@ -36,6 +36,10 @@ #include "MEM_guardedalloc.h" #endif +extern "C" { +#include "DNA_material_types.h" +} + namespace Freestyle { using namespace Geometry; @@ -78,9 +82,13 @@ public: return _point2d; } - inline Vec2r& texCoord() + inline Vec2r& texCoord(bool tips=false) { - return _texCoord; + if (tips) { + return _texCoord_w_tips; + } + else + return _texCoord; } inline Vec3r& color() @@ -98,9 +106,14 @@ public: _point2d = p; } - inline void setTexCoord(const Vec2r& p) + inline void setTexCoord(const Vec2r& p, bool tips=false) { - _texCoord = p; + if (tips) { + _texCoord_w_tips = p; + } + else { + _texCoord = p; + } } inline void setColor(const Vec3r& p) @@ -116,6 +129,7 @@ public: protected: Vec2r _point2d; Vec2r _texCoord; + Vec2r _texCoord_w_tips; Vec3r _color; float _alpha; @@ -135,15 +149,15 @@ protected: public: Strip(const std::vector<StrokeVertex*>& iStrokeVertices, bool hasTips = false, - bool tipBegin = false, bool tipEnd = false); + bool tipBegin = false, bool tipEnd = false, float texStep = 1.0); Strip(const Strip& iBrother); virtual ~Strip(); protected: void createStrip(const std::vector<StrokeVertex*>& iStrokeVertices); void cleanUpSingularities(const std::vector<StrokeVertex*>& iStrokeVertices); - void computeTexCoord (const std::vector<StrokeVertex*>& iStrokeVertices); - void computeTexCoordWithTips (const std::vector<StrokeVertex*>& iStrokeVertices, bool tipBegin, bool tipEnd); + void computeTexCoord (const std::vector<StrokeVertex*>& iStrokeVertices, float texStep); + void computeTexCoordWithTips (const std::vector<StrokeVertex*>& iStrokeVertices, bool tipBegin, bool tipEnd, float texStep); public: inline int sizeStrip() const @@ -168,6 +182,9 @@ protected: vector<Strip*> _strips; Stroke::MediumType _strokeType; unsigned int _textureId; + float _textureStep; + MTex *_mtex[MAX_MTEX]; + Material *_material; // float _averageTextureAlpha; @@ -194,6 +211,16 @@ public: return _textureId; } + inline MTex *getMTex(int idx) const + { + return _mtex[idx]; + } + + inline Material *getMaterial() const + { + return _material; + } + inline vector<Strip*>& getStrips() { return _strips; @@ -220,6 +247,16 @@ public: _textureId = textureId; } + inline void setMaterial(Material *mat) + { + _material = mat; + } + /* + inline void setMTex(int idx, MTex *mtex_ptr) + { + _mtex[idx] = mtex_ptr; + }*/ + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:StrokeRep") #endif |