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

0026885: Visualization - drop redundant aspects from structure level

Graphic3d_CStructure and OpenGl_Structure do not store structure aspects anymore.
Graphic3d_Structure, Prs3d_Presentation - structure aspect methods have been removed.

AIS_InteractiveObject::SetAspect() - globalChange argument has been removed.

Undocumented test methods V3d::DrawSphere(), ::SetPlane(), ::PickGrid() have been removed.
This commit is contained in:
kgv
2016-06-20 19:10:51 +03:00
committed by bugmaster
parent a47d34efa9
commit 2831708b17
29 changed files with 75 additions and 1207 deletions

View File

@@ -2232,7 +2232,7 @@ void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObje
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
const Standard_Boolean theIsGlobalChange,
const Standard_Boolean ,
const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
@@ -2245,7 +2245,7 @@ void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)&
{
isFound = Standard_True;
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
anObj->SetAspect (theAspect, theIsGlobalChange);
anObj->SetAspect (theAspect);
}
if (isFound && theToUpdateViewer)

View File

@@ -850,10 +850,7 @@ public:
//! Sets the graphic basic aspect to the current presentation of
//! ALL selected objects.
//! When <globalChange> is TRUE , the full object presentation
//! is changed.
//! When <globalChange> is FALSE , only the current group
//! of the object presentation is changed.
//! Flag globalChange has no effect (left to simplify porting).
//! Updates the viewer when <updateViewer> is TRUE
Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True, const Standard_Boolean updateViewer = Standard_True);

View File

