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

#include <GT_Util.h>

Static Public Member Functions

static void makeGEO (UT_Array< GU_Detail * > &result, const GT_PrimitiveHandle &prim, const GT_RefineParms *rparms=NULL, int segment=0)
 
static void makeGEO (UT_Array< GU_Detail * > &result, const GT_Primitive &prim, const GT_RefineParms *rparms=NULL, int segment=0)
 
static void makeGEO (UT_Array< GU_DetailHandle > &result, const GT_PrimitiveHandle &prim, const GT_RefineParms *parms=NULL, int segment=0)
 
static void makeGEO (UT_Array< GU_DetailHandle > &result, const GT_Primitive &prim, const GT_RefineParms *rparms=NULL, int segment=0)
 
static bool isSimpleGEO (const GT_Primitive &prim, const GT_RefineParms *rparms=NULL)
 Test whether a primitive is atomic (i.e. converts to a single gdp) More...
 
static void makeGD (GD_Detail &gdp, const GT_TrimNuCurves &curves)
 Convert a GT_TrimNuCurves primitive to a GD_Detail for trim curves. More...
 
static GT_Type getType (GA_TypeInfo type)
 Map from GA_Type info to a GT_Type info. More...
 
static GA_TypeInfo getGAType (GT_Type type)
 Map from GT_Type to GA_TypeInfo. More...
 
static GT_Storage getStorage (GA_Storage storage)
 Map from GA_Storage to GT_Storage. More...
 
static GA_Storage getGAStorage (GT_Storage storage)
 Map from GT_Storage to GA_Storage. More...
 
static GT_DataArrayHandle extractAttribute (const GA_Attribute &attrib, const GA_Range &range)
 Extract a data array from a GA attribute. More...
 
static void copyAttributeListToDetail (GU_Detail *gdp, GA_AttributeOwner owner, const GT_RefineParms *parms, const GT_AttributeListHandle &alist, int segment)
 Copies attributes from an attribute list to a detail. More...
 
static bool computeSubdivisionCreases (const GU_Detail &gdp, const GT_PrimPolygonMesh &polymesh, GT_DataArrayHandle &edge_indices, GT_DataArrayHandle &edge_sharpnesses, GT_DataArrayHandle &corner_indices, GT_DataArrayHandle &corner_sharpnesses, GT_DataArrayHandle &hole_indices)
 
static bool computeSubdivisionCreases (const GT_PrimPolygonMesh &polymesh, GT_DataArrayHandle &edge_indices, GT_DataArrayHandle &edge_sharpnesses, GT_DataArrayHandle &corner_indices, GT_DataArrayHandle &corner_sharpnesses, GT_DataArrayHandle &hole_indices)
 
static void addStandardSubdTagsFromAttribs (GT_PrimSubdivisionMesh &subd_mesh, bool allow_uniform_parms=false, const GU_Detail *gdp=nullptr)
 
