11 #ifndef GUI_GeoRender_h
12 #define GUI_GeoRender_h
74 class gui_CollectionPrim;
77 class GT_PrimCharacterScene;
80 class gui_HookedPrims;
83 class gui_RenderHookEntry;
84 class gui_UpdateResults;
85 class GUI_ObjectMaterialCache;
99 virtual const char *
className()
const {
return "GUI_GeoRender"; }
103 void setGeometry(
OP_Node *node);
107 void setGeoName(
const char *name);
109 void setInstanceName(
const char *name);
141 {
return myDetailTransforms.entries(); }
143 { myDetailFullTransform = xform; }
145 {
return myDetailFullTransform; }
150 { myInstancerTransform = xform;
151 myInstancerIdentityFlag = xform.
isIdentity(); }
153 { myInstancerTransform.identity();
154 myInstancerIdentityFlag =
true; }
156 {
return myInstancerTransform; }
167 int use_vertex)
const;
176 static void setWorldToScreen(
const UT_Matrix4R &xform);
179 void setIsInstancedGeo(
bool instanced);
180 bool addInstanceTransform(
const UT_DMatrix4 &xform,
182 void clearInstanceTransforms();
184 int64 getInstanceVersion()
const;
187 void gpuMemoryUsage(
exint &used_bytes,
189 exint &pinned_bytes);
209 const char *view_name,
220 const char *view_name,
223 virtual bool hasParallelUpdate()
const;
234 {
return myMaterialTexturePending; }
236 void addMaterialReference(
OP_Node *mat_node);
237 void removeMaterialReference(
OP_Node *mat_node);
238 void clearMaterialReferences();
248 bool isLit()
const {
return myLitFlag; }
273 { myNeedsDeferredPass = need;}
287 {
return myMaterialHasReflection; }
290 { myInfo.myObjectGhosted = ghost; }
292 { myInfo.myObjectSelection = obj_selection; }
294 { myInfo.myCanRenderUV = uv_render; }
297 return myInfo.myCanRenderUV;
300 bool getComponentSelection(
327 fpreal ghost_amount = 0.5);
355 {
return myPrimDecorMask; }
361 virtual void decorationRender(
366 bool override_dispopt,
387 bool canBeSelectedWhenNotUsingOps(
391 bool pick_ghost)
const;
403 unsigned int primmask,
410 const char *
name()
const {
return myCacheName; }
415 void cleanupLighting();
417 static void resetStats();
418 static void getStats(
int &num_objs,
424 void useObjectMaterials(
bool use_obj_mat);
440 return isBBoxShadingMode(getDisplayOptionSet(opt));
458 {
return myVisUpdateTime; }
461 {
return myVisRefineTime; }
468 { myVisRefineTime = myVisUpdateTime =
472 {
return myUpdateVisualizers.find(vis_id) >= 0; }
475 {
return myRefineVisualizers.find(vis_id) >= 0; }
481 {
return myUpdateVisualizers; }
484 {
return myRefineVisualizers; }
487 { myUpdateVisualizers = getActiveVisualizers(); }
490 { myUpdateVisualizers.clear(); }
493 { myRefineVisualizers = getActiveVisualizers(); }
496 { myRefineVisualizers.clear(); }
498 void runCreatorVisualizers(
int &listcount,
516 bool use_hidden_grp);
524 static void handleMaterialChange(
OP_Node *
src,
void *dest,
531 {
return myMaterialUseOverrides; }
534 { myMaterialLimitExceeded = e; }
536 { myHasTimeDepMaterials = d; }
538 {
return myHasTimeDepMaterials; }
541 void invalidateGeo();
546 { myDataIds.clear(); }
556 {
return (myMatOpChanges.size()!=0); }
569 myLocalBBox.makeInvalid();
570 myWorldBBox.makeInvalid();
571 myLook->invalidateBBox();
578 virtual bool shouldRender(
const GU_Detail *geo)
const;
581 {
return myPrimitives.entries(); }
618 bool outline=
true) {};
629 bool &has_edges)
const;
631 bool &has_edges)
const;
649 bool &needs_alpha_pass);
672 bool *old_poly_offset);
685 const char *view_name,
696 const char *view_name,
714 bool apply_filter_vis,
726 void clearUnusedAlembicArchives();
750 bool processing_geo_prims,
751 bool apply_filter_vis,
763 bool processing_geo_prims,
767 void resetPrimClassify();
775 const char *view_name);
777 bool buildInstanceSelection(
bool has_sel_overrides);
787 bool include_selection);
790 { mySelectionId =
id; mySelectionRevision =
version; }
802 gui_RenderHookEntry *&prev,
804 bool processing_geo_prims,
810 void restartCollectionPrimitives();
811 void removeUnusedCollectionPrimitives();
813 void find3DBoundaries(
const GU_Detail *geo,
816 void findUVBoundaries(
const GU_Detail *geo,
839 bool view_3d,
bool vert_uv);
858 void resizePrimArray(
exint nprims,
bool clear =
false);
862 void updateWorldTransform();
908 bool shouldUVRender(
const GU_Detail *geo,
910 bool is_vertex)
const;
929 bool checkAutoVertexNormal(
const GU_Detail *dtl,
932 bool inPackedPrim()
const
933 {
return myPackedPrimLevel > 0; }
934 bool inInstancePrim()
const
935 {
return myInstancePrim.entries() > 0; }
936 void updateInstanceEntry(gr_PrimEntry *entry,
950 bool use_fraction_parm);
958 bool set_shader =
false,
959 bool is_matte =
false,
967 void clearMaterialInterests();
976 bool myObjectMaterialDirty;
982 bool myUseObjectMaterial;
990 bool myHasGLStateCheckPrims;
992 bool myShadeOpenCurvesFlag;
993 bool myShadeOpenCurvesFlagSet;
994 bool myHasGuideParts;
995 bool myHasPackedPrims;
996 bool myHasPackedFragments;
997 bool myHasPackedInstances;
998 bool myWireframeFlag;
999 bool myForceShadedFlag;
1001 bool myRecordingTime;
1003 bool myIsSubD =
false;
1005 bool myHasAgentPrims;
1006 bool myAgentLastLODEnable;
1007 int myAgentLastMinPoints;
1008 int myAgentLastMaxLOD;
1019 int myDrawTimeWaiting;
1025 int64 myTopologyVersion;
1026 int myCachedShowSelect;
1027 int64 myPrimitiveVersion;
1029 exint mySelectionId;
1030 exint mySelectionRevision;
1032 bool myNeedsDeferredPass;
1033 bool myNeedsParallelPass;
1045 bool operator==(
const DataIdsCache &rhs)
const
1047 return myDataIdsCount==rhs.myDataIdsCount &&
1048 myDataIdsSum==rhs.myDataIdsSum;
1060 myDataIdsSum += (
exint)
id;
1063 void getDataIdsExcept_p_transform(
const GA_Detail *gdp);
1066 exint myDataIdsCount;
1069 DataIdsCache myDataIds;
1070 DataIdsCache myDataIdsCache;
1076 int myDispOptSerial;
1078 bool myPolygonConvexQuality;
1079 bool myVertexNormalEnable;
1080 fpreal myVertexNormalCuspAngle;
1082 bool myShowAllPoints;
1088 bool myObjectDisplayAsSubdiv;
1094 bool myDetailTransformIdentity;
1097 bool myInstancerIdentityFlag;
1101 int64 myCachedInstanceVersion;
1102 int myRefineVersion;
1103 bool myObjectTransformDirty;
1104 bool myNeedsAlphaPassFlag;
1105 bool myPrimAlphaPassFlag;
1107 bool myRefineOnLODChange;
1108 int mySelectionInstance;
1109 fpreal myLimitedInstanceFraction;
1110 bool myShowMaterials;
1111 int myFactoryMaterialOverrideId = -1;
1115 bool myHasInstanceSelection;
1122 gui_Instance() { myBBox.makeInvalid(); }
1136 gui_DiskFile() : myPrimIndex(0) {}
1142 int myPackedPrimLevel;
1144 mutable bool myCachedUseSampleMask;
1145 mutable int myCachedSampleMask;
1146 mutable bool myCachedMultisample;
1147 mutable bool myCachedSampleCoverage;
1152 fpreal myCubeInstanceFraction;
1157 exint myVisUpdateTime;
1158 exint myVisRefineTime;
1164 bool myRefineOnUpdate;
1165 unsigned myMaterialTextureFlag :1,
1166 myMaterialTexturePending :1,
1167 myMaterialHasDisplaceMap :1,
1168 myMaterialHasReflection :1,
1169 myMaterialUseOverrides :1,
1170 myMaterialTexCacheUpdate : 1,
1171 myHasTimeDepMaterials :1,
1172 myHasOpDepMaterials :1,
1179 int myMaterialLimit;
1180 bool myMaterialLimitExceeded;
1181 int myObjMaterialID;
1187 int64 myBaseMaterialPrevID;
1188 int64 myBaseMaterialRemapPrevID;
1189 bool myForceMaterialUpdate;
1190 bool myMaterialAllowUpdates;
1195 class gui_DetailAttribLists
1198 bool checkForAttribListChanges(
const GU_Detail &dtl);
1208 gui_DetailAttribLists myDetailAttribLists;
1215 } myHedgeInterface[2];
1218 int myPrimClassifierDetailId;
1219 int64 myPrimClassifierCacheVersion;
1220 int64 myPrimClassifierTopVersion;
1221 int64 myPrimClassifierSelectId;
1222 int64 myPrimClassifierSelectRevision;
1227 int myCachedGroupDetailId;
1228 int64 myCachedGroupCacheVersion;
1229 int64 myCachedGroupTopVersion;
1231 int64 myCachedHidden3DVersion;
1233 fpreal myDisplacementValue = -1.0;
1234 bool myDisplacementChanged =
false;
1254 friend class gr_PrimEntry;
1272 return myDetailTransforms(index);
1278 return myDetailInvTransforms(index);
A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)
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)
Object that represents drawable geometry. This object holds vertex, instancing and index buffers for ...
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)
GLint GLint GLsizei GLint GLenum GLenum type
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
RV_API void cleanupShaders()
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
FS_API bool cleanup(UT_StringArray &removed, UT_StringArray &error_files, exint &memory_freed, bool dry_run, const char *override_path=nullptr)
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
RV_API bool initShaders(RV_Instance *inst)
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()
void setHasTimeDependentMaterials(bool d)
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
bool hasTimeDependentMaterials() 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