-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProjectorDlg.h
130 lines (103 loc) · 3.24 KB
/
ProjectorDlg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include "resource.h"
class C3DObject;
class C3DGlyph;
class C3DWord;
class C3DStar;
#include "3DProjectorimpl.h"
#include "AudioPlayer.h"
class CProjectorDlg
: public CDialogImpl<CProjectorDlg>
, public C3DProjectorImpl
, protected local_utils::CMyThread
, protected CAudioPlayer
{
public:
CProjectorDlg();
~CProjectorDlg();
enum { IDD = IDD_PREVIEW };
BEGIN_MSG_MAP_EX(CMainDlg)
MSG_WM_INITDIALOG(OnInitDialog)
COMMAND_ID_HANDLER_EX(IDOK, OnClose)
COMMAND_ID_HANDLER_EX(IDCANCEL, OnClose)
MSG_WM_TIMER(OnTimer)
CHAIN_MSG_MAP(C3DProjectorImpl)
END_MSG_MAP()
LRESULT OnInitDialog(HWND, LPARAM);
void OnClose(UINT, int, HWND);
void OnTimer(UINT_PTR);
protected:
void PolyDraw(uint8_t* frameBuffer, const PolyPoint* polyPoints, size_t count, double r, double g, double b, double alpha) override;
void OnEvent() override;
void OnPlayAudio(uint8_t* pStream, ULONG dwLen) override;
private:
void StopAudio();
bool CreateScene();
void MoveScene(int nSteps = 1);
void PlayPause();
void AddTextBlock(std::wstring strTextBlock, bool bCenter, glm::dvec3& posLeftBorder, const glm::dvec3& posRightBorder, const glm::dvec3& boundsSpace, double lfVOffsetFactor = 1.5);
void RenderImGui();
int GetProgress() const;
void RandomizeStar(std::shared_ptr<C3DStar>& star);
public:
UINT GetScrollSpeed() const;
void SetScrollSpeed(UINT v);
UINT GetFlightSpeed() const;
void SetFlightSpeed(UINT v);
public:
int m_nWidth;
int m_nHeight;
std::wstring m_strHeadline;
std::wstring m_strMessage;
float m_lfViewAngle;
LOGFONT m_LogFont;
double m_lfFontScale;
int m_nStarCount;
bool m_bExportMode;
bool m_bHeadupDisplay; // ImGui Controls (yes/no)
std::wstring m_strExportFile;
std::wstring m_strAudioFile;
bool m_bWithAudio;
bool m_bSuccess;
double m_lfVideoLenInSeconds;
double m_lfFramesPerSecond;
std::wstring m_strVCodec;
private:
double m_lfScrollSpeed;
double m_lfFlightSpeed;
CProgressBarCtrl m_ctlProgress;
int m_nBitPlaneCount;
std::atomic_int m_nFrameCounter{ 0 };
int m_nFramesTotal;
__declspec(property(get=GetProgress)) int m_nProgress;
const glm::dvec3 m_vecUp;
glm::dvec4 m_posCam;
glm::dvec4 m_posView;
glm::dmat4 m_matScroll;
glm::dmat4 m_matFlight;
std::list< std::shared_ptr<C3DWord> > m_listWords;
std::list< std::shared_ptr<C3DStar> > m_listStars;
class frame_buffer_t
{
public:
frame_buffer_t(int nWidth, int nHeight, int nBitplaneCount);
~frame_buffer_t();
operator uint8_t *()
{
return m_pFrameBuffer;
}
public:
const SIZE sz;
const int bits;
HBITMAP hbmp;
uint8_t* m_pFrameBuffer;
};
local_utils::CMyQueue< std::shared_ptr< frame_buffer_t > > m_qInput;
local_utils::CMyQueue< std::shared_ptr< frame_buffer_t > > m_qOutput;
CHandle m_hVideoEncoder;
CHandle m_hVideoData;
CHandle m_hAudioDecoder;
local_utils::CTemporaryFile m_fileTemp;
std::atomic_bool m_bPaused{ false };
UINT m_nRandSeed;
};