2001-11-27 18:50:04 -07:00
|
|
|
// render.h
|
|
|
|
//
|
2008-04-03 11:46:45 -06:00
|
|
|
// Copyright (C) 2001-2008, Celestia Development Team
|
2007-12-17 18:54:17 -07:00
|
|
|
// Contact: Chris Laurel <claurel@gmail.com>
|
2001-11-27 18:50:04 -07:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
2021-11-27 07:29:08 -07:00
|
|
|
#pragma once
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2019-12-01 05:32:10 -07:00
|
|
|
#include <list>
|
2019-11-29 03:53:38 -07:00
|
|
|
#include <memory>
|
2019-12-01 05:32:10 -07:00
|
|
|
#include <string>
|
2019-11-29 03:53:38 -07:00
|
|
|
#include <vector>
|
2021-11-27 07:29:08 -07:00
|
|
|
|
2009-10-27 16:02:01 -06:00
|
|
|
#include <Eigen/Core>
|
2021-11-27 07:29:08 -07:00
|
|
|
|
2002-01-07 15:48:32 -07:00
|
|
|
#include <celengine/universe.h>
|
2001-11-27 18:50:04 -07:00
|
|
|
#include <celengine/selection.h>
|
2004-09-19 21:27:50 -06:00
|
|
|
#include <celengine/starcolors.h>
|
2005-02-10 23:09:37 -07:00
|
|
|
#include <celengine/rendcontext.h>
|
2019-12-01 05:32:10 -07:00
|
|
|
#include <celengine/renderlistentry.h>
|
2020-03-14 04:48:24 -06:00
|
|
|
#include "vertexobject.h"
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2019-12-18 11:56:34 -07:00
|
|
|
#ifdef USE_GLCONTEXT
|
|
|
|
class GLContext;
|
|
|
|
#endif
|
2008-01-19 15:21:56 -07:00
|
|
|
class RendererWatcher;
|
2008-02-20 19:25:48 -07:00
|
|
|
class FrameTree;
|
2008-03-20 15:36:17 -06:00
|
|
|
class ReferenceMark;
|
2009-08-06 21:15:26 -06:00
|
|
|
class CurvePlot;
|
2019-12-01 05:32:10 -07:00
|
|
|
class PointStarVertexBuffer;
|
2019-12-03 04:11:10 -07:00
|
|
|
class AsterismRenderer;
|
2019-12-03 04:46:48 -07:00
|
|
|
class BoundariesRenderer;
|
2019-12-18 11:56:34 -07:00
|
|
|
class Observer;
|
|
|
|
class TextureFont;
|
2019-11-29 03:53:38 -07:00
|
|
|
class FramebufferObject;
|
2021-05-22 01:10:05 -06:00
|
|
|
|
|
|
|
namespace celestia
|
|
|
|
{
|
|
|
|
class Rect;
|
|
|
|
}
|
|
|
|
|
2019-12-18 11:56:34 -07:00
|
|
|
namespace celmath
|
|
|
|
{
|
|
|
|
class Frustum;
|
2020-03-29 01:35:03 -06:00
|
|
|
}
|
2008-01-19 15:21:56 -07:00
|
|
|
|
2020-05-12 09:51:25 -06:00
|
|
|
struct Matrices
|
|
|
|
{
|
2020-09-29 20:27:22 -06:00
|
|
|
const Eigen::Matrix4f *projection;
|
|
|
|
const Eigen::Matrix4f *modelview;
|
2020-05-12 09:51:25 -06:00
|
|
|
};
|
|
|
|
|
2020-12-05 02:56:43 -07:00
|
|
|
struct LineStripEnd
|
|
|
|
{
|
|
|
|
LineStripEnd(Eigen::Vector3f point, float scale) : point(point), scale(scale) {};
|
|
|
|
Eigen::Vector3f point;
|
|
|
|
float scale;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LineEnds
|
|
|
|
{
|
|
|
|
LineEnds(Eigen::Vector3f point1, Eigen::Vector3f point2, float scale) : point1(point1), point2(point2), scale(scale) {};
|
|
|
|
Eigen::Vector3f point1;
|
|
|
|
Eigen::Vector3f point2;
|
|
|
|
float scale;
|
|
|
|
};
|
|
|
|
|
2007-12-17 18:54:17 -07:00
|
|
|
struct LightSource
|
|
|
|
{
|
2009-07-17 23:50:56 -06:00
|
|
|
Eigen::Vector3d position;
|
2007-12-17 18:54:17 -07:00
|
|
|
Color color;
|
|
|
|
float luminosity;
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-04-03 11:46:45 -06:00
|
|
|
struct SecondaryIlluminator
|
|
|
|
{
|
2009-07-17 23:50:56 -06:00
|
|
|
const Body* body;
|
|
|
|
Eigen::Vector3d position_v; // viewer relative position
|
|
|
|
float radius; // radius in km
|
|
|
|
float reflectedIrradiance; // albedo times total irradiance from direct sources
|
2002-11-03 21:14:07 -07:00
|
|
|
};
|
|
|
|
|
2004-10-19 11:52:43 -06:00
|
|
|
|
2020-03-14 04:48:24 -06:00
|
|
|
enum class VOType
|
|
|
|
{
|
|
|
|
Marker = 0,
|
|
|
|
AxisArrow = 1,
|
|
|
|
Rectangle = 2,
|
|
|
|
Terminator = 3,
|
2020-10-02 03:00:00 -06:00
|
|
|
LargeStar = 4,
|
2020-12-05 02:56:43 -07:00
|
|
|
AxisLetter = 5,
|
|
|
|
MarkerLine = 6,
|
|
|
|
Ecliptic = 7,
|
|
|
|
Count = 8,
|
2020-03-14 04:48:24 -06:00
|
|
|
};
|
|
|
|
|
2020-05-12 09:51:25 -06:00
|
|
|
enum class RenderMode
|
|
|
|
{
|
|
|
|
Fill = 0,
|
|
|
|
Line = 1
|
|
|
|
};
|
2020-03-14 04:48:24 -06:00
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
class Renderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Renderer();
|
|
|
|
~Renderer();
|
2004-03-15 11:51:16 -07:00
|
|
|
|
|
|
|
struct DetailOptions
|
|
|
|
{
|
|
|
|
DetailOptions();
|
|
|
|
unsigned int orbitPathSamplePoints;
|
|
|
|
unsigned int shadowTextureSize;
|
|
|
|
unsigned int eclipseTextureSize;
|
2017-03-04 07:05:41 -07:00
|
|
|
double orbitWindowEnd;
|
|
|
|
double orbitPeriodsShown;
|
|
|
|
double linearFadeFraction;
|
2004-03-15 11:51:16 -07:00
|
|
|
};
|
|
|
|
|
2020-10-02 03:00:00 -06:00
|
|
|
enum class ProjectionMode
|
|
|
|
{
|
|
|
|
PerspectiveMode = 0,
|
|
|
|
FisheyeMode = 1
|
|
|
|
};
|
|
|
|
|
2019-06-18 05:20:01 -06:00
|
|
|
#ifdef USE_GLCONTEXT
|
2004-03-15 11:51:16 -07:00
|
|
|
bool init(GLContext*, int, int, DetailOptions&);
|
2019-06-18 05:20:01 -06:00
|
|
|
#else
|
|
|
|
bool init(int, int, DetailOptions&);
|
|
|
|
#endif
|
2001-11-27 18:50:04 -07:00
|
|
|
void shutdown() {};
|
|
|
|
void resize(int, int);
|
2019-11-07 14:55:23 -07:00
|
|
|
float getAspectRatio() const;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2018-09-22 07:13:49 -06:00
|
|
|
float calcPixelSize(float fovY, float windowHeight);
|
2002-12-11 13:27:35 -07:00
|
|
|
void setFaintestAM45deg(float);
|
2008-05-01 16:25:20 -06:00
|
|
|
float getFaintestAM45deg() const;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2020-05-12 09:51:25 -06:00
|
|
|
void setRenderMode(RenderMode);
|
2002-09-22 08:51:35 -06:00
|
|
|
void autoMag(float& faintestMag);
|
2001-11-27 18:50:04 -07:00
|
|
|
void render(const Observer&,
|
2002-01-07 15:48:32 -07:00
|
|
|
const Universe&,
|
2001-11-27 18:50:04 -07:00
|
|
|
float faintestVisible,
|
2003-02-21 23:49:37 -07:00
|
|
|
const Selection& sel);
|
2008-03-24 18:23:16 -06:00
|
|
|
void draw(const Observer&,
|
|
|
|
const Universe&,
|
|
|
|
float faintestVisible,
|
|
|
|
const Selection& sel);
|
|
|
|
|
2019-05-25 12:39:46 -06:00
|
|
|
bool getInfo(std::map<std::string, std::string>& info) const;
|
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
enum {
|
2003-07-04 18:22:01 -06:00
|
|
|
NoLabels = 0x000,
|
|
|
|
StarLabels = 0x001,
|
|
|
|
PlanetLabels = 0x002,
|
|
|
|
MoonLabels = 0x004,
|
|
|
|
ConstellationLabels = 0x008,
|
|
|
|
GalaxyLabels = 0x010,
|
|
|
|
AsteroidLabels = 0x020,
|
|
|
|
SpacecraftLabels = 0x040,
|
|
|
|
LocationLabels = 0x080,
|
|
|
|
CometLabels = 0x100,
|
2006-12-03 01:49:52 -07:00
|
|
|
NebulaLabels = 0x200,
|
|
|
|
OpenClusterLabels = 0x400,
|
2005-07-21 16:35:18 -06:00
|
|
|
I18nConstellationLabels = 0x800,
|
2008-04-15 12:31:53 -06:00
|
|
|
DwarfPlanetLabels = 0x1000,
|
|
|
|
MinorMoonLabels = 0x2000,
|
2018-03-11 07:12:58 -06:00
|
|
|
GlobularLabels = 0x4000,
|
|
|
|
BodyLabelMask = (PlanetLabels | DwarfPlanetLabels | MoonLabels | MinorMoonLabels | AsteroidLabels | SpacecraftLabels | CometLabels),
|
|
|
|
};
|
2002-02-17 21:00:07 -07:00
|
|
|
|
2018-11-13 13:31:07 -07:00
|
|
|
enum RenderFlags : uint64_t
|
|
|
|
{
|
|
|
|
ShowNothing = 0x0000000000000000,
|
|
|
|
ShowStars = 0x0000000000000001,
|
|
|
|
ShowPlanets = 0x0000000000000002,
|
|
|
|
ShowGalaxies = 0x0000000000000004,
|
|
|
|
ShowDiagrams = 0x0000000000000008,
|
|
|
|
ShowCloudMaps = 0x0000000000000010,
|
|
|
|
ShowOrbits = 0x0000000000000020,
|
|
|
|
ShowCelestialSphere = 0x0000000000000040,
|
|
|
|
ShowNightMaps = 0x0000000000000080,
|
|
|
|
ShowAtmospheres = 0x0000000000000100,
|
|
|
|
ShowSmoothLines = 0x0000000000000200,
|
|
|
|
ShowEclipseShadows = 0x0000000000000400,
|
2021-03-02 09:07:25 -07:00
|
|
|
// the next one is unused in 1.7, kept for compatibility with 1.6
|
|
|
|
ShowStarsAsPoints = 0x0000000000000800,
|
2018-11-13 13:31:07 -07:00
|
|
|
ShowRingShadows = 0x0000000000001000,
|
|
|
|
ShowBoundaries = 0x0000000000002000,
|
|
|
|
ShowAutoMag = 0x0000000000004000,
|
|
|
|
ShowCometTails = 0x0000000000008000,
|
|
|
|
ShowMarkers = 0x0000000000010000,
|
|
|
|
ShowPartialTrajectories = 0x0000000000020000,
|
|
|
|
ShowNebulae = 0x0000000000040000,
|
|
|
|
ShowOpenClusters = 0x0000000000080000,
|
|
|
|
ShowGlobulars = 0x0000000000100000,
|
|
|
|
ShowCloudShadows = 0x0000000000200000,
|
|
|
|
ShowGalacticGrid = 0x0000000000400000,
|
|
|
|
ShowEclipticGrid = 0x0000000000800000,
|
|
|
|
ShowHorizonGrid = 0x0000000001000000,
|
|
|
|
ShowEcliptic = 0x0000000002000000,
|
|
|
|
ShowTintedIllumination = 0x0000000004000000,
|
2021-03-02 09:07:25 -07:00
|
|
|
// options added in 1.7
|
2018-11-13 13:31:07 -07:00
|
|
|
ShowDwarfPlanets = 0x0000000008000000,
|
|
|
|
ShowMoons = 0x0000000010000000,
|
|
|
|
ShowMinorMoons = 0x0000000020000000,
|
|
|
|
ShowAsteroids = 0x0000000040000000,
|
|
|
|
ShowComets = 0x0000000080000000,
|
|
|
|
ShowSpacecrafts = 0x0000000100000000,
|
|
|
|
ShowFadingOrbits = 0x0000000200000000,
|
2021-03-02 09:07:25 -07:00
|
|
|
ShowPlanetRings = 0x0000000400000000,
|
2020-04-16 01:17:21 -06:00
|
|
|
ShowSolarSystemObjects = ShowPlanets |
|
|
|
|
ShowDwarfPlanets |
|
|
|
|
ShowMoons |
|
|
|
|
ShowMinorMoons |
|
|
|
|
ShowAsteroids |
|
|
|
|
ShowComets |
|
|
|
|
ShowPlanetRings |
|
|
|
|
ShowSpacecrafts,
|
|
|
|
ShowDeepSpaceObjects = ShowGalaxies |
|
|
|
|
ShowGlobulars |
|
|
|
|
ShowNebulae |
|
|
|
|
ShowOpenClusters,
|
|
|
|
DefaultRenderFlags = ShowStars |
|
|
|
|
ShowSolarSystemObjects|
|
|
|
|
ShowDeepSpaceObjects |
|
|
|
|
ShowCloudMaps |
|
|
|
|
ShowNightMaps |
|
|
|
|
ShowAtmospheres |
|
|
|
|
ShowEclipseShadows |
|
|
|
|
ShowRingShadows |
|
|
|
|
ShowCloudShadows |
|
|
|
|
ShowCometTails |
|
|
|
|
ShowAutoMag |
|
2021-03-02 09:07:25 -07:00
|
|
|
ShowPlanetRings |
|
2020-04-16 01:17:21 -06:00
|
|
|
ShowFadingOrbits |
|
|
|
|
ShowSmoothLines
|
2003-07-08 09:31:34 -06:00
|
|
|
};
|
|
|
|
|
2018-03-11 07:12:58 -06:00
|
|
|
enum StarStyle
|
2003-07-08 09:31:34 -06:00
|
|
|
{
|
|
|
|
FuzzyPointStars = 0,
|
|
|
|
PointStars = 1,
|
|
|
|
ScaledDiscStars = 2,
|
|
|
|
StarStyleCount = 3,
|
2001-11-27 18:50:04 -07:00
|
|
|
};
|
2002-02-17 21:00:07 -07:00
|
|
|
|
2018-11-13 13:31:07 -07:00
|
|
|
uint64_t getRenderFlags() const;
|
|
|
|
void setRenderFlags(uint64_t);
|
2001-11-27 18:50:04 -07:00
|
|
|
int getLabelMode() const;
|
|
|
|
void setLabelMode(int);
|
2020-10-02 03:00:00 -06:00
|
|
|
ProjectionMode getProjectionMode() const;
|
|
|
|
void setProjectionMode(ProjectionMode);
|
2001-11-27 18:50:04 -07:00
|
|
|
float getAmbientLightLevel() const;
|
|
|
|
void setAmbientLightLevel(float);
|
2004-03-21 12:26:54 -07:00
|
|
|
float getMinimumOrbitSize() const;
|
2002-04-25 21:49:43 -06:00
|
|
|
void setMinimumOrbitSize(float);
|
2003-06-18 12:35:59 -06:00
|
|
|
float getMinimumFeatureSize() const;
|
|
|
|
void setMinimumFeatureSize(float);
|
2002-09-08 21:50:37 -06:00
|
|
|
float getDistanceLimit() const;
|
|
|
|
void setDistanceLimit(float);
|
2003-07-08 09:31:34 -06:00
|
|
|
int getOrbitMask() const;
|
|
|
|
void setOrbitMask(int);
|
2005-12-11 08:34:35 -07:00
|
|
|
int getScreenDpi() const;
|
|
|
|
void setScreenDpi(int);
|
2020-10-02 03:00:00 -06:00
|
|
|
int getWindowWidth() const;
|
|
|
|
int getWindowHeight() const;
|
2019-10-08 14:00:19 -06:00
|
|
|
|
2020-12-05 02:56:43 -07:00
|
|
|
float getScaleFactor() const;
|
|
|
|
float getPointWidth() const;
|
|
|
|
float getPointHeight() const;
|
|
|
|
float getLineWidthX() const;
|
|
|
|
float getLineWidthY() const;
|
2020-12-12 19:11:35 -07:00
|
|
|
float getRasterizedLineWidth(float multiplier) const;
|
|
|
|
bool shouldDrawLineAsTriangles(float multiplier = 1.0f) const;
|
2020-12-05 02:56:43 -07:00
|
|
|
|
2019-10-08 14:00:19 -06:00
|
|
|
// GL wrappers
|
|
|
|
void getViewport(int* x, int* y, int* w, int* h) const;
|
|
|
|
void getViewport(std::array<int, 4>& viewport) const;
|
|
|
|
void setViewport(int x, int y, int w, int h) const;
|
|
|
|
void setViewport(const std::array<int, 4>& viewport) const;
|
|
|
|
void setScissor(int x, int y, int w, int h);
|
|
|
|
void removeScissor();
|
2020-06-14 10:06:05 -06:00
|
|
|
|
|
|
|
void enableMSAA() noexcept;
|
|
|
|
void disableMSAA() noexcept;
|
|
|
|
bool isMSAAEnabled() const noexcept;
|
|
|
|
|
|
|
|
void enableBlending() noexcept;
|
|
|
|
void disableBlending() noexcept;
|
|
|
|
void setBlendingFactors(GLenum, GLenum) noexcept;
|
|
|
|
|
2020-07-07 11:00:08 -06:00
|
|
|
void enableDepthMask() noexcept;
|
|
|
|
void disableDepthMask() noexcept;
|
|
|
|
|
|
|
|
void enableDepthTest() noexcept;
|
|
|
|
void disableDepthTest() noexcept;
|
|
|
|
|
2021-06-13 04:48:54 -06:00
|
|
|
celestia::PixelFormat getPreferredCaptureFormat() const noexcept;
|
|
|
|
|
2021-05-22 01:10:05 -06:00
|
|
|
void drawRectangle(const celestia::Rect& r, int fishEyeOverrideMode, const Eigen::Matrix4f& p, const Eigen::Matrix4f& m = Eigen::Matrix4f::Identity());
|
2019-10-08 14:00:19 -06:00
|
|
|
void setRenderRegion(int x, int y, int width, int height, bool withScissor = true);
|
|
|
|
|
2004-09-19 21:27:50 -06:00
|
|
|
const ColorTemperatureTable* getStarColorTable() const;
|
|
|
|
void setStarColorTable(const ColorTemperatureTable*);
|
2020-04-08 05:58:24 -06:00
|
|
|
[[deprecated]] bool getVideoSync() const;
|
|
|
|
[[deprecated]] void setVideoSync(bool);
|
2018-11-22 13:26:50 -07:00
|
|
|
void setSolarSystemMaxDistance(float);
|
2019-11-29 03:53:38 -07:00
|
|
|
void setShadowMapSize(unsigned);
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2021-06-13 04:48:54 -06:00
|
|
|
bool captureFrame(int, int, int, int, celestia::PixelFormat format, unsigned char*) const;
|
2019-05-25 10:44:38 -06:00
|
|
|
|
2021-05-22 01:10:05 -06:00
|
|
|
void renderMarker(celestia::MarkerRepresentation::Symbol symbol,
|
2020-05-12 09:51:25 -06:00
|
|
|
float size,
|
|
|
|
const Color &color,
|
|
|
|
const Matrices &m);
|
|
|
|
|
|
|
|
const Eigen::Matrix4f& getModelViewMatrix() const
|
|
|
|
{
|
|
|
|
return m_modelMatrix;
|
|
|
|
}
|
|
|
|
const Eigen::Matrix4f& getProjectionMatrix() const
|
|
|
|
{
|
|
|
|
return m_projMatrix;
|
|
|
|
}
|
|
|
|
const Eigen::Matrix4f& getOrthoProjectionMatrix() const
|
|
|
|
{
|
|
|
|
return m_orthoProjMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Eigen::Matrix4f& getCurrentModelViewMatrix() const
|
|
|
|
{
|
|
|
|
return *m_modelViewPtr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCurrentModelViewMatrix(const Eigen::Matrix4f& m)
|
|
|
|
{
|
|
|
|
m_modelViewPtr = &m;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Eigen::Matrix4f& getCurrentProjectionMatrix() const
|
|
|
|
{
|
|
|
|
return *m_projectionPtr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCurrentProjectionMatrix(const Eigen::Matrix4f& m)
|
|
|
|
{
|
|
|
|
m_projectionPtr = &m;
|
|
|
|
}
|
2019-06-14 07:40:01 -06:00
|
|
|
|
2008-03-24 18:23:16 -06:00
|
|
|
#ifdef USE_HDR
|
|
|
|
bool getBloomEnabled();
|
|
|
|
void setBloomEnabled(bool);
|
|
|
|
void increaseBrightness();
|
|
|
|
void decreaseBrightness();
|
|
|
|
float getBrightness();
|
|
|
|
#endif
|
|
|
|
|
2019-06-18 05:20:01 -06:00
|
|
|
#ifdef USE_GLCONTEXT
|
2003-02-19 16:25:26 -07:00
|
|
|
GLContext* getGLContext() { return context; }
|
2019-06-18 05:20:01 -06:00
|
|
|
#endif
|
2003-02-19 16:25:26 -07:00
|
|
|
|
2003-07-08 09:31:34 -06:00
|
|
|
void setStarStyle(StarStyle);
|
|
|
|
StarStyle getStarStyle() const;
|
2002-02-13 13:38:49 -07:00
|
|
|
void setResolution(unsigned int resolution);
|
2008-05-01 16:25:20 -06:00
|
|
|
unsigned int getResolution() const;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2002-05-02 01:57:38 -06:00
|
|
|
void loadTextures(Body*);
|
|
|
|
|
2006-09-07 02:08:32 -06:00
|
|
|
// Label related methods
|
2008-05-29 15:52:27 -06:00
|
|
|
enum LabelAlignment
|
|
|
|
{
|
|
|
|
AlignCenter,
|
|
|
|
AlignLeft,
|
|
|
|
AlignRight
|
|
|
|
};
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2008-05-29 15:52:27 -06:00
|
|
|
enum LabelVerticalAlignment
|
|
|
|
{
|
|
|
|
VerticalAlignCenter,
|
|
|
|
VerticalAlignBottom,
|
|
|
|
VerticalAlignTop,
|
|
|
|
};
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2008-02-13 14:49:53 -07:00
|
|
|
struct Annotation
|
2006-09-07 02:08:32 -06:00
|
|
|
{
|
2018-10-27 09:28:20 -06:00
|
|
|
std::string labelText;
|
2021-05-22 01:10:05 -06:00
|
|
|
const celestia::MarkerRepresentation* markerRep;
|
2001-11-27 18:50:04 -07:00
|
|
|
Color color;
|
2009-07-20 22:04:26 -06:00
|
|
|
Eigen::Vector3f position;
|
2008-09-22 15:03:43 -06:00
|
|
|
LabelAlignment halign : 3;
|
|
|
|
LabelVerticalAlignment valign : 3;
|
|
|
|
float size;
|
2008-02-04 02:37:55 -07:00
|
|
|
|
2008-02-13 14:49:53 -07:00
|
|
|
bool operator<(const Annotation&) const;
|
2006-09-07 02:08:32 -06:00
|
|
|
};
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2021-05-22 01:10:05 -06:00
|
|
|
void addForegroundAnnotation(const celestia::MarkerRepresentation* markerRep,
|
2008-05-29 15:52:27 -06:00
|
|
|
const std::string& labelText,
|
|
|
|
Color color,
|
2009-07-20 22:04:26 -06:00
|
|
|
const Eigen::Vector3f& position,
|
2008-05-29 15:52:27 -06:00
|
|
|
LabelAlignment halign = AlignLeft,
|
2008-09-22 15:03:43 -06:00
|
|
|
LabelVerticalAlignment valign = VerticalAlignBottom,
|
|
|
|
float size = 0.0f);
|
2021-05-22 01:10:05 -06:00
|
|
|
void addBackgroundAnnotation(const celestia::MarkerRepresentation* markerRep,
|
2008-05-29 15:52:27 -06:00
|
|
|
const std::string& labelText,
|
|
|
|
Color color,
|
2009-07-20 22:04:26 -06:00
|
|
|
const Eigen::Vector3f& position,
|
2008-05-29 15:52:27 -06:00
|
|
|
LabelAlignment halign = AlignLeft,
|
|
|
|
LabelVerticalAlignment valign = VerticalAlignBottom,
|
2008-09-22 15:03:43 -06:00
|
|
|
float size = 0.0f);
|
2021-05-22 01:10:05 -06:00
|
|
|
void addSortedAnnotation(const celestia::MarkerRepresentation* markerRep,
|
2008-05-29 15:52:27 -06:00
|
|
|
const std::string& labelText,
|
|
|
|
Color color,
|
2009-07-20 22:04:26 -06:00
|
|
|
const Eigen::Vector3f& position,
|
2008-05-29 15:52:27 -06:00
|
|
|
LabelAlignment halign = AlignLeft,
|
2008-09-22 15:03:43 -06:00
|
|
|
LabelVerticalAlignment valign = VerticalAlignBottom,
|
|
|
|
float size = 0.0f);
|
2008-04-30 12:31:30 -06:00
|
|
|
|
2020-03-14 04:48:24 -06:00
|
|
|
ShaderManager& getShaderManager() const { return *shaderManager; }
|
|
|
|
|
|
|
|
celgl::VertexObject& getVertexObject(VOType, GLenum, GLsizeiptr, GLenum);
|
2018-12-04 13:00:36 -07:00
|
|
|
|
2008-04-30 12:31:30 -06:00
|
|
|
// Callbacks for renderables; these belong in a special renderer interface
|
|
|
|
// only visible in object's render methods.
|
|
|
|
void beginObjectAnnotations();
|
2021-05-22 01:10:05 -06:00
|
|
|
void addObjectAnnotation(const celestia::MarkerRepresentation* markerRep, const std::string& labelText, Color, const Eigen::Vector3f&);
|
2008-04-30 12:31:30 -06:00
|
|
|
void endObjectAnnotations();
|
2020-04-19 07:30:20 -06:00
|
|
|
const Eigen::Quaternionf& getCameraOrientation() const;
|
2008-04-30 12:31:30 -06:00
|
|
|
float getNearPlaneDistance() const;
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2008-02-13 14:49:53 -07:00
|
|
|
void clearAnnotations(std::vector<Annotation>&);
|
2007-10-25 01:18:53 -06:00
|
|
|
|
|
|
|
void invalidateOrbitCache();
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2006-09-07 02:08:32 -06:00
|
|
|
struct OrbitPathListEntry
|
|
|
|
{
|
|
|
|
float centerZ;
|
|
|
|
float radius;
|
|
|
|
Body* body;
|
2006-09-07 23:59:38 -06:00
|
|
|
const Star* star;
|
2009-08-06 21:15:26 -06:00
|
|
|
Eigen::Vector3d origin;
|
2007-05-13 21:00:26 -06:00
|
|
|
float opacity;
|
2008-02-04 02:37:55 -07:00
|
|
|
|
|
|
|
bool operator<(const OrbitPathListEntry&) const;
|
2018-03-11 07:12:58 -06:00
|
|
|
};
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2006-03-08 11:29:10 -07:00
|
|
|
enum FontStyle
|
|
|
|
{
|
|
|
|
FontNormal = 0,
|
|
|
|
FontLarge = 1,
|
|
|
|
FontCount = 2,
|
|
|
|
};
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2021-05-23 06:13:35 -06:00
|
|
|
void setFont(FontStyle, const std::shared_ptr<TextureFont>&);
|
|
|
|
std::shared_ptr<TextureFont> getFont(FontStyle) const;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2007-11-15 13:08:24 -07:00
|
|
|
bool settingsHaveChanged() const;
|
|
|
|
void markSettingsChanged();
|
2007-06-25 15:31:40 -06:00
|
|
|
|
2008-01-19 15:21:56 -07:00
|
|
|
void addWatcher(RendererWatcher*);
|
|
|
|
void removeWatcher(RendererWatcher*);
|
|
|
|
void notifyWatchers() const;
|
|
|
|
|
2019-11-29 03:53:38 -07:00
|
|
|
FramebufferObject* getShadowFBO(int) const;
|
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
public:
|
|
|
|
// Internal types
|
|
|
|
// TODO: Figure out how to make these private. Even with a friend
|
2018-03-11 07:12:58 -06:00
|
|
|
//
|
2001-11-27 18:50:04 -07:00
|
|
|
struct Particle
|
|
|
|
{
|
2009-07-20 22:04:26 -06:00
|
|
|
Eigen::Vector3f center;
|
2001-11-27 18:50:04 -07:00
|
|
|
float size;
|
|
|
|
Color color;
|
|
|
|
float pad0, pad1, pad2;
|
|
|
|
};
|
|
|
|
|
2002-02-08 14:55:26 -07:00
|
|
|
struct RenderProperties
|
|
|
|
{
|
2018-10-17 11:28:37 -06:00
|
|
|
Surface* surface{ nullptr };
|
|
|
|
const Atmosphere* atmosphere{ nullptr };
|
|
|
|
RingSystem* rings{ nullptr };
|
|
|
|
float radius{ 1.0f };
|
|
|
|
float geometryScale{ 1.0f };
|
|
|
|
Eigen::Vector3f semiAxes{ Eigen::Vector3f::Ones() };
|
|
|
|
ResourceHandle geometry{ InvalidResource };
|
|
|
|
Eigen::Quaternionf orientation{ Eigen::Quaternionf::Identity() };
|
2009-10-27 16:02:01 -06:00
|
|
|
LightingState::EclipseShadowVector* eclipseShadows;
|
2002-02-08 14:55:26 -07:00
|
|
|
};
|
|
|
|
|
2019-05-01 12:54:00 -06:00
|
|
|
#ifdef OCTREE_DEBUG
|
2019-04-27 09:30:12 -06:00
|
|
|
OctreeProcStats m_starProcStats;
|
|
|
|
OctreeProcStats m_dsoProcStats;
|
2019-05-01 12:54:00 -06:00
|
|
|
#endif
|
2003-05-25 20:27:27 -06:00
|
|
|
private:
|
|
|
|
struct SkyVertex
|
|
|
|
{
|
|
|
|
float x, y, z;
|
|
|
|
unsigned char color[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SkyContourPoint
|
|
|
|
{
|
2009-07-20 21:14:29 -06:00
|
|
|
Eigen::Vector3f v;
|
|
|
|
Eigen::Vector3f eyeDir;
|
2003-05-25 20:27:27 -06:00
|
|
|
float centerDist;
|
|
|
|
float eyeDist;
|
|
|
|
float cosSkyCapAltitude;
|
|
|
|
};
|
|
|
|
|
2005-11-18 02:00:39 -07:00
|
|
|
template <class OBJ> struct ObjectLabel
|
2004-02-28 02:30:17 -07:00
|
|
|
{
|
2018-11-08 10:39:00 -07:00
|
|
|
OBJ* obj{ nullptr };
|
2005-11-18 02:00:39 -07:00
|
|
|
std::string label;
|
|
|
|
|
|
|
|
ObjectLabel(OBJ* _obj, const std::string& _label) :
|
|
|
|
obj (_obj),
|
|
|
|
label(_label)
|
|
|
|
{};
|
|
|
|
|
|
|
|
ObjectLabel(const ObjectLabel& objLbl) :
|
|
|
|
obj (objLbl.obj),
|
|
|
|
label(objLbl.label)
|
|
|
|
{};
|
|
|
|
|
|
|
|
ObjectLabel& operator = (const ObjectLabel& objLbl)
|
2004-02-28 02:30:17 -07:00
|
|
|
{
|
2005-11-18 02:00:39 -07:00
|
|
|
obj = objLbl.obj;
|
|
|
|
label = objLbl.label;
|
2004-02-28 02:30:17 -07:00
|
|
|
return *this;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2005-11-18 02:00:39 -07:00
|
|
|
typedef ObjectLabel<Star> StarLabel;
|
|
|
|
typedef ObjectLabel<DeepSkyObject> DSOLabel; // currently not used
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2006-09-07 02:08:32 -06:00
|
|
|
struct DepthBufferPartition
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
float nearZ;
|
|
|
|
float farZ;
|
|
|
|
};
|
2005-11-18 02:00:39 -07:00
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
private:
|
2003-02-14 11:07:47 -07:00
|
|
|
void setFieldOfView(float);
|
2006-03-08 11:29:10 -07:00
|
|
|
void renderPointStars(const StarDatabase& starDB,
|
|
|
|
float faintestVisible,
|
|
|
|
const Observer& observer);
|
2005-11-18 02:00:39 -07:00
|
|
|
void renderDeepSkyObjects(const Universe&,
|
|
|
|
const Observer&,
|
|
|
|
float faintestMagNight);
|
2008-05-29 15:52:27 -06:00
|
|
|
void renderSkyGrids(const Observer& observer);
|
2008-09-25 12:31:48 -06:00
|
|
|
void renderSelectionPointer(const Observer& observer,
|
|
|
|
double now,
|
2019-05-16 15:51:11 -06:00
|
|
|
const celmath::Frustum& viewFrustum,
|
2008-09-25 12:31:48 -06:00
|
|
|
const Selection& sel);
|
|
|
|
|
2020-09-29 20:27:22 -06:00
|
|
|
void renderAsterisms(const Universe&, float, const Matrices&);
|
|
|
|
void renderBoundaries(const Universe&, float, const Matrices&);
|
2019-11-08 05:24:42 -07:00
|
|
|
void renderEclipticLine();
|
2020-05-12 09:51:25 -06:00
|
|
|
void renderCrosshair(float size, double tsec, const Color &color, const Matrices &m);
|
2018-11-08 10:37:51 -07:00
|
|
|
|
2020-04-18 03:56:49 -06:00
|
|
|
void buildNearSystemsLists(const Universe &universe,
|
|
|
|
const Observer &observer,
|
|
|
|
const celmath::Frustum &xfrustum,
|
|
|
|
double jd);
|
|
|
|
|
2009-07-17 00:15:25 -06:00
|
|
|
void buildRenderLists(const Eigen::Vector3d& astrocentricObserverPos,
|
2019-05-16 15:51:11 -06:00
|
|
|
const celmath::Frustum& viewFrustum,
|
2009-07-17 00:15:25 -06:00
|
|
|
const Eigen::Vector3d& viewPlaneNormal,
|
|
|
|
const Eigen::Vector3d& frameCenter,
|
2008-02-20 19:25:48 -07:00
|
|
|
const FrameTree* tree,
|
2006-09-07 23:59:38 -06:00
|
|
|
const Observer& observer,
|
2008-04-03 11:46:45 -06:00
|
|
|
double now);
|
2009-08-06 21:15:26 -06:00
|
|
|
void buildOrbitLists(const Eigen::Vector3d& astrocentricObserverPos,
|
|
|
|
const Eigen::Quaterniond& observerOrientation,
|
2019-05-16 15:51:11 -06:00
|
|
|
const celmath::Frustum& viewFrustum,
|
2008-04-03 11:46:45 -06:00
|
|
|
const FrameTree* tree,
|
|
|
|
double now);
|
2019-05-16 15:51:11 -06:00
|
|
|
void buildLabelLists(const celmath::Frustum& viewFrustum,
|
2008-04-03 11:46:45 -06:00
|
|
|
double now);
|
2020-04-18 11:17:33 -06:00
|
|
|
int buildDepthPartitions();
|
|
|
|
|
2008-04-03 11:46:45 -06:00
|
|
|
|
|
|
|
void addRenderListEntries(RenderListEntry& rle,
|
|
|
|
Body& body,
|
|
|
|
bool isLabeled);
|
|
|
|
|
2006-09-07 23:59:38 -06:00
|
|
|
void addStarOrbitToRenderList(const Star& star,
|
|
|
|
const Observer& observer,
|
|
|
|
double now);
|
2002-02-08 14:55:26 -07:00
|
|
|
|
2020-04-19 06:22:12 -06:00
|
|
|
void removeInvisibleItems(const celmath::Frustum &frustum);
|
|
|
|
|
2009-07-17 00:15:25 -06:00
|
|
|
void renderObject(const Eigen::Vector3f& pos,
|
2002-02-08 14:55:26 -07:00
|
|
|
float distance,
|
|
|
|
double now,
|
|
|
|
float nearPlaneDistance,
|
|
|
|
float farPlaneDistance,
|
2004-10-04 00:35:33 -06:00
|
|
|
RenderProperties& obj,
|
2020-05-12 09:51:25 -06:00
|
|
|
const LightingState&,
|
|
|
|
const Matrices&);
|
2002-02-08 14:55:26 -07:00
|
|
|
|
2003-06-24 00:31:19 -06:00
|
|
|
void renderPlanet(Body& body,
|
2009-07-17 00:15:25 -06:00
|
|
|
const Eigen::Vector3f& pos,
|
2001-11-27 18:50:04 -07:00
|
|
|
float distance,
|
|
|
|
float appMag,
|
2006-12-08 12:02:20 -07:00
|
|
|
const Observer& observer,
|
2020-05-12 09:51:25 -06:00
|
|
|
float, float,
|
|
|
|
const Matrices&);
|
2002-02-08 14:55:26 -07:00
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
void renderStar(const Star& star,
|
2009-07-17 00:15:25 -06:00
|
|
|
const Eigen::Vector3f& pos,
|
2001-11-27 18:50:04 -07:00
|
|
|
float distance,
|
|
|
|
float appMag,
|
|
|
|
double now,
|
2020-05-12 09:51:25 -06:00
|
|
|
float, float,
|
|
|
|
const Matrices&);
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2008-03-20 15:36:17 -06:00
|
|
|
void renderReferenceMark(const ReferenceMark& refMark,
|
2009-07-17 00:15:25 -06:00
|
|
|
const Eigen::Vector3f& pos,
|
2008-03-20 15:36:17 -06:00
|
|
|
float distance,
|
|
|
|
double now,
|
2020-05-12 09:51:25 -06:00
|
|
|
float nearPlaneDistance,
|
|
|
|
const Matrices&);
|
2007-11-08 13:50:37 -07:00
|
|
|
|
2002-06-16 20:41:11 -06:00
|
|
|
void renderCometTail(const Body& body,
|
2009-07-17 00:15:25 -06:00
|
|
|
const Eigen::Vector3f& pos,
|
2019-09-13 15:58:01 -06:00
|
|
|
const Observer& observer,
|
2020-05-12 09:51:25 -06:00
|
|
|
float discSizeInPixels,
|
|
|
|
const Matrices&);
|
2002-06-16 20:41:11 -06:00
|
|
|
|
2009-07-17 00:15:25 -06:00
|
|
|
void renderObjectAsPoint(const Eigen::Vector3f& center,
|
2006-12-20 11:56:43 -07:00
|
|
|
float radius,
|
2006-03-08 11:29:10 -07:00
|
|
|
float appMag,
|
|
|
|
float _faintestMag,
|
|
|
|
float discSizeInPixels,
|
2020-05-12 09:51:25 -06:00
|
|
|
const Color& color,
|
2006-12-20 11:56:43 -07:00
|
|
|
bool useHalos,
|
2020-05-12 09:51:25 -06:00
|
|
|
bool emissive,
|
|
|
|
const Matrices&);
|
2002-02-17 21:00:07 -07:00
|
|
|
|
2003-05-25 20:27:27 -06:00
|
|
|
void renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
|
2009-07-20 21:14:29 -06:00
|
|
|
const Eigen::Vector3f& center,
|
|
|
|
const Eigen::Quaternionf& orientation,
|
|
|
|
const Eigen::Vector3f& semiAxes,
|
|
|
|
const Eigen::Vector3f& sunDirection,
|
2009-02-17 18:39:43 -07:00
|
|
|
const LightingState& ls,
|
2003-05-25 20:27:27 -06:00
|
|
|
float fade,
|
2020-05-12 09:51:25 -06:00
|
|
|
bool lit,
|
|
|
|
const Matrices&);
|
2003-05-25 20:27:27 -06:00
|
|
|
|
2020-04-19 06:50:10 -06:00
|
|
|
void locationsToAnnotations(const Body& body,
|
|
|
|
const Eigen::Vector3d& bodyPosition,
|
|
|
|
const Eigen::Quaterniond& bodyOrientation);
|
2018-03-11 07:12:58 -06:00
|
|
|
|
|
|
|
// Render an item from the render list
|
2006-09-10 18:37:20 -06:00
|
|
|
void renderItem(const RenderListEntry& rle,
|
|
|
|
const Observer& observer,
|
|
|
|
float nearPlaneDistance,
|
2020-05-12 09:51:25 -06:00
|
|
|
float farPlaneDistance,
|
|
|
|
const Matrices&);
|
2003-06-17 11:40:49 -06:00
|
|
|
|
2004-10-19 11:52:43 -06:00
|
|
|
bool testEclipse(const Body& receiver,
|
|
|
|
const Body& caster,
|
2009-10-27 16:02:01 -06:00
|
|
|
LightingState& lightingState,
|
|
|
|
unsigned int lightIndex,
|
|
|
|
double now);
|
2002-02-17 21:00:07 -07:00
|
|
|
|
2018-11-03 12:22:14 -06:00
|
|
|
void labelConstellations(const AsterismList& asterisms,
|
2001-11-27 18:50:04 -07:00
|
|
|
const Observer& observer);
|
2020-04-19 07:30:20 -06:00
|
|
|
void renderParticles(const std::vector<Particle>& particles);
|
2018-03-11 07:12:58 -06:00
|
|
|
|
|
|
|
|
2008-02-13 14:49:53 -07:00
|
|
|
void addAnnotation(std::vector<Annotation>&,
|
2021-05-22 01:10:05 -06:00
|
|
|
const celestia::MarkerRepresentation*,
|
2008-03-20 15:36:17 -06:00
|
|
|
const std::string& labelText,
|
2008-05-29 15:52:27 -06:00
|
|
|
Color color,
|
2009-07-20 22:04:26 -06:00
|
|
|
const Eigen::Vector3f& position,
|
2008-05-29 15:52:27 -06:00
|
|
|
LabelAlignment halign = AlignLeft,
|
|
|
|
LabelVerticalAlignment = VerticalAlignBottom,
|
2018-11-03 11:15:27 -06:00
|
|
|
float size = 0.0f,
|
|
|
|
bool special = false);
|
2020-04-15 10:18:34 -06:00
|
|
|
void renderAnnotationMarker(const Annotation &a,
|
|
|
|
FontStyle fs,
|
2020-05-12 09:51:25 -06:00
|
|
|
float depth,
|
|
|
|
const Matrices&);
|
2020-04-15 10:18:34 -06:00
|
|
|
void renderAnnotationLabel(const Annotation &a,
|
|
|
|
FontStyle fs,
|
|
|
|
int hOffset,
|
|
|
|
int vOffset,
|
2020-05-12 09:51:25 -06:00
|
|
|
float depth,
|
|
|
|
const Matrices&);
|
|
|
|
void renderAnnotations(const std::vector<Annotation>&,
|
|
|
|
FontStyle fs);
|
2008-05-29 15:52:27 -06:00
|
|
|
void renderBackgroundAnnotations(FontStyle fs);
|
|
|
|
void renderForegroundAnnotations(FontStyle fs);
|
2008-02-13 14:49:53 -07:00
|
|
|
std::vector<Annotation>::iterator renderSortedAnnotations(std::vector<Annotation>::iterator,
|
|
|
|
float nearDist,
|
|
|
|
float farDist,
|
|
|
|
FontStyle fs);
|
2020-05-12 09:51:25 -06:00
|
|
|
std::vector<Annotation>::iterator renderAnnotations(std::vector<Annotation>::iterator startIter,
|
|
|
|
std::vector<Annotation>::iterator endIter,
|
|
|
|
float nearDist,
|
|
|
|
float farDist,
|
|
|
|
FontStyle fs);
|
2008-04-30 12:31:30 -06:00
|
|
|
|
2021-05-22 01:10:05 -06:00
|
|
|
void markersToAnnotations(const celestia::MarkerList &markers,
|
2020-04-19 04:17:46 -06:00
|
|
|
const Observer &observer,
|
|
|
|
double now);
|
|
|
|
|
|
|
|
bool selectionToAnnotation(const Selection &sel,
|
|
|
|
const Observer &observer,
|
|
|
|
const celmath::Frustum &xfrustum,
|
|
|
|
double now);
|
2020-04-19 05:52:38 -06:00
|
|
|
|
|
|
|
void adjustMagnitudeInsideAtmosphere(float &faintestMag,
|
|
|
|
float &saturationMag,
|
|
|
|
double now);
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2007-11-10 18:58:05 -07:00
|
|
|
void renderOrbit(const OrbitPathListEntry&,
|
|
|
|
double now,
|
2009-08-06 21:15:26 -06:00
|
|
|
const Eigen::Quaterniond& cameraOrientation,
|
2019-05-16 15:51:11 -06:00
|
|
|
const celmath::Frustum& frustum,
|
2007-11-10 18:58:05 -07:00
|
|
|
float nearDist,
|
2020-05-12 09:51:25 -06:00
|
|
|
float farDist,
|
|
|
|
const Matrices&);
|
2003-02-19 16:25:26 -07:00
|
|
|
|
2020-04-19 02:24:06 -06:00
|
|
|
void renderSolarSystemObjects(const Observer &observer,
|
|
|
|
int nIntervals,
|
|
|
|
double now);
|
|
|
|
|
2018-11-13 13:31:07 -07:00
|
|
|
void updateBodyVisibilityMask();
|
|
|
|
|
2019-11-29 03:53:38 -07:00
|
|
|
void createShadowFBO();
|
|
|
|
|
2020-12-12 19:11:35 -07:00
|
|
|
void enableSmoothLines();
|
|
|
|
void disableSmoothLines();
|
|
|
|
|
2008-03-24 18:23:16 -06:00
|
|
|
#ifdef USE_HDR
|
|
|
|
private:
|
|
|
|
int sceneTexWidth, sceneTexHeight;
|
|
|
|
GLfloat sceneTexWScale, sceneTexHScale;
|
|
|
|
GLsizei blurBaseWidth, blurBaseHeight;
|
|
|
|
GLuint sceneTexture;
|
|
|
|
Texture **blurTextures;
|
|
|
|
Texture *blurTempTexture;
|
|
|
|
GLuint gaussianLists[4];
|
|
|
|
GLint blurFormat;
|
|
|
|
bool useLuminanceAlpha;
|
|
|
|
bool bloomEnabled;
|
|
|
|
float maxBodyMag;
|
|
|
|
float exposure, exposurePrev;
|
|
|
|
float brightPlus;
|
|
|
|
|
|
|
|
void genBlurTexture(int blurLevel);
|
|
|
|
void genBlurTextures();
|
|
|
|
void genSceneTexture();
|
|
|
|
void renderToBlurTexture(int blurLevel);
|
|
|
|
void renderToTexture(const Observer& observer,
|
|
|
|
const Universe& universe,
|
|
|
|
float faintestMagNight,
|
|
|
|
const Selection& sel);
|
|
|
|
void drawSceneTexture();
|
|
|
|
void drawBlur();
|
|
|
|
void drawGaussian3x3(float xdelta, float ydelta, GLsizei width, GLsizei height, float blend);
|
|
|
|
void drawGaussian5x5(float xdelta, float ydelta, GLsizei width, GLsizei height, float blend);
|
|
|
|
void drawGaussian9x9(float xdelta, float ydelta, GLsizei width, GLsizei height, float blend);
|
|
|
|
void drawBlendedVertices(float xdelta, float ydelta, float blend);
|
|
|
|
#endif
|
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
private:
|
2019-06-18 05:20:01 -06:00
|
|
|
#ifdef USE_GLCONTEXT
|
2003-02-19 10:48:25 -07:00
|
|
|
GLContext* context;
|
2019-06-18 05:20:01 -06:00
|
|
|
#endif
|
2018-12-04 13:00:36 -07:00
|
|
|
ShaderManager* shaderManager{ nullptr };
|
2003-02-19 10:48:25 -07:00
|
|
|
|
2001-11-27 18:50:04 -07:00
|
|
|
int windowWidth;
|
|
|
|
int windowHeight;
|
|
|
|
float fov;
|
2008-05-30 00:37:37 -06:00
|
|
|
double cosViewConeAngle;
|
2005-12-11 08:34:35 -07:00
|
|
|
int screenDpi;
|
2002-09-22 08:51:35 -06:00
|
|
|
float corrFac;
|
2018-10-30 12:57:10 -06:00
|
|
|
float pixelSize{ 1.0f };
|
2002-12-11 13:27:35 -07:00
|
|
|
float faintestAutoMag45deg;
|
2021-05-23 06:13:35 -06:00
|
|
|
std::vector<std::shared_ptr<TextureFont>> fonts{FontCount, nullptr};
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2020-10-02 03:00:00 -06:00
|
|
|
ProjectionMode projectionMode;
|
2001-11-27 18:50:04 -07:00
|
|
|
int renderMode;
|
|
|
|
int labelMode;
|
2018-11-13 13:31:07 -07:00
|
|
|
uint64_t renderFlags;
|
|
|
|
int bodyVisibilityMask{ ~0 };
|
2003-07-08 09:31:34 -06:00
|
|
|
int orbitMask;
|
2001-11-27 18:50:04 -07:00
|
|
|
float ambientLightLevel;
|
|
|
|
float brightnessBias;
|
|
|
|
|
2018-10-30 12:57:10 -06:00
|
|
|
float brightnessScale{ 1.0f };
|
|
|
|
float faintestMag{ 0.0f };
|
|
|
|
float faintestPlanetMag{ 0.0f };
|
2001-12-11 00:40:53 -07:00
|
|
|
float saturationMagNight;
|
|
|
|
float saturationMag;
|
2003-07-08 09:31:34 -06:00
|
|
|
StarStyle starStyle;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
|
|
|
Color ambientColor;
|
2003-06-08 21:57:43 -06:00
|
|
|
std::string displayedSurface;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2009-07-17 00:15:25 -06:00
|
|
|
Eigen::Quaternionf m_cameraOrientation;
|
2006-03-08 11:29:10 -07:00
|
|
|
PointStarVertexBuffer* pointStarVertexBuffer;
|
2018-03-11 07:12:58 -06:00
|
|
|
PointStarVertexBuffer* glareVertexBuffer;
|
2001-11-27 18:50:04 -07:00
|
|
|
std::vector<RenderListEntry> renderList;
|
2008-04-03 11:46:45 -06:00
|
|
|
std::vector<SecondaryIlluminator> secondaryIlluminators;
|
2006-09-07 02:08:32 -06:00
|
|
|
std::vector<DepthBufferPartition> depthPartitions;
|
2001-11-27 18:50:04 -07:00
|
|
|
std::vector<Particle> glareParticles;
|
2008-02-13 14:49:53 -07:00
|
|
|
std::vector<Annotation> backgroundAnnotations;
|
|
|
|
std::vector<Annotation> foregroundAnnotations;
|
|
|
|
std::vector<Annotation> depthSortedAnnotations;
|
2008-04-30 12:31:30 -06:00
|
|
|
std::vector<Annotation> objectAnnotations;
|
2006-09-07 02:08:32 -06:00
|
|
|
std::vector<OrbitPathListEntry> orbitPathList;
|
2009-10-27 16:02:01 -06:00
|
|
|
LightingState::EclipseShadowVector eclipseShadows[MaxLights];
|
2004-10-02 04:44:49 -06:00
|
|
|
std::vector<const Star*> nearStars;
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2008-04-03 11:46:45 -06:00
|
|
|
std::vector<LightSource> lightSourceList;
|
2004-10-04 00:35:33 -06:00
|
|
|
|
2020-04-19 09:08:54 -06:00
|
|
|
Eigen::Matrix4f m_modelMatrix;
|
|
|
|
Eigen::Matrix4f m_projMatrix;
|
2020-04-28 12:30:58 -06:00
|
|
|
Eigen::Matrix4f m_MVPMatrix;
|
2020-04-19 04:49:49 -06:00
|
|
|
Eigen::Matrix4f m_orthoProjMatrix;
|
2020-05-12 09:51:25 -06:00
|
|
|
const Eigen::Matrix4f *m_modelViewPtr { &m_modelMatrix };
|
|
|
|
const Eigen::Matrix4f *m_projectionPtr { &m_projMatrix };
|
2001-11-27 18:50:04 -07:00
|
|
|
|
2018-10-30 12:57:10 -06:00
|
|
|
bool useCompressedTextures{ false };
|
2002-02-13 13:38:49 -07:00
|
|
|
unsigned int textureResolution;
|
2004-03-15 11:51:16 -07:00
|
|
|
DetailOptions detailOptions;
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2018-07-03 10:52:34 -06:00
|
|
|
uint32_t frameCount;
|
2007-10-25 01:18:53 -06:00
|
|
|
|
2018-10-30 12:57:10 -06:00
|
|
|
int currentIntervalIndex{ 0 };
|
2020-06-14 10:06:05 -06:00
|
|
|
|
|
|
|
struct State
|
2019-10-08 14:00:19 -06:00
|
|
|
{
|
2020-06-14 10:06:05 -06:00
|
|
|
bool blending : 1;
|
|
|
|
bool scissor : 1;
|
|
|
|
bool multisample : 1;
|
2020-07-07 11:00:08 -06:00
|
|
|
bool depthMask : 1;
|
|
|
|
bool depthTest : 1;
|
2019-10-08 14:00:19 -06:00
|
|
|
|
2020-06-14 10:06:05 -06:00
|
|
|
GLenum sfactor, dfactor; // blending
|
|
|
|
};
|
2020-07-07 11:00:08 -06:00
|
|
|
State m_GLState { false, false, false, false, false };
|
2008-04-30 12:31:30 -06:00
|
|
|
|
2007-10-25 01:18:53 -06:00
|
|
|
private:
|
2009-08-06 21:15:26 -06:00
|
|
|
typedef std::map<const Orbit*, CurvePlot*> OrbitCache;
|
2007-10-25 01:18:53 -06:00
|
|
|
OrbitCache orbitCache;
|
2018-07-03 10:52:34 -06:00
|
|
|
uint32_t lastOrbitCacheFlush;
|
2002-04-25 21:49:43 -06:00
|
|
|
|
|
|
|
float minOrbitSize;
|
2002-09-08 21:50:37 -06:00
|
|
|
float distanceLimit;
|
2003-06-18 12:35:59 -06:00
|
|
|
float minFeatureSize;
|
2018-11-05 11:44:39 -07:00
|
|
|
uint64_t locationFilter;
|
2003-05-25 20:27:27 -06:00
|
|
|
|
|
|
|
SkyVertex* skyVertices;
|
2018-07-03 10:52:34 -06:00
|
|
|
uint32_t* skyIndices;
|
2003-05-25 20:27:27 -06:00
|
|
|
SkyContourPoint* skyContour;
|
2004-09-19 21:27:50 -06:00
|
|
|
|
|
|
|
const ColorTemperatureTable* colorTemp;
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2006-09-07 23:59:38 -06:00
|
|
|
Selection highlightObject;
|
2006-12-11 18:29:27 -07:00
|
|
|
|
2007-11-15 13:08:24 -07:00
|
|
|
bool settingsChanged;
|
2007-10-10 19:32:04 -06:00
|
|
|
|
2019-12-03 04:11:10 -07:00
|
|
|
AsterismRenderer* m_asterismRenderer { nullptr };
|
2019-12-03 04:46:48 -07:00
|
|
|
BoundariesRenderer* m_boundariesRenderer { nullptr };
|
2019-12-03 04:11:10 -07:00
|
|
|
|
2008-04-30 12:31:30 -06:00
|
|
|
// True if we're in between a begin/endObjectAnnotations
|
|
|
|
bool objectAnnotationSetOpen;
|
2008-09-25 12:31:48 -06:00
|
|
|
|
2018-10-30 12:57:10 -06:00
|
|
|
double realTime{ true };
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2020-03-14 04:48:24 -06:00
|
|
|
// Maximum size of a solar system in light years. Features beyond this distance
|
|
|
|
// will not necessarily be rendered correctly. This limit is used for
|
|
|
|
// visibility culling of solar systems.
|
|
|
|
float SolarSystemMaxDistance{ 1.0f };
|
2018-11-22 13:26:50 -07:00
|
|
|
|
2019-11-29 03:53:38 -07:00
|
|
|
// Size of a texture used in shadow mapping
|
|
|
|
unsigned m_shadowMapSize { 0 };
|
|
|
|
std::unique_ptr<FramebufferObject> m_shadowFBO;
|
|
|
|
|
2020-03-14 04:48:24 -06:00
|
|
|
std::array<celgl::VertexObject*, static_cast<size_t>(VOType::Count)> m_VertexObjects;
|
2018-11-22 13:26:50 -07:00
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
// Location markers
|
2008-09-22 15:03:43 -06:00
|
|
|
public:
|
2021-05-22 01:10:05 -06:00
|
|
|
celestia::MarkerRepresentation mountainRep;
|
|
|
|
celestia::MarkerRepresentation craterRep;
|
|
|
|
celestia::MarkerRepresentation observatoryRep;
|
|
|
|
celestia::MarkerRepresentation cityRep;
|
|
|
|
celestia::MarkerRepresentation genericLocationRep;
|
|
|
|
celestia::MarkerRepresentation galaxyRep;
|
|
|
|
celestia::MarkerRepresentation nebulaRep;
|
|
|
|
celestia::MarkerRepresentation openClusterRep;
|
|
|
|
celestia::MarkerRepresentation globularRep;
|
2008-04-30 12:31:30 -06:00
|
|
|
|
2008-01-19 15:21:56 -07:00
|
|
|
std::list<RendererWatcher*> watchers;
|
|
|
|
|
2007-10-10 19:32:04 -06:00
|
|
|
public:
|
|
|
|
// Colors for all lines and labels
|
2007-10-13 05:08:13 -06:00
|
|
|
static Color StarLabelColor;
|
|
|
|
static Color PlanetLabelColor;
|
2008-04-15 12:31:53 -06:00
|
|
|
static Color DwarfPlanetLabelColor;
|
2007-10-13 05:08:13 -06:00
|
|
|
static Color MoonLabelColor;
|
2008-04-15 12:31:53 -06:00
|
|
|
static Color MinorMoonLabelColor;
|
2007-10-13 05:08:13 -06:00
|
|
|
static Color AsteroidLabelColor;
|
|
|
|
static Color CometLabelColor;
|
|
|
|
static Color SpacecraftLabelColor;
|
|
|
|
static Color LocationLabelColor;
|
|
|
|
static Color GalaxyLabelColor;
|
2018-03-11 07:12:58 -06:00
|
|
|
static Color GlobularLabelColor;
|
|
|
|
static Color NebulaLabelColor;
|
2007-10-13 05:08:13 -06:00
|
|
|
static Color OpenClusterLabelColor;
|
|
|
|
static Color ConstellationLabelColor;
|
|
|
|
static Color EquatorialGridLabelColor;
|
2008-03-20 15:36:17 -06:00
|
|
|
static Color PlanetographicGridLabelColor;
|
2008-05-29 15:52:27 -06:00
|
|
|
static Color GalacticGridLabelColor;
|
|
|
|
static Color EclipticGridLabelColor;
|
|
|
|
static Color HorizonGridLabelColor;
|
2007-10-13 05:08:13 -06:00
|
|
|
|
|
|
|
static Color StarOrbitColor;
|
|
|
|
static Color PlanetOrbitColor;
|
2008-04-15 12:31:53 -06:00
|
|
|
static Color DwarfPlanetOrbitColor;
|
2007-10-13 05:08:13 -06:00
|
|
|
static Color MoonOrbitColor;
|
2008-04-15 12:31:53 -06:00
|
|
|
static Color MinorMoonOrbitColor;
|
2007-10-13 05:08:13 -06:00
|
|
|
static Color AsteroidOrbitColor;
|
|
|
|
static Color CometOrbitColor;
|
|
|
|
static Color SpacecraftOrbitColor;
|
|
|
|
static Color SelectionOrbitColor;
|
|
|
|
|
|
|
|
static Color ConstellationColor;
|
|
|
|
static Color BoundaryColor;
|
|
|
|
static Color EquatorialGridColor;
|
2008-03-20 15:36:17 -06:00
|
|
|
static Color PlanetographicGridColor;
|
|
|
|
static Color PlanetEquatorColor;
|
2008-05-29 15:52:27 -06:00
|
|
|
static Color GalacticGridColor;
|
|
|
|
static Color EclipticGridColor;
|
|
|
|
static Color HorizonGridColor;
|
2008-06-06 19:35:24 -06:00
|
|
|
static Color EclipticColor;
|
2008-09-25 12:31:48 -06:00
|
|
|
|
|
|
|
static Color SelectionCursorColor;
|
2001-11-27 18:50:04 -07:00
|
|
|
};
|
|
|
|
|
2008-01-19 15:21:56 -07:00
|
|
|
|
|
|
|
class RendererWatcher
|
|
|
|
{
|
|
|
|
public:
|
2008-01-24 01:39:30 -07:00
|
|
|
RendererWatcher() {};
|
|
|
|
virtual ~RendererWatcher() {};
|
|
|
|
|
2008-01-19 15:21:56 -07:00
|
|
|
virtual void notifyRenderSettingsChanged(const Renderer*) = 0;
|
|
|
|
};
|