11 #ifndef GUI_GeoRender_h
12 #define GUI_GeoRender_h
69 class gui_CollectionPrim;
74 class gui_HookedPrims;
77 class gui_RenderHookEntry;
78 class gui_UpdateResults;
79 class GUI_ObjectMaterialCache;
93 virtual const char *
className()
const {
return "GUI_GeoRender"; }
97 void setGeometry(
OP_Node *node);
101 void setGeoName(
const char *name);
103 void setInstanceName(
const char *name);
135 {
return myDetailTransforms.entries(); }
137 { myDetailFullTransform = xform; }
139 {
return myDetailFullTransform; }
144 { myInstancerTransform = xform;
145 myInstancerIdentityFlag = xform.
isIdentity(); }
147 { myInstancerTransform.identity();
148 myInstancerIdentityFlag =
true; }
150 {
return myInstancerTransform; }
161 int use_vertex)
const;
170 static void setWorldToScreen(
const UT_Matrix4R &xform);
173 void setIsInstancedGeo(
bool instanced);
174 bool addInstanceTransform(
const UT_DMatrix4 &xform,
176 void clearInstanceTransforms();
178 int64 getInstanceVersion()
const;
198 const char *view_name,
209 const char *view_name,
212 virtual bool hasParallelUpdate()
const;
223 {
return myMaterialTexturePending; }
225 void addMaterialReference(
OP_Node *mat_node);
226 void removeMaterialReference(
OP_Node *mat_node);
227 void clearMaterialReferences();
237 bool isLit()
const {
return myLitFlag; }
262 { myNeedsDeferredPass = need;}
276 {
return myMaterialHasReflection; }
279 { myInfo.myObjectGhosted = ghost; }
281 { myInfo.myObjectSelection = obj_selection; }
283 { myInfo.myCanRenderUV = uv_render; }
286 return myInfo.myCanRenderUV;
289 bool getComponentSelection(
316 fpreal ghost_amount = 0.5);
344 {
return myPrimDecorMask; }
350 virtual void decorationRender(
355 bool override_dispopt,
367 bool canBeSelected(
OP_Node *op,
376 bool canBeSelectedWhenNotUsingOps(
380 bool pick_ghost)
const;
392 unsigned int primmask,
399 const char *
name()
const {
return myCacheName; }
404 void cleanupLighting();
406 static void resetStats();
407 static void getStats(
int &num_objs,
413 void useObjectMaterials(
bool use_obj_mat);
429 return isBBoxShadingMode(getDisplayOptionSet(opt));
447 {
return myVisUpdateTime; }
450 {
return myVisRefineTime; }
457 { myVisRefineTime = myVisUpdateTime =
461 {
return myUpdateVisualizers.find(vis_id) >= 0; }
464 {
return myRefineVisualizers.find(vis_id) >= 0; }
470 {
return myUpdateVisualizers; }
473 {
return myRefineVisualizers; }
476 { myUpdateVisualizers = getActiveVisualizers(); }
479 { myUpdateVisualizers.clear(); }
482 { myRefineVisualizers = getActiveVisualizers(); }
485 { myRefineVisualizers.clear(); }
487 void runCreatorVisualizers(
int &listcount,
505 bool use_hidden_grp);
510 static int getPolygonMeshLimit();
511 static int getPointMeshLimit();
513 static void handleMaterialChange(
OP_Node *
src,
void *dest,
520 {
return myMaterialUseOverrides; }
523 { myMaterialLimitExceeded = e; }
526 void invalidateGeo();
531 { myDataIds.clear(); }
535 static void cleanupShaders();
541 {
return (myMatOpChanges.size()!=0); }
549 myLocalBBox.makeInvalid();
550 myWorldBBox.makeInvalid();
551 myLook->invalidateBBox();
558 virtual bool shouldRender(
const GU_Detail *geo)
const;
561 {
return myPrimitives.entries(); }
598 bool outline=
true) {};
609 bool &has_edges)
const;
611 bool &has_edges)
const;
629 bool &needs_alpha_pass);
658 const char *view_name,
669 const char *view_name,
687 bool apply_filter_vis,
699 void clearUnusedAlembicArchives();
723 bool processing_geo_prims,
724 bool apply_filter_vis,
736 bool processing_geo_prims,
740 void resetPrimClassify();
748 const char *view_name);
750 bool buildInstanceSelection(
bool has_sel_overrides);
760 bool include_selection);
763 { mySelectionId =
id; mySelectionRevision =
version; }
775 gui_RenderHookEntry *&prev,
777 bool processing_geo_prims,
783 void restartCollectionPrimitives();
784 void removeUnusedCollectionPrimitives();
786 void find3DBoundaries(
const GU_Detail *geo,
789 void findUVBoundaries(
const GU_Detail *geo,
812 bool view_3d,
bool vert_uv);
831 void resizePrimArray(
exint nprims,
bool clear =
false);
835 void updateWorldTransform();
876 bool shouldUVRender(
const GU_Detail *geo,
878 bool is_vertex)
const;
897 bool checkAutoVertexNormal(
const GU_Detail *dtl,
900 bool inPackedPrim()
const
901 {
return myPackedPrimLevel > 0; }
902 bool inInstancePrim()
const
903 {
return myInstancePrim.entries() > 0; }
904 void updateInstanceEntry(gr_PrimEntry *entry,
918 bool use_fraction_parm);
930 void clearMaterialInterests();
939 bool myObjectMaterialDirty;
945 bool myUseObjectMaterial;
953 bool myHasGLStateCheckPrims;
955 bool myShadeOpenCurvesFlag;
956 bool myShadeOpenCurvesFlagSet;
957 bool myHasGuideParts;
958 bool myHasPackedPrims;
959 bool myHasPackedFragments;
960 bool myHasPackedInstances;
961 bool myWireframeFlag;
962 bool myForceShadedFlag;
964 bool myRecordingTime;
967 bool myHasAgentPrims;
968 bool myAgentLastLODEnable;
969 int myAgentLastMinPoints;
970 int myAgentLastMaxLOD;
972 bool myHasCharacterScenePrim;
981 int myDrawTimeWaiting;
987 int64 myTopologyVersion;
988 int myCachedShowSelect;
989 int64 myPrimitiveVersion;
992 exint mySelectionRevision;
994 bool myNeedsDeferredPass;
995 bool myNeedsParallelPass;
1007 bool operator==(
const DataIdsCache &rhs)
const
1009 return myDataIdsCount==rhs.myDataIdsCount &&
1010 myDataIdsSum==rhs.myDataIdsSum;
1022 myDataIdsSum += (
exint)
id;
1025 void getDataIdsExcept_p_transform(
const GA_Detail *gdp);
1028 exint myDataIdsCount;
1031 DataIdsCache myDataIds;
1032 DataIdsCache myDataIdsCache;
1038 int myDispOptSerial;
1040 bool myPolygonConvexQuality;
1041 bool myVertexNormalEnable;
1042 fpreal myVertexNormalCuspAngle;
1044 bool myShowAllPoints;
1050 bool myObjectDisplayAsSubdiv;
1056 bool myDetailTransformIdentity;
1059 bool myInstancerIdentityFlag;
1063 int64 myCachedInstanceVersion;
1064 int myRefineVersion;
1065 bool myObjectTransformDirty;
1066 bool myNeedsAlphaPassFlag;
1067 bool myPrimAlphaPassFlag;
1069 bool myRefineOnLODChange;
1070 int mySelectionInstance;
1071 fpreal myLimitedInstanceFraction;
1072 bool myShowMaterials;
1073 int myFactoryMaterialOverrideId = -1;
1077 bool myHasInstanceSelection;
1084 gui_Instance() { myBBox.makeInvalid(); }
1098 gui_DiskFile() : myPrimIndex(0) {}
1104 int myPackedPrimLevel;
1106 mutable bool myCachedUseSampleMask;
1107 mutable int myCachedSampleMask;
1108 mutable bool myCachedMultisample;
1109 mutable bool myCachedSampleCoverage;
1114 fpreal myCubeInstanceFraction;
1119 exint myVisUpdateTime;
1120 exint myVisRefineTime;
1126 bool myRefineOnUpdate;
1127 unsigned myMaterialTextureFlag :1,
1128 myMaterialTexturePending :1,
1129 myMaterialHasDisplaceMap :1,
1130 myMaterialHasReflection :1,
1131 myMaterialUseOverrides :1,
1132 myMaterialTexCacheUpdate : 1,
1133 myHasTimeDepMaterials :1,
1140 int myMaterialLimit;
1141 bool myMaterialLimitExceeded;
1142 int myObjMaterialID;
1148 int64 myBaseMaterialPrevID;
1149 int64 myBaseMaterialRemapPrevID;
1150 bool myForceMaterialUpdate;
1151 bool myMaterialAllowUpdates;
1156 class gui_DetailAttribLists
1159 bool checkForAttribListChanges(
const GU_Detail &dtl);
1169 gui_DetailAttribLists myDetailAttribLists;
1176 } myHedgeInterface[2];
1179 int myPrimClassifierDetailId;
1180 int64 myPrimClassifierCacheVersion;
1181 int64 myPrimClassifierTopVersion;
1182 int64 myPrimClassifierSelectId;
1183 int64 myPrimClassifierSelectRevision;
1188 int myCachedGroupDetailId;
1189 int64 myCachedGroupCacheVersion;
1190 int64 myCachedGroupTopVersion;
1192 int64 myCachedHidden3DVersion;
1194 fpreal myDisplacementValue = -1.0;
1195 bool myDisplacementChanged =
false;
1215 friend class gr_PrimEntry;
1233 return myDetailTransforms(index);
1239 return myDetailInvTransforms(index);
void setPostPassID(int id)
GR_MaterialAtlas myVulkanMaterials
UT_Map< UT_StringRef, int > myPrevAttributes
void setDetailFullTransform(const UT_DMatrix4 &xform)
int getNumPrimitives() const
gui_BoundaryData my3DBoundary
void clearUpdateVisualizers()
GR_MaterialAtlas * materials()
UT_StringMap< gui_BoundaryData > myUVBoundary
virtual void simpleBBoxRender(RE_RenderContext r, GUI_DisplayOption &opt, RE_Shader *shader=0, bool fill=true, bool outline=true)
void refreshVisRefineTime()
gui_BoundaryData myEdgeSelection
GA_API const UT_StringHolder uv
GT_API const UT_StringHolder time
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
static UT_Lock theShaderLock
bool isBBoxShadingMode(GUI_DisplayOption &opt) const
bool isDeferredPass() const
GUI_DisplaySetType
Context specific display options for geometry states.
Temporary container for either a RV_Render and an RE_Render.
int getNumDetailTransforms() const
std::optional< T > UT_Optional
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
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_UniquePtr< gui_UpdateResults > myUpdateResults
UT_SharedPtr< RE_Geometry > my2DGeoV
GUI_ObjectMaterialCache * myObjectMaterialCache
UT_SharedPtr< RE_Geometry > myGeoV
UT_SharedPtr< GA_PrimitiveGroup > myEdgePrims
GR_LightList * myLightList
bool isBBoxShadingMode(const GR_DisplayOption *opt) const
GLuint const GLchar * name
void clearRefineVisualizers()
void setInstancerTransform(const UT_DMatrix4 &xform)
const UT_DMatrix4 & getDetailInvTransform(int index) const
virtual void simpleRender(RE_RenderContext r, GUI_DisplayOption &opt, const GU_Detail *geo, GR_RenderMode mode, GR_RenderFlags flags)
The base class for all GT primitive types.
bool needsAlphaPass() const
Handle to the main interface of Vulkan.
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()
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
GR_API void setupGhosting(RE_RenderContext r, int opaque_data[3], fpreal transparency=0.25f)
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
GR_API void cleanupGhosting(RE_RenderContext r, int opaque_data[3])
virtual void solidRender(RE_RenderContext r, GUI_DisplayOption &disp_opt, const GU_Detail *geo, GR_RenderMode mode, GR_RenderFlags flags, GR_AlphaPass pass)
bool myCheckUpdateViewFlag
Container class for all geometry.
bool isMSSPackedEnabled() const
bool needsParallelPass() const
void setCanRenderUV(int uv_render)
fpreal getDrawTime() const
Simple class for a mutli-integer cache tag.
virtual bool isObjectRender() const
bool hasMaterialOpChanges() const
virtual void cleanupMaterials()
const UT_IntArray & getActiveVisualizers() const
UT_StringMap< bool > myUVAttribIsVertex
static int theNumVertices
const UT_IntArray & getActiveVisualizers() const
const char * getCacheName() const
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