Implement OutlineCircle2D and FillCircle2D
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <J3ML/LinearAlgebra.h>
|
||||
#include <J3ML/LinearAlgebra/Vector2.h>
|
||||
#include "J3ML/LinearAlgebra/Vector3.h"
|
||||
|
||||
// OpenGL Wrapper for rendering 2D graphics primitives in both a 2D and 3D context
|
||||
namespace JGL {
|
||||
@@ -13,17 +14,34 @@ namespace JGL {
|
||||
// and are internally transformed to OpenGL clip space [-1, +1]
|
||||
using namespace LinearAlgebra;
|
||||
|
||||
namespace J2D {
|
||||
|
||||
}
|
||||
|
||||
namespace J3D {
|
||||
struct RGBTuple {
|
||||
int r; int g; int b;
|
||||
};
|
||||
struct RGBATuple {
|
||||
int r; int g; int b; int a;
|
||||
};
|
||||
struct HSVTuple {
|
||||
int h; int s; int v;
|
||||
};
|
||||
struct HSLTuple {
|
||||
int h; int s; int l;
|
||||
};
|
||||
|
||||
}
|
||||
struct Color3 {
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
|
||||
Color3 Lerp(const Color3& rhs, float alpha) const;
|
||||
|
||||
};
|
||||
struct Color4{
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int a;
|
||||
};
|
||||
namespace Colors {
|
||||
namespace Primary {
|
||||
@@ -196,46 +214,66 @@ namespace JGL {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct HSV {
|
||||
float hue;
|
||||
float saturation;
|
||||
float value;
|
||||
};
|
||||
|
||||
struct Triangle2D
|
||||
{
|
||||
Vector2 A;
|
||||
Vector2 B;
|
||||
Vector3 C;
|
||||
};
|
||||
|
||||
struct Triangle3D
|
||||
{
|
||||
Vector3 A;
|
||||
Vector3 B;
|
||||
Vector3 C;
|
||||
};
|
||||
|
||||
Vector2 ScreenToViewport(const Vector2& v);
|
||||
Vector2 ViewportToScreen(const Vector2& v)
|
||||
{
|
||||
// TODO: Implement (CORRECT!!!) matrix transformation
|
||||
}
|
||||
|
||||
namespace J2D {
|
||||
void DrawPixel2D(const Color3& color, const Vector2 &coordinates);
|
||||
void DrawPixel2D(const Color3& color, float x, float y);
|
||||
void DrawLine2D(const Color3& color, const Vector2 &A, const Vector2 &B, float thickness = 1);
|
||||
void DrawLine2D(const Color3& color, float x, float y, float w, float h, float thickness = 1);
|
||||
void DrawCubicBezierCurve2D();
|
||||
void OutlineCircle2D(const Color3& color, const Vector2& center, float radius, int subdivisions, float thickness = 1);
|
||||
void FillCircle2D(const Color3& color, const Vector2& center, float radius, int subdivisions);
|
||||
void OutlineTriangle2D();
|
||||
void FillTriangle2D();
|
||||
void FillTexturedTriangle2D();
|
||||
void FillTexturedPolygon2D();
|
||||
void DrawSprite2D();
|
||||
void DrawPartialSprite2D();
|
||||
void DrawString2D();
|
||||
void FillRect2D(const Color3 &color, const Vector2 &pos, const Vector2 &size);
|
||||
void OutlineRect2D ( const Color3& color, const Vector2& pos, const Vector2& size, float thickness = 1);
|
||||
void FillRoundedRect2D (const Color3& color, const Vector2& pos, const Vector2& size, float radius);
|
||||
void OutlineRoundedRect2D(const Color3& color, const Vector2& pos, const Vector2& size, float radius, float thickness = 1);
|
||||
void OutlinePolygon2D (const Color3& color, std::vector<Vector2> points);
|
||||
void FillPolygon2D (const Color3& color, std::vector<Vector2> points, float thickness = 1);
|
||||
void GradientFillRect2D ();
|
||||
}
|
||||
namespace J3D {
|
||||
void DrawLine3D(const Color3& color, const Vector3 &A, const Vector3 &B, float thickness = 1);
|
||||
void FillSphere3D();
|
||||
void WireframeSphere3D();
|
||||
void DrawString3D();
|
||||
|
||||
void DrawPixel2D(const Color3& color, const Vector2 &coordinates);
|
||||
void DrawPixel2D(const Color3& color, float x, float y);
|
||||
void DrawLine2D(const Color3& color, const Vector2 &A, const Vector2 &B, float thickness = 1);
|
||||
void DrawLine2D(const Color3& color, float x, float y, float w, float h, float thickness = 1);
|
||||
void DrawLine3D(const Color3& color, const Vector3 &A, const Vector3 &B);
|
||||
void DrawCubicBezierCurve2D();
|
||||
void OutlineCircle2D(const Color3& color, const Vector2& center, float radius, int subdivisions);
|
||||
void FillSphere3D();
|
||||
void WireframeSphere3D();
|
||||
void FillCircle2D();
|
||||
void OutlineTriangle2D();
|
||||
void FillTriangle2D();
|
||||
void FillTexturedTriangle2D();
|
||||
void FillTexturedPolygon2D();
|
||||
void DrawSprite2D();
|
||||
void DrawPartialSprite2D();
|
||||
void DrawString2D();
|
||||
void DrawString3D();
|
||||
void FillRect2D(const Color3 &color, const Vector2 &pos, const Vector2 &size);
|
||||
void OutlineRect2D ( const Color3& color, const Vector2& pos, const Vector2& size, float thickness = 1);
|
||||
void FillRoundedRect2D (const Color3& color, const Vector2& pos, const Vector2& size, float radius);
|
||||
void OutlineRoundedRect2D(const Color3& color, const Vector2& pos, const Vector2& size, float radius, float thickness = 1);
|
||||
void OutlinePolygon2D (const Color3& color, std::vector<Vector2> points);
|
||||
void FillPolygon2D (const Color3& color, std::vector<Vector2> points, float thickness = 1);
|
||||
void GradientFillRect2D ();
|
||||
void DrawMatrixGizmo (const Matrix3x3&, const Vector3&);
|
||||
void DrawMatrixGizmo (const Matrix4x4&);
|
||||
void DrawAxisAngleGizmo (const AxisAngle&, const Vector3&);
|
||||
void DrawQuaternionGizmo (const Quaternion&, const Vector3&);
|
||||
void DrawMatrixGizmo (const Matrix3x3&, const Vector3&);
|
||||
void DrawMatrixGizmo (const Matrix4x4&);
|
||||
void DrawAxisAngleGizmo (const AxisAngle&, const Vector3&);
|
||||
void DrawQuaternionGizmo (const Quaternion&, const Vector3&);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user