File indexing completed on 2026-09-26 09:04:08
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 Standard_EXPORT OpenGl_BackgroundArray(const Graphic3d_TypeOfBackground theType);
0034
0035
0036 Standard_EXPORT void Render(const occ::handle<OpenGl_Workspace>& theWorkspace,
0037 Graphic3d_Camera::Projection theProjection) const;
0038
0039
0040 Standard_EXPORT bool IsDefined() const;
0041
0042
0043 Standard_EXPORT void SetTextureParameters(const Aspect_FillMethod theFillMethod);
0044
0045
0046 Standard_EXPORT void SetTextureFillMethod(const Aspect_FillMethod theFillMethod);
0047
0048
0049 Aspect_FillMethod TextureFillMethod() const { return myFillMethod; }
0050
0051
0052 Aspect_GradientFillMethod GradientFillMethod() const { return myGradientParams.type; }
0053
0054
0055 const NCollection_Vec4<float>& GradientColor(const int theIndex) const
0056 {
0057 return (&myGradientParams.color1)[theIndex];
0058 }
0059
0060
0061 Standard_EXPORT void SetGradientFillMethod(const Aspect_GradientFillMethod theType);
0062
0063
0064 Standard_EXPORT void SetGradientParameters(const Quantity_Color& theColor1,
0065 const Quantity_Color& theColor2,
0066 const Aspect_GradientFillMethod theType);
0067
0068 protected:
0069 struct OpenGl_GradientParameters
0070 {
0071 NCollection_Vec4<float> color1;
0072 NCollection_Vec4<float> color2;
0073 Aspect_GradientFillMethod type;
0074 };
0075
0076 protected:
0077
0078
0079
0080 Standard_EXPORT bool init(const occ::handle<OpenGl_Workspace>& theWorkspace) const;
0081
0082
0083 Standard_EXPORT bool createGradientArray(const occ::handle<OpenGl_Context>& theCtx) const;
0084
0085
0086
0087 Standard_EXPORT bool createTextureArray(const occ::handle<OpenGl_Workspace>& theWorkspace) const;
0088
0089
0090 Standard_EXPORT bool 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 int myViewWidth;
0104 mutable int myViewHeight;
0105 mutable bool myToUpdate;
0106
0107 };
0108
0109 #endif