Stellarium 0.12.3
List of all members | Public Member Functions
StelCircleArcRenderer Class Reference

Provides functions to draw circle arcs using StelRenderer. More...

#include <StelCircleArcRenderer.hpp>

Public Member Functions

 StelCircleArcRenderer (StelRenderer *renderer, StelProjectorP projector)
 Construct a StelCircleArcRenderer using specified renderer. More...
 
 StelCircleArcRenderer (StelRenderer *renderer, StelProjector *projector)
 Construct a StelCircleArcRenderer using specified renderer. More...
 
 ~StelCircleArcRenderer ()
 Destroy the StelCircleArcRenderer, freeing any vertex buffers. More...
 
void drawGreatCircleArc (const Vec3d &start, const Vec3d &stop, const SphericalCap *clippingCap=NULL, void(*viewportEdgeIntersectCallback)(const Vec3d &screenPos, const Vec3d &direction, void *userData)=NULL, void *userData=NULL)
 Draw a great circle arc between points start and stop. More...
 
void drawGreatCircleArcs (const QVector< Vec3d > &points, const PrimitiveType primitiveType, const SphericalCap *clippingCap)
 Draw a series of great circle arcs between specified points. More...
 
void setRotCenter (const Vec3d center)
 Set rotation point to draw a small circle around. More...
 
void drawSmallCircleArc (const Vec3d &start, const Vec3d &stop, void(*viewportEdgeIntersectCallback)(const Vec3d &screenPos, const Vec3d &direction, void *userData), void *userData)
 Draw a small circle arc between points start and stop. More...
 

Detailed Description

Provides functions to draw circle arcs using StelRenderer.

Performance could be improved if drawXXXCircleArc returned a list of vertex buffers to draw (perhaps generateXXXCircleArc), which could be cached as long as the StelProjector used is not modified. This would require a way to track the last update when StelProjector was modified.

Example:

// Drawing a single great circle arc
StelCircleArcRenderer(renderer, projector)
.drawGreatCircleArc(star1, star2, &viewportHalfspace);
// Create a circle arc renderer to draw multiple circle arcs
StelCircleArcRenderer circleArcRenderer = StelCircleArcRenderer(renderer, projector);
circleArcRenderer.drawGreatCircleArc(star1, star2, &viewportHalfspace);
circleArcRenderer.drawGreatCircleArc(star3, star4, &viewportHalfspace);

Definition at line 51 of file StelCircleArcRenderer.hpp.

Constructor & Destructor Documentation

StelCircleArcRenderer::StelCircleArcRenderer ( StelRenderer renderer,
StelProjectorP  projector 
)
inline

Construct a StelCircleArcRenderer using specified renderer.

Parameters
rendererRenderer to create adn draw vertex buffers.
projectorProjector to project 3D coordinates to the screen.

Definition at line 58 of file StelCircleArcRenderer.hpp.

StelCircleArcRenderer::StelCircleArcRenderer ( StelRenderer renderer,
StelProjector projector 
)
inline

Construct a StelCircleArcRenderer using specified renderer.

Parameters
rendererRenderer to create adn draw vertex buffers.
projectorProjector to project 3D coordinates to the screen.

Definition at line 69 of file StelCircleArcRenderer.hpp.

StelCircleArcRenderer::~StelCircleArcRenderer ( )
inline

Destroy the StelCircleArcRenderer, freeing any vertex buffers.

Definition at line 77 of file StelCircleArcRenderer.hpp.

Member Function Documentation

void StelCircleArcRenderer::drawGreatCircleArc ( const Vec3d start,
const Vec3d stop,
const SphericalCap clippingCap = NULL,
void(*)(const Vec3d &screenPos, const Vec3d &direction, void *userData)  viewportEdgeIntersectCallback = NULL,
void *  userData = NULL 
)
inline

Draw a great circle arc between points start and stop.

The angle between start and stop must be < 180 deg.

The line will look smooth, even for non linear distortion. Each time the small circle crosses the edge of the viewport, viewportEdgeIntersectCallback is called with the screen 2d position of the intersection, normalized direction of the currently drawn arc toward the inside of the viewport, and any extra user specified data.

Parameters
startStart point of the arc.
stopEnd point of the arc.
clippingCapif not NULL, try to clip part of the arc outside the cap.
viewportEdgeIntersectCallbackCallback called on intersection with viewportEdge.
userDataUser-defined data passed to viewportEdgeIntersectCallback.

Definition at line 100 of file StelCircleArcRenderer.hpp.

void StelCircleArcRenderer::drawGreatCircleArcs ( const QVector< Vec3d > &  points,
const PrimitiveType  primitiveType,
const SphericalCap clippingCap 
)
inline

Draw a series of great circle arcs between specified points.

primitiveType specifies how to interpret the points.

If primitiveType is PrimitiveType_Lines, the arcs are drawn between the first and the second point, third and fourth, and so on. In this case, the number of points must be divisible by 2.

If primitiveType is PrimitiveType_LineStrip, the arcs are drawn between the first and the second point, second and third, third and fourth, and so on.

If primitiveType is PrimitiveType_LineLoop, the arcs are drawn like with PrimitiveType_LineStrip, but there is also an arc between the last and the first point.

The angle between two points of any arc must be < 180 deg.

Parameters
pointsPoints to use to draw the arcs.
primitiveTypeDetermines how the points to draw arcs between are chosen (see above). Must be PrimitiveType_Lines, PrimitiveType_LineStrip or PrimitiveType_LineLoop.
clippingCapIf not NULL, try to clip the parts of the arcs outside the cap.

Definition at line 141 of file StelCircleArcRenderer.hpp.

void StelCircleArcRenderer::drawSmallCircleArc ( const Vec3d start,
const Vec3d stop,
void(*)(const Vec3d &screenPos, const Vec3d &direction, void *userData)  viewportEdgeIntersectCallback,
void *  userData 
)
inline

Draw a small circle arc between points start and stop.

The rotation point is set by setRotCenter().

The angle between start and stop must be < 180 deg. The line will look smooth, even for non linear distortion. Each time the small circle crosses the edge of the viewport, viewportEdgeIntersectCallback is called with the screen 2d position of the intersection, normalized direction of the currently drawn arc toward the inside of the viewport, and any extra user specified data.

If rotCenter is (0,0,0), the method draws a great circle.

Parameters
startStart point of the arc.
stopEnd point of the arc.
viewportEdgeIntersectCallbackCallback called on intersection with viewportEdge.
userDataUser-defined data passed to viewportEdgeIntersectCallback.

Definition at line 199 of file StelCircleArcRenderer.hpp.

void StelCircleArcRenderer::setRotCenter ( const Vec3d  center)
inline

Set rotation point to draw a small circle around.

Definition at line 174 of file StelCircleArcRenderer.hpp.


The documentation for this class was generated from the following file: