HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 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 (RE_RenderContext r, GR_RenderMode mode, GR_RenderFlags flags, const GR_DrawParms &dp, const UT_Matrix4D &proj_view, const UT_Matrix4D &object, const UT_Vector2F &min_proj_size, bool &visible, bool &defer)
 
virtual bool isPrimVisible () const
 
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_RenderContext 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_RenderContext r, const GR_ViewUpdateParms &parms)
 
virtual void updateInstanceGroupGL (const RE_VertexArray *array, int instance_group=-1, const char *attrib_name=NULL, RE_GenericAttribID id=RE_GENATTRIB_NONE)
 
virtual void updateInstanceGroup (const GR_InstanceBuffer *buffer, int instance_group=-1)
 
void draw (RE_RenderContext r, GR_RenderMode render_mode, GR_RenderFlags render_flags, GR_DrawParms parms)
 
int drawPick (RE_RenderContext r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)
 
virtual void setupDrawDecorations (RE_RenderContext r)
 Called just before drawing our first decoration. More...
 
void drawDecoration (RE_RenderContext r, GR_Decoration decor, const GR_DecorationParms &parms)
 
virtual bool inViewFrustum (const UT_Matrix4D &objviewproj, const UT_BoundingBoxD *bbox=nullptr)
 
virtual bool isRasterizedInView (const UT_Matrix4F &objviewproj, const UT_Vector2F &min_proj_size, const UT_BoundingBoxF *bbox=nullptr)
 
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) const
 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...
 
void setAlphaPassMask (int mask)
 
int getAlphaPassMask () const
 
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...
 
virtual bool supportsParallelDraw () const
 
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...
 
bool supportsDynamicCulling () const
 
void supportsDynamicCulling (bool dc)
 
int32 getDisplayOptionVersion () const
 
int32 bumpDisplayOptionVersion ()
 
virtual void retirePrimitive ()
 Called when a node is no longer actively displayed, but still cached. More...
 
virtual RE_GeometrygetDecorationGeometry ()
 
virtual bool isHighlighted () const
 Only for the Scene Graph view: highlighted prims. More...
 
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...
 
void incref ()
 
void decref ()
 
virtual bool needsGLStateCheck (const GR_DisplayOption &opts) const
 
virtual bool checkGLState (RE_RenderContext r, const GR_DisplayOption &opts)
 
virtual bool setup (const GR_DisplayOption *)
 
