1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027670: Visualization - avoid duplication of structures defining primitive array presentation aspects

Quantity_ColorRGBA has been introduced as convenient structure holding Vec4 for OpenGL.
Graphic3d_PolygonOffset has been added as replacement for TEL_POFFSET_PARAM.

Duplicating definition of Hatch Styles TEL_HS_*** has been removed;
Aspect_HatchStyle enum now follows values of TEL_HS_*** for compatibility.
TelCullMode enum has been removed.

Aspect_AspectLine has been merged into Graphic3d_AspectLine3d.
Aspect_AspectMarker has been merged into Graphic3d_AspectMarker3d.
Aspect_AspectFillArea has been merged into Graphic3d_AspectFillArea3d.
Graphic3d_CAspectFillArea have been removed.

OpenGl_AspectLine now stores Graphic3d_AspectLine3d as class field.
OpenGl_AspectMarker now stores Graphic3d_AspectMarker3d as class field.
OpenGl_AspectText now stores Graphic3d_AspectText3d as class field.
OpenGl_AspectFace now stores Graphic3d_AspectFillArea3d as class field.

Graphic3d_AspectFillArea3d - back face culling is now enabled by default.
TKOpenGl now relies on Graphic3d_Group::IsClosed() flag to disable face culling.
StdPrs_ShadedShape now does not modify aspect for different culling modes.

Headers InterfaceGraphic_Graphic3d.hxx, InterfaceGraphic_telem.hxx, InterfaceGraphic_tgl_all.hxx
defining obsolete structures CALL_DEF_COLOR, CALL_DEF_POINT,
CALL_DEF_MATERIAL, CALL_DEF_TRANSFORM_PERSISTENCE, TEL_POINT, TEL_COLOUR
have been removed.

Useless and broken test case bugs/vis/buc60821 has been removed.

OpenGl_Workspace::myAspectFaceApplied and myAspectMarkerApplied have been replaced
from OpenGl_AspectFace*/OpenGl_AspectMarker*
to Handle(Graphic3d_AspectFillArea3d)/Handle(Graphic3d_AspectMarker3d).
This eliminates reading from freed memory
(e.g. when OpenGl_AspectFace is allocated on stack like in OpenGl_Trihedron).

OpenGl_PrimitiveArray::drawEdges() - fix drawing non-indexed array from VBO (access violation due to NULL handle).

AIS_Dimension::DrawArrow() - added missing initialization of 3D arrow aspect.
AIS_Manipulator::Compute() now creates dedicated Face Aspect for each axis.
V3d_CircularGrid, V3d_RectangularGrid now create dedicated line aspects with different color.
AIS_InteractiveObject::SetMaterial() - do not modify global ShadingAspect.
This commit is contained in:
kgv
2016-07-13 19:36:20 +03:00
committed by bugmaster
parent 28cab3768f
commit b647266461
117 changed files with 1865 additions and 4534 deletions

View File

@@ -40,10 +40,6 @@ Graphic3d_Buffer.hxx
Graphic3d_BufferType.hxx
Graphic3d_Camera.cxx
Graphic3d_Camera.hxx
Graphic3d_CAspectFillArea.hxx
Graphic3d_CAspectLine.hxx
Graphic3d_CAspectMarker.hxx
Graphic3d_CAspectText.hxx
Graphic3d_CBitFields4.hxx
Graphic3d_CBitFields8.hxx
Graphic3d_CBitFields16.hxx
@@ -94,6 +90,7 @@ Graphic3d_NameOfTextureEnv.hxx
Graphic3d_NameOfTexturePlane.hxx
Graphic3d_NListOfHAsciiString.hxx
Graphic3d_NMapOfTransient.hxx
Graphic3d_PolygonOffset.hxx
Graphic3d_PriorityDefinitionError.hxx
Graphic3d_RenderingMode.hxx
Graphic3d_RenderingParams.hxx

View File

@@ -13,178 +13,57 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//-Design Declaration of variables specific to the context
// of tracing of facets 3D
//-Warning Ccontext of tracing of facets 3d inherits the context
// defined by :
// - the style of the interior of the facet
// - the style of the facet border
// - the color
// Additionally, it has more than one definition of material
// for internal and external faces.
// for the class
#include <Aspect_PolygonOffsetMode.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d,Aspect_AspectFillArea)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Standard_Transient)
Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d ():
DistinguishModeActive (Standard_False), EdgeModeActive (Standard_False), BackFaceRemovalActive (Standard_False), MyTextureMapState(Standard_False), MyFrontMaterial (), MyBackMaterial ()
// =======================================================================
// function : Graphic3d_AspectFillArea3d
// purpose :
// =======================================================================
Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d()
: myInteriorColor (Quantity_NOC_CYAN1),
myBackInteriorColor (Quantity_NOC_CYAN1),
myEdgeColor (Quantity_NOC_WHITE),
myInteriorStyle (Aspect_IS_EMPTY),
myEdgeType (Aspect_TOL_SOLID),
myEdgeWidth (1.0f),
myHatchStyle (Aspect_HS_VERTICAL),
myToDistinguishMaterials (false),
myToDrawEdges (false),
myToSuppressBackFaces (true),
myToMapTexture (false)
{
// By default, aspect do not change current polygon offset parameters
MyPolygonOffsetMode = Aspect_POM_Fill;
MyPolygonOffsetFactor = 1.;
MyPolygonOffsetUnits = 0.;
//
}
// (InteriorStyle, InteriorColor, EdgeColor, EdgeLineType, EdgeLineWidth)
// because AspectFillArea3d inherits AspectFillArea and it is necessary to call
// initialisation of AspectFillArea with InteriorStyle, InteriorColor,
// EdgeColor, EdgeLineType and EdgeLineWidth.
Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d (const Aspect_InteriorStyle InteriorStyle, const Quantity_Color& InteriorColor, const Quantity_Color& EdgeColor, const Aspect_TypeOfLine EdgeLineType, const Standard_Real EdgeLineWidth, const Graphic3d_MaterialAspect& FrontMaterial, const Graphic3d_MaterialAspect& BackMaterial):
Aspect_AspectFillArea (InteriorStyle, InteriorColor, EdgeColor, EdgeLineType, EdgeLineWidth), DistinguishModeActive (Standard_False), EdgeModeActive (Standard_False), BackFaceRemovalActive (Standard_False), MyTextureMap(), MyTextureMapState(Standard_False), MyFrontMaterial (FrontMaterial), MyBackMaterial (BackMaterial) {
// By default, aspect do not change current polygon offset parameters
MyPolygonOffsetMode = Aspect_POM_Fill;
MyPolygonOffsetFactor = 1.;
MyPolygonOffsetUnits = 0.;
}
void Graphic3d_AspectFillArea3d::SetBackMaterial (const Graphic3d_MaterialAspect& AMaterial) {
MyBackMaterial = AMaterial;
}
void Graphic3d_AspectFillArea3d::SetFrontMaterial (const Graphic3d_MaterialAspect& AMaterial) {
MyFrontMaterial = AMaterial;
}
const Graphic3d_MaterialAspect& Graphic3d_AspectFillArea3d::BackMaterial() const
// =======================================================================
// function : Graphic3d_AspectFillArea3d
// purpose :
// =======================================================================
Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d (const Aspect_InteriorStyle theInteriorStyle,
const Quantity_Color& theInteriorColor,
const Quantity_Color& theEdgeColor,
const Aspect_TypeOfLine theEdgeLineType,
const Standard_Real theEdgeLineWidth,
const Graphic3d_MaterialAspect& theFrontMaterial,
const Graphic3d_MaterialAspect& theBackMaterial)
: myFrontMaterial (theFrontMaterial),
myBackMaterial (theBackMaterial),
myInteriorColor (theInteriorColor),
myBackInteriorColor (theInteriorColor),
myEdgeColor (theEdgeColor),
myInteriorStyle (theInteriorStyle),
myEdgeType (theEdgeLineType),
myEdgeWidth ((float )theEdgeLineWidth),
myHatchStyle (Aspect_HS_VERTICAL),
myToDistinguishMaterials (false),
myToDrawEdges (false),
myToSuppressBackFaces (true),
myToMapTexture (false)
{
return MyBackMaterial;
}
const Graphic3d_MaterialAspect& Graphic3d_AspectFillArea3d::FrontMaterial() const
{
return MyFrontMaterial;
}
void Graphic3d_AspectFillArea3d::AllowBackFace () {
BackFaceRemovalActive = Standard_False;
}
void Graphic3d_AspectFillArea3d::SuppressBackFace () {
BackFaceRemovalActive = Standard_True;
}
Standard_Boolean Graphic3d_AspectFillArea3d::BackFace () const {
return (BackFaceRemovalActive);
}
void Graphic3d_AspectFillArea3d::SetDistinguishOn () {
DistinguishModeActive = Standard_True;
}
void Graphic3d_AspectFillArea3d::SetDistinguishOff () {
DistinguishModeActive = Standard_False;
}
Standard_Boolean Graphic3d_AspectFillArea3d::Distinguish () const {
return (DistinguishModeActive);
}
void Graphic3d_AspectFillArea3d::SetEdgeOn () {
EdgeModeActive = Standard_True;
}
void Graphic3d_AspectFillArea3d::SetEdgeOff () {
EdgeModeActive = Standard_False;
}
void Graphic3d_AspectFillArea3d::SetTextureMap(const Handle(Graphic3d_TextureMap)& ATexture)
{
MyTextureMap = ATexture;
}
void Graphic3d_AspectFillArea3d::SetTextureMapOn()
{
MyTextureMapState = Standard_True;
}
void Graphic3d_AspectFillArea3d::SetTextureMapOff()
{
MyTextureMapState = Standard_False;
}
Standard_Boolean Graphic3d_AspectFillArea3d::Edge () const {
return (EdgeModeActive);
}
Handle(Graphic3d_TextureMap) Graphic3d_AspectFillArea3d::TextureMap() const
{
return MyTextureMap;
}
Standard_Boolean Graphic3d_AspectFillArea3d::TextureMapState() const
{
return MyTextureMapState;
}
void Graphic3d_AspectFillArea3d::SetPolygonOffsets(const Standard_Integer aMode,
const Standard_ShortReal aFactor,
const Standard_ShortReal aUnits) {
MyPolygonOffsetMode = ( aMode & Aspect_POM_Mask );
MyPolygonOffsetFactor = aFactor;
MyPolygonOffsetUnits = aUnits;
}
void Graphic3d_AspectFillArea3d::PolygonOffsets(Standard_Integer& aMode,
Standard_ShortReal& aFactor,
Standard_ShortReal& aUnits) const {
aMode = MyPolygonOffsetMode;
aFactor = MyPolygonOffsetFactor;
aUnits = MyPolygonOffsetUnits;
}
void Graphic3d_AspectFillArea3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
{
MyShaderProgram = theProgram;
}
const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectFillArea3d::ShaderProgram() const
{
return MyShaderProgram;
if (theEdgeLineWidth <= 0.0)
{
Aspect_AspectFillAreaDefinitionError::Raise ("Bad value for EdgeLineWidth");
}
}

View File

