File indexing completed on 2025-01-18 10:04:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _OpenGl_ShadowMap_HeaderFile
0015 #define _OpenGl_ShadowMap_HeaderFile
0016
0017 #include <Graphic3d_Mat4.hxx>
0018 #include <NCollection_Array1.hxx>
0019 #include <OpenGl_NamedResource.hxx>
0020
0021 class gp_XYZ;
0022 class Graphic3d_Camera;
0023 class Graphic3d_CLight;
0024 class Graphic3d_CView;
0025 class OpenGl_FrameBuffer;
0026 class OpenGl_Texture;
0027
0028
0029 class OpenGl_ShadowMap : public OpenGl_NamedResource
0030 {
0031 DEFINE_STANDARD_RTTIEXT(OpenGl_ShadowMap, OpenGl_NamedResource)
0032 public:
0033
0034
0035 OpenGl_ShadowMap();
0036
0037
0038 Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
0039
0040
0041 Standard_EXPORT virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE;
0042
0043
0044 Standard_EXPORT virtual ~OpenGl_ShadowMap();
0045
0046
0047 Standard_EXPORT bool IsValid() const;
0048
0049
0050 const Handle(OpenGl_FrameBuffer)& FrameBuffer() const { return myShadowMapFbo; }
0051
0052
0053 Standard_EXPORT const Handle(OpenGl_Texture)& Texture() const;
0054
0055
0056 const Handle(Graphic3d_CLight)& LightSource() const { return myShadowLight; }
0057
0058
0059 void SetLightSource (const Handle(Graphic3d_CLight)& theLight) { myShadowLight = theLight; }
0060
0061
0062 const Handle(Graphic3d_Camera)& Camera() const { return myShadowCamera; }
0063
0064
0065 const Graphic3d_Mat4& LightSourceMatrix() const { return myLightMatrix; }
0066
0067
0068 void SetLightSourceMatrix (const Graphic3d_Mat4& theMat) { myLightMatrix = theMat; }
0069
0070
0071 Standard_ShortReal ShadowMapBias() const { return myShadowMapBias; }
0072
0073
0074 void SetShadowMapBias (Standard_ShortReal theBias) { myShadowMapBias = theBias; }
0075
0076
0077
0078
0079 Standard_EXPORT bool UpdateCamera (const Graphic3d_CView& theView,
0080 const gp_XYZ* theOrigin = NULL);
0081
0082 private:
0083
0084 Handle(OpenGl_FrameBuffer) myShadowMapFbo;
0085 Handle(Graphic3d_CLight) myShadowLight;
0086 Handle(Graphic3d_Camera) myShadowCamera;
0087 Graphic3d_Mat4 myLightMatrix;
0088 Standard_ShortReal myShadowMapBias;
0089
0090 };
0091
0092
0093 class OpenGl_ShadowMapArray : public Standard_Transient, public NCollection_Array1<Handle(OpenGl_ShadowMap)>
0094 {
0095 public:
0096
0097 OpenGl_ShadowMapArray() {}
0098
0099
0100 Standard_EXPORT void Release (OpenGl_Context* theCtx);
0101
0102
0103 bool IsValid() const
0104 {
0105 return !IsEmpty()
0106 && First()->IsValid();
0107 }
0108
0109
0110 Standard_EXPORT Standard_Size EstimatedDataSize() const;
0111
0112 public:
0113 DEFINE_STANDARD_ALLOC
0114 DEFINE_NCOLLECTION_ALLOC
0115
0116 };
0117
0118 #endif