@@ -483,15 +483,14 @@ Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const
//function : SetAspect
//purpose :
//=======================================================================
void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect,
const Standard_Boolean globalChange) {
void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect)
{
if( HasPresentation() ) {
Handle(Prs3d_Presentation) prs = Presentation();
{ Handle(Prs3d_ShadingAspect) aspect =
Handle(Prs3d_ShadingAspect)::DownCast(anAspect);
if( !aspect.IsNull() ) {
if( globalChange ) prs->SetPrimitivesAspect(aspect->Aspect());
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
return;
}
@@ -499,7 +498,6 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect,
{ Handle(Prs3d_LineAspect) aspect =
Handle(Prs3d_LineAspect)::DownCast(anAspect);
if( !aspect.IsNull() ) {
if( globalChange ) prs->SetPrimitivesAspect(aspect->Aspect());
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
return;
}
@@ -507,7 +505,6 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect,
{ Handle(Prs3d_PointAspect) aspect =
Handle(Prs3d_PointAspect)::DownCast(anAspect);
if( !aspect.IsNull() ) {
if( globalChange ) prs->SetPrimitivesAspect(aspect->Aspect());
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
return;
}
@@ -515,7 +512,6 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect,
{ Handle(Prs3d_TextAspect) aspect =
Handle(Prs3d_TextAspect)::DownCast(anAspect);
if( !aspect.IsNull() ) {
if( globalChange ) prs->SetPrimitivesAspect(aspect->Aspect());
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
return;
}
@@ -543,7 +539,6 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
if ( !aPrs3d.IsNull() ) {
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
if( !aStruct.IsNull() ) {
aStruct->SetPrimitivesAspect( myDrawer->ShadingAspect()->Aspect() );
// Workaround for issue 23115: Need to update also groups, because their
// face aspect ALWAYS overrides the structure's.
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();

View File

@@ -410,13 +410,9 @@ public:
//! Returns the current presentation of this object
//! according to the current DisplayMode()
Standard_EXPORT Handle(Prs3d_Presentation) Presentation() const;
//! Sets the graphic basic aspect to the current presentation.
//! When <globalChange> is TRUE , the full object presentation
//! is changed.
//! When <globalChange> is FALSE , only the current group
//! of the object presentation is changed.
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True);
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect);
//! Sets up polygon offsets for this object.
//! It modifies all existing presentations of <anObj> (if any),

View File

@@ -878,7 +878,16 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
return;
}
aPresentation->Highlight (Aspect_TOHM_COLOR, theColor);
aPresentation->SetShadingAspect (myHighlightAspect);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
aGroupIter.More(); aGroupIter.Next())
{
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
if (!aGrp.IsNull()
&& aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGrp->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
}
}
aPresentation->SetZLayer (Graphic3d_ZLayerId_Topmost);
thePM->AddToImmediateList (aPresentation);

View File

@@ -41,6 +41,9 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloud,AIS_InteractiveObject)
//==================================================
AIS_PointCloud::AIS_PointCloud()
{
// override default point style to Aspect_TOM_POINT
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0));
SetDisplayMode (AIS_PointCloud::DM_Points);
SetHilightMode (AIS_PointCloud::DM_BndBox);
}
@@ -187,12 +190,6 @@ void AIS_PointCloud::SetColor (const Quantity_Color& theColor)
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
// Set aspects for presentation
aPrs->SetPrimitivesAspect (aPointAspect);
aPrs->SetPrimitivesAspect (anAreaAspect);
// Go through all groups to change color for all primitives
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -281,8 +278,6 @@ void AIS_PointCloud::UnsetColor()
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
aPrs->SetPrimitivesAspect (aMarkerAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -346,7 +341,6 @@ void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -401,7 +395,6 @@ void AIS_PointCloud::UnsetMaterial()
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -432,14 +425,9 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
return;
}
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = myDrawer->PointAspect()->Aspect();
if (!myDrawer->HasOwnPointAspect())
{
aMarkerAspect->SetType (Aspect_TOM_POINT);
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
aGroup->SetGroupPrimitivesAspect (aMarkerAspect);
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (aPoints);
break;
}

View File

@@ -544,13 +544,6 @@ void AIS_Shape::SetColor (const Quantity_Color& theColor)
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
// Set aspects for presentation
aPrs->SetPrimitivesAspect (anAreaAspect);
aPrs->SetPrimitivesAspect (aLineAspect);
aPrs->SetPrimitivesAspect (aPointAspect);
// Go through all groups to change color for all primitives
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -677,10 +670,6 @@ void AIS_Shape::UnsetColor()
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
aPrs->SetPrimitivesAspect (aLineAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -878,7 +867,6 @@ void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -941,7 +929,6 @@ void AIS_Shape::UnsetMaterial()
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
@@ -999,7 +986,6 @@ void AIS_Shape::SetTransparency (const Standard_Real theValue)
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
@@ -1048,7 +1034,6 @@ void AIS_Shape::UnsetTransparency()
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
aPrs->SetPrimitivesAspect (anAreaAsp);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();

View File

@@ -237,8 +237,6 @@ void AIS_TexturedShape::UnsetColor()
Quantity_Color aColor;
AIS_GraphicTool::GetInteriorColor (myDrawer->Link(), aColor);
anAreaAsp->SetInteriorColor (aColor);
aPrs->SetPrimitivesAspect (anAreaAsp);
aPrs->SetPrimitivesAspect (aLineAsp);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data

View File

@@ -42,14 +42,4 @@ Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureMana
myGraphicDriver (theManager->GraphicDriver())
{
Id = myGraphicDriver->NewIdentification();
ContextLine.IsDef = 1,
ContextFillArea.IsDef = 1,
ContextMarker.IsDef = 1,
ContextText.IsDef = 1;
ContextLine.IsSet = 0,
ContextFillArea.IsSet = 0,
ContextMarker.IsSet = 0,
ContextText.IsSet = 0;
}

View File

@@ -92,9 +92,6 @@ public:
//! Disconnect other structure to this one
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
//! Synchronize structure aspects
virtual void UpdateAspects() = 0;
//! Synchronize structure transformation
virtual void UpdateTransformation() = 0;
@@ -122,11 +119,6 @@ public:
int Priority;
int PreviousPriority;
CALL_DEF_CONTEXTLINE ContextLine;
CALL_DEF_CONTEXTFILLAREA ContextFillArea;
CALL_DEF_CONTEXTMARKER ContextMarker;
CALL_DEF_CONTEXTTEXT ContextText;
CALL_DEF_COLOR HighlightColor;
Graphic3d_Mat4 Transformation;

View File

@@ -822,7 +822,7 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
Quantity_Color aColor;
Graphic3d_MaterialAspect aFront, aBack;
const CALL_DEF_CONTEXTLINE& anAspLine = ContextLine.IsSet ? ContextLine : myStructure->CStructure()->ContextLine;
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);
@@ -831,7 +831,7 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
theAspLine->SetWidth (Standard_Real (anAspLine.Width));
theAspLine->SetShaderProgram (anAspLine.ShaderProgram);
const CALL_DEF_CONTEXTTEXT& anAspText = ContextText.IsSet ? ContextText : myStructure->CStructure()->ContextText;
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);
@@ -847,7 +847,7 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
theAspText->SetDisplayType (Aspect_TypeOfDisplayText (anAspText.DisplayType));
theAspText->SetShaderProgram (anAspText.ShaderProgram);
const CALL_DEF_CONTEXTMARKER& anAspMarker = ContextMarker.IsSet ? ContextMarker : myStructure->CStructure()->ContextMarker;
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);
@@ -860,7 +860,7 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
theAspMarker->SetMarkerImage (ContextMarker.MarkerImage);
}
const CALL_DEF_CONTEXTFILLAREA& anAspFill = ContextFillArea.IsSet ? ContextFillArea : myStructure->CStructure()->ContextFillArea;
const CALL_DEF_CONTEXTFILLAREA& anAspFill = ContextFillArea;
// Interior
theAspFill->SetInteriorStyle (Aspect_InteriorStyle (anAspFill.Style));
aColor.SetValues (Standard_Real (anAspFill.IntColor.r),

View File

@@ -13,33 +13,28 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_Structure.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Bnd_Box.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_DataStructureManager.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_PriorityDefinitionError.hxx>
#include <Graphic3d_Structure.hxx>
#include "Graphic3d_Structure.pxx"
#include <Graphic3d_StructureDefinitionError.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Graphic3d_TransformError.hxx>
#include <Graphic3d_Vector.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Type.hxx>
#include <TColStd_Array2OfReal.hxx>
#include "Graphic3d_Structure.pxx"
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Structure,MMgt_TShared)
//=============================================================================
@@ -56,17 +51,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
myVisual (Graphic3d_TOS_ALL)
{
myCStructure = theManager->GraphicDriver()->CreateStructure (theManager);
// default aspects
Handle(Graphic3d_AspectLine3d) aAspectLine3d = new Graphic3d_AspectLine3d();
Handle(Graphic3d_AspectText3d) aAspectText3d = new Graphic3d_AspectText3d();
Handle(Graphic3d_AspectMarker3d) aAspectMarker3d = new Graphic3d_AspectMarker3d();
Handle(Graphic3d_AspectFillArea3d) aAspectFillArea3d = new Graphic3d_AspectFillArea3d();
theManager->PrimitivesAspect (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
aAspectFillArea3d->SetPolygonOffsets (Aspect_POM_Fill, 1.0, 0.0);
// update the associated CStructure
UpdateStructure (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
}
//=============================================================================
@@ -84,17 +68,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
myVisual (thePrs->myVisual)
{
myCStructure = thePrs->myCStructure->ShadowLink (theManager);
// default aspects
Handle(Graphic3d_AspectLine3d) aAspectLine3d = new Graphic3d_AspectLine3d();
Handle(Graphic3d_AspectText3d) aAspectText3d = new Graphic3d_AspectText3d();
Handle(Graphic3d_AspectMarker3d) aAspectMarker3d = new Graphic3d_AspectMarker3d();
Handle(Graphic3d_AspectFillArea3d) aAspectFillArea3d = new Graphic3d_AspectFillArea3d();
theManager->PrimitivesAspect (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
aAspectFillArea3d->SetPolygonOffsets (Aspect_POM_Fill, 1.0, 0.0);
// update the associated CStructure
UpdateStructure (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
}
//=============================================================================
@@ -501,21 +474,6 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const
return Standard_True;
}
//=============================================================================
//function : PrimitivesAspect
//purpose :
//=============================================================================
void Graphic3d_Structure::PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& theAspLine,
Handle(Graphic3d_AspectText3d)& theAspText,
Handle(Graphic3d_AspectMarker3d)& theAspMarker,
Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
{
theAspLine = Line3dAspect();
theAspText = Text3dAspect();
theAspMarker = Marker3dAspect();
theAspFill = FillArea3dAspect();
}
//=============================================================================
//function : GroupsWithFacet
//purpose :
@@ -664,229 +622,6 @@ void Graphic3d_Structure::GraphicDisconnect (const Handle(Graphic3d_Structure)&
myCStructure->Disconnect (*theDaughter->myCStructure);
}
//=============================================================================
//function : Line3dAspect
//purpose :
//=============================================================================
Handle(Graphic3d_AspectLine3d) Graphic3d_Structure::Line3dAspect() const
{
const Standard_Real anRGB[3] =
{
Standard_Real (myCStructure->ContextLine.Color.r),
Standard_Real (myCStructure->ContextLine.Color.g),
Standard_Real (myCStructure->ContextLine.Color.b)
};
Quantity_Color aColor;
aColor.SetValues (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
Aspect_TypeOfLine aLType = Aspect_TypeOfLine (myCStructure->ContextLine.LineType);
Standard_Real aWidth = Standard_Real (myCStructure->ContextLine.Width);
Handle(Graphic3d_AspectLine3d) anAspLine = new Graphic3d_AspectLine3d (aColor, aLType, aWidth);
anAspLine->SetShaderProgram (myCStructure->ContextLine.ShaderProgram);
return anAspLine;
}
//=============================================================================
//function : Text3dAspect
//purpose :
//=============================================================================
Handle(Graphic3d_AspectText3d) Graphic3d_Structure::Text3dAspect() const
{
const Standard_Real anRGB[3] =
{
Standard_Real (myCStructure->ContextText.Color.r),
Standard_Real (myCStructure->ContextText.Color.g),
Standard_Real (myCStructure->ContextText.Color.b)
};
Quantity_Color aColor;
aColor.SetValues (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
Standard_CString aFont = Standard_CString (myCStructure->ContextText.Font);
Standard_Real anExpansion = Standard_Real (myCStructure->ContextText.Expan);
Standard_Real aSpace = Standard_Real (myCStructure->ContextText.Space);
Aspect_TypeOfStyleText aStyle = Aspect_TypeOfStyleText (myCStructure->ContextText.Style);
Aspect_TypeOfDisplayText aDispType = Aspect_TypeOfDisplayText (myCStructure->ContextText.DisplayType);
Handle(Graphic3d_AspectText3d) anAspText = new Graphic3d_AspectText3d (aColor, aFont, anExpansion, aSpace, aStyle, aDispType);
anAspText->SetShaderProgram (myCStructure->ContextText.ShaderProgram);
return anAspText;
}
//=============================================================================
//function : Marker3dAspect
//purpose :
//=============================================================================
Handle(Graphic3d_AspectMarker3d) Graphic3d_Structure::Marker3dAspect() const
{
const Standard_Real anRGB[3] =
{
Standard_Real (myCStructure->ContextMarker.Color.r),
Standard_Real (myCStructure->ContextMarker.Color.g),
Standard_Real (myCStructure->ContextMarker.Color.b)
};
Quantity_Color aColor;
aColor.SetValues (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
Aspect_TypeOfMarker aMType = myCStructure->ContextMarker.MarkerType;
Standard_Real aScale = Standard_Real (myCStructure->ContextMarker.Scale);
Handle(Graphic3d_AspectMarker3d) anAspMarker = new Graphic3d_AspectMarker3d (aMType, aColor, aScale);
anAspMarker->SetShaderProgram (myCStructure->ContextMarker.ShaderProgram);
return anAspMarker;
}
//=============================================================================
//function : FillArea3dAspect
//purpose :
//=============================================================================
Handle(Graphic3d_AspectFillArea3d) Graphic3d_Structure::FillArea3dAspect() const
{
// Back Material
Graphic3d_MaterialAspect aBack;
aBack.SetShininess (Standard_Real (myCStructure->ContextFillArea.Back.Shininess));
aBack.SetAmbient (Standard_Real (myCStructure->ContextFillArea.Back.Ambient));
aBack.SetDiffuse (Standard_Real (myCStructure->ContextFillArea.Back.Diffuse));
aBack.SetSpecular (Standard_Real (myCStructure->ContextFillArea.Back.Specular));
aBack.SetTransparency (Standard_Real (myCStructure->ContextFillArea.Back.Transparency));
aBack.SetEmissive (Standard_Real (myCStructure->ContextFillArea.Back.Emission));
if (myCStructure->ContextFillArea.Back.IsAmbient == 1)
aBack.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
else
aBack.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
if (myCStructure->ContextFillArea.Back.IsDiffuse == 1)
aBack.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
else
aBack.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
if (myCStructure->ContextFillArea.Back.IsSpecular == 1)
aBack.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
else
aBack.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
if (myCStructure->ContextFillArea.Back.IsEmission == 1)
aBack.SetReflectionModeOn (Graphic3d_TOR_EMISSION);
else
aBack.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
Quantity_Color aColor (Standard_Real (myCStructure->ContextFillArea.Back.ColorSpec.r),
Standard_Real (myCStructure->ContextFillArea.Back.ColorSpec.g),
Standard_Real (myCStructure->ContextFillArea.Back.ColorSpec.b), Quantity_TOC_RGB);
aBack.SetSpecularColor (aColor);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Back.ColorAmb.r),
Standard_Real (myCStructure->ContextFillArea.Back.ColorAmb.g),
Standard_Real (myCStructure->ContextFillArea.Back.ColorAmb.b), Quantity_TOC_RGB);
aBack.SetAmbientColor (aColor);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Back.ColorDif.r),
Standard_Real (myCStructure->ContextFillArea.Back.ColorDif.g),
Standard_Real (myCStructure->ContextFillArea.Back.ColorDif.b), Quantity_TOC_RGB);
aBack.SetDiffuseColor (aColor);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Back.ColorEms.r),
Standard_Real (myCStructure->ContextFillArea.Back.ColorEms.g),
Standard_Real (myCStructure->ContextFillArea.Back.ColorEms.b), Quantity_TOC_RGB);
aBack.SetEmissiveColor (aColor);
aBack.SetEnvReflexion (myCStructure->ContextFillArea.Back.EnvReflexion);
aBack.SetMaterialType (myCStructure->ContextFillArea.Back.IsPhysic ? Graphic3d_MATERIAL_PHYSIC : Graphic3d_MATERIAL_ASPECT);
aBack.SetRefractionIndex (Standard_Real (myCStructure->ContextFillArea.Back.RefractionIndex));
aBack.SetBSDF (myCStructure->ContextFillArea.Back.BSDF);
// Front Material
Graphic3d_MaterialAspect aFront;
aFront.SetShininess (Standard_Real (myCStructure->ContextFillArea.Front.Shininess));
aFront.SetAmbient (Standard_Real (myCStructure->ContextFillArea.Front.Ambient));
aFront.SetDiffuse (Standard_Real (myCStructure->ContextFillArea.Front.Diffuse));
aFront.SetSpecular (Standard_Real (myCStructure->ContextFillArea.Front.Specular));
aFront.SetTransparency (Standard_Real (myCStructure->ContextFillArea.Front.Transparency));
aFront.SetEmissive (Standard_Real (myCStructure->ContextFillArea.Front.Emission));
if (myCStructure->ContextFillArea.Front.IsAmbient == 1)
aFront.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
else
aFront.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
if (myCStructure->ContextFillArea.Front.IsDiffuse == 1)
aFront.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
else
aFront.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
if (myCStructure->ContextFillArea.Front.IsSpecular == 1)
aFront.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
else
aFront.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
if (myCStructure->ContextFillArea.Front.Emission == 1)
aFront.SetReflectionModeOn (Graphic3d_TOR_EMISSION);
else
aFront.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorSpec.r),
Standard_Real (myCStructure->ContextFillArea.Front.ColorSpec.g),
Standard_Real (myCStructure->ContextFillArea.Front.ColorSpec.b), Quantity_TOC_RGB);
aFront.SetSpecularColor (aColor);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorAmb.r),
Standard_Real (myCStructure->ContextFillArea.Front.ColorAmb.g),
Standard_Real (myCStructure->ContextFillArea.Front.ColorAmb.b), Quantity_TOC_RGB);
aFront.SetAmbientColor (aColor);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorDif.r),
Standard_Real (myCStructure->ContextFillArea.Front.ColorDif.g),
Standard_Real (myCStructure->ContextFillArea.Front.ColorDif.b), Quantity_TOC_RGB);
aFront.SetDiffuseColor (aColor);
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorEms.r),
Standard_Real (myCStructure->ContextFillArea.Front.ColorEms.g),
Standard_Real (myCStructure->ContextFillArea.Front.ColorEms.b), Quantity_TOC_RGB);
aFront.SetEmissiveColor (aColor);
aFront.SetEnvReflexion (myCStructure->ContextFillArea.Front.EnvReflexion);
aFront.SetMaterialType (myCStructure->ContextFillArea.Front.IsPhysic ? Graphic3d_MATERIAL_PHYSIC : Graphic3d_MATERIAL_ASPECT);
aFront.SetRefractionIndex (Standard_Real (myCStructure->ContextFillArea.Front.RefractionIndex));
aFront.SetBSDF (myCStructure->ContextFillArea.Front.BSDF);
Quantity_Color anIntColor (Standard_Real (myCStructure->ContextFillArea.IntColor.r),
Standard_Real (myCStructure->ContextFillArea.IntColor.g),
Standard_Real (myCStructure->ContextFillArea.IntColor.b), Quantity_TOC_RGB);
Quantity_Color anEdgeColor (Standard_Real (myCStructure->ContextFillArea.EdgeColor.r),
Standard_Real (myCStructure->ContextFillArea.EdgeColor.g),
Standard_Real (myCStructure->ContextFillArea.EdgeColor.b), Quantity_TOC_RGB);
Handle(Graphic3d_AspectFillArea3d) anAspFill = new Graphic3d_AspectFillArea3d (Aspect_InteriorStyle (myCStructure->ContextFillArea.Style),
anIntColor, anEdgeColor,
Aspect_TypeOfLine (myCStructure->ContextFillArea.LineType),
Standard_Real (myCStructure->ContextFillArea.Width),
aFront, aBack);
// Edges
if (myCStructure->ContextFillArea.Edge == 1)
anAspFill->SetEdgeOn();
else
anAspFill->SetEdgeOff();
// Hatch
anAspFill->SetHatchStyle (Aspect_HatchStyle (myCStructure->ContextFillArea.Hatch));
// Materials
// Front and Back face
if (myCStructure->ContextFillArea.Distinguish == 1)
anAspFill->SetDistinguishOn();
else
anAspFill->SetDistinguishOff();
if (myCStructure->ContextFillArea.BackFace == 1)
anAspFill->SuppressBackFace();
else
anAspFill->AllowBackFace();
// Texture
anAspFill->SetTextureMap (myCStructure->ContextFillArea.Texture.TextureMap);
if (myCStructure->ContextFillArea.Texture.doTextureMap == 1)
{
anAspFill->SetTextureMapOn();
}
else
{
anAspFill->SetTextureMapOff();
}
anAspFill->SetShaderProgram (myCStructure->ContextFillArea.ShaderProgram);
anAspFill->SetPolygonOffsets (myCStructure->ContextFillArea.PolygonOffsetMode,
myCStructure->ContextFillArea.PolygonOffsetFactor,
myCStructure->ContextFillArea.PolygonOffsetUnits);
return anAspFill;
}
//=============================================================================
//function : Groups
//purpose :
@@ -905,273 +640,6 @@ Standard_Integer Graphic3d_Structure::NumberOfGroups() const
return myCStructure->Groups().Length();
}
//=============================================================================
//function : SetPrimitivesAspect
//purpose :
//=============================================================================
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
{
if (IsDeleted()) return;
Standard_Real aWidth;
Quantity_Color aColor;
Aspect_TypeOfLine aLType;
theAspLine->Values (aColor, aLType, aWidth);
myCStructure->ContextLine.Color.r = float (aColor.Red());
myCStructure->ContextLine.Color.g = float (aColor.Green());
myCStructure->ContextLine.Color.b = float (aColor.Blue());
myCStructure->ContextLine.LineType = int (aLType);
myCStructure->ContextLine.Width = float (aWidth);
myCStructure->ContextLine.ShaderProgram = theAspLine->ShaderProgram();
myCStructure->ContextLine.IsDef = 1;
myCStructure->UpdateAspects();
// Attributes are "IsSet" during the first update of context (line, marker...)
myCStructure->ContextLine.IsSet = 1;
myCStructure->ContextFillArea.IsSet = 1;
myCStructure->ContextMarker.IsSet = 1;
myCStructure->ContextText.IsSet = 1;
Update();
}
//=============================================================================
//function : SetPrimitivesAspect
//purpose :
//=============================================================================
void Graphic3d_Structure::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);
myCStructure->ContextFillArea.Style = aStyle;
myCStructure->ContextFillArea.IntColor.r = float (anRGB[0]);
myCStructure->ContextFillArea.IntColor.g = float (anRGB[1]);
myCStructure->ContextFillArea.IntColor.b = float (anRGB[2]);
if (theAspFill->Distinguish())
{
aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
}
myCStructure->ContextFillArea.BackIntColor.r = float(anRGB[0]);
myCStructure->ContextFillArea.BackIntColor.g = float(anRGB[1]);
myCStructure->ContextFillArea.BackIntColor.b = float(anRGB[2]);
// Edges
myCStructure->ContextFillArea.Edge = theAspFill->Edge () ? 1 : 0;
myCStructure->ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
myCStructure->ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
myCStructure->ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
myCStructure->ContextFillArea.LineType = aLType;
myCStructure->ContextFillArea.Width = float (aWidth);
myCStructure->ContextFillArea.Hatch = theAspFill->HatchStyle();
// Front and Back face
myCStructure->ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
myCStructure->ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
// Back Material
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
// Light specificity
myCStructure->ContextFillArea.Back.Shininess = float (aBack.Shininess());
myCStructure->ContextFillArea.Back.Ambient = float (aBack.Ambient());
myCStructure->ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
myCStructure->ContextFillArea.Back.Specular = float (aBack.Specular());
myCStructure->ContextFillArea.Back.Transparency = float (aBack.Transparency());
myCStructure->ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
myCStructure->ContextFillArea.Back.BSDF = aBack.BSDF();
myCStructure->ContextFillArea.Back.Emission = float (aBack.Emissive());
// Reflection mode
myCStructure->ContextFillArea.Back.IsAmbient = (aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
myCStructure->ContextFillArea.Back.IsDiffuse = (aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
myCStructure->ContextFillArea.Back.IsSpecular = (aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
myCStructure->ContextFillArea.Back.IsEmission = (aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
// Material type
//JR/Hp
myCStructure->ContextFillArea.Back.IsPhysic = (aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0 );
// Specular Color
myCStructure->ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
myCStructure->ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
myCStructure->ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
// Ambient color
myCStructure->ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
myCStructure->ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
myCStructure->ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
// Diffuse color
myCStructure->ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
myCStructure->ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
myCStructure->ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
// Emissive color
myCStructure->ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
myCStructure->ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
myCStructure->ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
myCStructure->ContextFillArea.Back.EnvReflexion =
float ((theAspFill->BackMaterial ()).EnvReflexion());
// Front Material
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
// Light specificity
myCStructure->ContextFillArea.Front.Shininess = float (aFront.Shininess());
myCStructure->ContextFillArea.Front.Ambient = float (aFront.Ambient());
myCStructure->ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
myCStructure->ContextFillArea.Front.Specular = float (aFront.Specular());
myCStructure->ContextFillArea.Front.Transparency = float (aFront.Transparency());
myCStructure->ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
myCStructure->ContextFillArea.Front.BSDF = aFront.BSDF();
myCStructure->ContextFillArea.Front.Emission = float (aFront.Emissive());
// Reflection mode
myCStructure->ContextFillArea.Front.IsAmbient = (aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
myCStructure->ContextFillArea.Front.IsDiffuse = (aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
myCStructure->ContextFillArea.Front.IsSpecular = (aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
myCStructure->ContextFillArea.Front.IsEmission = (aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
// Materail type
//JR/Hp
myCStructure->ContextFillArea.Front.IsPhysic = (aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0);
// Specular Color
myCStructure->ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
myCStructure->ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
myCStructure->ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
// Ambient color
myCStructure->ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
myCStructure->ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
myCStructure->ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
// Diffuse color
myCStructure->ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
myCStructure->ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
myCStructure->ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
// Emissive color
myCStructure->ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
myCStructure->ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
myCStructure->ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
myCStructure->ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
myCStructure->ContextFillArea.IsDef = 1; // Definition material ok
myCStructure->ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
myCStructure->ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
myCStructure->ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
Standard_Integer aPolyMode;
Standard_ShortReal aPolyFactor, aPolyUnits;
theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
myCStructure->ContextFillArea.PolygonOffsetMode = aPolyMode;
myCStructure->ContextFillArea.PolygonOffsetFactor = aPolyFactor;
myCStructure->ContextFillArea.PolygonOffsetUnits = aPolyUnits;
myCStructure->UpdateAspects();
// Attributes are "IsSet" during the first update of context (line, marker...)
myCStructure->ContextLine.IsSet = 1;
myCStructure->ContextFillArea.IsSet = 1;
myCStructure->ContextMarker.IsSet = 1;
myCStructure->ContextText.IsSet = 1;
Update();
}
//=============================================================================
//function : SetPrimitivesAspect
//purpose :
//=============================================================================
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
{
if (IsDeleted()) return;
Standard_CString aFont;
Standard_Real aSpace, anExpansion, aTextAngle;
Quantity_Color aColor, aColorSub;
Aspect_TypeOfStyleText aStyle;
Aspect_TypeOfDisplayText aDispType;
Standard_Boolean isTextZoomable;
Font_FontAspect aTextFontAspect;
theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDispType, aColorSub, isTextZoomable, aTextAngle, aTextFontAspect);
myCStructure->ContextText.Color.r = float (aColor.Red());
myCStructure->ContextText.Color.g = float (aColor.Green());
myCStructure->ContextText.Color.b = float (aColor.Blue());
myCStructure->ContextText.Font = aFont;
myCStructure->ContextText.Expan = float (anExpansion);
myCStructure->ContextText.Space = float (aSpace);
myCStructure->ContextText.Style = aStyle;
myCStructure->ContextText.DisplayType = aDispType;
myCStructure->ContextText.ColorSubTitle.r = float (aColorSub.Red());
myCStructure->ContextText.ColorSubTitle.g = float (aColorSub.Green());
myCStructure->ContextText.ColorSubTitle.b = float (aColorSub.Blue());
myCStructure->ContextText.TextZoomable = isTextZoomable;
myCStructure->ContextText.TextAngle = float (aTextAngle);
myCStructure->ContextText.TextFontAspect = aTextFontAspect;
myCStructure->ContextText.ShaderProgram = theAspText->ShaderProgram();
myCStructure->ContextText.IsDef = 1;
myCStructure->UpdateAspects();
// Attributes are "IsSet" during the first update of a context (line, marker...)
myCStructure->ContextLine.IsSet = 1;
myCStructure->ContextFillArea.IsSet = 1;
myCStructure->ContextMarker.IsSet = 1;
myCStructure->ContextText.IsSet = 1;
Update();
}
//=============================================================================
//function : SetPrimitivesAspect
//purpose :
//=============================================================================
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
{
if (IsDeleted()) return;
Standard_Real aScale;
Quantity_Color aColor;
Aspect_TypeOfMarker aMType;
theAspMarker->Values (aColor, aMType, aScale);
myCStructure->ContextMarker.Color.r = float (aColor.Red());
myCStructure->ContextMarker.Color.g = float (aColor.Green());
myCStructure->ContextMarker.Color.b = float (aColor.Blue());
myCStructure->ContextMarker.MarkerType = aMType;
myCStructure->ContextMarker.Scale = float (aScale);
myCStructure->ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
myCStructure->ContextMarker.IsDef = 1;
myCStructure->UpdateAspects();
// Attributes are "IsSet" during the first update of a context (line, marker...)
myCStructure->ContextLine.IsSet = 1;
myCStructure->ContextFillArea.IsSet = 1;
myCStructure->ContextMarker.IsSet = 1;
myCStructure->ContextText.IsSet = 1;
Update();
}
//=============================================================================
//function : SetVisual
//purpose :
@@ -1997,182 +1465,6 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
}
//=============================================================================
//function : UpdateStructure
//purpose :
//=============================================================================
void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& theAspLine,
const Handle(Graphic3d_AspectText3d)& theAspText,
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
{
Standard_CString aFont;
Standard_Real aSpace, anExpansion, aWidth, aScale;
Quantity_Color aColor, anIntColor, aBackIntColor, anEdgeColor, aColorSub;
Aspect_TypeOfLine aLType;
Aspect_TypeOfMarker aMType;
Aspect_InteriorStyle aStyle;
Aspect_TypeOfStyleText aStyleT;
Aspect_TypeOfDisplayText aDisplayType;
Standard_Boolean aTextZoomable;
Standard_Real aTextAngle;
Font_FontAspect aTextFontAspect;
theAspLine->Values (aColor, aLType, aWidth);
myCStructure->ContextLine.Color.r = float (aColor.Red());
myCStructure->ContextLine.Color.g = float (aColor.Green());
myCStructure->ContextLine.Color.b = float (aColor.Blue());
myCStructure->ContextLine.LineType = aLType;
myCStructure->ContextLine.Width = float (aWidth);
myCStructure->ContextLine.ShaderProgram = theAspLine->ShaderProgram();
theAspMarker->Values (aColor, aMType, aScale);
myCStructure->ContextMarker.Color.r = float (aColor.Red());
myCStructure->ContextMarker.Color.g = float (aColor.Green());
myCStructure->ContextMarker.Color.b = float (aColor.Blue());
myCStructure->ContextMarker.MarkerType = aMType;
myCStructure->ContextMarker.Scale = float (aScale);
myCStructure->ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyleT, aDisplayType, aColorSub, aTextZoomable, aTextAngle, aTextFontAspect);
myCStructure->ContextText.Color.r = float (aColor.Red());
myCStructure->ContextText.Color.g = float (aColor.Green());
myCStructure->ContextText.Color.b = float (aColor.Blue());
myCStructure->ContextText.Font = aFont;
myCStructure->ContextText.Expan = float (anExpansion);
myCStructure->ContextText.Style = aStyleT;
myCStructure->ContextText.DisplayType = aDisplayType;
myCStructure->ContextText.Space = float (aSpace);
myCStructure->ContextText.ColorSubTitle.r = float (aColorSub.Red());
myCStructure->ContextText.ColorSubTitle.g = float (aColorSub.Green());
myCStructure->ContextText.ColorSubTitle.b = float (aColorSub.Blue());
myCStructure->ContextText.TextZoomable = aTextZoomable;
myCStructure->ContextText.TextAngle = float (aTextAngle);
myCStructure->ContextText.TextFontAspect = aTextFontAspect;
myCStructure->ContextText.ShaderProgram = theAspText->ShaderProgram();
Standard_Real anRGB[3];
theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
myCStructure->ContextFillArea.Style = aStyle;
myCStructure->ContextFillArea.IntColor.r = float (anRGB[0]);
myCStructure->ContextFillArea.IntColor.g = float (anRGB[1]);
myCStructure->ContextFillArea.IntColor.b = float (anRGB[2]);
if (theAspFill->Distinguish())
{
aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
}
myCStructure->ContextFillArea.BackIntColor.r = float (anRGB[0]);
myCStructure->ContextFillArea.BackIntColor.g = float (anRGB[1]);
myCStructure->ContextFillArea.BackIntColor.b = float (anRGB[2]);
// Edges
myCStructure->ContextFillArea.Edge = theAspFill->Edge () ? 1:0;
myCStructure->ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
myCStructure->ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
myCStructure->ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
myCStructure->ContextFillArea.LineType = aLType;
myCStructure->ContextFillArea.Width = float (aWidth);
myCStructure->ContextFillArea.Hatch = theAspFill->HatchStyle();
// Front and Back face
myCStructure->ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
myCStructure->ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
// Back Material
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
// Light specificity
myCStructure->ContextFillArea.Back.Shininess = float (aBack.Shininess());
myCStructure->ContextFillArea.Back.Ambient = float (aBack.Ambient());
myCStructure->ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
myCStructure->ContextFillArea.Back.Specular = float (aBack.Specular());
myCStructure->ContextFillArea.Back.Transparency = float (aBack.Transparency());
myCStructure->ContextFillArea.Back.Emission = float (aBack.Emissive());
// Reflection mode
myCStructure->ContextFillArea.Back.IsAmbient = (aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
myCStructure->ContextFillArea.Back.IsDiffuse = (aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
myCStructure->ContextFillArea.Back.IsSpecular = (aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
myCStructure->ContextFillArea.Back.IsEmission = (aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
// Material type
myCStructure->ContextFillArea.Back.IsPhysic = (aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0);
// Specular color
myCStructure->ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
myCStructure->ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
myCStructure->ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
// Ambient color
myCStructure->ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
myCStructure->ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
myCStructure->ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
// Diffuse color
myCStructure->ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
myCStructure->ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
myCStructure->ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
// Emissive color
myCStructure->ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
myCStructure->ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
myCStructure->ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
myCStructure->ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
// Front Material
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
// Light specificity
myCStructure->ContextFillArea.Front.Shininess = float (aFront.Shininess());
myCStructure->ContextFillArea.Front.Ambient = float (aFront.Ambient());
myCStructure->ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
myCStructure->ContextFillArea.Front.Specular = float (aFront.Specular());
myCStructure->ContextFillArea.Front.Transparency = float (aFront.Transparency());
myCStructure->ContextFillArea.Front.Emission = float (aFront.Emissive());
// Reflection mode
myCStructure->ContextFillArea.Front.IsAmbient = (aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
myCStructure->ContextFillArea.Front.IsDiffuse = (aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
myCStructure->ContextFillArea.Front.IsSpecular = (aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
myCStructure->ContextFillArea.Front.IsEmission = (aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
// Material type
myCStructure->ContextFillArea.Front.IsPhysic = (aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0);
// Specular color
myCStructure->ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
myCStructure->ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
myCStructure->ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
// Ambient color
myCStructure->ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
myCStructure->ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
myCStructure->ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
// Diffuse color
myCStructure->ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
myCStructure->ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
myCStructure->ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
// Emissive color
myCStructure->ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
myCStructure->ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
myCStructure->ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
myCStructure->ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
myCStructure->ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
myCStructure->ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
myCStructure->ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
Standard_Integer aPolyMode;
Standard_ShortReal aPolyFactor, aPolyUnits;
theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
myCStructure->ContextFillArea.PolygonOffsetMode = aPolyMode;
myCStructure->ContextFillArea.PolygonOffsetFactor = aPolyFactor;
myCStructure->ContextFillArea.PolygonOffsetUnits = aPolyUnits;
}
//=============================================================================
//function : GraphicHighlight
//purpose :

View File

@@ -49,10 +49,6 @@ class Graphic3d_TransformError;
class Graphic3d_Group;
class Graphic3d_StructureManager;
class Quantity_Color;
class Graphic3d_AspectLine3d;
class Graphic3d_AspectFillArea3d;
class Graphic3d_AspectText3d;
class Graphic3d_AspectMarker3d;
class Graphic3d_DataStructureManager;
class Bnd_Box;
class gp_Pnt;
@@ -78,7 +74,6 @@ public:
//! Creates a graphic object in the manager theManager.
//! It will appear in all the views of the visualiser.
//! Warning: The default values AspectLine, AspectFillArea, AspectText and AspectMarker are NOT applied to the structure.
//! The structure is not displayed when it is created.
Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager);
@@ -172,23 +167,7 @@ public:
//! Get clip planes slicing the structure on rendering.
//! @return set of clip planes.
Standard_EXPORT const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const;
//! Modifies the default attributes for lines
//! in the structure <me>.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX);
//! Modifies the default attributes for faces
//! in the structure <me>.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX);
//! Modifies the default attributes for text
//! in the structure <me>.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX);
//! Modifies the default attributes for markers
//! in the structure <me>.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX);
//! Modifies the visibility indicator to Standard_True or
//! Standard_False for the structure <me>.
//! The default value at the definition of <me> is
@@ -241,10 +220,7 @@ public:
//! Returns Standard_True if the structure <me> contains
//! Polygons, Triangles or Quadrangles.
Standard_EXPORT Standard_Boolean ContainsFacet() const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectFillArea3d) FillArea3dAspect() const;
//! Returns the groups sequence included in the structure <me> (internal storage).
Standard_EXPORT const Graphic3d_SequenceOfGroup& Groups() const;
@@ -285,14 +261,7 @@ public:
//! Returns the visibility indicator for the structure <me>.
Standard_EXPORT Standard_Boolean IsVisible() const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectLine3d) Line3dAspect() const;
//! Returns the current group of graphic attributes used
//! for 3d marker primitives.
Standard_EXPORT Handle(Graphic3d_AspectMarker3d) Marker3dAspect() const;
//! Returns the coordinates of the boundary box of the structure <me>.
//! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical
//! boundaries of the Graphic3d_Group components. Otherwise, the
@@ -303,13 +272,7 @@ public:
//! Warning: If the structure <me> is empty then the empty box is returned,
//! If the structure <me> is infinite then the whole box is returned.
Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
//! Returns the current values of the default attributes.
Standard_EXPORT void PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& CTXL, Handle(Graphic3d_AspectText3d)& CTXT, Handle(Graphic3d_AspectMarker3d)& CTXM, Handle(Graphic3d_AspectFillArea3d)& CTXF) const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectText3d) Text3dAspect() const;
//! Returns the visualisation mode for the structure <me>.
Standard_EXPORT Graphic3d_TypeOfStructure Visual() const;
@@ -535,9 +498,8 @@ private:
//! Calls the Update method of the StructureManager which contains the Structure <me>.
//! If theUpdateLayer is true then invalidates bounding box of ZLayer.
Standard_EXPORT void Update (const bool theUpdateLayer = false) const;
//! Updates the c structure associated to <me>.
Standard_EXPORT void UpdateStructure (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF);
protected:
Handle(Graphic3d_CStructure) myCStructure;
Graphic3d_IndexedMapOfAddress myAncestors;

View File

@@ -120,10 +120,6 @@ public:
// =======================================================================
OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
: Graphic3d_CStructure (theManager),
myAspectLine (NULL),
myAspectFace (NULL),
myAspectMarker (NULL),
myAspectText (NULL),
myHighlightColor (NULL),
myInstancedStructure (NULL),
myIsRaytracable (Standard_False),
@@ -143,25 +139,6 @@ OpenGl_Structure::~OpenGl_Structure()
Release (Handle(OpenGl_Context)());
}
// =======================================================================
// function : UpdateAspects
// purpose :
// =======================================================================
void OpenGl_Structure::UpdateAspects()
{
if (ContextLine.IsDef)
SetAspectLine (ContextLine);
if (ContextFillArea.IsDef)
SetAspectFace (ContextFillArea);
if (ContextMarker.IsDef)
SetAspectMarker (ContextMarker);
if (ContextText.IsDef)
SetAspectText (ContextText);
}
// =======================================================================
// function : UpdateTransformation
// purpose :
@@ -183,63 +160,6 @@ void OpenGl_Structure::UpdateTransformation()
}
}
// =======================================================================
// function : SetAspectLine
// purpose :
// =======================================================================
void OpenGl_Structure::SetAspectLine (const CALL_DEF_CONTEXTLINE &theAspect)
{
if (!myAspectLine)
{
myAspectLine = new OpenGl_AspectLine();
}
myAspectLine->SetAspect (theAspect);
}
// =======================================================================
// function : SetAspectFace
// purpose :
// =======================================================================
void OpenGl_Structure::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theAspect)
{
if (!myAspectFace)
{
myAspectFace = new OpenGl_AspectFace();
}
myAspectFace->SetAspect (theAspect);
if (IsRaytracable())
{
++myModificationState;
}
}
// =======================================================================
// function : SetAspectMarker
// purpose :
// =======================================================================
void OpenGl_Structure::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect)
{
if (!myAspectMarker)
{
myAspectMarker = new OpenGl_AspectMarker();
}
myAspectMarker->SetAspect (theAspect);
}
// =======================================================================
// function : SetAspectText
// purpose :
// =======================================================================
void OpenGl_Structure::SetAspectText (const CALL_DEF_CONTEXTTEXT &theAspect)
{
if (!myAspectText)
{
myAspectText = new OpenGl_AspectText();
}
myAspectText->SetAspect (theAspect);
}
// =======================================================================
// function : clearHighlightBox
// purpose :
@@ -585,22 +505,6 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
const OpenGl_AspectFace *anAspectFace = theWorkspace->AspectFace (Standard_False);
const OpenGl_AspectMarker *anAspectMarker = theWorkspace->AspectMarker (Standard_False);
const OpenGl_AspectText *anAspectText = theWorkspace->AspectText (Standard_False);
if (myAspectLine)
{
theWorkspace->SetAspectLine (myAspectLine);
}
if (myAspectFace)
{
theWorkspace->SetAspectFace (myAspectFace);
}
if (myAspectMarker)
{
theWorkspace->SetAspectMarker (myAspectMarker);
}
if (myAspectText)
{
theWorkspace->SetAspectText (myAspectText);
}
// Apply correction for mirror transform
if (myIsMirrored)
@@ -716,10 +620,6 @@ void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
{
// Release groups
Clear (theGlCtx);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectLine);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectFace);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectMarker);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectText);
clearHighlightColor (theGlCtx);
}
@@ -733,22 +633,6 @@ void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCt
{
aGroupIter.ChangeValue()->Release (theGlCtx);
}
if (myAspectLine != NULL)
{
myAspectLine->Release (theGlCtx.operator->());
}
if (myAspectFace != NULL)
{
myAspectFace->Release (theGlCtx.operator->());
}
if (myAspectMarker != NULL)
{
myAspectMarker->Release (theGlCtx.operator->());
}
if (myAspectText != NULL)
{
myAspectText->Release (theGlCtx.operator->());
}
if (!myHighlightBox.IsNull())
{
myHighlightBox->Release (theGlCtx.operator->());

View File

@@ -78,9 +78,6 @@ public:
//! Disconnect other structure to this one
Standard_EXPORT virtual void Disconnect (Graphic3d_CStructure& theStructure) Standard_OVERRIDE;
//! Synchronize structure aspects
Standard_EXPORT virtual void UpdateAspects() Standard_OVERRIDE;
//! Synchronize structure transformation
Standard_EXPORT virtual void UpdateTransformation() Standard_OVERRIDE;
@@ -115,11 +112,6 @@ public:
return (OpenGl_GraphicDriver* )myGraphicDriver.operator->();
}
void SetAspectLine (const CALL_DEF_CONTEXTLINE &theAspect);
void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theAspect);
void SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect);
void SetAspectText (const CALL_DEF_CONTEXTTEXT &theAspect);
void clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
void setHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
@@ -185,9 +177,6 @@ public:
//! Returns instanced OpenGL structure.
const OpenGl_Structure* InstancedStructure() const { return myInstancedStructure; }
//! Returns OpenGL face aspect.
const OpenGl_AspectFace* AspectFace() const { return myAspectFace; }
//! Returns structure modification state (for ray-tracing).
Standard_Size ModificationState() const { return myModificationState; }
@@ -206,11 +195,6 @@ protected:
protected:
OpenGl_AspectLine* myAspectLine;
OpenGl_AspectFace* myAspectFace;
OpenGl_AspectMarker* myAspectMarker;
OpenGl_AspectText* myAspectText;
Handle(OpenGl_Group) myHighlightBox;
TEL_COLOUR* myHighlightColor;

