File indexing completed on 2025-10-30 08:47:42
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 #ifndef OpenGl_BackgroundArray_Header
0017 #define OpenGl_BackgroundArray_Header
0018 
0019 #include <Aspect_GradientFillMethod.hxx>
0020 #include <Aspect_FillMethod.hxx>
0021 #include <Graphic3d_Camera.hxx>
0022 #include <Graphic3d_TypeOfBackground.hxx>
0023 #include <OpenGl_Aspects.hxx>
0024 #include <OpenGl_PrimitiveArray.hxx>
0025 #include <OpenGl_Vec.hxx>
0026 
0027 
0028 
0029 class OpenGl_BackgroundArray : public OpenGl_PrimitiveArray
0030 {
0031 public:
0032 
0033   
0034   Standard_EXPORT OpenGl_BackgroundArray (const Graphic3d_TypeOfBackground theType);
0035 
0036   
0037   Standard_EXPORT void Render (const Handle(OpenGl_Workspace)& theWorkspace,
0038                                Graphic3d_Camera::Projection theProjection) const;
0039 
0040   
0041   Standard_EXPORT bool IsDefined() const;
0042 
0043   
0044   Standard_EXPORT void SetTextureParameters (const Aspect_FillMethod theFillMethod);
0045 
0046   
0047   Standard_EXPORT void SetTextureFillMethod (const Aspect_FillMethod theFillMethod);
0048 
0049   
0050   Aspect_FillMethod TextureFillMethod() const { return myFillMethod; }
0051 
0052   
0053   Aspect_GradientFillMethod GradientFillMethod() const { return myGradientParams.type; }
0054 
0055   
0056   const OpenGl_Vec4& GradientColor (const Standard_Integer theIndex) const { return (&myGradientParams.color1)[theIndex]; }
0057 
0058   
0059   Standard_EXPORT void SetGradientFillMethod (const Aspect_GradientFillMethod theType);
0060 
0061   
0062   Standard_EXPORT void SetGradientParameters (const Quantity_Color&           theColor1,
0063                                               const Quantity_Color&           theColor2,
0064                                               const Aspect_GradientFillMethod theType);
0065 
0066 protected: 
0067 
0068   struct OpenGl_GradientParameters
0069   {
0070     OpenGl_Vec4 color1;
0071     OpenGl_Vec4 color2;
0072     Aspect_GradientFillMethod type;
0073   };
0074 
0075 protected:
0076 
0077   
0078   
0079   
0080   Standard_EXPORT Standard_Boolean init (const Handle(OpenGl_Workspace)& theWorkspace) const;
0081 
0082   
0083   Standard_EXPORT Standard_Boolean createGradientArray (const Handle(OpenGl_Context)& theCtx) const;
0084 
0085   
0086   
0087   Standard_EXPORT Standard_Boolean createTextureArray (const Handle(OpenGl_Workspace)& theWorkspace) const;
0088 
0089   
0090   Standard_EXPORT Standard_Boolean createCubeMapArray() const;
0091 
0092   
0093   
0094   Standard_EXPORT void invalidateData();
0095 
0096   using OpenGl_PrimitiveArray::Render;
0097 
0098 protected:
0099 
0100   Graphic3d_TypeOfBackground        myType;           
0101   Aspect_FillMethod                 myFillMethod;     
0102   mutable OpenGl_GradientParameters myGradientParams; 
0103   mutable Standard_Integer          myViewWidth;      
0104   mutable Standard_Integer          myViewHeight;     
0105   mutable Standard_Boolean          myToUpdate;       
0106 
0107 };
0108 
0109 #endif