@@ -17,110 +17,165 @@
#ifndef _Graphic3d_AspectFillArea3d_HeaderFile
#define _Graphic3d_AspectFillArea3d_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Standard_Integer.hxx>
#include <Standard_ShortReal.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Aspect_AspectFillArea.hxx>
#include <Aspect_AspectFillAreaDefinitionError.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_HatchStyle.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_PolygonOffset.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_Real.hxx>
class Graphic3d_TextureMap;
class Quantity_Color;
class Graphic3d_MaterialAspect;
#include <Standard_Type.hxx>
#include <Quantity_ColorRGBA.hxx>
class Graphic3d_AspectFillArea3d;
DEFINE_STANDARD_HANDLE(Graphic3d_AspectFillArea3d, Aspect_AspectFillArea)
//! This class permits the creation and updating of
//! a graphic attribute context for opaque 3d
//! primitives (polygons, triangles, quadrilaterals)
//! Keywords: Face, FillArea, Triangle, Quadrangle, Polygon,
//! TriangleMesh, QuadrangleMesh, Edge, Border, Interior,
//! Color, Type, Width, Style, Hatch, Material,
//! BackFaceRemoval, DistinguishMode
class Graphic3d_AspectFillArea3d : public Aspect_AspectFillArea
//! This class defines graphic attributes for opaque 3d primitives (polygons, triangles, quadrilaterals).
class Graphic3d_AspectFillArea3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Standard_Transient)
public:
//! Creates a context table for fill area primitives
//! defined with the following default values:
//! Creates a context table for fill area primitives defined with the following default values:
//!
//! InteriorStyle : IS_EMPTY
//! InteriorColor : NOC_CYAN1
//! EdgeColor : NOC_WHITE
//! EdgeLineType : TOL_SOLID
//! EdgeWidth : 1.0
//! FrontMaterial : NOM_BRASS
//! BackMaterial : NOM_BRASS
//! InteriorStyle : Aspect_IS_EMPTY
//! InteriorColor : Quantity_NOC_CYAN1
//! EdgeColor : Quantity_NOC_WHITE
//! EdgeLineType : Aspect_TOL_SOLID
//! EdgeWidth : 1.0
//! FrontMaterial : NOM_BRASS
//! BackMaterial : NOM_BRASS
//! HatchStyle : Aspect_HS_VERTICAL
//!
//! Display of back-facing filled polygons.
//! No distinction between external and internal
//! faces of FillAreas.
//! No distinction between external and internal faces of FillAreas.
//! The edges are not drawn.
//! Polygon offset parameters: mode = Aspect_POM_None, factor = 1., units = 0.
Standard_EXPORT Graphic3d_AspectFillArea3d();
//! Creates a context table for fill area primitives
//! defined with the specified values.
//!
//! Creates a context table for fill area primitives defined with the specified values.
//! Display of back-facing filled polygons.
//! No distinction between external and internal
//! faces of FillAreas.
//! No distinction between external and internal faces of FillAreas.
//! The edges are not drawn.
//! Polygon offset parameters: mode = Aspect_POM_None, factor = 1., units = 0.
//! Warning
//! EdgeWidth is the "line width scale factor". The
//! nominal line width is 1 pixel. The width of the line is
//! determined by applying the line width scale factor to
//! this nominal line width. The supported line widths
//! vary by 1-pixel units.
Standard_EXPORT Graphic3d_AspectFillArea3d(const Aspect_InteriorStyle Interior, const Quantity_Color& InteriorColor, const Quantity_Color& EdgeColor, const Aspect_TypeOfLine EdgeLineType, const Standard_Real EdgeWidth, const Graphic3d_MaterialAspect& FrontMaterial, const Graphic3d_MaterialAspect& BackMaterial);
//! Allows the display of back-facing filled
//! polygons.
Standard_EXPORT void AllowBackFace();
//! Modifies the surface material of internal faces
Standard_EXPORT void SetBackMaterial (const Graphic3d_MaterialAspect& AMaterial);
//! Allows distinction between external and internal
//! faces of FillAreas.
Standard_EXPORT void SetDistinguishOn();
//! Forbids distinction between external and internal
//! faces of FillAreas.
Standard_EXPORT void SetDistinguishOff();
//! The edges of FillAreas are drawn.
Standard_EXPORT void SetEdgeOn();
//! The edges of FillAreas are not drawn.
Standard_EXPORT void SetEdgeOff();
Standard_EXPORT Graphic3d_AspectFillArea3d (const Aspect_InteriorStyle theInterior,
const Quantity_Color& theInteriorColor,
const Quantity_Color& theEdgeColor,
const Aspect_TypeOfLine theEdgeLineType,
const Standard_Real theEdgeWidth,
const Graphic3d_MaterialAspect& theFrontMaterial,
const Graphic3d_MaterialAspect& theBackMaterial);
//! Return interior rendering style (Aspect_IS_EMPTY by default, which means nothing will be rendered!).
Aspect_InteriorStyle InteriorStyle() const { return myInteriorStyle; }
//! Modifies the interior type used for rendering
void SetInteriorStyle (const Aspect_InteriorStyle theStyle) { myInteriorStyle = theStyle; }
//! Return interior color.
const Quantity_Color& InteriorColor() const { return myInteriorColor.GetRGB(); }
//! Return interior color.
const Quantity_ColorRGBA& InteriorColorRGBA() const { return myInteriorColor; }
//! Modifies the color of the interior of the face
void SetInteriorColor (const Quantity_Color& theColor) { myInteriorColor.SetRGB (theColor); }
//! Return back interior color.
const Quantity_Color& BackInteriorColor() const { return myBackInteriorColor.GetRGB(); }
//! Return back interior color.
const Quantity_ColorRGBA& BackInteriorColorRGBA() const { return myBackInteriorColor; }
//! Modifies the color of the interior of the back face
void SetBackInteriorColor (const Quantity_Color& theColor) { myBackInteriorColor.SetRGB (theColor); }
//! Returns the surface material of external faces
const Graphic3d_MaterialAspect& FrontMaterial() const { return myFrontMaterial; }
//! Modifies the surface material of external faces
Standard_EXPORT void SetFrontMaterial (const Graphic3d_MaterialAspect& AMaterial);
//! Suppress the display of back-facing filled
//! polygons.
void SetFrontMaterial (const Graphic3d_MaterialAspect& theMaterial) { myFrontMaterial = theMaterial; }
//! Returns the surface material of internal faces
const Graphic3d_MaterialAspect& BackMaterial() const { return myBackMaterial; }
//! Modifies the surface material of internal faces
void SetBackMaterial (const Graphic3d_MaterialAspect& theMaterial) { myBackMaterial = theMaterial; }
//! Returns true if back faces should be suppressed (true by default).
bool ToSuppressBackFaces() const { return myToSuppressBackFaces; }
//! Assign back faces culling flag.
void SetSuppressBackFaces (bool theToSuppress) { myToSuppressBackFaces = theToSuppress; }
//! Returns true if back faces should be suppressed (true by default).
bool BackFace() const { return myToSuppressBackFaces; }
//! Allows the display of back-facing filled polygons.
void AllowBackFace() { myToSuppressBackFaces = false; }
//! Suppress the display of back-facing filled polygons.
//! A back-facing polygon is defined as a polygon whose
//! vertices are in a clockwise order with respect
//! to screen coordinates.
Standard_EXPORT void SuppressBackFace();
Standard_EXPORT void SetTextureMap (const Handle(Graphic3d_TextureMap)& ATexture);
Standard_EXPORT void SetTextureMapOn();
Standard_EXPORT void SetTextureMapOff();
//! vertices are in a clockwise order with respect to screen coordinates.
void SuppressBackFace() { myToSuppressBackFaces = true; }
//! Returns true if material properties should be distinguished for back and front faces (false by default).
bool Distinguish() const { return myToDistinguishMaterials; }
//! Set material distinction between front and back faces.
void SetDistinguish (bool toDistinguish) { myToDistinguishMaterials = toDistinguish; }
//! Allows material distinction between front and back faces.
void SetDistinguishOn() { myToDistinguishMaterials = true; }
//! Forbids material distinction between front and back faces.
void SetDistinguishOff() { myToDistinguishMaterials = false; }
//! Return shader program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
//! Return texture to be mapped.
const Handle(Graphic3d_TextureMap)& TextureMap() const { return myTextureMap; }
//! Assign texture to be mapped.
//! See also SetTextureMap() to actually activate texture mapping.
void SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture) { myTextureMap = theTexture; }
//! Return true if texture mapping is enabled (false by default).
bool ToMapTexture() const { return myToMapTexture; }
//! Return true if texture mapping is enabled (false by default).
bool TextureMapState() const { return myToMapTexture; }
//! Set texture mapping flag.
void SetTextureMap (bool theToEnable) { myToMapTexture = theToEnable; }
//! Enable texture mapping (has no effect if texture is not set).
void SetTextureMapOn() { myToMapTexture = true; }
//! Disable texture mapping.
void SetTextureMapOff() { myToMapTexture = false; }
//! Returns current polygon offsets settings.
const Graphic3d_PolygonOffset& PolygonOffset() const { return myPolygonOffset; }
//! Returns current polygon offsets settings.
void PolygonOffsets (Standard_Integer& theMode,
Standard_ShortReal& theFactor,
Standard_ShortReal& theUnits) const
{
theMode = myPolygonOffset.Mode;
theFactor = myPolygonOffset.Factor;
theUnits = myPolygonOffset.Units;
}
//! Sets up OpenGL polygon offsets mechanism.
//! <aMode> parameter can contain various combinations of
//! Aspect_PolygonOffsetMode enumeration elements (Aspect_POM_None means
@@ -132,74 +187,129 @@ public:
//! m - maximum depth slope for the polygon currently being displayed,
//! r - minimum window coordinates depth resolution (implementation-specific)
//!
//! Deafult settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0.
//! Default settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0.
//!
//! Negative offset values move polygons closer to the viewport,
//! while positive values shift polygons away.
//! Consult OpenGL reference for details (glPolygonOffset function description).
Standard_EXPORT void SetPolygonOffsets (const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0);
//! Sets up OpenGL/GLSL shader program.
Standard_EXPORT void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram);
//! Returns the Back Face Removal status.
//! Standard_True if SuppressBackFace is activated.
Standard_EXPORT Standard_Boolean BackFace() const;
//! Returns the Distinguish Mode status.
Standard_EXPORT Standard_Boolean Distinguish() const;
//! Returns Standard_True if the edges are drawn and
//! Standard_False if the edges are not drawn.
Standard_EXPORT Standard_Boolean Edge() const;
//! Returns the surface material of internal faces
Standard_EXPORT const Graphic3d_MaterialAspect& BackMaterial() const;
//! Returns the surface material of external faces
Standard_EXPORT const Graphic3d_MaterialAspect& FrontMaterial() const;
Standard_EXPORT Handle(Graphic3d_TextureMap) TextureMap() const;
Standard_EXPORT Standard_Boolean TextureMapState() const;
//! Returns current polygon offsets settings.
Standard_EXPORT void PolygonOffsets (Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
Standard_EXPORT const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const;
void SetPolygonOffsets (const Standard_Integer theMode,
const Standard_ShortReal theFactor = 1.0f,
const Standard_ShortReal theUnits = 0.0f)
{
myPolygonOffset.Mode = (Aspect_PolygonOffsetMode )(theMode & Aspect_POM_Mask);
myPolygonOffset.Factor = theFactor;
myPolygonOffset.Units = theUnits;
}
public:
//! Returns true if edges should be drawn (false by default).
bool ToDrawEdges() const { return myToDrawEdges; }
//! Set if edges should be drawn or not.
void SetDrawEdges (bool theToDraw) { myToDrawEdges = theToDraw; }
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d,Aspect_AspectFillArea)
//! Returns true if edges should be drawn.
bool Edge() const { return myToDrawEdges; }
//! The edges of FillAreas are drawn.
void SetEdgeOn() { myToDrawEdges = true; }
//! The edges of FillAreas are not drawn.
void SetEdgeOff() { myToDrawEdges = false; }
//! Return color of edges.
const Quantity_Color& EdgeColor() const { return myEdgeColor.GetRGB(); }
//! Return color of edges.
const Quantity_ColorRGBA& EdgeColorRGBA() const { return myEdgeColor; }
//! Modifies the color of the edge of the face
void SetEdgeColor (const Quantity_Color& theColor) { myEdgeColor.SetRGB (theColor); }
//! Return edges line type.
Aspect_TypeOfLine EdgeLineType() const { return myEdgeType; }
//! Modifies the edge line type
void SetEdgeLineType (const Aspect_TypeOfLine theType) { myEdgeType = theType; }
//! Return width for edges in pixels.
Standard_ShortReal EdgeWidth() const { return myEdgeWidth; }
//! Modifies the edge thickness
//! Warning: Raises AspectFillAreaDefinitionError if the width is a negative value.
void SetEdgeWidth (const Standard_Real theWidth)
{
if (theWidth <= 0.0)
{
Aspect_AspectFillAreaDefinitionError::Raise ("Bad value for EdgeLineWidth");
}
myEdgeWidth = (float )theWidth;
}
public:
//! Returns the hatch type used when InteriorStyle is IS_HATCH
Aspect_HatchStyle HatchStyle() const { return myHatchStyle; }
//! Modifies the hatch type used when InteriorStyle is IS_HATCH
void SetHatchStyle (const Aspect_HatchStyle theStyle) { myHatchStyle = theStyle; }
//! Returns the current values.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Aspect_InteriorStyle& theStyle,
Quantity_Color& theIntColor,
Quantity_Color& theEdgeColor,
Aspect_TypeOfLine& theType,
Standard_Real& theWidth) const
{
theStyle = myInteriorStyle;
theIntColor = myInteriorColor.GetRGB();
theEdgeColor= myEdgeColor.GetRGB();
theType = myEdgeType;
theWidth = myEdgeWidth;
}
//! Returns the current values.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Aspect_InteriorStyle& theStyle,
Quantity_Color& theIntColor,
Quantity_Color& theBackIntColor,
Quantity_Color& theEdgeColor,
Aspect_TypeOfLine& theType,
Standard_Real& theWidth) const
{
theStyle = myInteriorStyle;
theIntColor = myInteriorColor.GetRGB();
theBackIntColor= myBackInteriorColor.GetRGB();
theEdgeColor = myEdgeColor.GetRGB();
theType = myEdgeType;
theWidth = myEdgeWidth;
}
protected:
Handle(Graphic3d_ShaderProgram) myProgram;
Handle(Graphic3d_TextureMap) myTextureMap;
Graphic3d_MaterialAspect myFrontMaterial;
Graphic3d_MaterialAspect myBackMaterial;
Quantity_ColorRGBA myInteriorColor;
Quantity_ColorRGBA myBackInteriorColor;
Quantity_ColorRGBA myEdgeColor;
Aspect_InteriorStyle myInteriorStyle;
Aspect_TypeOfLine myEdgeType;
Standard_ShortReal myEdgeWidth;
Aspect_HatchStyle myHatchStyle;
private:
Standard_Boolean DistinguishModeActive;
Standard_Boolean EdgeModeActive;
Standard_Boolean BackFaceRemovalActive;
Handle(Graphic3d_TextureMap) MyTextureMap;
Standard_Boolean MyTextureMapState;
Graphic3d_MaterialAspect MyFrontMaterial;
Graphic3d_MaterialAspect MyBackMaterial;
Standard_Integer MyPolygonOffsetMode;
Standard_ShortReal MyPolygonOffsetFactor;
Standard_ShortReal MyPolygonOffsetUnits;
Handle(Graphic3d_ShaderProgram) MyShaderProgram;
Graphic3d_PolygonOffset myPolygonOffset;
bool myToDistinguishMaterials;
bool myToDrawEdges;
bool myToSuppressBackFaces;
bool myToMapTexture;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectFillArea3d, Standard_Transient)
#endif // _Graphic3d_AspectFillArea3d_HeaderFile

