From a577aaabf9400029fd0971b61b761a1bbc1704e7 Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 30 Aug 2013 20:37:02 +0400 Subject: [PATCH] 0024131: TKOpenGL redesign GPU memory management for markers presentation Introduce Point Sprites usage. Graphic3d_Group - drop Marker(),MarkerSet() methods - markers should be drawn using AddPrimitiveArray. Added new Draw Harness commands vcaps, vmarkerstest. --- .../standard/03_Viewer2d/src/Viewer2dDoc.cpp | 2 +- samples/mfc/standard/Common/OCC_2dView.cpp | 8 +- .../Common/Primitive/Sample2D_Markers.cpp | 15 +- .../Common/Primitive/Sample2D_Markers.h | 5 +- src/AIS/AIS_Point.cxx | 7 +- src/Aspect/Aspect.cdl | 8 +- src/Aspect/Aspect_MarkerStyle.cxx | 27 - src/DsgPrs/DsgPrs.cxx | 153 +- src/DsgPrs/DsgPrs_FixPresentation.cxx | 21 +- src/DsgPrs/DsgPrs_IdenticPresentation.cxx | 21 +- src/DsgPrs/DsgPrs_OffsetPresentation.cxx | 32 +- src/DsgPrs/DsgPrs_SymmetricPresentation.cxx | 49 +- src/Graphic3d/FILES | 4 +- src/Graphic3d/Graphic3d.cdl | 6 +- src/Graphic3d/Graphic3d_ArrayOfPoints.cdl | 16 +- src/Graphic3d/Graphic3d_ArrayOfPoints.cxx | 7 +- src/Graphic3d/Graphic3d_AspectMarker3d.cdl | 141 +- src/Graphic3d/Graphic3d_AspectMarker3d.cxx | 145 +- src/Graphic3d/Graphic3d_CGroup.hxx | 27 + src/Graphic3d/Graphic3d_GraphicDriver.cdl | 15 - src/Graphic3d/Graphic3d_Group.cdl | 38 +- src/Graphic3d/Graphic3d_Group_3.cxx | 92 - src/Graphic3d/Graphic3d_Group_8.cxx | 100 +- src/Graphic3d/Graphic3d_MarkerImage.cxx | 226 ++ src/Graphic3d/Graphic3d_MarkerImage.hxx | 90 + .../Graphic3d_MarkerImage_Handle.hxx} | 37 +- src/Graphic3d/Graphic3d_Structure.cxx | 6 +- .../InterfaceGraphic_Graphic3d.hxx | 17 - src/MeshVS/MeshVS_MeshPrsBuilder.cxx | 16 +- src/MeshVS/MeshVS_TextPrsBuilder.cxx | 10 +- src/OpenGl/FILES | 8 +- ...rSet.hxx => Handle_OpenGl_PointSprite.hxx} | 45 +- src/OpenGl/OpenGl_AspectMarker.cxx | 1836 ++++++++++++++++- src/OpenGl/OpenGl_AspectMarker.hxx | 40 +- src/OpenGl/OpenGl_Caps.cxx | 10 +- src/OpenGl/OpenGl_Caps.hxx | 3 +- src/OpenGl/OpenGl_Display.cxx | 102 +- src/OpenGl/OpenGl_Display.hxx | 29 - src/OpenGl/OpenGl_Display_2.cxx | 1386 ------------- src/OpenGl/OpenGl_GraphicDriver.hxx | 2 - src/OpenGl/OpenGl_GraphicDriver_3.cxx | 11 +- src/OpenGl/OpenGl_GraphicDriver_4.cxx | 2 +- src/OpenGl/OpenGl_GraphicDriver_703.cxx | 154 -- src/OpenGl/OpenGl_Group.cxx | 9 +- src/OpenGl/OpenGl_Group.hxx | 4 +- src/OpenGl/OpenGl_Marker.cxx | 112 - src/OpenGl/OpenGl_MarkerSet.cxx | 145 -- src/OpenGl/OpenGl_PointSprite.cxx | 89 + src/OpenGl/OpenGl_PointSprite.hxx | 65 + src/OpenGl/OpenGl_PrimitiveArray.cxx | 120 +- src/OpenGl/OpenGl_PrimitiveArray.hxx | 3 + src/OpenGl/OpenGl_Structure.cxx | 7 +- src/OpenGl/OpenGl_Structure.hxx | 3 +- src/OpenGl/OpenGl_Texture.cxx | 92 +- src/OpenGl/OpenGl_Texture.hxx | 6 + src/OpenGl/OpenGl_Workspace.cxx | 22 +- src/OpenGl/OpenGl_Workspace_2.cxx | 2 - src/Prs3d/Prs3d_Point.hxx | 6 +- src/Prs3d/Prs3d_PointAspect.cdl | 6 +- src/Prs3d/Prs3d_PointAspect.cxx | 7 +- src/Prs3d/Prs3d_WFShape.cxx | 10 +- src/StdSelect/StdSelect_ViewerSelector3d.cxx | 6 +- src/V3d/V3d_CircularGrid.cxx | 7 +- src/V3d/V3d_RectangularGrid.cxx | 9 +- src/V3d/V3d_Viewer_4.cxx | 6 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 149 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 51 + tests/bugs/vis/bug24131_markers | 72 + 68 files changed, 3267 insertions(+), 2710 deletions(-) delete mode 100755 src/Graphic3d/Graphic3d_Group_3.cxx create mode 100644 src/Graphic3d/Graphic3d_MarkerImage.cxx create mode 100644 src/Graphic3d/Graphic3d_MarkerImage.hxx rename src/{OpenGl/OpenGl_Marker.hxx => Graphic3d/Graphic3d_MarkerImage_Handle.hxx} (60%) rename src/OpenGl/{OpenGl_MarkerSet.hxx => Handle_OpenGl_PointSprite.hxx} (55%) delete mode 100755 src/OpenGl/OpenGl_GraphicDriver_703.cxx delete mode 100644 src/OpenGl/OpenGl_Marker.cxx delete mode 100644 src/OpenGl/OpenGl_MarkerSet.cxx create mode 100644 src/OpenGl/OpenGl_PointSprite.cxx create mode 100644 src/OpenGl/OpenGl_PointSprite.hxx create mode 100644 tests/bugs/vis/bug24131_markers diff --git a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp index d6edf5599c..796ef34938 100755 --- a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp +++ b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp @@ -168,7 +168,7 @@ void CViewer2dDoc::OnBUTTONTestMarkers() for (int i=1;i<=2;i++) { Handle (Sample2D_Markers) aMarker = - new Sample2D_Markers(10+20,5*i,Aspect_TOM_BALL,(Quantity_NameOfColor)(aColor++)); + new Sample2D_Markers(10+20,5*i,Aspect_TOM_RING1,(Quantity_NameOfColor)(aColor++)); myAISContext->Display(aMarker, Standard_False); } for (int i=1;i<=2;i++) diff --git a/samples/mfc/standard/Common/OCC_2dView.cpp b/samples/mfc/standard/Common/OCC_2dView.cpp index 175cfcc9a5..fd1bf3d67b 100755 --- a/samples/mfc/standard/Common/OCC_2dView.cpp +++ b/samples/mfc/standard/Common/OCC_2dView.cpp @@ -176,7 +176,7 @@ OCC_2dDoc* OCC_2dView::GetDocument() // non-debug version is inline void OCC_2dView::OnBUTTONGridRectLines() { Handle(V3d_Viewer) aViewer = myV2dView->Viewer(); - Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Quantity_NOC_WHITE,2); + Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2); aViewer->SetGridEcho(aGridAspect); Standard_Integer aWidth=0, aHeight=0, anOffset=0; myV2dView->Window()->Size(aWidth,aHeight); @@ -195,7 +195,7 @@ void OCC_2dView::OnBUTTONGridRectLines() void OCC_2dView::OnBUTTONGridRectPoints() { Handle(V3d_Viewer) aViewer = myV2dView->Viewer(); - Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Quantity_NOC_WHITE,2); + Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2); aViewer->SetGridEcho(aGridAspect); Standard_Integer aWidth=0, aHeight=0, anOffset=0; myV2dView->Window()->Size(aWidth,aHeight); @@ -214,7 +214,7 @@ void OCC_2dView::OnBUTTONGridRectPoints() void OCC_2dView::OnBUTTONGridCircLines() { Handle(V3d_Viewer) aViewer = myV2dView->Viewer(); - Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Quantity_NOC_WHITE,2); + Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2); aViewer->SetGridEcho(aGridAspect); Standard_Integer aWidth=0, aHeight=0, anOffset=0; myV2dView->Window()->Size(aWidth,aHeight); @@ -234,7 +234,7 @@ void OCC_2dView::OnBUTTONGridCircLines() void OCC_2dView::OnBUTTONGridCircPoints() { Handle(V3d_Viewer) aViewer = myV2dView->Viewer(); - Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Quantity_NOC_WHITE,2); + Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2); aViewer->SetGridEcho(aGridAspect); Standard_Integer aWidth=0, aHeight=0, anOffset=0; myV2dView->Window()->Size(aWidth,aHeight); diff --git a/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp b/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp index 426dd9cc5a..e54a90b361 100755 --- a/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp +++ b/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp @@ -11,7 +11,7 @@ Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition , const Aspect_TypeOfMarker theMarkerType, const Quantity_Color theColor, const Standard_Real theScaleOrId) - :AIS_InteractiveObject(),myListVertex(1,1) + :AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (1)) { myXPosition = theXPosition; myYPosition = theYPosition; @@ -22,18 +22,18 @@ Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition , Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition , const Quantity_Length theYPosition , - const Graphic3d_Array1OfVertex& theListVertex, + const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints, const Aspect_TypeOfMarker theMarkerType, const Quantity_Color theColor, const Standard_Real theScaleOrId) - :AIS_InteractiveObject(),myListVertex(1,6) + :AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (6)) { myXPosition = theXPosition; myYPosition = theYPosition; myMarkerType = theMarkerType; myColor = theColor; myIndex = theScaleOrId; - myListVertex = theListVertex; + myArrayOfPoints = theArrayOfPoints; } @@ -45,13 +45,14 @@ void Sample2D_Markers::Compute ( const Handle(PrsMgr_PresentationManager3d)& aP { Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(Aspect_TOM_POINT,myColor,myIndex); Prs3d_Root::CurrentGroup(aPresentation)->SetGroupPrimitivesAspect(aMarker); - Prs3d_Root::CurrentGroup(aPresentation)->MarkerSet(myListVertex); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (myArrayOfPoints); } else { Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex); aPresentation->SetPrimitivesAspect(aMarker); - Graphic3d_Vertex aV3d(myXPosition, myYPosition, 0.); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(aV3d); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); } } diff --git a/samples/mfc/standard/Common/Primitive/Sample2D_Markers.h b/samples/mfc/standard/Common/Primitive/Sample2D_Markers.h index edc058d675..d0a16daccf 100755 --- a/samples/mfc/standard/Common/Primitive/Sample2D_Markers.h +++ b/samples/mfc/standard/Common/Primitive/Sample2D_Markers.h @@ -4,6 +4,7 @@ #include #include #include +#include DEFINE_STANDARD_HANDLE(Sample2D_Markers,AIS_InteractiveObject) class Sample2D_Markers : public AIS_InteractiveObject { @@ -26,7 +27,7 @@ public: // Polyline marker Standard_EXPORT Sample2D_Markers (const Quantity_Length theXPosition , const Quantity_Length theYPosition , - const Graphic3d_Array1OfVertex& theListVertex, + const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints, const Aspect_TypeOfMarker theMarkerType, const Quantity_Color theColor, const Standard_Real theScaleOrId=2.0); @@ -57,7 +58,7 @@ Quantity_Length myWidth ; Quantity_Length myHeight ; Standard_Real myIndex ;//myScaleOrId // specific polyline marker -Graphic3d_Array1OfVertex myListVertex ; +Handle(Graphic3d_ArrayOfPoints) myArrayOfPoints; }; diff --git a/src/AIS/AIS_Point.cxx b/src/AIS/AIS_Point.cxx index 39a22a62c2..9e7b0e0810 100755 --- a/src/AIS/AIS_Point.cxx +++ b/src/AIS/AIS_Point.cxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -95,8 +95,9 @@ void AIS_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat PtA->SetScale(3.); Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation); TheGroup->SetPrimitivesAspect(PtA); - Graphic3d_Vertex Vtx(myComponent->X(),myComponent->Y(),myComponent->Z()); - TheGroup->Marker(Vtx); + Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints (1); + aPoint->AddVertex (myComponent->X(),myComponent->Y(),myComponent->Z()); + TheGroup->AddPrimitiveArray (aPoint); } } diff --git a/src/Aspect/Aspect.cdl b/src/Aspect/Aspect.cdl index c418b8b148..17d8f58da6 100755 --- a/src/Aspect/Aspect.cdl +++ b/src/Aspect/Aspect.cdl @@ -549,16 +549,16 @@ is enumeration TypeOfMarker is TOM_POINT, TOM_PLUS, TOM_STAR, - TOM_O, TOM_X, + TOM_O, TOM_O_POINT, TOM_O_PLUS, TOM_O_STAR, TOM_O_X, - TOM_BALL, TOM_RING1, TOM_RING2, TOM_RING3, + TOM_BALL, TOM_USERDEFINED end TypeOfMarker; ---Purpose: Definition of types of markers @@ -566,16 +566,16 @@ is -- TOM_POINT point . -- TOM_PLUS plus + -- TOM_STAR star * - -- TOM_O circle O -- TOM_X cross x + -- TOM_O circle O -- TOM_O_POINT a point in a circle -- TOM_O_PLUS a plus in a circle -- TOM_O_STAR a star in a circle -- TOM_O_X a cross in a circle - -- TOM_BALL a ball with 1 color and different saturations -- TOM_RING1 a large ring -- TOM_RING2 a medium ring -- TOM_RING3 a small ring + -- TOM_BALL a ball with 1 color and different saturations -- TOM_USERDEFINED defined by Users -- ---Category: Enumerations diff --git a/src/Aspect/Aspect_MarkerStyle.cxx b/src/Aspect/Aspect_MarkerStyle.cxx index ac0e207da4..176ea55e05 100755 --- a/src/Aspect/Aspect_MarkerStyle.cxx +++ b/src/Aspect/Aspect_MarkerStyle.cxx @@ -456,33 +456,6 @@ void Aspect_MarkerStyle::SetPredefinedStyle() { MySpoint->SetValue(i+4,TRUE); } break ; - case Aspect_TOM_BALL : - MyXpoint = new TShort_HArray1OfShortReal(1, - MAX_BALL_LINE*(MAX_O_POINT+1)) ; - MyYpoint = new TShort_HArray1OfShortReal(1, - MAX_BALL_LINE*(MAX_O_POINT+1)) ; - MySpoint = new TColStd_HArray1OfBoolean(1, - MAX_BALL_LINE*(MAX_O_POINT+1)) ; - - { Standard_Integer i,j,n = 0; - Standard_Real da = 2. * M_PI / MAX_O_POINT; - Standard_Real dr = 1./MAX_BALL_LINE; - Standard_Real a,r = 1.; - - for( i=1 ; i<= MAX_BALL_LINE ; i++ ) { - a = 0.; - for( j=1 ; j<= MAX_O_POINT+1 ; j++,a += da ) { - n++; - MyXpoint->SetValue(n,(float )( r*Cos(a))); - MyYpoint->SetValue(n,(float )( r*Sin(a))); - MySpoint->SetValue(n,(j > 1) ? TRUE : FALSE); - } - MyXpoint->SetValue(n,(float ) r); - MyYpoint->SetValue(n,0.); - r -= dr; - } - } - break ; case Aspect_TOM_RING1 : MyXpoint = new TShort_HArray1OfShortReal(1, (MAX_BALL_LINE/4)*(MAX_O_POINT+1)) ; diff --git a/src/DsgPrs/DsgPrs.cxx b/src/DsgPrs/DsgPrs.cxx index 11915e544d..d830f34d4a 100755 --- a/src/DsgPrs/DsgPrs.cxx +++ b/src/DsgPrs/DsgPrs.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -56,20 +57,13 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, const DsgPrs_ArrowSide ArrowSide) { Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); - - Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); - MarkerAsp->SetType(Aspect_TOM_BALL); - MarkerAsp->SetScale(0.8); - Quantity_Color acolor; - Aspect_TypeOfLine atype; - Standard_Real awidth; - LA->LineAspect()->Aspect()->Values(acolor, atype, awidth); - MarkerAsp->SetColor(acolor); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - - // symbols aux extremites de la cote -// Graphic3d_Vertex V3d,V3d1,V3d2; - Graphic3d_Vertex V3d,V3d1; + + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; + LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp); switch(ArrowSide) { case DsgPrs_AS_NONE: @@ -115,28 +109,29 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, case DsgPrs_AS_FIRSTPT: { - V3d = Graphic3d_Vertex (pt1.X(), pt1.Y(), pt1.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); break; } case DsgPrs_AS_LASTPT: { // On dessine un rond - V3d = Graphic3d_Vertex (pt2.X(), pt2.Y(), pt2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); break; } case DsgPrs_AS_BOTHPT: { - V3d1 = Graphic3d_Vertex (pt1.X(), pt1.Y(), pt1.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d1); - Graphic3d_Vertex V3d2(pt2.X(), pt2.Y(), pt2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d2); - + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2); break; } @@ -144,30 +139,30 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, { // an Arrow Prs3d_Arrow::Draw(aPresentation, - pt1, - dir1, - LA->ArrowAspect()->Angle(), - LA->ArrowAspect()->Length()); + pt1, + dir1, + LA->ArrowAspect()->Angle(), + LA->ArrowAspect()->Length()); // a Round - V3d = Graphic3d_Vertex (pt2.X(), pt2.Y(), pt2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); break; } case DsgPrs_AS_FIRSTPT_LASTAR: { // a Round - V3d = Graphic3d_Vertex (pt1.X(), pt1.Y(), pt1.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); // an Arrow Prs3d_Arrow::Draw(aPresentation, - pt2, - dir2, - LA->ArrowAspect()->Angle(), - LA->ArrowAspect()->Length()); - + pt2, + dir2, + LA->ArrowAspect()->Angle(), + LA->ArrowAspect()->Length()); break; } } @@ -182,19 +177,13 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean drawFromCenter) { - Quantity_Color acolor; - Aspect_TypeOfLine atype; - Standard_Real awidth; + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); - LA->LineAspect()->Aspect()->Values(acolor, atype, awidth); - Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); - MarkerAsp->SetType(Aspect_TOM_BALL); - MarkerAsp->SetScale(0.8); - MarkerAsp->SetColor(acolor); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - // symbols aux extremites de la cote -// Graphic3d_Vertex V3d,V3d1,V3d2; - Graphic3d_Vertex V3d,V3d1; + LA->LineAspect()->Aspect()->Values(aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp); switch(ArrowSide) { case DsgPrs_AS_NONE: @@ -240,30 +229,35 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, case DsgPrs_AS_FIRSTPT: { - V3d = Graphic3d_Vertex (pt1.X(), pt1.Y(), pt1.Z()); - if(drawFromCenter) - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + if (drawFromCenter) + { + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); + } break; } case DsgPrs_AS_LASTPT: { // On dessine un rond - V3d = Graphic3d_Vertex (pt2.X(), pt2.Y(), pt2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); break; } case DsgPrs_AS_BOTHPT: { - V3d1 = Graphic3d_Vertex (pt1.X(), pt1.Y(), pt1.Z()); - if(drawFromCenter) - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d1); - Graphic3d_Vertex V3d2(pt2.X(), pt2.Y(), pt2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d2); - + if (drawFromCenter) + { + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1); + } + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2); break; } @@ -271,29 +265,32 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, { // an Arrow Prs3d_Arrow::Draw (aPresentation, - pt1, - dir1, - LA->Arrow1Aspect()->Angle(), - LA->Arrow1Aspect()->Length()); + pt1, + dir1, + LA->Arrow1Aspect()->Angle(), + LA->Arrow1Aspect()->Length()); // a Round - V3d = Graphic3d_Vertex (pt2.X(), pt2.Y(), pt2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); break; } case DsgPrs_AS_FIRSTPT_LASTAR: { // a Round - V3d = Graphic3d_Vertex (pt1.X(), pt1.Y(), pt1.Z()); - if(drawFromCenter) - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + if (drawFromCenter) + { + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); + } // an Arrow Prs3d_Arrow::Draw (aPresentation, - pt2, - dir2, - LA->Arrow1Aspect()->Angle(), - LA->Arrow1Aspect()->Length()); + pt2, + dir2, + LA->Arrow1Aspect()->Angle(), + LA->Arrow1Aspect()->Length()); break; } } diff --git a/src/DsgPrs/DsgPrs_FixPresentation.cxx b/src/DsgPrs/DsgPrs_FixPresentation.cxx index f14dd1e12a..98a59b8d89 100755 --- a/src/DsgPrs/DsgPrs_FixPresentation.cxx +++ b/src/DsgPrs/DsgPrs_FixPresentation.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -108,15 +109,13 @@ void DsgPrs_FixPresentation::Add( // On ajoute un rond au point d'attache Prs3d_Root::NewGroup(aPresentation); Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); - Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); - MarkerAsp->SetType(Aspect_TOM_BALL); - MarkerAsp->SetScale(0.8); - Quantity_Color acolor; - Aspect_TypeOfLine atype; - Standard_Real awidth; - LA->LineAspect()->Aspect()->Values(acolor, atype, awidth); - MarkerAsp->SetColor(acolor); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - Graphic3d_Vertex V3d(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; + LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); } diff --git a/src/DsgPrs/DsgPrs_IdenticPresentation.cxx b/src/DsgPrs/DsgPrs_IdenticPresentation.cxx index 390d867435..73dbf05263 100755 --- a/src/DsgPrs/DsgPrs_IdenticPresentation.cxx +++ b/src/DsgPrs/DsgPrs_IdenticPresentation.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -59,17 +60,15 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent // On ajoute un rond au point d'attache Prs3d_Root::NewGroup(aPresentation); Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); - Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); - MarkerAsp->SetType(Aspect_TOM_BALL); - MarkerAsp->SetScale(0.8); - Quantity_Color acolor; - Aspect_TypeOfLine atype; - Standard_Real awidth; - LA->LineAspect()->Aspect()->Values(acolor, atype, awidth); - MarkerAsp->SetColor(acolor); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - Graphic3d_Vertex V3d(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; + LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); // texte Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntOffset); diff --git a/src/DsgPrs/DsgPrs_OffsetPresentation.cxx b/src/DsgPrs/DsgPrs_OffsetPresentation.cxx index 64b6c6b54a..2c4c1d0a71 100755 --- a/src/DsgPrs/DsgPrs_OffsetPresentation.cxx +++ b/src/DsgPrs/DsgPrs_OffsetPresentation.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -131,20 +132,18 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); // ball 1 : 3eme groupe - Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); - MarkerAsp->SetType(Aspect_TOM_BALL); - MarkerAsp->SetScale(0.8); - Quantity_Color acolor; - Aspect_TypeOfLine atype; - Standard_Real awidth; - LA->LineAspect()->Aspect()->Values(acolor, atype, awidth); - MarkerAsp->SetColor(acolor); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - Graphic3d_Vertex V3d(Proj2.X() ,Proj2.Y(), Proj2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); - + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; + LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (Proj2.X(), Proj2.Y(), Proj2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); + Prs3d_Root::NewGroup(aPresentation); - + // texte : 4eme groupe Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,offp); } @@ -209,7 +208,8 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims); // anneau : 3eme et 4eme groupes - Graphic3d_Vertex V3d(Proj2.X() ,Proj2.Y(), Proj2.Z()); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (Proj2.X(), Proj2.Y(), Proj2.Z()); Prs3d_Root::NewGroup(aPresentation); Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); @@ -218,7 +218,7 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres //MarkerAsp->SetColor(Quantity_Color(Quantity_NOC_RED)); MarkerAsp->SetColor(acolor); Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); Prs3d_Root::NewGroup(aPresentation); Handle(Graphic3d_AspectMarker3d) Marker2Asp = new Graphic3d_AspectMarker3d(); @@ -227,5 +227,5 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres //Marker2Asp->SetColor(Quantity_Color(Quantity_NOC_GREEN)); Marker2Asp->SetColor(acolor); Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(Marker2Asp); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); } diff --git a/src/DsgPrs/DsgPrs_SymmetricPresentation.cxx b/src/DsgPrs/DsgPrs_SymmetricPresentation.cxx index 8da9410fe7..387eb7488f 100755 --- a/src/DsgPrs/DsgPrs_SymmetricPresentation.cxx +++ b/src/DsgPrs/DsgPrs_SymmetricPresentation.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -702,17 +703,16 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese // SYMMETRY WHEN THE REFERENCE POINT IS ON THE AXIS OF SYM.: //============================================================== //Marker of localisation of the face - Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d(); - MarkerAsp->SetType(Aspect_TOM_BALL); - MarkerAsp->SetScale(0.8); - Quantity_Color acolor; - Aspect_TypeOfLine atype; - Standard_Real awidth; - LA->LineAspect()->Aspect()->Values(acolor, atype, awidth); - MarkerAsp->SetColor(acolor); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp); - Graphic3d_Vertex V3d(AttachmentPoint1.X(),AttachmentPoint1.Y(),AttachmentPoint1.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d); + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; + LA->LineAspect()->Aspect()->Values(aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (AttachmentPoint1.X(), AttachmentPoint1.Y(), AttachmentPoint1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); + //Trace of the linking segment Prs3d_Root::NewGroup(aPresentation); @@ -824,23 +824,22 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese Prs3d_Root::NewGroup(aPresentation); Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); - Handle(Graphic3d_AspectMarker3d) MarkerAspAtt = new Graphic3d_AspectMarker3d(); - MarkerAspAtt->SetType(Aspect_TOM_BALL); - MarkerAspAtt->SetScale(0.8); - Quantity_Color color; - Aspect_TypeOfLine type; - Standard_Real width; - LA->LineAspect()->Aspect()->Values(color, type, width); - MarkerAspAtt->SetColor(color); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAspAtt); - Graphic3d_Vertex Vatt1(AttachmentPoint1.X(),AttachmentPoint1.Y(),AttachmentPoint1.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(Vatt1); + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real aWidth; + LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth); + Handle(Graphic3d_AspectMarker3d) aMarkerAspAtt = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAspAtt); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints1->AddVertex (AttachmentPoint1.X(), AttachmentPoint1.Y(), AttachmentPoint1.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1); Prs3d_Root::NewGroup(aPresentation); Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); - Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAspAtt); - Graphic3d_Vertex Vatt2(AttachmentPoint2.X(),AttachmentPoint2.Y(),AttachmentPoint2.Z()); - Prs3d_Root::CurrentGroup(aPresentation)->Marker(Vatt2); + Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAspAtt); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints2->AddVertex (AttachmentPoint2.X(), AttachmentPoint2.Y(), AttachmentPoint2.Z()); + Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2); //------------------------------------------------------------------------------------- //| SYMBOL OF SYMMETRY | diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index 56ebd27e15..50ec0a846e 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -30,7 +30,6 @@ Graphic3d_Structure.pxx Graphic3d_Group.pxx Graphic3d_Group_1.cxx Graphic3d_Group_2.cxx -Graphic3d_Group_3.cxx Graphic3d_Group_8.cxx Graphic3d_Group_10.cxx Graphic3d_Structure.pxx @@ -53,3 +52,6 @@ Graphic3d_Vec3.hxx Graphic3d_Vec4.hxx Graphic3d_Vertex.hxx Graphic3d_Vertex.cxx +Graphic3d_MarkerImage.hxx +Graphic3d_MarkerImage.cxx +Graphic3d_MarkerImage_Handle.hxx \ No newline at end of file diff --git a/src/Graphic3d/Graphic3d.cdl b/src/Graphic3d/Graphic3d.cdl index 7546455056..bdf6960bf0 100755 --- a/src/Graphic3d/Graphic3d.cdl +++ b/src/Graphic3d/Graphic3d.cdl @@ -215,7 +215,8 @@ is enumeration TypeOfTextureMode is TOTM_OBJECT, TOTM_SPHERE, TOTM_EYE, - TOTM_MANUAL; + TOTM_MANUAL, + TOTM_SPRITE; ---Purpose: Type of the texture projection. ---Category: Enumerations @@ -402,6 +403,9 @@ is imported CTransPersStruct; imported TransModeFlags; + + imported MarkerImage; + imported MarkerImage_Handle; primitive PtrFrameBuffer; primitive Vec2; diff --git a/src/Graphic3d/Graphic3d_ArrayOfPoints.cdl b/src/Graphic3d/Graphic3d_ArrayOfPoints.cdl index 8a03ed9182..ff3085dd83 100755 --- a/src/Graphic3d/Graphic3d_ArrayOfPoints.cdl +++ b/src/Graphic3d/Graphic3d_ArrayOfPoints.cdl @@ -21,13 +21,13 @@ class ArrayOfPoints from Graphic3d inherits ArrayOfPrimitives from Graphic3d is - -- constructor - Create ( - maxVertexs: Integer from Standard) - returns mutable ArrayOfPoints from Graphic3d; - ---Purpose: Creates an array of points, - -- a single pixel point is drawn at each vertex. - -- The array must be filled using only - -- the AddVertex(Point) method. + -- constructor + Create (maxVertexs: Integer from Standard; + hasVColors: Boolean from Standard = Standard_False) + returns mutable ArrayOfPoints from Graphic3d; + ---Purpose: Creates an array of points, + -- a single pixel point is drawn at each vertex. + -- The array must be filled using the AddVertex(Point) method. + -- When is TRUE , you must use only AddVertex(Point,Color) method. end; diff --git a/src/Graphic3d/Graphic3d_ArrayOfPoints.cxx b/src/Graphic3d/Graphic3d_ArrayOfPoints.cxx index 4922a229a8..5c64d52510 100755 --- a/src/Graphic3d/Graphic3d_ArrayOfPoints.cxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPoints.cxx @@ -19,6 +19,7 @@ #include -Graphic3d_ArrayOfPoints :: Graphic3d_ArrayOfPoints ( - const Standard_Integer maxVertexs) - : Graphic3d_ArrayOfPrimitives(Graphic3d_TOPA_POINTS,maxVertexs,0,0,Standard_False,Standard_False,Standard_False,Standard_False,Standard_False) {} +Graphic3d_ArrayOfPoints :: Graphic3d_ArrayOfPoints (const Standard_Integer maxVertexs, + const Standard_Boolean hasVColors) +: Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POINTS, maxVertexs, 0, 0, Standard_False, hasVColors, Standard_False, Standard_False, Standard_False) +{} diff --git a/src/Graphic3d/Graphic3d_AspectMarker3d.cdl b/src/Graphic3d/Graphic3d_AspectMarker3d.cdl index c7fb674963..c33e785545 100755 --- a/src/Graphic3d/Graphic3d_AspectMarker3d.cdl +++ b/src/Graphic3d/Graphic3d_AspectMarker3d.cdl @@ -20,88 +20,89 @@ class AspectMarker3d from Graphic3d inherits AspectMarker from Aspect - ---Version: + ---Version: - ---Purpose: Creates and updates an attribute group for - -- marker type primitives. This group contains the type - -- of marker, its colour, and its scale factor. - ---Keywords: Marker, Color, Scale, Type + ---Purpose: Creates and updates an attribute group for + -- marker type primitives. This group contains the type + -- of marker, its colour, and its scale factor. + ---Keywords: Marker, Color, Scale, Type - ---Warning: - ---References: + ---Warning: + ---References: uses - Color from Quantity, - - TypeOfMarker from Aspect, - - HArray1OfByte from TColStd + Color from Quantity, + TypeOfMarker from Aspect, + HArray1OfByte from TColStd, + PixMap_Handle from Image, + MarkerImage_Handle from Graphic3d is - Create - returns mutable AspectMarker3d from Graphic3d; - ---Level: Public - ---Purpose: Creates a context table for marker primitives - -- defined with the following default values: - -- - -- Marker type : TOM_X - -- Colour : YELLOW - -- Scale factor : 1.0 - - Create ( AType : TypeOfMarker from Aspect; - AColor : Color from Quantity; - AScaleOrId : Real from Standard - ) - returns mutable AspectMarker3d from Graphic3d; - - Create ( AType : TypeOfMarker from Aspect; - AColor : Color from Quantity; - AScaleOrId : Real from Standard; - AWidth : Integer from Standard; - AHeight : Integer from Standard; - ATexture : HArray1OfByte from TColStd - ) - returns mutable AspectMarker3d from Graphic3d; - ---Level: Public - ---Purpose: Creates a context table for marker primitives - -- defined with the specified values. - - GetTextureSize (me:mutable; AWidth : out Integer from Standard; - AHeight : out Integer from Standard); - ---Level: Public - ---Purpose: Returns marker's texture size. - - GetTexture (me:mutable) - returns HArray1OfByte from TColStd; - ---Level: Public - ---Purpose: Returns marker's texture. - ---C++: return const & - - SetTexture ( me: mutable; - AWidth : Integer from Standard; - AHeight : Integer from Standard; - ATexture : HArray1OfByte from TColStd ) is static; - --- + Create + returns mutable AspectMarker3d from Graphic3d; + ---Level: Public + ---Purpose: Creates a context table for marker primitives + -- defined with the following default values: + -- + -- Marker type : TOM_X + -- Colour : YELLOW + -- Scale factor: 1.0 + + Create (theType : TypeOfMarker from Aspect; + theColor : Color from Quantity; + theScale : Real from Standard) + returns mutable AspectMarker3d from Graphic3d; + + Create (theColor : Color from Quantity; + theWidth : Integer from Standard; + theHeight : Integer from Standard; + theTextureBitmap : HArray1OfByte from TColStd) + returns mutable AspectMarker3d from Graphic3d; + ---Level: Public + ---Purpose: Creates a context table for marker primitives + -- defined with the specified values. + + Create (theTextureImage : PixMap_Handle from Image) + returns mutable AspectMarker3d from Graphic3d; + ---Level: Public + ---Purpose: Creates a context table for marker primitives + -- defined with the specified values. + + GetTextureSize (me; + theWidth : out Integer from Standard; + theHeight: out Integer from Standard); + ---Level: Public + ---Purpose: Returns marker's texture size. + + GetMarkerImage (me) + returns MarkerImage_Handle from Graphic3d; + ---Level: Public + ---Purpose: Returns marker's image texture. + --- Could be null handle if marker aspect has been initialized as + --- default type of marker. + ---C++: return const & + + SetBitMap (me: mutable; + theWidth : Integer from Standard; + theHeight : Integer from Standard; + theTexture: HArray1OfByte from TColStd ) is static; fields -- --- Class : Graphic3d_AspectMarker3d +-- Class: Graphic3d_AspectMarker3d -- --- Purpose : Declaration of context-specific variables --- for drawing 3d markers. +-- Purpose: Declaration of context-specific variables +-- for drawing 3d markers. -- --- Reminder : A context for drawing 3d markers inherits: --- - the colour --- - the type of marker --- - the scale factor --- defined by AspectMarker. - - MyTexture : HArray1OfByte from TColStd is protected; - MyTextureWidth : Integer from Standard is protected; - MyTextureHeight : Integer from Standard is protected; - +-- Reminder: A context for drawing 3d markers inherits: +-- - the colour +-- - the type of marker +-- - the scale factor +-- defined by AspectMarker. + +myMarkerImage : MarkerImage_Handle from Graphic3d is protected; + end AspectMarker3d; diff --git a/src/Graphic3d/Graphic3d_AspectMarker3d.cxx b/src/Graphic3d/Graphic3d_AspectMarker3d.cxx index c6599d437b..fa602f5d03 100755 --- a/src/Graphic3d/Graphic3d_AspectMarker3d.cxx +++ b/src/Graphic3d/Graphic3d_AspectMarker3d.cxx @@ -17,86 +17,85 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - - -//-Version - -//-Design Declaration of variables specific to the context -// of trace of markers 3d - -// Rappels Context of trace of markers 3d inherits the context -// defined by : -// - the color -// - the type of marker -// - the scale - -//-Warning - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class #include #include - -//-Aliases - -//-Global data definitions - -//-Constructors - -//-Destructors - -//-Methods, in order - -Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d () - :Aspect_AspectMarker(), MyTextureWidth(0), MyTextureHeight(0) -{ -} - -Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker AType, const Quantity_Color& AColor, const Standard_Real AScaleOrId ): -Aspect_AspectMarker( AColor, AType, AScaleOrId ), MyTextureWidth(0), MyTextureHeight(0) -{ -} - - -Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker AType, - const Quantity_Color& AColor, - const Standard_Real AScaleOrId, - const Standard_Integer AWidth, - const Standard_Integer AHeight, - const Handle(TColStd_HArray1OfByte)& ATexture ): -Aspect_AspectMarker( AColor, AType, AScaleOrId ), MyTexture( ATexture ), MyTextureWidth(AWidth), MyTextureHeight(AHeight) -{ - /*for( Standard_Integer aIndex = ATexture.Lower(); aIndex <= ATexture.Upper(); aIndex++ ) - { - MyTexture.SetValue( aIndex, ATexture.Value( aIndex ) ); - } - */ - -} - -void Graphic3d_AspectMarker3d::GetTextureSize(Standard_Integer& AWidth, Standard_Integer& AHeight) +#include +#include + +// ======================================================================= +// function : Graphic3d_AspectMarker3d +// purpose : +// ======================================================================= +Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d() +: Aspect_AspectMarker() +{} + +// ======================================================================= +// function : Graphic3d_AspectMarker3d +// purpose : +// ======================================================================= +Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType, + const Quantity_Color& theColor, + const Standard_Real theScale) +: Aspect_AspectMarker (theColor, theType, theScale) +{} + +// ======================================================================= +// function : Graphic3d_AspectMarker3d +// purpose : +// ======================================================================= +Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor, + const Standard_Integer theWidth, + const Standard_Integer theHeight, + const Handle(TColStd_HArray1OfByte)& theTextureBitMap) +: Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0), + myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight)) +{} + +// ======================================================================= +// function : Graphic3d_AspectMarker3d +// purpose : +// ======================================================================= +Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage) +: Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0), + myMarkerImage (new Graphic3d_MarkerImage (theTextureImage)) +{} + +// ======================================================================= +// function : GetTextureSize +// purpose : +// ======================================================================= +void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth, + Standard_Integer& theHeight) const { - AWidth = MyTextureWidth; - AHeight = MyTextureHeight; + if (!myMarkerImage.IsNull()) + { + myMarkerImage->GetTextureSize (theWidth, theHeight); + } + else + { + theWidth = 0; + theHeight = 0; + } } -const Handle(TColStd_HArray1OfByte)& Graphic3d_AspectMarker3d::GetTexture() +// ======================================================================= +// function : GetMarkerImage +// purpose : +// ======================================================================= +const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const { - return MyTexture; + return myMarkerImage; } -void Graphic3d_AspectMarker3d::SetTexture (const Standard_Integer AWidth, - const Standard_Integer AHeight, - const Handle(TColStd_HArray1OfByte)& ATexture ) +// ======================================================================= +// function : SetBitMap +// purpose : +// ======================================================================= +void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth, + const Standard_Integer theHeight, + const Handle(TColStd_HArray1OfByte)& theTextureBitMap) { - MyTextureWidth = AWidth; - MyTextureHeight = AHeight; - - MyTexture = ATexture; + myMarkerImage.Nullify(); + myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight); } diff --git a/src/Graphic3d/Graphic3d_CGroup.hxx b/src/Graphic3d/Graphic3d_CGroup.hxx index 7add19ac8c..2ce7a2f790 100755 --- a/src/Graphic3d/Graphic3d_CGroup.hxx +++ b/src/Graphic3d/Graphic3d_CGroup.hxx @@ -19,8 +19,10 @@ #ifndef _Graphic3d_CGroup_HeaderFile #define _Graphic3d_CGroup_HeaderFile +#include #include #include +#include class Graphic3d_CStructure; @@ -80,6 +82,31 @@ public: }; +class CALL_DEF_CONTEXTMARKER +{ +public: + + CALL_DEF_CONTEXTMARKER() + : IsDef (0), + IsSet (0), + MarkerType (Aspect_TOM_POINT), + Scale (0), + MarkerImage (NULL) + { + // + } + +public: + + Standard_Integer IsDef; + Standard_Integer IsSet; + CALL_DEF_COLOR Color; + Aspect_TypeOfMarker MarkerType; + Standard_ShortReal Scale; + Handle(Graphic3d_MarkerImage) MarkerImage; + +}; + class Graphic3d_CGroup { diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cdl b/src/Graphic3d/Graphic3d_GraphicDriver.cdl index dffb3ac7cb..0bef557e0c 100755 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cdl +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cdl @@ -458,21 +458,6 @@ is is deferred; ---Purpose: - ---------------------------------------- - -- Category: Methods to create Marker - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Marker ( me : mutable; - ACGroup : CGroup from Graphic3d; - APoint : Vertex from Graphic3d ) - is deferred; - - MarkerSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d ) - is deferred; - ---------------------------------------- -- Category: Methods to create Text -- for Purpose : see Graphic3d_Group.cdl diff --git a/src/Graphic3d/Graphic3d_Group.cdl b/src/Graphic3d/Graphic3d_Group.cdl index 5fb7fc60b6..0c936630d3 100755 --- a/src/Graphic3d/Graphic3d_Group.cdl +++ b/src/Graphic3d/Graphic3d_Group.cdl @@ -231,43 +231,7 @@ class Group from Graphic3d inherits TShared ---Purpose: Sets the coordinates of the boundary box of the -- group . ---Category: Methods to modify the class definition - - ------------------------------------- - -- Category: Methods to create Marker - ------------------------------------- - - --------------------------------------------- - -- Summary of Markers -- - -- -- - -- They should have one or more vertices. -- - -- -- - -- They have the following attributes. -- - -- -- - -- Marker Type. -- - -- Marker Scale Factor. -- - -- Marker Color. -- - -- -- - -- The size, shape and orientation of a -- - -- marker is not subject to transformation -- - --------------------------------------------- - - Marker ( me : mutable; - APoint : Vertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is static; - ---Level: Public - ---Purpose: Creates a marker in position which will be drawn - -- with the current attribute (AspectMarker). - ---Category: Methods to create Marker - - MarkerSet ( me : mutable; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is static; - ---Purpose: Creates a group of markers defined by a table of - -- vertices. - ---Category: Methods to create Marker - + ----------------------------------- -- Category: Methods to create Text ----------------------------------- diff --git a/src/Graphic3d/Graphic3d_Group_3.cxx b/src/Graphic3d/Graphic3d_Group_3.cxx deleted file mode 100755 index cd58ef0a72..0000000000 --- a/src/Graphic3d/Graphic3d_Group_3.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// Created by: NW,JPB,CAL -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - - - -//-Version - -//-Design Declaration des variables specifiques aux groupes -// de primitives - -//-Warning Un groupe est defini dans une structure -// Il s'agit de la plus petite entite editable - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -#include - -//-Methods, in order - -void Graphic3d_Group::Marker (const Graphic3d_Vertex &APoint, const Standard_Boolean EvalMinMax) -{ - if (IsDeleted ()) return; - - MyIsEmpty = Standard_False; - - // Min-Max Update - if (EvalMinMax) { - Standard_ShortReal X, Y, Z; - APoint.Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = X; - if (Y < MyBounds.YMin) MyBounds.YMin = Y; - if (Z < MyBounds.ZMin) MyBounds.ZMin = Z; - if (X > MyBounds.XMax) MyBounds.XMax = X; - if (Y > MyBounds.YMax) MyBounds.YMax = Y; - if (Z > MyBounds.ZMax) MyBounds.ZMax = Z; - } - - MyGraphicDriver->Marker (MyCGroup, APoint); - - Update (); -} - -void Graphic3d_Group::MarkerSet (const Graphic3d_Array1OfVertex &ListVertex, const Standard_Boolean EvalMinMax) -{ - if (IsDeleted ()) return; - - MyIsEmpty = Standard_False; - - // Min-Max Update - if (EvalMinMax) { - Standard_ShortReal X, Y, Z; - Standard_Integer i = ListVertex.Lower (); - const Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (; i<=Upper; i++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = X; - if (Y < MyBounds.YMin) MyBounds.YMin = Y; - if (Z < MyBounds.ZMin) MyBounds.ZMin = Z; - if (X > MyBounds.XMax) MyBounds.XMax = X; - if (Y > MyBounds.YMax) MyBounds.YMax = Y; - if (Z > MyBounds.ZMax) MyBounds.ZMax = Z; - } - } - - MyGraphicDriver->MarkerSet (MyCGroup, ListVertex); - - Update (); -} diff --git a/src/Graphic3d/Graphic3d_Group_8.cxx b/src/Graphic3d/Graphic3d_Group_8.cxx index 85676bff23..5e93b1a4d0 100755 --- a/src/Graphic3d/Graphic3d_Group_8.cxx +++ b/src/Graphic3d/Graphic3d_Group_8.cxx @@ -286,39 +286,32 @@ void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFil } -void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) { - - if (IsDeleted ()) return; +void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theCtx) +{ + if (IsDeleted()) return; - Standard_Real R, G, B; - Standard_Real AScale; - Quantity_Color AColor; - Aspect_TypeOfMarker AMType; + Standard_Real aRed, aGreen, aBlue; + Standard_Real aScale; + Quantity_Color aColor; + Aspect_TypeOfMarker aMarkerType; - CTX->Values (AColor, AMType, AScale); - AColor.Values (R, G, B, Quantity_TOC_RGB); + theCtx->Values (aColor, aMarkerType, aScale); + aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB); - MyCGroup.ContextMarker.Color.r = float (R); - MyCGroup.ContextMarker.Color.g = float (G); - MyCGroup.ContextMarker.Color.b = float (B); - MyCGroup.ContextMarker.MarkerType = int (AMType); - MyCGroup.ContextMarker.Scale = float (AScale); - MyCGroup.ContextMarker.IsDef = 1; + MyCGroup.ContextMarker.IsDef = 1; + MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed); + MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen); + MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue); + MyCGroup.ContextMarker.MarkerType = aMarkerType; + MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale); + MyCGroup.ContextMarker.MarkerImage = theCtx->GetMarkerImage(); - int noinsert = 1; - if ( AMType == Aspect_TOM_USERDEFINED ) - { - CTX->GetTextureSize( MyMarkWidth, MyMarkHeight ); - MyMarkArray = CTX->GetTexture(); - MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray); - } - else - MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; + int noinsert = 1; + MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert); - Update (); + MyCGroup.ContextMarker.IsSet = 1; + Update(); } void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) { @@ -600,39 +593,32 @@ void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea } -void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) { - - if (IsDeleted ()) return; - - Standard_Real R, G, B; - Standard_Real AScale; - Quantity_Color AColor; - Aspect_TypeOfMarker AMType; +void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& thCtx) +{ + if (IsDeleted()) return; - CTX->Values (AColor, AMType, AScale); - AColor.Values (R, G, B, Quantity_TOC_RGB); + Standard_Real aRed, aGreen, aBlue; + Standard_Real aScale; + Quantity_Color aColor; + Aspect_TypeOfMarker aMarkerType; - MyCGroup.ContextMarker.Color.r = float (R); - MyCGroup.ContextMarker.Color.g = float (G); - MyCGroup.ContextMarker.Color.b = float (B); - MyCGroup.ContextMarker.MarkerType = int (AMType); - MyCGroup.ContextMarker.Scale = float (AScale); - MyCGroup.ContextMarker.IsDef = 1; + thCtx->Values (aColor, aMarkerType, aScale); + aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB); - int noinsert = 0; - if ( AMType == Aspect_TOM_USERDEFINED ) - { - CTX->GetTextureSize( MyMarkWidth, MyMarkHeight ); - MyMarkArray = CTX->GetTexture(); - MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert, MyMarkWidth, MyMarkHeight, MyMarkArray); - } - else - MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert); + MyCGroup.ContextMarker.IsDef = 1; + MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed); + MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen); + MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue); + MyCGroup.ContextMarker.MarkerType = aMarkerType; + MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale); + MyCGroup.ContextMarker.MarkerImage = thCtx->GetMarkerImage(); - MyCGroup.ContextMarker.IsSet = 1; + int noinsert = 0; + MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert); - Update (); + MyCGroup.ContextMarker.IsSet = 1; + Update(); } void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) { @@ -777,19 +763,19 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d R = Standard_Real (MyCGroup.ContextMarker.Color.r); G = Standard_Real (MyCGroup.ContextMarker.Color.g); B = Standard_Real (MyCGroup.ContextMarker.Color.b); - AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType); + AMType = MyCGroup.ContextMarker.MarkerType; AScale = Standard_Real (MyCGroup.ContextMarker.Scale); if( AMType == Aspect_TOM_USERDEFINED ) { - CTXM->SetTexture( MyMarkWidth, MyMarkHeight, MyMarkArray ); + CTXM->SetBitMap( MyMarkWidth, MyMarkHeight, MyMarkArray ); } } else { R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r); G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g); B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b); - AMType = Aspect_TypeOfMarker (MyCGroup.Struct->ContextMarker.MarkerType); + AMType = MyCGroup.Struct->ContextMarker.MarkerType; AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale); } AColor.SetValues (R, G, B, Quantity_TOC_RGB); diff --git a/src/Graphic3d/Graphic3d_MarkerImage.cxx b/src/Graphic3d/Graphic3d_MarkerImage.cxx new file mode 100644 index 0000000000..14e853af4c --- /dev/null +++ b/src/Graphic3d/Graphic3d_MarkerImage.cxx @@ -0,0 +1,226 @@ +// Created on: 2013-06-25 +// Created by: Dmitry BOBYLEV +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +#include +#include +#include + +namespace +{ + static volatile Standard_Integer THE_MARKER_IMAGE_COUNTER = 0; +}; + +IMPLEMENT_STANDARD_HANDLE (Graphic3d_MarkerImage, Standard_Transient) +IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_MarkerImage, Standard_Transient) + +// ======================================================================= +// function : Graphic3d_MarkerImage +// purpose : +// ======================================================================= +Graphic3d_MarkerImage::Graphic3d_MarkerImage (const Handle(Image_PixMap)& theImage) +: myBitMap (NULL), + myImage (theImage), + myImageAlpha (NULL), + myMargin (1), + myWidth ((Standard_Integer )theImage->Width()), + myHeight ((Standard_Integer )theImage->Height()) +{ + myImageId = TCollection_AsciiString ("Graphic3d_MarkerImage_") + + TCollection_AsciiString (Standard_Atomic_Increment (&THE_MARKER_IMAGE_COUNTER)); + + myImageAlphaId = TCollection_AsciiString ("Graphic3d_MarkerImageAlpha_") + + TCollection_AsciiString (THE_MARKER_IMAGE_COUNTER); +} + +// ======================================================================= +// function : Graphic3d_MarkerImage +// purpose : +// ======================================================================= +Graphic3d_MarkerImage::Graphic3d_MarkerImage (const Handle(TColStd_HArray1OfByte)& theBitMap, + const Standard_Integer& theWidth, + const Standard_Integer& theHeight) +: myBitMap (theBitMap), + myImage (NULL), + myImageAlpha (NULL), + myMargin (1), + myWidth (theWidth), + myHeight (theHeight) +{ + myImageId = TCollection_AsciiString ("Graphic3d_MarkerImage_") + + TCollection_AsciiString (Standard_Atomic_Increment (&THE_MARKER_IMAGE_COUNTER)); + + myImageAlphaId = TCollection_AsciiString ("Graphic3d_MarkerImageAlpha_") + + TCollection_AsciiString (THE_MARKER_IMAGE_COUNTER); +} + +// ======================================================================= +// function : GetBitMapArray +// purpose : +// ======================================================================= +Handle(TColStd_HArray1OfByte) Graphic3d_MarkerImage::GetBitMapArray (const Standard_Real& theAlphaValue) const +{ + if (!myBitMap.IsNull()) + { + return myBitMap; + } + + Handle(TColStd_HArray1OfByte) aBitMap; + if (myImage.IsNull()) + { + return aBitMap; + } + + const Standard_Integer aNumOfBytesInRow = (Standard_Integer )(myImage->Width() / 8) + (myImage->Width() % 8 ? 1 : 0); + const Standard_Integer aNumOfBytes = (Standard_Integer )(aNumOfBytesInRow * myImage->Height()); + const Standard_Integer aHeight = (Standard_Integer )myImage->Height(); + const Standard_Integer aWidth = (Standard_Integer )myImage->Width(); + aBitMap = new TColStd_HArray1OfByte (0, aNumOfBytes - 1); + aBitMap->Init (0); + for (Standard_Integer aRow = 0; aRow < aHeight; aRow++) + { + for (Standard_Integer aColumn = 0; aColumn < aWidth; aColumn++) + { + Quantity_Parameter anAlphaValue; + Quantity_Color aColor = myImage->PixelColor (aColumn, aRow, anAlphaValue); + Standard_Boolean aBitOn = Standard_False; + + if (myImage->Format() == Image_PixMap::ImgGray) + { + aBitOn = aColor.Red() > theAlphaValue; + } + else + { + aBitOn = anAlphaValue > theAlphaValue; + } + + aBitMap->ChangeValue (aNumOfBytesInRow * aRow + aColumn / 8) += aBitOn ? (0x80 >> (aColumn % 8)) : 0; + } + } + + return aBitMap; +} + +// ======================================================================= +// function : GetImage +// purpose : +// ======================================================================= +const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImage() +{ + if (!myImage.IsNull()) + { + return myImage; + } + + if (myBitMap.IsNull()) + { + return myImage; + } + + // Converting a byte array to bitmap image. Row and column offsets are used + // to store bitmap in a square image, so the image will not be stretched + // when rendering with point sprites. + const Standard_Integer aNumOfBytesInRow = myWidth / 8 + (myWidth % 8 ? 1 : 0); + const Standard_Integer aSize = Max (myWidth, myHeight); + const Standard_Integer aRowOffset = (aSize - myHeight) / 2 + myMargin; + const Standard_Integer aColumnOffset = (aSize - myWidth ) / 2 + myMargin; + const Standard_Integer aLowerIndex = myBitMap->Lower(); + + myImage = new Image_PixMap(); + myImage->InitZero (Image_PixMap::ImgGray, aSize + myMargin * 2, aSize + myMargin * 2); + for (Standard_Integer aRowIter = 0; aRowIter < myHeight; aRowIter++) + { + Standard_Byte* anImageRow = myImage->ChangeRow (aRowIter + aRowOffset); + for (Standard_Integer aColumnIter = 0; aColumnIter < myWidth; aColumnIter++) + { + Standard_Boolean aBitOn = myBitMap->Value (aLowerIndex + aNumOfBytesInRow * aRowIter + aColumnIter / 8) & (0x80 >> (aColumnIter % 8)); + anImageRow[aColumnIter + aColumnOffset] = aBitOn ? 255 : 0; + } + } + + return myImage; +} + +// ======================================================================= +// function : GetImageAlpha +// purpose : +// ======================================================================= +const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImageAlpha() +{ + if (!myImageAlpha.IsNull()) + { + return myImageAlpha; + } + + if (!myImage.IsNull()) + { + if (myImage->Format() == Image_PixMap::ImgGray) + { + myImageAlpha = myImage; + } + else + { + myImageAlpha = new Image_PixMap(); + myImageAlpha->InitZero (Image_PixMap::ImgGray, myImage->Width(), myImage->Height()); + myImageAlpha->SetTopDown (Standard_False); + Quantity_Parameter anAlpha; + for (Standard_Integer aRowIter = 0; aRowIter < myImage->Height(); aRowIter++) + { + Standard_Byte* anImageRow = myImageAlpha->ChangeRow (aRowIter); + for (Standard_Integer aColumnIter = 0; aColumnIter < myImage->Width(); aColumnIter++) + { + myImage->PixelColor (aColumnIter, aRowIter, anAlpha); + anImageRow[aColumnIter] = Standard_Byte (255.0 * anAlpha); + } + } + } + } + + return myImageAlpha; +} + +// ======================================================================= +// function : GetImageId +// purpose : +// ======================================================================= +const TCollection_AsciiString& Graphic3d_MarkerImage::GetImageId() const +{ + return myImageId; +} + +// ======================================================================= +// function : GetImageAlphaId +// purpose : +// ======================================================================= +const TCollection_AsciiString& Graphic3d_MarkerImage::GetImageAlphaId() const +{ + return myImageAlphaId; +} + +// ======================================================================= +// function : GetTextureSize +// purpose : +// ======================================================================= +void Graphic3d_MarkerImage::GetTextureSize (Standard_Integer& theWidth, + Standard_Integer& theHeight) const +{ + theWidth = myWidth; + theHeight = myHeight; +} diff --git a/src/Graphic3d/Graphic3d_MarkerImage.hxx b/src/Graphic3d/Graphic3d_MarkerImage.hxx new file mode 100644 index 0000000000..848cb86278 --- /dev/null +++ b/src/Graphic3d/Graphic3d_MarkerImage.hxx @@ -0,0 +1,90 @@ +// Created on: 2013-06-25 +// Created by: Dmitry BOBYLEV +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Graphic3d_MarkerImage_H__ +#define _Graphic3d_MarkerImage_H__ + +#include + +#include +#include +#include +#include + +//! This class is used to store bitmaps and images for markers rendering. +//! It can convert bitmap texture stored in TColStd_HArray1OfByte to Image_PixMap and vice versa. +class Graphic3d_MarkerImage : public Standard_Transient +{ +public: + + //! @param theImage - source image + Standard_EXPORT Graphic3d_MarkerImage (const Handle(Image_PixMap)& theImage); + + //! Creates marker image from array of bytes + //! (method for compatibility with old markers definition). + //! @param theBitMap - source bitmap stored as array of bytes + //! @param theWidth - number of bits in a row + //! @param theHeight - number of bits in a column + Standard_EXPORT Graphic3d_MarkerImage (const Handle(TColStd_HArray1OfByte)& theBitMap, + const Standard_Integer& theWidth, + const Standard_Integer& theHeight); + + //! @param theAlphaValue pixels in the image that have alpha value greater than + //! or equal to this parameter will be stored in bitmap as "1", + //! others will be stored as "0" + //! @return marker image as array of bytes. If an instance of the class has been + //! initialized with image, it will be converted to bitmap based on the parameter theAlphaValue. + Standard_EXPORT Handle(TColStd_HArray1OfByte) GetBitMapArray (const Standard_Real& theAlphaValue = 0.5) const; + + //! @return marker image. If an instance of the class has been initialized with a bitmap, it will be + //! converted to image. + Standard_EXPORT const Handle(Image_PixMap)& GetImage(); + + //! @return image alpha as grayscale image. Note that if an instance of the class has been initialized + //! with a bitmap or with grayscale image this method will return exactly the same image as GetImage() + Standard_EXPORT const Handle(Image_PixMap)& GetImageAlpha(); + + //! @return an unique ID. This ID will be used to manage resource in graphic driver. + Standard_EXPORT const TCollection_AsciiString& GetImageId() const; + + //! @return an unique ID. This ID will be used to manage resource in graphic driver. + Standard_EXPORT const TCollection_AsciiString& GetImageAlphaId() const; + + //! @return texture size + Standard_EXPORT void GetTextureSize (Standard_Integer& theWidth, + Standard_Integer& theHeight) const; + +private: + + TCollection_AsciiString myImageId; //!< resource identifier + TCollection_AsciiString myImageAlphaId; //!< resource identifier + Handle(TColStd_HArray1OfByte) myBitMap; //!< bytes array with bitmap definition (for compatibility with old code) + Handle(Image_PixMap) myImage; //!< full-color marker definition + Handle(Image_PixMap) myImageAlpha; //!< alpha-color marker definition (for dynamic hi-lighting) + Standard_Integer myMargin; //!< extra margin from boundaries for bitmap -> point sprite conversion, 1 px by default + Standard_Integer myWidth; //!< marker width + Standard_Integer myHeight; //!< marker height + +public: + + DEFINE_STANDARD_RTTI(Graphic3d_MarkerImage) // Type definition + +}; + +#endif // _Graphic3d_MarkerImage_H__ diff --git a/src/OpenGl/OpenGl_Marker.hxx b/src/Graphic3d/Graphic3d_MarkerImage_Handle.hxx similarity index 60% rename from src/OpenGl/OpenGl_Marker.hxx rename to src/Graphic3d/Graphic3d_MarkerImage_Handle.hxx index c8c0e061c9..f847ae6675 100644 --- a/src/OpenGl/OpenGl_Marker.hxx +++ b/src/Graphic3d/Graphic3d_MarkerImage_Handle.hxx @@ -1,6 +1,6 @@ -// Created on: 2011-07-13 -// Created by: Sergey ZERCHANINOV -// Copyright (c) 2011-2012 OPEN CASCADE SAS +// Created on: 2013-06-25 +// Created by: Dmitry BOBYLEV +// Copyright (c) 2013 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file @@ -17,29 +17,14 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. +#ifndef _Graphic3d_TextureBitMap_Handle_H__ +#define _Graphic3d_TextureBitMap_Handle_H__ -#ifndef OpenGl_Marker_Header -#define OpenGl_Marker_Header +#include +#include -#include +class Graphic3d_TextureBitMap; +DEFINE_STANDARD_HANDLE(Graphic3d_MarkerImage, Standard_Transient) +typedef Handle(Graphic3d_MarkerImage) Graphic3d_MarkerImage_Handle; -#include - -class OpenGl_Marker : public OpenGl_Element -{ - public: - - OpenGl_Marker (const TEL_POINT &APoint) : myPoint(APoint) {} - - virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; - virtual void Release (const Handle(OpenGl_Context)& theContext); - - protected: - - TEL_POINT myPoint; - - public: - DEFINE_STANDARD_ALLOC -}; - -#endif //OpenGl_Marker_Header +#endif // _Graphic3d_TextureBitMap_Handle_H__ diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index 3dce01e085..87ba9e8b25 100755 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -795,7 +795,7 @@ Handle(Graphic3d_AspectMarker3d) Graphic3d_Structure::Marker3dAspect () const { G = Standard_Real (MyCStructure.ContextMarker.Color.g); B = Standard_Real (MyCStructure.ContextMarker.Color.b); AColor.SetValues (R, G, B, Quantity_TOC_RGB); - AMType = Aspect_TypeOfMarker (MyCStructure.ContextMarker.MarkerType); + AMType = MyCStructure.ContextMarker.MarkerType; AScale = Standard_Real (MyCStructure.ContextMarker.Scale); Handle(Graphic3d_AspectMarker3d) CTXM = @@ -1303,7 +1303,7 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectMark MyCStructure.ContextMarker.Color.r = float (R); MyCStructure.ContextMarker.Color.g = float (G); MyCStructure.ContextMarker.Color.b = float (B); - MyCStructure.ContextMarker.MarkerType = int (AMType); + MyCStructure.ContextMarker.MarkerType = AMType; MyCStructure.ContextMarker.Scale = float (AScale); MyCStructure.ContextMarker.IsDef = 1; @@ -2076,7 +2076,7 @@ void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& MyCStructure.ContextMarker.Color.r = float (R); MyCStructure.ContextMarker.Color.g = float (G); MyCStructure.ContextMarker.Color.b = float (B); - MyCStructure.ContextMarker.MarkerType = int (AMType); + MyCStructure.ContextMarker.MarkerType = AMType; MyCStructure.ContextMarker.Scale = float (AScale); CTXT->Values (AColor, AFont, AnExpansion, ASpace,AStyleT,ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect); diff --git a/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx b/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx index 84e73ee31d..032468f85b 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx @@ -371,23 +371,6 @@ typedef struct { } CALL_DEF_MATERIAL; -/* CONTEXTE MARKER */ - -typedef struct { - - int IsDef; - - int IsSet; - - CALL_DEF_COLOR Color; - - int MarkerType; - - float Scale; - -} CALL_DEF_CONTEXTMARKER; - - /* CONTEXTE TEXT */ typedef struct { diff --git a/src/MeshVS/MeshVS_MeshPrsBuilder.cxx b/src/MeshVS/MeshVS_MeshPrsBuilder.cxx index 0088485875..412544dded 100755 --- a/src/MeshVS/MeshVS_MeshPrsBuilder.cxx +++ b/src/MeshVS/MeshVS_MeshPrsBuilder.cxx @@ -30,8 +30,8 @@ #include #include #include +#include #include -#include #include #include @@ -136,7 +136,7 @@ void MeshVS_MeshPrsBuilder::BuildNodes ( const Handle(Prs3d_Presentation)& Prs, if ( upper<=0 ) return; - Graphic3d_Array1OfVertex aNodePoints ( 1, upper ); + Handle(Graphic3d_ArrayOfPoints) aNodePoints = new Graphic3d_ArrayOfPoints (upper); Standard_Integer k=0; TColStd_MapIteratorOfPackedMapOfInteger it (anIDs); for( ; it.More(); it.Next() ) @@ -146,8 +146,8 @@ void MeshVS_MeshPrsBuilder::BuildNodes ( const Handle(Prs3d_Presentation)& Prs, { if ( IsExcludingOn() ) IDsToExclude.Add (aKey); - k++; - aNodePoints.SetValue ( k, Graphic3d_Vertex ( aCoords(1), aCoords(2), aCoords(3) ) ); + k++; + aNodePoints->AddVertex (aCoords(1), aCoords(2), aCoords(3)); } } @@ -156,7 +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->MarkerSet ( aNodePoints ); + aNodeGroup->AddPrimitiveArray (aNodePoints); } } @@ -474,8 +474,10 @@ void MeshVS_MeshPrsBuilder::BuildHilightPrs ( const Handle(Prs3d_Presentation)& { case MeshVS_ET_Node : { - aHilightGroup->SetPrimitivesAspect ( aNodeMark ); - aHilightGroup->Marker ( Graphic3d_Vertex ( aCoords(1), aCoords(2), aCoords(3) ) ); + aHilightGroup->SetPrimitivesAspect (aNodeMark); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (aCoords(1), aCoords(2), aCoords(3)); + aHilightGroup->AddPrimitiveArray (anArrayOfPoints); } break; diff --git a/src/MeshVS/MeshVS_TextPrsBuilder.cxx b/src/MeshVS/MeshVS_TextPrsBuilder.cxx index ecfc6c3847..78446ee7fd 100755 --- a/src/MeshVS/MeshVS_TextPrsBuilder.cxx +++ b/src/MeshVS/MeshVS_TextPrsBuilder.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -260,10 +261,11 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs, continue; } - Graphic3d_Vertex aPoint( X, Y, Z ); - - aTextGroup->Marker ( aPoint ); - aTextGroup->Text ( aStr.ToCString(), aPoint, aHeight ); + Graphic3d_Vertex aPoint (X, Y, Z); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (X, Y, Z); + aTextGroup->AddPrimitiveArray (anArrayOfPoints); + aTextGroup->Text (aStr.ToCString(), aPoint, aHeight); } } } diff --git a/src/OpenGl/FILES b/src/OpenGl/FILES index 51d8949bbe..9e596aede7 100755 --- a/src/OpenGl/FILES +++ b/src/OpenGl/FILES @@ -8,7 +8,6 @@ OpenGl_GraphicDriver_2.cxx OpenGl_GraphicDriver_3.cxx OpenGl_GraphicDriver_4.cxx OpenGl_GraphicDriver_7.cxx -OpenGl_GraphicDriver_703.cxx OpenGl_GraphicDriver_713.cxx OpenGl_GraphicDriver_Layer.cxx OpenGl_GraphicDriver_Export.cxx @@ -30,10 +29,9 @@ OpenGl_Text.hxx OpenGl_Text.cxx OpenGl_TextFormatter.hxx OpenGl_TextFormatter.cxx -OpenGl_Marker.hxx -OpenGl_Marker.cxx -OpenGl_MarkerSet.hxx -OpenGl_MarkerSet.cxx +OpenGl_PointSprite.hxx +OpenGl_PointSprite.cxx +Handle_OpenGl_PointSprite.hxx OpenGl_PrimitiveArray.hxx OpenGl_PrimitiveArray.cxx Handle_OpenGl_Workspace.hxx diff --git a/src/OpenGl/OpenGl_MarkerSet.hxx b/src/OpenGl/Handle_OpenGl_PointSprite.hxx similarity index 55% rename from src/OpenGl/OpenGl_MarkerSet.hxx rename to src/OpenGl/Handle_OpenGl_PointSprite.hxx index 4840f0cbed..775d373ea3 100644 --- a/src/OpenGl/OpenGl_MarkerSet.hxx +++ b/src/OpenGl/Handle_OpenGl_PointSprite.hxx @@ -1,6 +1,6 @@ -// Created on: 2011-07-13 -// Created by: Sergey ZERCHANINOV -// Copyright (c) 2011-2012 OPEN CASCADE SAS +// Created on: 2013-08-26 +// Created by: Kirill GAVRILOV +// Copyright (c) 2013 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file @@ -17,39 +17,12 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. +#ifndef _Handle_OpenGl_PointSprite_Header +#define _Handle_OpenGl_PointSprite_Header -#ifndef OpenGl_MarkerSet_Header -#define OpenGl_MarkerSet_Header +#include -#include +class OpenGl_PointSprite; +DEFINE_STANDARD_HANDLE(OpenGl_PointSprite, OpenGl_Texture) -#include - -#include - -class OpenGl_MarkerSet : public OpenGl_Element -{ - -public: - - OpenGl_MarkerSet (const Standard_Integer ANbPoints, const Graphic3d_Vertex *APoints); - - virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; - virtual void Release (const Handle(OpenGl_Context)& theContext); - -protected: - - virtual ~OpenGl_MarkerSet(); - -protected: - - Tint myNbPoints; - TEL_POINT* myPoints; - -public: - - DEFINE_STANDARD_ALLOC - -}; - -#endif //OpenGl_MarkerSet_Header +#endif // _Handle_OpenGl_PointSprite_Header diff --git a/src/OpenGl/OpenGl_AspectMarker.cxx b/src/OpenGl/OpenGl_AspectMarker.cxx index a53e7148fd..c0a39fa7f3 100644 --- a/src/OpenGl/OpenGl_AspectMarker.cxx +++ b/src/OpenGl/OpenGl_AspectMarker.cxx @@ -18,38 +18,1838 @@ // and conditions governing the rights and limitations under the License. #include +#include +#include +#include #include +#include +#include +#include + static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }}; -/*----------------------------------------------------------------------*/ +// Following Section relates to default markers -OpenGl_AspectMarker::OpenGl_AspectMarker () - : myColor(myDefaultColor), - myType(Aspect_TOM_PLUS), - myScale(1.0F) -{} +#define TEL_NO_OF_SIZES 13 +#define TEL_PM_START_SIZE 1.0 +#define TEL_PM_END_SIZE 7.0 + +struct PM_FONT_INFO +{ + Tfloat width, height; + Tint offset; +}; +typedef PM_FONT_INFO* pm_font_info; + +#define PM_PLUS_10_NUM 9*2 +#define PM_PLUS_15_NUM 11*2 +#define PM_PLUS_20_NUM 13*2 +#define PM_PLUS_25_NUM 15*2 +#define PM_PLUS_30_NUM 17*3 +#define PM_PLUS_35_NUM 19*3 +#define PM_PLUS_40_NUM 21*3 +#define PM_PLUS_45_NUM 23*3 +#define PM_PLUS_50_NUM 25*4 +#define PM_PLUS_55_NUM 27*4 +#define PM_PLUS_60_NUM 29*4 +#define PM_PLUS_65_NUM 31*4 +#define PM_PLUS_70_NUM 32*4 + +#define PM_STAR_10_NUM 9 +#define PM_STAR_15_NUM 11*2 +#define PM_STAR_20_NUM 13*2 +#define PM_STAR_25_NUM 15*2 +#define PM_STAR_30_NUM 17*2 +#define PM_STAR_35_NUM 19*2 +#define PM_STAR_40_NUM 21*3 +#define PM_STAR_45_NUM 23*3 +#define PM_STAR_50_NUM 25*3 +#define PM_STAR_55_NUM 27*3 +#define PM_STAR_60_NUM 29*4 +#define PM_STAR_65_NUM 32*4 +#define PM_STAR_70_NUM 32*4 + +#define PM_CIRC_10_NUM 7 +#define PM_CIRC_15_NUM 9*2 +#define PM_CIRC_20_NUM 9*2 +#define PM_CIRC_25_NUM 11*2 +#define PM_CIRC_30_NUM 13*2 +#define PM_CIRC_35_NUM 15*2 +#define PM_CIRC_40_NUM 17*3 +#define PM_CIRC_45_NUM 19*3 +#define PM_CIRC_50_NUM 21*3 +#define PM_CIRC_55_NUM 23*3 +#define PM_CIRC_60_NUM 25*4 +#define PM_CIRC_65_NUM 27*4 +#define PM_CIRC_70_NUM 29*4 + +#define PM_CROSS_10_NUM 7 +#define PM_CROSS_15_NUM 9*2 +#define PM_CROSS_20_NUM 11*2 +#define PM_CROSS_25_NUM 13*2 +#define PM_CROSS_30_NUM 15*2 +#define PM_CROSS_35_NUM 17*3 +#define PM_CROSS_40_NUM 19*3 +#define PM_CROSS_45_NUM 21*3 +#define PM_CROSS_50_NUM 23*3 +#define PM_CROSS_55_NUM 25*4 +#define PM_CROSS_60_NUM 27*4 +#define PM_CROSS_65_NUM 32*4 +#define PM_CROSS_70_NUM 32*4 -/*----------------------------------------------------------------------*/ +#define PM_PLUS_10_OFT 0 +#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM +#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM +#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM +#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM +#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM +#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM +#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM +#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM +#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM +#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM +#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM +#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM -void OpenGl_AspectMarker::SetContext (const CALL_DEF_CONTEXTMARKER &AContext) +#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM +#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM +#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM +#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM +#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM +#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM +#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM +#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM +#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM +#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM +#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM +#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM +#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM + +#define PM_CIRC_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM +#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM +#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM +#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM +#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM +#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM +#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM +#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM +#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM +#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM +#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM +#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM +#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM + +#define PM_CROSS_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM +#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM +#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM +#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM +#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM +#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM +#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM +#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM +#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM +#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM +#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM +#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM +#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM + +static const PM_FONT_INFO arrPMFontInfo[][TEL_NO_OF_SIZES] = { - myColor.rgb[0] = (float) AContext.Color.r; - myColor.rgb[1] = (float) AContext.Color.g; - myColor.rgb[2] = (float) AContext.Color.b; - myColor.rgb[3] = 1.0f; - myType = (Aspect_TypeOfMarker) AContext.MarkerType; - myScale = (float) AContext.Scale; + // TOM_POINT - not used + {{0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}}, + + // TOM_PLUS + {{ 9.f, 9.f, PM_PLUS_10_OFT}, + {11.f, 11.f, PM_PLUS_15_OFT}, + {13.f, 13.f, PM_PLUS_20_OFT}, + {15.f, 15.f, PM_PLUS_25_OFT}, + {17.f, 17.f, PM_PLUS_30_OFT}, + {19.f, 19.f, PM_PLUS_35_OFT}, + {21.f, 21.f, PM_PLUS_40_OFT}, + {23.f, 23.f, PM_PLUS_45_OFT}, + {25.f, 25.f, PM_PLUS_50_OFT}, + {27.f, 27.f, PM_PLUS_55_OFT}, + {29.f, 29.f, PM_PLUS_60_OFT}, + {31.f, 31.f, PM_PLUS_65_OFT}, + {32.f, 32.f, PM_PLUS_70_OFT}}, + + // TOM_STAR + {{ 7.f, 9.f, PM_STAR_10_OFT}, + {9.f, 11.f, PM_STAR_15_OFT}, + {11.f, 13.f, PM_STAR_20_OFT}, + {13.f, 15.f, PM_STAR_25_OFT}, + {13.f, 17.f, PM_STAR_30_OFT}, + {15.f, 19.f, PM_STAR_35_OFT}, + {17.f, 21.f, PM_STAR_40_OFT}, + {19.f, 23.f, PM_STAR_45_OFT}, + {21.f, 25.f, PM_STAR_50_OFT}, + {23.f, 27.f, PM_STAR_55_OFT}, + {25.f, 29.f, PM_STAR_60_OFT}, + {32.f, 32.f, PM_STAR_65_OFT}, + {32.f, 32.f, PM_STAR_70_OFT}}, + + // TOM_X + {{ 7.f, 7.f, PM_CROSS_10_OFT}, + { 9.f, 9.f, PM_CROSS_15_OFT}, + {11.f, 11.f, PM_CROSS_20_OFT}, + {13.f, 13.f, PM_CROSS_25_OFT}, + {15.f, 15.f, PM_CROSS_30_OFT}, + {17.f, 17.f, PM_CROSS_35_OFT}, + {19.f, 19.f, PM_CROSS_40_OFT}, + {21.f, 21.f, PM_CROSS_45_OFT}, + {23.f, 23.f, PM_CROSS_50_OFT}, + {25.f, 25.f, PM_CROSS_55_OFT}, + {27.f, 27.f, PM_CROSS_60_OFT}, + {32.f, 32.f, PM_CROSS_65_OFT}, + {32.f, 32.f, PM_CROSS_70_OFT}}, + + // TOM_O + {{ 7.f, 7.f, PM_CIRC_10_OFT}, + { 9.f, 9.f, PM_CIRC_15_OFT}, + { 9.f, 9.f, PM_CIRC_20_OFT}, + {11.f, 11.f, PM_CIRC_25_OFT}, + {13.f, 13.f, PM_CIRC_30_OFT}, + {15.f, 15.f, PM_CIRC_35_OFT}, + {17.f, 17.f, PM_CIRC_40_OFT}, + {19.f, 19.f, PM_CIRC_45_OFT}, + {21.f, 21.f, PM_CIRC_50_OFT}, + {23.f, 23.f, PM_CIRC_55_OFT}, + {25.f, 25.f, PM_CIRC_60_OFT}, + {27.f, 27.f, PM_CIRC_65_OFT}, + {29.f, 29.f, PM_CIRC_70_OFT}} +}; + +static const Standard_Byte OpenGl_AspectMarker_myMarkerRaster[] = +{ + // TYPE = PLUS + + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0xff,0x80, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, // PLUS 9x9 = 1.0 + + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0xff,0xe0, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, // PLUS 11x11 = 1.5 + + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0xff,0xf8, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, // PLUS 13x13 = 2.0 + + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0xff,0xfe, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, // PLUS 15x15 = 2.5 + + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0xff,0xff, 0x80, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, // PLUS 17x17 = 3.0 + + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0xff,0xff, 0xe0, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, // PLUS 19x19 = 3.5 + + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0xff,0xff, 0xf8, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, // PLUS 21x21 = 4.0 + + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0xff,0xff, 0xfe, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, // PLUS 23x23 = 4.5 + + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0xff,0xff, 0xff,0x80, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, // PLUS 25x25 = 5.0 + + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0xff,0xff, 0xff,0xe0, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, // PLUS 27x27 = 5.5 + + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0xff,0xff, 0xff,0xf8, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, // PLUS 29x29 = 6.0 + + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0xff,0xff, 0xff,0xfd, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, // PLUS 31x31 = 6.5 + + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0xff,0xff, 0xff,0xff, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, // PLUS 32x32 = 7.0 + + // TYPE = STAR + + 0x10, + 0x10, + 0xd6, + 0x38, + 0x10, + 0x38, + 0xd6, + 0x10, + 0x10, // STAR 7x9 = 1.0 + + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0xc9,0x80, + 0x3e,0x00, + 0x08,0x00, + 0x3e,0x00, + 0xc9,0x80, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, // STAR 9x11 = 1.5 + + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x84,0x20, + 0x64,0xc0, + 0x1f,0x00, + 0x04,0x00, + 0x1f,0x00, + 0x64,0xc0, + 0x84,0x20, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, // STAR 11x13 = 2.0 + + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x82,0x18, + 0x62,0x60, + 0x1b,0x80, + 0x06,0x00, + 0x1b,0x80, + 0x62,0x60, + 0x82,0x18, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, // STAR 13x15 = 2.5 + + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x82,0x08, + 0x62,0x30, + 0x12,0x40, + 0x0f,0x80, + 0x02,0x00, + 0x0f,0x80, + 0x12,0x40, + 0x62,0x30, + 0x82,0x08, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, // STAR 13x17 = 3.0 + + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0xc1,0x06, + 0x21,0x18, + 0x19,0x20, + 0x07,0xc0, + 0x01,0x00, + 0x07,0xc0, + 0x19,0x20, + 0x21,0x18, + 0xc1,0x06, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, // STAR 15x19 = 3.5 + + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x80,0x80, 0x80, + 0x60,0x83, 0x00, + 0x10,0x8c, 0x00, + 0x0c,0x90, 0x00, + 0x03,0xe0, 0x00, + 0x00,0x80, 0x00, + 0x03,0xe0, 0x00, + 0x0c,0x90, 0x00, + 0x10,0x8c, 0x00, + 0x60,0x83, 0x00, + 0x80,0x80, 0x80, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, // STAR 17x21 = 4.0 + + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0xc0,0x40, 0x60, + 0x30,0x41, 0x80, + 0x08,0x42, 0x00, + 0x06,0x4c, 0x00, + 0x01,0xf0, 0x00, + 0x00,0x40, 0x00, + 0x01,0xf0, 0x00, + 0x06,0x4c, 0x00, + 0x08,0x42, 0x00, + 0x30,0x41, 0x80, + 0xc0,0x40, 0x60, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, // STAR 19x23 = 4.5 + + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x80,0x20, 0x08, + 0x60,0x20, 0x30, + 0x18,0x20, 0xc0, + 0x04,0x21, 0x00, + 0x03,0x26, 0x00, + 0x00,0xf8, 0x00, + 0x00,0x20, 0x00, + 0x00,0xf8, 0x00, + 0x03,0x26, 0x00, + 0x04,0x21, 0x00, + 0x18,0x20, 0xc0, + 0x60,0x20, 0x30, + 0x80,0x20, 0x08, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, // STAR 21x25 = 5.0 + + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0xc0,0x10, 0x06, + 0x30,0x10, 0x18, + 0x08,0x10, 0x60, + 0x06,0x10, 0x80, + 0x01,0x93, 0x00, + 0x00,0x7c, 0x00, + 0x00,0x10, 0x00, + 0x00,0x7c, 0x00, + 0x01,0x93, 0x00, + 0x06,0x10, 0x80, + 0x08,0x10, 0x60, + 0x30,0x10, 0x18, + 0xc0,0x10, 0x06, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, // STAR 23x27 = 5.5 + + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x80,0x08, 0x00,0x80, + 0x60,0x08, 0x03,0x00, + 0x18,0x08, 0x0c,0x00, + 0x04,0x08, 0x30,0x00, + 0x03,0x08, 0x40,0x00, + 0x00,0xc9, 0x80,0x00, + 0x00,0x3e, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x3e, 0x00,0x00, + 0x00,0xc9, 0x80,0x00, + 0x03,0x08, 0x40,0x00, + 0x04,0x08, 0x30,0x00, + 0x18,0x08, 0x0c,0x00, + 0x60,0x08, 0x03,0x00, + 0x80,0x08, 0x00,0x80, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, // STAR 25x29 = 6.0 + + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x30,0x00, 0x80,0x06, + 0x0c,0x00, 0x80,0x18, + 0x03,0x00, 0x80,0x60, + 0x00,0xc0, 0x81,0x80, + 0x00,0x30, 0x86,0x00, + 0x00,0x0c, 0x98,0x00, + 0x00,0x03, 0xe0,0x00, + 0x00,0x03, 0xe0,0x00, + 0x00,0x0c, 0x98,0x00, + 0x00,0x30, 0x86,0x00, + 0x00,0xc0, 0x81,0x80, + 0x03,0x00, 0x80,0x60, + 0x0c,0x00, 0x80,0x18, + 0x30,0x00, 0x80,0x06, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x00,0x00, + 0x00,0x00, 0x00,0x00, // STAR 32x32 = 6.5 + + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x10, 0x00, 0x80, 0x04, + 0x0c, 0x00, 0x80, 0x18, + 0x02, 0x00, 0x80, 0x20, + 0x01, 0x80, 0x80, 0xc0, + 0x00, 0x40, 0x81, 0x00, + 0x00, 0x30, 0x86, 0x00, + 0x00, 0x08, 0x88, 0x00, + 0x00, 0x06, 0xb0, 0x00, + 0x00, 0x01, 0xc0, 0x00, + 0x00, 0x06, 0xb0, 0x00, + 0x00, 0x08, 0x88, 0x00, + 0x00, 0x30, 0x86, 0x00, + 0x00, 0x40, 0x81, 0x00, + 0x01, 0x80, 0x80, 0xc0, + 0x02, 0x00, 0x80, 0x20, + 0x0c, 0x00, 0x80, 0x18, + 0x10, 0x00, 0x80, 0x04, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, // STAR 32x32 = 7.0 + + // TYPE = CIRC + + 0x38, + 0x44, + 0x82, + 0x82, + 0x82, + 0x44, + 0x38, // CIRC 7x7 = 1.0 + + 0x3c,0x00, + 0x42,0x00, + 0x81,0x00, + 0x81,0x00, + 0x81,0x00, + 0x81,0x00, + 0x42,0x00, + 0x3c,0x00, + 0x00,0x00, //CIRC 9x9 = 1.5 + + 0x3e,0x00, + 0x41,0x00, + 0x81,0x80, + 0x80,0x80, + 0x80,0x80, + 0x80,0x80, + 0x81,0x80, + 0x41,0x00, + 0x3e,0x00, // CIRC 9x9 = 2.0 + + 0x1f,0x00, + 0x20,0x80, + 0x40,0x40, + 0x80,0x20, + 0x80,0x20, + 0x80,0x20, + 0x80,0x20, + 0x80,0x20, + 0x40,0x40, + 0x20,0x80, + 0x1f,0x00, // CIRC 11x11 = 2.5 + + 0x0f,0x80, + 0x10,0x40, + 0x20,0x20, + 0x40,0x10, + 0x80,0x08, + 0x80,0x08, + 0x80,0x08, + 0x80,0x08, + 0x80,0x08, + 0x40,0x10, + 0x20,0x20, + 0x10,0x40, + 0x0f,0x80, // CIRC 13x13 = 3.0 + + 0x07,0xc0, + 0x18,0x30, + 0x20,0x08, + 0x40,0x04, + 0x40,0x04, + 0x80,0x02, + 0x80,0x02, + 0x80,0x02, + 0x80,0x02, + 0x80,0x02, + 0x40,0x04, + 0x40,0x04, + 0x20,0x08, + 0x18,0x30, + 0x07,0xc0, // CIRC 15x15 = 3.5 + + 0x03,0xe0, 0x00, + 0x0c,0x18, 0x00, + 0x10,0x04, 0x00, + 0x20,0x02, 0x00, + 0x40,0x01, 0x00, + 0x40,0x01, 0x00, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x40,0x01, 0x00, + 0x40,0x01, 0x00, + 0x20,0x02, 0x00, + 0x10,0x04, 0x00, + 0x0c,0x18, 0x00, + 0x03,0xe0, 0x00, // CIRC 17x17 = 4.0 + + 0x03,0xf8, 0x00, + 0x0e,0x0e, 0x00, + 0x18,0x03, 0x00, + 0x20,0x00, 0x80, + 0x60,0x00, 0xc0, + 0x40,0x00, 0x40, + 0xc0,0x00, 0x60, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0xc0,0x00, 0x60, + 0x40,0x00, 0x40, + 0x60,0x00, 0xc0, + 0x20,0x00, 0x80, + 0x18,0x03, 0x00, + 0x0e,0x0e, 0x00, + 0x03,0xf8, 0x00, // CIRC 19x19 = 4.5 + + 0x01,0xfc, 0x00, + 0x06,0x03, 0x00, + 0x08,0x00, 0x80, + 0x10,0x00, 0x40, + 0x20,0x00, 0x20, + 0x40,0x00, 0x10, + 0x40,0x00, 0x10, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x40,0x00, 0x10, + 0x40,0x00, 0x10, + 0x20,0x00, 0x20, + 0x10,0x00, 0x40, + 0x08,0x00, 0x80, + 0x06,0x03, 0x00, + 0x01,0xfc, 0x00, // CIRC 21x21 = 5.0 + + 0x00,0xfe, 0x00, + 0x03,0x01, 0x80, + 0x0c,0x00, 0x60, + 0x18,0x00, 0x30, + 0x30,0x00, 0x18, + 0x20,0x00, 0x08, + 0x40,0x00, 0x04, + 0x40,0x00, 0x04, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x40,0x00, 0x04, + 0x40,0x00, 0x04, + 0x20,0x00, 0x08, + 0x30,0x00, 0x18, + 0x18,0x00, 0x30, + 0x0c,0x00, 0x60, + 0x03,0x01, 0x80, + 0x00,0xfe, 0x00, // CIRC 23x23 = 5.5 + + 0x00,0x7f, 0x00,0x00, + 0x01,0x80, 0xc0,0x00, + 0x06,0x00, 0x30,0x00, + 0x08,0x00, 0x08,0x00, + 0x10,0x00, 0x04,0x00, + 0x20,0x00, 0x02,0x00, + 0x20,0x00, 0x02,0x00, + 0x40,0x00, 0x01,0x00, + 0x40,0x00, 0x01,0x00, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x40,0x00, 0x01,0x00, + 0x40,0x00, 0x01,0x00, + 0x20,0x00, 0x02,0x00, + 0x20,0x00, 0x02,0x00, + 0x10,0x00, 0x04,0x00, + 0x08,0x00, 0x08,0x00, + 0x06,0x00, 0x30,0x00, + 0x01,0x80, 0xc0,0x00, + 0x00,0x7f, 0x00,0x00, // CIRC 25x25 = 6.0 + + 0x00,0x3f, 0x80,0x00, + 0x01,0xc0, 0x70,0x00, + 0x03,0x00, 0x18,0x00, + 0x0c,0x00, 0x06,0x00, + 0x18,0x00, 0x03,0x00, + 0x10,0x00, 0x01,0x00, + 0x20,0x00, 0x00,0x80, + 0x60,0x00, 0x00,0xc0, + 0x40,0x00, 0x00,0x40, + 0x40,0x00, 0x00,0x40, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x40,0x00, 0x00,0x40, + 0x40,0x00, 0x00,0x40, + 0x60,0x00, 0x00,0xc0, + 0x20,0x00, 0x00,0x80, + 0x10,0x00, 0x01,0x00, + 0x18,0x00, 0x03,0x00, + 0x0c,0x00, 0x06,0x00, + 0x03,0x00, 0x18,0x00, + 0x01,0xc0, 0x70,0x00, + 0x00,0x3f, 0x80,0x00, // CIRC 27x27 = 6.5 + + 0x00,0x1f, 0xc0,0x00, + 0x00,0xe0, 0x38,0x00, + 0x01,0x00, 0x04,0x00, + 0x06,0x00, 0x03,0x00, + 0x08,0x00, 0x00,0x80, + 0x10,0x00, 0x00,0x40, + 0x10,0x00, 0x00,0x40, + 0x20,0x00, 0x00,0x20, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x20,0x00, 0x00,0x20, + 0x10,0x00, 0x00,0x40, + 0x10,0x00, 0x00,0x40, + 0x08,0x00, 0x00,0x80, + 0x06,0x00, 0x03,0x00, + 0x01,0x00, 0x04,0x00, + 0x00,0xe0, 0x38,0x00, + 0x00,0x1f, 0xc0,0x00, // CIRC 29x29 = 7.0 + + // TYPE = CROSS + + 0x82, + 0x44, + 0x28, + 0x10, + 0x28, + 0x44, + 0x82, // CROSS 7x7 = 1.0 + + 0x80,0x80, + 0x41,0x00, + 0x22,0x00, + 0x14,0x00, + 0x08,0x00, + 0x14,0x00, + 0x22,0x00, + 0x41,0x00, + 0x80,0x80, // CROSS 9x9 = 1.5 + + 0x80,0x20, + 0x40,0x40, + 0x20,0x80, + 0x11,0x00, + 0x0a,0x00, + 0x04,0x00, + 0x0a,0x00, + 0x11,0x00, + 0x20,0x80, + 0x40,0x40, + 0x80,0x20, // CROSS 11x11 = 2.0 + + 0x80,0x08, + 0x40,0x10, + 0x20,0x20, + 0x10,0x40, + 0x08,0x80, + 0x05,0x00, + 0x02,0x00, + 0x05,0x00, + 0x08,0x80, + 0x10,0x40, + 0x20,0x20, + 0x40,0x10, + 0x80,0x08, // CROSS 13x13 = 2.5 + + 0x80,0x02, + 0x40,0x04, + 0x20,0x08, + 0x10,0x10, + 0x08,0x20, + 0x04,0x40, + 0x02,0x80, + 0x01,0x00, + 0x02,0x80, + 0x04,0x40, + 0x08,0x20, + 0x10,0x10, + 0x20,0x08, + 0x40,0x04, + 0x80,0x02, // CROSS 15x15 = 3.0 + + 0x80,0x00, 0x80, + 0x40,0x01, 0x00, + 0x20,0x02, 0x00, + 0x10,0x04, 0x00, + 0x08,0x08, 0x00, + 0x04,0x10, 0x00, + 0x02,0x20, 0x00, + 0x01,0x40, 0x00, + 0x00,0x80, 0x00, + 0x01,0x40, 0x00, + 0x02,0x20, 0x00, + 0x04,0x10, 0x00, + 0x08,0x08, 0x00, + 0x10,0x04, 0x00, + 0x20,0x02, 0x00, + 0x40,0x01, 0x00, + 0x80,0x00, 0x80, // CROSS 17x17 = 3.5 + + 0x80,0x00, 0x20, + 0x40,0x00, 0x40, + 0x20,0x00, 0x80, + 0x10,0x01, 0x00, + 0x08,0x02, 0x00, + 0x04,0x04, 0x00, + 0x02,0x08, 0x00, + 0x01,0x10, 0x00, + 0x00,0xa0, 0x00, + 0x00,0x40, 0x00, + 0x00,0xa0, 0x00, + 0x01,0x10, 0x00, + 0x02,0x08, 0x00, + 0x04,0x04, 0x00, + 0x08,0x02, 0x00, + 0x10,0x01, 0x00, + 0x20,0x00, 0x80, + 0x40,0x00, 0x40, + 0x80,0x00, 0x20, // CROSS 19x19 = 4.0 + + 0x80,0x00, 0x08, + 0x40,0x00, 0x10, + 0x20,0x00, 0x20, + 0x10,0x00, 0x40, + 0x08,0x00, 0x80, + 0x04,0x01, 0x00, + 0x02,0x02, 0x00, + 0x01,0x04, 0x00, + 0x00,0x88, 0x00, + 0x00,0x50, 0x00, + 0x00,0x20, 0x00, + 0x00,0x50, 0x00, + 0x00,0x88, 0x00, + 0x01,0x04, 0x00, + 0x02,0x02, 0x00, + 0x04,0x01, 0x00, + 0x08,0x00, 0x80, + 0x10,0x00, 0x40, + 0x20,0x00, 0x20, + 0x40,0x00, 0x10, + 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */ + + 0x80,0x00, 0x02, + 0x40,0x00, 0x04, + 0x20,0x00, 0x08, + 0x10,0x00, 0x10, + 0x08,0x00, 0x20, + 0x04,0x00, 0x40, + 0x02,0x00, 0x80, + 0x01,0x01, 0x00, + 0x00,0x82, 0x00, + 0x00,0x44, 0x00, + 0x00,0x28, 0x00, + 0x00,0x10, 0x00, + 0x00,0x28, 0x00, + 0x00,0x44, 0x00, + 0x00,0x82, 0x00, + 0x01,0x01, 0x00, + 0x02,0x00, 0x80, + 0x04,0x00, 0x40, + 0x08,0x00, 0x20, + 0x10,0x00, 0x10, + 0x20,0x00, 0x08, + 0x40,0x00, 0x04, + 0x80,0x00, 0x02, // CROSS 23x23 = 5.0 + + 0x80,0x00, 0x00,0x80, + 0x40,0x00, 0x01,0x00, + 0x20,0x00, 0x02,0x00, + 0x10,0x00, 0x04,0x00, + 0x08,0x00, 0x08,0x00, + 0x04,0x00, 0x10,0x00, + 0x02,0x00, 0x20,0x00, + 0x01,0x00, 0x40,0x00, + 0x00,0x80, 0x80,0x00, + 0x00,0x41, 0x00,0x00, + 0x00,0x22, 0x00,0x00, + 0x00,0x14, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x14, 0x00,0x00, + 0x00,0x22, 0x00,0x00, + 0x00,0x41, 0x00,0x00, + 0x00,0x80, 0x80,0x00, + 0x01,0x00, 0x40,0x00, + 0x02,0x00, 0x20,0x00, + 0x04,0x00, 0x10,0x00, + 0x08,0x00, 0x08,0x00, + 0x10,0x00, 0x04,0x00, + 0x20,0x00, 0x02,0x00, + 0x40,0x00, 0x01,0x00, + 0x80,0x00, 0x00,0x80, // CROSS 25x25 = 5.5 + + 0x80,0x00, 0x00,0x20, + 0x40,0x00, 0x00,0x40, + 0x20,0x00, 0x00,0x80, + 0x10,0x00, 0x01,0x00, + 0x08,0x00, 0x02,0x00, + 0x04,0x00, 0x04,0x00, + 0x02,0x00, 0x08,0x00, + 0x01,0x00, 0x10,0x00, + 0x00,0x80, 0x20,0x00, + 0x00,0x40, 0x40,0x00, + 0x00,0x20, 0x80,0x00, + 0x00,0x11, 0x00,0x00, + 0x00,0x0a, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x0a, 0x00,0x00, + 0x00,0x11, 0x00,0x00, + 0x00,0x20, 0x80,0x00, + 0x00,0x40, 0x40,0x00, + 0x00,0x80, 0x20,0x00, + 0x01,0x00, 0x10,0x00, + 0x02,0x00, 0x08,0x00, + 0x04,0x00, 0x04,0x00, + 0x08,0x00, 0x02,0x00, + 0x10,0x00, 0x01,0x00, + 0x20,0x00, 0x00,0x80, + 0x40,0x00, 0x00,0x40, + 0x80,0x00, 0x00,0x20, // CROSS 27x27 = 6.0 + + 0x00,0x00, 0x00,0x00, + 0x00,0x00, 0x00,0x00, + 0x20,0x00, 0x00,0x04, + 0x10,0x00, 0x00,0x08, + 0x08,0x00, 0x00,0x10, + 0x04,0x00, 0x00,0x20, + 0x02,0x00, 0x00,0x40, + 0x01,0x00, 0x00,0x80, + 0x00,0x80, 0x01,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x80, 0x01,0x00, + 0x01,0x00, 0x00,0x80, + 0x02,0x00, 0x00,0x40, + 0x04,0x00, 0x00,0x20, + 0x08,0x00, 0x00,0x10, + 0x10,0x00, 0x00,0x08, + 0x20,0x00, 0x00,0x04, + 0x00,0x00, 0x00,0x00, + 0x00,0x00, 0x00,0x00, // CROSS 32x32 = 6.5 + + 0x00,0x00, 0x00,0x00, + 0x40,0x00, 0x00,0x02, + 0x20,0x00, 0x00,0x04, + 0x10,0x00, 0x00,0x08, + 0x08,0x00, 0x00,0x10, + 0x04,0x00, 0x00,0x20, + 0x02,0x00, 0x00,0x40, + 0x01,0x00, 0x00,0x80, + 0x00,0x80, 0x01,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x80, 0x01,0x00, + 0x01,0x00, 0x00,0x80, + 0x02,0x00, 0x00,0x40, + 0x04,0x00, 0x00,0x20, + 0x08,0x00, 0x00,0x10, + 0x10,0x00, 0x00,0x08, + 0x20,0x00, 0x00,0x04, + 0x40,0x00, 0x00,0x02, + 0x00,0x00, 0x00,0x00 // CROSS 32x32 = 7.0 +}; + +// ======================================================================= +// function : GetMarkerBitMapArray +// purpose : Returns a parameters for the marker of the specified +// type and scale. +// ======================================================================= +void GetMarkerBitMapParam (const Aspect_TypeOfMarker theMarkerType, + const Standard_ShortReal& theScale, + Standard_Integer& theWidth, + Standard_Integer& theHeight, + Standard_Integer& theOffset, + Standard_Integer& theNumOfBytes) +{ + const Standard_Integer aType = (Standard_Integer )((theMarkerType > Aspect_TOM_O) ? Aspect_TOM_O : theMarkerType); + const Standard_Real anIndex = (Standard_Real )(TEL_NO_OF_SIZES - 1) * (theScale - (Standard_Real )TEL_PM_START_SIZE) + / (Standard_Real )(TEL_PM_END_SIZE - TEL_PM_START_SIZE); + Standard_Integer anId = (Standard_Integer )(anIndex + 0.5); + if (anId < 0) + { + anId = 0; + } + else if (anId >= TEL_NO_OF_SIZES) + { + anId = TEL_NO_OF_SIZES - 1; + } + + theWidth = (Standard_Integer )arrPMFontInfo[aType][anId].width; + theHeight = (Standard_Integer )arrPMFontInfo[aType][anId].height; + theOffset = arrPMFontInfo[aType][anId].offset; + const Standard_Integer aNumOfBytesInRow = theWidth / 8 + (theWidth % 8 ? 1 : 0); + theNumOfBytes = theHeight * aNumOfBytesInRow; +} + +// ======================================================================= +// function : GetTextureImage +// purpose : Returns a marker image for the marker of the specified +// type and scale. +// ======================================================================= +Handle(Graphic3d_MarkerImage) GetTextureImage (const Aspect_TypeOfMarker theMarkerType, + const Standard_ShortReal& theScale) +{ + Standard_Integer aWidth, aHeight, anOffset, aNumOfBytes; + GetMarkerBitMapParam (theMarkerType, theScale, aWidth, aHeight, anOffset, aNumOfBytes); + + Handle(TColStd_HArray1OfByte) aBitMap = new TColStd_HArray1OfByte (0, aNumOfBytes - 1); + for (Standard_Integer anIter = 0; anIter < aNumOfBytes; anIter++) + { + aBitMap->ChangeValue (anIter) = OpenGl_AspectMarker_myMarkerRaster[anOffset + anIter]; + } + + Handle(Graphic3d_MarkerImage) aTexture = new Graphic3d_MarkerImage (aBitMap, aWidth, aHeight); + return aTexture; } -/*----------------------------------------------------------------------*/ +// ======================================================================= +// function : MergeImages +// purpose : Merge two image pixmap into one. Used for creating image for +// following markers: Aspect_TOM_O_POINT, Aspect_TOM_O_PLUS, +// Aspect_TOM_O_STAR, Aspect_TOM_O_X, Aspect_TOM_RING1, +// Aspect_TOM_RING2, Aspect_TOM_RING3 +// ======================================================================= +Handle(Image_PixMap) MergeImages (const Handle(Image_PixMap)& theImage1, + const Handle(Image_PixMap)& theImage2) +{ + if (theImage1.IsNull() && theImage2.IsNull()) + { + return Handle(Image_PixMap)(); + } + + Handle(Image_PixMap) aResultImage = new Image_PixMap(); + + Standard_Integer aWidth1 (0), aHeight1 (0); + if (!theImage1.IsNull()) + { + aWidth1 = (Standard_Integer )theImage1->Width(); + aHeight1 = (Standard_Integer )theImage1->Height(); + } + + Standard_Integer aWidth2 (0), aHeight2 (0); + if (!theImage2.IsNull()) + { + aWidth2 = (Standard_Integer )theImage2->Width(); + aHeight2 = (Standard_Integer )theImage2->Height(); + } + + const Standard_Integer aMaxWidth = Max (aWidth1, aWidth2); + const Standard_Integer aMaxHeight = Max (aHeight1, aHeight2); + const Standard_Integer aSize = Max (aMaxWidth, aMaxHeight); + + aResultImage->InitZero (Image_PixMap::ImgGray, aSize, aSize); + + if (!theImage1.IsNull()) + { + const Standard_Integer aXOffset1 = Abs (aWidth1 - aMaxWidth) / 2; + const Standard_Integer anYOffset1 = Abs (aHeight1 - aMaxHeight) / 2; + for (Standard_Integer anY = 0; anY < aHeight1; anY++) + { + Standard_Byte* anImageLine = theImage1->ChangeRow (anY); + Standard_Byte* aResultImageLine = aResultImage->ChangeRow (anYOffset1 + anY); + for (Standard_Integer aX = 0; aX < aWidth1; aX++) + { + aResultImageLine[aXOffset1 + aX] |= anImageLine[aX]; + } + } + } + + if (!theImage2.IsNull()) + { + const Standard_Integer aXOffset2 = Abs (aWidth2 - aMaxWidth) / 2; + const Standard_Integer anYOffset2 = Abs (aHeight2 - aMaxHeight) / 2; + for (Standard_Integer anY = 0; anY < aHeight2; anY++) + { + Standard_Byte* anImageLine = theImage2->ChangeRow (anY); + Standard_Byte* aResultImageLine = aResultImage->ChangeRow (anYOffset2 + anY); + for (Standard_Integer aX = 0; aX < aWidth2; aX++) + { + aResultImageLine[aXOffset2 + aX] |= anImageLine[aX]; + } + } + } + + return aResultImage; +} + +// ======================================================================= +// function : OpenGl_AspectMarker +// purpose : +// ======================================================================= +OpenGl_AspectMarker::OpenGl_AspectMarker() + : myColor (myDefaultColor), + myType (Aspect_TOM_PLUS), + myScale (1.0f), + myMarkerSize (1.0f), + mySpriteKey (""), + mySpriteAKey ("") +{} + +// ======================================================================= +// function : Init +// purpose : +// ======================================================================= +void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx, + const CALL_DEF_CONTEXTMARKER& theAspect) +{ + myColor.rgb[0] = (float )theAspect.Color.r; + myColor.rgb[1] = (float )theAspect.Color.g; + myColor.rgb[2] = (float )theAspect.Color.b; + myColor.rgb[3] = 1.0f; + myType = theAspect.MarkerType; + myScale = myMarkerSize = theAspect.Scale; + + // generate key for shared resource + TCollection_AsciiString aNewKey, aNewKeyA; + if (myType == Aspect_TOM_USERDEFINED) + { + if (!theAspect.MarkerImage.IsNull()) + { + aNewKey = theAspect.MarkerImage->GetImageId(); + aNewKeyA = theAspect.MarkerImage->GetImageAlphaId(); + } + } + else if (myType != Aspect_TOM_POINT) + { + // pre-defined markers + const Standard_Integer aScale = Standard_Integer(myScale + 0.5f); + aNewKey = TCollection_AsciiString ("OpenGl_AspectMarker") + myType + "_" + aScale; + aNewKeyA = aNewKey + "A"; + if (myType == Aspect_TOM_BALL) + { + unsigned int aColor[3] = + { + (unsigned int )(255.0f * myColor.rgb[0]), + (unsigned int )(255.0f * myColor.rgb[1]), + (unsigned int )(255.0f * myColor.rgb[2]) + }; + char aBytes[8]; + sprintf (aBytes, "%02X%02X%02X", aColor[0], aColor[1], aColor[2]); + aNewKey += aBytes; + } + } + + // release old shared resources + const Standard_Boolean aNewResource = aNewKey.IsEmpty() || mySpriteKey != aNewKey; + if (aNewResource) + { + if (!mySprite.IsNull()) + { + if (mySpriteKey.IsEmpty()) + { + theCtx->DelayedRelease (mySprite); + mySprite.Nullify(); + } + else + { + mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call + theCtx->ReleaseResource (mySpriteKey); + } + } + mySpriteKey = aNewKey; + } + if (aNewKeyA.IsEmpty() + || mySpriteAKey != aNewKeyA) + { + if (!mySpriteA.IsNull()) + { + if (mySpriteAKey.IsEmpty()) + { + theCtx->DelayedRelease (mySpriteA); + mySpriteA.Nullify(); + } + else + { + mySpriteA.Nullify(); // we need nullify all handles before ReleaseResource() call + theCtx->ReleaseResource (mySpriteKey); + } + } + mySpriteAKey = aNewKeyA; + } + if (myType == Aspect_TOM_POINT + || !aNewResource + || (myType == Aspect_TOM_USERDEFINED && theAspect.MarkerImage.IsNull())) + { + // nothing to do - just simple point + return; + } + + if (!aNewKey.IsEmpty() + && theCtx->GetResource (aNewKey, mySprite) + && theCtx->GetResource (aNewKeyA, mySpriteA)) + { + // reuse shared resource + if (!mySprite->IsDisplayList()) + { + myMarkerSize = Standard_ShortReal (Max (mySprite->SizeX(), mySprite->SizeY())); + } + return; + } + + mySprite = new OpenGl_PointSprite(); + mySpriteA = new OpenGl_PointSprite(); + if (!aNewKey.IsEmpty()) + { + theCtx->ShareResource (aNewKey, mySprite); + theCtx->ShareResource (aNewKeyA, mySpriteA); + } + + if (!theCtx.IsNull() + && theCtx->IsGlGreaterEqual (2, 0) + && !theCtx->caps->pntSpritesDisable) + { + // Creating texture resource for using it with point sprites + Handle(Graphic3d_MarkerImage) aNewMarkerImage; + Handle(Image_PixMap) anImage, anImageA; + + if (myType == Aspect_TOM_USERDEFINED && !theAspect.MarkerImage.IsNull()) + { + aNewMarkerImage = theAspect.MarkerImage; + anImage = aNewMarkerImage->GetImage(); + } + else + { + // Creating image from default bitmap + Handle(TColStd_HArray1OfByte) aBitMap; + Handle(Graphic3d_MarkerImage) aMarkerImage1, aMarkerImage2; + + const Standard_ShortReal aDelta = 0.1F; + Standard_ShortReal aScale = myScale; + Standard_ShortReal aLimit = 0.0F; + + switch (myType) + { + case Aspect_TOM_O_POINT: + { + const Standard_Integer aSize = myScale > 7 ? 7 : (Standard_Integer )(myScale + 0.5F); + const Standard_Integer aNumOfBytes = (aSize / 8 + (aSize % 8 ? 1 : 0)) * aSize; + aBitMap = new TColStd_HArray1OfByte (0, aNumOfBytes - 1); + for (Standard_Integer anIter = 0; anIter < aBitMap->Length(); anIter++) + { + aBitMap->SetValue (anIter, 255); + } + aMarkerImage2 = new Graphic3d_MarkerImage (aBitMap, aSize, aSize); + } + case Aspect_TOM_O_PLUS: + case Aspect_TOM_O_STAR: + case Aspect_TOM_O_X: + { + // For this type of markers we merge two base bitmaps into one + // For example Aspect_TOM_O_PLUS = Aspect_TOM_O + Aspect_TOM_PLUS + aMarkerImage1 = GetTextureImage (Aspect_TOM_O, myScale); + if (myType != Aspect_TOM_O_POINT) + { + aMarkerImage2 = GetTextureImage (Aspect_TypeOfMarker (myType - Aspect_TOM_O_POINT), myScale); + } + anImage = MergeImages (aMarkerImage1->GetImage(), aMarkerImage2->GetImage()); + aNewMarkerImage = new Graphic3d_MarkerImage (anImage); + break; + } + case Aspect_TOM_RING1: + if (aLimit == 0.0f) aLimit = aScale * 0.2f; + case Aspect_TOM_RING2: + if (aLimit == 0.0f) aLimit = aScale * 0.5f; + case Aspect_TOM_RING3: + { + if (aLimit == 0.0f) aLimit = aScale * 0.8f; + for (; aScale > aLimit && aScale >= 1.0f; aScale -= aDelta) + { + anImage = MergeImages (anImage, GetTextureImage (Aspect_TOM_O, aScale)->GetImage()); + } + aNewMarkerImage = new Graphic3d_MarkerImage (anImage); + break; + } + case Aspect_TOM_BALL: + { + Standard_Integer aWidth, aHeight, anOffset, aNumOfBytes; + GetMarkerBitMapParam (Aspect_TOM_O, aScale, aWidth, aHeight, anOffset, aNumOfBytes); + + const Standard_ShortReal aDelta = 0.1f; + NCollection_Vec4 aColor (Standard_Real (myColor.rgb[0]), + Standard_Real (myColor.rgb[1]), + Standard_Real (myColor.rgb[2]), + Standard_Real (myColor.rgb[3])); + + const Standard_Integer aSize = Max (aWidth + 2, aHeight + 2); // includes extra margin + anImage = new Image_PixMap(); + anImageA = new Image_PixMap(); + anImage ->InitZero (Image_PixMap::ImgBGRA, aSize, aSize); + anImageA->InitZero (Image_PixMap::ImgGray, aSize, aSize); + Image_PixMapData& aDataBGRA = anImage->EditData(); + Image_PixMapData& aDataGray = anImageA->EditData(); + + // we draw a set of circles + Image_ColorBGRA aColor32; + aColor32.a() = 255; + Standard_Real aHLS[3]; + while (aScale >= 1.0f) + { + Quantity_Color::RgbHls (aColor.r(), aColor.g(), aColor.b(), aHLS[0], aHLS[1], aHLS[2]); + aHLS[2] *= 0.95; // 5% saturation change + Quantity_Color::HlsRgb (aHLS[0], aHLS[1], aHLS[2], aColor.r(), aColor.g(), aColor.b()); + aColor32.r() = Standard_Byte(255.0 * aColor.r()); + aColor32.g() = Standard_Byte(255.0 * aColor.g()); + aColor32.b() = Standard_Byte(255.0 * aColor.b()); + + const Handle(Graphic3d_MarkerImage) aMarker = GetTextureImage (Aspect_TOM_O, aScale); + const Handle(Image_PixMap)& aCircle = aMarker->GetImage(); + + const Standard_Size aDiffX = (aDataBGRA.SizeX() - aCircle->SizeX()) / 2; + const Standard_Size aDiffY = (aDataBGRA.SizeY() - aCircle->SizeY()) / 2; + for (Standard_Size aRow = 0; aRow < aCircle->SizeY(); ++aRow) + { + const Standard_Byte* aRowData = aCircle->Row (aRow); + for (Standard_Size aCol = 0; aCol < aCircle->SizeX(); ++aCol) + { + if (aRowData[aCol] != 0) + { + aDataBGRA.ChangeValue (aDiffX + aRow, aDiffY + aCol) = aColor32; + aDataGray.ChangeValue (aDiffX + aRow, aDiffY + aCol) = 255; + } + } + } + aScale -= aDelta; + } + break; + } + default: + { + aNewMarkerImage = GetTextureImage (myType, myScale); + anImage = aNewMarkerImage->GetImage(); + break; + } + } + } + + myMarkerSize = Max ((Standard_ShortReal )anImage->Width(),(Standard_ShortReal )anImage->Height()); + + mySprite->Init (theCtx, *anImage.operator->(), Graphic3d_TOT_2D); + if (anImageA.IsNull() + && mySprite->GetFormat() != GL_ALPHA8 + && !aNewMarkerImage.IsNull()) + { + anImageA = aNewMarkerImage->GetImageAlpha(); + } + if (!anImageA.IsNull()) + { + mySpriteA->Init (theCtx, *anImageA.operator->(), Graphic3d_TOT_2D); + } + } + else + { + // Creating list with bitmap for using it in compatibility mode + GLuint aBitmapList = glGenLists (1); + mySprite->SetDisplayList (theCtx, aBitmapList); + + Standard_Integer aWidth, aHeight, anOffset, aNumOfBytes; + if (myType == Aspect_TOM_USERDEFINED && !theAspect.MarkerImage.IsNull()) + { + // Reading userdefined marker + Handle(TColStd_HArray1OfByte) aBitMap = theAspect.MarkerImage->GetBitMapArray(); + Standard_Byte* aBitMapArray = new Standard_Byte[aBitMap->Length()]; + theAspect.MarkerImage->GetTextureSize (aWidth, aHeight); + + // We should pass bitmap to glBitmap with reversed line order as it draws it from + // bottom to top + const Standard_Integer aNumOfBytesInRow = aWidth / 8 + (aWidth % 8 ? 1 : 0); + const Standard_Integer anUpperIndex = aBitMap->Upper(); + for (Standard_Integer aRow = 0; aRow < aHeight; aRow++) + { + for (Standard_Integer aByteIter = 0; aByteIter < aNumOfBytesInRow; aByteIter++) + { + aBitMapArray[aRow * aNumOfBytesInRow + aByteIter] = + aBitMap->Value (anUpperIndex + 1 - (aRow + 1) * aNumOfBytesInRow + aByteIter); + } + } + + if (aBitMapArray != NULL) + { + glNewList (aBitmapList, GL_COMPILE); + glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, (GLfloat )(0.5f * aWidth), (GLfloat )(0.5f * aHeight), + 0.f, 0.f, (const GLubyte* )aBitMapArray); + glEndList(); + } + } + else + { + // Creating list for default marker + const Standard_ShortReal aDelta = 0.1f; + Standard_ShortReal aScale = myScale; + Standard_ShortReal aLimit = 0.0f; + + glNewList (aBitmapList, GL_COMPILE); + switch (myType) + { + case Aspect_TOM_O_PLUS: + case Aspect_TOM_O_STAR: + case Aspect_TOM_O_X: + { + // For this type of markers we merge two base bitmaps into one + // For example Aspect_TOM_O_PLUS = Aspect_TOM_O + Aspect_TOM_PLUS + GetMarkerBitMapParam (Aspect_TOM_O, myScale, aWidth, aHeight, anOffset, aNumOfBytes); + glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, (GLfloat )(0.5f * aWidth), (GLfloat )(0.5f * aHeight), + 0.f, 0.f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]); + GetMarkerBitMapParam (Aspect_TypeOfMarker (myType - Aspect_TOM_O_POINT), myScale, aWidth, aHeight, anOffset, aNumOfBytes); + glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, (GLfloat )(0.5f * aWidth), (GLfloat )(0.5f * aHeight), + 0.f, 0.f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]); + break; + } + case Aspect_TOM_BALL: + { + const Standard_ShortReal aDelta = 0.1f; + NCollection_Vec4 aColor (Standard_Real (myColor.rgb[0]), + Standard_Real (myColor.rgb[1]), + Standard_Real (myColor.rgb[2]), + Standard_Real (myColor.rgb[3])); + + // we draw a set of circles + while (aScale >= 1.0f) + { + Standard_Real aHLS[3]; + Quantity_Color::RgbHls (aColor.r(), aColor.g(), aColor.b(), aHLS[0], aHLS[1], aHLS[2]); + // 5% saturation change + aHLS[2] *= 0.95; + Quantity_Color::HlsRgb (aHLS[0], aHLS[1], aHLS[2], aColor.r(), aColor.g(), aColor.b()); + + glColor4dv (aColor); + GetMarkerBitMapParam (Aspect_TOM_O, aScale, aWidth, aHeight, anOffset, aNumOfBytes); + glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, 0.5f * GLfloat(aWidth), 0.5f * GLfloat(aHeight), + 0.0f, 0.0f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]); + + aScale -= aDelta; + } + break; + } + case Aspect_TOM_RING1: + if (aLimit == 0.0f) aLimit = aScale * 0.2f; + case Aspect_TOM_RING2: + if (aLimit == 0.0f) aLimit = aScale * 0.5f; + case Aspect_TOM_RING3: + { + if (aLimit == 0.0f) aLimit = aScale * 0.8f; + for (; aScale > aLimit && aScale >= 1.0f; aScale -= aDelta) + { + GetMarkerBitMapParam (Aspect_TOM_O, aScale, aWidth, aHeight, anOffset, aNumOfBytes); + glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, 0.5f * GLfloat(aWidth), 0.5f * GLfloat(aHeight), + 0.0f, 0.0f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]); + } + break; + } + default: + { + GetMarkerBitMapParam (myType, myScale, aWidth, aHeight, anOffset, aNumOfBytes); + glBitmap ((GLsizei )aWidth, (GLsizei )aHeight, 0.5f * GLfloat(aWidth), 0.5f * GLfloat(aHeight), + 0.0f, 0.0f, (const GLubyte* )&OpenGl_AspectMarker_myMarkerRaster[anOffset]); + break; + } + } + glEndList(); + } + } +} +// ======================================================================= +// function : Render +// purpose : +// ======================================================================= void OpenGl_AspectMarker::Render (const Handle(OpenGl_Workspace)& theWorkspace) const { - theWorkspace->SetAspectMarker(this); + theWorkspace->SetAspectMarker (this); } -void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)&) +// ======================================================================= +// function : Release +// purpose : +// ======================================================================= +void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx) { - // + if (!mySprite.IsNull()) + { + if (!theCtx.IsNull()) + { + if (mySpriteKey.IsEmpty()) + { + theCtx->DelayedRelease (mySprite); + theCtx->DelayedRelease (mySpriteA); + } + else + { + mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call + mySpriteA.Nullify(); + theCtx->ReleaseResource (mySpriteKey); + theCtx->ReleaseResource (mySpriteAKey); + } + } + mySprite.Nullify(); + mySpriteA.Nullify(); + } + mySpriteKey.Clear(); + mySpriteAKey.Clear(); } diff --git a/src/OpenGl/OpenGl_AspectMarker.hxx b/src/OpenGl/OpenGl_AspectMarker.hxx index a3b85ccc4b..4e7fa80122 100644 --- a/src/OpenGl/OpenGl_AspectMarker.hxx +++ b/src/OpenGl/OpenGl_AspectMarker.hxx @@ -22,32 +22,48 @@ #include #include +#include +#include #include +#include + +#include class OpenGl_AspectMarker : public OpenGl_Element { - public: +public: - OpenGl_AspectMarker (); + OpenGl_AspectMarker(); - void SetContext (const CALL_DEF_CONTEXTMARKER &AContext); + void Init (const Handle(OpenGl_Context)& theContext, + const CALL_DEF_CONTEXTMARKER& theAspect); - const TEL_COLOUR & Color() const { return myColor; } - Aspect_TypeOfMarker Type() const { return myType; } - float Scale() const { return myScale; } + const TEL_COLOUR& Color() const { return myColor; } + Aspect_TypeOfMarker Type() const { return myType; } + Standard_ShortReal Scale() const { return myScale; } + Standard_ShortReal MarkerSize() const { return myMarkerSize; } + const Handle(OpenGl_PointSprite)& Sprite() const { return mySprite; } + const Handle(OpenGl_PointSprite)& SpriteHighlight() const { return mySpriteA; } virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; virtual void Release (const Handle(OpenGl_Context)& theContext); - protected: +protected: + + TEL_COLOUR myColor; + Aspect_TypeOfMarker myType; + Standard_ShortReal myScale; + Standard_ShortReal myMarkerSize; + TCollection_AsciiString mySpriteKey; //!< shared resource ID + TCollection_AsciiString mySpriteAKey; //!< shared resource ID + Handle(OpenGl_PointSprite) mySprite; //!< normal sprite + Handle(OpenGl_PointSprite) mySpriteA; //!< extra alphs-only sprite for RGB sprites - TEL_COLOUR myColor; - Aspect_TypeOfMarker myType; - float myScale; +public: - public: DEFINE_STANDARD_ALLOC + }; -#endif //OpenGl_AspectMarker_Header +#endif // OpenGl_AspectMarker_Header diff --git a/src/OpenGl/OpenGl_Caps.cxx b/src/OpenGl/OpenGl_Caps.cxx index 86a679e924..cf1e93d1ee 100644 --- a/src/OpenGl/OpenGl_Caps.cxx +++ b/src/OpenGl/OpenGl_Caps.cxx @@ -27,8 +27,9 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Caps, Standard_Transient) // purpose : // ======================================================================= OpenGl_Caps::OpenGl_Caps() -: vboDisable (Standard_False), - contextDebug (Standard_False) +: vboDisable (Standard_False), + pntSpritesDisable (Standard_False), + contextDebug (Standard_False) { // } @@ -39,8 +40,9 @@ OpenGl_Caps::OpenGl_Caps() // ======================================================================= OpenGl_Caps& OpenGl_Caps::operator= (const OpenGl_Caps& theCopy) { - vboDisable = theCopy.vboDisable; - contextDebug = theCopy.contextDebug; + vboDisable = theCopy.vboDisable; + pntSpritesDisable = theCopy.pntSpritesDisable; + contextDebug = theCopy.contextDebug; return *this; } diff --git a/src/OpenGl/OpenGl_Caps.hxx b/src/OpenGl/OpenGl_Caps.hxx index 04e5bc2a7c..18552f82b8 100644 --- a/src/OpenGl/OpenGl_Caps.hxx +++ b/src/OpenGl/OpenGl_Caps.hxx @@ -31,7 +31,8 @@ class OpenGl_Caps : public Standard_Transient public: //! @name flags to disable particular functionality - Standard_Boolean vboDisable; //!< flag permits VBO usage, will significantly affect performance (OFF by default) + Standard_Boolean vboDisable; //!< flag permits VBO usage, will significantly affect performance (OFF by default) + Standard_Boolean pntSpritesDisable; //!< flag permits Point Sprites usage, will significantly affect performance (OFF by default) public: //! @name context creation parameters diff --git a/src/OpenGl/OpenGl_Display.cxx b/src/OpenGl/OpenGl_Display.cxx index b67312281b..a7614a039e 100644 --- a/src/OpenGl/OpenGl_Display.cxx +++ b/src/OpenGl/OpenGl_Display.cxx @@ -63,8 +63,7 @@ OpenGl_Display::OpenGl_Display (const Handle(Aspect_DisplayConnection)& theDispl myOffsetUnits(0.F), myAntiAliasingMode(3), myLinestyleBase(0), - myPatternBase(0), - myMarkerBase(0) + myPatternBase(0) { #if (defined(_WIN32) || defined(__WIN32__)) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX)) myDisplay = TheDummyDisplay; @@ -91,26 +90,7 @@ OpenGl_Display::~OpenGl_Display () glDeleteLists((GLuint)myPatternBase,TEL_HS_USER_DEF_START); myPatternBase = 0; } - // Delete markers - if (myMarkerBase) - { - glDeleteLists((GLuint)myMarkerBase,60); - myMarkerBase = 0; - } - // Delete user markers - OpenGl_MapOfUserMarker::Iterator itm(myMapOfUM); - for (; itm.More(); itm.Next()) - { - const OPENGL_MARKER_DATA &aData = itm.Value(); - if (aData.Array) - { - delete[] aData.Array; - } - else if (aData.ListId != 0) - { - glDeleteLists ( aData.ListId, 1 ); - } - } + myDisplay = NULL; } @@ -138,84 +118,6 @@ void OpenGl_Display::SetWindow (const Aspect_Drawable AParent, const Handle(Open /*----------------------------------------------------------------------*/ -//GenerateMarkerBitmap -void OpenGl_Display::AddUserMarker (const Standard_Integer AIndex, - const Standard_Integer AMarkWidth, - const Standard_Integer AMarkHeight, - const Handle(TColStd_HArray1OfByte)& ATexture) -{ - if (!myMapOfUM.IsBound(AIndex)) - { - const OPENGL_MARKER_DATA anEmptyData = { 0, 0, 0, NULL }; - myMapOfUM.Bind(AIndex,anEmptyData); - } - - OPENGL_MARKER_DATA &aData = myMapOfUM.ChangeFind(AIndex); - - if (aData.Array) - { - delete[] aData.Array; - aData.Array = NULL; - } - - unsigned char *anArray = new unsigned char[ATexture->Length()]; - - const int aByteWidth = AMarkWidth / 8; - int i, anIndex = ATexture->Upper() - ATexture->Lower() - aByteWidth + 1; - for ( ; anIndex >= 0; anIndex -= aByteWidth ) - for ( i = 0; i < aByteWidth; i++ ) - anArray[ATexture->Upper() - ATexture->Lower() - aByteWidth + 1 - anIndex + i ] = ATexture->Value( anIndex + i + 1 ); - - aData.Width = AMarkWidth; - aData.Height = AMarkHeight; - aData.Array = anArray; -} - -/*----------------------------------------------------------------------*/ - -void OpenGl_Display::UpdateUserMarkers () -{ - OpenGl_MapOfUserMarker::Iterator itm(myMapOfUM); - for (; itm.More(); itm.Next()) - { - OPENGL_MARKER_DATA &aData = itm.ChangeValue(); - if (aData.Array) - { - if (aData.ListId == 0) - aData.ListId = glGenLists(1); - - glNewList( (GLuint)aData.ListId, GL_COMPILE ); - - GLint w = ( GLsizei ) aData.Width; - GLint h = ( GLsizei ) aData.Height; - glBitmap( w, h, - 0.5F * ( float )aData.Width, 0.5F * ( float )aData.Height, - ( float )30.0, ( float )30.0, - ( GLubyte* )aData.Array ); - - glEndList(); - - delete[] aData.Array; - aData.Array = NULL; - } - } -} - -/*----------------------------------------------------------------------*/ - -Standard_Integer OpenGl_Display::GetUserMarkerListIndex (const Standard_Integer AIndex) const -{ - if (myMapOfUM.IsBound(AIndex)) - { - const OPENGL_MARKER_DATA &aData = myMapOfUM.Find(AIndex); - if (!aData.Array) - return aData.ListId; - } - return -1; -} - -/*----------------------------------------------------------------------*/ - void OpenGl_Display::Init() { if (myDisplay != NULL) diff --git a/src/OpenGl/OpenGl_Display.hxx b/src/OpenGl/OpenGl_Display.hxx index f60f945a89..5ba1797044 100644 --- a/src/OpenGl/OpenGl_Display.hxx +++ b/src/OpenGl/OpenGl_Display.hxx @@ -49,17 +49,6 @@ struct OpenGl_Facilities int MaxViews; }; -struct OPENGL_MARKER_DATA -{ - unsigned int ListId; - unsigned int Width; - unsigned int Height; - unsigned char* Array; - DEFINE_STANDARD_ALLOC -}; - -typedef NCollection_DataMap OpenGl_MapOfUserMarker; - class OpenGl_AspectText; struct OpenGl_TextParam; @@ -93,25 +82,10 @@ class OpenGl_Display : public MMgt_TShared void InitAttributes (); - const char * GetStringForMarker (const Aspect_TypeOfMarker AType, const Tfloat AVal) const; - - void SetBaseForMarker () const; - void SetTypeOfLine (const Aspect_TypeOfLine AType) const; void SetTypeOfHatch (const int AType) const; - // User markers - - void AddUserMarker (const Standard_Integer AIndex, - const Standard_Integer AMarkWidth, - const Standard_Integer AMarkHeight, - const Handle(TColStd_HArray1OfByte)& ATexture); - - void UpdateUserMarkers (); - - Standard_Integer GetUserMarkerListIndex (const Standard_Integer AIndex) const; - friend class OpenGl_Window; // Type definition @@ -148,9 +122,6 @@ class OpenGl_Display : public MMgt_TShared unsigned int myLinestyleBase; unsigned int myPatternBase; - unsigned int myMarkerBase; - - OpenGl_MapOfUserMarker myMapOfUM; public: DEFINE_STANDARD_ALLOC diff --git a/src/OpenGl/OpenGl_Display_2.cxx b/src/OpenGl/OpenGl_Display_2.cxx index 4bc0f370fb..5b04b88f92 100644 --- a/src/OpenGl/OpenGl_Display_2.cxx +++ b/src/OpenGl/OpenGl_Display_2.cxx @@ -494,1353 +494,6 @@ static const unsigned int myInteriors[TEL_HS_USER_DEF_START][32] = } }; -/* Following Section relates to POLYMARKER */ - -#define TEL_NO_OF_SIZES 13 -#define TEL_NB_OF_LISTS 5 - -struct PM_FONT_INFO -{ - const char *str; - Tfloat width, height; - Tint offset; -}; -typedef PM_FONT_INFO* pm_font_info; - -#define PM_PLUS_10_NUM 9*2 -#define PM_PLUS_15_NUM 11*2 -#define PM_PLUS_20_NUM 13*2 -#define PM_PLUS_25_NUM 15*2 -#define PM_PLUS_30_NUM 17*3 -#define PM_PLUS_35_NUM 19*3 -#define PM_PLUS_40_NUM 21*3 -#define PM_PLUS_45_NUM 23*3 -#define PM_PLUS_50_NUM 25*4 -#define PM_PLUS_55_NUM 27*4 -#define PM_PLUS_60_NUM 29*4 -#define PM_PLUS_65_NUM 31*4 -#define PM_PLUS_70_NUM 32*4 - -#define PM_STAR_10_NUM 9 -#define PM_STAR_15_NUM 11*2 -#define PM_STAR_20_NUM 13*2 -#define PM_STAR_25_NUM 15*2 -#define PM_STAR_30_NUM 17*2 -#define PM_STAR_35_NUM 19*2 -#define PM_STAR_40_NUM 21*3 -#define PM_STAR_45_NUM 23*3 -#define PM_STAR_50_NUM 25*3 -#define PM_STAR_55_NUM 27*3 -#define PM_STAR_60_NUM 29*4 -#define PM_STAR_65_NUM 32*4 -#define PM_STAR_70_NUM 32*4 - -#define PM_CIRC_10_NUM 7 -#define PM_CIRC_15_NUM 9*2 -#define PM_CIRC_20_NUM 9*2 -#define PM_CIRC_25_NUM 11*2 -#define PM_CIRC_30_NUM 13*2 -#define PM_CIRC_35_NUM 15*2 -#define PM_CIRC_40_NUM 17*3 -#define PM_CIRC_45_NUM 19*3 -#define PM_CIRC_50_NUM 21*3 -#define PM_CIRC_55_NUM 23*3 -#define PM_CIRC_60_NUM 25*4 -#define PM_CIRC_65_NUM 27*4 -#define PM_CIRC_70_NUM 29*4 - -#define PM_CROSS_10_NUM 7 -#define PM_CROSS_15_NUM 9*2 -#define PM_CROSS_20_NUM 11*2 -#define PM_CROSS_25_NUM 13*2 -#define PM_CROSS_30_NUM 15*2 -#define PM_CROSS_35_NUM 17*3 -#define PM_CROSS_40_NUM 19*3 -#define PM_CROSS_45_NUM 21*3 -#define PM_CROSS_50_NUM 23*3 -#define PM_CROSS_55_NUM 25*4 -#define PM_CROSS_60_NUM 27*4 -#define PM_CROSS_65_NUM 32*4 -#define PM_CROSS_70_NUM 32*4 - -#define PM_PLUS_10_OFT 0 -#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM -#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM -#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM -#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM -#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM -#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM -#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM -#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM -#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM -#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM -#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM -#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM - -#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM -#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM -#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM -#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM -#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM -#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM -#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM -#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM -#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM -#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM -#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM -#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM -#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM - -#define PM_CIRC_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM -#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM -#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM -#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM -#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM -#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM -#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM -#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM -#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM -#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM -#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM -#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM -#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM - -#define PM_CROSS_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM -#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM -#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM -#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM -#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM -#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM -#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM -#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM -#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM -#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM -#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM -#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM -#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM - -static const PM_FONT_INFO arrPMFontInfo[][TEL_NO_OF_SIZES] = -{ - /* TOM_POINT - not used */ - {{"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}}, - - /* TOM_PLUS */ - {{"\001", 9.f, 9.f, PM_PLUS_10_OFT}, - {"\002", 11.f, 11.f, PM_PLUS_15_OFT}, - {"\003", 13.f, 13.f, PM_PLUS_20_OFT}, - {"\004", 15.f, 15.f, PM_PLUS_25_OFT}, - {"\005", 17.f, 17.f, PM_PLUS_30_OFT}, - {"\006", 19.f, 19.f, PM_PLUS_35_OFT}, - {"\007", 21.f, 21.f, PM_PLUS_40_OFT}, - {"\010", 23.f, 23.f, PM_PLUS_45_OFT}, - {"\011", 25.f, 25.f, PM_PLUS_50_OFT}, - {"\012", 27.f, 27.f, PM_PLUS_55_OFT}, - {"\013", 29.f, 29.f, PM_PLUS_60_OFT}, - {"\014", 31.f, 31.f, PM_PLUS_65_OFT}, - {"\015", 32.f, 32.f, PM_PLUS_70_OFT}}, - - /* TOM_STAR */ - {{"\016", 7.f, 9.f, PM_STAR_10_OFT}, - {"\017", 9.f, 11.f, PM_STAR_15_OFT}, - {"\020", 11.f, 13.f, PM_STAR_20_OFT}, - {"\021", 13.f, 15.f, PM_STAR_25_OFT}, - {"\022", 13.f, 17.f, PM_STAR_30_OFT}, - {"\023", 15.f, 19.f, PM_STAR_35_OFT}, - {"\024", 17.f, 21.f, PM_STAR_40_OFT}, - {"\025", 19.f, 23.f, PM_STAR_45_OFT}, - {"\026", 21.f, 25.f, PM_STAR_50_OFT}, - {"\027", 23.f, 27.f, PM_STAR_55_OFT}, - {"\030", 25.f, 29.f, PM_STAR_60_OFT}, - {"\031", 32.f, 32.f, PM_STAR_65_OFT}, - {"\032", 32.f, 32.f, PM_STAR_70_OFT}}, - - /* TOM_O */ - {{"\033", 7.f, 7.f, PM_CIRC_10_OFT}, - {"\034", 9.f, 9.f, PM_CIRC_15_OFT}, - {"\035", 9.f, 9.f, PM_CIRC_20_OFT}, - {"\036", 11.f, 11.f, PM_CIRC_25_OFT}, - {"\037", 13.f, 13.f, PM_CIRC_30_OFT}, - {"\040", 15.f, 15.f, PM_CIRC_35_OFT}, - {"\041", 17.f, 17.f, PM_CIRC_40_OFT}, - {"\042", 19.f, 19.f, PM_CIRC_45_OFT}, - {"\043", 21.f, 21.f, PM_CIRC_50_OFT}, - {"\044", 23.f, 23.f, PM_CIRC_55_OFT}, - {"\045", 25.f, 25.f, PM_CIRC_60_OFT}, - {"\046", 27.f, 27.f, PM_CIRC_65_OFT}, - {"\047", 29.f, 29.f, PM_CIRC_70_OFT}}, - - /* TOM_X */ - {{"\050", 7.f, 7.f, PM_CROSS_10_OFT}, - {"\051", 9.f, 9.f, PM_CROSS_15_OFT}, - {"\052", 11.f, 11.f, PM_CROSS_20_OFT}, - {"\053", 13.f, 13.f, PM_CROSS_25_OFT}, - {"\054", 15.f, 15.f, PM_CROSS_30_OFT}, - {"\055", 17.f, 17.f, PM_CROSS_35_OFT}, - {"\056", 19.f, 19.f, PM_CROSS_40_OFT}, - {"\057", 21.f, 21.f, PM_CROSS_45_OFT}, - {"\060", 23.f, 23.f, PM_CROSS_50_OFT}, - {"\061", 25.f, 25.f, PM_CROSS_55_OFT}, - {"\062", 27.f, 27.f, PM_CROSS_60_OFT}, - {"\063", 32.f, 32.f, PM_CROSS_65_OFT}, - {"\064", 32.f, 32.f, PM_CROSS_70_OFT}}, - - /* TOM_O_POINT - not used */ - {{"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}, - {"\0"}}, - - /* TOM_O_PLUS */ - {{"\001\033"}, - {"\002\034"}, - {"\003\035"}, - {"\004\036"}, - {"\005\037"}, - {"\006\040"}, - {"\007\041"}, - {"\010\042"}, - {"\011\043"}, - {"\012\044"}, - {"\013\045"}, - {"\014\046"}, - {"\015\047"}}, - - /* TOM_O_STAR */ - {{"\016\033"}, - {"\017\034"}, - {"\020\035"}, - {"\021\036"}, - {"\022\037"}, - {"\023\040"}, - {"\024\041"}, - {"\025\042"}, - {"\026\043"}, - {"\027\044"}, - {"\030\045"}, - {"\031\046"}, - {"\032\047"}}, - - /* TOM_O_X */ - {{"\050\033"}, - {"\051\034"}, - {"\052\035"}, - {"\053\036"}, - {"\054\037"}, - {"\055\040"}, - {"\056\041"}, - {"\057\042"}, - {"\060\043"}, - {"\061\044"}, - {"\062\045"}, - {"\063\046"}, - {"\064\047"}} -}; - -static const unsigned char myMarkerRaster[] = -{ - /* TYPE = PLUS */ - - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0xff,0x80, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, /* PLUS 9x9 = 1.0 */ - - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0xff,0xe0, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, /* PLUS 11x11 = 1.5 */ - - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0xff,0xf8, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00,/* PLUS 13x13 = 2.0 */ - - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0xff,0xfe, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00,/* PLUS 15x15 = 2.5 */ - - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0xff,0xff, 0x80, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00,/* PLUS 17x17 = 3.0 */ - - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0xff,0xff, 0xe0, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00,/* PLUS 19x19 = 3.5 */ - - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0xff,0xff, 0xf8, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00,/* PLUS 21x21 = 4.0 */ - - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0xff,0xff, 0xfe, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00,/* PLUS 23x23 = 4.5 */ - - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0xff,0xff, 0xff,0x80, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00,/* PLUS 25x25 = 5.0 */ - - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0xff,0xff, 0xff,0xe0, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00,/* PLUS 27x27 = 5.5 */ - - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0xff,0xff, 0xff,0xf8, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00,/* PLUS 29x29 = 6.0 */ - - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0xff,0xff, 0xff,0xfd, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00,/* PLUS 31x31 = 6.5 */ - - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0xff,0xff, 0xff,0xff, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00,/* PLUS 32x32 = 7.0 */ - - /* TYPE = STAR */ - - 0x10, - 0x10, - 0xd6, - 0x38, - 0x10, - 0x38, - 0xd6, - 0x10, - 0x10,/* STAR 7x9 = 1.0 */ - - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0xc9,0x80, - 0x3e,0x00, - 0x08,0x00, - 0x3e,0x00, - 0xc9,0x80, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00,/* STAR 9x11 = 1.5 */ - - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x84,0x20, - 0x64,0xc0, - 0x1f,0x00, - 0x04,0x00, - 0x1f,0x00, - 0x64,0xc0, - 0x84,0x20, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00,/* STAR 11x13 = 2.0 */ - - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x82,0x18, - 0x62,0x60, - 0x1b,0x80, - 0x06,0x00, - 0x1b,0x80, - 0x62,0x60, - 0x82,0x18, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00,/* STAR 13x15 = 2.5 */ - - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x82,0x08, - 0x62,0x30, - 0x12,0x40, - 0x0f,0x80, - 0x02,0x00, - 0x0f,0x80, - 0x12,0x40, - 0x62,0x30, - 0x82,0x08, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00,/* STAR 13x17 = 3.0 */ - - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0xc1,0x06, - 0x21,0x18, - 0x19,0x20, - 0x07,0xc0, - 0x01,0x00, - 0x07,0xc0, - 0x19,0x20, - 0x21,0x18, - 0xc1,0x06, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00,/* STAR 15x19 = 3.5 */ - - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x80,0x80, 0x80, - 0x60,0x83, 0x00, - 0x10,0x8c, 0x00, - 0x0c,0x90, 0x00, - 0x03,0xe0, 0x00, - 0x00,0x80, 0x00, - 0x03,0xe0, 0x00, - 0x0c,0x90, 0x00, - 0x10,0x8c, 0x00, - 0x60,0x83, 0x00, - 0x80,0x80, 0x80, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00,/* STAR 17x21 = 4.0 */ - - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0xc0,0x40, 0x60, - 0x30,0x41, 0x80, - 0x08,0x42, 0x00, - 0x06,0x4c, 0x00, - 0x01,0xf0, 0x00, - 0x00,0x40, 0x00, - 0x01,0xf0, 0x00, - 0x06,0x4c, 0x00, - 0x08,0x42, 0x00, - 0x30,0x41, 0x80, - 0xc0,0x40, 0x60, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00,/* STAR 19x23 = 4.5 */ - - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x80,0x20, 0x08, - 0x60,0x20, 0x30, - 0x18,0x20, 0xc0, - 0x04,0x21, 0x00, - 0x03,0x26, 0x00, - 0x00,0xf8, 0x00, - 0x00,0x20, 0x00, - 0x00,0xf8, 0x00, - 0x03,0x26, 0x00, - 0x04,0x21, 0x00, - 0x18,0x20, 0xc0, - 0x60,0x20, 0x30, - 0x80,0x20, 0x08, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00,/* STAR 21x25 = 5.0 */ - - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0xc0,0x10, 0x06, - 0x30,0x10, 0x18, - 0x08,0x10, 0x60, - 0x06,0x10, 0x80, - 0x01,0x93, 0x00, - 0x00,0x7c, 0x00, - 0x00,0x10, 0x00, - 0x00,0x7c, 0x00, - 0x01,0x93, 0x00, - 0x06,0x10, 0x80, - 0x08,0x10, 0x60, - 0x30,0x10, 0x18, - 0xc0,0x10, 0x06, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00,/* STAR 23x27 = 5.5 */ - - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x80,0x08, 0x00,0x80, - 0x60,0x08, 0x03,0x00, - 0x18,0x08, 0x0c,0x00, - 0x04,0x08, 0x30,0x00, - 0x03,0x08, 0x40,0x00, - 0x00,0xc9, 0x80,0x00, - 0x00,0x3e, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x3e, 0x00,0x00, - 0x00,0xc9, 0x80,0x00, - 0x03,0x08, 0x40,0x00, - 0x04,0x08, 0x30,0x00, - 0x18,0x08, 0x0c,0x00, - 0x60,0x08, 0x03,0x00, - 0x80,0x08, 0x00,0x80, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00,/* STAR 25x29 = 6.0 */ - - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x30,0x00, 0x80,0x06, - 0x0c,0x00, 0x80,0x18, - 0x03,0x00, 0x80,0x60, - 0x00,0xc0, 0x81,0x80, - 0x00,0x30, 0x86,0x00, - 0x00,0x0c, 0x98,0x00, - 0x00,0x03, 0xe0,0x00, - 0x00,0x03, 0xe0,0x00, - 0x00,0x0c, 0x98,0x00, - 0x00,0x30, 0x86,0x00, - 0x00,0xc0, 0x81,0x80, - 0x03,0x00, 0x80,0x60, - 0x0c,0x00, 0x80,0x18, - 0x30,0x00, 0x80,0x06, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x00,0x00, - 0x00,0x00, 0x00,0x00,/* STAR 32x32 = 6.5 */ - - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x10, 0x00, 0x80, 0x04, - 0x0c, 0x00, 0x80, 0x18, - 0x02, 0x00, 0x80, 0x20, - 0x01, 0x80, 0x80, 0xc0, - 0x00, 0x40, 0x81, 0x00, - 0x00, 0x30, 0x86, 0x00, - 0x00, 0x08, 0x88, 0x00, - 0x00, 0x06, 0xb0, 0x00, - 0x00, 0x01, 0xc0, 0x00, - 0x00, 0x06, 0xb0, 0x00, - 0x00, 0x08, 0x88, 0x00, - 0x00, 0x30, 0x86, 0x00, - 0x00, 0x40, 0x81, 0x00, - 0x01, 0x80, 0x80, 0xc0, - 0x02, 0x00, 0x80, 0x20, - 0x0c, 0x00, 0x80, 0x18, - 0x10, 0x00, 0x80, 0x04, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00,/* STAR 32x32 = 7.0 */ - - /* TYPE = CIRC */ - - 0x38, - 0x44, - 0x82, - 0x82, - 0x82, - 0x44, - 0x38,/* CIRC 7x7 = 1.0 */ - - 0x3c,0x00, - 0x42,0x00, - 0x81,0x00, - 0x81,0x00, - 0x81,0x00, - 0x81,0x00, - 0x42,0x00, - 0x3c,0x00, - 0x00,0x00,/*CIRC 9x9 = 1.5 */ - - 0x3e, 0x00, - 0x41, 0x00, - 0x81, 0x80, - 0x80,0x80, - 0x80,0x80, - 0x80,0x80, - 0x81, 0x80, - 0x41, 0x00, - 0x3e,0x00,/* CIRC 9x9 = 2.0 */ - - 0x1f,0x00, - 0x20,0x80, - 0x40,0x40, - 0x80,0x20, - 0x80,0x20, - 0x80,0x20, - 0x80,0x20, - 0x80,0x20, - 0x40,0x40, - 0x20,0x80, - 0x1f,0x00,/* CIRC 11x11 = 2.5 */ - - 0x0f,0x80, - 0x10,0x40, - 0x20,0x20, - 0x40,0x10, - 0x80,0x08, - 0x80,0x08, - 0x80,0x08, - 0x80,0x08, - 0x80,0x08, - 0x40,0x10, - 0x20,0x20, - 0x10,0x40, - 0x0f,0x80,/* CIRC 13x13 = 3.0 */ - - 0x07,0xc0, - 0x18,0x30, - 0x20,0x08, - 0x40,0x04, - 0x40,0x04, - 0x80,0x02, - 0x80,0x02, - 0x80,0x02, - 0x80,0x02, - 0x80,0x02, - 0x40,0x04, - 0x40,0x04, - 0x20,0x08, - 0x18,0x30, - 0x07,0xc0,/* CIRC 15x15 = 3.5 */ - - 0x03,0xe0, 0x00, - 0x0c,0x18, 0x00, - 0x10,0x04, 0x00, - 0x20,0x02, 0x00, - 0x40,0x01, 0x00, - 0x40,0x01, 0x00, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x40,0x01, 0x00, - 0x40,0x01, 0x00, - 0x20,0x02, 0x00, - 0x10,0x04, 0x00, - 0x0c,0x18, 0x00, - 0x03,0xe0, 0x00,/* CIRC 17x17 = 4.0 */ - - 0x03,0xf8, 0x00, - 0x0e,0x0e, 0x00, - 0x18,0x03, 0x00, - 0x20,0x00, 0x80, - 0x60,0x00, 0xc0, - 0x40,0x00, 0x40, - 0xc0,0x00, 0x60, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0xc0,0x00, 0x60, - 0x40,0x00, 0x40, - 0x60,0x00, 0xc0, - 0x20,0x00, 0x80, - 0x18,0x03, 0x00, - 0x0e,0x0e, 0x00, - 0x03,0xf8, 0x00,/* CIRC 19x19 = 4.5 */ - - 0x01,0xfc, 0x00, - 0x06,0x03, 0x00, - 0x08,0x00, 0x80, - 0x10,0x00, 0x40, - 0x20,0x00, 0x20, - 0x40,0x00, 0x10, - 0x40,0x00, 0x10, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x40,0x00, 0x10, - 0x40,0x00, 0x10, - 0x20,0x00, 0x20, - 0x10,0x00, 0x40, - 0x08,0x00, 0x80, - 0x06,0x03, 0x00, - 0x01,0xfc, 0x00,/* CIRC 21x21 = 5.0 */ - - 0x00,0xfe, 0x00, - 0x03,0x01, 0x80, - 0x0c,0x00, 0x60, - 0x18,0x00, 0x30, - 0x30,0x00, 0x18, - 0x20,0x00, 0x08, - 0x40,0x00, 0x04, - 0x40,0x00, 0x04, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x40,0x00, 0x04, - 0x40,0x00, 0x04, - 0x20,0x00, 0x08, - 0x30,0x00, 0x18, - 0x18,0x00, 0x30, - 0x0c,0x00, 0x60, - 0x03,0x01, 0x80, - 0x00,0xfe, 0x00,/* CIRC 23x23 = 5.5 */ - - 0x00,0x7f, 0x00,0x00, - 0x01,0x80, 0xc0,0x00, - 0x06,0x00, 0x30,0x00, - 0x08,0x00, 0x08,0x00, - 0x10,0x00, 0x04,0x00, - 0x20,0x00, 0x02,0x00, - 0x20,0x00, 0x02,0x00, - 0x40,0x00, 0x01,0x00, - 0x40,0x00, 0x01,0x00, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x40,0x00, 0x01,0x00, - 0x40,0x00, 0x01,0x00, - 0x20,0x00, 0x02,0x00, - 0x20,0x00, 0x02,0x00, - 0x10,0x00, 0x04,0x00, - 0x08,0x00, 0x08,0x00, - 0x06,0x00, 0x30,0x00, - 0x01,0x80, 0xc0,0x00, - 0x00,0x7f, 0x00,0x00,/* CIRC 25x25 = 6.0 */ - - 0x00,0x3f, 0x80,0x00, - 0x01,0xc0, 0x70,0x00, - 0x03,0x00, 0x18,0x00, - 0x0c,0x00, 0x06,0x00, - 0x18,0x00, 0x03,0x00, - 0x10,0x00, 0x01,0x00, - 0x20,0x00, 0x00,0x80, - 0x60,0x00, 0x00,0xc0, - 0x40,0x00, 0x00,0x40, - 0x40,0x00, 0x00,0x40, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x40,0x00, 0x00,0x40, - 0x40,0x00, 0x00,0x40, - 0x60,0x00, 0x00,0xc0, - 0x20,0x00, 0x00,0x80, - 0x10,0x00, 0x01,0x00, - 0x18,0x00, 0x03,0x00, - 0x0c,0x00, 0x06,0x00, - 0x03,0x00, 0x18,0x00, - 0x01,0xc0, 0x70,0x00, - 0x00,0x3f, 0x80,0x00,/* CIRC 27x27 = 6.5 */ - - 0x00,0x1f, 0xc0,0x00, - 0x00,0xe0, 0x38,0x00, - 0x01,0x00, 0x04,0x00, - 0x06,0x00, 0x03,0x00, - 0x08,0x00, 0x00,0x80, - 0x10,0x00, 0x00,0x40, - 0x10,0x00, 0x00,0x40, - 0x20,0x00, 0x00,0x20, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x20,0x00, 0x00,0x20, - 0x10,0x00, 0x00,0x40, - 0x10,0x00, 0x00,0x40, - 0x08,0x00, 0x00,0x80, - 0x06,0x00, 0x03,0x00, - 0x01,0x00, 0x04,0x00, - 0x00,0xe0, 0x38,0x00, - 0x00,0x1f, 0xc0,0x00, /* CIRC 29x29 = 7.0 */ - - /* TYPE = CROSS */ - - 0x82, - 0x44, - 0x28, - 0x10, - 0x28, - 0x44, - 0x82,/* CROSS 7x7 = 1.0 */ - - 0x80,0x80, - 0x41,0x00, - 0x22,0x00, - 0x14,0x00, - 0x08,0x00, - 0x14,0x00, - 0x22,0x00, - 0x41,0x00, - 0x80,0x80,/* CROSS 9x9 = 1.5 */ - - 0x80,0x20, - 0x40,0x40, - 0x20,0x80, - 0x11,0x00, - 0x0a,0x00, - 0x04,0x00, - 0x0a,0x00, - 0x11,0x00, - 0x20,0x80, - 0x40,0x40, - 0x80,0x20,/* CROSS 11x11 = 2.0 */ - - 0x80,0x08, - 0x40,0x10, - 0x20,0x20, - 0x10,0x40, - 0x08,0x80, - 0x05,0x00, - 0x02,0x00, - 0x05,0x00, - 0x08,0x80, - 0x10,0x40, - 0x20,0x20, - 0x40,0x10, - 0x80,0x08,/* CROSS 13x13 = 2.5 */ - - 0x80,0x02, - 0x40,0x04, - 0x20,0x08, - 0x10,0x10, - 0x08,0x20, - 0x04,0x40, - 0x02,0x80, - 0x01,0x00, - 0x02,0x80, - 0x04,0x40, - 0x08,0x20, - 0x10,0x10, - 0x20,0x08, - 0x40,0x04, - 0x80,0x02,/* CROSS 15x15 = 3.0 */ - - 0x80,0x00, 0x80, - 0x40,0x01, 0x00, - 0x20,0x02, 0x00, - 0x10,0x04, 0x00, - 0x08,0x08, 0x00, - 0x04,0x10, 0x00, - 0x02,0x20, 0x00, - 0x01,0x40, 0x00, - 0x00,0x80, 0x00, - 0x01,0x40, 0x00, - 0x02,0x20, 0x00, - 0x04,0x10, 0x00, - 0x08,0x08, 0x00, - 0x10,0x04, 0x00, - 0x20,0x02, 0x00, - 0x40,0x01, 0x00, - 0x80,0x00, 0x80,/* CROSS 17x17 = 3.5 */ - - 0x80,0x00, 0x20, - 0x40,0x00, 0x40, - 0x20,0x00, 0x80, - 0x10,0x01, 0x00, - 0x08,0x02, 0x00, - 0x04,0x04, 0x00, - 0x02,0x08, 0x00, - 0x01,0x10, 0x00, - 0x00,0xa0, 0x00, - 0x00,0x40, 0x00, - 0x00,0xa0, 0x00, - 0x01,0x10, 0x00, - 0x02,0x08, 0x00, - 0x04,0x04, 0x00, - 0x08,0x02, 0x00, - 0x10,0x01, 0x00, - 0x20,0x00, 0x80, - 0x40,0x00, 0x40, - 0x80,0x00, 0x20,/* CROSS 19x19 = 4.0 */ - - 0x80,0x00, 0x08, - 0x40,0x00, 0x10, - 0x20,0x00, 0x20, - 0x10,0x00, 0x40, - 0x08,0x00, 0x80, - 0x04,0x01, 0x00, - 0x02,0x02, 0x00, - 0x01,0x04, 0x00, - 0x00,0x88, 0x00, - 0x00,0x50, 0x00, - 0x00,0x20, 0x00, - 0x00,0x50, 0x00, - 0x00,0x88, 0x00, - 0x01,0x04, 0x00, - 0x02,0x02, 0x00, - 0x04,0x01, 0x00, - 0x08,0x00, 0x80, - 0x10,0x00, 0x40, - 0x20,0x00, 0x20, - 0x40,0x00, 0x10, - 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */ - - 0x80,0x00, 0x02, - 0x40,0x00, 0x04, - 0x20,0x00, 0x08, - 0x10,0x00, 0x10, - 0x08,0x00, 0x20, - 0x04,0x00, 0x40, - 0x02,0x00, 0x80, - 0x01,0x01, 0x00, - 0x00,0x82, 0x00, - 0x00,0x44, 0x00, - 0x00,0x28, 0x00, - 0x00,0x10, 0x00, - 0x00,0x28, 0x00, - 0x00,0x44, 0x00, - 0x00,0x82, 0x00, - 0x01,0x01, 0x00, - 0x02,0x00, 0x80, - 0x04,0x00, 0x40, - 0x08,0x00, 0x20, - 0x10,0x00, 0x10, - 0x20,0x00, 0x08, - 0x40,0x00, 0x04, - 0x80,0x00, 0x02,/* CROSS 23x23 = 5.0 */ - - 0x80,0x00, 0x00,0x80, - 0x40,0x00, 0x01,0x00, - 0x20,0x00, 0x02,0x00, - 0x10,0x00, 0x04,0x00, - 0x08,0x00, 0x08,0x00, - 0x04,0x00, 0x10,0x00, - 0x02,0x00, 0x20,0x00, - 0x01,0x00, 0x40,0x00, - 0x00,0x80, 0x80,0x00, - 0x00,0x41, 0x00,0x00, - 0x00,0x22, 0x00,0x00, - 0x00,0x14, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x14, 0x00,0x00, - 0x00,0x22, 0x00,0x00, - 0x00,0x41, 0x00,0x00, - 0x00,0x80, 0x80,0x00, - 0x01,0x00, 0x40,0x00, - 0x02,0x00, 0x20,0x00, - 0x04,0x00, 0x10,0x00, - 0x08,0x00, 0x08,0x00, - 0x10,0x00, 0x04,0x00, - 0x20,0x00, 0x02,0x00, - 0x40,0x00, 0x01,0x00, - 0x80,0x00, 0x00,0x80,/* CROSS 25x25 = 5.5 */ - - 0x80,0x00, 0x00,0x20, - 0x40,0x00, 0x00,0x40, - 0x20,0x00, 0x00,0x80, - 0x10,0x00, 0x01,0x00, - 0x08,0x00, 0x02,0x00, - 0x04,0x00, 0x04,0x00, - 0x02,0x00, 0x08,0x00, - 0x01,0x00, 0x10,0x00, - 0x00,0x80, 0x20,0x00, - 0x00,0x40, 0x40,0x00, - 0x00,0x20, 0x80,0x00, - 0x00,0x11, 0x00,0x00, - 0x00,0x0a, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x0a, 0x00,0x00, - 0x00,0x11, 0x00,0x00, - 0x00,0x20, 0x80,0x00, - 0x00,0x40, 0x40,0x00, - 0x00,0x80, 0x20,0x00, - 0x01,0x00, 0x10,0x00, - 0x02,0x00, 0x08,0x00, - 0x04,0x00, 0x04,0x00, - 0x08,0x00, 0x02,0x00, - 0x10,0x00, 0x01,0x00, - 0x20,0x00, 0x00,0x80, - 0x40,0x00, 0x00,0x40, - 0x80,0x00, 0x00,0x20,/* CROSS 27x27 = 6.0 */ - - 0x00,0x00, 0x00,0x00, - 0x00,0x00, 0x00,0x00, - 0x20,0x00, 0x00,0x04, - 0x10,0x00, 0x00,0x08, - 0x08,0x00, 0x00,0x10, - 0x04,0x00, 0x00,0x20, - 0x02,0x00, 0x00,0x40, - 0x01,0x00, 0x00,0x80, - 0x00,0x80, 0x01,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x80, 0x01,0x00, - 0x01,0x00, 0x00,0x80, - 0x02,0x00, 0x00,0x40, - 0x04,0x00, 0x00,0x20, - 0x08,0x00, 0x00,0x10, - 0x10,0x00, 0x00,0x08, - 0x20,0x00, 0x00,0x04, - 0x00,0x00, 0x00,0x00, - 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 6.5 */ - - 0x00,0x00, 0x00,0x00, - 0x40,0x00, 0x00,0x02, - 0x20,0x00, 0x00,0x04, - 0x10,0x00, 0x00,0x08, - 0x08,0x00, 0x00,0x10, - 0x04,0x00, 0x00,0x20, - 0x02,0x00, 0x00,0x40, - 0x01,0x00, 0x00,0x80, - 0x00,0x80, 0x01,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x80, 0x01,0x00, - 0x01,0x00, 0x00,0x80, - 0x02,0x00, 0x00,0x40, - 0x04,0x00, 0x00,0x20, - 0x08,0x00, 0x00,0x10, - 0x10,0x00, 0x00,0x08, - 0x20,0x00, 0x00,0x04, - 0x40,0x00, 0x00,0x02, - 0x00,0x00, 0x00,0x00/* CROSS 32x32 = 7.0 */ -}; - /*----------------------------------------------------------------------*/ //TsmInitAttributes @@ -1884,45 +537,6 @@ void OpenGl_Display::InitAttributes () } glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - myMarkerBase = glGenLists (60); - int j; - for( i = 1; i < TEL_NB_OF_LISTS; i++ ) - for( j = 0; j < TEL_NO_OF_SIZES; j++ ) - { - const Tfloat w = arrPMFontInfo[i][j].width; - const Tfloat h = arrPMFontInfo[i][j].height; - const Tint offset = arrPMFontInfo[i][j].offset; - - glNewList( (const GLuint)(arrPMFontInfo[i][j].str[0] + myMarkerBase), GL_COMPILE ); - glBitmap( (GLsizei)w, (GLsizei)h, (GLfloat)(0.5f * w), (GLfloat)(0.5f * h), 0.f, 0.f, (const GLubyte *) &myMarkerRaster[offset] ); - glEndList(); - } -} - -/*----------------------------------------------------------------------*/ - -#define TEL_PM_START_SIZE 1.F -#define TEL_PM_END_SIZE 7.F - -//TelGetStringForPM -const char * OpenGl_Display::GetStringForMarker (const Aspect_TypeOfMarker AType, const Tfloat AVal) const -{ - const int atype = (int)(( AType > Aspect_TOM_O_X )? Aspect_TOM_X : AType); - - const float index = ( float )(TEL_NO_OF_SIZES-1) * (AVal - ( float )TEL_PM_START_SIZE ) / ( float )(TEL_PM_END_SIZE - TEL_PM_START_SIZE); - int id = (int)(index + 0.5F); - if (id < 0) id = 0; - else if (id >= TEL_NO_OF_SIZES) id = TEL_NO_OF_SIZES-1; - - return arrPMFontInfo[atype][id].str; -} - -/*----------------------------------------------------------------------*/ - -void OpenGl_Display::SetBaseForMarker () const -{ - glListBase( (const GLuint) myMarkerBase ); } /*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_GraphicDriver.hxx b/src/OpenGl/OpenGl_GraphicDriver.hxx index 0f076b3095..a3ae77f695 100644 --- a/src/OpenGl/OpenGl_GraphicDriver.hxx +++ b/src/OpenGl/OpenGl_GraphicDriver.hxx @@ -161,8 +161,6 @@ public: Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait); Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait); Standard_EXPORT void Environment (const Graphic3d_CView& ACView); - Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint); - Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex); Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True); Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True); Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True); diff --git a/src/OpenGl/OpenGl_GraphicDriver_3.cxx b/src/OpenGl/OpenGl_GraphicDriver_3.cxx index b6208f6f8a..9231bfacfe 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_3.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_3.cxx @@ -64,7 +64,7 @@ void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup { if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return; - ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert); + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (GetSharedContext(), theCGroup.ContextMarker, theNoInsert); } void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup, @@ -73,15 +73,14 @@ void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup const Standard_Integer theMarkHeight, const Handle(TColStd_HArray1OfByte)& theTexture) { - if(!theCGroup.ContextMarker.IsDef) + if (!theCGroup.ContextMarker.IsDef) + { return; - - if (!openglDisplay.IsNull()) - openglDisplay->AddUserMarker ((int )theCGroup.ContextMarker.Scale, theMarkWidth, theMarkHeight, theTexture); + } if (theCGroup.ptrGroup != NULL) { - ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert); + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (GetSharedContext(), theCGroup.ContextMarker, theNoInsert); } } diff --git a/src/OpenGl/OpenGl_GraphicDriver_4.cxx b/src/OpenGl/OpenGl_GraphicDriver_4.cxx index 84e72969fd..8449479169 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_4.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_4.cxx @@ -48,7 +48,7 @@ void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& theCStr aStructure->SetAspectFace (GetSharedContext(), theCStructure.ContextFillArea); if (theCStructure.ContextMarker.IsDef) - aStructure->SetAspectMarker (theCStructure.ContextMarker); + aStructure->SetAspectMarker (GetSharedContext(), theCStructure.ContextMarker); if (theCStructure.ContextText.IsDef) aStructure->SetAspectText (theCStructure.ContextText); diff --git a/src/OpenGl/OpenGl_GraphicDriver_703.cxx b/src/OpenGl/OpenGl_GraphicDriver_703.cxx deleted file mode 100755 index 27da505e1f..0000000000 --- a/src/OpenGl/OpenGl_GraphicDriver_703.cxx +++ /dev/null @@ -1,154 +0,0 @@ -// Created on: 2011-10-20 -// Created by: Sergey ZERCHANINOV -// Copyright (c) 2011-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -#include -#include -#include -#include - -static void OpenGl_CreateMarkers(const Graphic3d_CGroup& ACGroup, const Standard_Integer NbPoints, const Graphic3d_Vertex *Points) -{ - OpenGl_MarkerSet *amarkerset = new OpenGl_MarkerSet( NbPoints, Points ); - ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelMarkerSet, amarkerset ); -} - -void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex &APoint) -{ - if (!ACGroup.ptrGroup) - return; - - const Aspect_TypeOfMarker AType = Aspect_TypeOfMarker (ACGroup.ContextMarker.MarkerType); - - switch (AType) - { - case Aspect_TOM_POINT : - case Aspect_TOM_PLUS : - case Aspect_TOM_STAR : - case Aspect_TOM_O : - case Aspect_TOM_X : - case Aspect_TOM_O_POINT : - case Aspect_TOM_O_PLUS : - case Aspect_TOM_O_STAR : - case Aspect_TOM_O_X : - case Aspect_TOM_RING1 : - case Aspect_TOM_RING2 : - case Aspect_TOM_RING3 : - case Aspect_TOM_USERDEFINED: - OpenGl_CreateMarkers(ACGroup, 1, &APoint); - break; - - case Aspect_TOM_BALL : - { - const Standard_Real Delta = 0.1; - - Standard_Real R, G, B, H, L, S, AScale; - R = Standard_Real (ACGroup.ContextMarker.Color.r); - G = Standard_Real (ACGroup.ContextMarker.Color.g); - B = Standard_Real (ACGroup.ContextMarker.Color.b); - AScale = Standard_Real (ACGroup.ContextMarker.Scale); - - // we draw a set of circles - CALL_DEF_CONTEXTMARKER AContext; - AContext.MarkerType = int (Aspect_TOM_O); - while (AScale >= 1.0) - { - Quantity_Color::RgbHls (R, G, B, H, L, S); - // Modification de la saturation de 5 % - S *= 0.95; - Quantity_Color::HlsRgb (H, L, S, R, G, B); - AContext.Color.r = float (R); - AContext.Color.g = float (G); - AContext.Color.b = float (B); - AContext.Scale = float (AScale); - ((OpenGl_Group *)ACGroup.ptrGroup)->SetAspectMarker(AContext, Standard_False); - OpenGl_CreateMarkers(ACGroup, 1, &APoint); - AScale -= Delta; - } - break; - } - default: - break; - } -} - -void OpenGl_GraphicDriver::MarkerSet (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex) -{ - if (!ACGroup.ptrGroup) - return; - - const Standard_Integer nb = ListVertex.Length(); - const Graphic3d_Vertex *arr = &ListVertex( ListVertex.Lower() ); - - const Aspect_TypeOfMarker AType = Aspect_TypeOfMarker (ACGroup.ContextMarker.MarkerType); - - switch (AType) - { - case Aspect_TOM_POINT : - case Aspect_TOM_PLUS : - case Aspect_TOM_STAR : - case Aspect_TOM_O : - case Aspect_TOM_X : - case Aspect_TOM_O_POINT : - case Aspect_TOM_O_PLUS : - case Aspect_TOM_O_STAR : - case Aspect_TOM_O_X : - case Aspect_TOM_RING1 : - case Aspect_TOM_RING2 : - case Aspect_TOM_RING3 : - case Aspect_TOM_USERDEFINED: - OpenGl_CreateMarkers(ACGroup, nb, arr); - break; - - case Aspect_TOM_BALL : - { - const Standard_Real Delta = 0.1; - - Standard_Real R, G, B, H, L, S, AScale; - R = Standard_Real (ACGroup.ContextMarker.Color.r); - G = Standard_Real (ACGroup.ContextMarker.Color.g); - B = Standard_Real (ACGroup.ContextMarker.Color.b); - AScale = Standard_Real (ACGroup.ContextMarker.Scale); - - // we draw a set of circles - CALL_DEF_CONTEXTMARKER AContext; - AContext.MarkerType = int (Aspect_TOM_O); - while (AScale >= 1.0) - { - Quantity_Color::RgbHls (R, G, B, H, L, S); - // Modification de la saturation de 5 % - S *= 0.95; - Quantity_Color::HlsRgb (H, L, S, R, G, B); - AContext.Color.r = float (R); - AContext.Color.g = float (G); - AContext.Color.b = float (B); - AContext.Scale = float (AScale); - ((OpenGl_Group *)ACGroup.ptrGroup)->SetAspectMarker(AContext, Standard_False); - OpenGl_CreateMarkers(ACGroup, nb, arr); - AScale -= Delta; - } - break; - } - default: - break; - } -} diff --git a/src/OpenGl/OpenGl_Group.cxx b/src/OpenGl/OpenGl_Group.cxx index cf80e70a45..b6f81ad0c9 100644 --- a/src/OpenGl/OpenGl_Group.cxx +++ b/src/OpenGl/OpenGl_Group.cxx @@ -81,19 +81,22 @@ void OpenGl_Group::SetAspectFace (const Handle(OpenGl_Context)& theCtx, /*----------------------------------------------------------------------*/ -void OpenGl_Group::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theContext, +void OpenGl_Group::SetAspectMarker (const Handle(OpenGl_Context)& theCtx, + const CALL_DEF_CONTEXTMARKER& theAspect, const Standard_Boolean theIsGlobal) { if (theIsGlobal || myFirst == NULL) { if (myAspectMarker == NULL) + { myAspectMarker = new OpenGl_AspectMarker(); - myAspectMarker->SetContext (theContext); + } + myAspectMarker->Init (theCtx, theAspect); } else { OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker(); - anAspectMarker->SetContext (theContext); + anAspectMarker->Init (theCtx, theAspect); AddElement (TelNil/*TelAspectMarker*/, anAspectMarker); } } diff --git a/src/OpenGl/OpenGl_Group.hxx b/src/OpenGl/OpenGl_Group.hxx index 086a299d79..4d4d9c77a2 100644 --- a/src/OpenGl/OpenGl_Group.hxx +++ b/src/OpenGl/OpenGl_Group.hxx @@ -50,7 +50,9 @@ public: void SetAspectFace (const Handle(OpenGl_Context)& theCtx, const CALL_DEF_CONTEXTFILLAREA& theAspect, const Standard_Boolean IsGlobal = Standard_True); - void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext, const Standard_Boolean IsGlobal = Standard_True); + void SetAspectMarker (const Handle(OpenGl_Context)& theCtx, + const CALL_DEF_CONTEXTMARKER& theAspect, + const Standard_Boolean IsGlobal = Standard_True); void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext, const Standard_Boolean IsGlobal = Standard_True); void AddElement (const TelType, OpenGl_Element * ); diff --git a/src/OpenGl/OpenGl_Marker.cxx b/src/OpenGl/OpenGl_Marker.cxx deleted file mode 100644 index 06314694a0..0000000000 --- a/src/OpenGl/OpenGl_Marker.cxx +++ /dev/null @@ -1,112 +0,0 @@ -// Created on: 2011-07-13 -// Created by: Sergey ZERCHANINOV -// Copyright (c) 2011-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include - -#include - -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -void OpenGl_Marker::Release (const Handle(OpenGl_Context)&) -{ - // -} - -void OpenGl_Marker::Render (const Handle(OpenGl_Workspace) &AWorkspace) const -{ - const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True ); - - // Use highlight colours - glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb ); - - switch ( aspect_marker->Type() ) - { - case Aspect_TOM_O_POINT : - { - const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() ); - glRasterPos3fv( myPoint.xyz ); - AWorkspace->GetDisplay()->SetBaseForMarker(); - glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); - } - case Aspect_TOM_POINT : - { - glBegin( GL_POINTS ); - glVertex3fv( myPoint.xyz ); - glEnd(); - break; - } - default: - { - glRasterPos3fv( myPoint.xyz ); - switch ( aspect_marker->Type() ) - { - case Aspect_TOM_RING1 : - case Aspect_TOM_RING2 : - case Aspect_TOM_RING3 : - { - const float ADelta = 0.1f; - float AScale = aspect_marker->Scale(); - float ALimit = 0.f; - if (aspect_marker->Type() == Aspect_TOM_RING1) - ALimit = AScale * 0.2f; - else if (aspect_marker->Type() == Aspect_TOM_RING2) - ALimit = AScale * 0.5f; - else - ALimit = AScale * 0.8f; - AWorkspace->GetDisplay()->SetBaseForMarker(); - while (AScale > ALimit && AScale >= 1.f) - { - const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale ); - glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); - AScale -= ADelta; - } - break; - } - case Aspect_TOM_USERDEFINED : - { - glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) ); - break; - } - default : - { - AWorkspace->GetDisplay()->SetBaseForMarker(); - const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() ); - glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *)str ); - } - } - - if (AWorkspace->GetGlContext()->IsFeedback()) - { - glBegin( GL_POINTS ); - glVertex3fv( myPoint.xyz ); - glEnd(); - /* it is necessary to indicate end of marker information*/ - } - } - } -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_MarkerSet.cxx b/src/OpenGl/OpenGl_MarkerSet.cxx deleted file mode 100644 index 3ab427c1b0..0000000000 --- a/src/OpenGl/OpenGl_MarkerSet.cxx +++ /dev/null @@ -1,145 +0,0 @@ -// Created on: 2011-07-13 -// Created by: Sergey ZERCHANINOV -// Copyright (c) 2011-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#include -#include - -#include - -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -OpenGl_MarkerSet::OpenGl_MarkerSet (const Standard_Integer ANbPoints, const Graphic3d_Vertex *APoints) -: myNbPoints(ANbPoints), - myPoints(new TEL_POINT[ANbPoints]) -{ - memcpy( myPoints, APoints, ANbPoints*sizeof(TEL_POINT) ); -} - -/*----------------------------------------------------------------------*/ - -OpenGl_MarkerSet::~OpenGl_MarkerSet () -{ - if (myPoints) - delete[] myPoints; -} - -/*----------------------------------------------------------------------*/ - -void OpenGl_MarkerSet::Render (const Handle(OpenGl_Workspace) &AWorkspace) const -{ - const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True ); - - // Use highlight colors - glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb ); - - const TEL_POINT *ptr; - Tint i; - - switch ( aspect_marker->Type() ) - { - case Aspect_TOM_O_POINT : - { - const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() ); - AWorkspace->GetDisplay()->SetBaseForMarker(); - for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) - { - glRasterPos3fv( ptr->xyz ); - glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); - } - } - case Aspect_TOM_POINT : - { - glBegin( GL_POINTS ); - for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) - glVertex3fv( ptr->xyz ); - glEnd(); - break; - } - default: - { - switch ( aspect_marker->Type() ) - { - case Aspect_TOM_RING1 : - case Aspect_TOM_RING2 : - case Aspect_TOM_RING3 : - { - const float ADelta = 0.1f; - float AScale = aspect_marker->Scale(); - float ALimit = 0.f; - if (aspect_marker->Type() == Aspect_TOM_RING1) - ALimit = AScale * 0.2f; - else if (aspect_marker->Type() == Aspect_TOM_RING2) - ALimit = AScale * 0.5f; - else - ALimit = AScale * 0.8f; - AWorkspace->GetDisplay()->SetBaseForMarker(); - for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) - { - glRasterPos3fv( ptr->xyz ); - AScale = aspect_marker->Scale(); - while (AScale > ALimit && AScale >= 1.f) - { - const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale ); - glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); - AScale -= ADelta; - } - } - break; - } - case Aspect_TOM_USERDEFINED : - { - for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) - { - glRasterPos3fv( ptr->xyz ); - glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) ); - } - break; - } - default : - { - AWorkspace->GetDisplay()->SetBaseForMarker(); - const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() ); - for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) - { - glRasterPos3fv( ptr->xyz ); - glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); - } - } - } - - if (AWorkspace->GetGlContext()->IsFeedback()) - { - glBegin( GL_POINTS ); - for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) - glVertex3fv( ptr->xyz ); - glEnd(); - } - } - } -} - -void OpenGl_MarkerSet::Release (const Handle(OpenGl_Context)&) -{ - // -} diff --git a/src/OpenGl/OpenGl_PointSprite.cxx b/src/OpenGl/OpenGl_PointSprite.cxx new file mode 100644 index 0000000000..f733595c55 --- /dev/null +++ b/src/OpenGl/OpenGl_PointSprite.cxx @@ -0,0 +1,89 @@ +// Created by: Kirill GAVRILOV +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#include + +#include +#include +#include +#include + +IMPLEMENT_STANDARD_HANDLE (OpenGl_PointSprite, OpenGl_Texture) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture) + +// ======================================================================= +// function : OpenGl_PointSprite +// purpose : +// ======================================================================= +OpenGl_PointSprite::OpenGl_PointSprite() +: OpenGl_Texture (NULL), + myBitmapList (0) +{ + //myParams->SetFilter (Graphic3d_TOTF_NEAREST); + myParams->SetGenMode (Graphic3d_TOTM_SPRITE, + Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f), + Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f)); +} + +// ======================================================================= +// function : ~OpenGl_PointSprite +// purpose : +// ======================================================================= +OpenGl_PointSprite::~OpenGl_PointSprite() +{ + Release (NULL); +} + +// ======================================================================= +// function : Release +// purpose : +// ======================================================================= +void OpenGl_PointSprite::Release (const OpenGl_Context* theGlCtx) +{ + if (myBitmapList != 0) + { + glDeleteLists (myBitmapList, 1); + myBitmapList = 0; + } + + OpenGl_Texture::Release (theGlCtx); +} + +// ======================================================================= +// function : SetDisplayList +// purpose : +// ======================================================================= +void OpenGl_PointSprite::SetDisplayList (const Handle(OpenGl_Context)& theCtx, + const GLuint theBitmapList) +{ + Release (theCtx.operator->()); + myBitmapList = theBitmapList; +} + + +// ======================================================================= +// function : DrawBitmap +// purpose : +// ======================================================================= +void OpenGl_PointSprite::DrawBitmap (const Handle(OpenGl_Context)& ) const +{ + if (myBitmapList != 0) + { + glCallList (myBitmapList); + } +} diff --git a/src/OpenGl/OpenGl_PointSprite.hxx b/src/OpenGl/OpenGl_PointSprite.hxx new file mode 100644 index 0000000000..dc6c7d3d31 --- /dev/null +++ b/src/OpenGl/OpenGl_PointSprite.hxx @@ -0,0 +1,65 @@ +// Created by: Kirill GAVRILOV +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _OpenGl_PointSprite_H__ +#define _OpenGl_PointSprite_H__ + +#include +#include + +//! Point sprite resource. On modern hardware it will be texture with extra parameters. +//! On ancient hardware sprites will be drawn using bitmaps. +class OpenGl_PointSprite : public OpenGl_Texture +{ + +public: + + //! Create uninitialized resource. + Standard_EXPORT OpenGl_PointSprite(); + + //! Destroy object. + Standard_EXPORT virtual ~OpenGl_PointSprite(); + + //! Destroy object - will release GPU memory if any. + Standard_EXPORT virtual void Release (const OpenGl_Context* theCtx); + + //! @return true if this is display list bitmap + inline Standard_Boolean IsDisplayList() const + { + return myBitmapList != 0; + } + + //! Draw sprite using glBitmap. + //! Please call glRasterPos3fv() before to setup sprite position. + Standard_EXPORT void DrawBitmap (const Handle(OpenGl_Context)& theCtx) const; + + //! Initialize point sprite as display list + Standard_EXPORT void SetDisplayList (const Handle(OpenGl_Context)& theCtx, + const GLuint theBitmapList); + +protected: + + GLuint myBitmapList; //!< if of display list to draw sprite using glBitmap (for backward compatibility) + +public: + + DEFINE_STANDARD_RTTI(OpenGl_PointSprite) // Type definition + +}; + +#endif // _OpenGl_PointSprite_H__ diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index fdc0f02b14..6a2a1f2e00 100755 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -229,7 +230,7 @@ void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel, glEnableClientState (GL_TEXTURE_COORD_ARRAY); } - if (pvc != NULL) + if ((pvc != NULL) && (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) == 0) { glColorPointer (4, GL_UNSIGNED_BYTE, 0, pvc); // array of colors glEnableClientState (GL_COLOR_ARRAY); @@ -249,7 +250,7 @@ void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel, { myVbos[VBOVtexels]->BindFixed (aGlContext, GL_TEXTURE_COORD_ARRAY); } - if (!myVbos[VBOVcolours].IsNull()) + if (!myVbos[VBOVcolours].IsNull() && (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) == 0) { myVbos[VBOVcolours]->BindFixed (aGlContext, GL_COLOR_ARRAY); glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); @@ -295,7 +296,14 @@ void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel, } else { - glDrawArrays (myDrawMode, 0, myVbos[VBOVertices]->GetElemsNb()); + if (myDrawMode == GL_POINTS) + { + DrawMarkers (theWorkspace); + } + else + { + glDrawArrays (myDrawMode, 0, myVbos[VBOVertices]->GetElemsNb()); + } } // bind with 0 @@ -344,7 +352,14 @@ void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel, } else { - glDrawArrays (myDrawMode, 0, myPArray->num_vertexs); + if (myDrawMode == GL_POINTS) + { + DrawMarkers (theWorkspace); + } + else + { + glDrawArrays (myDrawMode, 0, myPArray->num_vertexs); + } } if (pvc != NULL) @@ -516,6 +531,90 @@ void OpenGl_PrimitiveArray::DrawEdges (const TEL_COLOUR* theEdgeCo } } +// ======================================================================= +// function : DrawMarkers +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const +{ + const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (Standard_True); + const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); + const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->Sprite(); + const Standard_Boolean isHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT); + if (aCtx->IsGlGreaterEqual (2, 0) + && !aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) + { + // Textured markers will be drawn with the point sprites + glPointSize (anAspectMarker->MarkerSize()); + + Handle(OpenGl_Texture) aTextureBack; + if (anAspectMarker->Type() != Aspect_TOM_POINT) + { + const Handle(OpenGl_PointSprite)& aSprite = (isHilight && anAspectMarker->SpriteHighlight()->IsValid()) + ? anAspectMarker->SpriteHighlight() + : aSpriteNorm; + aTextureBack = theWorkspace->EnableTexture (aSprite); + + glEnable (GL_ALPHA_TEST); + glAlphaFunc (GL_GEQUAL, 0.1f); + + glEnable (GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + glDrawArrays (myDrawMode, 0, toDrawVbo() ? myVbos[VBOVertices]->GetElemsNb() : myPArray->num_vertexs); + + glDisable (GL_BLEND); + glDisable (GL_ALPHA_TEST); + if (anAspectMarker->Type() != Aspect_TOM_POINT) + { + theWorkspace->EnableTexture (aTextureBack); + } + glPointSize (1.0f); + return; + } + + // Textured markers will be drawn with the glBitmap + const GLfloat aPntSize = anAspectMarker->Type() == Aspect_TOM_POINT + ? anAspectMarker->MarkerSize() + : 0.0f; + if (aPntSize > 0.0f) + { + glPointSize (aPntSize); + } + if (anAspectMarker->Type() == Aspect_TOM_POINT + || anAspectMarker->Type() == Aspect_TOM_O_POINT) + { + glDrawArrays (myDrawMode, 0, toDrawVbo() ? myVbos[VBOVertices]->GetElemsNb() : myPArray->num_vertexs); + } + if (aPntSize > 0.0f) + { + glPointSize (1.0f); + } + + if (anAspectMarker->Type() != Aspect_TOM_POINT + && !aSpriteNorm.IsNull()) + { + if (!isHilight && (myPArray->vcolours != NULL)) + { + for (Standard_Integer anIter = 0; anIter < myPArray->num_vertexs; anIter++) + { + glColor4ubv ((GLubyte* )&myPArray->vcolours[anIter]); + glRasterPos3fv (myPArray->vertices[anIter].xyz); + aSpriteNorm->DrawBitmap (theWorkspace->GetGlContext()); + } + } + else + { + for (Standard_Integer anIter = 0; anIter < myPArray->num_vertexs; anIter++) + { + glRasterPos3fv (myPArray->vertices[anIter].xyz); + aSpriteNorm->DrawBitmap (theWorkspace->GetGlContext()); + } + } + } +} + // ======================================================================= // function : OpenGl_PrimitiveArray // purpose : @@ -596,9 +695,16 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace return; } + const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True); + const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); + const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (myDrawMode == GL_POINTS); + // create VBOs on first render call const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); - if (!myIsVboInit && !aCtx->caps->vboDisable && aCtx->core15 != NULL) + if (!myIsVboInit + && !aCtx->caps->vboDisable + && aCtx->core15 != NULL + && (myDrawMode != GL_POINTS || anAspectMarker->Sprite().IsNull() || !anAspectMarker->Sprite()->IsDisplayList())) { BuildVBO (theWorkspace); myIsVboInit = Standard_True; @@ -617,10 +723,6 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace break; } - const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True); - const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); - const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker (myPArray->type == TelPointsArrayType); - Tint aFrontLightingModel = anAspectFace->IntFront.color_mask; const TEL_COLOUR* anInteriorColor = &anAspectFace->IntFront.matcol; const TEL_COLOUR* anEdgeColor = &anAspectFace->AspectEdge()->Color(); diff --git a/src/OpenGl/OpenGl_PrimitiveArray.hxx b/src/OpenGl/OpenGl_PrimitiveArray.hxx index 1a314e33e1..2a3f681286 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.hxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.hxx @@ -24,6 +24,7 @@ #include #include +#include #include @@ -76,6 +77,8 @@ private: void DrawEdges (const TEL_COLOUR* theEdgeColour, const Handle(OpenGl_Workspace)& theWorkspace) const; + void DrawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const; + protected: //! Destructor diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index 9545e177b3..47a436e475 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -191,11 +191,14 @@ void OpenGl_Structure::SetAspectFace (const Handle(OpenGl_Context)& theCtx, /*----------------------------------------------------------------------*/ -void OpenGl_Structure::SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext) +void OpenGl_Structure::SetAspectMarker (const Handle(OpenGl_Context)& theCtx, + const CALL_DEF_CONTEXTMARKER& theAspect) { if (!myAspectMarker) + { myAspectMarker = new OpenGl_AspectMarker(); - myAspectMarker->SetContext( AContext ); + } + myAspectMarker->Init (theCtx, theAspect); } /*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Structure.hxx b/src/OpenGl/OpenGl_Structure.hxx index a2d7eaf998..978ace2fc1 100644 --- a/src/OpenGl/OpenGl_Structure.hxx +++ b/src/OpenGl/OpenGl_Structure.hxx @@ -50,7 +50,8 @@ public: void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext); void SetAspectFace (const Handle(OpenGl_Context)& theCtx, const CALL_DEF_CONTEXTFILLAREA& theAspect); - void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext); + void SetAspectMarker (const Handle(OpenGl_Context)& theCtx, + const CALL_DEF_CONTEXTMARKER& theAspect); void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext); void SetHighlightBox (const Handle(OpenGl_Context)& theGlCtx, diff --git a/src/OpenGl/OpenGl_Texture.cxx b/src/OpenGl/OpenGl_Texture.cxx index b7c9c32fd5..f1c1b9003b 100644 --- a/src/OpenGl/OpenGl_Texture.cxx +++ b/src/OpenGl/OpenGl_Texture.cxx @@ -158,23 +158,23 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, return false; } - GLenum aTextureFormat = GL_RGBA8; - GLenum aPixelFormat = 0; - GLenum aDataType = 0; + myTextFormat = GL_RGBA8; + GLenum aPixelFormat = 0; + GLenum aDataType = 0; switch (theImage.Format()) { case Image_PixMap::ImgGrayF: { - aTextureFormat = GL_ALPHA8; // GL_R8, GL_R32F - aPixelFormat = GL_ALPHA; // GL_RED - aDataType = GL_FLOAT; + myTextFormat = GL_ALPHA8; // GL_R8, GL_R32F + aPixelFormat = GL_ALPHA; // GL_RED + aDataType = GL_FLOAT; break; } case Image_PixMap::ImgRGBAF: { - aTextureFormat = GL_RGBA8; // GL_RGBA32F - aPixelFormat = GL_RGBA; - aDataType = GL_FLOAT; + myTextFormat = GL_RGBA8; // GL_RGBA32F + aPixelFormat = GL_RGBA; + aDataType = GL_FLOAT; break; } case Image_PixMap::ImgBGRAF: @@ -183,30 +183,30 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, { return false; } - aTextureFormat = GL_RGBA8; // GL_RGBA32F - aPixelFormat = GL_BGRA; // equals to GL_BGRA_EXT - aDataType = GL_FLOAT; + myTextFormat = GL_RGBA8; // GL_RGBA32F + aPixelFormat = GL_BGRA; // equals to GL_BGRA_EXT + aDataType = GL_FLOAT; break; } case Image_PixMap::ImgRGBF: { - aTextureFormat = GL_RGB8; // GL_RGB32F - aPixelFormat = GL_RGB; - aDataType = GL_FLOAT; + myTextFormat = GL_RGB8; // GL_RGB32F + aPixelFormat = GL_RGB; + aDataType = GL_FLOAT; break; } case Image_PixMap::ImgBGRF: { - aTextureFormat = GL_RGB8; // GL_RGB32F - aPixelFormat = GL_BGR; // equals to GL_BGR_EXT - aDataType = GL_FLOAT; + myTextFormat = GL_RGB8; // GL_RGB32F + aPixelFormat = GL_BGR; // equals to GL_BGR_EXT + aDataType = GL_FLOAT; break; } case Image_PixMap::ImgRGBA: { - aTextureFormat = GL_RGBA8; - aPixelFormat = GL_RGBA; - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_RGBA8; + aPixelFormat = GL_RGBA; + aDataType = GL_UNSIGNED_BYTE; break; } case Image_PixMap::ImgBGRA: @@ -215,16 +215,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, { return false; } - aTextureFormat = GL_RGBA8; - aPixelFormat = GL_BGRA; // equals to GL_BGRA_EXT - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_RGBA8; + aPixelFormat = GL_BGRA; // equals to GL_BGRA_EXT + aDataType = GL_UNSIGNED_BYTE; break; } case Image_PixMap::ImgRGB32: { - aTextureFormat = GL_RGB8; - aPixelFormat = GL_RGBA; - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_RGB8; + aPixelFormat = GL_RGBA; + aDataType = GL_UNSIGNED_BYTE; break; } case Image_PixMap::ImgBGR32: @@ -233,16 +233,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, { return false; } - aTextureFormat = GL_RGB8; - aPixelFormat = GL_BGRA; // equals to GL_BGRA_EXT - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_RGB8; + aPixelFormat = GL_BGRA; // equals to GL_BGRA_EXT + aDataType = GL_UNSIGNED_BYTE; break; } case Image_PixMap::ImgRGB: { - aTextureFormat = GL_RGB8; - aPixelFormat = GL_RGB; - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_RGB8; + aPixelFormat = GL_RGB; + aDataType = GL_UNSIGNED_BYTE; break; } case Image_PixMap::ImgBGR: @@ -251,16 +251,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, { return false; } - aTextureFormat = GL_RGB8; - aPixelFormat = GL_BGR; // equals to GL_BGR_EXT - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_RGB8; + aPixelFormat = GL_BGR; // equals to GL_BGR_EXT + aDataType = GL_UNSIGNED_BYTE; break; } case Image_PixMap::ImgGray: { - aTextureFormat = GL_ALPHA8; // GL_R8 - aPixelFormat = GL_ALPHA; // GL_RED - aDataType = GL_UNSIGNED_BYTE; + myTextFormat = GL_ALPHA8; // GL_R8 + aPixelFormat = GL_ALPHA; // GL_RED + aDataType = GL_UNSIGNED_BYTE; break; } default: @@ -311,7 +311,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, } // use proxy to check texture could be created or not - glTexImage1D (GL_PROXY_TEXTURE_1D, 0, aTextureFormat, + glTexImage1D (GL_PROXY_TEXTURE_1D, 0, myTextFormat, aWidthOut, 0, aPixelFormat, aDataType, NULL); glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth); @@ -322,7 +322,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, return false; } - glTexImage1D (GL_TEXTURE_1D, 0, aTextureFormat, + glTexImage1D (GL_TEXTURE_1D, 0, myTextFormat, aWidthOut, 0, aPixelFormat, aDataType, aDataPtr); if (glGetError() != GL_NO_ERROR) @@ -362,7 +362,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, } // use proxy to check texture could be created or not - glTexImage2D (GL_PROXY_TEXTURE_2D, 0, aTextureFormat, + glTexImage2D (GL_PROXY_TEXTURE_2D, 0, myTextFormat, aWidthOut, aHeightOut, 0, aPixelFormat, aDataType, NULL); glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth); @@ -374,7 +374,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, return false; } - glTexImage2D (GL_TEXTURE_2D, 0, aTextureFormat, + glTexImage2D (GL_TEXTURE_2D, 0, myTextFormat, aWidthOut, aHeightOut, 0, aPixelFormat, aDataType, aDataPtr); if (glGetError() != GL_NO_ERROR) @@ -401,7 +401,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, && aWidth == aWidthOut && aHeight == aHeightOut) { // use proxy to check texture could be created or not - glTexImage2D (GL_PROXY_TEXTURE_2D, 0, aTextureFormat, + glTexImage2D (GL_PROXY_TEXTURE_2D, 0, myTextFormat, aWidthOut, aHeightOut, 0, aPixelFormat, aDataType, NULL); glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth); @@ -414,7 +414,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, } // upload main picture - glTexImage2D (GL_TEXTURE_2D, 0, aTextureFormat, + glTexImage2D (GL_TEXTURE_2D, 0, myTextFormat, aWidthOut, aHeightOut, 0, aPixelFormat, aDataType, theImage.Data()); if (glGetError() != GL_NO_ERROR) @@ -435,7 +435,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, } else { - bool isCreated = gluBuild2DMipmaps (GL_TEXTURE_2D, aTextureFormat, + bool isCreated = gluBuild2DMipmaps (GL_TEXTURE_2D, myTextFormat, aWidth, aHeight, aPixelFormat, aDataType, theImage.Data()) == 0; if (isCreated) diff --git a/src/OpenGl/OpenGl_Texture.hxx b/src/OpenGl/OpenGl_Texture.hxx index 64f45aa38a..a6e452df31 100644 --- a/src/OpenGl/OpenGl_Texture.hxx +++ b/src/OpenGl/OpenGl_Texture.hxx @@ -76,6 +76,12 @@ public: return myTextureId; } + //! @return texture format + inline GLint GetFormat() const + { + return myTextFormat; + } + //! Creates Texture id if not yet generated. //! Data should be initialized by another method. Standard_EXPORT bool Create (const Handle(OpenGl_Context)& theCtx); diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx index 22507903fa..a0c453cbd4 100644 --- a/src/OpenGl/OpenGl_Workspace.cxx +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -17,7 +17,7 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -#include +#include #include @@ -224,6 +224,10 @@ Handle(OpenGl_Texture) OpenGl_Workspace::DisableTexture() { glDisable (GL_TEXTURE_GEN_S); glDisable (GL_TEXTURE_GEN_T); + if (myTextureBound->GetParams()->GenMode() == Graphic3d_TOTM_SPRITE) + { + glDisable (GL_POINT_SPRITE); + } } glDisable (GL_TEXTURE_2D); break; @@ -301,12 +305,26 @@ void OpenGl_Workspace::setTextureParams (Handle(OpenGl_Texture)& glPopMatrix(); break; } + case Graphic3d_TOTM_SPRITE: + { + if (GetGlContext()->core20 != NULL) + { + glEnable (GL_POINT_SPRITE); + glTexEnvi (GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE); + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + GetGlContext()->core15->glPointParameteri (GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); + } + break; + } case Graphic3d_TOTM_MANUAL: default: break; } // setup lighting - glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, aParams->IsModulate() ? GL_MODULATE : GL_DECAL); + if (aParams->GenMode() != Graphic3d_TOTM_SPRITE) + { + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, aParams->IsModulate() ? GL_MODULATE : GL_DECAL); + } // setup texture filtering and wrapping //if (theTexture->GetParams() != theParams) diff --git a/src/OpenGl/OpenGl_Workspace_2.cxx b/src/OpenGl/OpenGl_Workspace_2.cxx index d5a23e2bab..3b591b0fcd 100644 --- a/src/OpenGl/OpenGl_Workspace_2.cxx +++ b/src/OpenGl/OpenGl_Workspace_2.cxx @@ -803,8 +803,6 @@ void OpenGl_Workspace::Redraw1 (const Graphic3d_CView& ACView, if (myDisplay.IsNull() || myView.IsNull()) return; - myDisplay->UpdateUserMarkers(); - // Request reset of material NamedStatus |= OPENGL_NS_RESMAT; diff --git a/src/Prs3d/Prs3d_Point.hxx b/src/Prs3d/Prs3d_Point.hxx index 81fd6aeb89..107c5bcb2a 100644 --- a/src/Prs3d/Prs3d_Point.hxx +++ b/src/Prs3d/Prs3d_Point.hxx @@ -19,6 +19,7 @@ #define _Prs3d_Point_H__ +#include #include #include #include @@ -39,8 +40,9 @@ private: { Quantity_Length aX,aY,aZ; PointTool::Coord(thePoint,aX,aY,aZ); - Graphic3d_Vertex aVertex(aX,aY,aZ); - theGroup->Marker(aVertex); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (aX, aY, aZ); + theGroup->AddPrimitiveArray (anArrayOfPoints); } public: diff --git a/src/Prs3d/Prs3d_PointAspect.cdl b/src/Prs3d/Prs3d_PointAspect.cdl index aca81bfa94..648d787de5 100755 --- a/src/Prs3d/Prs3d_PointAspect.cdl +++ b/src/Prs3d/Prs3d_PointAspect.cdl @@ -34,7 +34,8 @@ uses NameOfColor from Quantity, Color from Quantity, TypeOfMarker from Aspect, - HArray1OfByte from TColStd + HArray1OfByte from TColStd, + MarkerImage_Handle from Graphic3d is @@ -51,7 +52,6 @@ is returns mutable PointAspect from Prs3d; Create ( AColor : Color from Quantity; - AnId : Real from Standard; AWidth : Integer from Standard; AHeight : Integer from Standard; ATexture : HArray1OfByte from TColStd) @@ -85,7 +85,7 @@ is ---Purpose: Returns marker's texture size. GetTexture (me:mutable) - returns HArray1OfByte from TColStd; + returns MarkerImage_Handle from Graphic3d; ---Level: Public ---Purpose: Returns marker's texture. ---C++: return const & diff --git a/src/Prs3d/Prs3d_PointAspect.cxx b/src/Prs3d/Prs3d_PointAspect.cxx index 8abd01c614..8bbd450393 100755 --- a/src/Prs3d/Prs3d_PointAspect.cxx +++ b/src/Prs3d/Prs3d_PointAspect.cxx @@ -37,14 +37,13 @@ Prs3d_PointAspect::Prs3d_PointAspect (const Aspect_TypeOfMarker aType, } Prs3d_PointAspect::Prs3d_PointAspect (const Quantity_Color &aColor, - const Standard_Real anId, const Standard_Integer aWidth, const Standard_Integer aHeight, const Handle(TColStd_HArray1OfByte)& aTexture ) { myAspect = new Graphic3d_AspectMarker3d - (Aspect_TOM_USERDEFINED,aColor,anId,aWidth,aHeight,aTexture); + (aColor,aWidth,aHeight,aTexture); } #ifdef GER61351 @@ -74,7 +73,7 @@ void Prs3d_PointAspect::GetTextureSize(Standard_Integer& AWidth, Standard_Intege myAspect->GetTextureSize( AWidth, AHeight); } -const Handle(TColStd_HArray1OfByte)& Prs3d_PointAspect::GetTexture() +const Handle(Graphic3d_MarkerImage)& Prs3d_PointAspect::GetTexture() { - return myAspect->GetTexture(); + return myAspect->GetMarkerImage(); } diff --git a/src/Prs3d/Prs3d_WFShape.cxx b/src/Prs3d/Prs3d_WFShape.cxx index f3d500cf6b..b1b21366d2 100644 --- a/src/Prs3d/Prs3d_WFShape.cxx +++ b/src/Prs3d/Prs3d_WFShape.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -625,17 +625,15 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation, aNbVertices = aShapePoints.Length(); if (aNbVertices > 0) { - Graphic3d_Array1OfVertex aPointArray (1, aNbVertices); + Handle(Graphic3d_ArrayOfPoints) aPointArray = new Graphic3d_ArrayOfPoints (aNbVertices); for (anI = 1; anI <= aNbVertices; ++anI) { - aPointArray.SetValue (anI, Graphic3d_Vertex (aShapePoints.Value (anI).X(), - aShapePoints.Value (anI).Y(), - aShapePoints.Value (anI).Z())); + aPointArray->AddVertex (aShapePoints.Value (anI)); } Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation); aGroup->SetPrimitivesAspect (theDrawer->PointAspect()->Aspect()); - aGroup->MarkerSet (aPointArray); + aGroup->AddPrimitiveArray (aPointArray); } } diff --git a/src/StdSelect/StdSelect_ViewerSelector3d.cxx b/src/StdSelect/StdSelect_ViewerSelector3d.cxx index 8088c8974b..87885ce2c5 100755 --- a/src/StdSelect/StdSelect_ViewerSelector3d.cxx +++ b/src/StdSelect/StdSelect_ViewerSelector3d.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -905,8 +906,9 @@ void StdSelect_ViewerSelector3d::ComputeSensitivePrs(const Handle(SelectMgr_Sele gp_Pnt P = hasloc ? Handle(Select3D_SensitivePoint)::DownCast(Ent)->Point() : Handle(Select3D_SensitivePoint)::DownCast(Ent)->Point().Transformed (theloc.Transformation()); - Graphic3d_Vertex V (P.X(), P.Y(), P.Z()); - mysensgroup->Marker (V); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (P.X(), P.Y(), P.Z()); + mysensgroup->AddPrimitiveArray (anArrayOfPoints); } //============================================================ // Triangulation : On met un petit offset ves l'interieur... diff --git a/src/V3d/V3d_CircularGrid.cxx b/src/V3d/V3d_CircularGrid.cxx index 05d2658a39..21a2fe36aa 100755 --- a/src/V3d/V3d_CircularGrid.cxx +++ b/src/V3d/V3d_CircularGrid.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -326,13 +327,13 @@ void V3d_CircularGrid::DefinePoints () { Standard_Real X,Y,Z; const Standard_Integer nbv = aSeqPnts.Length(); - Graphic3d_Array1OfVertex Cercle (1,nbv); + Handle(Graphic3d_ArrayOfPoints) Cercle = new Graphic3d_ArrayOfPoints (nbv); for (Standard_Integer i=1; i<=nbv; i++) { aSeqPnts(i).Coord(X,Y,Z); - Cercle(i).SetCoord(X,Y,Z); + Cercle->AddVertex (X,Y,Z); } - myGroup->MarkerSet (Cercle, Standard_False); + myGroup->AddPrimitiveArray (Cercle, Standard_False); } myGroup->SetMinMaxValues(-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0); diff --git a/src/V3d/V3d_RectangularGrid.cxx b/src/V3d/V3d_RectangularGrid.cxx index d96f45b955..efd66882b5 100755 --- a/src/V3d/V3d_RectangularGrid.cxx +++ b/src/V3d/V3d_RectangularGrid.cxx @@ -52,8 +52,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -326,14 +325,14 @@ void V3d_RectangularGrid::DefinePoints () Standard_Integer i; Standard_Real X,Y,Z; const Standard_Integer nbv = aSeqPnts.Length(); - Graphic3d_Array1OfVertex Vertical (1,nbv); + Handle(Graphic3d_ArrayOfPoints) Vertical = new Graphic3d_ArrayOfPoints (nbv); for (i=1; i<=nbv; i++) { aSeqPnts(i).Coord(X,Y,Z); - Vertical(i).SetCoord(X,Y,Z); + Vertical->AddVertex (X,Y,Z); } myGroup->SetGroupPrimitivesAspect (MarkerAttrib); - myGroup->MarkerSet (Vertical, Standard_False); + myGroup->AddPrimitiveArray (Vertical, Standard_False); } myGroup->SetMinMaxValues(-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0); diff --git a/src/V3d/V3d_Viewer_4.cxx b/src/V3d/V3d_Viewer_4.cxx index d2b47c2332..94c08cf131 100755 --- a/src/V3d/V3d_Viewer_4.cxx +++ b/src/V3d/V3d_Viewer_4.cxx @@ -190,6 +190,7 @@ Standard_Boolean V3d_Viewer::GridEcho() const { return myGridEcho; } +#include #include void V3d_Viewer::ShowGridEcho( const Handle(V3d_View)& aView, const Graphic3d_Vertex& aVertex ) { @@ -217,7 +218,10 @@ void V3d_Viewer::ShowGridEcho( const Handle(V3d_View)& aView, #ifdef OCC281 myGridEchoGroup->SetPrimitivesAspect( myGridEchoAspect ); #endif - myGridEchoGroup->Marker(aVertex); + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex (aVertex.X(), aVertex.Y(), aVertex.Z()); + myGridEchoGroup->AddPrimitiveArray (anArrayOfPoints); + Visual3d_TransientManager::BeginDraw( aView->View(), Standard_False, Standard_False); Visual3d_TransientManager::DrawStructure (myGridEchoStructure); diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index e1c85058d6..4f5ed4280d 100755 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -107,6 +107,7 @@ #include #include #include +#include #include #include @@ -134,6 +135,7 @@ #include #include +#include #include #include @@ -141,6 +143,9 @@ #include #include +#include + +#include #ifdef HAVE_STRINGS_H #include @@ -3166,9 +3171,11 @@ class MyPArrayObject : public AIS_InteractiveObject public: - MyPArrayObject (const Handle(Graphic3d_ArrayOfPrimitives) theArray) + MyPArrayObject (const Handle(Graphic3d_ArrayOfPrimitives) theArray, + Handle(Graphic3d_AspectMarker3d) theMarkerAspect = NULL) { myArray = theArray; + myMarkerAspect = theMarkerAspect; } DEFINE_STANDARD_RTTI(MyPArrayObject); @@ -3179,12 +3186,13 @@ private: const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode); - void ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/, - const Standard_Integer /*aMode*/) {}; + void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, + const Standard_Integer /*theMode*/); protected: Handle(Graphic3d_ArrayOfPrimitives) myArray; + Handle(Graphic3d_AspectMarker3d) myMarkerAspect; }; @@ -3196,9 +3204,26 @@ void MyPArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPre const Standard_Integer /*aMode*/) { aPresentation->Clear(); + if (!myMarkerAspect.IsNull()) + { + Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect); + } Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (myArray); } +void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, + const Standard_Integer /*theMode*/) +{ + Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this); + + for (Standard_Integer anIter = 1; anIter <= myArray->VertexNumber(); anIter++) + { + + Handle(Select3D_SensitivePoint) aSensetivePoint = new Select3D_SensitivePoint (anEntityOwner, myArray->Vertice (anIter)); + theSelection->Add (aSensetivePoint); + } +} + static bool CheckInputCommand (const TCollection_AsciiString theCommand, const char **theArgStr, int &theArgIndex, int theArgCount, int theMaxArgs) @@ -3325,8 +3350,12 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char* // create an array of primitives by types Handle(Graphic3d_ArrayOfPrimitives) anArray; + Handle(Graphic3d_AspectMarker3d) anAspPoints; if (anArrayType == "points") + { anArray = new Graphic3d_ArrayOfPoints (aVertexNum); + anAspPoints = new Graphic3d_AspectMarker3d (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0f); + } else if (anArrayType == "segments") anArray = new Graphic3d_ArrayOfSegments (aVertexNum, aEdgeNum, hasVColors); else if (anArrayType == "polylines") @@ -3426,7 +3455,7 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char* } // create primitives array object - Handle (MyPArrayObject) aPObject = new MyPArrayObject (anArray); + Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArray, anAspPoints); // register the object in map VDisplayAISObject (aName, aPObject); @@ -4587,6 +4616,114 @@ static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/, return 0; } +//======================================================================= +//function : VMarkersTest +//purpose : Draws an array of markers for testing purposes. +//======================================================================= +static Standard_Integer VMarkersTest (Draw_Interpretor& theDI, + Standard_Integer theArgNb, + const char** theArgVec) +{ + Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); + if (aContext.IsNull()) + { + std::cerr << "Call 'vinit' before!\n"; + return 1; + } + + if (theArgNb < 5) + { + std::cerr << "Usage :\n " << theArgVec[0] + << "name X Y Z [PointsOnSide=10] [MarkerType=0] [Scale=1.0] [FileName=ImageFile]\n"; + return 1; + } + + Standard_Integer anArgIter = 1; + + TCollection_AsciiString aName (theArgVec[anArgIter++]); + TCollection_AsciiString aFileName; + gp_XYZ aPnt (Atof (theArgVec[anArgIter]), + Atof (theArgVec[anArgIter + 1]), + Atof (theArgVec[anArgIter + 2])); + anArgIter += 3; + + Standard_Integer aPointsOnSide = 10; + Standard_Integer aMarkerType = -1; + Standard_Real aScale = 1.0; + for (; anArgIter < theArgNb; ++anArgIter) + { + const TCollection_AsciiString anArg (theArgVec[anArgIter]); + if (anArg.Search ("PointsOnSide=") > -1) + { + aPointsOnSide = anArg.Token ("=", 2).IntegerValue(); + } + else if (anArg.Search ("MarkerType=") > -1) + { + aMarkerType = anArg.Token ("=", 2).IntegerValue(); + } + else if (anArg.Search ("Scale=") > -1) + { + aScale = anArg.Token ("=", 2).RealValue(); + } + else if (anArg.Search ("FileName=") > -1) + { + aFileName = anArg.Token ("=", 2); + } + else + { + std::cerr << "Wrong argument: " << anArg << "\n"; + return 1; + } + } + + Handle(Graphic3d_AspectMarker3d) anAspect; + Handle(Image_AlienPixMap) anImage; + Quantity_Color aColor (Quantity_NOC_GREEN1); + if ((aMarkerType == Aspect_TOM_USERDEFINED || aMarkerType < 0) + && !aFileName.IsEmpty()) + { + anImage = new Image_AlienPixMap(); + if (!anImage->Load (aFileName)) + { + std::cerr << "Could not load image from file '" << aFileName << "'!\n"; + return 1; + } + anAspect = new Graphic3d_AspectMarker3d (anImage); + } + else + { + anAspect = new Graphic3d_AspectMarker3d (aMarkerType >= 0 ? (Aspect_TypeOfMarker )aMarkerType : Aspect_TOM_POINT, aColor, aScale); + } + + Handle(Graphic3d_ArrayOfPrimitives) anArray = new Graphic3d_ArrayOfPoints ((Standard_Integer )Pow (aPointsOnSide, 3), aPointsOnSide != 1); + if (aPointsOnSide == 1) + { + anArray->AddVertex (aPnt); + } + else + { + for (Standard_Real i = 1; i <= aPointsOnSide; i++) + { + for (Standard_Real j = 1; j <= aPointsOnSide; j++) + { + for (Standard_Real k = 1; k <= aPointsOnSide; k++) + { + anArray->AddVertex (aPnt.X() + i, aPnt.Y() + j, aPnt.Z() + k); + anArray->SetVertexColor (anArray->VertexNumber(), + i / aPointsOnSide, + j / aPointsOnSide, + k / aPointsOnSide); + } + } + } + } + + Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArray, anAspect); + VDisplayAISObject (aName, aPObject); + + return 0; +} + //======================================================================= //function : ObjectsCommands //purpose : @@ -4722,4 +4859,8 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands) "- turns on/off drawing of face boundaries for ais object " "and defines boundary line style.", __FILE__, VShowFaceBoundary, group); + + theCommands.Add ("vmarkerstest", + "vmarkerstest: name X Y Z [PointsOnSide=10] [MarkerType=0] [Scale=1.0] [FileName=ImageFile]\n", + __FILE__, VMarkersTest, group); } diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 28eb5594b6..f25c460968 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -3850,6 +3850,54 @@ static int VVbo (Draw_Interpretor& theDI, return 0; } +//============================================================================== +//function : VCaps +//purpose : +//============================================================================== + +static int VCaps (Draw_Interpretor& theDI, + Standard_Integer theArgNb, + const char** theArgVec) +{ + OpenGl_Caps* aCaps = &ViewerTest_myDefaultCaps; + Handle(OpenGl_GraphicDriver) aDriver; + Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext(); + if (!aContextAIS.IsNull()) + { + aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver()); + aCaps = &aDriver->ChangeOptions(); + } + + if (theArgNb < 2) + { + theDI << "VBO: " << (aCaps->vboDisable ? "0" : "1") << "\n"; + theDI << "Sprites: " << (aCaps->pntSpritesDisable ? "0" : "1") << "\n"; + return 0; + } + + for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter) + { + const TCollection_AsciiString anArg (theArgVec[anArgIter]); + if (anArg.Search ("vbo=") > -1) + { + aCaps->vboDisable = anArg.Token ("=", 2).IntegerValue() == 0; + } + else if (anArg.Search ("sprites=") > -1) + { + aCaps->pntSpritesDisable = anArg.Token ("=", 2).IntegerValue() == 0; + } + else + { + std::cerr << "Unknown argument: " << anArg << "\n"; + } + } + if (aCaps != &ViewerTest_myDefaultCaps) + { + ViewerTest_myDefaultCaps = *aCaps; + } + return 0; +} + //============================================================================== //function : VMemGpu //purpose : @@ -4903,6 +4951,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) theCommands.Add ("vvbo", "vvbo [{0|1}] : turn VBO usage On/Off; affects only newly displayed objects", __FILE__, VVbo, group); + theCommands.Add ("vcaps", + "vcaps [vbo={0|1}] [sprites={0|1}] : modify particular graphic driver options", + __FILE__, VCaps, group); theCommands.Add ("vmemgpu", "vmemgpu [f]: print system-dependent GPU memory information if available;" " with f option returns free memory in bytes", diff --git a/tests/bugs/vis/bug24131_markers b/tests/bugs/vis/bug24131_markers new file mode 100644 index 0000000000..8a96391ec8 --- /dev/null +++ b/tests/bugs/vis/bug24131_markers @@ -0,0 +1,72 @@ +puts "========" +puts "OCC24131 Markers using Point Sprites" +puts "========" + +# reflects Aspect_TypeOfMarker enumeration +set aMarkerTypeNames { + Aspect_TOM_POINT + Aspect_TOM_PLUS + Aspect_TOM_STAR + Aspect_TOM_X + Aspect_TOM_O + Aspect_TOM_O_POINT + Aspect_TOM_O_PLUS + Aspect_TOM_O_STAR + Aspect_TOM_O_X + Aspect_TOM_RING1 + Aspect_TOM_RING2 + Aspect_TOM_RING3 + Aspect_TOM_BALL + Aspect_TOM_USERDEFINED +} + +# generate custom marker +set aCustom1 $imagedir/${casename}_m1.png +set aCustom2 $imagedir/${casename}_m2.png +box b 1 1 1 +vinit name=Driver0/Viewer1/View1 l=32 t=32 w=512 h=512 +vclear +vdisplay b +vaxo +vfit +vdump $aCustom1 rgba 32 32 +vsetdispmode b 1 +vsetcolor b RED +vrotate 1 0 0 +vdump $aCustom2 rgba 32 32 + +# draw box in advance which should fit all our markers +box b -8 -8 0 16 16 2 +puts "hI" +for { set aMode 0 } { $aMode <= 1 } { incr aMode } { + set aTitle "bitmaps" + if { $aMode == 1 } { set aTitle "sprites" } + vcaps sprites=$aMode + set aV "Driver${aMode}/Viewer1/View1" + vinit name=$aV l=32 t=32 w=512 h=512 + vactivate $aV + vclear + + vbottom + vdisplay b + vfit + verase b + + for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } { + set aRow [expr $aMarkerType - 7] + set aCol 5 + set aName [lindex $aMarkerTypeNames $aMarkerType] + vdrawtext "$aName" 0 [expr $aRow + 0.5] 0 128 255 255 1 1 000 0 12 2 Arial + if { $aMarkerType == 13 } { + vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1 + set aCol [expr $aCol - 1] + vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom2 + } else { + for { set aMarkerScale 1.0 } { $aMarkerScale <= 7 } { set aMarkerScale [expr $aMarkerScale + 0.5] } { + vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 MarkerType=$aMarkerType Scale=$aMarkerScale PointsOnSide=1 + set aCol [expr $aCol - 1] + } + } + } + vdump $imagedir/${casename}_${aTitle}.png +} -- 2.20.1