diff options
| author | esquizo <esquizo+noreply@esquizo.net> | 2026-05-18 21:44:30 -0300 |
|---|---|---|
| committer | esquizo <esquizo+noreply@esquizo.net> | 2026-05-18 21:44:30 -0300 |
| commit | 55677cd9e31943f43bc01515ce29325e6b053c40 (patch) | |
| tree | 61ffa3e432012cbba100a3a060b157288e43e1fe /libphysics/dat.h | |
| parent | df8e49f5019b6f33a30d4c9372a18d8d372d6af2 (diff) | |
libphysics: otimização por blockmaps
bug: o object não pode ser maior do que o BLOCK_SIZE, definido no dat.h
Diffstat (limited to 'libphysics/dat.h')
| -rw-r--r-- | libphysics/dat.h | 11 |
1 files changed, 11 insertions, 0 deletions
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; |
