RayZaler 0.1
The free opto-mechanical simulation framework
PhaseScreen.h
1//
2// Copyright (c) 2024 Gonzalo José Carracedo Carballal
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as
6// published by the Free Software Foundation, either version 3 of the
7// License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public
15// License along with this program. If not, see
16// <http://www.gnu.org/licenses/>
17//
18
19#ifndef _PHASE_SCREEN_H
20#define _PHASE_SCREEN_H
21
22#include <OpticalElement.h>
23#include <MediumBoundaries/PhaseScreen.h>
24#include <GLHelpers.h>
25
26namespace RZ {
27 class TranslatedFrame;
28
29 class PhaseScreen : public OpticalElement {
30 PhaseScreenBoundary *m_boundary;
31 GLDisc m_skyDiscFront;
32 GLDisc m_skyDiscBack;
33
34 TranslatedFrame *m_tSurface = nullptr;
35 Real m_muIn = 1;
36 Real m_muOut = 1.5;
37 Real m_radius = 2.5e-2;
38
39 GLuint m_textureId;
40 std::vector<uint8_t> m_textureData;
41 bool m_texDirty = true;
42
43 void uploadTexture();
44 void recalcModel();
45 void recalcTexture();
46
47 protected:
48 virtual bool propertyChanged(std::string const &, PropertyValue const &) override;
49
50 public:
53 std::string const &,
55 Element *parent = nullptr);
56
57 virtual ~PhaseScreen() override;
58
59 virtual void enterOpenGL() override;
60 virtual void nativeMaterialOpenGL(std::string const &role) override;
61 virtual void renderOpenGL() override;
62 };
63
64 RZ_DECLARE_OPTICAL_ELEMENT(PhaseScreen);
65}
66
67
68#endif // _PHASE_SCREEN_H
Definition: Element.h:393
Definition: Element.h:173
Definition: GLHelpers.h:100
Definition: OpticalElement.h:87
Definition: PhaseScreen.h:27
Definition: PhaseScreen.h:29
Definition: Element.h:58
Definition: ReferenceFrame.h:59
Definition: TranslatedFrame.h:25