X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FShape.hpp;h=c6964f9c410110d10e4ed48933b07bce0512eb42;hb=bfa8d0303d57e62fb73dad96d1b521760d475cf8;hp=39dd50f3b93048ad2edfe999113cf4e8fa4b13d5;hpb=bc1cefd505bf1f34639b8839cb337b08310ceb8e;p=blank.git diff --git a/src/model/Shape.hpp b/src/model/Shape.hpp index 39dd50f..c6964f9 100644 --- a/src/model/Shape.hpp +++ b/src/model/Shape.hpp @@ -2,7 +2,7 @@ #define BLANK_MODEL_SHAPE_HPP_ #include "BlockModel.hpp" -#include "Model.hpp" +#include "EntityModel.hpp" #include "OutlineModel.hpp" #include @@ -21,26 +21,26 @@ struct Shape { /// the number of vertex indices this shape has size_t VertexIndexCount() const noexcept { return vtx_idx.size(); } - const Model::Normal &VertexNormal(size_t idx) const noexcept { return vtx_nrm[idx]; } - Model::Normal VertexNormal( + const EntityModel::Normal &VertexNormal(size_t idx) const noexcept { return vtx_nrm[idx]; } + EntityModel::Normal VertexNormal( size_t idx, const glm::mat4 &transform ) const noexcept { - return Model::Normal(transform * glm::vec4(vtx_nrm[idx], 0.0f)); + return EntityModel::Normal(transform * glm::vec4(vtx_nrm[idx], 0.0f)); } /// fill given buffers with this shape's elements with an /// optional transform and offset void Vertices( - Model::Positions &vertex, - Model::Normals &normal, - Model::Indices &index + EntityModel::Positions &vertex, + EntityModel::Normals &normal, + EntityModel::Indices &index ) const; void Vertices( - Model::Positions &vertex, - Model::Normals &normal, - Model::Indices &index, + EntityModel::Positions &vertex, + EntityModel::Normals &normal, + EntityModel::Indices &index, const glm::mat4 &transform, - Model::Index idx_offset = 0 + EntityModel::Index idx_offset = 0 ) const; void Vertices( BlockModel::Positions &vertex, @@ -79,11 +79,13 @@ struct Shape { virtual bool Intersects( const glm::mat4 &M, const AABB &box, - const glm::mat4 &box_M + const glm::mat4 &box_M, + float &depth, + glm::vec3 &normal ) const noexcept = 0; protected: - void SetShape(const Model::Positions &pos, const Model::Normals &nrm, const Model::Indices &idx) { + void SetShape(const EntityModel::Positions &pos, const EntityModel::Normals &nrm, const EntityModel::Indices &idx) { vtx_pos = pos; vtx_nrm = nrm; vtx_idx = idx; @@ -94,9 +96,9 @@ protected: } private: - Model::Positions vtx_pos; - Model::Normals vtx_nrm; - Model::Indices vtx_idx; + EntityModel::Positions vtx_pos; + EntityModel::Normals vtx_nrm; + EntityModel::Indices vtx_idx; OutlineModel::Positions out_pos; OutlineModel::Indices out_idx;