From 55677cd9e31943f43bc01515ce29325e6b053c40 Mon Sep 17 00:00:00 2001 From: esquizo Date: Mon, 18 May 2026 21:44:30 -0300 Subject: libphysics: otimização por blockmaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bug: o object não pode ser maior do que o BLOCK_SIZE, definido no dat.h --- libphysics/dat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libphysics/dat.h') diff --git a/libphysics/dat.h b/libphysics/dat.h index 75869a4..9fe3312 100644 --- a/libphysics/dat.h +++ b/libphysics/dat.h @@ -1,3 +1,5 @@ +#define BLOCK_SIZE 128 + typedef struct Body { BodyType type; int active; @@ -7,6 +9,12 @@ typedef struct Body { vec2 accel; } Body; +typedef struct BlockmapNode BlockmapNode; +struct BlockmapNode { + BodyID id; + BlockmapNode *next; +}; + void phxmapcollision(Body *); void phxbodycollision(Body *, Body *); @@ -17,6 +25,9 @@ void phxaabbresolv(Body *a, Body *b, vec2 p, vec2 n); int phxenqevent(CollisionEvent *ev); int phxdeqevent(CollisionEvent *ev); +void phxmakeblkmap(void); +BlockmapNode *phxnodelist(float x, float y); + extern int phxmapwidth, phxmapheight; extern int *phxmapbuffer; -- cgit v1.2.3