View File

@@ -13,45 +13,35 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//-Version
//-Design Declaration of variables specific to the context
// of tracing of lines 3d
//-Warning Context of tracing of lines 3d inherits the context
// defined by :
// - the color
// - the type of trait
// - the thickness
//-References
//-Language C++ 2.0
//-Declarations
// for the class
#include <Graphic3d_AspectLine3d.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectLine3d,Aspect_AspectLine)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectLine3d, Standard_Transient)
//-Aliases
//-Global data definitions
//-Constructors
//-Destructors
//-Methods, in order
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d () {
}
// (AColor, AType, AWidth)
// because AspectLine3d inherits AspectLine and it is necessary to call
// initialisation of AspectLine with AColor, AType, AWidth.
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d (const Quantity_Color& AColor, const Aspect_TypeOfLine AType, const Standard_Real AWidth):Aspect_AspectLine (AColor, AType, AWidth) {}
void Graphic3d_AspectLine3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
// =======================================================================
// function : Graphic3d_AspectLine3d
// purpose :
// =======================================================================
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d()
: myColor (Quantity_NOC_YELLOW),
myType (Aspect_TOL_SOLID),
myWidth (1.0f)
{
MyShaderProgram = theProgram;
//
}
const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectLine3d::ShaderProgram() const
// =======================================================================
// function : Graphic3d_AspectLine3d
// purpose :
// =======================================================================
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d (const Quantity_Color& theColor,
const Aspect_TypeOfLine theType,
const Standard_Real theWidth)
: myColor (theColor),
myType (theType),
myWidth ((float )theWidth)
{
return MyShaderProgram;
if (myWidth <= 0.0f)
{
Aspect_AspectLineDefinitionError::Raise ("Graphic3d_AspectLine3d, Bad value for LineWidth");
}
}

View File

@@ -16,49 +16,76 @@
#ifndef _Graphic3d_AspectLine3d_HeaderFile
#define _Graphic3d_AspectLine3d_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Aspect_AspectLine.hxx>
#include <Aspect_AspectLineDefinitionError.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Standard.hxx>
#include <Standard_Real.hxx>
class Quantity_Color;
#include <Standard_Type.hxx>
#include <Quantity_ColorRGBA.hxx>
class Graphic3d_AspectLine3d;
DEFINE_STANDARD_HANDLE(Graphic3d_AspectLine3d, Aspect_AspectLine)
//! Creates and updates a group of attributes
//! for 3d line primitives. This group contains the
//! colour, the type of line, and its thickness.
class Graphic3d_AspectLine3d : public Aspect_AspectLine
//! Creates and updates a group of attributes for 3d line primitives.
//! This group contains the color, the type of line, and its thickness.
class Graphic3d_AspectLine3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectLine3d, Standard_Transient)
public:
//! Creates a context table for line primitives
//! defined with the following default values:
//!
//! Colour : NOC_YELLOW
//! Line type : TOL_SOLID
//! Width : 1.0
//! Color = Quantity_NOC_YELLOW;
//! Type = Aspect_TOL_SOLID;
//! Width = 1.0;
Standard_EXPORT Graphic3d_AspectLine3d();
//! Creates a context table for line primitives
//! defined with the specified values.
//! Warning: <AWidth> is the "linewidth scale factor".
//! The nominal line width is 1 pixel. The width of
//! the line is determined by applying the linewidth scale
//! factor to this nominal line width.
//! The supported linewidths vary by 1-pixel units.
Standard_EXPORT Graphic3d_AspectLine3d(const Quantity_Color& AColor, const Aspect_TypeOfLine AType, const Standard_Real AWidth);
//! Creates a context table for line primitives defined with the specified values.
//! Warning: theWidth is the "line width scale factor".
//! The nominal line width is 1 pixel.
//! The width of the line is determined by applying the line width scale factor to this nominal line width.
//! The supported line widths vary by 1-pixel units.
Standard_EXPORT Graphic3d_AspectLine3d (const Quantity_Color& theColor,
const Aspect_TypeOfLine theType,
const Standard_Real theWidth);
//! Return color.
const Quantity_ColorRGBA& ColorRGBA() const { return myColor; }
//! Return color.
const Quantity_Color& Color() const { return myColor.GetRGB(); }
//! Modifies the color.
void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); }
//! Return line type.
Aspect_TypeOfLine Type() const { return myType; }
//! Modifies the type of line.
void SetType (const Aspect_TypeOfLine theType) { myType = theType; }
//! Return line width.
Standard_ShortReal Width() const { return myWidth; }
//! Modifies the line thickness.
//! Warning: Raises AspectLineDefinitionError if the width is a negative value.
void SetWidth (const Standard_Real theWidth) { SetWidth ((float )theWidth); }
//! Modifies the line thickness.
//! Warning: Raises AspectLineDefinitionError if the width is a negative value.
void SetWidth (const Standard_ShortReal theWidth)
{
if (theWidth <= 0.0f)
{
Aspect_AspectLineDefinitionError::Raise ("Graphic3d_AspectLine3d, Bad value for LineWidth");
}
myWidth = theWidth;
}
//! Return shader program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
Standard_EXPORT void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram);
Standard_EXPORT const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const;
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
//! Check for equality with another line aspect.
bool IsEqual (const Graphic3d_AspectLine3d& theOther)
@@ -68,32 +95,34 @@ public:
return true;
}
return MyShaderProgram == theOther.MyShaderProgram
&& MyType == theOther.MyType
&& MyColor == theOther.MyColor
&& MyWidth == theOther.MyWidth;
return myProgram == theOther.myProgram
&& myType == theOther.myType
&& myColor == theOther.myColor
&& myWidth == theOther.myWidth;
}
public:
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectLine3d,Aspect_AspectLine)
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Aspect_TypeOfLine& theType,
Standard_Real& theWidth) const
{
theColor = myColor.GetRGB();
theType = myType;
theWidth = myWidth;
}
protected:
private:
Handle(Graphic3d_ShaderProgram) MyShaderProgram;
Handle(Graphic3d_ShaderProgram) myProgram;
Quantity_ColorRGBA myColor;
Aspect_TypeOfLine myType;
Standard_ShortReal myWidth;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectLine3d, Standard_Transient)
#endif // _Graphic3d_AspectLine3d_HeaderFile

View File

@@ -13,23 +13,21 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_MarkerImage.hxx>
#include <Image_PixMap.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Type.hxx>
#include <TColStd_Array1OfByte.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d,Aspect_AspectMarker)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Standard_Transient)
// =======================================================================
// function : Graphic3d_AspectMarker3d
// purpose :
// =======================================================================
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
: Aspect_AspectMarker()
{}
: myColor (Quantity_NOC_YELLOW),
myType (Aspect_TOM_X),
myScale (1.0f)
{
//
}
// =======================================================================
// function : Graphic3d_AspectMarker3d
@@ -38,8 +36,15 @@ Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType,
const Quantity_Color& theColor,
const Standard_Real theScale)
: Aspect_AspectMarker (theColor, theType, theScale)
{}
: myColor (theColor),
myType (theType),
myScale ((float )theScale)
{
if (theScale <= 0.0)
{
Aspect_AspectMarkerDefinitionError::Raise ("Bad value for MarkerScale");
}
}
// =======================================================================
// function : Graphic3d_AspectMarker3d
@@ -49,18 +54,26 @@ Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theCo
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
: Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0),
myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight))
{}
: myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight)),
myColor (theColor),
myType (Aspect_TOM_USERDEFINED),
myScale (1.0f)
{
//
}
// =======================================================================
// function : Graphic3d_AspectMarker3d
// purpose :
// =======================================================================
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage)
: Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0),
myMarkerImage (new Graphic3d_MarkerImage (theTextureImage))
{}
: myMarkerImage (new Graphic3d_MarkerImage (theTextureImage)),
myColor (Quantity_NOC_YELLOW),
myType (Aspect_TOM_USERDEFINED),
myScale (1.0f)
{
//
}
// =======================================================================
// function : GetTextureSize
@@ -80,24 +93,6 @@ void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth,
}
}
// =======================================================================
// function : GetMarkerImage
// purpose :
// =======================================================================
const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const
{
return myMarkerImage;
}
// =======================================================================
// function : SetMarkerImage
// purpose :
// =======================================================================
void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage)
{
myMarkerImage = theImage;
}
// =======================================================================
// function : SetBitMap
// purpose :
@@ -109,21 +104,3 @@ void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth,
myMarkerImage.Nullify();
myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight);
}
// =======================================================================
// function : SetShaderProgram
// purpose :
// =======================================================================
void Graphic3d_AspectMarker3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
{
MyShaderProgram = theProgram;
}
// =======================================================================
// function : ShaderProgram
// purpose :
// =======================================================================
const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectMarker3d::ShaderProgram() const
{
return MyShaderProgram;
}

