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/Stroke.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/Stroke.h')
-rw-r--r-- | source/blender/freestyle/intern/stroke/Stroke.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index 66dc5a1acf4..27a105bb1cc 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -43,6 +43,14 @@ #include "MEM_guardedalloc.h" #endif +extern "C" { +#include "DNA_material_types.h" +} + +#ifndef MAX_MTEX +#define MAX_MTEX 18 +#endif + namespace Freestyle { // @@ -528,9 +536,11 @@ private: float _Length; // The stroke length viewedge_container _ViewEdges; float _sampling; + float _textureStep; // StrokeRenderer *_renderer; // mark implementation OpenGL renderer MediumType _mediumType; unsigned int _textureId; + MTex *_mtex[MAX_MTEX]; bool _tips; Vec2r _extremityOrientations[2]; // the orientations of the first and last extermity StrokeRep *_rep; @@ -635,6 +645,13 @@ public: /*! Returns the id of the texture used to simulate th marks system for this Stroke */ inline unsigned int getTextureId() {return _textureId;} + /*! Returns the spacing of texture coordinates along the stroke lenght */ + inline float getTextureStep() {return _textureStep;} + + /*! Returns the texture used at given index to simulate the marks system for this Stroke */ + inline MTex *getMTex(int idx) { + return _mtex[idx];} + /*! Returns true if this Stroke uses a texture with tips, false otherwise. */ inline bool hasTips() const { @@ -725,6 +742,25 @@ public: _textureId = id; } + /*! sets the spacing of texture coordinates along the stroke lenght. */ + inline void setTextureStep(float step) + { + _textureStep = step; + } + + /*! assigns a blender texture to the first available slot. */ + inline int setMTex(MTex *mtex) + { + for (int a = 0; a < MAX_MTEX; a++) { + if (!_mtex[a]) { + _mtex[a] = mtex; + + return 0; + } + } + return -1; /* no free slots */ + } + /*! sets the flag telling whether this stroke is using a texture with tips or not. */ inline void setTips(bool iTips) { |