2 #ifndef _BOUNDING_BOX_HPP_ 3 #define _BOUNDING_BOX_HPP_ 7 #include "../util/Program.h" 8 #include "OOOGL/GLobjects/VertexArrayObject.hpp" 9 #include "OOOGL/GLobjects/Buffers.hpp" 10 #include "components/inheritable/drawable.hpp" 16 BoundingBox(
const glm::vec3& min_point,
const glm::vec3& max_point) : min_point(min_point), max_point(max_point) {}
18 virtual void draw(
const MVPset& MVP,
Program* shader =
nullptr)
override;
19 virtual bool canOverrideShader()
const override {
return(
false);}
20 virtual bool requiesOverrideShader()
const {
return(
false);}
21 const glm::vec3 min_point;
22 const glm::vec3 max_point;
25 static std::shared_ptr<Program> _control_point_program;
26 static GLuint _box_vao;
27 static GLuint _box_vbo;
28 static GLuint _box_elements;
29 static GLsizei _box_element_count;
32 static void _init_static_draw_assets_();
33 static bool _static_draw_ready_;
38 DeformationBox(
const glm::vec3& min_point,
const glm::vec3& max_point);
42 virtual void draw(
const MVPset& MVP,
Program* shader =
nullptr)
override;
43 const std::array<glm::vec3, 8>& getControlPoints()
const {
return(control_points);}
44 const glm::vec3& getControlPoint(
size_t index)
const;
45 void setControlPoint(
size_t index,
const glm::vec3& location);
46 void setHighlight(
size_t index,
bool highlight) {highlights[index%8] = highlight ? 1.0f : 0.0f;}
47 void clearHighlight() {
for(
float& f : highlights){f = 0.0f;}}
48 void reset() {control_points = original_points; updateDrawAssets();}
51 void computeInitialControlPoints();
52 void initDrawAssets();
53 void updateDrawAssets();
55 std::array<glm::vec3, 8> control_points;
56 std::array<glm::vec3, 8> original_points;
57 std::array<float, 8> highlights = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
61 GLuint cage_vertices = 0;
63 static std::shared_ptr<Program> _control_point_program;
64 static GLuint _cage_elements;
65 static void _init_static_draw_assets_();
66 static bool _static_draw_ready_;
Definition: BoundingBox.hpp:14
Definition: drawable.hpp:8
Definition: drawable.hpp:14