View File

@@ -16,37 +16,30 @@
#ifndef _Graphic3d_AspectMarker3d_HeaderFile
#define _Graphic3d_AspectMarker3d_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Aspect_AspectMarkerDefinitionError.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Graphic3d_MarkerImage.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Aspect_AspectMarker.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_HArray1OfByte.hxx>
#include <Image_PixMap.hxx>
class Quantity_Color;
#include <Standard.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HArray1OfByte.hxx>
#include <Quantity_ColorRGBA.hxx>
class Graphic3d_AspectMarker3d;
DEFINE_STANDARD_HANDLE(Graphic3d_AspectMarker3d, Aspect_AspectMarker)
//! Creates and updates an attribute group for
//! marker type primitives. This group contains the type
//! of marker, its colour, and its scale factor.
class Graphic3d_AspectMarker3d : public Aspect_AspectMarker
//! Creates and updates an attribute group for marker type primitives.
//! This group contains the type of marker, its color, and its scale factor.
class Graphic3d_AspectMarker3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Standard_Transient)
public:
//! Creates a context table for marker primitives
//! defined with the following default values:
//!
//! Marker type : TOM_X
//! Colour : YELLOW
//! Color : YELLOW
//! Scale factor: 1.0
Standard_EXPORT Graphic3d_AspectMarker3d();
@@ -59,48 +52,82 @@ public:
//! Creates a context table for marker primitives
//! defined with the specified values.
Standard_EXPORT Graphic3d_AspectMarker3d(const Handle(Image_PixMap)& theTextureImage);
//! Return color.
const Quantity_ColorRGBA& ColorRGBA() const { return myColor; }
//! Return the color.
const Quantity_Color& Color() const { return myColor.GetRGB(); }
//! Modifies the color.
void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); }
//! Return scale factor.
Standard_ShortReal Scale() const { return myScale; }
//! Modifies the scale factor.
//! Marker type Aspect_TOM_POINT is not affected by the marker size scale factor.
//! It is always the smallest displayable dot.
//! Warning: Raises AspectMarkerDefinitionError if the scale is a negative value.
void SetScale (const Standard_ShortReal theScale)
{
if (theScale <= 0.0f)
{
Aspect_AspectMarkerDefinitionError::Raise ("Bad value for MarkerScale");
}
myScale = theScale;
}
//! Assign scale factor.
void SetScale (const Standard_Real theScale) { SetScale ((float )theScale); }
//! Return marker type.
Aspect_TypeOfMarker Type() const { return myType; }
//! Modifies the type of marker.
void SetType (const Aspect_TypeOfMarker theType) { myType = theType; }
//! Returns marker's texture size.
Standard_EXPORT void GetTextureSize (Standard_Integer& theWidth, Standard_Integer& theHeight) const;
//! Returns marker's image texture.
//! Could be null handle if marker aspect has been initialized as
//! default type of marker.
Standard_EXPORT const Handle(Graphic3d_MarkerImage)& GetMarkerImage() const;
//! Could be null handle if marker aspect has been initialized as default type of marker.
const Handle(Graphic3d_MarkerImage)& GetMarkerImage() const { return myMarkerImage; }
//! Set marker's image texture.
Standard_EXPORT void SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage);
void SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage) { myMarkerImage = theImage; }
Standard_EXPORT void SetBitMap (const Standard_Integer theWidth, const Standard_Integer theHeight, const Handle(TColStd_HArray1OfByte)& theTexture);
//! Return the program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
Standard_EXPORT void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram);
Standard_EXPORT const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const;
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
public:
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d,Aspect_AspectMarker)
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Aspect_TypeOfMarker& theType,
Standard_Real& theScale) const
{
theColor = myColor.GetRGB();
theType = myType;
theScale = myScale;
}
protected:
Handle(Graphic3d_MarkerImage) myMarkerImage;
private:
Handle(Graphic3d_ShaderProgram) MyShaderProgram;
Handle(Graphic3d_ShaderProgram) myProgram;
Handle(Graphic3d_MarkerImage) myMarkerImage;
Quantity_ColorRGBA myColor;
Aspect_TypeOfMarker myType;
Standard_ShortReal myScale;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectMarker3d, Standard_Transient)
#endif // _Graphic3d_AspectMarker3d_HeaderFile

View File

@@ -13,229 +13,57 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// 30/11/98 ; FMN : S3819. Textes always visible.
//-Version
//-Design Declaration of variables specific to the context
// of trace of texts 3d
//-Warning A context of trace of text is defined by :
// - the font used
// - the color
// - the scale
// - the space between characters
//-References
//-Language C++ 2.0
//-Declarations
// for the class
#include <Font_NameOfFont.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_AspectTextDefinitionError.hxx>
#include <OSD_Environment.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectText3d,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Standard_Transient)
//-Aliases
//-Global data definitions
// -- la font utilisee
// MyFont : NameOfFont;
// -- la couleur
// MyColor : Color;
// -- l'echelle
// MyFactor : Standard_Real;
// -- l'espace entre caracteres
// MySpace : Standard_Real;
// -- le style
// MyStyle : TypeOfStyleText;
// -- le display type
// MyDisplayType : TypeOfDisplayText;
// -- la couleur du sous-titrage et pour le fond en mode decalage.
// MyColorSubTitle : Color;
//-Constructors
//-Destructors
//-Methods, in order
Graphic3d_AspectText3d::Graphic3d_AspectText3d ():
MyFont (Font_NOF_ASCII_MONO), MyColor (Quantity_NOC_YELLOW), MyFactor (1.0), MySpace (0.0), MyStyle (Aspect_TOST_NORMAL), MyDisplayType (Aspect_TODT_NORMAL), MyColorSubTitle (Quantity_NOC_WHITE) {
MyTextZoomable = Standard_False;
MyTextAngle = 0.0;
MyTextFontAspect = Font_FA_Regular;
}
Graphic3d_AspectText3d::Graphic3d_AspectText3d (
const Quantity_Color& AColor,
const Standard_CString AFont,
const Standard_Real AFactor,
const Standard_Real ASpace,
const Aspect_TypeOfStyleText AStyle,
const Aspect_TypeOfDisplayText ADisplayType):
MyFont(AFont), MyColor (AColor), MyFactor (AFactor), MySpace (ASpace), MyStyle (AStyle), MyDisplayType(ADisplayType), MyColorSubTitle (Quantity_NOC_WHITE) {
MyTextZoomable = Standard_False;
MyTextAngle = 0.0;
MyTextFontAspect = Font_FA_Regular;
if(MyFont.Length() == 0)
MyFont.AssignCat(Font_NOF_ASCII_MONO);
if (AFactor <= 0.0)
Graphic3d_AspectTextDefinitionError::Raise
("Bad value for TextScaleFactor");
}
void Graphic3d_AspectText3d::SetColor (const Quantity_Color& AColor) {
MyColor = AColor;
}
void Graphic3d_AspectText3d::SetExpansionFactor (const Standard_Real AFactor) {
if (AFactor <= 0.0)
Graphic3d_AspectTextDefinitionError::Raise
("Bad value for TextScaleFactor");
MyFactor = AFactor;
}
void Graphic3d_AspectText3d::SetFont (const Standard_CString AFont) {
TCollection_AsciiString aTemp("");
if( !strlen(AFont))
aTemp.AssignCat(Font_NOF_ASCII_MONO);
else
aTemp.AssignCat(AFont);
MyFont = aTemp;
}
void Graphic3d_AspectText3d::SetSpace (const Standard_Real ASpace) {
MySpace = ASpace;
}
void Graphic3d_AspectText3d::SetStyle(const Aspect_TypeOfStyleText AStyle) {
MyStyle = AStyle;
}
void Graphic3d_AspectText3d::SetDisplayType(const Aspect_TypeOfDisplayText ADisplayType) {
MyDisplayType = ADisplayType;
}
void Graphic3d_AspectText3d::SetColorSubTitle (const Quantity_Color& AColor) {
MyColorSubTitle = AColor;
}
void Graphic3d_AspectText3d::SetTextZoomable(const Standard_Boolean AFlag)
// =======================================================================
// function : Graphic3d_AspectText3d
// purpose :
// =======================================================================
Graphic3d_AspectText3d::Graphic3d_AspectText3d()
: myFont (Font_NOF_ASCII_MONO),
myColor (Quantity_NOC_YELLOW),
myFactor (1.0),
mySpace (0.0),
myStyle (Aspect_TOST_NORMAL),
myDisplayType (Aspect_TODT_NORMAL),
myColorSubTitle (Quantity_NOC_WHITE),
myTextZoomable (false),
myTextAngle (0.0),
myTextFontAspect(Font_FA_Regular)
{
MyTextZoomable = AFlag;
//
}
Standard_Boolean Graphic3d_AspectText3d::GetTextZoomable() const
// =======================================================================
// function : Graphic3d_AspectText3d
// purpose :
// =======================================================================
Graphic3d_AspectText3d::Graphic3d_AspectText3d (const Quantity_Color& theColor,
const Standard_CString theFont,
const Standard_Real theExpansionFactor,
const Standard_Real theSpace,
const Aspect_TypeOfStyleText theStyle,
const Aspect_TypeOfDisplayText theDisplayType)
: myFont (theFont),
myColor (theColor),
myFactor (theExpansionFactor),
mySpace (theSpace),
myStyle (theStyle),
myDisplayType (theDisplayType),
myColorSubTitle (Quantity_NOC_WHITE),
myTextZoomable (false),
myTextAngle (0.0),
myTextFontAspect(Font_FA_Regular)
{
return MyTextZoomable;
}
void Graphic3d_AspectText3d::SetTextAngle(const Standard_Real AAngle)
{
MyTextAngle = AAngle;
}
Standard_Real Graphic3d_AspectText3d::GetTextAngle() const
{
return MyTextAngle;
}
void Graphic3d_AspectText3d::SetTextFontAspect(const Font_FontAspect AFontAspect)
{
MyTextFontAspect = AFontAspect;
}
Font_FontAspect Graphic3d_AspectText3d::GetTextFontAspect() const
{
return MyTextFontAspect;
}
void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace) const {
AColor = MyColor;
AFont = MyFont.ToCString();
AFactor = MyFactor;
ASpace = MySpace;
}
void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle,Aspect_TypeOfDisplayText& ADisplayType,Quantity_Color& AColorSubTitle) const {
AColor = MyColor;
AFont = MyFont.ToCString();
AFactor = MyFactor;
ASpace = MySpace;
AStyle = MyStyle;
ADisplayType = MyDisplayType;
AColorSubTitle = MyColorSubTitle;
}
void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle,Aspect_TypeOfDisplayText& ADisplayType,Quantity_Color& AColorSubTitle, Standard_Boolean& ATextZoomable,Standard_Real& ATextAngle ) const {
AColor = MyColor;
AFont = MyFont.ToCString();
AFactor = MyFactor;
ASpace = MySpace;
AStyle = MyStyle;
ADisplayType = MyDisplayType;
AColorSubTitle = MyColorSubTitle;
ATextZoomable = MyTextZoomable;
ATextAngle = MyTextAngle;
}
void Graphic3d_AspectText3d::Values ( Quantity_Color& AColor,
Standard_CString& AFont,
Standard_Real& AFactor,
Standard_Real& ASpace,
Aspect_TypeOfStyleText& AStyle,
Aspect_TypeOfDisplayText& ADisplayType,
Quantity_Color& AColorSubTitle,
Standard_Boolean& ATextZoomable,
Standard_Real& ATextAngle,
Font_FontAspect& ATextFontAspect ) const
{
AColor = MyColor;
AFont = MyFont.ToCString();
AFactor = MyFactor;
ASpace = MySpace;
AStyle = MyStyle;
ADisplayType = MyDisplayType;
AColorSubTitle = MyColorSubTitle;
ATextZoomable = MyTextZoomable;
ATextAngle = MyTextAngle;
ATextFontAspect = MyTextFontAspect;
}
void Graphic3d_AspectText3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
{
MyShaderProgram = theProgram;
}
const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectText3d::ShaderProgram() const
{
return MyShaderProgram;
if (myFont.IsEmpty())
{
myFont = Font_NOF_ASCII_MONO;
}
if (theExpansionFactor <= 0.0)
{
Graphic3d_AspectTextDefinitionError::Raise ("Bad value for TextScaleFactor");
}
}

