00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELPAINTER_HPP_
00021 #define _STELPAINTER_HPP_
00022
00023 #include "GLee.h"
00024 #include "fixx11h.h"
00025 #include "VecMath.hpp"
00026 #include "StelSphereGeometry.hpp"
00027 #include "StelProjectorType.hpp"
00028 #include "StelProjector.hpp"
00029 #include <QString>
00030
00031 class StelFont;
00032
00039
00040 class StelPainter
00041 {
00042 public:
00043
00044 explicit StelPainter(const StelProjectorP& prj);
00045 ~StelPainter();
00046
00048 const StelProjectorP getProjector() const {return prj;}
00049
00051 void drawViewportShape(void) const;
00052
00055 void drawVertex3v(const Vec3d& v) const
00056 {
00057 Vec3d win;
00058 prj->project(v, win);
00059 glVertex3dv(win);
00060 }
00063 void drawVertex3(double x, double y, double z) const {drawVertex3v(Vec3d(x, y, z));}
00064
00075 void drawText(const StelFont* font, float x, float y, const QString& str, float angleDeg=0.f,
00076 float xshift=0.f, float yshift=0.f, bool noGravity=true) const;
00077
00080 void drawPolygon(const StelGeom::Polygon& poly) const;
00081
00087 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;
00088
00090 void drawCircle(double x,double y,double r) const;
00091
00096 void drawSprite2dMode(double x, double y, double size) const;
00097
00103 void drawSprite2dMode(double x, double y, double size, double rotation) const;
00104
00111 void drawRectSprite2dMode(double x, double y, double sizex, double sizey, double rotation) const;
00112
00116 void drawPoint2d(double x, double y) const;
00117
00119 void sSphere(GLdouble radius, GLdouble oneMinusOblateness,
00120 GLint slices, GLint stacks, int orientInside = 0) const;
00121
00123 void sCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks, int orientInside = 0) const;
00124
00131 void sFanDisk(double radius,int innerFanSlices,int level) const;
00132
00138 void sDisk(GLdouble radius, GLint slices, GLint stacks, int orientInside = 0) const;
00139
00141 void sRing(GLdouble rMin, GLdouble rMax, GLint slices, GLint stacks, int orientInside) const;
00142
00144 void sSphereMap(GLdouble radius, GLint slices, GLint stacks,
00145 double textureFov = 2.*M_PI, int orientInside = 0) const;
00146
00149 static void initSystemGLInfo();
00150
00151 private:
00152
00155 void switchToNativeOpenGLPainting();
00156
00158 void revertToQtPainting();
00159
00160 void drawTextGravity180(const StelFont* font, float x, float y, const QString& str,
00161 bool speedOptimize = 1, float xshift = 0, float yshift = 0) const;
00162
00164 void initGlMatrixOrtho2d(void) const;
00165
00167 const StelProjectorP prj;
00168
00170 static bool flagGlPointSprite;
00171
00173 static class QMutex* globalMutex;
00174 };
00175
00176 #endif // _STELPAINTER_HPP_
00177