46 using namespace HDK_Sample;
62 PRM_Name(
"usedir",
"Use Direction Vector"),
87 :
SOP_Node(net, name, op), myGroup(NULL)
182 (!myGroup || !myGroup->
isEmpty()))
207 positionattribs.
append(handle);
216 normalattribs.
append(handle);
225 vectorattribs.
append(handle);
260 float dist = DIST(now);
279 normal.
assign(NX(now), NY(now), NZ(now));
285 for (
exint i = 0; i < positionattribs.
size(); ++i)
288 p -= normal * (
dot(normal, p) -
dist);
289 positionattribs(i).set(ptoff, p);
293 for (
exint i = 0; i < normalattribs.
size(); ++i)
296 if (
dot(normal, n) < 0)
300 normalattribs(i).set(ptoff, n);
305 for (
exint i = 0; i < vectorattribs.
size(); ++i)
308 v -= normal *
dot(normal, v);
309 vectorattribs(i).set(ptoff, v);
337 float dist = DIST(now);
347 nx = 0; ny = 0; nz = 1;
350 nx = 1; ny = 0; nz = 0;
353 nx = 0; ny = 1; nz = 0;
359 nx = NX(now); ny = NY(now); nz = NZ(now);
371 float sx = bbox.
sizeX();
372 float sy = bbox.
sizeY();
373 float sz = bbox.
sizeZ();
374 float size = SYSsqrt(sx*sx + sy*sy + sz*sz);
376 float cx = normal.
x() *
dist;
377 float cy = normal.
y() *
dist;
378 float cz = normal.
z() *
dist;
380 myGuide1->meshGrid(divs, divs, size, size);
397 return "Geometry to Flatten";
SYS_FORCE_INLINE void bumpDataId()
GA_API const UT_StringHolder dist
Definition of a geometry attribute.
void setNeedGuide1(bool onOff)
Iteration over a range of elements.
PRM_API const PRM_Type PRM_STRING
bool getBBox(UT_BoundingBox *bbox, const GA_PrimitiveGroup *g=nullptr) const
bool blockAdvance(GA_Offset &start, GA_Offset &end)
static PRM_SpareData * getGroupSelectButton(GA_GroupType group_type, const char *group_type_parm=NULL, int input_index=0, PRM_SpareData *merge_spare_data=NULL, const char *assoc_groups=NULL, GroupSelectAsOrdered ordered=GroupSelectAsOrdered::AUTO, const char *use_name_attr=nullptr, const char *select_script=nullptr)
SOP_Flatten(OP_Network *net, const char *name, OP_Operator *op)
PRM_API PRM_Name PRMorientName
constexpr SYS_FORCE_INLINE T & z() noexcept
PRM_API const PRM_Type PRM_ORD
bool updateParmsFlags() override
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
GU_DetailHandle myGdpHandle
OP_ERROR cookInputGroups(OP_Context &context, int alone=0) override
OP_ERROR cookMyGuide1(OP_Context &context) override
static PRM_ChoiceList pointGroupMenu
void newSopOperator(OP_OperatorTable *table)
GA_Range getPointRange(const GA_PointGroup *group=0) const
Get a range of all points in the detail.
PRM_API const PRM_Type PRM_DIRECTION
static PRM_Template myTemplateList[]
const GU_Detail * inputGeo(int index, OP_Context &)
#define GA_FOR_ALL_POINT_ATTRIBUTES(gdp, A)
bool enableParm(int pi, int state, int v=-1)
static UT_Matrix3T< T > dihedral(UT_Vector3T< S > &a, UT_Vector3T< S > &b, UT_Vector3T< S > &c, int norm=1)
OP_ERROR cookMySop(OP_Context &context) override
Method to cook geometry for the SOP.
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
bool needsTransform(bool include_P=true) const
OP_ERROR cookInputPointGroups(OP_Context &context, const GA_PointGroup *&group, bool alone=false, bool do_selection=true, int parm_index=0, int group_type_index=-1, bool allow_reference=true, bool ordered=false, bool detached=true, int input_index=0)
See cookInputPrimitiveGroups.
PRM_API PRM_Default PRMzaxisDefaults[]
PRM_API PRM_Range PRMscaleRange
GLuint const GLchar * name
PRM_API PRM_Name PRMgroupName
void setVariableOrder(int detail, int prim, int pt, int vtx)
PRM_API const PRM_Type PRM_FLT_J
GLenum GLenum GLsizei void * table
void setManagesDataIDs(bool onOff)
IMATH_HOSTDEVICE constexpr int divs(int x, int y) IMATH_NOEXCEPT
SYS_FORCE_INLINE bool isValid() const
void assign(T xx=0.0f, T yy=0.0f, T zz=0.0f)
Set the values of the vector components.
void setCurGdh(int index, const GU_DetailHandle &gdh)
void translate(T dx, T dy, T dz=0)
SYS_FORCE_INLINE GA_TypeInfo getTypeInfo() const
Data represents a normal vector. Token "normal".
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
PRM_API const PRM_Type PRM_TOGGLE
Data represents a direction vector. Token "vector".
Data represents a position in space. Token "point".
SYS_FORCE_INLINE UT_StorageMathFloat_t< T > normalize() noexcept
SYS_FORCE_INLINE bool isEmpty() const
Query whether the group is empty of primary elements.
PRM_API PRM_Name PRMdirectionName
constexpr SYS_FORCE_INLINE T & y() noexcept
PRM_API PRM_Default PRMzeroDefaults[]
const char * inputLabel(unsigned idx) const override
PRM_API PRM_ChoiceList PRMplaneMenu
constexpr SYS_FORCE_INLINE T & x() noexcept
OP_ERROR duplicateSource(unsigned index, OP_Context &context, GU_Detail *gdp, bool clean=true)