![]() |
Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure |
#include <StelPainter.hpp>
Public Member Functions | |
StelPainter (const StelProjectorP &prj) | |
const StelProjectorP | getProjector () const |
void | drawViewportShape (void) const |
void | drawVertex3v (const Vec3d &v) const |
void | drawVertex3 (double x, double y, double z) const |
void | drawText (const StelFont *font, float x, float y, const QString &str, float angleDeg=0.f, float xshift=0.f, float yshift=0.f, bool noGravity=true) const |
void | drawPolygon (const StelGeom::Polygon &poly) const |
void | drawSmallCircleArc (const Vec3d &start, const Vec3d &stop, const Vec3d &rotCenter, void(*viewportEdgeIntersectCallback)(const Vec3d &screenPos, const Vec3d &direction, const void *userData)=NULL, const void *userData=NULL) const |
void | drawCircle (double x, double y, double r) const |
void | drawSprite2dMode (double x, double y, double size) const |
void | drawSprite2dMode (double x, double y, double size, double rotation) const |
void | drawRectSprite2dMode (double x, double y, double sizex, double sizey, double rotation) const |
void | drawPoint2d (double x, double y) const |
void | sSphere (GLdouble radius, GLdouble oneMinusOblateness, GLint slices, GLint stacks, int orientInside=0) const |
void | sCylinder (GLdouble radius, GLdouble height, GLint slices, GLint stacks, int orientInside=0) const |
void | sFanDisk (double radius, int innerFanSlices, int level) const |
void | sDisk (GLdouble radius, GLint slices, GLint stacks, int orientInside=0) const |
void | sRing (GLdouble rMin, GLdouble rMax, GLint slices, GLint stacks, int orientInside) const |
void | sSphereMap (GLdouble radius, GLint slices, GLint stacks, double textureFov=2.*M_PI, int orientInside=0) const |
Static Public Member Functions | |
static void | initSystemGLInfo () |
All coordinates are converted using the StelProjector instance passed at construction. Because openGL is not thread safe, only one instance of StelPainter can exist at a time, enforcing thread safety. As a coding rule, no openGL calls should be performed when no instance of StelPainter exist. Typical usage is to create a local instance of StelPainter where drawing operations are needed.
const StelProjectorP StelPainter::getProjector | ( | ) | const [inline] |
Return the instance of projector associated to this painter.
void StelPainter::drawViewportShape | ( | void | ) | const |
Fill with black around the viewport.
void StelPainter::drawVertex3v | ( | const Vec3d & | v | ) | const [inline] |
Generalisation of glVertex3v for non-linear projections.
This method does not manage the lighting operations properly.
void StelPainter::drawVertex3 | ( | double | x, | |
double | y, | |||
double | z | |||
) | const [inline] |
void StelPainter::drawText | ( | const StelFont * | font, | |
float | x, | |||
float | y, | |||
const QString & | str, | |||
float | angleDeg = 0.f , |
|||
float | xshift = 0.f , |
|||
float | yshift = 0.f , |
|||
bool | noGravity = true | |||
) | const |
Draw the string at the given position and angle with the given font.
If the gravity label flag is set, uses drawTextGravity180.
font | the font to use for display | |
x | horizontal position of the lower left corner of the first character of the text in pixel. | |
y | horizontal position of the lower left corner of the first character of the text in pixel. | |
str | the text to print. | |
angleDeg | rotation angle in degree. Rotation is around x,y. | |
xshift | shift in pixel in the rotated x direction. | |
yshift | shift in pixel in the rotated y direction. | |
noGravity | don't take into account the fact that the text should be written with gravity. |
void StelPainter::drawPolygon | ( | const StelGeom::Polygon & | poly | ) | const |
Draw the given polygon.
poly | The polygon to draw |
void StelPainter::drawSmallCircleArc | ( | const Vec3d & | start, | |
const Vec3d & | stop, | |||
const Vec3d & | rotCenter, | |||
void(*)(const Vec3d &screenPos, const Vec3d &direction, const void *userData) | viewportEdgeIntersectCallback = NULL , |
|||
const void * | userData = NULL | |||
) | const |
Draw a small circle arc between points start and stop with rotation point in rotCenter.
The angle between start and stop must be < 180 deg. Each time the small circle crosses the edge of the viewport, the viewportEdgeIntersectCallback is called with the screen 2d position, direction of the currently drawn arc toward the inside of the viewport. If rotCenter is equal to 0,0,0, the method draws a great circle.
void StelPainter::drawCircle | ( | double | x, | |
double | y, | |||
double | r | |||
) | const |
Draw a simple circle, 2d viewport coordinates in pixel.
void StelPainter::drawSprite2dMode | ( | double | x, | |
double | y, | |||
double | size | |||
) | const |
Draw a square using the current texture at the given projected 2d position.
x | x position in the viewport in pixel. | |
y | y position in the viewport in pixel. | |
size | the size of a square side in pixel. |
void StelPainter::drawSprite2dMode | ( | double | x, | |
double | y, | |||
double | size, | |||
double | rotation | |||
) | const |
Draw a rotated square using the current texture at the given projected 2d position.
x | x position in the viewport in pixel. | |
y | y position in the viewport in pixel. | |
size | the size of a square side in pixel. | |
rotation | rotation angle in degree. |
void StelPainter::drawRectSprite2dMode | ( | double | x, | |
double | y, | |||
double | sizex, | |||
double | sizey, | |||
double | rotation | |||
) | const |
Draw a rotated rectangle using the current texture at the given projected 2d position.
x | x position in the viewport in pixel. | |
y | y position in the viewport in pixel. | |
sizex | the size of the rectangle x side in pixel. | |
sizey | the size of the rectangle y side in pixel. | |
rotation | rotation angle in degree. |
void StelPainter::drawPoint2d | ( | double | x, | |
double | y | |||
) | const |
Draw a GL_POINT at the given position.
x | x position in the viewport in pixels. | |
y | y position in the viewport in pixels. |
void StelPainter::sSphere | ( | GLdouble | radius, | |
GLdouble | oneMinusOblateness, | |||
GLint | slices, | |||
GLint | stacks, | |||
int | orientInside = 0 | |||
) | const |
Re-implementation of gluSphere : glu is overridden for non-standard projection.
void StelPainter::sCylinder | ( | GLdouble | radius, | |
GLdouble | height, | |||
GLint | slices, | |||
GLint | stacks, | |||
int | orientInside = 0 | |||
) | const |
Re-implementation of gluCylinder : glu is overridden for non-standard projection.
void StelPainter::sFanDisk | ( | double | radius, | |
int | innerFanSlices, | |||
int | level | |||
) | const |
Draw a disk with a special texturing mode having texture center at center of disk.
The disk is made up of concentric circles with increasing refinement. The number of slices of the outmost circle is (innerFanSlices<<level).
radius | the radius of the disk. | |
innerFanSlices | the number of slices. | |
level | the numbe of concentric circles. |
void StelPainter::sDisk | ( | GLdouble | radius, | |
GLint | slices, | |||
GLint | stacks, | |||
int | orientInside = 0 | |||
) | const |
Draw a disk with a special texturing mode having texture center at center.
radius | the radius of the disk. | |
slices | the number of slices. | |
stacks | ??? | |
orientInside | ??? |
void StelPainter::sRing | ( | GLdouble | rMin, | |
GLdouble | rMax, | |||
GLint | slices, | |||
GLint | stacks, | |||
int | orientInside | |||
) | const |
Draw a ring with a radial texturing.
void StelPainter::sSphereMap | ( | GLdouble | radius, | |
GLint | slices, | |||
GLint | stacks, | |||
double | textureFov = 2.*M_PI , |
|||
int | orientInside = 0 | |||
) | const |
Draw a fisheye texture in a sphere.
static void StelPainter::initSystemGLInfo | ( | ) | [static] |
Get some informations about the OS openGL capacities.
This method needs to be called once at init