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

#include <GR_PrimInstance.h>

+ Inheritance diagram for GR_PrimInstance:

Public Member Functions

 GR_PrimInstance (const GR_RenderInfo *info, const char *cache_name, const GT_PrimitiveHandle &instance_prim, const GT_PrimitiveHandle &instancer, const UT_Matrix4DArray &instance_transforms, const GU_ConstDetailHandle &instance_gdp, int nest_level, int prim_index=-1, const UT_BoundingBox *bbox=nullptr)
 
 ~GR_PrimInstance () override
 
const char * className () const override
 Return a string version of this class's name. More...
 
GR_BasePrimType getBasePrimType () const override
 The base primitive type is usually NORMAL unless this is a packed type. More...
 
void setTransforms (const UT_Matrix4DArray &inst_transforms)
 
void setNestLevel (int nest_level)
 
void setTopTransforms (const UT_Matrix4DArray &top_xforms)
 
bool updateOnViewChange (const GR_DisplayOption &dopts) const override
 If this primitive requires an update when the view changes, return true. More...
 
void viewUpdate (RE_Render *r, const GR_ViewUpdateParms &parms) override
 
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, const UT_Vector2F &min_proj_size, bool &visible, bool &defer) override
 
void update (RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p) override
 
void render (RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp) override
 
bool inViewFrustum (const UT_Matrix4D &objviewprojj, const UT_BoundingBoxD *bbox=nullptr) override
 
exint getNumGLPrimitives (const GR_DisplayOption *) override
 
bool getSingleTransform (UT_Matrix4D &mat) const override
 
int getNumTopTransforms () const
 
int getNumTransforms () const
 
void setInstancer (const GT_PrimitiveHandle &ph)
 
- Public Member Functions inherited from GR_PrimPacked
 GR_PrimPacked (const GR_RenderInfo *info, const char *cache_name, const GT_PrimitiveHandle &packed_prim, const GT_PrimitiveHandle &instanced_prim, const GU_ConstDetailHandle &instanced_gdp, int prim_index=-1)
 
 ~GR_PrimPacked () override
 
const char * className () const override
 Return a string version of this class's name. More...
 
GR_BasePrimType getBasePrimType () const override
 The base primitive type is usually NORMAL unless this is a packed type. More...
 
GT_PrimitiveHandle getInstancePrim () const override
 
const GT_PrimitiveHandleinstancePrim () const
 
const GT_PrimitiveHandlepackedPrim () const
 
void setPackedPrim (const GT_PrimitiveHandle &packed_prim)
 
void setInstancedPrim (const GT_PrimitiveHandle &instance, const GU_ConstDetailHandle &inst_gdp)
 
void setPrimIndex (int pindex)
 
GR_PrimAcceptResult acceptPrimitive (GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim) override
 
void update (RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p) override
 
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, const UT_Vector2F &min_proj_size, bool &visible, bool &defer) override
 
void render (RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp) override
 
void renderDecoration (RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms) override
 
int renderPick (RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map) override
 
bool checkForTransformChange ()
 
GR_DispOptChange displayOptionChange (const GR_DisplayOption &opts, bool first_init) override
 
bool updateOnViewChange (const GR_DisplayOption &) const override
 If this primitive requires an update when the view changes, return true. More...
 
void viewUpdate (RE_Render *r, const GR_ViewUpdateParms &parms) override
 
bool needsGLStateCheck (const GR_DisplayOption &opts) const override
 
bool checkGLState (RE_Render *r, const GR_DisplayOption &opt) override
 
bool setup (const GR_DisplayOption *) override
 
void cleanup (RE_Render *r) override
 
bool requiresAlphaPass () const override
 Return true if this primitive requires an alpha pass. More...
 
const GA_PrimitivegetGAPrimitive (const GU_Detail *gdp, exint primitive_id) const override
 
exint getGAVertex (const GU_Detail *gdp, exint vertex_id) const override
 
RE_GeometrygetDecorationGeometry () override
 
bool renderInAlphaPass (GR_AlphaPass a) override
 Return true if this primitive renders in the specified alpha pass. More...
 
bool inViewFrustum (const UT_Matrix4D &objviewproj, const UT_BoundingBoxD *bbox=nullptr) override
 
bool isRasterizedInView (const UT_Matrix4F &objviewproj, const UT_Vector2F &min_proj_size, const UT_BoundingBoxF *bbox) override
 
bool getBoundingBox (UT_BoundingBoxD &bbox) const override
 Returns the bounding box of this primitive if it can be determined. More...
 
exint getNumGLPrimitives (const GR_DisplayOption *) override
 
void retirePrimitive () override
 Called when a node is no longer actively displayed, but still cached. More...
 
GR_SelectMode getSelectionMode (const GU_Detail &gdp, GU_SelectionHandle &selection) const
 