static GT_DataArrayHandle getPointIndex (const GT_Primitive &prim, const GU_Detail &parent_detail, int npoints)
 Return an array of the point IDs of the primitives (in GA_Index's). More...
 
static GT_DataArrayHandle getPointIndex (const GT_Primitive &prim, const GU_ConstDetailHandle &geo, int npoints)
 
static GT_DataArrayHandle getPointOffset (const GT_Primitive &prim, const GU_Detail &parent_detail, int npoints)
 
static GT_DataArrayHandle getPointOffset (const GT_Primitive &prim, const GU_ConstDetailHandle &geo, int npoints)
 
static GT_DataArrayHandle getPrimitiveIndex (const GT_Primitive &prim, const GU_Detail &parent_dtl, bool use_nested=false)
 
static GT_DataArrayHandle getPrimitiveIndex (const GT_Primitive &prim, const GU_ConstDetailHandle &pdtl, bool use_nested=false)
 
static GT_DataArrayHandle getPrimitiveOffset (const GT_Primitive &prim, const GU_Detail &parent_dtl, bool use_nested=false)
 
static GT_DataArrayHandle getPrimitiveOffset (const GT_Primitive &prim, const GU_ConstDetailHandle &pdtl, bool use_nested=false)
 
template<typename T >
static GT_DataArrayHandle buildPointIndirect (GT_Size *points, GT_Size npoints, GT_Size newpoints)
 
template<typename T >
static GT_DataArrayHandle buildVertexIndirect (const GT_Size *points, const GT_DataArrayHandle &vtx)
 
static GT_PrimitiveHandle optimizePolyMeshForGL (const GT_PrimitiveHandle &mesh, const GU_ConstDetailHandle &parent_dtl, const UT_Array< int > *bone_index_remap=nullptr)
 
static GT_PrimitiveHandle optimizeCurveMeshForGL (const GT_PrimitiveHandle &mesh, const UT_Array< int > *bone_index_remap=nullptr)
 
static void addViewportLODAttribs (const UT_Array< GEO_ViewportLOD > &lods, GT_AttributeListHandle &uniform, GT_AttributeListHandle &detail)
 
static void addBBoxAttrib (const UT_BoundingBox &bbox, GT_AttributeListHandle &detail)
 

Detailed Description

Definition at line 33 of file GT_Util.h.

Member Function Documentation

static void GT_Util::addBBoxAttrib ( const UT_BoundingBox bbox,
GT_AttributeListHandle detail 
)
static
static void GT_Util::addStandardSubdTagsFromAttribs ( GT_PrimSubdivisionMesh subd_mesh,
bool  allow_uniform_parms = false,
const GU_Detail gdp = nullptr 
)
static

Add the standard subdivision tags from the mesh attributes (e.g. creaseweight). If allow_uniform_parms is enabled, attributes for subdivision parameters (like osd_vtxboundaryinterpolation) can be read from the first element of a uniform attribute if the detail attribute does not exist. The gdp can optionally be provided as the source for the attributes and groups, if e.g. facesets aren't being imported.

static void GT_Util::addViewportLODAttribs ( const UT_Array< GEO_ViewportLOD > &  lods,
GT_AttributeListHandle uniform,
GT_AttributeListHandle detail 
)
static
template<typename T >
static GT_DataArrayHandle GT_Util::buildPointIndirect ( GT_Size points,
GT_Size  npoints,
GT_Size  newpoints 
)
inlinestatic

Definition at line 186 of file GT_Util.h.

template<typename T >
static GT_DataArrayHandle GT_Util::buildVertexIndirect ( const GT_Size points,
const GT_DataArrayHandle vtx 
)
inlinestatic

Definition at line 208 of file GT_Util.h.

static bool GT_Util::computeSubdivisionCreases ( const GU_Detail gdp,
const GT_PrimPolygonMesh polymesh,
GT_DataArrayHandle edge_indices,
GT_DataArrayHandle edge_sharpnesses,
GT_DataArrayHandle corner_indices,
GT_DataArrayHandle corner_sharpnesses,
GT_DataArrayHandle hole_indices 
)
static

Some software represents crease weights as a list of edges and sharpnesses, or corners and sharpnesses. This code will look for the Houdini "crease" attributes and map them to edge or corner crease weights. Edge creases are specified by two indices and a single sharpneess (i.e. the length of edge_indices will be twice the length of edge_sharpness).
Each index (edge or corner) refers to a vertex in the vertex list.

Note
: This function relies on being able to find the __primitive_id and __vertex_id attributes on the polygon mesh to evaluate the creaseweight attribute.
: You only need a GT_PrimPolygonMesh to compute creases... GT_PrimSubdivisionMesh is a sub-class of GT_PrimPolygonMesh.
static bool GT_Util::computeSubdivisionCreases ( const GT_PrimPolygonMesh polymesh,
GT_DataArrayHandle edge_indices,
GT_DataArrayHandle edge_sharpnesses,
GT_DataArrayHandle corner_indices,
GT_DataArrayHandle corner_sharpnesses,
GT_DataArrayHandle hole_indices 
)
static

This version of computeSubdivisionCreases() looks for uniform or vertex attributes named "creaseweight" on the GT_PrimPolygonMesh.

static void GT_Util::copyAttributeListToDetail ( GU_Detail gdp,
GA_AttributeOwner  owner,
const GT_RefineParms parms,
const GT_AttributeListHandle alist,
int  segment 
)
static

Copies attributes from an attribute list to a detail.

static GT_DataArrayHandle GT_Util::extractAttribute ( const GA_Attribute attrib,
const GA_Range range 
)
static

Extract a data array from a GA attribute.

static GA_Storage GT_Util::getGAStorage ( GT_Storage  storage)
static

Map from GT_Storage to GA_Storage.

static GA_TypeInfo GT_Util::getGAType ( GT_Type  type)
static

Map from GT_Type to GA_TypeInfo.

static GT_DataArrayHandle GT_Util::getPointIndex ( const GT_Primitive prim,
const GU_Detail parent_detail,
int  npoints 
)
static

Return an array of the point IDs of the primitives (in GA_Index's).

static GT_DataArrayHandle GT_Util::getPointIndex ( const GT_Primitive prim,
const GU_ConstDetailHandle geo,
int  npoints 
)
static
static GT_DataArrayHandle GT_Util::getPointOffset ( const GT_Primitive prim,
const GU_Detail parent_detail,
int  npoints 
)
static
static GT_DataArrayHandle GT_Util::getPointOffset ( const GT_Primitive prim,
const GU_ConstDetailHandle geo,
int  npoints 
)
static
static GT_DataArrayHandle GT_Util::getPrimitiveIndex ( const GT_Primitive prim,
const GU_Detail parent_dtl,
bool  use_nested = false 
)
static

Return an array of the primitive IDs (in GA_Index's). If 'use_nested' is true, attempt to find __nested_prim_id first, then fall back to __primitive_id.

static GT_DataArrayHandle GT_Util::getPrimitiveIndex ( const GT_Primitive prim,
const GU_ConstDetailHandle pdtl,
bool  use_nested = false 
)
static
static GT_DataArrayHandle GT_Util::getPrimitiveOffset ( const GT_Primitive prim,
const GU_Detail parent_dtl,
bool  use_nested = false 
)
static
static GT_DataArrayHandle GT_Util::getPrimitiveOffset ( const GT_Primitive prim,
const GU_ConstDetailHandle pdtl,
bool  use_nested = false 
)
static
static GT_Storage GT_Util::getStorage ( GA_Storage  storage)
static

Map from GA_Storage to GT_Storage.

static GT_Type GT_Util::getType ( GA_TypeInfo  type)
static

Map from GA_Type info to a GT_Type info.

static bool GT_Util::isSimpleGEO ( const GT_Primitive prim,
const GT_RefineParms rparms = NULL 
)
static

Test whether a primitive is atomic (i.e. converts to a single gdp)

static void GT_Util::makeGD ( GD_Detail gdp,
const GT_TrimNuCurves curves 
)
static

Convert a GT_TrimNuCurves primitive to a GD_Detail for trim curves.

static void GT_Util::makeGEO ( UT_Array< GU_Detail * > &  result,
const GT_PrimitiveHandle prim,
const GT_RefineParms rparms = NULL,
int  segment = 0 
)
static

Create a list of geometry details. Each refined primitive is stored in a separate detail. Refine parameters include:

  • bool "gconvert:include_ids" (default: false)
    Keep the __vertex_id and __primitive_id attributes in conversion
  • bool "gconvert:particleprim" (default: false)
    Convert point mesh primitives to a particle primitive. If off, the detail will just contain points (no primitives).
  • bool "gconvert:pack" (default: false)
    Each primitive will be packed into a packed primitive, meaning the list of returned details will each have a single packed primitive.
static void GT_Util::makeGEO ( UT_Array< GU_Detail * > &  result,
const GT_Primitive prim,
const GT_RefineParms rparms = NULL,
int  segment = 0 
)
static

Create a list of geometry details for a single GT primitive. Each refined primitive is stored in a separate detail. These details must be deleted by the caller.

static void GT_Util::makeGEO ( UT_Array< GU_DetailHandle > &  result,
const GT_PrimitiveHandle prim,
const GT_RefineParms parms = NULL,
int  segment = 0 
)
static

Create a list of geometry details, but return the result in an array of GU_DetailHandle's. Each primitive's refined geometry is stored in a separate detail.

Refine parameters include:

  • bool "gconvert:include_ids" (default: false)
    Keep the __vertex_id and __primitive_id attributes in conversion
  • bool "gconvert:particleprim" (default: false)
    Convert point mesh primitives to a particle primitive. If off, the detail will just contain points (no primitives).
static void GT_Util::makeGEO ( UT_Array< GU_DetailHandle > &  result,
const GT_Primitive prim,
const GT_RefineParms rparms = NULL,
int  segment = 0 
)
static

Create a list of geometry details for a single GT primitive. Each refined primitive is stored in a separate detail.

static GT_PrimitiveHandle GT_Util::optimizeCurveMeshForGL ( const GT_PrimitiveHandle mesh,
const UT_Array< int > *  bone_index_remap = nullptr 
)
static
static GT_PrimitiveHandle GT_Util::optimizePolyMeshForGL ( const GT_PrimitiveHandle mesh,
const GU_ConstDetailHandle parent_dtl,
const UT_Array< int > *  bone_index_remap = nullptr 
)
static

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