virtual void cleanup (RE_RenderContext 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_Primitive ()
 
virtual GR_DispOptChange displayOptionChange (const GR_DisplayOption &opts, bool first_init)
 
virtual void update (RE_RenderContext r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)=0
 
virtual void render (RE_RenderContext r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)=0
 
virtual int renderPick (RE_RenderContext r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)=0
 
virtual void renderDecoration (RE_RenderContext r, GR_Decoration decor, const GR_DecorationParms &parms)
 
bool standardMarkersChanged (const GR_DisplayOption &opts, const GR_Decoration *markers, bool first_init)
 
void updateDecoration (RE_RenderContext r, GR_Decoration dec, const GR_UpdateParms &p, const GT_PrimitiveHandle &prim, RE_Geometry *geo)
 
void updateDecoration (RE_RenderContext r, GR_Decoration dec, const GR_UpdateParms &p, const GT_PrimitiveHandle &prim, RV_Geometry *geo)
 
void updateDecorationList (RE_RenderContext r, const GR_Decoration *pdecs, const GR_UpdateParms &p, const GT_PrimitiveHandle &prim, GR_GeoRender *geo)
 
void drawDecoration (RE_RenderContext 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_RenderContext 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_RenderContext 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_RenderContext 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 drawDecorationForGeo (RE_RenderContext r, RV_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_RenderContext r, RV_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_RenderContext 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_RenderContext 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 doPickPoints (RE_RenderContext r, const GR_DisplayOption *opts, GR_GeoRender *gr, RE_Geometry *geo, GR_SelectMode select_mode, int select_inst, GR_PickStyle pickstyle, bool has_pick_map, RE_PrimType real_prim_type, int real_connect_start, int real_connect_num)
 
int doPickPoints (RE_RenderContext r, const GR_DisplayOption *opts, GR_GeoRender *gr, RV_Geometry *geo, GR_SelectMode select_mode, int select_inst, GR_PickStyle pickstyle, bool has_pick_map, RE_PrimType real_prim_type, int real_connect_start, int real_connect_num)
 
int doPickPoints (RE_RenderContext r, const GR_DisplayOption *opts, GR_GeoRender *gr, GR_PickStyle pickstyle, bool has_pick_map, RE_PrimType real_prim_type, int real_connect_start, int real_connect_num)
 Do picking for point attribute on GeoRender gr More...
 
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
 
int getPickBufferSize (const GR_PickRender *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
 
GR_PickBuffercreatePickBuffer (RE_RenderContext r, int buffer_size, int vector_size=1, bool inconclusive_stream_too=false, const GR_PickRender *geo=nullptr)
 
UT_UniquePtr< GR_PickRendercreatePickRender (RE_RenderContext r, const GR_DisplayOption *opts, GR_GeoRender *gr, unsigned int picktype)
 
int accumulatePickIDs (RE_RenderContext r, int npicks, GR_PickBuffer *pick_buffer=NULL)
 
GR_PickCompMode setupPrimPickMode (RE_RenderContext r, GR_GeoRender *geo) const
 
void setPrimTypeMask (GEO_PrimTypeCompat::TypeMask m)
 
void setSupportedDecorations (int64 mask)
 
bool checkForRibbons (const GR_UpdateParms &p, const GT_PrimitiveHandle &primh) const
 

Protected Attributes

bool myHasDetailPointNormal
 
bool mySupportsDynamicCulling
 
GR_DecorationRendermyDecorRender
 
const GR_RenderInfomyInfo
 
UT_BoundingBoxF myBBox
 
UT_Matrix4D myLocal
 
int myQueuedDrawID
 
int myQueuedPointID
 

Detailed Description

Member Enumeration Documentation

Enumerator
DISPLAY_UNCHANGED 
DISPLAY_CHANGED 
DISPLAY_VERSION_CHANGED 

Definition at line 108 of file GR_Primitive.h.

Constructor & Destructor Documentation

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.

virtual GR_Primitive::~GR_Primitive ( )
protectedvirtual

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_PrimAgentShape, GR_PrimPacked, and GR_PrimAgents.

int GR_Primitive::accumulatePickIDs ( RE_RenderContext  r,
int  npicks,
GR_PickBuffer 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 288 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 297 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 720 of file GR_Primitive.h.

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

Reimplemented in GR_PrimPacked, and GR_PrimInstance.

bool GR_Primitive::checkForRibbons ( const GR_UpdateParms p,
const GT_PrimitiveHandle primh 
) const
protected
virtual bool GR_Primitive::checkGLState ( RE_RenderContext  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 162 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_RenderContext  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 197 of file GR_Primitive.h.

GR_PickBuffer* GR_Primitive::createPickBuffer ( RE_RenderContext  r,
int  buffer_size,
int  vector_size = 1,
bool  inconclusive_stream_too = false,
const GR_PickRender geo = nullptr 
)
protected

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

UT_UniquePtr<GR_PickRender> GR_Primitive::createPickRender ( RE_RenderContext  r,
const GR_DisplayOption opts,
GR_GeoRender gr,
unsigned int  picktype 
)
protected

creates a PickRender wrapping the passed in GeoRender, also creates a pick buffer if needed

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
void GR_Primitive::decref ( )
inline

Definition at line 379 of file GR_Primitive.h.

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_PrimAgentShape, and GR_PrimAgents.

int GR_Primitive::doPickPoints ( RE_RenderContext  r,
const GR_DisplayOption opts,
GR_GeoRender gr,
RE_Geometry geo,
GR_SelectMode  select_mode,
int  select_inst,
GR_PickStyle  pickstyle,
bool  has_pick_map,
RE_PrimType  real_prim_type,
int  real_connect_start,
int  real_connect_num 
)
protected

Do picking for point attribute on GeoRender gr

Only uses parameters geo, select_mode, and select_inst if gr is null, ignores them and uses values set from gr

int GR_Primitive::doPickPoints ( RE_RenderContext  r,
const GR_DisplayOption opts,
GR_GeoRender gr,
RV_Geometry geo,
GR_SelectMode  select_mode,
int  select_inst,
GR_PickStyle  pickstyle,
bool  has_pick_map,
RE_PrimType  real_prim_type,
int  real_connect_start,
int  real_connect_num 
)
protected
int GR_Primitive::doPickPoints ( RE_RenderContext  r,
const GR_DisplayOption opts,
GR_GeoRender gr,
GR_PickStyle  pickstyle,
bool  has_pick_map,
RE_PrimType  real_prim_type,
int  real_connect_start,
int  real_connect_num 
)
protected

Do picking for point attribute on GeoRender gr

void GR_Primitive::draw ( RE_RenderContext  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_RenderContext  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_RenderContext  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_RenderContext  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::drawDecorationForGeo ( RE_RenderContext  r,
RV_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().

void GR_Primitive::drawGeoRender ( RE_RenderContext  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) const
inline

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

Definition at line 226 of file GR_Primitive.h.

int GR_Primitive::drawPick ( RE_RenderContext  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_RenderContext  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_RenderContext  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
void GR_Primitive::drawVisualizerForGeo ( RE_RenderContext  r,
RV_Geometry geo,
const GR_VisualizerInfo dec_info,
const GR_DisplayOption opts,
GR_DecorRenderFlags  flags,
GR_DecorationRender::PrimitiveType  ptype = GR_DecorationRender::PRIM_TRIANGLE 
)
protected
int GR_Primitive::getAlphaPassMask ( ) const
inline

Definition at line 239 of file GR_Primitive.h.

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, GR_PrimAgentShape, GR_PrimPacked, VISF_Primitive, GR_PrimFragments, and GR_PrimInstance.

Definition at line 82 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 233 of file GR_Primitive.h.

GT_PrimitiveHandle GR_Primitive::getCachedGTPrimitive ( )
inline

GT Primitive caching. This is handled by updatePrim()

Definition at line 296 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 375 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 315 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 285 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 565 of file GR_Primitive.h.

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

Definition at line 338 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 87 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 333 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.

int GR_Primitive::getPickBufferSize ( const GR_PickRender 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 336 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
void GR_Primitive::incref ( )
inline

Definition at line 378 of file GR_Primitive.h.

virtual bool GR_Primitive::inViewFrustum ( const UT_Matrix4D objviewproj,
const UT_BoundingBoxD bbox = nullptr 
)
inlinevirtual

return true if the primitive is in or overlaps the view frustum. always returning true will effectively disable frustum culling. bbox is an option bounding box which can be used for frustum testing.

Reimplemented in GR_PrimPacked, GR_PrimAgentShape, and GR_PrimInstance.

Definition at line 204 of file GR_Primitive.h.

virtual bool GR_Primitive::isHighlighted ( ) const
inlinevirtual

Only for the Scene Graph view: highlighted prims.

Definition at line 318 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 328 of file GR_Primitive.h.

virtual bool GR_Primitive::isPrimVisible ( ) const
inlinevirtual

Reimplemented in GR_PrimPacked.

Definition at line 105 of file GR_Primitive.h.

virtual bool GR_Primitive::isRasterizedInView ( const UT_Matrix4F objviewproj,
const UT_Vector2F min_proj_size,
const UT_BoundingBoxF bbox = nullptr 
)
virtual

Similar to inViewFrustum, but also considers if the prim is too small to render in the viewport. Also uses 32b FP precision for speed.

Reimplemented in GR_PrimPacked.

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 160 of file GR_Primitive.h.

virtual void GR_Primitive::render ( RE_RenderContext  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_PrimPacked, GR_PrimInstance, GR_PrimAgentShape, and GR_PrimAgents.

virtual void GR_Primitive::renderDecoration ( RE_RenderContext  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_RenderContext  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_PrimAgentShape, and GR_PrimAgents.

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 223 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.

Definition at line 79 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.

void GR_Primitive::setAlphaPassMask ( int  mask)
inline

Definition at line 237 of file GR_Primitive.h.

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 331 of file GR_Primitive.h.

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

Definition at line 662 of file GR_Primitive.h.

void GR_Primitive::setPrimUsed ( bool  used)
inline

Definition at line 327 of file GR_Primitive.h.

void GR_Primitive::setSupportedDecorations ( int64  mask)
inlineprotected

Definition at line 665 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 195 of file GR_Primitive.h.

virtual void GR_Primitive::setupDrawDecorations ( RE_RenderContext  r)
virtual

Called just before drawing our first decoration.

GR_PickCompMode GR_Primitive::setupPrimPickMode ( RE_RenderContext  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 217 of file GR_Primitive.h.

bool GR_Primitive::supportsDynamicCulling ( ) const
inline

Returns true if the primitive supports packed prim culling when its parent is a packed prim. On by default.

Definition at line 277 of file GR_Primitive.h.

void GR_Primitive::supportsDynamicCulling ( bool  dc)
inline

Definition at line 279 of file GR_Primitive.h.

virtual bool GR_Primitive::supportsParallelDraw ( ) const
inlinevirtual

Whether this primitive can have it's render function called from a thread other then the main thread

Reimplemented in GR_PrimPacked.

Definition at line 264 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 91 of file GR_Primitive.h.

virtual void GR_Primitive::update ( RE_RenderContext  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_PrimAgentShape, GR_PrimPacked, GR_PrimAgents, and GR_PrimFragments.

void GR_Primitive::updateDecoration ( RE_RenderContext  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 760 of file GR_Primitive.h.

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

Definition at line 776 of file GR_Primitive.h.

void GR_Primitive::updateDecorationList ( RE_RenderContext  r,
const GR_Decoration pdecs,
const GR_UpdateParms p,
const GT_PrimitiveHandle prim,
GR_GeoRender geo 
)
protected
virtual void GR_Primitive::updateInstanceGroup ( const GR_InstanceBuffer buffer,
int  instance_group = -1 
)
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 void GR_Primitive::updateInstanceGroupGL ( 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_PrimAgents, and GR_PrimInstance.

Definition at line 124 of file GR_Primitive.h.

void GR_Primitive::updatePrim ( RE_RenderContext  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 730 of file GR_Primitive.h.

void GR_Primitive::updateUserDecorations ( RE_RenderContext  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_RenderContext  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 134 of file GR_Primitive.h.

Member Data Documentation

UT_BoundingBoxF GR_Primitive::myBBox
protected

Definition at line 677 of file GR_Primitive.h.

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

Definition at line 673 of file GR_Primitive.h.

bool GR_Primitive::myHasDetailPointNormal
protected

Definition at line 671 of file GR_Primitive.h.

const GR_RenderInfo* GR_Primitive::myInfo
protected

Definition at line 674 of file GR_Primitive.h.

UT_Matrix4D GR_Primitive::myLocal
protected

Definition at line 678 of file GR_Primitive.h.

int GR_Primitive::myQueuedDrawID
protected

Definition at line 679 of file GR_Primitive.h.

int GR_Primitive::myQueuedPointID
protected

Definition at line 680 of file GR_Primitive.h.

bool GR_Primitive::mySupportsDynamicCulling
protected

Definition at line 672 of file GR_Primitive.h.


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