View File

@@ -16,28 +16,22 @@
#ifndef _Graphic3d_AspectText3d_HeaderFile
#define _Graphic3d_AspectText3d_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Real.hxx>
#include <Aspect_TypeOfStyleText.hxx>
#include <Aspect_TypeOfDisplayText.hxx>
#include <Standard_Boolean.hxx>
#include <Font_FontAspect.hxx>
#include <Graphic3d_AspectTextDefinitionError.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Font_FontAspect.hxx>
#include <Font_NameOfFont.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
class Graphic3d_AspectTextDefinitionError;
class Quantity_Color;
class Graphic3d_AspectText3d;
DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, MMgt_TShared)
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <Quantity_ColorRGBA.hxx>
//! Creates and updates a group of attributes for
//! text primitives. This group contains the colour,
//! text primitives. This group contains the color,
//! font, expansion factor (height/width ratio), and
//! inter-character space.
//!
@@ -46,52 +40,91 @@ DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, MMgt_TShared)
//! without copying the string. However, the aspect should not
//! be deleted until the text drawn using this aspect is no longer
//! visible. The best practice is to keep the aspect in the object's drawer.
class Graphic3d_AspectText3d : public MMgt_TShared
class Graphic3d_AspectText3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Standard_Transient)
public:
//! Creates a context table for text primitives
//! defined with the following default values:
//!
//! Colour : NOC_YELLOW
//! Color : NOC_YELLOW
//! Font : NOF_ASCII_MONO
//! Expansion factor : 1.
//! Space between characters : 0.
//! The style : TOST_NORMAL
//! The display type : TODT_NORMAL
Standard_EXPORT Graphic3d_AspectText3d();
//! Creates a context table for text primitives
//! defined with the specified values.
//! AFont may be to take means from User(example "Courier New")
//! or Font name defined in Font_NameOfFont(example Font_NOF_ASCII_MONO)
//! or use default font("Courier")
Standard_EXPORT Graphic3d_AspectText3d(const Quantity_Color& AColor, const Standard_CString AFont, const Standard_Real AExpansionFactor, const Standard_Real ASpace, const Aspect_TypeOfStyleText AStyle = Aspect_TOST_NORMAL, const Aspect_TypeOfDisplayText ADisplayType = Aspect_TODT_NORMAL);
//! Modifies the colour of <me>.
Standard_EXPORT void SetColor (const Quantity_Color& AColor);
Standard_EXPORT Graphic3d_AspectText3d (const Quantity_Color& theColor,
const Standard_CString theFont,
const Standard_Real theExpansionFactor,
const Standard_Real theSpace,
const Aspect_TypeOfStyleText theStyle = Aspect_TOST_NORMAL,
const Aspect_TypeOfDisplayText theDisplayType = Aspect_TODT_NORMAL);
//! Return the text color.
const Quantity_Color& Color() const { return myColor.GetRGB(); }
//! Return the text color.
const Quantity_ColorRGBA& ColorRGBA() const { return myColor; }
//! Modifies the color.
void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); }
//! Modifies the expansion factor (height/width ratio)
//! If the factor is less than 1, the characters will
//! be higher than they are wide.
Standard_EXPORT void SetExpansionFactor (const Standard_Real AFactor);
//! Modifies the font of <me>.
Standard_EXPORT void SetFont (const Standard_CString AFont);
void SetExpansionFactor (const Standard_Real theFactor)
{
if (theFactor <= 0.0)
{
Graphic3d_AspectTextDefinitionError::Raise ("Bad value for TextScaleFactor");
}
myFactor = theFactor;
}
//! Return the font.
const TCollection_AsciiString& Font() const { return myFont; }
//! Modifies the font.
void SetFont (const TCollection_AsciiString& theFont)
{
myFont = !theFont.IsEmpty() ? theFont : TCollection_AsciiString (Font_NOF_ASCII_MONO);
}
//! Modifies the font.
void SetFont (const Standard_CString theFont)
{
SetFont (TCollection_AsciiString (theFont));
}
//! Return the space between characters.
Standard_Real Space() const { return mySpace; }
//! Modifies the space between the characters.
Standard_EXPORT void SetSpace (const Standard_Real ASpace);
void SetSpace (const Standard_Real theSpace) { mySpace = theSpace; }
//! Return the text style.
Aspect_TypeOfStyleText Style() const { return myStyle; }
//! Modifies the style of the text.
//! TOST_NORMAL Default text. The text is displayed like any other graphic object.
//! This text can be hidden by another object that is nearest from the
//! point of view.
//! TOST_ANNOTATION The text is always visible. The texte is displayed
//! over the other object according to the priority.
Standard_EXPORT void SetStyle (const Aspect_TypeOfStyleText AStyle);
//! * TOST_NORMAL
//! Default text. The text is displayed like any other graphic object.
//! This text can be hidden by another object that is nearest from the point of view.
//! * TOST_ANNOTATION
//! The text is always visible.
//! The text is displayed over the other object according to the priority.
void SetStyle (const Aspect_TypeOfStyleText theStyle) { myStyle = theStyle; }
//! Return display type.
Aspect_TypeOfDisplayText DisplayType() const { return myDisplayType; }
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
@@ -99,79 +132,142 @@ public:
//! TODT_DEKALE The text is displayed with a 3D style.
//! TODT_BLEND The text is displayed in XOR.
//! TODT_DIMENSION Dimension line under text will be invisible.
Standard_EXPORT void SetDisplayType (const Aspect_TypeOfDisplayText ADisplayType);
//! Modifies the colour of the subtitle for the TODT_SUBTITLE TextDisplayType
//! and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
Standard_EXPORT void SetColorSubTitle (const Quantity_Color& AColor);
//! Turns usage of text zoomable on/off
Standard_EXPORT void SetTextZoomable (const Standard_Boolean AFlag);
void SetDisplayType (const Aspect_TypeOfDisplayText theDisplayType) { myDisplayType = theDisplayType; }
//! Return subtitle color.
const Quantity_ColorRGBA& ColorSubTitleRGBA() const { return myColorSubTitle; }
//! Return subtitle color.
const Quantity_Color& ColorSubTitle() const { return myColorSubTitle.GetRGB(); }
//! Modifies the color of the subtitle for the TODT_SUBTITLE TextDisplayType
//! and the color of background for the TODT_DEKALE TextDisplayType.
void SetColorSubTitle (const Quantity_Color& theColor) { myColorSubTitle.SetRGB (theColor); }
//! Returns TRUE when the Text Zoomable is on.
Standard_EXPORT Standard_Boolean GetTextZoomable() const;
//! Turns usage of text rotated
Standard_EXPORT void SetTextAngle (const Standard_Real AAngle);
bool GetTextZoomable() const { return myTextZoomable; }
//! Turns usage of text zoomable on/off
void SetTextZoomable (const bool theFlag) { myTextZoomable = theFlag; }
//! Returns Angle of degree
Standard_EXPORT Standard_Real GetTextAngle() const;
//! Turns usage of Aspect text
Standard_EXPORT void SetTextFontAspect (const Font_FontAspect AFontAspect);
Standard_Real GetTextAngle() const { return myTextAngle; }
//! Turns usage of text rotated
void SetTextAngle (const Standard_Real theAngle) { myTextAngle = theAngle; }
//! Returns text FontAspect
Standard_EXPORT Font_FontAspect GetTextFontAspect() const;
Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; }
//! Turns usage of Aspect text
void SetTextFontAspect (const Font_FontAspect theFontAspect) { myTextFontAspect = theFontAspect; }
//! Return the shader program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
Standard_EXPORT void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram);
//! Returns the current values of the group <me>.
Standard_EXPORT void Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AnExpansionFactor, Standard_Real& ASpace) const;
//! Returns the current values of the group <me>.
Standard_EXPORT void Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AnExpansionFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle, Aspect_TypeOfDisplayText& ADisplayType, Quantity_Color& AColorSubTitle) const;
//! Returns the current values of the group <me>.
Standard_EXPORT void Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AnExpansionFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle, Aspect_TypeOfDisplayText& ADisplayType, Quantity_Color& AColorSubTitle, Standard_Boolean& ATextZoomable, Standard_Real& ATextAngle) const;
//! Returns the current values of the group <me>.
Standard_EXPORT void Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AnExpansionFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle, Aspect_TypeOfDisplayText& ADisplayType, Quantity_Color& AColorSubTitle, Standard_Boolean& ATextZoomable, Standard_Real& ATextAngle, Font_FontAspect& ATextFontAspect) const;
Standard_EXPORT const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const;
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
public:
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Standard_CString& theFont,
Standard_Real& theExpansionFactor,
Standard_Real& theSpace) const
{
theColor = myColor.GetRGB();
theFont = myFont.ToCString();
theExpansionFactor = myFactor;
theSpace = mySpace;
}
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Standard_CString& theFont,
Standard_Real& theExpansionFactor,
Standard_Real& theSpace,
Aspect_TypeOfStyleText& theStyle,
Aspect_TypeOfDisplayText& theDisplayType,
Quantity_Color& theColorSubTitle) const
{
theColor = myColor.GetRGB();
theFont = myFont.ToCString();
theExpansionFactor= myFactor;
theSpace = mySpace;
theStyle = myStyle;
theDisplayType = myDisplayType;
theColorSubTitle = myColorSubTitle.GetRGB();
}
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectText3d,MMgt_TShared)
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Standard_CString& theFont,
Standard_Real& theExpansionFactor,
Standard_Real& theSpace,
Aspect_TypeOfStyleText& theStyle,
Aspect_TypeOfDisplayText& theDisplayType,
Quantity_Color& theColorSubTitle,
Standard_Boolean& theTextZoomable,
Standard_Real& theTextAngle) const
{
theColor = myColor.GetRGB();
theFont = myFont.ToCString();
theExpansionFactor= myFactor;
theSpace = mySpace;
theStyle = myStyle;
theDisplayType = myDisplayType;
theColorSubTitle = myColorSubTitle.GetRGB();
theTextZoomable = myTextZoomable;
theTextAngle = myTextAngle;
}
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Standard_CString& theFont,
Standard_Real& theExpansionFactor,
Standard_Real& theSpace,
Aspect_TypeOfStyleText& theStyle,
Aspect_TypeOfDisplayText& theDisplayType,
Quantity_Color& theColorSubTitle,
Standard_Boolean& theTextZoomable,
Standard_Real& theTextAngle,
Font_FontAspect& theTextFontAspect) const
{
theColor = myColor.GetRGB();
theFont = myFont.ToCString();
theExpansionFactor= myFactor;
theSpace = mySpace;
theStyle = myStyle;
theDisplayType = myDisplayType;
theColorSubTitle = myColorSubTitle.GetRGB();
theTextZoomable = myTextZoomable;
theTextAngle = myTextAngle;
theTextFontAspect = myTextFontAspect;
}
protected:
private:
TCollection_AsciiString MyFont;
Quantity_Color MyColor;
Standard_Real MyFactor;
Standard_Real MySpace;
Aspect_TypeOfStyleText MyStyle;
Aspect_TypeOfDisplayText MyDisplayType;
Quantity_Color MyColorSubTitle;
Standard_Boolean MyTextZoomable;
Standard_Real MyTextAngle;
Font_FontAspect MyTextFontAspect;
Handle(Graphic3d_ShaderProgram) MyShaderProgram;
TCollection_AsciiString myFont;
Quantity_ColorRGBA myColor;
Standard_Real myFactor;
Standard_Real mySpace;
Aspect_TypeOfStyleText myStyle;
Aspect_TypeOfDisplayText myDisplayType;
Quantity_ColorRGBA myColorSubTitle;
bool myTextZoomable;
Standard_Real myTextAngle;
Font_FontAspect myTextFontAspect;
Handle(Graphic3d_ShaderProgram) myProgram;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, Standard_Transient)
#endif // _Graphic3d_AspectText3d_HeaderFile

