GfxNode.hpp
1 #pragma once
2 #if SCORE_PLUGIN_GFX
3 
4 #include <Crousti/GpuUtils.hpp>
5 #include <Crousti/Metadatas.hpp>
6 #include <Gfx/Graph/Node.hpp>
7 #include <Gfx/Graph/NodeRenderer.hpp>
8 #include <Gfx/Graph/RenderList.hpp>
9 #include <Gfx/Graph/RenderState.hpp>
10 #include <Gfx/Graph/Uniforms.hpp>
11 
12 #include <avnd/binding/ossia/port_run_preprocess.hpp>
13 #include <avnd/common/for_nth.hpp>
14 
15 namespace oscr
16 {
17 template <typename Info>
18 class ProcessModel;
19 static const constexpr auto generic_texgen_vs = R"_(#version 450
20 layout(location = 0) in vec2 position;
21 layout(location = 1) in vec2 texcoord;
22 
23 layout(binding=3) uniform sampler2D y_tex;
24 layout(location = 0) out vec2 v_texcoord;
25 
26 layout(std140, binding = 0) uniform renderer_t {
27  mat4 clipSpaceCorrMatrix;
28  vec2 renderSize;
29 } renderer;
30 
31 out gl_PerVertex { vec4 gl_Position; };
32 
33 void main()
34 {
35  v_texcoord = texcoord;
36  gl_Position = renderer.clipSpaceCorrMatrix * vec4(position.xy, 0.0, 1.);
37 }
38 )_";
39 
40 static const constexpr auto generic_texgen_fs = R"_(#version 450
41 layout(location = 0) in vec2 v_texcoord;
42 layout(location = 0) out vec4 fragColor;
43 
44 layout(std140, binding = 0) uniform renderer_t {
45 mat4 clipSpaceCorrMatrix;
46 vec2 renderSize;
47 } renderer;
48 
49 layout(binding=3) uniform sampler2D y_tex;
50 
51 
52 void main ()
53 {
54  fragColor = texture(y_tex, v_texcoord);
55 }
56 )_";
57 
58 template <typename Node_T>
59 struct GfxNode;
60 template <typename Node_T>
61 struct GfxRenderer;
62 }
63 #endif