gtsam_points
Loading...
Searching...
No Matches
primitives.hpp
Go to the documentation of this file.
1#ifndef GLK_PRIMITIVES_HPP
2#define GLK_PRIMITIVES_HPP
3
4#include <glk/drawable.hpp>
5#include <glk/api_export.hpp>
6
7namespace glk {
8
9class Primitives {
10private:
11 Primitives() { meshes.resize(NUM_PRIMITIVES, nullptr); }
12
13public:
32
33 static Primitives* instance() {
34 if (instance_ == nullptr) {
35 instance_ = new Primitives();
36 }
37 return instance_;
38 }
39
40 static const glk::Drawable& primitive(PrimitiveType type) { return Primitives::instance()->create_primitive(type); }
41
42 static glk::Drawable::ConstPtr primitive_ptr(PrimitiveType type) { return Primitives::instance()->create_primitive_ptr(type); }
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
72private:
73 const glk::Drawable& create_primitive(PrimitiveType type);
74 std::shared_ptr<glk::Drawable> create_primitive_ptr(PrimitiveType type);
75
76private:
77 GLK_API static Primitives* instance_;
78
79 std::vector<std::shared_ptr<glk::Drawable>> meshes;
80};
81} // namespace glk
82
83#endif
#define GLK_API
Definition api_export.hpp:4
Definition drawable.hpp:12
std::shared_ptr< const Drawable > ConstPtr
Definition drawable.hpp:15
Definition primitives.hpp:9
PrimitiveType
Definition primitives.hpp:14
@ WIRE_FRUSTUM
Definition primitives.hpp:29
@ FRUSTUM
Definition primitives.hpp:23
@ WIRE_CONE
Definition primitives.hpp:27
@ COORDINATE_SYSTEM
Definition primitives.hpp:20
@ BUNNY
Definition primitives.hpp:22
@ CONE
Definition primitives.hpp:18
@ WIRE_SPHERE
Definition primitives.hpp:25
@ WIRE_ICOSAHEDRON
Definition primitives.hpp:24
@ GRID
Definition primitives.hpp:19
@ SOLID_COORDINATE_SYSTEM
Definition primitives.hpp:21
@ WIRE_CUBE
Definition primitives.hpp:26
@ WIRE_BUNNY
Definition primitives.hpp:28
@ SPHERE
Definition primitives.hpp:16
@ CUBE
Definition primitives.hpp:17
@ NUM_PRIMITIVES
Definition primitives.hpp:30
@ ICOSAHEDRON
Definition primitives.hpp:15
static glk::Drawable::ConstPtr wire_cube()
Definition primitives.hpp:64
static glk::Drawable::ConstPtr cone()
Definition primitives.hpp:50
static glk::Drawable::ConstPtr solid_coordinate_system()
Definition primitives.hpp:56
static glk::Drawable::ConstPtr sphere()
Definition primitives.hpp:46
static const glk::Drawable & primitive(PrimitiveType type)
Definition primitives.hpp:40
static Primitives * instance()
Definition primitives.hpp:33
static glk::Drawable::ConstPtr cube()
Definition primitives.hpp:48
static glk::Drawable::ConstPtr primitive_ptr(PrimitiveType type)
Definition primitives.hpp:42
static glk::Drawable::ConstPtr wire_frustum()
Definition primitives.hpp:70
static glk::Drawable::ConstPtr frustum()
Definition primitives.hpp:52
static glk::Drawable::ConstPtr wire_icosahedron()
Definition primitives.hpp:60
static glk::Drawable::ConstPtr wire_sphere()
Definition primitives.hpp:62
static glk::Drawable::ConstPtr coordinate_system()
Definition primitives.hpp:54
static glk::Drawable::ConstPtr bunny()
Definition primitives.hpp:58
static glk::Drawable::ConstPtr wire_cone()
Definition primitives.hpp:66
static glk::Drawable::ConstPtr icosahedron()
Definition primitives.hpp:44
static glk::Drawable::ConstPtr wire_bunny()
Definition primitives.hpp:68
Definition async_buffer_copy.hpp:6