View File

@@ -1,84 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_CAspectFillArea_HeaderFile
#define _Graphic3d_CAspectFillArea_HeaderFile
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectFillArea
{
public:
Graphic3d_CAspectFillArea()
: IsDef (0),
IsSet (0),
Style (0),
LineType (0),
Width (0.0f),
Hatch (0),
Distinguish (0),
BackFace (0),
Edge (0),
PolygonOffsetMode (0),
PolygonOffsetFactor (0.0f),
PolygonOffsetUnits (0.0f)
{
memset (&IntColor, 0, sizeof(IntColor));
memset (&BackIntColor, 0, sizeof(BackIntColor));
memset (&EdgeColor, 0, sizeof(EdgeColor));
memset (&Front, 0, sizeof(Front));
memset (&Back, 0, sizeof(Back));
}
public:
int IsDef;
int IsSet;
int Style;
CALL_DEF_COLOR IntColor;
CALL_DEF_COLOR BackIntColor;
CALL_DEF_COLOR EdgeColor;
int LineType;
float Width;
int Hatch;
int Distinguish;
int BackFace;
int Edge;
CALL_DEF_MATERIAL Front;
CALL_DEF_MATERIAL Back;
Graphic3d_CTexture Texture;
int PolygonOffsetMode;
float PolygonOffsetFactor;
float PolygonOffsetUnits;
Handle(Graphic3d_ShaderProgram) ShaderProgram;
};
typedef Graphic3d_CAspectFillArea CALL_DEF_CONTEXTFILLAREA;
#endif // _Graphic3d_CAspectFillArea_HeaderFile

View File

@@ -1,51 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_CAspectMarker_HeaderFile
#define _Graphic3d_CAspectMarker_HeaderFile
#include <Aspect_TypeOfMarker.hxx>
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_MarkerImage.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectMarker
{
public:
Graphic3d_CAspectMarker()
: IsDef (0),
IsSet (0),
MarkerType (Aspect_TOM_POINT),
Scale (0)
{
memset (&Color, 0, sizeof(Color));
}
public:
Standard_Integer IsDef;
Standard_Integer IsSet;
CALL_DEF_COLOR Color;
Aspect_TypeOfMarker MarkerType;
Standard_ShortReal Scale;
Handle(Graphic3d_MarkerImage) MarkerImage;
Handle(Graphic3d_ShaderProgram) ShaderProgram;
};
typedef Graphic3d_CAspectMarker CALL_DEF_CONTEXTMARKER;
#endif // _Graphic3d_AspectMarker_HeaderFile

View File

@@ -1,44 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_CAspectText_HeaderFile
#define _Graphic3d_CAspectText_HeaderFile
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectText
{
public:
int IsDef;
int IsSet;
const char* Font;
float Space;
float Expan;
CALL_DEF_COLOR Color;
int Style;
int DisplayType;
CALL_DEF_COLOR ColorSubTitle;
int TextZoomable;
float TextAngle;
int TextFontAspect;
Handle(Graphic3d_ShaderProgram) ShaderProgram;
};
typedef Graphic3d_CAspectText CALL_DEF_CONTEXTTEXT;
#endif // _Graphic3d_CAspectText_HeaderFile

View File

@@ -16,7 +16,6 @@
#include <Graphic3d_TypeOfLightSource.hxx>
#include <Graphic3d_Vec.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <NCollection_List.hxx>
//! Light definition

View File

@@ -24,7 +24,6 @@
#include <Graphic3d_TransformPers.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_GraphicDriver;
class Graphic3d_StructureManager;
@@ -119,7 +118,7 @@ public:
int Priority;
int PreviousPriority;
CALL_DEF_COLOR HighlightColor;
Quantity_Color HighlightColor;
Graphic3d_Mat4 Transformation;

View File

@@ -236,10 +236,7 @@ Handle(Graphic3d_AspectFillArea3d) Graphic3d_ClipPlane::CappingAspect() const
anAspect->SetHatchStyle (myHatch);
anAspect->SetInteriorStyle (myHatchOn ? Aspect_IS_HATCH : Aspect_IS_SOLID);
anAspect->SetInteriorColor (myMaterial.Color());
if (!myTexture.IsNull())
anAspect->SetTextureMapOn();
else
anAspect->SetTextureMapOff();
anAspect->SetSuppressBackFaces (false);
anAspect->SetTextureMap (!myTexture.IsNull());
return anAspect;
}

View File

