Skip to content

Commit

Permalink
Fixed bug with incorrect batch attributes for Triangles
Browse files Browse the repository at this point in the history
Signed-off-by: Bhavye Mathur <[email protected]>
  • Loading branch information
BhavyeMathur committed Sep 25, 2024
1 parent 40c3eaf commit f4701b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/objects/Triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ namespace gp {
GP_CORE_DEBUG("Initializing Triangle ({0}, {1}), ({2}, {3}), ({4}, {5})", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);
}

shared_ptr<Triangle> Triangle::create(Point p1, Point p2, Point p3) {
return make_shared<Triangle>(p1, p2, p3);
}

bool Triangle::_contains(float x, float y) const {
return checkTriangleContains({x, y}, m_Points[0], m_Points[1], m_Points[2]);
}
Expand Down
2 changes: 2 additions & 0 deletions src/objects/Triangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace gp {
*/
Triangle(Point p1, Point p2, Point p3);

static shared_ptr<Triangle> create(Point p1, Point p2, Point p3);

virtual ~Triangle() = default;

[[nodiscard]] std::string toString() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace gp {
m_TriangleBatch({{{ShaderDataType::Float2, "position"},
{ShaderDataType::Float, "z"},
{ShaderDataType::Float4, "color"}},
6, 4, m_Window.m_SolidShader}),
3, 3, m_Window.m_SolidShader}),
m_QuadBatch({{
{ShaderDataType::Float2, "position"},
{ShaderDataType::Float, "z"},
Expand Down

0 comments on commit f4701b8

Please sign in to comment.