galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
VideoShader.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_RESOURCE_EMBEDDED_VIDEOSHADER_HPP_
9#define GALAXY_RESOURCE_EMBEDDED_VIDEOSHADER_HPP_
10
11namespace galaxy
12{
13 namespace resource
14 {
18 constexpr const auto video_vert_shader = R"(
19 #version 460 core
20
21 layout(location = 0) in vec2 vertex;
22
23 out vec2 io_texels;
24
25 void main()
26 {
27 io_texels = vertex;
28 gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);
29 }
30 )";
31
35 constexpr const auto video_frag_shader = R"(
36 #version 460 core
37
38 in vec2 io_texels;
39 out vec4 io_frag;
40
41 uniform sampler2D u_texture_y;
42 uniform sampler2D u_texture_cb;
43 uniform sampler2D u_texture_cr;
44
45 mat4 rec601 = mat4(
46 1.16438, 0.00000, 1.59603, -0.87079,
47 1.16438, -0.39176, -0.81297, 0.52959,
48 1.16438, 2.01723, 0.00000, -1.08139,
49 0, 0, 0, 1
50 );
51
52 void main()
53 {
54 float y = texture2D(texture_y, tex_coord).r;
55 float cb = texture2D(texture_cb, tex_coord).r;
56 float cr = texture2D(texture_cr, tex_coord).r;
57
58 io_frag = vec4(y, cb, cr, 1.0) * rec601;
59 }
60 )";
61 } // namespace resource
62} // namespace galaxy
63
64#endif
constexpr const auto video_vert_shader
Video vertex shader.
constexpr const auto video_frag_shader
Video frag shader.
Timer.hpp galaxy.
Definition Async.hpp:17