From 5c613a10364f30bd6add25f7950433f0c482c3ca Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Sun, 31 Oct 2021 13:54:11 -0400 Subject: (mkosarek) Working undamped spring motion --- 2d/_collisions/polygon_polygon/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '2d/_collisions/polygon_polygon') diff --git a/2d/_collisions/polygon_polygon/main.cpp b/2d/_collisions/polygon_polygon/main.cpp index 9cb3eb2..3d8561f 100644 --- a/2d/_collisions/polygon_polygon/main.cpp +++ b/2d/_collisions/polygon_polygon/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" @@ -112,7 +112,7 @@ struct Edge { }; struct ConvexPolygon { - OrthographicShape shape; + Mesh2d shape; Rigidbody body; Rigidbody previousBody; Vector4 color; @@ -123,7 +123,7 @@ struct ConvexPolygon { Vector2* transformedVertices; Edge* edges; - void load(OrthographicRenderer* renderer) { + void load(Renderer2d* renderer) { transformedVertices = new Vector2[numVertices]; // This will be used for SAT calculations later originalVertices = new Vector2[numVertices]; @@ -134,7 +134,7 @@ struct ConvexPolygon { // is the 2k lines of JavaScript that are required to display it. int32 verticesNeeded = numVertices * 3; float32 angleIncrements = (2.f * PI) / static_cast(numVertices); - OrthographicVertex* shaderVertices = new OrthographicVertex[verticesNeeded]; + Vertex2d* shaderVertices = new Vertex2d[verticesNeeded]; for (int32 vidx = 0; vidx < numVertices; vidx++) { int32 indexPosition = vidx * 3; @@ -186,7 +186,7 @@ struct ConvexPolygon { body = previousBody; } - void render(OrthographicRenderer* renderer) { + void render(Renderer2d* renderer) { shape.render(renderer); } @@ -213,7 +213,7 @@ void update(float32 time, void* userData); void unload(); WebglContext context; -OrthographicRenderer renderer; +Renderer2d renderer; MainLoop mainLoop; ConvexPolygon polygons[4]; -- cgit v1.2.1