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 // particles
22 //------------------------------------------------------------------------------
23 class particles {
24 public:
25  void init(example&);
26  void emit(example&);
27  void draw(example&);
28 
29  static auto origin_loc() noexcept {
31  }
32 
33  static auto cursors_binding() noexcept {
34  return 0U;
35  }
36 
37  static auto random_binding() noexcept {
38  return 0U;
39  }
40 
41  static auto offsets_binding() noexcept {
42  return 1U;
43  }
44 
45  static auto velocities_binding() noexcept {
46  return 2U;
47  }
48 
49  static auto ages_binding() noexcept {
50  return 3U;
51  }
52 
53 private:
54  const unsigned _count{4096U};
55 
57 
58  oglp::owned_buffer_name _origin;
59  oglp::owned_buffer_name _cursors;
60  oglp::owned_buffer_name _random;
61  oglp::owned_buffer_name _offsets;
62  oglp::owned_buffer_name _velocities;
63  oglp::owned_buffer_name _ages;
64 };
65 //------------------------------------------------------------------------------
66 // programs
67 //------------------------------------------------------------------------------
68 class emit_program {
69 public:
70  void init(example&);
71  void prepare_frame(example&);
72  void bind_random(example&, oglp::gl_types::uint_type);
73  void bind_offsets(example&, oglp::gl_types::uint_type);
74  void bind_velocities(example&, oglp::gl_types::uint_type);
75  void bind_ages(example&, oglp::gl_types::uint_type);
76  void use(example&);
77 
78 private:
80  oglp::uniform_location _emit_position_loc;
81  oglp::uniform_location _delta_time_loc;
82 };
83 //------------------------------------------------------------------------------
84 class draw_program {
85 public:
86  void init(example&);
87  void prepare_frame(example&);
88  void bind_origin_location(example&, oglp::vertex_attrib_location);
89  void bind_offsets(example&, oglp::gl_types::uint_type);
90  void bind_ages(example&, oglp::gl_types::uint_type);
91  void use(example&);
92 
93 private:
95  oglp::uniform_location _camera_mat_loc;
96  oglp::uniform_location _perspective_mat_loc;
97 };
98 //------------------------------------------------------------------------------
99 } // namespace eagine::application
100 
101 #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
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).