@@ -63,17 +63,7 @@ Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct)
myStructure = theStruct.operator->();
MyContainsFacet = Standard_False,
ContextLine.IsDef = 0;
ContextText.IsDef = 0;
ContextMarker.IsDef = 0;
ContextFillArea.IsDef = 0;
ContextLine.IsSet = 0;
ContextText.IsSet = 0;
ContextMarker.IsSet = 0;
ContextFillArea.IsSet = 0;
MyContainsFacet = Standard_False;
}
// =======================================================================
@@ -87,16 +77,6 @@ void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
return;
}
ContextLine.IsSet = 0,
ContextText.IsSet = 0,
ContextMarker.IsSet = 0,
ContextFillArea.IsSet = 0;
ContextLine.IsDef = 0,
ContextText.IsDef = 0,
ContextMarker.IsDef = 0,
ContextFillArea.IsDef = 0;
myBounds.Clear();
if (MyContainsFacet)
@@ -264,536 +244,6 @@ void Graphic3d_Group::Update() const
myStructure->StructureManager()->Update (myStructure->StructureManager()->UpdateMode());
}
// =======================================================================
// function : SetGroupPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
{
if (IsDeleted())
{
return;
}
Standard_Real aWidth;
Quantity_Color aColor;
Aspect_TypeOfLine aLType;
theAspLine->Values (aColor, aLType, aWidth);
ContextLine.IsDef = 1;
ContextLine.Color.r = float (aColor.Red());
ContextLine.Color.g = float (aColor.Green());
ContextLine.Color.b = float (aColor.Blue());
ContextLine.LineType = aLType;
ContextLine.Width = float (aWidth);
ContextLine.ShaderProgram = theAspLine->ShaderProgram();
UpdateAspectLine (Standard_True);
ContextLine.IsSet = 1;
Update();
}
// =======================================================================
// function : SetGroupPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
{
if (IsDeleted())
{
return;
}
Standard_Real anRGB[3];
Standard_Real aWidth;
Quantity_Color anIntColor;
Quantity_Color aBackIntColor;
Quantity_Color anEdgeColor;
Aspect_TypeOfLine aLType;
Aspect_InteriorStyle aStyle;
theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
ContextFillArea.Style = aStyle;
ContextFillArea.IntColor.r = float (anRGB[0]);
ContextFillArea.IntColor.g = float (anRGB[1]);
ContextFillArea.IntColor.b = float (anRGB[2]);
if (theAspFill->Distinguish())
{
aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
}
ContextFillArea.BackIntColor.r = float (anRGB[0]);
ContextFillArea.BackIntColor.g = float (anRGB[1]);
ContextFillArea.BackIntColor.b = float (anRGB[2]);
// Edges
ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
ContextFillArea.LineType = aLType;
ContextFillArea.Width = float (aWidth);
ContextFillArea.Hatch = theAspFill->HatchStyle();
// Front and Back face
ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
// Back Material
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
// Material properties
ContextFillArea.Back.Shininess = float (aBack.Shininess());
ContextFillArea.Back.Ambient = float (aBack.Ambient());
ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
ContextFillArea.Back.Specular = float (aBack.Specular());
ContextFillArea.Back.Transparency = float (aBack.Transparency());
ContextFillArea.Back.Emission = float (aBack.Emissive());
ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
ContextFillArea.Back.BSDF = aBack.BSDF();
// Reflection mode
ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
// Material type
ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
// Specular color
ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
// Ambient color
ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
// Diffuse color
ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
// Emissive color
ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
// Front Material
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
// Material properties
ContextFillArea.Front.Shininess = float (aFront.Shininess());
ContextFillArea.Front.Ambient = float (aFront.Ambient());
ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
ContextFillArea.Front.Specular = float (aFront.Specular());
ContextFillArea.Front.Transparency = float (aFront.Transparency());
ContextFillArea.Front.Emission = float (aFront.Emissive());
ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
ContextFillArea.Front.BSDF = aFront.BSDF();
// Reflection mode
ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
// Material type
ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
// Specular color
ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
// Ambient color
ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
// Diffuse color
ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
// Emissive color
ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
ContextFillArea.IsDef = 1; // Definition material ok
// Texture map
ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
Standard_Integer aPolyMode;
Standard_ShortReal aPolyFactor, aPolyUnits;
theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
ContextFillArea.PolygonOffsetMode = aPolyMode;
ContextFillArea.PolygonOffsetFactor = aPolyFactor;
ContextFillArea.PolygonOffsetUnits = aPolyUnits;
ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
UpdateAspectFace (Standard_True);
ContextFillArea.IsSet = 1;
Update();
}
// =======================================================================
// function : SetGroupPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
{
if (IsDeleted())
{
return;
}
Standard_Real aScale;
Quantity_Color aColor;
Aspect_TypeOfMarker aMarkerType;
theAspMarker->Values (aColor, aMarkerType, aScale);
ContextMarker.IsDef = 1;
ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
ContextMarker.MarkerType = aMarkerType;
ContextMarker.Scale = Standard_ShortReal (aScale);
ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
UpdateAspectMarker (Standard_True);
ContextMarker.IsSet = 1;
Update();
}
// =======================================================================
// function : SetGroupPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
{
if (IsDeleted())
{
return;
}
Standard_Real anExpansion, aSpace, aTextAngle;
Quantity_Color aColor, aColorSubTitle;
Standard_CString aFont;
Aspect_TypeOfStyleText aStyle;
Aspect_TypeOfDisplayText aDisplayType;
Standard_Boolean isTextZoomable;
Font_FontAspect aTextFontAspect;
theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
aColorSubTitle, isTextZoomable, aTextAngle, aTextFontAspect);
ContextText.IsDef = 1;
ContextText.Color.r = float (aColor.Red());
ContextText.Color.g = float (aColor.Green());
ContextText.Color.b = float (aColor.Blue());
ContextText.Font = (char* )aFont;
ContextText.Expan = float (anExpansion);
ContextText.Space = float (aSpace);
ContextText.Style = aStyle;
ContextText.DisplayType = aDisplayType;
ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
ContextText.TextZoomable = isTextZoomable;
ContextText.TextAngle = float (aTextAngle);
ContextText.TextFontAspect = aTextFontAspect;
ContextText.ShaderProgram = theAspText->ShaderProgram();
UpdateAspectText (Standard_True);
ContextText.IsSet = 1;
Update();
}
// =======================================================================
// function : SetPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
{
if (IsDeleted())
{
return;
}
Standard_Real aWidth;
Quantity_Color aColor;
Aspect_TypeOfLine aLType;
theAspLine->Values (aColor, aLType, aWidth);
ContextLine.IsDef = 1;
ContextLine.Color.r = float (aColor.Red());
ContextLine.Color.g = float (aColor.Green());
ContextLine.Color.b = float (aColor.Blue());
ContextLine.LineType = aLType;
ContextLine.Width = float (aWidth);
ContextLine.ShaderProgram = theAspLine->ShaderProgram();
UpdateAspectLine (Standard_False);
ContextLine.IsSet = 1;
Update();
}
// =======================================================================
// function : SetPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
{
if (IsDeleted())
{
return;
}
Standard_Real anRGB[3];
Standard_Real aWidth;
Quantity_Color anIntColor;
Quantity_Color aBackIntColor;
Quantity_Color anEdgeColor;
Aspect_TypeOfLine aLType;
Aspect_InteriorStyle aStyle;
theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
ContextFillArea.Style = aStyle;
ContextFillArea.IntColor.r = float (anRGB[0]);
ContextFillArea.IntColor.g = float (anRGB[1]);
ContextFillArea.IntColor.b = float (anRGB[2]);
if (theAspFill->Distinguish())
{
aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
}
ContextFillArea.BackIntColor.r = float(anRGB[0]);
ContextFillArea.BackIntColor.g = float(anRGB[1]);
ContextFillArea.BackIntColor.b = float(anRGB[2]);
// Edges
ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
ContextFillArea.LineType = aLType;
ContextFillArea.Width = float (aWidth);
ContextFillArea.Hatch = theAspFill->HatchStyle();
// Front and Back face
ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
// Back Material
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
// Material state
ContextFillArea.Back.Shininess = float (aBack.Shininess());
ContextFillArea.Back.Ambient = float (aBack.Ambient());
ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
ContextFillArea.Back.Specular = float (aBack.Specular());
ContextFillArea.Back.Transparency = float (aBack.Transparency());
ContextFillArea.Back.Emission = float (aBack.Emissive());
// Reflection mode
ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
// Material type
ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
// Specular color
ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
// Ambient color
ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
// Diffuse color
ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
// Emissive color
ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
ContextFillArea.Back.BSDF = aBack.BSDF();
// Front Material
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
// Light specificity
ContextFillArea.Front.Shininess = float (aFront.Shininess());
ContextFillArea.Front.Ambient = float (aFront.Ambient());
ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
ContextFillArea.Front.Specular = float (aFront.Specular());
ContextFillArea.Front.Transparency = float (aFront.Transparency());
ContextFillArea.Front.Emission = float (aFront.Emissive());
// Reflection mode
ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
// Material type
ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
// Specular color
ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
// Ambient color
ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
// Diffuse color
ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
// Emissive color
ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
ContextFillArea.Front.BSDF = aFront.BSDF();
ContextFillArea.IsDef = 1; // Material definition ok
ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
Standard_Integer aPolyMode;
Standard_ShortReal aPolyFactor, aPolyUnits;
theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
ContextFillArea.PolygonOffsetMode = aPolyMode;
ContextFillArea.PolygonOffsetFactor = aPolyFactor;
ContextFillArea.PolygonOffsetUnits = aPolyUnits;
ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
UpdateAspectFace (Standard_False);
ContextFillArea.IsSet = 1;
Update();
}
// =======================================================================
// function : SetPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
{
if (IsDeleted())
{
return;
}
Standard_Real aScale;
Quantity_Color aColor;
Aspect_TypeOfMarker aMarkerType;
theAspMarker->Values (aColor, aMarkerType, aScale);
ContextMarker.IsDef = 1;
ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
ContextMarker.MarkerType = aMarkerType;
ContextMarker.Scale = Standard_ShortReal (aScale);
ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
UpdateAspectMarker (Standard_False);
ContextMarker.IsSet = 1;
Update();
}
// =======================================================================
// function : SetPrimitivesAspect
// purpose :
// =======================================================================
void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
{
if (IsDeleted())
{
return;
}
Standard_CString aFont;
Standard_Real aSpace, anExpansion, aTextAngle;
Quantity_Color aColor, aColorSubTitle;
Aspect_TypeOfStyleText aStyle;
Aspect_TypeOfDisplayText aDisplayType;
Standard_Boolean aTextZoomable;
Font_FontAspect aTextFontAspect;
theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
aColorSubTitle, aTextZoomable, aTextAngle, aTextFontAspect);
ContextText.IsDef = 1;
ContextText.Color.r = float (aColor.Red());
ContextText.Color.g = float (aColor.Green());
ContextText.Color.b = float (aColor.Blue());
ContextText.Font = (char* )aFont;
ContextText.Expan = float (anExpansion);
ContextText.Space = float (aSpace);
ContextText.Style = aStyle;
ContextText.DisplayType = aDisplayType;
ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
ContextText.TextZoomable = aTextZoomable;
ContextText.TextAngle = float (aTextAngle);
ContextText.TextFontAspect = aTextFontAspect;
ContextText.ShaderProgram = theAspText->ShaderProgram();
UpdateAspectText (Standard_False);
ContextText.IsSet = 1;
Update();
}
// =======================================================================
// function : IsGroupPrimitivesAspectSet
// purpose :
@@ -802,10 +252,10 @@ Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_Gr
{
switch (theAspect)
{
case Graphic3d_ASPECT_LINE: return ContextLine.IsSet;
case Graphic3d_ASPECT_TEXT: return ContextText.IsSet;
case Graphic3d_ASPECT_MARKER: return ContextMarker.IsSet;
case Graphic3d_ASPECT_FILL_AREA: return ContextFillArea.IsSet;
case Graphic3d_ASPECT_LINE: return !LineAspect().IsNull();
case Graphic3d_ASPECT_TEXT: return !TextAspect().IsNull();
case Graphic3d_ASPECT_MARKER: return !MarkerAspect().IsNull();
case Graphic3d_ASPECT_FILL_AREA: return !FillAreaAspect().IsNull();
default: return Standard_False;
}
}
@@ -819,154 +269,41 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
{
Quantity_Color aColor;
Graphic3d_MaterialAspect aFront, aBack;
const CALL_DEF_CONTEXTLINE& anAspLine = ContextLine;
aColor.SetValues (Standard_Real (anAspLine.Color.r),
Standard_Real (anAspLine.Color.g),
Standard_Real (anAspLine.Color.b), Quantity_TOC_RGB);
theAspLine->SetColor (aColor);
theAspLine->SetType (Aspect_TypeOfLine (anAspLine.LineType));
theAspLine->SetWidth (Standard_Real (anAspLine.Width));
theAspLine->SetShaderProgram (anAspLine.ShaderProgram);
const CALL_DEF_CONTEXTTEXT& anAspText = ContextText;
aColor.SetValues (Standard_Real (anAspText.Color.r),
Standard_Real (anAspText.Color.g),
Standard_Real (anAspText.Color.b), Quantity_TOC_RGB);
theAspText->SetColor (aColor);
aColor.SetValues (Standard_Real (anAspText.ColorSubTitle.r),
Standard_Real (anAspText.ColorSubTitle.g),
Standard_Real (anAspText.ColorSubTitle.b), Quantity_TOC_RGB);
theAspText->SetColorSubTitle (aColor);
theAspText->SetFont (anAspText.Font);
theAspText->SetSpace (Standard_Real (anAspText.Space));
theAspText->SetExpansionFactor (Standard_Real (anAspText.Expan));
theAspText->SetStyle (Aspect_TypeOfStyleText (anAspText.Style));
theAspText->SetDisplayType (Aspect_TypeOfDisplayText (anAspText.DisplayType));
theAspText->SetShaderProgram (anAspText.ShaderProgram);
const CALL_DEF_CONTEXTMARKER& anAspMarker = ContextMarker;
aColor.SetValues (Standard_Real (anAspMarker.Color.r),
Standard_Real (anAspMarker.Color.g),
Standard_Real (anAspMarker.Color.b), Quantity_TOC_RGB);
theAspMarker->SetColor (aColor);
theAspMarker->SetType (anAspMarker.MarkerType);
theAspMarker->SetScale (Standard_Real (anAspMarker.Scale));
theAspMarker->SetShaderProgram (anAspMarker.ShaderProgram);
if (anAspMarker.MarkerType == Aspect_TOM_USERDEFINED)
if (!theAspLine.IsNull())
{
theAspMarker->SetMarkerImage (ContextMarker.MarkerImage);
Handle(Graphic3d_AspectLine3d) aLineAspect = LineAspect();
if (!aLineAspect.IsNull())
{
*theAspLine.operator->() = *aLineAspect;
}
}
const CALL_DEF_CONTEXTFILLAREA& anAspFill = ContextFillArea;
// Interior
theAspFill->SetInteriorStyle (Aspect_InteriorStyle (anAspFill.Style));
aColor.SetValues (Standard_Real (anAspFill.IntColor.r),
Standard_Real (anAspFill.IntColor.g),
Standard_Real (anAspFill.IntColor.b), Quantity_TOC_RGB);
theAspFill->SetInteriorColor (aColor);
if (!theAspText.IsNull())
{
Handle(Graphic3d_AspectText3d) aTextAspect = TextAspect();
if (!aTextAspect.IsNull())
{
*theAspText.operator->() = *aTextAspect;
}
}
// Edges
aColor.SetValues (Standard_Real (anAspFill.EdgeColor.r),
Standard_Real (anAspFill.EdgeColor.g),
Standard_Real (anAspFill.EdgeColor.b), Quantity_TOC_RGB);
theAspFill->SetEdgeColor (aColor);
theAspFill->SetEdgeLineType (Aspect_TypeOfLine (anAspFill.LineType));
theAspFill->SetEdgeWidth (Standard_Real (anAspFill.Width));
if (!theAspMarker.IsNull())
{
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = MarkerAspect();
if (!aMarkerAspect.IsNull())
{
*theAspMarker.operator->() = *aMarkerAspect;
}
}
// Back Material
aBack.SetShininess (Standard_Real (anAspFill.Back.Shininess));
aBack.SetAmbient (Standard_Real (anAspFill.Back.Ambient));
aBack.SetDiffuse (Standard_Real (anAspFill.Back.Diffuse));
aBack.SetSpecular (Standard_Real (anAspFill.Back.Specular));
aBack.SetTransparency (Standard_Real (anAspFill.Back.Transparency));
aBack.SetEmissive (Standard_Real (anAspFill.Back.Emission));
anAspFill.Back.IsAmbient == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aBack.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
anAspFill.Back.IsDiffuse == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aBack.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
anAspFill.Back.IsSpecular == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aBack.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
anAspFill.Back.IsEmission == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aBack.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aColor.SetValues (Standard_Real (anAspFill.Back.ColorSpec.r),
Standard_Real (anAspFill.Back.ColorSpec.g),
Standard_Real (anAspFill.Back.ColorSpec.b), Quantity_TOC_RGB);
aBack.SetSpecularColor (aColor);
aColor.SetValues (Standard_Real (anAspFill.Back.ColorAmb.r),
Standard_Real (anAspFill.Back.ColorAmb.g),
Standard_Real (anAspFill.Back.ColorAmb.b), Quantity_TOC_RGB);
aBack.SetAmbientColor (aColor);
aColor.SetValues (Standard_Real (anAspFill.Back.ColorDif.r),
Standard_Real (anAspFill.Back.ColorDif.g),
Standard_Real (anAspFill.Back.ColorDif.b), Quantity_TOC_RGB);
aBack.SetDiffuseColor (aColor);
aColor.SetValues (Standard_Real (anAspFill.Back.ColorEms.r),
Standard_Real (anAspFill.Back.ColorEms.g),
Standard_Real (anAspFill.Back.ColorEms.b), Quantity_TOC_RGB);
aBack.SetEmissiveColor (aColor);
aBack.SetEnvReflexion (anAspFill.Back.EnvReflexion);
aBack.SetRefractionIndex (Standard_Real (anAspFill.Back.RefractionIndex));
aBack.SetBSDF (anAspFill.Back.BSDF);
// Front Material
aFront.SetShininess (Standard_Real (anAspFill.Front.Shininess));
aFront.SetAmbient (Standard_Real (anAspFill.Front.Ambient));
aFront.SetDiffuse (Standard_Real (anAspFill.Front.Diffuse));
aFront.SetSpecular (Standard_Real (anAspFill.Front.Specular));
aFront.SetTransparency (Standard_Real (anAspFill.Front.Transparency));
aFront.SetEmissive (Standard_Real (anAspFill.Back.Emission));
anAspFill.Front.IsAmbient == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aFront.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
anAspFill.Front.IsDiffuse == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aFront.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
anAspFill.Front.IsSpecular == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aFront.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
anAspFill.Front.IsEmission == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aFront.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aColor.SetValues (Standard_Real (anAspFill.Front.ColorSpec.r),
Standard_Real (anAspFill.Front.ColorSpec.g),
Standard_Real (anAspFill.Front.ColorSpec.b), Quantity_TOC_RGB);
aFront.SetSpecularColor (aColor);
aColor.SetValues (Standard_Real (anAspFill.Front.ColorAmb.r),
Standard_Real (anAspFill.Front.ColorAmb.g),
Standard_Real (anAspFill.Front.ColorAmb.b), Quantity_TOC_RGB);
aFront.SetAmbientColor (aColor);
aColor.SetValues (Standard_Real (anAspFill.Front.ColorDif.r),
Standard_Real (anAspFill.Front.ColorDif.g),
Standard_Real (anAspFill.Front.ColorDif.b), Quantity_TOC_RGB);
aFront.SetDiffuseColor (aColor);
aColor.SetValues (Standard_Real (anAspFill.Front.ColorEms.r),
Standard_Real (anAspFill.Front.ColorEms.g),
Standard_Real (anAspFill.Front.ColorEms.b), Quantity_TOC_RGB);
aFront.SetEmissiveColor (aColor);
aFront.SetEnvReflexion (anAspFill.Front.EnvReflexion);
aFront.SetRefractionIndex (Standard_Real (anAspFill.Front.RefractionIndex));
aFront.SetBSDF (anAspFill.Front.BSDF);
// Edges
anAspFill.Edge == 1 ? theAspFill->SetEdgeOn() : theAspFill->SetEdgeOff();
// Hatch
theAspFill->SetHatchStyle (Aspect_HatchStyle (anAspFill.Hatch));
// Materials
// Front and Back face
anAspFill.Distinguish == 1 ? theAspFill->SetDistinguishOn() : theAspFill->SetDistinguishOff();
anAspFill.BackFace == 1 ? theAspFill->SuppressBackFace() : theAspFill->AllowBackFace();
// Texture
theAspFill->SetTextureMap (anAspFill.Texture.TextureMap);
anAspFill.Texture.doTextureMap == 1 ? theAspFill->SetTextureMapOn() : theAspFill->SetTextureMapOff();
theAspFill->SetShaderProgram (anAspFill.ShaderProgram);
theAspFill->SetPolygonOffsets (anAspFill.PolygonOffsetMode,
anAspFill.PolygonOffsetFactor,
anAspFill.PolygonOffsetUnits);
theAspFill->SetBackMaterial (aBack);
theAspFill->SetFrontMaterial (aFront);
if (!theAspFill.IsNull())
{
Handle(Graphic3d_AspectFillArea3d) aFillAspect = FillAreaAspect();
if (!aFillAspect.IsNull())
{
*theAspFill.operator->() = *aFillAspect;
}
}
}
// =======================================================================
@@ -1207,39 +544,3 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
Text (aText.ToCString(), thePoint, theHeight, 0.0,
Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
}
// =======================================================================
// function : SetClosed
// purpose :
// =======================================================================
void Graphic3d_Group::SetClosed (const Standard_Boolean theIsClosed)
{
myIsClosed = theIsClosed;
}
// =======================================================================
// function : IsClosed
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_Group::IsClosed() const
{
return myIsClosed;
}
//=======================================================================
//function : BoundingBox
//purpose :
//=======================================================================
const Graphic3d_BndBox4f& Graphic3d_Group::BoundingBox() const
{
return myBounds;
}
//=======================================================================
//function : ChangeBoundingBox
//purpose :
//=======================================================================
Graphic3d_BndBox4f& Graphic3d_Group::ChangeBoundingBox()
{
return myBounds;
}

