Euphoria
uniform_buffer.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace eu
6{
7 struct m4;
8}
9
10namespace eu::render
11{
12
17enum class UniformType
18{
19 invalid,
23 vec2,
24 vec3,
25 vec4,
26 mat4
27};
28
30{
31 int size = 512;
33 std::string name;
34 std::string source;
35};
36
44
54
56{
57 void add(CompiledUniformProp* target, UniformType type, const std::string& name, int array_count = 1);
58
59 [[nodiscard]]
60 UniformBufferSetup compile(const std::string& name, int binding_point) const;
61
62 std::vector<UniformProp> props;
63};
64
66{
69
70 void set_mat4(const CompiledUniformProp& prop, const m4& m);
71
72 UniformBuffer(const UniformBuffer&) = delete;
73 void operator=(const UniformBuffer&) = delete;
74
77
78 // clears the loaded buffer to a invalid buffer
79 void unload();
80
81 unsigned int id;
82};
83
96
101} // namespace klotter
#define DEBUG_LABEL_ARG_MANY
first debug label argument of many
#define DEBUG_LABEL_EXPLICIT_MANY
optional explicit for when the constructor only takes one more argument and needs to be explicit if t...
Definition assert.h:111
A (inclusive) range between two values.
Definition range.h:19
4x4 matrix
Definition mat4.h:19
BoundUniformBuffer(BoundUniformBuffer &&)=delete
void operator=(const BoundUniformBuffer &)=delete
BoundUniformBuffer(const BoundUniformBuffer &)=delete
void operator=(BoundUniformBuffer &&)=delete
BoundUniformBuffer(UniformBuffer *b)
A compiled uniform buffer property that can be used in a shader.
UniformBufferSetup compile(const std::string &name, int binding_point) const
std::vector< UniformProp > props
void add(CompiledUniformProp *target, UniformType type, const std::string &name, int array_count=1)
UniformBuffer(UniformBuffer &&) noexcept
void operator=(const UniformBuffer &)=delete
DEBUG_LABEL_EXPLICIT_MANY UniformBuffer(DEBUG_LABEL_ARG_MANY const UniformBufferSetup &setup)
void set_mat4(const CompiledUniformProp &prop, const m4 &m)
UniformBuffer(const UniformBuffer &)=delete
CompiledUniformProp * target