Skip to content

Commit

Permalink
Fix the construction of the Circle drawables. Two of the constructors…
Browse files Browse the repository at this point in the history
… were non-functional and only used in one place.
  • Loading branch information
fluffyfreak committed Sep 20, 2014
1 parent ddc8226 commit 687cecc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/SystemInfoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ void SystemInfoView::BodyIcon::Draw()
// The -0.1f offset seems to be the best compromise to make the circles closed (e.g. around Mars), symmetric, fitting with selection
// and not overlapping to much with asteroids
Graphics::Drawables::Circle circle =
Graphics::Drawables::Circle(size[0]*0.5f, size[0]*0.5f-0.1f, size[1]*0.5f, 0.f,
Graphics::Drawables::Circle(m_renderer, size[0]*0.5f, size[0]*0.5f-0.1f, size[1]*0.5f, 0.f,
portColor, m_renderState);
circle.Draw(m_renderer);
}
Expand Down
6 changes: 4 additions & 2 deletions src/graphics/Drawables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ namespace Graphics {

namespace Drawables {

Circle::Circle(const float radius, const Color &c, RenderState *state) : m_color(c) {
Circle::Circle(Renderer *renderer, const float radius, const Color &c, RenderState *state) : m_color(c) {
m_renderState = state;
VertexArray vertices (ATTRIB_POSITION);
for (float theta=0; theta < 2*float(M_PI); theta += 0.05f*float(M_PI)) {
vertices.Add(vector3f(radius*sin(theta), radius*cos(theta), 0));
}
SetupVertexBuffer(vertices, renderer);
}
Circle::Circle(const float radius, const float x, const float y, const float z, const Color &c, RenderState *state) : m_color(c) {
Circle::Circle(Renderer *renderer, const float radius, const float x, const float y, const float z, const Color &c, RenderState *state) : m_color(c) {
m_renderState = state;
VertexArray vertices (ATTRIB_POSITION);
for (float theta=0; theta < 2*float(M_PI); theta += 0.05f*float(M_PI)) {
vertices.Add(vector3f(radius*sin(theta) + x, radius*cos(theta) + y, z));
}
SetupVertexBuffer(vertices, renderer);
}
Circle::Circle(Renderer *renderer, const float radius, const vector3f &center, const Color &c, RenderState *state) : m_color(c) {
m_renderState = state;
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/Drawables.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace Drawables {

class Circle {
public:
Circle(const float radius, const Color &c, RenderState *state);
Circle(const float radius, const float x, const float y, const float z, const Color &c, RenderState *state);
Circle(Renderer *renderer, const float radius, const Color &c, RenderState *state);
Circle(Renderer *renderer, const float radius, const float x, const float y, const float z, const Color &c, RenderState *state);
Circle(Renderer *renderer, const float radius, const vector3f &center, const Color &c, RenderState *state);
virtual void Draw(Renderer *renderer);

Expand Down

0 comments on commit 687cecc

Please sign in to comment.