21 std::array<const unsigned int*, MAX_ENVIRONMENT_TEXTURES> bitmaps)
41 FILE* file = fopen(fullBinaryPath.c_str(),
"rb");
50 if (fread(magic, 1, 4, file) != 4)
58 if (magic[0] !=
'E' || magic[1] !=
'N' || magic[2] !=
'V' || magic[3] !=
'1')
67 if (fread(&groupCount,
sizeof(u32), 1, file) != 1)
84 for (u32 i = 0; i < groupCount; i++)
86 if (fread(&
dlSizes[i],
sizeof(u32), 1, file) != 1)
126 if (bitmaps.empty() || !bitmaps[i])
135 TEXGEN_TEXCOORD | GL_TEXTURE_WRAP_S | GL_TEXTURE_WRAP_T,
151 for (
int i = 0; i <
dbEntry->textureCount; i++)
169 for (
int i = 0; i <
dbEntry->billboardCount; i++)
171 const auto& bb =
dbEntry->billboards[i];
173 if (bb.texSlot >=
dbEntry->textureCount)
183 render.renderTexturedBillboard(bb,
textureIDs[bb.texSlot], faceCamera, camX, camY, camZ);
constexpr int MAX_ENVIRONMENT_TEXTURES
int textureIDs[MAX_ENVIRONMENT_TEXTURES]
const EnvironmentDbEntry * dbEntry
void cleanup()
Frees all display lists and deletes all textures owned by this Environment, and clears the current da...
void drawBillboards(bool faceCamera, ae::q20_12_t camX, ae::q20_12_t camY, ae::q20_12_t camZ)
Renders every billboard quad defined for the currently loaded environment.
Environment()
Constructs an empty Environment with all texture and display-list slots cleared and no database entry...
void draw()
Renders every loaded texture/display-list pair for the currently loaded environment.
u32 * displayLists[MAX_ENVIRONMENT_TEXTURES]
u32 dlSizes[MAX_ENVIRONMENT_TEXTURES]
bool load(const EnvironmentDbEntry *entry, std::array< const unsigned int *, MAX_ENVIRONMENT_TEXTURES > bitmaps)
Loads environment geometry (display lists) and textures from the compiled .bin file described by an E...
static bool enableDebugPrint
Holds global variables used game-wide.
void logMessage(LogSeverity severity, std::string_view message, std::source_location location)
Logs a diagnostic message and halts only for fatal messages.
Util to handle error logging.
const EnvironmentTexture * textures