Mail Archives: djgpp/1997/02/06/12:39:37
In article <vgpI$hAr7O+yEwGt AT talula DOT demon DOT co DOT uk>, Shawn Hargreaves
<Shawn AT talula DOT demon DOT co DOT uk> writes
>If true pixel-perfect testing is needed, one of the fastest approaches
>is to pregenerate a monochrome mask for each sprite, containing one bits
>for the pixels that are set and zeros for the ones that aren't. To test
>two objects for a collision, line up these bitmasks depending on the
>relative positions of the sprites (this involves a lot of shifting and
>can be a big pain to get right), and then bitwise-or the two masks
>together. If the resulting value is non-zero, the objects have collided.
>This technique lets you check 32 pixels with each test, rather than
>having to laboriously loop through every single pixel in the sprite...
Any chance you post some example code for this Shawn?
--
. ben AT flag DOT demon DOT co DOT uk / www.flag.demon.co.uk
Moo-Juice on IRC. ___ .
: _~#~_ '#####`
: 'o o` #include <sys/nearptr.h> void main(){__djgpp_ |o o| :
::| | || nearptr_enable();char *v=(char*)(__djgpp_conv | | |::
:: || entional_base+0xb8000);v[0]='M';v[1]=15;v[2]= | ::
|==- /| 'o';v[3]=15;v[4]='o';v[5]=15;v[6]='!';v[7]=15 \ -==
| | | | ;__djgpp_nearptr_disable();}; | |
-oOOo---oOOo---The---Adventures---Of---Poke---And---Moo---oOOo-oOOo--
- Raw text -