How do I build/implement a bitmask?

Started by
2 comments, last by pizzafan 19 years, 7 months ago
I keep getting stuck, getting half inspired, then getting stuck and leaving it again. My aim is to basically create a swept-area collision detection routine, as shown here. I'd be checking the entire grey + blue + dark blue area against the tiles with dark brown in them. I don't know the general gist of doing bitmasking in the first place, and these questions come to mind: 1. Can I create and store a 1-bit bitmap? Because I only want each pixel to have a yes/no value. 2. Can I do this in Direct3D, or do I need some other library? So far I've got pretty things that move and spin, using D3D. 3. If the surface is built from those 1-bit tiles, how do I pluck out a specific tile and prepare it for bitmask testing? 4. Can I create a dynamic bitmask on the fly? For example, the grey rectangle, or one tile-bounded piece of the grey rectange. I don't know how much sense those questions make, but thanks for any replies.
Advertisement
Bump.
Even just some suggestions of tutorials or the like that cover bitmasking would be much appreciated.
Quote:Original post by Defend
1. Can I create and store a 1-bit bitmap? Because I only want each pixel to have a yes/no value.
Yes, there are monochrome bitmaps.

Quote:3. If the surface is built from those 1-bit tiles, how do I pluck out a specific tile and prepare it for bitmask testing?
You can't really, but if you put the tile, you should be able to calculate where that tile is.

Quote:4. Can I create a dynamic bitmask on the fly? For example, the grey rectangle, or one tile-bounded piece of the grey rectange.
I've never used DirectX, so I can't tell you, look at the converting function and see if they dither.
~~~~~Screaming Statue Software. | OpenGL FontLibWhy does Data talk to the computer? Surely he's Wi-Fi enabled... - phaseburn
if you don't know the theorical aspects of bitmasking, this link will help you :
http://students.cs.byu.edu/~kawigi/animation/bitwise.html

(twas found with google)

This topic is closed to new replies.

Advertisement