HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_BrushNib.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GU_BrushNib.h ( GU Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GU_BrushNib__
12 #define __GU_BrushNib__
13 
14 #include "GU_API.h"
15 #include <UT/UT_Vector3.h>
16 #include <UT/UT_Matrix3.h>
17 
18 class TS_MetaKernel;
19 class TIL_TextureMap;
20 
21 // This must match the ordered list in SOPs.
23 {
29 };
30 
31 //
32 // This class describes how to do a single dab with the brush. For each
33 // point it describes what the alpha should be:
34 //
36 {
37 public:
38  GU_BrushNib();
39  virtual ~GU_BrushNib();
40 
41  // Determine if pos is within the nibs depth.
42  // It will initialize depth to the depth to the point in the nib. If
43  // depth clipping is off, depth will always be set to 0.0f.
44  bool testDepth(const UT_Vector3 &pos, float &depth)
45  const;
46 
47  virtual float getAlpha(const UT_Vector3 &pos);
48 
49  virtual float getAlphaColor(const UT_Vector3 &pos,
50  UT_Vector3 &cd);
51 
52  int hasStamping() const { return myStampColor; }
53 
54  void setOpacity(float val) { myOpacity = val; }
55  float getOpacity() const { return myOpacity; }
56 
57  void setDepth(bool usedepth,
58  float depth, float height)
59  { myUseDepth = usedepth;
60  myDepth = depth;
61  myHeight = height;
62  }
63 
64  void setStamping(int stamp)
65  { myStampColor = stamp; }
66  void setColor(const UT_Vector3 &cd)
67  { myColor = cd; }
68 
69  void setOrientation(const UT_Vector3 &orig,
70  const UT_Vector3 &dir, const UT_Vector3 &upvector,
71  float rad, float angle, float squash);
72 
73  void setSoftEdge(float softedge,
74  TS_MetaKernel *kernel);
75 
76  void toBrushSpace(UT_Vector3 &pos);
77  float getBrushDist2(const UT_Vector3 &pos);
78 
79  void setSplatter(float brush, float paper)
80  { myPaperNoise = paper; myBrushNoise = brush; }
81 
82  // Finds the amount of splatter to apply to the given worldspace
83  // coordinate.
84  float getSplatter(const UT_Vector3 &pos);
85 
87  { orient = myOrient; }
88 
89 protected:
90  float myOpacity, myInvRadius, myInvRadius2;
91  float myRadius, myRadius2;
92  bool myUseDepth;
93  float myDepth; // How deep we will apply.
94  float myHeight; // How high we will apply.
95  float myAngle, mySquash;
96  UT_Vector3 myOrig, myDir, myUpVector;
97  UT_Matrix3 myOrient; // This is from world space
98  // to normalized brush space
99  float myPaperNoise, myBrushNoise;
100 
101  UT_Vector3 myColor; // Nib's base colour.
102  int myStampColor; // Apply colour to stencil?
103  // This is the percentage of the nib that should have a soft
104  // edge applied.
105  float mySoftEdge;
107 };
108 
110 {
111 public:
113  ~GU_BrushNibSquare() override;
114 
115  float getAlpha(const UT_Vector3 &pos) override;
116 };
117 
119 {
120 public:
122  ~GU_BrushNibBitmap() override;
123 
124  float getAlphaColor(const UT_Vector3 &pos,
125  UT_Vector3 &cd) override;
126 
127 
128  void setRaster(TIL_TextureMap *raster);
130  { myChannel = chanidx; }
131 
132  float getAlpha(const UT_Vector3 &pos) override;
133 
134 protected:
135  float getAlphaFromColor(const UT_Vector4 &clr) const;
136 
139 };
140 
141 
142 #endif
143 
float mySoftEdge
Definition: GU_BrushNib.h:105
virtual float getAlphaColor(const UT_Vector3 &pos, UT_Vector3 &cd)
SIM_API const UT_StringHolder angle
TS_MetaKernel * myKernel
Definition: GU_BrushNib.h:106
float myDepth
Definition: GU_BrushNib.h:93
void setStamping(int stamp)
Definition: GU_BrushNib.h:64
void setOpacity(float val)
Definition: GU_BrushNib.h:54
int hasStamping() const
Definition: GU_BrushNib.h:52
UT_Matrix3 myOrient
Definition: GU_BrushNib.h:97
int myStampColor
Definition: GU_BrushNib.h:102
UT_Vector3 myColor
Definition: GU_BrushNib.h:101
void setRasterChan(GU_BrushBitmapChan chanidx)
Definition: GU_BrushNib.h:129
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
UT_Vector3 myUpVector
Definition: GU_BrushNib.h:96
void setSplatter(float brush, float paper)
Definition: GU_BrushNib.h:79
float myRadius2
Definition: GU_BrushNib.h:91
float myPaperNoise
Definition: GU_BrushNib.h:99
HUSD_API const char * raster()
void setColor(const UT_Vector3 &cd)
Definition: GU_BrushNib.h:66
GU_BrushBitmapChan
Definition: GU_BrushNib.h:22
#define GU_API
Definition: GU_API.h:14
float getOpacity() const
Definition: GU_BrushNib.h:55
GA_API const UT_StringHolder orient
float myHeight
Definition: GU_BrushNib.h:94
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:476
virtual float getAlpha(const UT_Vector3 &pos)
float myOpacity
Definition: GU_BrushNib.h:90
GU_BrushBitmapChan myChannel
Definition: GU_BrushNib.h:138
GLuint GLfloat * val
Definition: glcorearb.h:1608
TIL_TextureMap * myRaster
Definition: GU_BrushNib.h:137
bool myUseDepth
Definition: GU_BrushNib.h:92
void setDepth(bool usedepth, float depth, float height)
Definition: GU_BrushNib.h:57
float mySquash
Definition: GU_BrushNib.h:95
void getOrientation(UT_Matrix3 &orient) const
Definition: GU_BrushNib.h:86