void setPickID (GA_Index prim_id, GA_Index point_id)
 
void setInstanceHookPrim (GR_Primitive *prim)
 
void setPrimVisible (bool v)
 
- Public Member Functions inherited from GR_Primitive
bool setCacheName (const char *cache_name)
 
virtual void resetPrimitives ()
 
bool typeMask (GEO_PrimTypeCompat::TypeMask mask) const
 returns true if this primitive's type mask is part of "mask". More...
 
GR_DispOptChange checkDisplayOptionChange (const GR_DisplayOption &opts)
 
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 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)
 
int64 supportedDecorations ()
 
virtual bool supportsRenderUV ()
 Return true if this primitive supports drawing into a UV viewport. More...
 
bool drawInAlphaPass (GR_AlphaPass alpha) const
 Return true if this should be drawn in the given alpha pass. More...
 
void setAlphaPassMask (int mask)
 
int getAlphaPassMask () const
 
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...
 
bool supportsDynamicCulling () const
 
void supportsDynamicCulling (bool dc)
 
int32 getDisplayOptionVersion () const
 
int32 bumpDisplayOptionVersion ()
 
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 ()
 
GT_PrimitiveHandle getCachedGTPrimitive ()
 
void cacheGTPrimitive (const GT_PrimitiveHandle &prim)
 

Additional Inherited Members

- Public Types inherited from GR_Primitive
enum  GR_DispOptChange { DISPLAY_UNCHANGED, DISPLAY_CHANGED, DISPLAY_VERSION_CHANGED }
 
- Static Public Member Functions inherited from GR_Primitive
static GR_PrimitivecreatePrimitive (GT_PrimitiveType ptype, int geo_type, const GR_RenderInfo *info, const char *cache_name)
 
- Protected Member Functions inherited from GR_PrimPacked
virtual bool isFragment () const
 
bool updateCacheName (const GT_PrimitiveHandle &iph, const GR_UpdateParms &p, bool fallback)
 
void updateInstanceGeometry (RE_Render *r, const GT_PrimitiveHandle &container_prim, const GR_UpdateParms &p, bool build_anchors, GR_UpdateReason full_update)
 
bool fetchBoundingBox (UT_BoundingBoxD &bbox) const
 
virtual void buildAnchorsGL3 (RE_Render *r, const GR_UpdateParms &p, GR_UpdateReason full_reason, const GT_PrimitiveHandle &xforms)
 
void buildPickID (const GT_PrimitiveHandle &pid)
 
RE_GeometrybuildPickBBox (RE_Render *r) const
 
void buildInstPrimTransform ()
 
GR_UpdateReason checkForPackedGeoChanges (const GT_PrimitiveHandle &ph, GR_UpdateReason reason)
 
GR_UpdateParms checkForPackedMaterialAssignment (const GR_UpdateParms &p)
 
void updateLightLinking ()
 
void updateLinkMap (const UT_StringRef &attrib_name, UT_StringMap< int > &link_map, UT_StringArray &list, bool &has_link)
 
bool setLightLinkMask (GR_DrawParms &dp, int &prev_mask) const
 
void restoreLightLinkMask (GR_DrawParms &dp, int prev_mask) const
 
- Protected Member Functions inherited from GR_Primitive
 GR_Primitive (const GR_RenderInfo *info, const char *cache_name, GEO_PrimTypeCompat::TypeMask gaprimtype)
 
virtual ~GR_Primitive ()
 
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 inherited from GR_PrimPacked
GT_PrimitiveHandle myPackedPrim
 
RE_GeometrymyCenterPoints
 
RE_GeometrymyCenterPrims
 
RE_CacheVersion myCenterPointCacheVersion
 
GR_PrimitivePtr myInstance
 
GU_ConstDetailHandle myInstancedDetail
 
GT_PrimitiveHandle myInstancedPrim
 
GT_PrimitiveType myInstancedPrimType
 
int64 myInstancedDetailID
 
int64 myInstancedDetailCacheCount
 
UT_Vector3F myInstancePoint
 
UT_Matrix4D myInstancePrimTransform
 
UT_BoundingBoxmyAssignedBBox
 
UT_Matrix4D myBBoxTransform
 
RE_VertexArraymyColorVA
 
GR_SelectMode mySelectMode
 
GR_SelectMode myPointSelectMode
 
int64 myTopVersion
 
int64 myMatVersion
 
int64 myPrimVersion
 
int64 myPackedPVersion
 
int64 myAlembicVersion
 
GT_DataArrayHandle myPickIDs
 
GT_DataArrayHandle myPrimIDs
 
GT_DataArrayHandle myPointIDs
 
GT_DataArrayHandle myLODMask
 
UT_IntArray myBBoxInstances
 
UT_IntArray myPointInstances
 
RE_VertexArrayRef myCenterPointP
 
