OGLplus  (0.59.0) a C++ wrapper for rendering APIs

resources.hpp
1 
9 #ifndef OGLPLUS_EXAMPLE_RESOURCES_HPP // NOLINT(llvm-header-guard)
10 #define OGLPLUS_EXAMPLE_RESOURCES_HPP
11 
12 #include <oglplus/gl.hpp>
13 #include <oglplus/gl_api.hpp>
14 
17 
18 namespace eagine::application {
19 class example;
20 //------------------------------------------------------------------------------
21 // volume_domain
22 //------------------------------------------------------------------------------
23 class volume_domain {
24 public:
25  void init(example&);
26  void compute(example&);
27  void draw(example&);
28 
29  constexpr auto plane_count() const noexcept -> int {
30  return 64;
31  }
32 
33  constexpr auto div_count() const noexcept -> int {
34  return plane_count() - 1;
35  }
36 
37  constexpr auto cube_count() const noexcept -> int {
38  return div_count() * div_count() * div_count();
39  }
40 
41  constexpr auto vertex_count() const noexcept -> int {
42  return plane_count() * plane_count() * plane_count();
43  }
44 
45  static auto corner_loc() noexcept {
47  }
48 
49  static auto field_binding() noexcept {
50  return 0U;
51  }
52 
53  static auto metaballs_binding() noexcept {
54  return 1U;
55  }
56 
57  static auto configs_binding() noexcept {
58  return 2U;
59  }
60 
61 private:
62  oglp::owned_vertex_array_name _tetrahedrons;
63  oglp::owned_buffer_name _corners;
64  oglp::owned_buffer_name _indices;
65 
66  oglp::owned_buffer_name _field;
67  oglp::owned_buffer_name _metaballs;
68  oglp::owned_buffer_name _configs;
69 };
70 //------------------------------------------------------------------------------
71 // programs
72 //------------------------------------------------------------------------------
73 class metaball_program {
74 public:
75  void init(example&);
76  void prepare_frame(example&);
77  void use(example&);
78 
79  void bind_metaballs(example&, oglp::gl_types::uint_type);
80 
81 private:
83 };
84 //------------------------------------------------------------------------------
85 class field_program {
86 public:
87  void init(example&);
88  void prepare_frame(example&);
89  void use(example&);
90 
91  void bind_field(example&, oglp::gl_types::uint_type);
92  void bind_metaballs(example&, oglp::gl_types::uint_type);
93  void set_plane_count(example&, oglp::gl_types::int_type);
94 
95 private:
97  oglp::uniform_location _plane_count_loc;
98 };
99 //------------------------------------------------------------------------------
100 class surface_program {
101 public:
102  void init(example&);
103  void prepare_frame(example&);
104  void bind_corner_location(example&, oglp::vertex_attrib_location);
105  void use(example&);
106 
107  void bind_field(example&, oglp::gl_types::uint_type);
108  void bind_configs(example&, oglp::gl_types::uint_type);
109  void set_plane_count(example&, oglp::gl_types::int_type);
110  void set_div_count(example&, oglp::gl_types::int_type);
111 
112 private:
114  oglp::uniform_location _camera_mat_loc;
115  oglp::uniform_location _perspective_mat_loc;
116  oglp::uniform_location _plane_count_loc;
117  oglp::uniform_location _div_count_loc;
118 };
119 //------------------------------------------------------------------------------
120 } // namespace eagine::application
121 
122 #endif
Application harness / wrapper code is placed in this namespace.
Definition: eagine.hpp:72
prog_var_location< EAGINE_ID_V(Uniform)> uniform_location
Alias for shader program uniform location wrapper.
Definition: prog_var_loc.hpp:115
GLint int_type
Signed integer type.
Definition: config.hpp:70
GLuint uint_type
Unsigned integer type.
Definition: config.hpp:73
gl_owned_object_name< vertex_array_tag > owned_vertex_array_name
Alias for owned GL vertex array object handle.
Definition: object_name.hpp:224
prog_var_location< EAGINE_ID_V(VertexAttr)> vertex_attrib_location
Alias for program vertex attribute location wrapper.
Definition: prog_var_loc.hpp:104
gl_owned_object_name< program_tag > owned_program_name
Alias for owned GL program object handle.
Definition: object_name.hpp:188

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).