JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fixed 2 more dot collision bugs (last ones?)
[vor.git] / shape.c
diff --git a/shape.c b/shape.c
index f457158..92729e9 100644 (file)
--- a/shape.c
+++ b/shape.c
@@ -108,3 +108,14 @@ collide(int xdiff, int ydiff, struct shape *r, struct shape *s)
        if(xov == 0 || yov == 0) return 0;  // bboxes hit?
        else return mask_collide(xov, yov, r, s);
 }
+
+int
+pixel_collide(unsigned int xoff, unsigned int yoff, struct shape *r)
+{
+       uint32_t pmask;
+       
+       if(xoff >= r->w || yoff >= r->h) return 0;
+
+       pmask = 1 << (32 - (xoff&0x1f));
+       return r->mask[(yoff*r->mw) + (xoff>>5)] & pmask;
+}