00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __GU_Fur__
00019 #define __GU_Fur__
00020
00021 #include "GU_API.h"
00022
00023 #include "GU_Detail.h"
00024 #include <UT/UT_OpCaller.h>
00025
00026 enum GU_FurCurveType
00027 {
00028 GU_FUR_POLYGON,
00029 GU_FUR_NURBS
00030 };
00031
00032
00033
00034
00035 class GU_API guFurAttribute
00036 {
00037 public:
00038 guFurAttribute(const GU_Detail *gdp, const char *name, int size, GB_AttribType type);
00039 guFurAttribute(const GU_Detail *gdp, GEO_AttributeOwner owner, const GB_Attribute *atr);
00040
00041
00042
00043 void setDefaultScalar(fpreal scalar);
00044
00045
00046 fpreal evalFloat(int pr, int v, int i = 0) const;
00047 int evalInt(int pr, int v, int i = 0) const;
00048 const char *evalString(int pr, int v, int i = 0) const;
00049
00050
00051 bool hasAttrib() const { return myOffset >= 0; }
00052
00053
00054 const GU_Detail *getGdp() const { return myGdp; }
00055
00056 private:
00057 const void *getData(int pr, int v) const;
00058
00059 const GU_Detail *myGdp;
00060 GEO_AttributeOwner myOwner;
00061 const GB_Attribute *myAttribute;
00062 int myOffset;
00063 bool myUseDefaultScalar;
00064 fpreal myDefaultScalar;
00065 };
00066
00067 class guFurSkinWrapper;
00068 class guFurClumpsWrapper;
00069 class guFurPartingLinesWrapper;
00070
00071 class GU_API GU_Fur
00072 {
00073 public:
00074 GU_Fur(const GU_Detail *skin,
00075 const GU_Detail *guides,
00076 const GU_Detail *clumps,
00077 const GU_Detail *partinglines,
00078 int seed,
00079 fpreal density,
00080 fpreal length,
00081 fpreal clumpradius,
00082 fpreal partingradius,
00083 const UT_String &skin_shader,
00084 const UT_String &guide_shader,
00085 const UT_String &skin_attribs,
00086 const UT_String &guide_attribs,
00087 bool set_id);
00088 virtual ~GU_Fur();
00089
00090
00091
00092
00093
00094
00095
00096 bool initialize(int nvertices);
00097
00098
00099
00100 void generate(UT_OpCaller *caller,
00101 GU_Detail *gdp,
00102 const UT_IntArray &skinprims,
00103 fpreal display,
00104 bool use_closest_clump,
00105 GU_FurCurveType type,
00106 GEO_AttributeOwner skinowner,
00107 GEO_AttributeOwner guideowner,
00108 bool interruptable);
00109
00110
00111 virtual void addError(const UT_String &str) = 0;
00112 virtual void addWarning(const UT_String &str) = 0;
00113
00114 protected:
00115 guFurSkinWrapper *mySkin;
00116 const GU_Detail *myGuides;
00117 guFurClumpsWrapper *myClumps;
00118 guFurPartingLinesWrapper *myPartingLines;
00119
00120 int mySeed;
00121 fpreal myDensity;
00122 fpreal myLength;
00123 const UT_String mySkinShader;
00124 const UT_String myGuideShader;
00125 const UT_String mySkinAttribs;
00126 const UT_String myGuideAttribs;
00127 bool mySetId;
00128 int myNumVertices;
00129 };
00130
00131 #endif