Also I notice a lot of modeltype if/else tests which I need to extend to support a third model format.
Since this is C++ I'd prefer to convert these decision trees into class members and build a rendering class for each model type.
Instead of (UnitDrawer.cpp):
Code: Select all
if (unit->model->type==MODELTYPE_S3O) {
if (unit->isCloaked) {
drawCloakedS3O.push_back(unit);
} else {
QueS3ODraw(unit, unit->model->textureType);
}
} else {
if (unit->isCloaked) {
drawCloaked.push_back(unit);
} else {
DrawUnitNow(unit);
}
}
Code: Select all
if (unit->isCloaked) {
unit->model->DrawCloaked();
} else {
unit->model->Draw();
}
This would also have the benefit of allowing models loaded via Lua or other systems to be rendered without being game objects (such as for UI or SFX purposes).
It's a fairly big job so before I start does anyone have any concerns or suggestions regarding this change?