diff options
Diffstat (limited to '2d/rigidbody/rigidbody_2')
-rw-r--r-- | 2d/rigidbody/rigidbody_2/main.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/2d/rigidbody/rigidbody_2/main.cpp b/2d/rigidbody/rigidbody_2/main.cpp index 44a3c53..cae18a5 100644 --- a/2d/rigidbody/rigidbody_2/main.cpp +++ b/2d/rigidbody/rigidbody_2/main.cpp @@ -1,4 +1,4 @@ -#include "../../../shared_cpp/OrthographicRenderer.h" +#include "../../../shared_cpp/Renderer2d.h" #include "../../../shared_cpp/types.h" #include "../../../shared_cpp/WebglContext.h" #include "../../../shared_cpp/mathlib.h" @@ -100,18 +100,18 @@ struct Rigidbody { }; struct Rectangle { - OrthographicShape shape; + Mesh2d shape; Rigidbody body; Vector2 originalPoints[4]; Vector2 transformedPoints[4]; - void load(OrthographicRenderer* renderer, Vector4 color, float32 width, float32 height) { + void load(Renderer2d* renderer, Vector4 color, float32 width, float32 height) { color = color.toNormalizedColor(); float32 halfWidth = width / 2.f; float32 halfHeight = height / 2.f; - OrthographicVertex vertices[6]; + Vertex2d vertices[6]; vertices[0].position = Vector2 { -halfWidth, -halfHeight }; vertices[1].position = Vector2 { -halfWidth, halfHeight }; vertices[2].position = Vector2 { halfWidth, halfHeight }; @@ -145,7 +145,7 @@ struct Rectangle { } } - void render(OrthographicRenderer* renderer) { + void render(Renderer2d* renderer) { shape.render(renderer); } @@ -155,20 +155,20 @@ struct Rectangle { }; struct Circle { - OrthographicShape shape; + Mesh2d shape; Rigidbody body; Vector2 force; float32 radius = 5.f; - void load(OrthographicRenderer* renderer, Vector4 color) { + void load(Renderer2d* renderer, Vector4 color) { const int32 numSegments = 36; const float32 radiansPerSegment = (2.f * PI) / static_cast<float>(numSegments); const int32 numVertices = numSegments * 3; color = color.toNormalizedColor(); - OrthographicVertex vertices[numSegments * 3]; + Vertex2d vertices[numSegments * 3]; for (int idx = 0; idx < numSegments; idx++) { int vIdx = idx * 3; @@ -188,7 +188,7 @@ struct Circle { shape.model = Mat4x4().translateByVec2(body.position); } - void render(OrthographicRenderer* renderer) { + void render(Renderer2d* renderer) { shape.render(renderer); } @@ -206,7 +206,7 @@ void update(float32 time, void* userData); void unload(); WebglContext context; -OrthographicRenderer renderer; +Renderer2d renderer; MainLoop mainLoop; Rectangle rectangle; Circle pointer; |