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:
@@ -266,21 +266,21 @@ void AIS_InteractiveObject::UnsetWidth()
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//function : SetMaterial
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetMaterial(const Graphic3d_NameOfMaterial aName)
|
||||
void AIS_InteractiveObject::SetMaterial (const Graphic3d_NameOfMaterial theName)
|
||||
{
|
||||
if( HasColor() || IsTransparent() || HasMaterial() )
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetMaterial(aName);
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
myDrawer->ShadingAspect()->SetMaterial(aName);
|
||||
}
|
||||
myOwnMaterial = aName;
|
||||
myDrawer->ShadingAspect()->SetMaterial (theName);
|
||||
myOwnMaterial = theName;
|
||||
hasOwnMaterial = Standard_True;
|
||||
}
|
||||
|
||||
@@ -290,13 +290,15 @@ void AIS_InteractiveObject::SetMaterial(const Graphic3d_NameOfMaterial aName)
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
{
|
||||
if (!HasColor() && !IsTransparent() && !HasMaterial())
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect);
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
myDrawer->ShadingAspect()->SetMaterial (theMaterial);
|
||||
|
||||
hasOwnMaterial = Standard_True;
|
||||
}
|
||||
|
||||
@@ -343,7 +345,7 @@ void AIS_InteractiveObject::UnsetMaterial()
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetTransparency(const Standard_Real aValue)
|
||||
{
|
||||
if(!HasColor() && !IsTransparent() && !HasMaterial())
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
if(myDrawer->HasLink())
|
||||
|
Reference in New Issue
Block a user