View File

@@ -404,21 +404,15 @@ Standard_Boolean OpenGl_View::addRaytraceStructure (const OpenGl_Structure*
}
// Get structure material
OpenGl_RaytraceMaterial aStructMaterial;
if (theStructure->AspectFace() != NULL)
{
aStructMaterial = convertMaterial (theStructure->AspectFace(), theGlContext);
}
Standard_Boolean aResult = addRaytraceGroups (theStructure, aStructMaterial, &theStructure->Transformation, theGlContext);
OpenGl_RaytraceMaterial aDefaultMaterial;
Standard_Boolean aResult = addRaytraceGroups (theStructure, aDefaultMaterial, &theStructure->Transformation, theGlContext);
// Process all connected OpenGL structures
const OpenGl_Structure* anInstanced = theStructure->InstancedStructure();
if (anInstanced != NULL && anInstanced->IsRaytracable())
{
aResult &= addRaytraceGroups (anInstanced, aStructMaterial, &theStructure->Transformation, theGlContext);
aResult &= addRaytraceGroups (anInstanced, aDefaultMaterial, &theStructure->Transformation, theGlContext);
}
myStructureStates[theStructure] = StructState (theStructure);

View File

@@ -56,6 +56,7 @@ namespace
static const OpenGl_AspectLine myDefaultAspectLine;
static const OpenGl_AspectFace myDefaultAspectFace;
static const OpenGl_AspectMarker myDefaultAspectMarker;
static const OpenGl_AspectText myDefaultAspectText;
static const OpenGl_Matrix myDefaultMatrix =
{
@@ -153,6 +154,8 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi
AspectFace_applied (NULL),
AspectMarker_set (&myDefaultAspectMarker),
AspectMarker_applied (NULL),
AspectText_set (&myDefaultAspectText),
AspectText_applied (NULL),
ViewMatrix_applied (&myDefaultMatrix),
StructureMatrix_applied (&myDefaultMatrix),
myCullingMode (TelCullUndefined),
@@ -245,6 +248,9 @@ void OpenGl_Workspace::ResetAppliedAspect()
AspectFace_applied = NULL;
AspectMarker_set = &myDefaultAspectMarker;
AspectMarker_applied = NULL;
AspectText_set = &myDefaultAspectText;
AspectText_applied = NULL;
PolygonOffset_applied = THE_DEFAULT_POFFSET;
myCullingMode = TelCullUndefined;

View File

@@ -12,27 +12,20 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Modified: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets
#include <Prs3d_Presentation.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Geom_Transformation.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_DataStructureManager.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_NameOfMaterial.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <TColStd_Array2OfReal.hxx>
@@ -66,20 +59,6 @@ Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)
{
return;
}
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
Quantity_Color aColor = aMat.AmbientColor();
// It is necessary to set default polygon offsets for a new presentation
Handle(Graphic3d_AspectFillArea3d) aDefAspect =
new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID,
aColor,
aColor,
Aspect_TOL_SOLID,
1.0,
Graphic3d_NOM_BRASS,
Graphic3d_NOM_BRASS);
aDefAspect->SetPolygonOffsets (Aspect_POM_Fill, 1.0f, 0.0f);
SetPrimitivesAspect (aDefAspect);
}
//=======================================================================
@@ -90,28 +69,7 @@ Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)
const Handle(Prs3d_Presentation)& thePrs)
: Graphic3d_Structure (theViewer, thePrs)
{
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
Quantity_Color aColor = aMat.AmbientColor();
// It is necessary to set default polygon offsets for a new presentation
Handle(Graphic3d_AspectFillArea3d) aDefAspect =
new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID,
aColor,
aColor,
Aspect_TOL_SOLID,
1.0,
Graphic3d_NOM_BRASS,
Graphic3d_NOM_BRASS);
aDefAspect->SetPolygonOffsets (Aspect_POM_Fill, 1.0f, 0.0f);
SetPrimitivesAspect (aDefAspect);
}
//=======================================================================
//function : SetShadingAspect
//purpose :
//=======================================================================
void Prs3d_Presentation::SetShadingAspect(const Handle(Prs3d_ShadingAspect)& aShadingAspect)
{
SetPrimitivesAspect(aShadingAspect->Aspect());
//
}
//=======================================================================

