11 #ifndef GUI_GeoRender_h
12 #define GUI_GeoRender_h
65 class gui_CollectionPrim;
70 class gui_HookedPrims;
73 class gui_RenderHookEntry;
74 class GUI_ObjectMaterialCache;
87 virtual const char *
className()
const {
return "GUI_GeoRender"; }
91 void setGeometry(
OP_Node *node);
95 void setGeoName(
const char *name);
97 void setInstanceName(
const char *name);
129 {
return myDetailTransforms.entries(); }
131 { myDetailFullTransform = xform; }
133 {
return myDetailFullTransform; }
138 { myInstancerTransform = xform;
139 myInstancerIdentityFlag = xform.
isIdentity(); }
141 { myInstancerTransform.identity();
142 myInstancerIdentityFlag =
true; }
144 {
return myInstancerTransform; }
155 int use_vertex)
const;
164 static void setWorldToScreen(
const UT_Matrix4R &xform);
167 void setIsInstancedGeo(
bool instanced);
168 bool addInstanceTransform(
const UT_DMatrix4 &xform,
170 void clearInstanceTransforms();
172 int64 getInstanceVersion()
const;
192 const char *view_name,
202 {
return myMaterialTexturePending; }
212 bool isLit()
const {
return myLitFlag; }
233 { myNeedsDeferredPass = need;}
244 {
return myMaterialHasReflection; }
247 { myInfo.myObjectGhosted = ghost; }
249 { myInfo.myObjectSelection = obj_selection; }
251 { myInfo.myCanRenderUV = uv_render; }
254 return myInfo.myCanRenderUV;
257 bool getComponentSelection(
284 fpreal ghost_amount = 0.5);
312 {
return myPrimDecorMask; }
316 virtual void setupDecorationsRender(
RE_Render *
r);
322 bool override_dispopt,
325 virtual void customDecorationRender(
RE_Render *
r,
334 bool canBeSelected(
OP_Node *op,
343 bool canBeSelectedWhenNotUsingOps(
347 bool pick_ghost)
const;
359 unsigned int primmask,
366 const char *
name()
const {
return myCacheName; }
371 void cleanupLighting();
373 static void resetStats();
374 static void getStats(
int &num_objs,
380 static void setDefaultMaterialParms(
UT_Color diff,
387 void useObjectMaterials(
bool use_obj_mat);
402 return isBboxShadingMode(getDisplayOptionSet(opt));
419 {
return myVisUpdateTime; }
422 {
return myVisRefineTime; }
429 { myVisRefineTime = myVisUpdateTime =
433 {
return myUpdateVisualizers.find(vis_id) >= 0; }
436 {
return myRefineVisualizers.find(vis_id) >= 0; }
442 {
return myUpdateVisualizers; }
445 {
return myRefineVisualizers; }
448 { myUpdateVisualizers = getActiveVisualizers(); }
451 { myUpdateVisualizers.clear(); }
454 { myRefineVisualizers = getActiveVisualizers(); }
457 { myRefineVisualizers.clear(); }
459 void runCreatorVisualizers(
int &listcount,
477 bool use_hidden_grp);
482 static int getPolygonMeshLimit();
483 static int getPointMeshLimit();
485 static void handleMaterialChange(
OP_Node *
src,
void *dest,
492 {
return myMaterialUseOverrides; }
495 { myMaterialLimitExceeded = e; }
498 void invalidateGeo();
503 { myDataIds.clear(); }
510 const char *view_name,
518 myLocalBBox.makeInvalid();
519 myWorldBBox.makeInvalid();
520 myLook->invalidateBBox();
527 virtual bool shouldRender(
const GU_Detail *geo)
const;
530 {
return myPrimitives.entries(); }
567 bool outline=
true) {};
578 bool &has_edges)
const;
580 bool &has_edges)
const;
598 bool &needs_alpha_pass);
618 const char *view_name,
636 bool apply_filter_vis,
648 void clearUnusedAlembicArchives();
672 bool processing_geo_prims,
673 bool apply_filter_vis,
685 bool processing_geo_prims,
689 void resetPrimClassify();
697 const char *view_name);
699 bool buildInstanceSelection(
bool has_sel_overrides);
709 bool include_selection);
712 { mySelectionId =
id; mySelectionRevision =
version; }
724 gui_RenderHookEntry *&prev,
726 bool processing_geo_prims,
732 void restartCollectionPrimitives();
733 void removeUnusedCollectionPrimitives();
735 void find3DBoundaries(
const GU_Detail *geo,
738 void findUVBoundaries(
const GU_Detail *geo,
761 bool view_3d,
bool vert_uv);
780 void resizePrimArray(
exint nprims,
bool clear =
false);
784 void updateWorldTransform();
819 bool shouldUVRender(
const GU_Detail *geo,
821 bool is_vertex)
const;
839 bool checkAutoVertexNormal(
const GU_Detail *dtl,
841 bool checkAutoMikkT(
const GU_Detail *dtl);
843 bool inPackedPrim()
const
844 {
return myPackedPrimLevel > 0; }
845 bool inInstancePrim()
const
846 {
return myInstancePrim.entries() > 0; }
847 void updateInstanceEntry(gr_PrimEntry *entry,
861 bool use_fraction_parm);
873 void clearMaterialInterests();
882 bool myObjectMaterialDirty;
888 bool myUseObjectMaterial;
896 bool myHasGLStateCheckPrims;
898 bool myHasGuideParts;
899 bool myHasPackedPrims;
900 bool myHasPackedFragments;
901 bool myHasPackedInstances;
902 bool myWireframeFlag;
903 bool myForceShadedFlag;
905 bool myRecordingTime;
908 bool myHasAgentPrims;
909 bool myAgentLastLODEnable;
910 int myAgentLastMinPoints;
911 int myAgentLastMaxLOD;
919 int myDrawTimeWaiting;
925 int64 myTopologyVersion;
926 int myCachedShowSelect;
927 int64 myPrimitiveVersion;
930 exint mySelectionRevision;
932 bool myNeedsDeferredPass;
944 bool operator==(
const DataIdsCache &rhs)
const
946 return myDataIdsCount==rhs.myDataIdsCount &&
947 myDataIdsSum==rhs.myDataIdsSum;
959 myDataIdsSum += (
exint)
id;
962 void getDataIdsExcept_p_transform(
const GA_Detail *gdp);
965 exint myDataIdsCount;
968 DataIdsCache myDataIds;
969 DataIdsCache myDataIdsCache;
977 bool myPolygonConvexQuality;
978 bool myVertexNormalEnable;
979 fpreal myVertexNormalCuspAngle;
983 bool myShowAllPoints;
989 bool myObjectDisplayAsSubdiv;
995 bool myDetailTransformIdentity;
998 bool myInstancerIdentityFlag;
1002 int64 myCachedInstanceVersion;
1003 int myRefineVersion;
1004 bool myCheckUpdateViewFlag;
1005 bool myObjectTransformDirty;
1006 bool myNeedsAlphaPassFlag;
1007 bool myPrimAlphaPassFlag;
1009 bool myRefineOnLODChange;
1010 int mySelectionInstance;
1011 fpreal myLimitedInstanceFraction;
1012 bool myShowMaterials;
1016 bool myHasInstanceSelection;
1023 gui_Instance() { myBBox.makeInvalid(); }
1037 gui_DiskFile() : myPrimIndex(0) {}
1043 int myPackedPrimLevel;
1045 mutable bool myCachedUseSampleMask;
1046 mutable int myCachedSampleMask;
1047 mutable bool myCachedMultisample;
1048 mutable bool myCachedSampleCoverage;
1053 fpreal myCubeInstanceFraction;
1058 exint myVisUpdateTime;
1059 exint myVisRefineTime;
1065 bool myRefineOnUpdate;
1066 unsigned myMaterialTextureFlag :1,
1067 myMaterialTexturePending :1,
1068 myMaterialHasDisplaceMap :1,
1069 myMaterialHasReflection :1,
1070 myMaterialUseOverrides :1,
1077 int myMaterialLimit;
1078 bool myMaterialLimitExceeded;
1079 int myObjMaterialID;
1080 int myDefaultMatSerial;
1085 int64 myBaseMaterialPrevID;
1086 int64 myBaseMaterialRemapPrevID;
1087 bool myDefaultMaterialLazyMode;
1088 bool myForceMaterialUpdate;
1089 bool myMaterialAllowUpdates;
1091 class gui_DetailAttribLists
1094 bool checkForAttribListChanges(
const GU_Detail &dtl);
1104 gui_DetailAttribLists myDetailAttribLists;
1111 } myHedgeInterface[2];
1114 int myPrimClassifierDetailId;
1115 int64 myPrimClassifierCacheVersion;
1116 int64 myPrimClassifierTopVersion;
1117 int64 myPrimClassifierSelectId;
1118 int64 myPrimClassifierSelectRevision;
1123 int myCachedGroupDetailId;
1124 int64 myCachedGroupCacheVersion;
1125 int64 myCachedGroupTopVersion;
1127 int64 myCachedHidden3DVersion;
1146 friend class gr_PrimEntry;
1164 return myDetailTransforms(index);
1170 return myDetailInvTransforms(index);
virtual void simpleBboxRender(RE_Render *r, GUI_DisplayOption &opt, RE_Shader *shader=0, bool fill=true, bool outline=true)
void setPostPassID(int id)
void setDetailFullTransform(const UT_DMatrix4 &xform)
int getNumPrimitives() const
gui_BoundaryData my3DBoundary
void clearUpdateVisualizers()
RE_LightList * myLightList
UT_StringMap< gui_BoundaryData > myUVBoundary
void refreshVisRefineTime()
gui_BoundaryData myEdgeSelection
GA_API const UT_StringHolder uv
GT_API const UT_StringHolder time
virtual void solidRender(RE_Render *r, GUI_DisplayOption &disp_opt, const GU_Detail *geo, GR_RenderMode mode, GR_RenderFlags flags, GR_AlphaPass pass)
void shadingMode(GR_ShadingMode shading_mode)
void setNameIndex(int idx)
GA_API const UT_StringHolder rot
int getObjectMaterialID() const
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
fpreal getSetupTime() const
GT_API const UT_StringHolder cache_name
void setGhosted(bool ghost)
const UT_DMatrix4 & getDetailTransform(int index) const
bool forceWireframe() const
bool hasUpdateVisualizer(int vis_id) const
GLuint const GLchar * name
static UT_Lock theShaderLock
bool isDeferredPass() const
GUI_DisplaySetType
Context specific display options for geometry states.
virtual void simpleRender(RE_Render *r, GUI_DisplayOption &opt, const GU_Detail *geo, GR_RenderMode mode, GR_RenderFlags flags)
int getNumDetailTransforms() const
const GU_Detail * myLockedDetail
const UT_IntArray & getUpdateVisualizers() const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
const UT_IntArray & getRefineVisualizers() const
bool needsDeferredPass() const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void setNeedsDeferredPass(bool need)
void refreshUpdateVisualizers()
void setSelection(int64 id, int64 version)
virtual exint bumpClock()=0
UT_SharedPtr< GA_EdgeGroup > myEdges
void setDisplayed(bool is_disp)
UT_SharedPtr< RE_Geometry > my2DGeo
bool isBboxShadingMode(const GR_DisplayOption *opt) const
std::pair< GA_PrimitiveTypeId, GT_PrimitiveType > GUI_PrimTypeKey
RE_MaterialAtlas myMaterialAtlas
void bumpObjectMaterial()
virtual int64 getPrimDecorationMask() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
This class provides a way to manage a reference to an attribute permitting Read-Only access...
UT_SharedPtr< RE_Geometry > my2DGeoV
GUI_ObjectMaterialCache * myObjectMaterialCache
UT_SharedPtr< RE_Geometry > myGeoV
UT_SharedPtr< GA_PrimitiveGroup > myEdgePrims
void clearRefineVisualizers()
void setInstancerTransform(const UT_DMatrix4 &xform)
const UT_DMatrix4 & getDetailInvTransform(int index) const
The base class for all GT primitive types.
bool needsAlphaPass() const
void setInstancerTransformIdentity()
UT_SharedPtr< GU_Selection > GU_SelectionHandle
GUI_DetailLook & look() const
void setShowMaterials(bool show)
void setDeferredPass(bool dpass)
const UT_DMatrix4 & getDetailFullTransform() const
bool isMSSEnabled() const
GT_API const UT_StringHolder version
virtual const char * className() const
void setInstanceVersion(int64 version)
bool hasGuideParts() const
bool showMaterials() const
void refreshRefineVisualizers()
GUI_DisplaySetType getDisplaySetType() const
bool isMSSPerPrimEnabled() const
int getMaterialLimit() const
GR_DisplayOption * getDisplayOptionSet(GUI_DisplayOption &disp_opt)
void refreshVisUpdateTime()
bool isBboxShadingMode(GUI_DisplayOption &opt) const
int getPostPassID() const
UT_UniquePtr< GA_Group > GA_GroupUPtr
int64 myLimitInstanceVersion
bool hasMaterialReflection() const
GA_GroupType
An ordinal enum for the different types of groups in GA.
UT_SharedPtr< RE_Geometry > myGeo
void setMaterialLimitExceeded(bool e)
A specialization of GA_AIFStringTuple to access "shared strings".
void setObjectSelection(int obj_selection)
exint getVisUpdateTime() const
int64 getInstanceVersion() const
const char * name() const
bool hasRefineVisualizer(int vis_id) const
virtual GU_ConstDetailHandle & getDetailHandle()
GR_RenderInfo & getRenderInfo()
exint getVisRefineTime() const
UT_Map< UT_StringRef, int > myAttributes
const UT_DMatrix4 & getInstancerTransform() const
Container class for all geometry.
bool isMSSPackedEnabled() const
void setCanRenderUV(int uv_render)
fpreal getDrawTime() const
Simple class for a mutli-integer cache tag.
virtual bool isObjectRender() const
virtual void cleanupMaterials()
const UT_IntArray & getActiveVisualizers() const
virtual void updateGLSpecific(RE_Render *r, GR_DisplayOption *opts, GUI_SetupResult setup_reason, GR_DecorationOverride selmask_dec, const char *view_name, const GU_Detail *dtl)
UT_StringMap< bool > myUVAttribIsVertex
static int theNumVertices
const UT_IntArray & getActiveVisualizers() const
GR_API void setupGhosting(RE_Render *r, int opaque_data[3], fpreal transparency=0.25f)
const char * getCacheName() const
GR_API void cleanupGhosting(RE_Render *r, int opaque_data[3])
virtual bool isLopRender() const
void needsAlphaPass(bool need)
void setGeoIndex(int idx)
static GUI_VisInterface * getHandler()
Simple interface to building a shader from a .prog file.
bool areOverridesEnabled() const
UT_UniquePtr< GEO_DetachedHedgeInterface > interface
bool hasPendingMaterialTextures() const
const GR_DisplayOption * getDisplayOptionSet(const GUI_DisplayOption &disp_opt) const