View File

@@ -24,10 +24,6 @@
#include <Graphic3d_StructurePtr.hxx>
#include <Graphic3d_BndBox4f.hxx>
#include <Standard_Boolean.hxx>
#include <Graphic3d_CAspectLine.hxx>
#include <Graphic3d_CAspectFillArea.hxx>
#include <Graphic3d_CAspectMarker.hxx>
#include <Graphic3d_CAspectText.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
@@ -103,14 +99,6 @@ public:
//! cross-reference);
Standard_EXPORT virtual void Clear (const Standard_Boolean theUpdateStructureMgr = Standard_True);
Standard_EXPORT virtual void UpdateAspectLine (const Standard_Boolean theIsGlobal) = 0;
Standard_EXPORT virtual void UpdateAspectFace (const Standard_Boolean theIsGlobal) = 0;
Standard_EXPORT virtual void UpdateAspectMarker (const Standard_Boolean theIsGlobal) = 0;
Standard_EXPORT virtual void UpdateAspectText (const Standard_Boolean theIsGlobal) = 0;
//! Supress the group <me> in the structure.
Standard_EXPORT void Destroy();
~Graphic3d_Group()
@@ -124,41 +112,49 @@ public:
//! Get the current modelling transform persistence (pan, zoom or rotate)
Standard_EXPORT void Remove();
//! Modifies the context for all the line primitives
//! of the group.
Standard_EXPORT void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX);
//! Return line aspect.
virtual Handle(Graphic3d_AspectLine3d) LineAspect() const = 0;
//! Modifies the context for all the face primitives
//! of the group.
Standard_EXPORT void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX);
//! Assign line aspect to the group.
virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) = 0;
//! Modifies the context for all the text primitives
//! of the group.
Standard_EXPORT void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX);
//! Return fill area aspect.
virtual Handle(Graphic3d_AspectFillArea3d) FillAreaAspect() const = 0;
//! Modifies the context for all the marker primitives
//! of the group.
Standard_EXPORT void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX);
//! Modifies the context for all the face primitives of the group.
virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) = 0;
//! Return text aspect.
virtual Handle(Graphic3d_AspectText3d) TextAspect() const = 0;
//! Modifies the context for all the text primitives of the group.
virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspect) = 0;
//! Return marker aspect.
virtual Handle(Graphic3d_AspectMarker3d) MarkerAspect() const = 0;
//! Modifies the context for all the marker primitives of the group.
virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) = 0;
//! Modifies the current context of the group to give
//! another aspect for all the line primitives created
//! after this call in the group.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX);
virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) = 0;
//! Modifies the current context of the group to give
//! another aspect for all the face primitives created
//! after this call in the group.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX);
virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) = 0;
//! Modifies the current context of the group to give
//! another aspect for all the text primitives created
//! after this call in the group.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX);
virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspect) = 0;
//! Modifies the current context of the group to give
//! another aspect for all the marker primitives created
//! after this call in the group.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX);
virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) = 0;
//! Sets the coordinates of the boundary box of the
//! group <me>.
@@ -283,19 +279,19 @@ public:
Standard_EXPORT void MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const;
//! Returns boundary box of the group <me> without transformation applied,
Standard_EXPORT const Graphic3d_BndBox4f& BoundingBox() const;
const Graphic3d_BndBox4f& BoundingBox() const { return myBounds; }
//! Returns non-const boundary box of the group <me> without transformation applied,
Standard_EXPORT Graphic3d_BndBox4f& ChangeBoundingBox();
Graphic3d_BndBox4f& ChangeBoundingBox() { return myBounds; }
//! Returns the structure containing the group <me>.
Standard_EXPORT Handle(Graphic3d_Structure) Structure() const;
//! Changes property shown that primitive arrays within this group form closed volume (do no contain open shells).
Standard_EXPORT void SetClosed (const Standard_Boolean theIsClosed);
void SetClosed (const bool theIsClosed) { myIsClosed = theIsClosed; }
//! Return true if primitive arrays within this graphic group form closed volume (do no contain open shells).
Standard_EXPORT Standard_Boolean IsClosed() const;
bool IsClosed() const { return myIsClosed; }
friend class Graphic3d_Structure;
@@ -311,14 +307,9 @@ protected:
Graphic3d_CBitFields4 myCBitFields;
Graphic3d_StructurePtr myStructure;
Graphic3d_BndBox4f myBounds;
Standard_Boolean myIsClosed;
Graphic3d_CAspectLine ContextLine;
Graphic3d_CAspectFillArea ContextFillArea;
Graphic3d_CAspectMarker ContextMarker;
Graphic3d_CAspectText ContextText;
bool myIsClosed;
private:
protected:
//! Returns the extreme coordinates found in the group.

View File

@@ -1,5 +1,4 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -12,26 +11,20 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_CAspectLine_HeaderFile
#define _Graphic3d_CAspectLine_HeaderFile
#ifndef _Graphic3d_PolygonOffset_HeaderFile
#define _Graphic3d_PolygonOffset_HeaderFile
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
class Graphic3d_CAspectLine
//! Polygon offset parameters.
struct Graphic3d_PolygonOffset
{
public:
int IsDef;
int IsSet;
CALL_DEF_COLOR Color;
int LineType;
float Width;
Handle(Graphic3d_ShaderProgram) ShaderProgram;
Aspect_PolygonOffsetMode Mode;
Standard_ShortReal Factor;
Standard_ShortReal Units;
//! Empty constructor.
Graphic3d_PolygonOffset() : Mode(Aspect_POM_Fill), Factor (1.0f), Units (0.0f) {}
};
typedef Graphic3d_CAspectLine CALL_DEF_CONTEXTLINE;
#endif // _Graphic3d_CAspectLine_HeaderFile
#endif // _Graphic3d_PolygonOffset_HeaderFile

View File

@@ -1471,23 +1471,18 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const
//=============================================================================
void Graphic3d_Structure::GraphicHighlight (const Aspect_TypeOfHighlightMethod theMethod)
{
Standard_Real anRGB[3];
myCStructure->highlight = 1;
myHighlightMethod = theMethod;
switch (theMethod)
{
case Aspect_TOHM_COLOR:
{
myHighlightColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
myCStructure->HighlightWithColor (Graphic3d_Vec3 (float (anRGB[0]), float (anRGB[1]), float (anRGB[2])), Standard_True);
myCStructure->HighlightWithColor (myHighlightColor, Standard_True);
break;
}
case Aspect_TOHM_BOUNDBOX:
{
myHighlightColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
myCStructure->HighlightColor.r = float (anRGB[0]);
myCStructure->HighlightColor.g = float (anRGB[1]);
myCStructure->HighlightColor.b = float (anRGB[2]);
myCStructure->HighlightColor = myHighlightColor;
myCStructure->HighlightWithBndBox (this, Standard_True);
break;
}

View File

@@ -16,16 +16,19 @@
#ifndef _Graphic3d_Vertex_HeaderFile
#define _Graphic3d_Vertex_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <InterfaceGraphic_telem.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_Real.hxx>
//! This class represents a graphical 3D point.
class Graphic3d_Vertex : public TEL_POINT
class Graphic3d_Vertex
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a point with 0.0, 0.0, 0.0 coordinates.
Graphic3d_Vertex()
{
@@ -106,6 +109,8 @@ public:
//! Returns the distance between two points.
Standard_EXPORT Standard_ShortReal Distance (const Graphic3d_Vertex& theOther) const;
float xyz[3];
};
#endif