29 #undef UT_ASSERT_LEVEL
30 #define UT_ASSERT_LEVEL 4
41 using namespace HDK_Sample;
99 if (!
import(
"segments", &mySegments, 1))
102 if (!
import(
"count", &myCurveCount, 1))
105 if (!
import(
"maxradius", &myMaxRadius, 1))
109 if (
import(
"debug", &ival, 1))
110 myDebug = (ival != 0);
115 return myCurveCount > 0 && mySegments > 0 && myMaxRadius > 0;
133 static const int pts_per_curve = 4;
136 int npts = ncurves * pts_per_curve;
141 for (
int i = 0; i < ncurves*3; ++i)
149 for (
int curve = 0; curve < ncurves; curve++)
154 for (
int pt = 0; pt < pts_per_curve; ++pt)
166 for (
int i = 0; i < segments; ++i)
172 for (
int i = 0; i < pts_per_curve; ++i)
179 for (
int curve = 0; curve < ncurves; ++curve)
183 for (
int seg = 0; seg < segments; ++seg)
196 int off = curve * pts_per_curve * 3;
197 for (
int pt = 0; pt < pts_per_curve; ++pt)
199 Pdata[seg]->data()[off+pt*3+0] = px;
200 Pdata[seg]->data()[off+pt*3+1] = Py[pt] *
height;
201 Pdata[seg]->data()[off+pt*3+2] = pz;
221 amap->
add(
"Cd",
true);
223 for (
int seg = 0; seg < segments; ++seg)
224 uniform->
set(0, clr, seg);
228 amap->
add(
"P",
true);
229 amap->
add(
"width",
true);
231 for (
int seg = 0; seg < segments; ++seg)
233 vertex->
set(0, P[seg], seg);
234 vertex->
set(1, widths, seg);
259 fpreal16 clr[3] = { .3f, .5f, 1.f };
276 prim = testBox(myBox, myMaxRadius*2);
280 prim = makeCurveMesh(myBox, myCurveCount, myMaxRadius, mySegments);
283 obj->changeSetting(
"object:rendersubdcurves", 1, &one);
286 obj->changeSetting(
"geometry:computeN", 1, &zero);
SIM_API const UT_StringHolder vertex
void getBoundingBox(UT_BoundingBox &box) override
The bounding box is the "object space" bounds of the procedural.
void set(int idx, const GT_DataArrayHandle &h, int motion_segment=0)
Assign an array to a given index in the list.
A symbol table for attribute data.
UT_IntrusivePtr< GT_AttributeList > GT_AttributeListHandle
GT_DANumeric< fpreal32 > GT_Real32Array
GA_API const UT_StringHolder twist
Procedural primitive for mantra (RAY)
void registerProcedural(RAY_ProceduralFactory *factory)
Modern interface to register procedurals.
bool insert(ProcDefinition *def, bool replace_existing=true)
T * data() const
Raw access to the data array.
GA_API const UT_StringHolder P
std::pair< const char *, UT_VariadicPODType > GT_Attribute
UT_Matrix2T< T > SYSlerp(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2, S t)
int add(const UT_StringHolder &name, bool replace_existing)
SYS_FORCE_INLINE void expandBounds(T relative, T absolute)
GLint GLsizei GLsizei height
int initialize(const UT_BoundingBox *) override
UT_VariadicT< GT_Attribute > GT_VariadicAttributes
UT_BoundingBoxT< float > UT_BoundingBox
const char * className() const override
RAY_ProceduralChildPtr createChild() const
A procedural using GT to create geometry for rendering.
static GT_PrimitiveHandle wireBox(GT_BuilderStatus &err, const UT_BoundingBox &box, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
Parameter definition for arguments to RAY_Procedural.
SYS_FORCE_INLINE void initBounds()
RAY_ProceduralArg * arguments() const override
Provide a const reference to the arguments for the procedural.
Procedural to render a single GT primitive.
GT_DAConstantValue< int64 > GT_IntConstant
An array of numeric values (int32, int64, fpreal16, fpreal32, fpreal64)
RAY_Procedural * create() const override
Create a procedural, and pass ownership of the instance to mantra.
Return the status of primitive creation from GT_PrimitiveBuilder.
ImageBuf OIIO_API zero(ROI roi, int nthreads=0)
Class to create a procedural.
GT_DANumeric< fpreal16 > GT_Real16Array