View File

@@ -28,7 +28,6 @@ class Prs3d_Root;
class Graphic3d_StructureManager;
class Graphic3d_Structure;
class Graphic3d_DataStructureManager;
class Prs3d_ShadingAspect;
class Geom_Transformation;
class Graphic3d_Group;
@@ -68,9 +67,7 @@ public:
//! Returns the new Structure defined for the new visualization
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix, Handle(Graphic3d_Structure)& aStructure) Standard_OVERRIDE;
Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& aShadingAspect);
Standard_EXPORT void Transform (const Handle(Geom_Transformation)& aTransformation);
Standard_EXPORT void Place (const Quantity_Length X, const Quantity_Length Y, const Quantity_Length Z);

View File

@@ -12,6 +12,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <PrsMgr_Presentation.hxx>
#include <Geom_Transformation.hxx>
#include <Graphic3d_DataStructureManager.hxx>
@@ -19,10 +20,8 @@
#include <Precision.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <PrsMgr_Presentation.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <PrsMgr_Prs.hxx>
#include <Quantity_Color.hxx>
@@ -266,15 +265,6 @@ void PrsMgr_Presentation::Move (const Quantity_Length theX,
myStructure->Move (theX, theY, theZ);
}
//=======================================================================
//function : SetShadingAspect
//purpose :
//=======================================================================
void PrsMgr_Presentation::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theShadingAspect) const
{
myStructure->SetShadingAspect (theShadingAspect);
}
//=======================================================================
//function : Compute
//purpose : Methods for hidden parts...

