mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0023634: Eliminate Polyline and Polygon usage in drawers
Polylines and polygons removed, now everything is based on PrimitiveArrays. Added use of Graphic3d_ArrayOfSegments, some additional clean up in Graphic3d_Group. Dead code elimination in AIS and V3d Corrected compilation errors Fixed grid presentation Adding test case correction
This commit is contained in:
@@ -18,18 +18,13 @@
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#define _POLYGONES_
|
||||
// if define _POLYGONES_ ColorPrsBuilder use ArrayOfPolygons for drawing faces
|
||||
|
||||
#include <MeshVS_ElementalColorPrsBuilder.ixx>
|
||||
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Array1OfVertex.hxx>
|
||||
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
@@ -375,18 +370,14 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
if ( IsPolyG )
|
||||
{
|
||||
aGGroup->SetPrimitivesAspect ( anAsp );
|
||||
aGGroup->BeginPrimitives();
|
||||
aGGroup->AddPrimitiveArray ( aPolyGArr );
|
||||
aGGroup->EndPrimitives();
|
||||
}
|
||||
if ( IsPolyL )
|
||||
{
|
||||
anAsp->SetEdgeOff();
|
||||
aLGroup->SetPrimitivesAspect ( anAsp );
|
||||
aLGroup->SetPrimitivesAspect ( anLAsp );
|
||||
aLGroup->BeginPrimitives();
|
||||
aLGroup->AddPrimitiveArray ( aPolyLArr );
|
||||
aLGroup->EndPrimitives();
|
||||
if (anEdgeOn)
|
||||
anAsp->SetEdgeOn();
|
||||
else
|
||||
@@ -446,10 +437,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
if ( aSize<=0 )
|
||||
continue;
|
||||
|
||||
#ifdef _POLYGONES_
|
||||
Handle (Graphic3d_ArrayOfPolygons) aPolyArr = new Graphic3d_ArrayOfPolygons
|
||||
( aMaxFaceNodes*aSize, aSize, 0, IsReflect );
|
||||
#endif
|
||||
|
||||
MeshVS_TwoColors aTC = aColIter2.Key();
|
||||
Quantity_Color aMyIntColor, aMyBackColor;
|
||||
@@ -469,7 +458,6 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
anAsp->SetEdgeOff();
|
||||
|
||||
aGroup2->SetPrimitivesAspect ( anAsp );
|
||||
aGroup2->BeginPrimitives();
|
||||
|
||||
for( it.Reset(); it.More(); it.Next() )
|
||||
{
|
||||
@@ -491,15 +479,10 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
Standard_Boolean hasNormals = /*IsReflect &&*/
|
||||
aSource->GetNormalsByElement( aKey, IsMeshSmoothShading, aMaxFaceNodes, aNormals );
|
||||
|
||||
#ifdef _POLYGONES_
|
||||
aPolyArr->AddBound ( NbNodes );
|
||||
#else
|
||||
Graphic3d_Array1OfVertex aVertArr ( 1, NbNodes );
|
||||
#endif
|
||||
|
||||
for ( i=1; i<=NbNodes; i++ )
|
||||
{
|
||||
#ifdef _POLYGONES_
|
||||
if ( IsReflect )
|
||||
{
|
||||
hasNormals ? aPolyArr->AddVertex ( aCoords(3 * i - 2),
|
||||
@@ -519,43 +502,11 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
aPolyArr->AddVertex ( aCoords(3*i-2),
|
||||
aCoords(3*i-1),
|
||||
aCoords(3*i ) );
|
||||
#else
|
||||
if ( IsReflect )
|
||||
{
|
||||
aVertArr (i) = hasNormals ? Graphic3d_VertexN( aCoords(3 * i - 2),
|
||||
aCoords(3 * i - 1),
|
||||
aCoords(3 * i ),
|
||||
aNormals->Value(3 * i - 2),
|
||||
aNormals->Value(3 * i - 1),
|
||||
aNormals->Value(3 * i ),
|
||||
Standard_False ) :
|
||||
Graphic3d_VertexN( aCoords(3 * i - 2),
|
||||
aCoords(3 * i - 1),
|
||||
aCoords(3 * i ),
|
||||
0.,
|
||||
0.,
|
||||
1.,
|
||||
Standard_False );
|
||||
|
||||
}
|
||||
else
|
||||
Graphic3d_Vertex ( aCoords(3 * i - 2),
|
||||
aCoords(3 * i - 1),
|
||||
aCoords(3 * i ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef _POLYGONES_
|
||||
aGroup2->Polygon ( aVertArr );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef _POLYGONES_
|
||||
aGroup2->AddPrimitiveArray ( aPolyArr );
|
||||
#endif
|
||||
aGroup2->EndPrimitives();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,8 +24,6 @@
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_Array1OfVertex.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_Array1OfVertex.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
@@ -155,10 +156,7 @@ void MeshVS_MeshPrsBuilder::BuildNodes ( const Handle(Prs3d_Presentation)& Prs,
|
||||
Prs3d_Root::NewGroup ( Prs );
|
||||
Handle (Graphic3d_Group) aNodeGroup = Prs3d_Root::CurrentGroup ( Prs );
|
||||
aNodeGroup->SetPrimitivesAspect ( aNodeMark );
|
||||
|
||||
aNodeGroup->BeginPrimitives();
|
||||
aNodeGroup->MarkerSet ( aNodePoints );
|
||||
aNodeGroup->EndPrimitives();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,14 +345,6 @@ void MeshVS_MeshPrsBuilder::BuildElements( const Handle(Prs3d_Presentation)& Prs
|
||||
// add shading presentation
|
||||
if ( ( IsShading || IsShrink ) && !HasSelectFlag )
|
||||
AddVolumePrs ( aTopo, aCoords, NbNodes, aVolumes, IsReflect, IsShrink, HasSelectFlag, aShrinkCoef );
|
||||
|
||||
/*
|
||||
Handle( Graphic3d_ArrayOfPrimitives ) anArr = aVolumes;
|
||||
if( IsWireFrame || HasSelectFlag )
|
||||
anArr = aPolylines;
|
||||
|
||||
AddVolumePrs ( aTopo, aCoords, NbNodes, anArr, IsReflect, IsShrink, HasSelectFlag, aShrinkCoef );
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -492,26 +482,21 @@ void MeshVS_MeshPrsBuilder::BuildHilightPrs ( const Handle(Prs3d_Presentation)&
|
||||
case MeshVS_ET_Link:
|
||||
{
|
||||
aHilightGroup->SetPrimitivesAspect ( aBeam );
|
||||
aHilightGroup->Polyline ( Graphic3d_Vertex ( aCoords(1), aCoords(2), aCoords(3) ),
|
||||
Graphic3d_Vertex ( aCoords(4), aCoords(5), aCoords(6) ) );
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(aCoords(1),aCoords(2),aCoords(3));
|
||||
aPrims->AddVertex(aCoords(4),aCoords(5),aCoords(6));
|
||||
aHilightGroup->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
break;
|
||||
|
||||
case MeshVS_ET_Face:
|
||||
if ( NbNodes > 0 )
|
||||
{
|
||||
Standard_Real X, Y, Z;
|
||||
aHilightGroup->SetPrimitivesAspect ( aFill );
|
||||
Graphic3d_Array1OfVertex aVArr ( 1, NbNodes );
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolygons) aPrims = new Graphic3d_ArrayOfPolygons(NbNodes);
|
||||
for ( Standard_Integer k=1; k<=NbNodes; k++)
|
||||
{
|
||||
X = aCoords(3*k-2);
|
||||
Y = aCoords(3*k-1);
|
||||
Z = aCoords(3*k);
|
||||
aVArr.SetValue ( k, Graphic3d_Vertex ( X, Y, Z ) );
|
||||
}
|
||||
aHilightGroup->Polygon ( aVArr );
|
||||
aPrims->AddVertex(aCoords(3*k-2),aCoords(3*k-1),aCoords(3*k));
|
||||
aHilightGroup->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -524,21 +509,25 @@ void MeshVS_MeshPrsBuilder::BuildHilightPrs ( const Handle(Prs3d_Presentation)&
|
||||
|
||||
if( aSource->Get3DGeom( ID, NbNodes, aTopo ) )
|
||||
{
|
||||
Standard_Integer low = aTopo->Lower(), up = aTopo->Upper(), i, j, m, ind;
|
||||
for( i=low; i<=up; i++ )
|
||||
const Standard_Integer up = aTopo->Upper();
|
||||
const Standard_Integer lo = aTopo->Lower();
|
||||
Standard_Integer nbnodes = 0, i, j;
|
||||
for( i=lo; i<=up; i++ )
|
||||
nbnodes += aTopo->Value( i ).Length();
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolygons) aPrims = new Graphic3d_ArrayOfPolygons(nbnodes,aTopo->Length());
|
||||
for( i=lo; i<=up; i++ )
|
||||
{
|
||||
const TColStd_SequenceOfInteger& aSeq = aTopo->Value( i );
|
||||
m = aSeq.Length();
|
||||
Graphic3d_Array1OfVertex aVArr( 1, m );
|
||||
const Standard_Integer m = aSeq.Length();
|
||||
aPrims->AddBound(m);
|
||||
for( j=1; j<=m; j++ )
|
||||
{
|
||||
ind = aSeq.Value( j );
|
||||
aVArr.SetValue( j, Graphic3d_Vertex( aCoords( 3*ind+1 ),
|
||||
aCoords( 3*ind+2 ),
|
||||
aCoords( 3*ind+3 ) ) );
|
||||
const Standard_Integer ind = 3*aSeq.Value( j );
|
||||
aPrims->AddVertex(aCoords(ind+1),aCoords(ind+2),aCoords(ind+3));
|
||||
}
|
||||
aHilightGroup->Polygon ( aVArr );
|
||||
}
|
||||
aHilightGroup->AddPrimitiveArray(aPrims);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -933,9 +922,7 @@ void MeshVS_MeshPrsBuilder::DrawArrays( const Handle(Prs3d_Presentation)& Prs,
|
||||
if( IsFacePolygons )
|
||||
{
|
||||
aGroup->SetPrimitivesAspect ( theFillAsp );
|
||||
aGroup->BeginPrimitives ();
|
||||
aGroup->AddPrimitiveArray ( thePolygons );
|
||||
aGroup->EndPrimitives ();
|
||||
}
|
||||
|
||||
if( IsVolumePolygons )
|
||||
@@ -952,9 +939,7 @@ void MeshVS_MeshPrsBuilder::DrawArrays( const Handle(Prs3d_Presentation)& Prs,
|
||||
aCullFillAsp->SuppressBackFace();
|
||||
|
||||
aGroup->SetPrimitivesAspect ( aCullFillAsp );
|
||||
aGroup->BeginPrimitives ();
|
||||
aGroup->AddPrimitiveArray ( theVolumesInShad );
|
||||
aGroup->EndPrimitives ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,9 +957,7 @@ void MeshVS_MeshPrsBuilder::DrawArrays( const Handle(Prs3d_Presentation)& Prs,
|
||||
aLGroup->SetPrimitivesAspect ( new Graphic3d_AspectLine3d
|
||||
( anEdgeColor, Aspect_TOL_SOLID, aWidth ) );
|
||||
}
|
||||
aLGroup->BeginPrimitives ();
|
||||
aLGroup->AddPrimitiveArray ( theLines );
|
||||
aLGroup->EndPrimitives ();
|
||||
theFillAsp->SetEdgeOn();
|
||||
}
|
||||
|
||||
@@ -987,10 +970,7 @@ void MeshVS_MeshPrsBuilder::DrawArrays( const Handle(Prs3d_Presentation)& Prs,
|
||||
if ( !IsSelected )
|
||||
aBeamGroup->SetPrimitivesAspect ( theFillAsp );
|
||||
aBeamGroup->SetPrimitivesAspect ( theLineAsp );
|
||||
|
||||
aBeamGroup->BeginPrimitives();
|
||||
aBeamGroup->AddPrimitiveArray ( theLinkLines );
|
||||
aBeamGroup->EndPrimitives();
|
||||
theFillAsp->SetEdgeOn();
|
||||
}
|
||||
|
||||
@@ -1012,9 +992,7 @@ void MeshVS_MeshPrsBuilder::DrawArrays( const Handle(Prs3d_Presentation)& Prs,
|
||||
if( IsFacePolygons )
|
||||
{
|
||||
aGroup->SetPrimitivesAspect ( theFillAsp );
|
||||
aGroup->BeginPrimitives ();
|
||||
aGroup->AddPrimitiveArray ( thePolygons );
|
||||
aGroup->EndPrimitives ();
|
||||
}
|
||||
|
||||
if( IsVolumePolygons )
|
||||
@@ -1031,9 +1009,7 @@ void MeshVS_MeshPrsBuilder::DrawArrays( const Handle(Prs3d_Presentation)& Prs,
|
||||
aCullFillAsp->SuppressBackFace();
|
||||
|
||||
aGroup->SetPrimitivesAspect ( aCullFillAsp );
|
||||
aGroup->BeginPrimitives ();
|
||||
aGroup->AddPrimitiveArray ( theVolumesInShad );
|
||||
aGroup->EndPrimitives ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,9 +27,7 @@
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Array1OfVertex.hxx>
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
@@ -59,7 +57,6 @@
|
||||
#include <Graphic3d_TypeOfTextureMode.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Graphic3d_Array1OfVertexNT.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <Quantity_Array1OfColor.hxx>
|
||||
#include <Aspect_SequenceOfColor.hxx>
|
||||
@@ -531,9 +528,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
Handle(Graphic3d_Group) aGroup1 = Prs3d_Root::CurrentGroup ( Prs );
|
||||
|
||||
aGroup1->SetPrimitivesAspect( anAsp );
|
||||
aGroup1->BeginPrimitives();
|
||||
aGroup1->AddPrimitiveArray( aCPolyArr );
|
||||
aGroup1->EndPrimitives();
|
||||
|
||||
if (aShowEdges)
|
||||
{
|
||||
@@ -544,9 +539,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
anAsp->SetTextureMapOff();
|
||||
aGroup2->SetPrimitivesAspect( anAsp );
|
||||
aGroup2->SetPrimitivesAspect( anLAsp );
|
||||
aGroup2->BeginPrimitives();
|
||||
aGroup2->AddPrimitiveArray( aPolyL );
|
||||
aGroup2->EndPrimitives();
|
||||
anAsp->SetEdgeOn();
|
||||
}
|
||||
}
|
||||
|
@@ -203,8 +203,6 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
aTextGroup->SetPrimitivesAspect( aTextAspect );
|
||||
aTextGroup->SetPrimitivesAspect( anAspectMarker3d );
|
||||
|
||||
aTextGroup->BeginPrimitives();
|
||||
|
||||
MeshVS_Buffer aCoordsBuf (3*aMaxFaceNodes*sizeof(Standard_Real));
|
||||
TColStd_Array1OfReal aCoords (aCoordsBuf, 1, 3*aMaxFaceNodes);
|
||||
Standard_Integer NbNodes;
|
||||
@@ -270,8 +268,6 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
}
|
||||
}
|
||||
|
||||
aTextGroup->EndPrimitives();
|
||||
|
||||
if (!aCustomElements.IsEmpty())
|
||||
CustomBuild ( Prs, aCustomElements, IDsToExclude, theDisplayMode );
|
||||
}
|
||||
|
@@ -339,10 +339,8 @@ void MeshVS_VectorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
new Graphic3d_AspectLine3d ( aColor, Aspect_TOL_SOLID, 1.5 );
|
||||
|
||||
aVGroup->SetPrimitivesAspect( aLinAspect );
|
||||
|
||||
aVGroup->BeginPrimitives();
|
||||
aVGroup->AddPrimitiveArray( aLineArray );
|
||||
aVGroup->EndPrimitives();
|
||||
|
||||
if ( !myIsSimplePrs )
|
||||
{
|
||||
Graphic3d_MaterialAspect aMatAspect;
|
||||
@@ -356,10 +354,7 @@ void MeshVS_VectorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
1., aMatAspect, aMatAspect );
|
||||
|
||||
aVGroup->SetPrimitivesAspect( aFillAspect );
|
||||
|
||||
aVGroup->BeginPrimitives();
|
||||
aVGroup->AddPrimitiveArray( aTriangleArray );
|
||||
aVGroup->EndPrimitives();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -367,10 +362,7 @@ void MeshVS_VectorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
new Graphic3d_AspectLine3d ( aColor, Aspect_TOL_SOLID, mySimpleWidthPrm * 1.5 );
|
||||
|
||||
aVGroup->SetPrimitivesAspect( anArrowLinAspect );
|
||||
|
||||
aVGroup->BeginPrimitives();
|
||||
aVGroup->AddPrimitiveArray( aArrowLineArray );
|
||||
aVGroup->EndPrimitives();
|
||||
}
|
||||
|
||||
if( !aCustomElements.IsEmpty() )
|
||||
|
Reference in New Issue
Block a user