HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GR_Primitive Class Referenceabstract

#include <GR_Primitive.h>

+ Inheritance diagram for GR_Primitive:

Public Types

enum  GR_DispOptChange { DISPLAY_UNCHANGED, DISPLAY_CHANGED, DISPLAY_VERSION_CHANGED }
 

Public Member Functions

virtual ~GR_Primitive ()
 
virtual const char * className () const =0
 Return a string version of this class's name. More...
 
bool setCacheName (const char *cache_name)
 
virtual GR_PrimAcceptResult acceptPrimitive (GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)=0
 
virtual void resetPrimitives ()
 
virtual GR_BasePrimType getBasePrimType () const
 The base primitive type is usually NORMAL unless this is a packed type. More...
 
virtual GT_PrimitiveHandle getInstancePrim () const
 
bool typeMask (GEO_PrimTypeCompat::TypeMask mask) const
 returns true if this primitive's type mask is part of "mask". More...
 
virtual void checkForDeferredDraw (const RE_Render *r, GR_RenderMode mode, GR_RenderFlags flags, const GR_DrawParms &dp, const UT_Matrix4D &proj_view, const UT_Matrix4D &object, bool &visible, bool &defer)
 
GR_DispOptChange checkDisplayOptionChange (const GR_DisplayOption &opts)
 
virtual bool updateOnViewChange (const GR_DisplayOption &) const
 If this primitive requires an update when the view changes, return true. More...
 
void updatePrim (RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &parms)
 called every time the metacount version is bumped on the GU_Detail. More...
 
virtual void viewUpdate (RE_Render *r, const GR_ViewUpdateParms &parms)
 
virtual void updateInstanceGroup (const RE_VertexArray *array, int instance_group=-1, const char *attrib_name=NULL, RE_GenericAttribID id=RE_GENATTRIB_NONE)
 
void draw (RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags render_flags, GR_DrawParms parms)
 
int drawPick (RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)
 
virtual void setupDrawDecorations (RE_Render *r)
 Called just before drawing our first decoration. More...
 
void drawDecoration (RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms)
 
virtual bool inViewFrustum (const UT_Matrix4D &objviewproj)
 
int64 supportedDecorations ()
 
virtual bool supportsRenderUV ()
 Return true if this primitive supports drawing into a UV viewport. More...
 
virtual bool requiresAlphaPass () const
 Return true if this primitive requires an alpha pass. More...
 
bool drawInAlphaPass (GR_AlphaPass alpha)
 Return true if this should be drawn in the given alpha pass. More...
 
virtual bool renderInAlphaPass (GR_AlphaPass a)
 Return true if this primitive renders in the specified alpha pass. More...
 
virtual bool getBoundingBox (UT_BoundingBoxD &bbox) const
 Returns the bounding box of this primitive if it can be determined. More...
 
virtual const GA_PrimitivegetGAPrimitive (const GU_Detail *gdp, exint primitive_id) const
 
virtual exint getGAVertex (const GU_Detail *gdp, exint vertex_id) const
 
virtual exint getNumGLPrimitives (const GR_DisplayOption *)
 
GR_RenderVersion getRenderVersion () const
 The GL render version to use for this primitive. More...
 
bool showSelections () const
 whether to display component selections or not. More...
 
bool canDoInstancing () const
 Instancing matrix list and version (for the vertex array) More...
 
bool isObjectSelection () const
 Returns true if the full object is selected at the scene level. More...
 
int32 getDisplayOptionVersion () const
 
int32 bumpDisplayOptionVersion ()
 
virtual void retirePrimitive ()
 Called when a node is no longer actively displayed, but still cached. More...
 
virtual RE_GeometrygetDecorationGeometry ()
 
void setPrimUsed (bool used)
 
bool isPrimUsed () const
 
void setParentPrimType (GR_BasePrimType type)
 set for those primitives that are within packed primitives More...
 
GR_BasePrimType getParentPrimType () const
 
const GR_RenderInfogetRenderInfo () const
 
