0029517: Visualization - introduce AlphaMode property defining alpha value handling...
[occt.git] / src / Graphic3d / Graphic3d_AspectFillArea3d.hxx
index dcd532b..f7e46e1 100644 (file)
@@ -21,6 +21,7 @@
 #include <Aspect_PolygonOffsetMode.hxx>
 #include <Aspect_InteriorStyle.hxx>
 #include <Aspect_TypeOfLine.hxx>
+#include <Graphic3d_AlphaMode.hxx>
 #include <Graphic3d_HatchStyle.hxx>
 #include <Graphic3d_MaterialAspect.hxx>
 #include <Graphic3d_PolygonOffset.hxx>
@@ -84,6 +85,20 @@ public:
   //! Sets shading model
   void SetShadingModel (const Graphic3d_TypeOfShadingModel theShadingModel) { myShadingModel = theShadingModel; }
 
+  //! Returns the way how alpha value should be treated (Graphic3d_AlphaMode_BlendAuto by default, for backward compatibility).
+  Graphic3d_AlphaMode AlphaMode() const { return myAlphaMode; }
+
+  //! Returns alpha cutoff threshold, for discarding fragments within Graphic3d_AlphaMode_Mask mode (0.5 by default).
+  //! If the alpha value is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent.
+  Standard_ShortReal AlphaCutoff() const { return myAlphaCutoff; }
+
+  //! Defines the way how alpha value should be treated.
+  void SetAlphaMode (Graphic3d_AlphaMode theMode, Standard_ShortReal theAlphaCutoff = 0.5f)
+  {
+    myAlphaMode = theMode;
+    myAlphaCutoff = theAlphaCutoff;
+  }
+
   //! Return interior color.
   const Quantity_Color& InteriorColor() const { return myInteriorColor.GetRGB(); }
 
@@ -345,6 +360,8 @@ protected:
   Quantity_ColorRGBA           myEdgeColor;
   Aspect_InteriorStyle         myInteriorStyle;
   Graphic3d_TypeOfShadingModel myShadingModel;
+  Graphic3d_AlphaMode          myAlphaMode;
+  Standard_ShortReal           myAlphaCutoff;
   Aspect_TypeOfLine            myEdgeType;
   Standard_ShortReal           myEdgeWidth;
   Handle(Graphic3d_HatchStyle) myHatchStyle;