namespace blank {
+size_t NullShape::VertexCount() const {
+ return 0;
+}
+
+void NullShape::Vertices(std::vector<glm::vec3> &out, const glm::vec3 &pos) const {
+
+}
+
+void NullShape::Normals(std::vector<glm::vec3> &out) const {
+
+}
+
+size_t NullShape::OutlineCount() const {
+ return 0;
+}
+
+void NullShape::Outline(std::vector<glm::vec3> &out, const glm::vec3 &pos) const {
+
+}
+
+bool NullShape::Intersects(const Ray &, const glm::mat4 &, float &, glm::vec3 &) const {
+ return false;
+}
+
+
CuboidShape::CuboidShape(const AABB &b)
: Shape()
, bb(b) {
};
+class NullShape
+: public Shape {
+
+public:
+ size_t VertexCount() const override;
+ void Vertices(std::vector<glm::vec3> &, const glm::vec3 &) const override;
+ void Normals(std::vector<glm::vec3> &) const override;
+
+ size_t OutlineCount() const override;
+ void Outline(std::vector<glm::vec3> &, const glm::vec3 &) const override;
+
+ bool Intersects(const Ray &, const glm::mat4 &, float &, glm::vec3 &) const override;
+
+};
+
+
class CuboidShape
: public Shape {
namespace blank {
const BlockType BlockType::DEFAULT;
-const CuboidShape BlockType::DEFAULT_SHAPE({{ 0, 0, 0 }, { 1, 1, 1 }});
+const NullShape BlockType::DEFAULT_SHAPE;
void BlockType::FillVBO(
const glm::vec3 &pos,
int Chunk::VertexCount() const {
- // TODO: query blocks as soon as type shapes are implemented
int count = 0;
for (const auto &block : blocks) {
count += block.type->shape->VertexCount();
model.Reserve(VertexCount());
for (size_t i = 0; i < Size(); ++i) {
- if (blocks[i].type->visible) {
- blocks[i].type->FillModel(ToCoords(i), model);
- }
+ blocks[i].type->FillModel(ToCoords(i), model);
}
model.Invalidate();
: id(-1), visible(v), shape(shape), color(color), outline_color(outline_color) { }
static const BlockType DEFAULT;
- static const CuboidShape DEFAULT_SHAPE;
+ static const NullShape DEFAULT_SHAPE;
void FillVBO(