Instrument Neutral Distributed Interface INDI 2.2.5
sky_renderer.h
Go to the documentation of this file.
1#pragma once
2#include <indiccd.h>
3
4// Configuration parameters for the sky renderer.
5// All fields have sensible defaults; update via setConfig() when INDI properties change.
7{
8 int maxVal = 65000; // ADU ceiling
9 float limitingMag = 11.5f; // magnitude that gives 1 ADU/s at reference aperture
10 float saturationMag = 2.0f; // magnitude that saturates in 1 s
11 float seeing = 3.5f; // atmospheric FWHM (arcsec)
12 float skyGlow = 19.5f; // sky background brightness (magnitudes)
13 float tiltLR = 0.0f; // Left-to-Right tilt: extra defocus (arcsec) at sensor edge
14 float tiltTB = 0.0f; // Top-to-Bottom tilt: extra defocus (arcsec) at sensor edge
15};
16
17// SkyRenderer renders a synthetic sky scene into an INDI::CCDChip frame buffer.
18// It has no INDI::CCD base class and can be used standalone in tests.
19// Both CCDSim and GuideSim own one as a member and delegate DrawCcdFrame work to it.
21{
22 public:
23 SkyRenderer() = default;
24 explicit SkyRenderer(const RenderConfig &cfg) : m_Cfg(cfg) {}
25
26 void setConfig(const RenderConfig &cfg)
27 {
28 m_Cfg = cfg;
29 }
30 const RenderConfig &getConfig() const
31 {
32 return m_Cfg;
33 }
34
35 int maxPix() const
36 {
37 return m_MaxPix;
38 }
39 int minPix() const
40 {
41 return m_MinPix;
42 }
43
44 // Render a complete sky scene into chip's frame buffer.
45 // Returns the number of stars drawn, 0 if the field is empty or renderStars is false,
46 // or -1 if the GSC catalog tool could not be launched.
47 // ra_j2000_deg: field center RA in J2000 degrees [0..360).
48 // dec_j2000_deg: field center Dec in J2000 degrees [-90..90].
49 // rotation_deg: camera position angle from North (degrees).
50 // renderStars: if false, skip GSC catalog lookup and star rendering (use for flat frames).
51 // minSearchRadiusArcmin: if > 0, GSC search radius is clamped to at least this value.
52 int renderFrame(INDI::CCDChip *chip,
53 double ra_j2000_deg,
54 double dec_j2000_deg,
55 double focal_length_mm,
56 double rotation_deg,
57 float exposure_s,
58 bool renderStars = true,
59 double minSearchRadiusArcmin = 0);
60
61 float imageScaleX() const
62 {
63 return m_ImageScaleX;
64 }
65 float imageScaleY() const
66 {
67 return m_ImageScaleY;
68 }
69 void setImageScale(float scaleX, float scaleY)
70 {
71 m_ImageScaleX = scaleX;
72 m_ImageScaleY = scaleY;
73 }
74
75 int drawImageStar(INDI::CCDChip *, float mag, float x, float y, float exp_s);
76
77 void applyReadoutNoise(INDI::CCDChip *chip, int bias, int maxNoise);
78
79 private:
80 RenderConfig m_Cfg;
81 int m_MaxPix {0};
82 int m_MinPix {65000};
83 float m_ImageScaleX {1.0f};
84 float m_ImageScaleY {1.0f};
85
86 double flux(double mag) const;
87 int addToPixel(INDI::CCDChip *, int x, int y, int val);
88 void drawSkyGlow(INDI::CCDChip *, float exp_s);
89};
The CCDChip class provides functionality of a CCD Chip within a CCD.
Definition indiccdchip.h:39
int renderFrame(INDI::CCDChip *chip, double ra_j2000_deg, double dec_j2000_deg, double focal_length_mm, double rotation_deg, float exposure_s, bool renderStars=true, double minSearchRadiusArcmin=0)
void setImageScale(float scaleX, float scaleY)
void applyReadoutNoise(INDI::CCDChip *chip, int bias, int maxNoise)
int drawImageStar(INDI::CCDChip *, float mag, float x, float y, float exp_s)
SkyRenderer()=default
const RenderConfig & getConfig() const
int maxPix() const
void setConfig(const RenderConfig &cfg)
float imageScaleY() const
int minPix() const
SkyRenderer(const RenderConfig &cfg)
float imageScaleX() const
float limitingMag
Definition sky_renderer.h:9
float saturationMag