HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_PrimitiveBuilder Class Reference

Create specific primitives by building from existing arrays. More...

#include <GT_PrimitiveBuilder.h>

Static Public Member Functions

static GT_PrimitiveHandle pointMesh (GT_BuilderStatus &err, int npoints, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle polygon (GT_BuilderStatus &err, int npoints, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle polygonMesh (GT_BuilderStatus &err, int npolys, const int *counts, const int *vtxlist, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle subdivisionMesh (GT_BuilderStatus &err, GT_Scheme scheme, int npolys, const int *counts, const int *vtxlist, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle curve (GT_BuilderStatus &err, GT_Basis basis, int npoints, bool wrap, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle curveMesh (GT_BuilderStatus &err, GT_Basis basis, int ncurves, const int *counts, bool wrap, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle patch (GT_BuilderStatus &err, GT_Basis basis, int nu, bool uwrap, int nv, bool vwrap, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle patchMesh (GT_BuilderStatus &err, int npatches, GT_Basis basis, const int *nu, const bool *uwrap, const int *nv, const bool *vwrap, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle nucurves (GT_BuilderStatus &err, int ncurves, const int *counts, const int *orders, const fpreal *knots, const fpreal *tmin, const fpreal *tmax, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle nupatch (GT_BuilderStatus &err, int nu, int uorder, const fpreal *uknots, int nv, int vorder, const fpreal *vknots, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle box (GT_BuilderStatus &err, const UT_BoundingBox &box, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle wireBox (GT_BuilderStatus &err, const UT_BoundingBox &box, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle sphere (GT_BuilderStatus &err, const GT_TransformHandle &transform, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle circle (GT_BuilderStatus &err, const GT_TransformHandle &transform, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle tube (GT_BuilderStatus &err, const GT_TransformHandle &transform, fpreal taper, bool caps, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_PrimitiveHandle hyperboloid (GT_BuilderStatus &err, const GT_TransformHandle &transform, const UT_Vector3D &p0, const UT_Vector3D &p1, const GT_VariadicAttributes &attribs=GT_VariadicAttributes())
 
static GT_TrimNuCurvestrimcurves (GT_BuilderStatus &err, int nloops, const int *curves_per_loop, const int *points_per_curve, const int *curve_orders, const fpreal *knots, const fpreal *min, const fpreal *max, const UT_Vector3D *uvw)
 

Detailed Description

Create specific primitives by building from existing arrays.

These methods construct GT primitives based on the attribute parsing style defined in GT_AttributeBuilder.

Each builder function specifies a number of fixed arguments describing the topology of the primitive. The function also takes variadic arguments which are passed through to the GT_AttributeBuilder function.

A simple example creating a simple point mesh

// Build a point mesh
#define NPOINTS 4
UT_Vector3 P[NPOINTS];
fpreal32 width[NPOINTS];
initialize(P, w);
prim = GT_PrimitiveBuilder::pointMesh(err, NPOINTS,
"vertex point32 P", P,
"vertex real32 width", width,
NULL);

A simple example creating a curve mesh that has deformation motion blur

#define NCURVES 3
#define PTS_PER_CURVE 3
UT_Vector3 P0[NCURVES*PTS_PER_CURVE];
UT_Vector3 P1[NCURVES*PTS_PER_CURVE];
UT_Vector3 Cd[NCURVES*PTS_PER_CURVE];
int points_per_curve[NCURVES];
for (int i = 0; i < ncurves; ++i)
{
initCurveP(i, P0+i*PTS_PER_CURVE, time=0);
initCurveP(i, P1+i*PTS_PER_CURVE, time=1);
initCurveColor(i, Cd + i*PTS_PER_CURVE);
points_per_curve[i] = PTS_PER_CURVE;
}
prim = GT_PrimitiveBuilder::curveMesh(err, GT_BEZIER_BASIS,
NCURVES, points_per_curve, false,
"vertex point32 P", P0, // P for first segment
"vertex point32 P", P1, // P for next segment
"vertex color32 Cd", Cd, // Color for curves
NULL);

Definition at line 68 of file GT_PrimitiveBuilder.h.

Member Function Documentation

static GT_PrimitiveHandle GT_PrimitiveBuilder::box ( GT_BuilderStatus err,
const UT_BoundingBox box,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Build geometry for the given bounding box.

  • varying[8] Varying attributes are defined for each shared point of the box. You should not give a "P" attribute since that's built for you automatically.
  • vertex[24] Vertex attributes are defined per-vertex of each face
  • uniform[6] Uniform attributes are defined per face
  • detail[1]
    Detail attributes are uniform over all faces of the geometry
static GT_PrimitiveHandle GT_PrimitiveBuilder::circle ( GT_BuilderStatus err,
const GT_TransformHandle transform,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Build a circle.

  • varying[1], vertex[1], primitive[1], detail[1] All storage classes should have a single entry
static GT_PrimitiveHandle GT_PrimitiveBuilder::curve ( GT_BuilderStatus err,
GT_Basis  basis,
int  npoints,
bool  wrap,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a single open curve.
The counts array specifies the number of vertices for the curve.

  • varying[], vertex[]
    There are values for each vertex of the curve. Each array should have npoints entries.
  • primitive/detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::curveMesh ( GT_BuilderStatus err,
GT_Basis  basis,
int  ncurves,
const int counts,
bool  wrap,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a mesh of ncurves open curves.
The curves are constructed using the basis given. The counts array specifies the number of vertices for each curve. The vtxlist array contains an index for each vertex. The varying attributes are indexed using these indices. There should be sum(counts) entries in the vtxlist array.

  • varying[], vertex[]
    There are distinct values for each vertex of each curve. Each array should have sum(counts) entries.
  • primitive[ncurves]
    The primitive attributes are specified with a single value per curve.
  • detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::hyperboloid ( GT_BuilderStatus err,
const GT_TransformHandle transform,
const UT_Vector3D p0,
const UT_Vector3D p1,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Build a hyperboloid sheet

  • varying[1], vertex[1], primitive[1], detail[1] All storage classes should have a single entry
static GT_PrimitiveHandle GT_PrimitiveBuilder::nucurves ( GT_BuilderStatus err,
int  ncurves,
const int counts,
const int orders,
const fpreal knots,
const fpreal tmin,
const fpreal tmax,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a mesh of NURBS curves
NURBS curves are defined by a hulls of control vertices.

  • ncurves - The number of individual curves in the mesh
  • counts - The number of vertices in each curve
  • orders - The order of each curve
  • knots - Each curve should have counts[i]+orders[i] knots
  • tmin, tmax - The parametric range for the curve. tmin should be >= to the first knot for the curve. tmax should be >= tmin and <= the last knot for the curve.
  • varying[], vertex[] attributes
    Distinct values for each vertex on the patch. Each array should be nu*nv entries.
  • uniform[] attributes
    Distinct values for each curve. Arrays should have ncurves entries.
  • detail[1]
    Detail attributes are constant across the curve mesh. Please note that for a cubic NURBS curve, the order is 4.
static GT_PrimitiveHandle GT_PrimitiveBuilder::nupatch ( GT_BuilderStatus err,
int  nu,
int  uorder,
const fpreal uknots,
int  nv,
int  vorder,
const fpreal vknots,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a NURBS patch
A NURBS patch is defined by a hull of control vertices. The number of elements in the uknots array should be nu+uorder. The number of elements in the vknots array should be nv+vorder.

  • varying[], vertex[] attributes
    Distinct values for each vertex on the patch. Each array should be nu*nv entries.
  • uniform[1], detail[1]
    Uniform and detail attributes are uniform across the patch. Please note that for a cubic NURBS curve, the order is 4.
static GT_PrimitiveHandle GT_PrimitiveBuilder::patch ( GT_BuilderStatus err,
GT_Basis  basis,
int  nu,
bool  uwrap,
int  nv,
bool  vwrap,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a patch
The patch is constructed using the given basis. When the uwrap or vwrap flags are set, the patch will be wrapped (or periodic) in the given direction. The nu and nv values must match the periodicity and basis.

  • varying[], vertex[]
    There are distinct values for each vertex of the patch. Each array should have nu*nv entries.
  • primitive[npatches]
    The primitive attributes are specified per sub-patch. The number of sub-patches is determined by the basis and periodicity.
  • detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::patchMesh ( GT_BuilderStatus err,
int  npatches,
GT_Basis  basis,
const int nu,
const bool *  uwrap,
const int nv,
const bool *  vwrap,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a patch mesh
A patch mesh is a collection of patches (all with the same basis)

  • nu, nv
    Arrays which should have npatches entries. These are the number of vertices in the u and v directions for each individual patch.
  • uwrap, vwrap
    Arrays which should have npatches entries. These indicate whether each individual patch is wrapped (periodic) in each direction.
  • varying[], vertex[]
    Distinct values for each vertex of every patch. Each array should be sum(nu[i]*nv[i]) entries.
  • uniform[]
    Distinct values for each face of each patch. This value is determined by the wrapped flags and the basis type.
  • detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::pointMesh ( GT_BuilderStatus err,
int  npoints,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a point mesh

  • varying[npoints]
  • vertex[npoints]
  • primitive[1]
  • detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::polygon ( GT_BuilderStatus err,
int  npoints,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a single polygon

  • varying[npoints]
  • vertex[npoints]
  • primitive[1]
  • detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::polygonMesh ( GT_BuilderStatus err,
int  npolys,
const int counts,
const int vtxlist,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a mesh of npolys polygons.
The counts array specifies the number of vertices for each polygon. The vtxlist array contains an index for each vertex. The varying attributes are indexed using these indices. There should be sum(counts) entries in the vtxlist array.

  • varying[]
    These values can be shared between polygons and are referenced using the vtxlist array. The array should have at least max(vtxlist)+1 entries.
  • vertex[]
    These values specify unique values for each vertex of each polygon. There should be sum(counts) entries in each of these arrays.
  • primitive[npolys]
    The primitive attributes are specified with a single value per face.
  • detail[1]
static GT_PrimitiveHandle GT_PrimitiveBuilder::sphere ( GT_BuilderStatus err,
const GT_TransformHandle transform,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Build a sphere.

  • varying[1], vertex[1], primitive[1], detail[1] All storage classes should have a single entry
static GT_PrimitiveHandle GT_PrimitiveBuilder::subdivisionMesh ( GT_BuilderStatus err,
GT_Scheme  scheme,
int  npolys,
const int counts,
const int vtxlist,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Construct a subdivision mesh of nfaces faces.
The counts array specifies the number of vertices for each face. The vtxlist array contains an index for each vertex. The varying attributes are indexed using these indices. There should be sum(counts) entries in the vtxlist array.

  • varying[]
    These values can be shared between faces and are referenced using the vtxlist array. The array should have at least max(vtxlist)+1 entries.
  • vertex[]
    These values specify unique values for each vertex of each face. There should be sum(counts) entries in each of these arrays.
  • primitive[npolys]
    The primitive attributes are specified with a single value per face.
  • detail[1]
static GT_TrimNuCurves* GT_PrimitiveBuilder::trimcurves ( GT_BuilderStatus err,
int  nloops,
const int curves_per_loop,
const int points_per_curve,
const int curve_orders,
const fpreal knots,
const fpreal min,
const fpreal max,
const UT_Vector3D uvw 
)
static

Build trim curves.

  • The curves_per_loop array should be nloops long. The number of curves (ncurves) is the sum of the entries in this array.
  • The points_per_curve array should be ncurves long (i.e. one entry for each individual curve)
  • The curve_orders array should be ncurves long
  • The knots array should have sum(points_per_curve) + sum(curve_orders) entries
  • The min and max arrays should be ncurves long
  • The uvw array should be sum(points_per_curve) entries long
static GT_PrimitiveHandle GT_PrimitiveBuilder::tube ( GT_BuilderStatus err,
const GT_TransformHandle transform,
fpreal  taper,
bool  caps,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Build a tube.

  • varying[1], vertex[1], primitive[1], detail[1] All storage classes should have a single entry
static GT_PrimitiveHandle GT_PrimitiveBuilder::wireBox ( GT_BuilderStatus err,
const UT_BoundingBox box,
const GT_VariadicAttributes attribs = GT_VariadicAttributes() 
)
static

Build a curve mesh for the given bounding box.

  • At the current time, vertex/varying attributes are not supported and are interpreted as uniform/detail attributes. In the future, they may be defined differently.
  • uniform[1]/detail[1]
    Detail & uniform attributes are uniform over all faces of the geometry
Examples:
RAY/RAY_DemoGT.C.

The documentation for this class was generated from the following file: