#include <InterfaceGraphic_telem.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <TCollection_AsciiString.hxx>
-#include <Handle_Graphic3d_TextureParams.hxx>
+
#include <OpenGl_AspectLine.hxx>
#include <OpenGl_Element.hxx>
#include <Handle_OpenGl_Texture.hxx>
+
+#include <Graphic3d_TextureMap.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Handle_Graphic3d_TextureParams.hxx>
#define OPENGL_AMBIENT_MASK (1<<0)
#define OPENGL_DIFFUSE_MASK (1<<1)
OpenGl_AspectFace();
- void Init (const Handle(OpenGl_Context)& theContext,
- const CALL_DEF_CONTEXTFILLAREA& theAspect);
-
- void Init (const Handle(OpenGl_Context)& theContext,
- const Handle(Graphic3d_AspectFillArea3d)& theAspect);
-
- void SetAspectEdge (const OpenGl_AspectLine* theAspectEdge) { myAspectEdge = *theAspectEdge; }
-
- const OpenGl_AspectLine* AspectEdge() const { return &myAspectEdge; }
+ //! Copy parameters
+ void SetAspect (const CALL_DEF_CONTEXTFILLAREA& theAspect);
+ void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
+
+ //! Set edge aspect.
+ void SetAspectEdge (const OpenGl_AspectLine* theAspectEdge)
+ {
+ myAspectEdge = *theAspectEdge;
+ }
+
+ //! @return edge aspect.
+ const OpenGl_AspectLine* AspectEdge() const
+ {
+ return &myAspectEdge;
+ }
+
+ //! @return interior style
+ const Aspect_InteriorStyle InteriorStyle() const
+ {
+ return myInteriorStyle;
+ }
+
+ Aspect_InteriorStyle& ChangeInteriorStyle()
+ {
+ return myInteriorStyle;
+ }
+
+ //! @return edge on flag.
+ int Edge() const
+ {
+ return myEdge;
+ }
+
+ //! @return edge on flag.
+ int& ChangeEdge()
+ {
+ return myEdge;
+ }
+
+ //! @return hatch type.
+ int Hatch() const
+ {
+ return myHatch;
+ }
+
+ //! @return hatch type variable.
+ int& ChangeHatch()
+ {
+ return myHatch;
+ }
+
+ //! @return distinguishing mode.
+ int DistinguishingMode() const
+ {
+ return myDistinguishingMode;
+ }
+
+ //! @return distinguishing mode.
+ int& ChangeDistinguishingMode()
+ {
+ return myDistinguishingMode;
+ }
+
+ //! @return culling mode.
+ int CullingMode() const
+ {
+ return myCullingMode;
+ }
+
+ //! @return culling mode.
+ int& ChangeCullingMode()
+ {
+ return myCullingMode;
+ }
+
+ //! @return front material properties.
+ const OPENGL_SURF_PROP& IntFront() const
+ {
+ return myIntFront;
+ }
+
+ //! @return front material properties.
+ OPENGL_SURF_PROP& ChangeIntFront()
+ {
+ return myIntFront;
+ }
+
+ //! @return back material properties.
+ const OPENGL_SURF_PROP& IntBack() const
+ {
+ return myIntBack;
+ }
+
+ //! @return back material properties.
+ OPENGL_SURF_PROP& ChangeIntBack()
+ {
+ return myIntBack;
+ }
+
+ //! @return polygon offset parameters.
+ const TEL_POFFSET_PARAM& PolygonOffset() const
+ {
+ return myPolygonOffset;
+ }
+
+ //! @return polygon offset parameters.
+ TEL_POFFSET_PARAM& ChangePolygonOffset()
+ {
+ return myPolygonOffset;
+ }
+
+ //! @return texture mapping flag.
+ bool DoTextureMap() const
+ {
+ return myDoTextureMap;
+ }
+
+ //! @return texture mapping flag.
+ bool& ChangeDoTextureMap()
+ {
+ return myDoTextureMap;
+ }
+
+ //! @return texture map.
+ const Handle(OpenGl_Texture)& TextureRes (const Handle(OpenGl_Workspace)& theWorkspace) const
+ {
+ if (!myIsTextureInit)
+ {
+ buildTexture (theWorkspace);
+ myIsTextureInit = Standard_True;
+ }
+
+ return myTextureRes;
+ }
+
+ //! @return texture mapping parameters.
+ const Handle(Graphic3d_TextureParams)& TextureParams() const
+ {
+ return myTextureMap->GetParams();
+ }
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext);
-private:
+protected:
+ void buildTexture (const Handle(OpenGl_Workspace)& theWorkspace) const;
void convertMaterial (const CALL_DEF_MATERIAL& theMat,
OPENGL_SURF_PROP& theSurf);
-public:
+protected: //! @name ordinary aspect properties
+
+ Aspect_InteriorStyle myInteriorStyle;
+ int myEdge;
+ int myHatch;
+ int myDistinguishingMode;
+ int myCullingMode;
+ OPENGL_SURF_PROP myIntFront;
+ OPENGL_SURF_PROP myIntBack;
+ TEL_POFFSET_PARAM myPolygonOffset;
+ bool myDoTextureMap;
+ Handle(Graphic3d_TextureMap) myTextureMap;
- Aspect_InteriorStyle InteriorStyle;
- int Edge;
- int Hatch;
- int DistinguishingMode;
- int CullingMode;
- OPENGL_SURF_PROP IntFront;
- OPENGL_SURF_PROP IntBack;
- TEL_POFFSET_PARAM PolygonOffset;
+protected: //! @name OpenGl resources
- int doTextureMap;
- Handle(OpenGl_Texture) TextureRes;
- Handle(Graphic3d_TextureParams) TextureParams;
+ mutable Standard_Boolean myIsTextureInit;
+ mutable Handle(OpenGl_Texture) myTextureRes;
+ mutable TCollection_AsciiString myTextureId;
protected:
- TCollection_AsciiString myTextureId;
- OpenGl_AspectLine myAspectEdge;
+ OpenGl_AspectLine myAspectEdge;
public: