34 #include "SOP_MinRay.proto.h"
49 using namespace UT::Literal;
50 using namespace HDK_Sample;
52 constexpr
static int thePointsInput = 0;
53 constexpr
static int theSurfaceInput = 1;
73 SOP_MinRay::theSOPTypeName,
75 SOP_MinRay::myConstructor,
76 SOP_MinRay::buildTemplates(),
100 static const char *theDsFile = R
"THEDSFILE(
108 parmtag { "script_action" "import soputils\nkwargs['geometrytype'] = (hou.geometryType.Points,)\nkwargs['inputindex'] = 0\nsoputils.selectGroupParm(kwargs)" }
109 parmtag { "script_action_help" "Select geometry from an available viewport.\nShift-click to turn on Select Groups." }
110 parmtag { "script_action_icon" "BUTTONS_reselect" }
116 SOP_MinRay::buildTemplates()
144 case theSurfaceInput:
145 return "Collision Geometry";
147 return "Invalid Source";
191 void cook(
const CookParms &cookparms)
const;
205 SOP_MinRay::cookVerb()
const
214 auto &&sopparms = cookparms.
parms<SOP_MinRayParms>();
230 if (!cache->myRayIntersect || !cache->myRayIntersect->validForDetail(collision_detail))
232 cache->myRayIntersect = UTmakeUnique<GU_RayIntersect>(collision_detail);
278 exint nhit = cache->myRayIntersect->minimumPoint(pos, min_info);
288 float u = min_info.
u1;
289 float v = min_info.
v1;
290 float w = min_info.
w1;
295 cache->myRayIntersect->fixBrokenUVs(hit_prim, u, v);
SYS_FORCE_INLINE void bumpDataId()
void UTparallelFor(const Range &range, const Body &body, const int subscribe_ratio=2, const int min_grain_size=1, const bool force_use_task_scope=true)
static const SOP_NodeVerb::Register< SOP_MinRayVerb > theVerb
void newSopOperator(OP_OperatorTable *table)
Iteration over a range of elements.
void setChoiceListPtr(const UT_StringRef &name, PRM_ChoiceList *list)
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
bool blockAdvance(GA_Offset &start, GA_Offset &end)
bool evaluateInteriorPoint(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v, fpreal w=0) const
~SOP_MinRayCache() override
UT_Vector3T< float > UT_Vector3
GA_Attribute * getP()
Convenience method to access the P attribute.
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
UT_UniquePtr< GU_RayIntersect > myRayIntersect
static PRM_ChoiceList pointGroupMenu
A range of elements in an index-map.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
~SOP_MinRayVerb() override
GA_Range getPointRange(const GA_PointGroup *group=0) const
Get a range of all points in the detail.
Constructs a PRM_Template list from an embedded .ds file or an istream.
PRM_Template * templates() const
void cook(const CookParms &cookparms) const
This is the function that does the actual work.
UT_StringHolder name() const
GLenum GLenum GLsizei void * table
GA_API const UT_StringHolder parms
SOP_NodeCache * allocCache() const override
SYS_FORCE_INLINE void setPos3(GA_Offset ptoff, const UT_Vector3 &pos)
Set P from a UT_Vector3.
CookMode cookMode(const SOP_NodeParms *parms) const
const GU_Detail * inputGeo(exint idx) const
SOP_NodeCache * cache() const
GLubyte GLubyte GLubyte GLubyte w
SOP_NodeParms * allocParms() const override
const GA_PointGroup * parsePointGroups(const char *pat, const GroupCreator &creator, bool numok=true, bool ordered=false, bool strict=false, GA_Index point_offset=GA_Index(0), ParseInfo *info=0)
GU_DetailHandle & gdh() const
The initial state of gdh depends on the cookMode()
SYS_FORCE_INLINE bool isstring() const