cgv
Loading...
Searching...
No Matches
shader_library.h
1
#pragma once
2
3
#include "context.h"
4
#include "shader_program.h"
5
6
#include "lib_begin.h"
7
8
namespace
cgv
{
9
namespace
render {
10
12
class
CGV_API
shader_library
{
13
struct
shader_info {
14
std::string filename;
15
shader_program
prog;
16
shader_compile_options
options;
17
};
18
19
using
shader_lib_map = std::map<std::string, shader_info>;
20
21
public
:
22
void
clear(
context
& ctx);
23
24
bool
add(
const
std::string& name,
const
std::string& file,
const
shader_compile_options
& options = {});
25
26
bool
contains(
const
std::string& name)
const
;
27
28
shader_program
& get(
const
std::string& name);
29
30
shader_compile_options
& get_compile_options(
const
std::string& name);
31
32
shader_lib_map::iterator begin() {
return
shaders.begin(); }
33
shader_lib_map::iterator end() {
return
shaders.end(); }
34
35
static
bool
load(
context
& ctx,
shader_program
& prog,
const
std::string& name,
const
shader_compile_options
& options,
const
std::string& where =
""
);
36
37
static
bool
load(
context
& ctx,
shader_program
& prog,
const
std::string& name,
const
std::string& where =
""
);
38
39
bool
load_all(
context
& ctx,
const
std::string& where =
""
);
40
41
bool
reload(
context
& ctx,
const
std::string& name,
const
shader_compile_options
& options = {},
const
std::string& where =
""
);
42
43
private
:
44
shader_info& get_shader_info(
const
std::string& name);
45
46
shader_lib_map shaders;
47
};
48
49
}
// namespace render
50
}
// namespace cgv
51
52
#include <cgv/config/lib_end.h>
cgv::render::context
base class for all drawables, which is independent of the used rendering API.
Definition
context.h:627
cgv::render::shader_compile_options
Stores preprocessor options used for conditionally compiling shader programs.
Definition
shader_code.h:73
cgv::render::shader_library
provides a shader library that handles shader loading and stores shaders
Definition
shader_library.h:12
cgv::render::shader_program
a shader program combines several shader code fragments to a complete definition of the shading pipel...
Definition
shader_program.h:28
cgv
the cgv namespace
Definition
print.h:11
cgv
render
shader_library.h
Generated by
1.9.8