View File

@@ -31,7 +31,6 @@ class PrsMgr_Prs;
class PrsMgr_PresentableObject;
class Quantity_Color;
class Geom_Transformation;
class Prs3d_ShadingAspect;
class Prs3d_Presentation;
class Graphic3d_Structure;
class Graphic3d_DataStructureManager;
@@ -117,9 +116,7 @@ private:
Standard_EXPORT void Multiply (const Handle(Geom_Transformation)& theTrsf) const;
Standard_EXPORT void Move (const Quantity_Length theX, const Quantity_Length theY, const Quantity_Length theZ) const;
Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theShadingAspect) const;
Standard_EXPORT void Compute (const Handle(Graphic3d_Structure)& theStructure);
Standard_EXPORT Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector);
@@ -132,6 +129,8 @@ private:
Standard_EXPORT static Handle(Prs3d_Projector) Projector (const Handle(Graphic3d_DataStructureManager)& theProjector);
protected:
Handle(PrsMgr_PresentationManager) myPresentationManager;
Handle(Prs3d_Presentation) myStructure;
PrsMgr_PresentableObjectPointer myPresentableObject;

View File

@@ -17,7 +17,6 @@
#include <Graphic3d_GraphicDriver.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_PresentationShadow.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <PrsMgr_Presentation.hxx>
@@ -641,36 +640,6 @@ void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject
aPrs->Highlight (Aspect_TOHM_BOUNDBOX, mySelectionColor);
}
// =======================================================================
// function : SetShadingAspect
// purpose :
// =======================================================================
void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject,
const Quantity_NameOfColor theColor,
const Graphic3d_NameOfMaterial theMaterial,
const Standard_Integer theMode)
{
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
anAspect->SetColor (theColor);
anAspect->SetMaterial (theMaterial);
SetShadingAspect (thePrsObject, anAspect, theMode);
}
// =======================================================================
// function : SetShadingAspect
// purpose :
// =======================================================================
void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObj,
const Handle(Prs3d_ShadingAspect)& theShadingAspect,
const Standard_Integer theMode)
{
const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
if (!aPrs.IsNull())
{
aPrs->SetShadingAspect (theShadingAspect);
}
}
namespace
{
// =======================================================================

View File

@@ -31,7 +31,6 @@
class Geom_Transformation;
class Prs3d_Presentation;
class Prs3d_ShadingAspect;
class PrsMgr_PresentableObject;
class PrsMgr_Presentation;
class Standard_NoSuchObject;
@@ -145,14 +144,8 @@ public:
Standard_EXPORT void Transform (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(Geom_Transformation)& theTransformation, const Standard_Integer theMode = 0);
//! Returns the structure manager.
const Handle(Graphic3d_StructureManager)& StructureManager() const;
//! this method will change the color and the aspect of the presentations containing shaded structures.
Standard_EXPORT void SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Quantity_NameOfColor theColor, const Graphic3d_NameOfMaterial theMaterial, const Standard_Integer theMode = 0);
//! this method will change the color and the aspect of the presentations containing shaded structures.
Standard_EXPORT void SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(Prs3d_ShadingAspect)& theShadingAspect, const Standard_Integer theMode = 0);
const Handle(Graphic3d_StructureManager)& StructureManager() const;
//! Returns true if there is a presentation of the
//! presentable object thePrsObject in this framework, thePrsObject having the display mode theMode.
Standard_EXPORT Standard_Boolean HasPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0) const;

