1 #ifndef BLANK_MODEL_SHAPE_HPP_
2 #define BLANK_MODEL_SHAPE_HPP_
4 #include "CollisionBounds.hpp"
5 #include "geometry.hpp"
6 #include "../graphics/BlockMesh.hpp"
7 #include "../graphics/EntityMesh.hpp"
8 #include "../world/Block.hpp"
12 #include <glm/glm.hpp>
17 class TokenStreamReader;
23 bool face[Block::FACE_COUNT];
24 Faces &operator =(const Faces &other) noexcept {
25 for (int i = 0; i < Block::FACE_COUNT; ++i) {
26 face[i] = other.face[i];
30 bool operator [](Block::Face f) const noexcept {
39 void Read(TokenStreamReader &);
41 bool FaceFilled(Block::Face face) const noexcept {
45 std::size_t VertexCount() const noexcept { return vertices.size(); }
46 std::size_t IndexCount() const noexcept { return indices.size(); }
48 const glm::vec3 &VertexNormal(size_t idx) const noexcept {
49 return vertices[idx].normal;
51 glm::vec3 VertexNormal(size_t idx, const glm::mat4 &M) const noexcept {
52 return glm::vec3(M * glm::vec4(VertexNormal(idx), 0.0f));
57 const std::vector<float> &tex_map
61 const glm::mat4 &transform,
62 const std::vector<float> &tex_map
66 const glm::mat4 &transform,
67 const std::vector<float> &tex_map,
68 std::size_t idx_offset = 0
71 size_t OutlineCount() const noexcept;
72 size_t OutlineIndexCount() const noexcept;
73 void Outline(OutlineMesh::Buffer &out) const;
84 const glm::mat4 &box_M,
90 static float TexR(const std::vector<float> &, std::size_t) noexcept;
93 std::unique_ptr<CollisionBounds> bounds;
100 std::vector<Vertex> vertices;
101 std::vector<std::size_t> indices;