- moved most of gl_setup.cpp to r_data as this is only some data setup in the main map data structures.

- made currentmapsections array something nicer to look at and made it a member of the scene drawer class.
This commit is contained in:
Christoph Oelckers 2018-04-02 09:27:40 +02:00
commit 8080e039e0
12 changed files with 101 additions and 40 deletions

View file

@ -1259,3 +1259,74 @@ public:
Clear();
}
};
class BitArray
{
TArray<uint8_t> bytes;
unsigned size;
public:
void Resize(unsigned elem)
{
bytes.Resize((elem + 7) / 8);
size = elem;
}
BitArray() : size(0)
{
}
BitArray(const BitArray & arr)
{
bytes = arr.bytes;
size = arr.size;
}
BitArray &operator=(const BitArray & arr)
{
bytes = arr.bytes;
size = arr.size;
return *this;
}
BitArray(BitArray && arr)
{
bytes = std::move(arr.bytes);
size = arr.size;
arr.size = 0;
}
BitArray &operator=(BitArray && arr)
{
bytes = std::move(arr.bytes);
size = arr.size;
arr.size = 0;
return *this;
}
bool operator[](size_t index) const
{
return !!(bytes[index >> 3] & (1 << (index & 7)));
}
void Set(size_t index)
{
bytes[index >> 3] |= (1 << (index & 7));
}
void Clear(size_t index)
{
bytes[index >> 3] &= ~(1 << (index & 7));
}
unsigned Size() const
{
return size;
}
void Zero()
{
memset(&bytes[0], 0, bytes.Size());
}
};