X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2Fshape.cpp;h=e9364bd45498d0f06bea9efa09435998fe502e48;hb=c52405fad9c070e1370f852234c6eb723b52916c;hp=82659437f60fc87506f3847e181494514a99a7cd;hpb=bc1cefd505bf1f34639b8839cb337b08310ceb8e;p=blank.git diff --git a/src/model/shape.cpp b/src/model/shape.cpp index 8265943..e9364bd 100644 --- a/src/model/shape.cpp +++ b/src/model/shape.cpp @@ -5,9 +5,9 @@ namespace blank { void Shape::Vertices( - Model::Positions &vertex, - Model::Normals &normal, - Model::Indices &index + EntityModel::Positions &vertex, + EntityModel::Normals &normal, + EntityModel::Indices &index ) const { for (const auto &pos : vtx_pos) { vertex.emplace_back(pos); @@ -21,11 +21,11 @@ void Shape::Vertices( } void Shape::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 + EntityModel::Index idx_offset ) const { for (const auto &pos : vtx_pos) { vertex.emplace_back(transform * glm::vec4(pos, 1.0f)); @@ -83,7 +83,9 @@ bool NullShape::Intersects( bool NullShape::Intersects( const glm::mat4 &, const AABB &, - const glm::mat4 & + const glm::mat4 &, + float &, + glm::vec3 & ) const noexcept { return false; } @@ -178,9 +180,11 @@ bool CuboidShape::Intersects( bool CuboidShape::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 { - return Intersection(bb, M, box, box_M); + return Intersection(bb, M, box, box_M, depth, normal); } @@ -345,9 +349,12 @@ bool StairShape::Intersects( bool StairShape::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 { - return Intersection(bot, M, box, box_M) || Intersection(top, M, box, box_M); + // TODO: this is wrong, but simple. so for now will have to do + return Intersection(bot, M, box, box_M, depth, normal) || Intersection(top, M, box, box_M, depth, normal); } }