View File

@@ -232,109 +232,3 @@ void V3d::SwitchViewsinWindow(const Handle(V3d_View)& aPreviousView,
aNextView->Viewer()->SetViewOn(aNextView);
}
void V3d::DrawSphere(const Handle(V3d_Viewer)& aViewer,const Quantity_Length ray)
{
const Standard_Boolean inf = ray < 0;
const Standard_Real aRadius = Standard_ShortReal(Abs(ray));
Handle(Graphic3d_Structure) Struct = new Graphic3d_Structure(aViewer->StructureManager());
Handle(Graphic3d_Group) Group = Struct->NewGroup();
Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d() ;
LineAttrib->SetColor(Quantity_Color(Quantity_NOC_YELLOW));
Struct->SetPrimitivesAspect(LineAttrib) ;
const Standard_Integer NFACES = 30;
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NFACES*(NFACES+1),NFACES);
const Standard_Real Dbeta = 2. * M_PI / NFACES;
const Standard_Real Dalpha = 2. * M_PI / NFACES;
Standard_ShortReal X,Y,Z,X0 = 0.,Y0 = 0.,Z0 = 0.;
Standard_Real R, Alpha, Beta = 0.;
Standard_Integer i,j ;
for( j=0; j<NFACES/2 ; j++, Beta += Dbeta ) {
aPrims->AddBound(NFACES+1);
R = aRadius*sin(Beta);
Z = Standard_ShortReal(aRadius*cos(Beta));
for( i=0, Alpha = 0.; i<NFACES; i++, Alpha += Dalpha ) {
X = Standard_ShortReal(R*cos(Alpha));
Y = Standard_ShortReal(R*sin(Alpha));
aPrims->AddVertex(X,Y,Z);
if (i==0) { X0=X, Y0=Y, Z0=Z; }
}
aPrims->AddVertex(X0,Y0,Z0);
}
for( j=0; j<NFACES/2 ; j++, Beta += Dbeta ) {
aPrims->AddBound(NFACES+1);
R = aRadius*sin(Beta);
Y = Standard_ShortReal(aRadius*cos(Beta));
Beta += Dbeta ;
for( i=0, Alpha = 0.; i<NFACES; i++, Alpha += Dalpha ) {
X = Standard_ShortReal(R*cos(Alpha));
Z = Standard_ShortReal(R*sin(Alpha));
aPrims->AddVertex(X,Y,Z);
if (i==0) { X0=X, Y0=Y, Z0=Z; }
}
aPrims->AddVertex(X0,Y0,Z0);
}
Group->AddPrimitiveArray(aPrims);
if(inf) Struct->SetInfiniteState(Standard_True);
Struct->Display();
aViewer->Update();
}
void V3d::SetPlane(const Handle(V3d_Viewer)& aViewer,
const Standard_Real x1,
const Standard_Real y1,
const Standard_Real z1,
const Standard_Real x2,
const Standard_Real y2,
const Standard_Real z2) {
gp_Ax3 a(gp_Pnt(0.,0.,0),gp_Dir(x1,y1,z1),gp_Dir(x2,y2,z2));
aViewer->SetPrivilegedPlane(a);
}
void V3d::PickGrid(const Handle(V3d_Viewer)& aViewer,
// const Quantity_Length ray) {
const Quantity_Length ) {
Standard_Real x1, y1, z1;
Standard_Real x2, y2, z2;
cout << "Direction ? " << flush;
cin >> x1; cin >> y1; cin >> z1;
cout << "XDirection ? " << flush;
cin >> x2; cin >> y2; cin >> z2;
Standard_Integer u, v;
cout << "u, v ? " << flush;
cin >> u; cin >> v;
V3d::SetPlane (aViewer, x1, y1, z1, x2, y2, z2);
// To restart the calculation on the new plane
if (aViewer->Grid ()->IsActive ()) {
Standard_Real xo, yo;
Quantity_PlaneAngle angle;
switch (aViewer->GridType ()) {
case Aspect_GT_Rectangular :
Standard_Real xstep, ystep;
aViewer->RectangularGridValues
(xo, yo, xstep, ystep, angle);
aViewer->SetRectangularGridValues
(xo, yo, xstep, ystep, angle);
break;
case Aspect_GT_Circular :
Standard_Real radiusstep;
Standard_Integer division;
aViewer->CircularGridValues
(xo, yo, radiusstep, division, angle);
aViewer->SetCircularGridValues
(xo, yo, radiusstep, division, angle);
break;
}
}
for (aViewer->InitActiveViews ();
aViewer->MoreActiveViews ();
aViewer->NextActiveViews()) {
Standard_Real X, Y, Z;
aViewer->ActiveView ()->Convert (u, v, X, Y, Z);
}
}

