Kstars

skyglpainter.h
1 /*
2  SPDX-FileCopyrightText: 2010 Henry de Valence <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef SKYGLPAINTER_H
8 #define SKYGLPAINTER_H
9 
10 #include <cstddef>
11 #include <Eigen/Core>
12 
13 #include "skypainter.h"
14 #include "skyobjects/skyobject.h"
15 #include "projections/projector.h"
16 
17 class QGLWidget;
18 
19 class SkyGLPainter : public SkyPainter
20 {
21  public:
22  explicit SkyGLPainter(QGLWidget *widget);
23  bool drawPlanet(KSPlanetBase *planet) override;
24  bool drawPointSource(const SkyPoint *loc, float mag, char sp = 'A') override;
25  void drawSkyPolygon(LineList *list, bool forceClip = true) override;
26  void drawSkyPolyline(LineList *list, SkipHashList *skipList = nullptr,
27  LineListLabel *label = nullptr) override;
28  void drawSkyLine(SkyPoint *a, SkyPoint *b) override;
29  void drawSkyBackground() override;
30  void drawObservingList(const QList<SkyObject *> &obs) override;
31  void drawFlags() override;
32  void end() override;
33  void begin() override;
34  void setBrush(const QBrush &brush) override;
35  void setPen(const QPen &pen) override;
36  void drawHorizon(bool filled, SkyPoint *labelPoint = nullptr,
37  bool *drawLabel = nullptr) override;
38  bool drawSatellite(Satellite *sat) override;
39  bool drawSupernova(Supernova *sup) override;
40  void drawText(int x, int y, const QString text, QFont font, QColor color);
41  bool drawConstellationArtImage(ConstellationsArt *obj) override;
42  bool drawHips(bool useCache = false) override;
43 
44  private:
45  bool addItem(SkyPoint *p, int type, float width, char sp = 'a');
46  void drawBuffer(int type);
47  void drawPolygon(const QVector<Eigen::Vector2f> &poly, bool convex = true,
48  bool flush_buffers = true);
49 
50  /** Render textured rectangle on screeen. Parameters are texture
51  * to be used, position, orientation and size of rectangle*/
52  void drawTexturedRectangle(const QImage &img, const Eigen::Vector2f &pos, const float angle,
53  const float sizeX, const float sizeY);
54 
55  const Projector *m_proj;
56 
57  Eigen::Vector4f m_pen;
58  static const int BUFSIZE = 512;
59  ///FIXME: what kind of TYPE_UNKNOWN objects are there?
60  static const int NUMTYPES = (int)SkyObject::TYPE_UNKNOWN + 1;
61  static Eigen::Vector2f m_vertex[NUMTYPES][6 * BUFSIZE];
62  static Eigen::Vector2f m_texcoord[NUMTYPES][6 * BUFSIZE];
63  static Eigen::Vector3f m_color[NUMTYPES][6 * BUFSIZE];
64  static int m_idx[NUMTYPES];
65  static bool m_init; ///< keep track of whether we have filled the texcoord array
66  QGLWidget *m_widget; // Pointer to (GL) widget on which we are painting
67 };
68 
69 #endif // SKYGLPAINTER_H
virtual bool drawSupernova(Supernova *sup)=0
Draw a Supernova.
virtual void end()=0
End and finalize painting.
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
virtual void setPen(const QPen &pen)=0
Set the pen of the painter.
virtual bool drawSatellite(Satellite *sat)=0
Draw a satellite.
virtual bool drawHips(bool useCache=false)=0
drawMosaicPanel Draws mosaic panel in planning or operation mode.
virtual void drawSkyLine(SkyPoint *a, SkyPoint *b)=0
Draw a line between points in the sky.
virtual bool drawPointSource(const SkyPoint *loc, float mag, char sp='A')=0
Draw a point source (e.g., a star).
virtual void setBrush(const QBrush &brush)=0
Set the brush of the painter.
Draws things on the sky, without regard to backend.
Definition: skypainter.h:37
virtual void drawSkyPolygon(LineList *list, bool forceClip=true)=0
Draw a polygon in the sky.
virtual void drawSkyBackground()=0
Draw the sky background.
virtual void begin()=0
Begin painting.
virtual void drawObservingList(const QList< SkyObject * > &obs)=0
Draw the symbols for the observing list.
virtual void drawFlags()=0
Draw flags.
virtual void drawSkyPolyline(LineList *list, SkipHashList *skipList=nullptr, LineListLabel *label=nullptr)=0
Draw a polyline in the sky.
Information about a ConstellationsArt object. This class represents a constellation image.
virtual bool drawConstellationArtImage(ConstellationsArt *obj)=0
Draw a ConstellationsArt object.
virtual bool drawPlanet(KSPlanetBase *planet)=0
Draw a planet.
Provides necessary information about objects in the solar system.
Definition: ksplanetbase.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 03:57:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.