1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +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

@@ -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");
}
}