Euphoria
vfs_defaultshaders.cc
Go to the documentation of this file.
2 
3 #include "base/stringutils.h"
4 #include "log/log.h"
5 #include "io/vfs_path.h"
6 
7 namespace eu::core
8 {
9  void
11  {
13  cat->register_file_string(
14  base.get_file("sprite.vert"),
15  R"STRING(
16  #version 330 core
17 
18  in vec4 vertex; // <vec2 position, vec2 texCoords>
19 
20  out vec2 TexCoords;
21 
22  uniform mat4 model;
23  uniform mat4 projection;
24 
25  uniform vec4 color;
26  uniform vec4 region;
27 
28  void main()
29  {
30  TexCoords = vec2(region.x + vertex.z * (region.y - region.x),
31  region.z + vertex.w * (region.w - region.z));
32  gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);
33  }
34  )STRING");
35  cat->register_file_string(
36  base.get_file("sprite.frag"),
37  R"STRING(
38  #version 330 core
39 
40  in vec2 TexCoords;
41  out vec4 outColor;
42 
43  uniform sampler2D image;
44  uniform vec4 color;
45 
46  void main()
47  {
48  outColor = color * texture(image, TexCoords);
49  }
50  )STRING");
51  }
52 }
ParserBase * base
Definition: argparse.cc:887
void add_default_shaders(io::FileSystem *fs, const io::DirPath &base)
String utility functions.
static std::shared_ptr< ReadRootCatalog > create_and_add(FileSystem *fs)
Definition: vfs.cc:216