RE_VertexArrayRef myCenterPointInstMat
 
RE_VertexArrayRef myCenterPrimP
 
RE_VertexArrayRef myCenterPrimInstMat
 
RE_VertexArraymySelectionVA
 
bool myPrimSwappedFlag
 
bool myPrimTypeChanged
 
int64 myPrimUniqueID
 
GR_MaterialGroups myMatGroups
 
UT_Map< int, UT_IntArraymyMaterialGroups
 
bool myIsVisible
 
bool myPrimVisible
 
bool myQueuedDrawValid
 
bool myIsConsolidatedMesh
 
int myQueuedBBoxID
 
UT_BoundingBoxD myCachedBBox
 
bool myCachedBBoxValid
 
UT_StringArray myLightLinks
 
UT_StringMap< intmyLightLinkMap
 
bool myHasLightLink
 
UT_StringArray myShadowMasks
 
UT_StringMap< intmyShadowMaskMap
 
bool myHasShadowMask
 
GA_Index myPrimID
 
GA_Index myOverridePointID
 
GA_Index myOverridePrimID
 
int myPrimIndex
 
- Protected Attributes inherited from GR_Primitive
bool myHasDetailPointNormal
 
bool mySupportsDynamicCulling
 
GR_DecorationRendermyDecorRender
 
const GR_RenderInfomyInfo
 
UT_BoundingBoxF myBBox
 
UT_Matrix4D myLocal
 
int myQueuedDrawID
 
int myQueuedPointID
 

Detailed Description

Definition at line 15 of file GR_PrimInstance.h.

Constructor & Destructor Documentation

GR_PrimInstance::GR_PrimInstance ( const GR_RenderInfo info,
const char *  cache_name,
const GT_PrimitiveHandle instance_prim,
const GT_PrimitiveHandle instancer,
const UT_Matrix4DArray instance_transforms,
const GU_ConstDetailHandle instance_gdp,
int  nest_level,
int  prim_index = -1,
const UT_BoundingBox bbox = nullptr 
)
GR_PrimInstance::~GR_PrimInstance ( )
override

Member Function Documentation

void GR_PrimInstance::checkForDeferredDraw ( const RE_Render 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 
)
overridevirtual

Reimplemented from GR_Primitive.

const char* GR_PrimInstance::className ( ) const
inlineoverridevirtual

Return a string version of this class's name.

Implements GR_Primitive.

Definition at line 29 of file GR_PrimInstance.h.

GR_BasePrimType GR_PrimInstance::getBasePrimType ( ) const
inlineoverridevirtual

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

Reimplemented from GR_Primitive.

Definition at line 31 of file GR_PrimInstance.h.

exint GR_PrimInstance::getNumGLPrimitives ( const GR_DisplayOption )
overridevirtual

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

Reimplemented from GR_Primitive.

int GR_PrimInstance::getNumTopTransforms ( ) const
inline

Definition at line 91 of file GR_PrimInstance.h.

int GR_PrimInstance::getNumTransforms ( ) const
inline

Definition at line 97 of file GR_PrimInstance.h.

bool GR_PrimInstance::getSingleTransform ( UT_Matrix4D mat) const
inlineoverridevirtual

Reimplemented from GR_PrimPacked.

Definition at line 81 of file GR_PrimInstance.h.

bool GR_PrimInstance::inViewFrustum ( const UT_Matrix4D objviewproj,
const UT_BoundingBoxD bbox = nullptr 
)
overridevirtual

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 from GR_Primitive.

void GR_PrimInstance::render ( RE_Render r,
GR_RenderMode  render_mode,
GR_RenderFlags  flags,
GR_DrawParms  dp 
)
overridevirtual

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.

Implements GR_Primitive.

void GR_PrimInstance::setInstancer ( const GT_PrimitiveHandle ph)
void GR_PrimInstance::setNestLevel ( int  nest_level)
inline

Definition at line 36 of file GR_PrimInstance.h.

void GR_PrimInstance::setTopTransforms ( const UT_Matrix4DArray top_xforms)
inline

Definition at line 45 of file GR_PrimInstance.h.

void GR_PrimInstance::setTransforms ( const UT_Matrix4DArray inst_transforms)
void GR_PrimInstance::update ( RE_Render r,
const GT_PrimitiveHandle primh,
const GR_UpdateParms p 
)
overridevirtual

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)

Implements GR_Primitive.

bool GR_PrimInstance::updateOnViewChange ( const GR_DisplayOption ) const
inlineoverridevirtual

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

Reimplemented from GR_Primitive.

Definition at line 48 of file GR_PrimInstance.h.

void GR_PrimInstance::viewUpdate ( RE_Render r,
const GR_ViewUpdateParms parms 
)
overridevirtual

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

Reimplemented from GR_Primitive.


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