View File

@@ -72,29 +72,6 @@ public:
Standard_EXPORT static void CircleInPlane (const Handle(Graphic3d_Group)& gcircle, const V3d_Coordinate X0, const V3d_Coordinate Y0, const V3d_Coordinate Z0, const V3d_Parameter VX, const V3d_Parameter VY, const V3d_Parameter VZ, const V3d_Parameter Radius);
Standard_EXPORT static void SwitchViewsinWindow (const Handle(V3d_View)& aPreviousView, const Handle(V3d_View)& aNextView);
//! test.
Standard_EXPORT static void DrawSphere (const Handle(V3d_Viewer)& aViewer, const Quantity_Length aRadius = 1000);
//! test.
Standard_EXPORT static void PickGrid (const Handle(V3d_Viewer)& aViewer, const Quantity_Length aRadius = 1000);
//! test.
Standard_EXPORT static void SetPlane (const Handle(V3d_Viewer)& aViewer, const Quantity_Length x1, const Quantity_Length y1, const Quantity_Length z1, const Quantity_Length x2, const Quantity_Length y2, const Quantity_Length z2);
protected:
private:
friend class V3d_Viewer;
friend class V3d_View;

View File

@@ -72,7 +72,7 @@ void V3d_Plane::Display (const Handle(V3d_View)& theView,
anAsp->SetFrontMaterial (aPlastic);
anAsp->SetInteriorStyle (Aspect_IS_HATCH);
anAsp->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
myGraphicStructure->SetPrimitivesAspect (anAsp);
aGroup->SetGroupPrimitivesAspect (anAsp);
const Standard_ShortReal aSize = (Standard_ShortReal)(0.5*aViewer->DefaultViewSize());
const Standard_ShortReal anOffset = aSize/5000.0f;

View File

@@ -3562,6 +3562,8 @@ void MyPArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPre
{
Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect);
}
Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (anArray);
}

View File

@@ -36,6 +36,7 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Select3D_SensitiveCurve.hxx>
#include <SelectMgr_EntityOwner.hxx>
@@ -129,6 +130,7 @@ void VUserDrawObj::Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr
Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast (thePrs->NewGroup());
aGroup->SetMinMaxValues (aBndMin.x(), aBndMin.y(), aBndMin.z(),
aBndMax.x(), aBndMax.y(), aBndMax.z());
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
VUserDrawObj::Element* anElem = new VUserDrawObj::Element (this);
aGroup->AddElement(anElem);