virtual void getGeoRenders (UT_Array< GR_GeoRender * > &renders)
 
void addUpdateMessage (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addUpdateWarning (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addUpdateError (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addUpdateFatal (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addRedrawMessage (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addRedrawWarning (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addRedrawError (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
void addRedrawFatal (GR_ErrorManager::Source err_source, GR_ErrorCode gr_code, UT_StringHolder extra_text=UT_StringHolder(), UT_StringHolder src_name=UT_StringHolder())
 
const char * getCacheName () const
 The base GL cache name assigned to this primitive. More...
 
virtual bool needsGLStateCheck (const GR_DisplayOption &opts) const
 
virtual bool checkGLState (RE_Render *r, const GR_DisplayOption &opts)
 
virtual bool setup (const GR_DisplayOption *)
 
virtual void cleanup (RE_Render *r)
 
GT_PrimitiveHandle getCachedGTPrimitive ()
 
void cacheGTPrimitive (const GT_PrimitiveHandle &prim)
 

Static Public Member Functions

static GR_PrimitivecreatePrimitive (GT_PrimitiveType ptype, int geo_type, const GR_RenderInfo *info, const char *cache_name)
 

Protected Member Functions

 GR_Primitive (const GR_RenderInfo *info, const char *cache_name, GEO_PrimTypeCompat::TypeMask gaprimtype)
 
virtual GR_DispOptChange displayOptionChange (const GR_DisplayOption &opts, bool first_init)
 
virtual void update (RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)=0
 
virtual void render (RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)=0
 
virtual int renderPick (RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)=0
 
virtual void renderDecoration (RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms)
 
bool standardMarkersChanged (const GR_DisplayOption &opts, const GR_Decoration *markers, bool first_init)
 
void updateDecoration (RE_Render *r, GR_Decoration dec, const GR_UpdateParms &p, const GT_PrimitiveHandle &prim, RE_Geometry *geo)
 
void drawDecoration (RE_Render *r, GR_GeoRender *geo, GR_Decoration dec, const GR_DisplayOption *opts, GR_DecorRenderFlags flags, bool overlay, bool override_vis, int instance_group=-1, GR_SelectMode *select_override=NULL, GR_DecorationRender::PrimitiveType t=GR_DecorationRender::PRIM_TRIANGLE)
 
void drawVisualizer (RE_Render *r, GR_GeoRender *geo, const GR_VisualizerInfo *dec_info, const GR_DisplayOption *opts, GR_DecorRenderFlags flags, GR_DecorationRender::PrimitiveType ptype=GR_DecorationRender::PRIM_TRIANGLE)
 
void drawDecorationForGeo (RE_Render *r, RE_Geometry *geo, GR_Decoration dec, const GR_DisplayOption *opts, GR_DecorRenderFlags flags, bool overlay, bool override_vis, int instance_group, GR_SelectMode smode, GR_DecorationRender::PrimitiveType t=GR_DecorationRender::PRIM_TRIANGLE, RE_OverrideList *override_list=NULL)
 
void drawVisualizerForGeo (RE_Render *r, RE_Geometry *geo, const GR_VisualizerInfo *dec_info, const GR_DisplayOption *opts, GR_DecorRenderFlags flags, GR_DecorationRender::PrimitiveType ptype=GR_DecorationRender::PRIM_TRIANGLE)
 
void drawGeoRender (RE_Render *r, GR_GeoRender *geo, GR_RenderMode mode, GR_RenderFlags flags, GR_DrawParms dp)
 
bool checkUserOptions (const GR_DisplayOption &opt) const
 
void updateUserOptions (const GR_DisplayOption &opt)
 
const GR_UserOptiongetUserDecoration (GR_Decoration dec) const
 
void updateUserDecorations (RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, RE_Geometry *for_geo=NULL)
 
GR_DispOptChange checkColorOverride (const GR_DisplayOption &opts, bool first_init)
 
GT_PrimitivecreateUnitSphere (const GT_RefineParms &parms)
 
template<class GeoPrim >
void getGEOPrimFromGT (const GT_PrimitiveHandle &primh, const GeoPrim *&prim)
 
int getPickBufferSize (RE_Geometry *geo, unsigned int picktype, int &vector_size, bool &needs_2pass, int start_group=4, int end_group=-1, GR_PickStyle pickstyle=GR_PICK_NONE) const
 
RE_GeometrycreatePickBuffer (RE_Render *r, int buffer_size, int vector_size=1, bool inconclusive_stream_too=false)
 
int accumulatePickIDs (RE_Render *r, int npicks, RE_Geometry *pick_buffer=NULL)
 
GR_PickCompMode setupPrimPickMode (RE_Render *r, GR_GeoRender *geo) const
 
void setPrimTypeMask (GEO_PrimTypeCompat::TypeMask m)
 
void setSupportedDecorations (int64 mask)
 

Protected Attributes

bool myHasDetailPointNormal
 
GR_DecorationRendermyDecorRender
 
const GR_RenderInfomyInfo
 
UT_BoundingBox myBBox
 
UT_Matrix4D myLocal
 
int myQueuedDrawID
 
int myQueuedPointID
 

Detailed Description

Member Enumeration Documentation

Enumerator
DISPLAY_UNCHANGED 
DISPLAY_CHANGED 
DISPLAY_VERSION_CHANGED 

Definition at line 102 of file GR_Primitive.h.

Constructor & Destructor Documentation

virtual GR_Primitive::~GR_Primitive ( )
virtual
GR_Primitive::GR_Primitive ( const GR_RenderInfo info,
const char *  cache_name,
GEO_PrimTypeCompat::TypeMask  gaprimtype 
)
protected

Primitive constructor. info and cache_name are assigned by the viewport. GR_Primitive subclasses can assign a typemask which is used to determine if the primitive is rendered in instances where only a subset of primitive types is requested.

Member Function Documentation

virtual GR_PrimAcceptResult GR_Primitive::acceptPrimitive ( GT_PrimitiveType  t,
int  geo_type,
const GT_PrimitiveHandle ph,
const GEO_Primitive prim 
)
pure virtual

returns true if the given GT primitive can be rendered by this primitive if t==GT_GEO_PRIMITIVE, geo_type will be the geo type id and prim will be non-NULL. If t is any other type, ph will be a valid GT primitive. The primitives themselves can be used for more sophisticated matching.

Implemented in HDK_Sample::GR_PrimTetra, GR_PrimPacked, GR_PrimAgents, and GR_PrimAgentShape.

int GR_Primitive::accumulatePickIDs ( RE_Render r,
int  npicks,
RE_Geometry pick_buffer = NULL 
)
protected

accumulate picks into the myInfo.myPicks array so that it can be passed up to higher level code. Some effort is made to remove duplicate pickIDs, mostly from neighbouring picks. If 'pick_buffer' is NULL, myPickBuffer is used.

void GR_Primitive::addRedrawError ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addRedrawFatal ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addRedrawMessage ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addRedrawWarning ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addUpdateError ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addUpdateFatal ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addUpdateMessage ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
void GR_Primitive::addUpdateWarning ( GR_ErrorManager::Source  err_source,
GR_ErrorCode  gr_code,
UT_StringHolder  extra_text = UT_StringHolder(),
UT_StringHolder  src_name = UT_StringHolder() 
)
int32 GR_Primitive::bumpDisplayOptionVersion ( )
inline

Definition at line 248 of file GR_Primitive.h.

void GR_Primitive::cacheGTPrimitive ( const GT_PrimitiveHandle prim)
inline

GT Primitive caching. This is handled by updatePrim()

Definition at line 257 of file GR_Primitive.h.

bool GR_Primitive::canDoInstancing ( ) const

Instancing matrix list and version (for the vertex array)

GR_DispOptChange GR_Primitive::checkColorOverride ( const GR_DisplayOption opts,
bool  first_init 
)
protected
GR_Primitive::GR_DispOptChange GR_Primitive::checkDisplayOptionChange ( const GR_DisplayOption opts)
inline

Called when the geometry-related display options change, to determine if an update is required. By default, no update is required. If the options did change, return either DISPLAY_CHANGED, which will call update() without bumping the display option version, or DISPLAY_VERSION_CHANGED, which will bump the version.

Definition at line 553 of file GR_Primitive.h.

virtual void GR_Primitive::checkForDeferredDraw ( const RE_Render r,
GR_RenderMode  mode,
GR_RenderFlags  flags,
const GR_DrawParms dp,
const UT_Matrix4D proj_view,
const UT_Matrix4D object,
bool &  visible,
bool &  defer 
)
virtual

Reimplemented in GR_PrimPacked, and GR_PrimInstance.

virtual bool GR_Primitive::checkGLState ( RE_Render r,
const GR_DisplayOption opts 
)
inlinevirtual

For primitives that may need updating if the GL state changes, this hook allows you to perform a check if no update is otherwise required. Return true to have checkGLState() called. Returning true from that will trigger an update.

Reimplemented in GR_PrimPacked.

Definition at line 149 of file GR_Primitive.h.

bool GR_Primitive::checkUserOptions ( const GR_DisplayOption opt) const
protected
virtual const char* GR_Primitive::className ( ) const
pure virtual
virtual void GR_Primitive::cleanup ( RE_Render r)
inlinevirtual

called once per viewport draw, setup() before any renders are done, and cleanup() after all are complete. There is a possibility that render() may not be called at all.

Reimplemented in GR_PrimPacked.

Definition at line 183 of file GR_Primitive.h.

RE_Geometry* GR_Primitive::createPickBuffer ( RE_Render r,
int  buffer_size,
int  vector_size = 1,
bool  inconclusive_stream_too = false 
)
protected

creates a ivec4 pick buffer with a pickID attribute with buffer_size points. This primitive owns the buffer, and there is only one.

static GR_Primitive* GR_Primitive::createPrimitive ( GT_PrimitiveType  ptype,
int  geo_type,
const GR_RenderInfo info,
const char *  cache_name 
)
static

create a primitive for the given GT type, with appropriate cache name and GL render level

GT_Primitive* GR_Primitive::createUnitSphere ( const GT_RefineParms parms)
protected
virtual GR_DispOptChange GR_Primitive::displayOptionChange ( const GR_DisplayOption opts,
bool  first_init 
)
protectedvirtual

Called when the geometry-related display options change, to determine if an update is required. By default, no update is required. If the options did change, return either DISPLAY_CHANGED, which will call update() without bumping the display option version, or DISPLAY_VERSION_CHANGED, which will bump the version. If 'first_init' is true, this is being called to initialize any cached display options. The return value will be ignored. This will happen just after the primitive is created.

Reimplemented in GR_PrimPacked, GR_PrimAgents, and GR_PrimAgentShape.

void GR_Primitive::draw ( RE_Render r,
GR_RenderMode  render_mode,
GR_RenderFlags  render_flags,
GR_DrawParms  parms 
)

Main render call, which can be called several times in a redraw with different render modes. Calls render to do the real work specialized for each primitive type.

void GR_Primitive::drawDecoration ( RE_Render r,
GR_Decoration  decor,
const GR_DecorationParms parms 
)

Decoration version of draw(). Calls renderDecoration to do the real work specialized for each primitive type.

void GR_Primitive::drawDecoration ( RE_Render r,
GR_GeoRender geo,
GR_Decoration  dec,
const GR_DisplayOption opts,
GR_DecorRenderFlags  flags,
bool  overlay,
bool  override_vis,
int  instance_group = -1,
GR_SelectMode select_override = NULL,
GR_DecorationRender::PrimitiveType  t = GR_DecorationRender::PRIM_TRIANGLE 
)
protected

Helper mother to draw a decoration on a given GR_GeoRender object. Called from renderDecoration() or render().

void GR_Primitive::drawDecorationForGeo ( RE_Render r,
RE_Geometry geo,
GR_Decoration  dec,
const GR_DisplayOption opts,
GR_DecorRenderFlags  flags,
bool  overlay,
bool  override_vis,
int  instance_group,
GR_SelectMode  smode,
GR_DecorationRender::PrimitiveType  t = GR_DecorationRender::PRIM_TRIANGLE,
RE_OverrideList override_list = NULL 
)
protected

Helper method to draw a decoration on a given RE_Geometry object. Called from renderDeocration() or render().

Examples:
tetprim/GR_PrimTetra.C.
void GR_Primitive::drawGeoRender ( RE_Render r,
GR_GeoRender geo,
GR_RenderMode  mode,
GR_RenderFlags  flags,
GR_DrawParms  dp 
)
protected

Helper method to draw a GR_GeoRender object. Called from render() or renderDecoration().

bool GR_Primitive::drawInAlphaPass ( GR_AlphaPass  alpha)
inline

Return true if this should be drawn in the given alpha pass.

Definition at line 584 of file GR_Primitive.h.

int GR_Primitive::drawPick ( RE_Render r,
const GR_DisplayOption opt,
unsigned int  pick_type,
GR_PickStyle  pick_style,
bool  has_pick_map 
)

Picking version of draw(). Calls renderPick to do the real work specialized for each primitive type.

void GR_Primitive::drawVisualizer ( RE_Render r,
GR_GeoRender geo,
const GR_VisualizerInfo dec_info,
const GR_DisplayOption opts,
GR_DecorRenderFlags  flags,
GR_DecorationRender::PrimitiveType  ptype = GR_DecorationRender::PRIM_TRIANGLE 
)
protected
void GR_Primitive::drawVisualizerForGeo ( RE_Render r,
RE_Geometry geo,
const GR_VisualizerInfo dec_info,
const GR_DisplayOption opts,
GR_DecorRenderFlags  flags,
GR_DecorationRender::PrimitiveType  ptype = GR_DecorationRender::PRIM_TRIANGLE 
)
protected
virtual GR_BasePrimType GR_Primitive::getBasePrimType ( ) const
inlinevirtual

The base primitive type is usually NORMAL unless this is a packed type.

Reimplemented in GR_PrimPackedMesh, VISF_Primitive, GR_PrimPacked, GR_PrimFragments, GR_PrimInstance, and GR_PrimAgentShape.

Definition at line 80 of file GR_Primitive.h.

virtual bool GR_Primitive::getBoundingBox ( UT_BoundingBoxD bbox) const
inlinevirtual

Returns the bounding box of this primitive if it can be determined.

Reimplemented in GR_PrimPacked.

Definition at line 210 of file GR_Primitive.h.

GT_PrimitiveHandle GR_Primitive::getCachedGTPrimitive ( )
inline

GT Primitive caching. This is handled by updatePrim()

Definition at line 256 of file GR_Primitive.h.

const char* GR_Primitive::getCacheName ( ) const
inline

The base GL cache name assigned to this primitive.

Examples:
tetprim/GR_PrimTetra.C.

Definition at line 332 of file GR_Primitive.h.

virtual RE_Geometry* GR_Primitive::getDecorationGeometry ( )
inlinevirtual

return the RE_Geometry containing the geometry to be decorated by user display options. May return NULL if no user decorations are to be shown.

Reimplemented in GR_PrimPacked.

Definition at line 275 of file GR_Primitive.h.

int32 GR_Primitive::getDisplayOptionVersion ( ) const
inline

Returns the current display option version for this primitive. It will only be non-zero if the primitive responds to display option changes and bumps the display option version.

Definition at line 245 of file GR_Primitive.h.

virtual const GA_Primitive* GR_Primitive::getGAPrimitive ( const GU_Detail gdp,
exint  primitive_id 
) const
virtual

Return the GA_Primitive corresponding to this primitive. Some rendering primitives may be comprised of multiple GA/GU primitives. The id parameter (corresponding to the __primitive_id attribute) can be used to extract a specific primitive.

Reimplemented in GR_PrimPacked.

virtual exint GR_Primitive::getGAVertex ( const GU_Detail gdp,
exint  vertex_id 
) const
virtual

Find the vertex offset for a given vertex id. The integer returned corresponds with the GA_Offset for the given vertex. If the vertex_id is invalid, the method will return -1.

Reimplemented in GR_PrimPacked.

template<class GeoPrim >
void GR_Primitive::getGEOPrimFromGT ( const GT_PrimitiveHandle primh,
const GeoPrim *&  prim 
)
inlineprotected

Return a GEO_Primitive derivative (GeoPrim) from the GT handle. The GT handle must be referencing a GT_GEOPrimitive.

Definition at line 477 of file GR_Primitive.h.

virtual void GR_Primitive::getGeoRenders ( UT_Array< GR_GeoRender * > &  renders)
inlinevirtual

Definition at line 295 of file GR_Primitive.h.

virtual GT_PrimitiveHandle GR_Primitive::getInstancePrim ( ) const
inlinevirtual

Returns the contained instance prim. Will only be valid if getBasePrimType() is not GR_BASE_PRIM_NORMAL.

Reimplemented in GR_PrimPacked.

Definition at line 85 of file GR_Primitive.h.

virtual exint GR_Primitive::getNumGLPrimitives ( const GR_DisplayOption )
virtual

Return the actual or estimated number of GL primitive that this primitive will be rendering.

Reimplemented in GR_PrimPacked, and GR_PrimInstance.

GR_BasePrimType GR_Primitive::getParentPrimType ( ) const
inline

Definition at line 290 of file GR_Primitive.h.

int GR_Primitive::getPickBufferSize ( RE_Geometry geo,
unsigned int  picktype,
int vector_size,
bool &  needs_2pass,
int  start_group = 4,
int  end_group = -1,
GR_PickStyle  pickstyle = GR_PICK_NONE 
) const
protected

Create a pick buffer large enough to hold all picks from 'geo' with 'picktype' selection style (GR_PICK_GEOPOINT, PRIMITIVE, etc) The required vector size (1 or 2) will be returned in vsize (edges need 2) and needs_2pass will be true if some picks require CPU support.

const GR_RenderInfo* GR_Primitive::getRenderInfo ( ) const
inline

Definition at line 293 of file GR_Primitive.h.

GR_RenderVersion GR_Primitive::getRenderVersion ( ) const

The GL render version to use for this primitive.

const GR_UserOption* GR_Primitive::getUserDecoration ( GR_Decoration  dec) const
protected
virtual bool GR_Primitive::inViewFrustum ( const UT_Matrix4D objviewproj)
inlinevirtual

return true if the primitive is in or overlaps the view frustum. always returning true will effectively disable frustum culling.

Reimplemented in GR_PrimPacked, GR_PrimInstance, and GR_PrimAgentShape.

Definition at line 189 of file GR_Primitive.h.

bool GR_Primitive::isObjectSelection ( ) const

Returns true if the full object is selected at the scene level.

bool GR_Primitive::isPrimUsed ( ) const
inline

Definition at line 285 of file GR_Primitive.h.

virtual bool GR_Primitive::needsGLStateCheck ( const GR_DisplayOption opts) const
inlinevirtual

For primitives that may need updating if the GL state changes, this hook allows you to perform a check if no update is otherwise required. Return true to have checkGLState() called. Returning true from that will trigger an update.

Reimplemented in GR_PrimPacked.

Definition at line 147 of file GR_Primitive.h.

virtual void GR_Primitive::render ( RE_Render r,
GR_RenderMode  render_mode,
GR_RenderFlags  flags,
GR_DrawParms  dp 
)
protectedpure virtual

Main drawing method. update() will always be called before render(), but render() may execute multiple times before the next update call. This method should be fairly lightweight; do as much work in update() as possible. There is no access to the GU_Detail from this method.

Implemented in HDK_Sample::GR_PrimTetra, GR_PrimInstance, GR_PrimPacked, GR_PrimAgents, and GR_PrimAgentShape.

virtual void GR_Primitive::renderDecoration ( RE_Render r,
GR_Decoration  decor,
const GR_DecorationParms parms 
)
protectedvirtual

Render the attributes required for decoration 'decor' (like point markers, uv text, normals, etc). 'overlay' should be set to true if currently rendering in the overlay texture, false if in the main viewport.

Reimplemented in HDK_Sample::GR_PrimTetra, GR_PrimPacked, and GR_PrimAgents.

virtual bool GR_Primitive::renderInAlphaPass ( GR_AlphaPass  a)
virtual

Return true if this primitive renders in the specified alpha pass.

Reimplemented in GR_PrimPacked.

virtual int GR_Primitive::renderPick ( RE_Render r,
const GR_DisplayOption opt,
unsigned int  pick_type,
GR_PickStyle  pick_style,
bool  has_pick_map 
)
protectedpure virtual

Render this primitive for picking, where pick_type is defined as one of the pickable bits in GU_SelectType.h (like GR_PICK_GEOPOINT) return the number of picks

Implemented in HDK_Sample::GR_PrimTetra, GR_PrimPacked, GR_PrimAgents, and GR_PrimAgentShape.

virtual bool GR_Primitive::requiresAlphaPass ( ) const
inlinevirtual

Return true if this primitive requires an alpha pass.

Reimplemented in GR_PrimPacked, and GR_PrimAgentShape.

Definition at line 201 of file GR_Primitive.h.

virtual void GR_Primitive::resetPrimitives ( )
inlinevirtual

This is called if this primitive is collecting multiple GEO or GT primitives. It will be called just before the viewport starts iterating through the primitives. The GR_Primitive should clear its list of collected primitive IDs.

Reimplemented in HDK_Sample::GR_PrimTetra.

Definition at line 77 of file GR_Primitive.h.

virtual void GR_Primitive::retirePrimitive ( )
virtual

Called when a node is no longer actively displayed, but still cached.

Reimplemented in GR_PrimPacked.

bool GR_Primitive::setCacheName ( const char *  cache_name)

The cache name is assigned to this primitive by the viewport. It can be used as a base name for multiple objects by adding a suffix, but do not change the base name. Returns true if the name changed.

void GR_Primitive::setParentPrimType ( GR_BasePrimType  type)
inline

set for those primitives that are within packed primitives

Definition at line 288 of file GR_Primitive.h.

void GR_Primitive::setPrimTypeMask ( GEO_PrimTypeCompat::TypeMask  m)
inlineprotected

Definition at line 514 of file GR_Primitive.h.

void GR_Primitive::setPrimUsed ( bool  used)
inline

Definition at line 284 of file GR_Primitive.h.

void GR_Primitive::setSupportedDecorations ( int64  mask)
inlineprotected

Definition at line 517 of file GR_Primitive.h.

virtual bool GR_Primitive::setup ( const GR_DisplayOption )
inlinevirtual

called once per viewport draw, setup() before any renders are done, and cleanup() after all are complete. There is a possibility that render() may not be called at all.

Reimplemented in GR_PrimPacked.

Definition at line 181 of file GR_Primitive.h.

virtual void GR_Primitive::setupDrawDecorations ( RE_Render r)
virtual

Called just before drawing our first decoration.

GR_PickCompMode GR_Primitive::setupPrimPickMode ( RE_Render r,
GR_GeoRender geo 
) const
protected
bool GR_Primitive::showSelections ( ) const

whether to display component selections or not.

bool GR_Primitive::standardMarkersChanged ( const GR_DisplayOption opts,
const GR_Decoration markers,
bool  first_init 
)
protected

Check if the builtin Houdini markers (point numbers, profile curves, prim normals, etc) have changed since the last redraw, and return true if at least one did. 'markers' is a list of markers to check that must be terminated by GR_NO_DECORATION.

int64 GR_Primitive::supportedDecorations ( )
inline

Return a bitfield of what decorations are supported by this primitive. Set bit (1 << GR_Decoration) if that decoration is supported. Not all primitives will support all decorations.

Definition at line 195 of file GR_Primitive.h.

virtual bool GR_Primitive::supportsRenderUV ( )
virtual

Return true if this primitive supports drawing into a UV viewport.

bool GR_Primitive::typeMask ( GEO_PrimTypeCompat::TypeMask  mask) const
inline

returns true if this primitive's type mask is part of "mask".

Definition at line 89 of file GR_Primitive.h.

virtual void GR_Primitive::update ( RE_Render r,
const GT_PrimitiveHandle primh,
const GR_UpdateParms p 
)
protectedpure virtual

Main update method, called when conditions change which may require the geometry to be updated. These include geometry changes, selections, volatile display options (level of detail), instancing updates, and some GL state changes (if needsGLStateCheck returns true)

Implemented in HDK_Sample::GR_PrimTetra, GR_PrimInstance, GR_PrimPacked, GR_PrimAgentShape, GR_PrimAgents, and GR_PrimFragments.

void GR_Primitive::updateDecoration ( RE_Render r,
GR_Decoration  dec,
const GR_UpdateParms p,
const GT_PrimitiveHandle prim,
RE_Geometry geo 
)
inlineprotected

Updates a decoration for the pass RE_Geometry object. Called from update().

Definition at line 593 of file GR_Primitive.h.

virtual void GR_Primitive::updateInstanceGroup ( const RE_VertexArray array,
int  instance_group = -1,
const char *  attrib_name = NULL,
RE_GenericAttribID  id = RE_GENATTRIB_NONE 
)
virtual

Update an array on the specified instance group. If instance group is -1, array->getInstanceGroup() must specify a valid instance group. If 'array' is null, it will be removed from the instances but you must specify the instance_group and attrib_name.

virtual bool GR_Primitive::updateOnViewChange ( const GR_DisplayOption ) const
inlinevirtual

If this primitive requires an update when the view changes, return true.

Reimplemented in GR_PrimPacked, GR_PrimAgentShape, GR_PrimInstance, and GR_PrimAgents.

Definition at line 118 of file GR_Primitive.h.

void GR_Primitive::updatePrim ( RE_Render r,
const GT_PrimitiveHandle primh,
const GR_UpdateParms parms 
)
inline

called every time the metacount version is bumped on the GU_Detail.

Definition at line 563 of file GR_Primitive.h.

void GR_Primitive::updateUserDecorations ( RE_Render r,
const GT_PrimitiveHandle primh,
const GR_UpdateParms p,
RE_Geometry for_geo = NULL 
)
protected
void GR_Primitive::updateUserOptions ( const GR_DisplayOption opt)
protected
virtual void GR_Primitive::viewUpdate ( RE_Render r,
const GR_ViewUpdateParms parms 
)
inlinevirtual

If updateOnViewChange() returns true, this is called when the view changes.

Reimplemented in GR_PrimPacked, GR_PrimAgentShape, GR_PrimInstance, and GR_PrimAgents.

Definition at line 128 of file GR_Primitive.h.

Member Data Documentation

UT_BoundingBox GR_Primitive::myBBox
protected

Definition at line 525 of file GR_Primitive.h.

GR_DecorationRender* GR_Primitive::myDecorRender
protected
Examples:
tetprim/GR_PrimTetra.C.

Definition at line 521 of file GR_Primitive.h.

bool GR_Primitive::myHasDetailPointNormal
protected

Definition at line 520 of file GR_Primitive.h.

const GR_RenderInfo* GR_Primitive::myInfo
protected

Definition at line 522 of file GR_Primitive.h.

UT_Matrix4D GR_Primitive::myLocal
protected

Definition at line 526 of file GR_Primitive.h.

int GR_Primitive::myQueuedDrawID
protected

Definition at line 527 of file GR_Primitive.h.

int GR_Primitive::myQueuedPointID
protected

Definition at line 528 of file GR_Primitive.h.


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