1 #ifndef BLANK_MODEL_COLLISIONBOUNDS_HPP_
2 #define BLANK_MODEL_COLLISIONBOUNDS_HPP_
4 #include "../graphics/PrimitiveMesh.hpp"
5 #include "../graphics/glm.hpp"
13 struct CollisionBounds {
15 /// the number of vertices this shape's outline has
16 std::size_t OutlineCount() const { return out_pos.size(); }
17 /// the number of vertex indices this shape's outline has
18 std::size_t OutlineIndexCount() const { return out_idx.size(); }
20 /// fill given buffers with these bounds' outline's elements
21 void Outline(PrimitiveMesh::Buffer &out) const;
23 /// Check if given ray would pass though this shape if it were
24 /// transformed with given matrix.
25 /// If true, dist and normal hold the intersection distance and
26 /// normal, otherwise their content is undefined.
27 virtual bool Intersects(
34 /// Check for intersection with given OBB.
35 /// The OBB is defined by box and box_M, M is applied to the shape.
36 virtual bool Intersects(
39 const glm::mat4 &box_M,
46 const PrimitiveMesh::Positions &pos,
47 const PrimitiveMesh::Indices &idx);
50 PrimitiveMesh::Positions out_pos;
51 PrimitiveMesh::Indices out_idx;