File indexing completed on 2025-01-18 10:04:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef OpenGl_Structure_HeaderFile
0017 #define OpenGl_Structure_HeaderFile
0018
0019 #include <Graphic3d_CStructure.hxx>
0020
0021 #include <OpenGl_GraphicDriver.hxx>
0022 #include <OpenGl_Group.hxx>
0023 #include <OpenGl_Workspace.hxx>
0024
0025 #include <NCollection_List.hxx>
0026
0027
0028 DEFINE_STANDARD_HANDLE(OpenGl_Structure, Graphic3d_CStructure)
0029 typedef NCollection_List<const OpenGl_Structure* > OpenGl_ListOfStructure;
0030
0031
0032 class OpenGl_Structure : public Graphic3d_CStructure
0033 {
0034 friend class OpenGl_Group;
0035 DEFINE_STANDARD_RTTIEXT(OpenGl_Structure, Graphic3d_CStructure)
0036 public:
0037
0038
0039 typedef SubclassStructIterator<OpenGl_Structure> StructIterator;
0040
0041
0042 typedef SubclassGroupIterator<OpenGl_Group> GroupIterator;
0043
0044 public:
0045
0046
0047 Standard_EXPORT OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
0048
0049
0050 Standard_EXPORT virtual void OnVisibilityChanged() Standard_OVERRIDE;
0051
0052
0053 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0054
0055
0056 Standard_EXPORT virtual void Connect (Graphic3d_CStructure& theStructure) Standard_OVERRIDE;
0057
0058
0059 Standard_EXPORT virtual void Disconnect (Graphic3d_CStructure& theStructure) Standard_OVERRIDE;
0060
0061
0062 Standard_EXPORT virtual void SetTransformation (const Handle(TopLoc_Datum3D)& theTrsf) Standard_OVERRIDE;
0063
0064
0065 Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers) Standard_OVERRIDE;
0066
0067
0068 Standard_EXPORT virtual void SetZLayer(const Graphic3d_ZLayerId theLayerIndex) Standard_OVERRIDE;
0069
0070
0071
0072 Standard_EXPORT virtual void GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle) Standard_OVERRIDE;
0073
0074
0075 Standard_EXPORT virtual void GraphicUnhighlight() Standard_OVERRIDE;
0076
0077
0078 Standard_EXPORT virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const Standard_OVERRIDE;
0079
0080
0081 Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) Standard_OVERRIDE;
0082
0083
0084 Standard_EXPORT virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) Standard_OVERRIDE;
0085
0086 public:
0087
0088
0089 OpenGl_GraphicDriver* GlDriver() const
0090 {
0091 return (OpenGl_GraphicDriver* )myGraphicDriver.operator->();
0092 }
0093
0094 Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
0095
0096
0097 Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
0098
0099
0100 Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
0101
0102
0103
0104
0105
0106
0107
0108 Standard_EXPORT void ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx);
0109
0110
0111 const OpenGl_Structure* InstancedStructure() const { return myInstancedStructure; }
0112
0113
0114 Standard_Size ModificationState() const { return myModificationState; }
0115
0116
0117 void ResetModificationState() const { myModificationState = 0; }
0118
0119
0120 Standard_Boolean IsRaytracable() const;
0121
0122
0123 Standard_EXPORT virtual void updateLayerTransformation() Standard_OVERRIDE;
0124
0125
0126 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0127
0128 protected:
0129
0130 Standard_EXPORT virtual ~OpenGl_Structure();
0131
0132
0133 void UpdateStateIfRaytracable (const Standard_Boolean toCheck = Standard_True) const;
0134
0135
0136
0137
0138 Standard_EXPORT void renderGeometry (const Handle(OpenGl_Workspace)& theWorkspace,
0139 bool& theHasClosed) const;
0140
0141
0142 Standard_EXPORT void renderBoundingBox(const Handle(OpenGl_Workspace)& theWorkspace) const;
0143
0144
0145
0146
0147
0148
0149
0150 Standard_EXPORT void applyPersistence (const Handle(OpenGl_Context)& theCtx,
0151 const Handle(Graphic3d_TransformPers)& theTrsfPersistence,
0152 const Standard_Boolean theIsLocal,
0153 Standard_Boolean& theOldCastShadows) const;
0154
0155
0156
0157
0158
0159
0160 Standard_EXPORT void revertPersistence (const Handle(OpenGl_Context)& theCtx,
0161 const Handle(Graphic3d_TransformPers)& theTrsfPersistence,
0162 const Standard_Boolean theIsLocal,
0163 const Standard_Boolean theOldCastShadows) const;
0164
0165 protected:
0166
0167 OpenGl_Structure* myInstancedStructure;
0168 Graphic3d_Mat4 myRenderTrsf;
0169
0170 mutable Standard_Boolean myIsRaytracable;
0171 mutable Standard_Size myModificationState;
0172
0173 Standard_Boolean myIsMirrored;
0174
0175 };
0176
0177 #endif