nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
postprocess.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_POSTPROCESS_H_
2#define NANOMMO_CLIENT_POSTPROCESS_H_
3
4#include <raylib.h>
5
6#include <array>
7
8#include "client/graphics.h"
9
10namespace nanommo {
11
12/// What the world goes through on its way to the screen. The renderer draws
13/// it into a frame of our own, a render texture, and the frame goes to the
14/// screen from there, so that shaders can work on the whole picture first. The
15/// GUI goes on top, as it is.
17 public:
20
21 PostProcess(const PostProcess&) = delete;
23
24 /// What's drawn from here goes into the frame, until End, and Draw puts it
25 /// on the screen as the settings say.
26 void Begin(const GraphicsSettings& graphics);
27 /// Into a frame of that many pixels, whatever the window's size, as for a
28 /// film's.
29 void Begin(const GraphicsSettings& graphics, int width, int height);
30 void End();
31
32 /// Draws the frame to the screen, with bloom if it's on.
33 void Draw();
34 /// Draws the frame into the render texture instead, at its size, as for a
35 /// film's frame. The passes before the last switch to frames of their own,
36 /// so this one picks the render texture itself.
37 void DrawOnto(const RenderTexture2D& into);
38
39 private:
40 /// The bloom's halves of the frame, each half the size of the one before.
41 static constexpr int kHalves = 5;
42
43 void Resize(int width, int height);
44 /// Draws the frame to the render texture, or to the screen without one.
45 void Show(const RenderTexture2D* into);
46 void Bloom();
47 /// Draws the frame with the bloom on top, at a width and a height.
48 void Combine(float width, float height);
49
50 Shader bright_;
51 Shader spread_;
52 Shader combine_;
53 Shader fxaa_;
54 GraphicsSettings graphics_;
55 RenderTexture2D frame_{};
56 std::array<RenderTexture2D, kHalves> halves_{};
57 /// The frame with its bloom, as the screen would show it, for FXAA.
58 RenderTexture2D picture_{};
59};
60
61} // namespace nanommo
62
63#endif // NANOMMO_CLIENT_POSTPROCESS_H_
void DrawOnto(const RenderTexture2D &into)
void Draw()
Draws the frame to the screen, with bloom if it's on.
PostProcess(const PostProcess &)=delete
PostProcess & operator=(const PostProcess &)=delete
void Begin(const GraphicsSettings &graphics)
Definition chat.cc:9