This class can be used to store a bit per map channel, including both negative and positive map channels, and it works with any size index.
#include <mesh.h>
Public Member Functions |
|
MapBitArray () | |
Constructor. Sets all channels to false.
|
|
MapBitArray (bool defaultValue) | |
Constructor. Sets all channels to the given
default value. |
|
MapBitArray (bool textureDefault, bool colorDefault) | |
Constructor. |
|
int | Largest () const |
Returns the highest index that this
MapBitArray could have a non-default value for. |
|
int | Smallest () const |
Returns the lowest index that this
MapBitArray could have a non-default value for. |
|
DllExport void | Set (int mapChannel, bool val=true) |
Sets the value of the given channel.
|
|
void | Clear (int mapChannel) |
Clears the value of the given channel.
|
|
DllExport bool | Get (int mapChannel) const |
Gets the value of the given channel.
|
|
bool | TextureDefault () const |
Returns the default value for texture
channels, channels 1 and above. |
|
bool | ColorDefault () const |
Returns the default value for color
channels, channels 0 and below. |
|
void | InvertTextureChannels () |
Inverts the value of all texture channels (1
and above). |
|
void | InvertColorChannels () |
Inverts the value of all color channels (0
and below). |
|
void | InvertAll () |
Inverts all channel values. |
|
DllExport IOResult | Save (ISave *isave) |
Saves data to stream. |
|
DllExport IOResult | Load (ILoad *iload) |
Loads data from stream. |
|
bool | operator[] (int i) const |
Indexing operator. |
|
DllExport BOOL | operator== (const MapBitArray &b) const |
Comparison operator. |
|
BOOL | operator!= (const MapBitArray &b) const |
Inequality operator. |
|
DllExport MapBitArray & | operator= (const MapBitArray &b) |
Assignment operator. |
MapBitArray | ( | ) | [inline] |
Constructor. Sets all channels to false.
: mTexture(false), mColor(false) { }
MapBitArray | ( | bool | defaultValue | ) | [inline] |
Constructor. Sets all channels to the given default value.
: mTexture(defaultValue), mColor(defaultValue) { }
MapBitArray | ( | bool | textureDefault, |
bool | colorDefault | ||
) | [inline] |
Constructor.
Sets all texture channels (1 and above) to the texture default, and all color channels (0 and below) to the color default.
: mTexture(textureDefault), mColor(colorDefault) { }
int Largest | ( | ) | const [inline] |
Returns the highest index that this MapBitArray could have a non-default value for.
All indices above this are guaranteed to have value "TextureDefault()".
int Smallest | ( | ) | const [inline] |
Returns the lowest index that this MapBitArray could have a non-default value for.
All indices below this are guaranteed to have value "ColorDefault()".
DllExport void Set | ( | int | mapChannel, |
bool | val = true |
||
) |
Sets the value of the given channel.
void Clear | ( | int | mapChannel | ) | [inline] |
DllExport bool Get | ( | int | mapChannel | ) | const |
Gets the value of the given channel.
(If this particular channel has not been set before, the default for the channel will be returned.)
bool TextureDefault | ( | ) | const [inline] |
Returns the default value for texture channels, channels 1 and above.
{ return mTexture; }
bool ColorDefault | ( | ) | const [inline] |
Returns the default value for color channels, channels 0 and below.
{ return mColor; }
void InvertTextureChannels | ( | ) | [inline] |
Inverts the value of all texture channels (1 and above).
{ mTexture=!mTexture; }
void InvertColorChannels | ( | ) | [inline] |
Inverts the value of all color channels (0 and below).
{ mColor=!mColor; }
void InvertAll | ( | ) | [inline] |
Saves data to stream.
Loads data from stream.
bool operator[] | ( | int | i | ) | const [inline] |
Indexing operator.
{ return Get(i); }
DllExport BOOL operator== | ( | const MapBitArray & | b | ) | const |
Comparison operator.
BOOL operator!= | ( | const MapBitArray & | b | ) | const [inline] |
Inequality operator.
{ return !(*this == b); }
DllExport MapBitArray& operator= | ( | const MapBitArray & | b | ) |
Assignment operator.