Stellarium 0.12.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · File Structure

StelCircleArcRenderer Class Reference

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

#include <StelCircleArcRenderer.hpp>

List of all members.

Public Member Functions

 StelCircleArcRenderer (StelRenderer *renderer, StelProjectorP projector)
 Construct a StelCircleArcRenderer using specified renderer.
 StelCircleArcRenderer (StelRenderer *renderer, StelProjector *projector)
 Construct a StelCircleArcRenderer using specified renderer.
 ~StelCircleArcRenderer ()
 Destroy the StelCircleArcRenderer, freeing any vertex buffers.
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.
void drawGreatCircleArcs (const QVector< Vec3d > &points, const PrimitiveType primitiveType, const SphericalCap *clippingCap)
 Draw a series of great circle arcs between specified points.
void setRotCenter (const Vec3d center)
 Set rotation point to draw a small circle around.
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.

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:
renderer Renderer to create adn draw vertex buffers.
projector Projector to project 3D coordinates to the screen.

Definition at line 35 of file StelCircleArcRenderer.hpp.

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

Construct a StelCircleArcRenderer using specified renderer.

Parameters:
renderer Renderer to create adn draw vertex buffers.
projector Projector to project 3D coordinates to the screen.

Definition at line 46 of file StelCircleArcRenderer.hpp.

StelCircleArcRenderer::~StelCircleArcRenderer (  )  [inline]

Destroy the StelCircleArcRenderer, freeing any vertex buffers.

Definition at line 54 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:
start Start point of the arc.
stop End point of the arc.
clippingCap if not NULL, try to clip part of the arc outside the cap.
viewportEdgeIntersectCallback Callback called on intersection with viewportEdge.
userData User-defined data passed to viewportEdgeIntersectCallback.

Definition at line 77 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:
points Points to use to draw the arcs.
primitiveType Determines how the points to draw arcs between are chosen (see above). Must be PrimitiveType_Lines, PrimitiveType_LineStrip or PrimitiveType_LineLoop.
clippingCap If not NULL, try to clip the parts of the arcs outside the cap.

Definition at line 118 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:
start Start point of the arc.
stop End point of the arc.
viewportEdgeIntersectCallback Callback called on intersection with viewportEdge.
userData User-defined data passed to viewportEdgeIntersectCallback.

Definition at line 176 of file StelCircleArcRenderer.hpp.

void StelCircleArcRenderer::setRotCenter ( const Vec3d  center  )  [inline]

Set rotation point to draw a small circle around.

Definition at line 151 of file StelCircleArcRenderer.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Jan 31 14:05:45 2013 for Stellarium by  doxygen 1.6.3