Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor astar pt2 #3320

Closed
wants to merge 13 commits into from
20 changes: 20 additions & 0 deletions lib/ivis_opengl/pieblitfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,26 @@ void iV_Lines(const std::vector<glm::ivec4> &lines, PIELIGHT colour)
gfx_api::LinePSO::get().unbind_vertex_buffers(pie_internal::rectBuffer);
}

void iV_PolyLine(const std::vector<Vector3i> &points, const glm::mat4 &mvp, PIELIGHT colour)
{
std::vector<glm::ivec4> lines;
Vector2i result;
Vector2i lastPoint(0, 0);

for(auto i = 0; i < points.size(); i++){
Vector3i source = points[i];
pie_RotateProjectWithPerspective(&source, mvp, &result);

if(i > 0){
lines.push_back({ lastPoint.x, lastPoint.y, result.x, result.y });
}

lastPoint = result;
}

iV_Lines(lines, colour);
}

/**
* Assumes render mode set up externally, draws filled rectangle.
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/ivis_opengl/pieblitfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ glm::mat4 defaultProjectionMatrix();
void iV_ShadowBox(int x0, int y0, int x1, int y1, int pad, PIELIGHT first, PIELIGHT second, PIELIGHT fill);
void iV_Line(int x0, int y0, int x1, int y1, PIELIGHT colour);
void iV_Lines(const std::vector<glm::ivec4> &lines, PIELIGHT colour);
/// Draws connected polyline.
void iV_PolyLine(const std::vector<Vector3i> &points, const glm::mat4 &mvp, PIELIGHT colour);
void iV_Box2(int x0, int y0, int x1, int y1, PIELIGHT first, PIELIGHT second);
static inline void iV_Box(int x0, int y0, int x1, int y1, PIELIGHT first)
{
Expand Down
Loading