1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00
occt/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp
kgv a577aaabf9 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.
2013-09-05 13:23:03 +04:00

59 lines
2.3 KiB
C++
Executable File

#include "stdafx.h"
#include "Sample2D_Markers.h"
IMPLEMENT_STANDARD_HANDLE(Sample2D_Markers,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Markers,AIS_InteractiveObject)
// generic marker
Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
const Quantity_Length theYPosition ,
const Aspect_TypeOfMarker theMarkerType,
const Quantity_Color theColor,
const Standard_Real theScaleOrId)
:AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (1))
{
myXPosition = theXPosition;
myYPosition = theYPosition;
myMarkerType = theMarkerType;
myColor = theColor;
myIndex = theScaleOrId;
}
Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
const Quantity_Length theYPosition ,
const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints,
const Aspect_TypeOfMarker theMarkerType,
const Quantity_Color theColor,
const Standard_Real theScaleOrId)
:AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (6))
{
myXPosition = theXPosition;
myYPosition = theYPosition;
myMarkerType = theMarkerType;
myColor = theColor;
myIndex = theScaleOrId;
myArrayOfPoints = theArrayOfPoints;
}
void Sample2D_Markers::Compute ( const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
if(myMarkerType == Aspect_TOM_USERDEFINED)
{
Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(Aspect_TOM_POINT,myColor,myIndex);
Prs3d_Root::CurrentGroup(aPresentation)->SetGroupPrimitivesAspect(aMarker);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (myArrayOfPoints);
}
else
{
Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex);
aPresentation->SetPrimitivesAspect(aMarker);
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
}