Drag[en]gine Game Engine
1.21
|
Simple mask to organize objects into layers. More...
#include <decLayerMask.h>
Public Member Functions | |
Constructors and Destructors | |
decLayerMask () | |
Create new layer mask. More... | |
decLayerMask (const decLayerMask &layerMask) | |
Create new layer mask as a copy of another layer mask. More... | |
~decLayerMask () | |
Cleans up layer mask. More... | |
Operators | |
bool | operator== (const decLayerMask &layerMask) const |
Layer masks are equal. More... | |
bool | operator!= (const decLayerMask &layerMask) const |
Layer masks are not equal. More... | |
decLayerMask & | operator= (const decLayerMask &layerMask) |
Sets this layer mask to another one. More... | |
decLayerMask & | operator|= (const decLayerMask &layerMask) |
Sets all bits that are set in another one. More... | |
decLayerMask & | operator&= (const decLayerMask &layerMask) |
Clears all bits that are not set in another one. More... | |
decLayerMask & | operator^= (const decLayerMask &layerMask) |
Sets bits that are different between this layer mask and another one. More... | |
decLayerMask | operator| (const decLayerMask &layerMask) const |
Retrieves a layermask with all bits set that are set in either this layer mask or another one. More... | |
decLayerMask | operator& (const decLayerMask &layerMask) const |
Retrieves a layermask with all bits set that are set in both this layer mask and another one. More... | |
decLayerMask | operator^ (const decLayerMask &layerMask) const |
Retrieves a layermask with all bits set that are different between this layer mask and another one. More... | |
decLayerMask | operator~ () const |
Inverse layermask with all bits inverted. More... | |
Management | |
void | ClearMask () |
Clears the mask. More... | |
void | FillMask () |
Sets all bits in the mask. More... | |
void | SetBit (int bit) |
Sets a bit in the range from 0 to 63 inclusive. More... | |
void | ClearBit (int bit) |
Clears a bit in the range from 0 to 63 inclusive. More... | |
bool | IsBitSet (int bit) const |
Determines if a bit is set in the range from 0 to 63 inclusive. More... | |
bool | IsBitCleared (int bit) const |
Determines if a bit is not set in the range from 0 to 63 inclusive. More... | |
bool | IsEmpty () const |
Layer mask has no bits set. More... | |
bool | IsNotEmpty () const |
Layer mask has at least one bit set. More... | |
bool | IsFull () const |
Layer mask has all bits set. More... | |
bool | Matches (const decLayerMask &layerMask) const |
Determines if this mask shares at least one bit with another mask. More... | |
bool | MatchesNot (const decLayerMask &layerMask) const |
Determines if this mask shares no bits with another mask. More... | |
decString | ToBitString () const |
Retrieves a bit string representation. More... | |
void | SetFromBitString (const char *string) |
Set layer mask from a bit string representation. More... | |
decString | ToHexString () const |
Retrieves a hexadecimal string representation. More... | |
void | SetFromHexString (const char *string) |
Set layer mask from a hexadecimal string representation. More... | |
void | WriteToFile (decBaseFileWriter &writer) const |
Write layer mask to file writer. More... | |
uint64_t | GetMask () const |
Mask value. More... | |
void | SetMask (uint64_t mask) |
Set mask value. More... | |
static decLayerMask | ReadFromFile (decBaseFileReader &reader) |
Read layer mask from file reader. More... | |
Simple mask to organize objects into layers.
Objects can be located on multiple layers depending on the bits set. A maximum of 64 layers can be used.
decLayerMask::decLayerMask | ( | ) |
Create new layer mask.
decLayerMask::decLayerMask | ( | const decLayerMask & | layerMask | ) |
Create new layer mask as a copy of another layer mask.
decLayerMask::~decLayerMask | ( | ) |
Cleans up layer mask.
void decLayerMask::ClearBit | ( | int | bit | ) |
Clears a bit in the range from 0 to 63 inclusive.
void decLayerMask::ClearMask | ( | ) |
Clears the mask.
void decLayerMask::FillMask | ( | ) |
Sets all bits in the mask.
|
inline |
Mask value.
bool decLayerMask::IsBitCleared | ( | int | bit | ) | const |
Determines if a bit is not set in the range from 0 to 63 inclusive.
bool decLayerMask::IsBitSet | ( | int | bit | ) | const |
Determines if a bit is set in the range from 0 to 63 inclusive.
bool decLayerMask::IsEmpty | ( | ) | const |
Layer mask has no bits set.
bool decLayerMask::IsFull | ( | ) | const |
Layer mask has all bits set.
bool decLayerMask::IsNotEmpty | ( | ) | const |
Layer mask has at least one bit set.
bool decLayerMask::Matches | ( | const decLayerMask & | layerMask | ) | const |
Determines if this mask shares at least one bit with another mask.
bool decLayerMask::MatchesNot | ( | const decLayerMask & | layerMask | ) | const |
Determines if this mask shares no bits with another mask.
bool decLayerMask::operator!= | ( | const decLayerMask & | layerMask | ) | const |
Layer masks are not equal.
decLayerMask decLayerMask::operator& | ( | const decLayerMask & | layerMask | ) | const |
Retrieves a layermask with all bits set that are set in both this layer mask and another one.
decLayerMask& decLayerMask::operator&= | ( | const decLayerMask & | layerMask | ) |
Clears all bits that are not set in another one.
decLayerMask& decLayerMask::operator= | ( | const decLayerMask & | layerMask | ) |
Sets this layer mask to another one.
bool decLayerMask::operator== | ( | const decLayerMask & | layerMask | ) | const |
Layer masks are equal.
decLayerMask decLayerMask::operator^ | ( | const decLayerMask & | layerMask | ) | const |
Retrieves a layermask with all bits set that are different between this layer mask and another one.
decLayerMask& decLayerMask::operator^= | ( | const decLayerMask & | layerMask | ) |
Sets bits that are different between this layer mask and another one.
decLayerMask decLayerMask::operator| | ( | const decLayerMask & | layerMask | ) | const |
Retrieves a layermask with all bits set that are set in either this layer mask or another one.
decLayerMask& decLayerMask::operator|= | ( | const decLayerMask & | layerMask | ) |
Sets all bits that are set in another one.
decLayerMask decLayerMask::operator~ | ( | ) | const |
Inverse layermask with all bits inverted.
|
static |
Read layer mask from file reader.
void decLayerMask::SetBit | ( | int | bit | ) |
Sets a bit in the range from 0 to 63 inclusive.
void decLayerMask::SetFromBitString | ( | const char * | string | ) |
Set layer mask from a bit string representation.
String contains 1 for set bits and 0 for cleared bits. The first bit is located on the front of the string with bits following up to the bit 63. If the string is less than 64 characters long all bits outside the range are set to cleared.
void decLayerMask::SetFromHexString | ( | const char * | string | ) |
Set layer mask from a hexadecimal string representation.
String contains groups of 4 bits converted to readable hexadecimal in the form 0 to f. The first 4 bits are located in the hex digit at the front of the string with each group of 4 bits following up to bit 63. Inside each hex digit the first bit in the group is located at the high bit with each following bit progressing down to the lowest bit. If the string is less than 16 characters long all bits outside the range are set to cleared.
void decLayerMask::SetMask | ( | uint64_t | mask | ) |
Set mask value.
decString decLayerMask::ToBitString | ( | ) | const |
Retrieves a bit string representation.
String contains 1 for set bits and 0 for cleared bits. The first bit is located on the front of the string with bits following up to the bit 63.
decString decLayerMask::ToHexString | ( | ) | const |
Retrieves a hexadecimal string representation.
String contains groups of 4 bits converted to readable hexadecimal in the form 0 to f. The first 4 bits are located in the hex digit at the front of the string with each group of 4 bits following up to bit 63. Inside each hex digit the first bit in the group is located at the high bit with each following bit progressing down to the lowest bit.
void decLayerMask::WriteToFile | ( | decBaseFileWriter & | writer | ) | const |
Write layer mask to file writer.