updating shadow mask only when needed works now

This commit is contained in:
Pawel Kolodziejski 2008-07-13 14:01:22 +00:00
parent 9b2b6a00f0
commit 65f81b6328
4 changed files with 7 additions and 5 deletions

View File

@ -601,7 +601,7 @@ void Actor::draw() {
for (std::list<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); i++)
(*i)->setupTextures();
if (!g_driver->isHardwareAccelerated()/* && g_engine->getFlagRefreshShadowMask()*/) {
if (!g_driver->isHardwareAccelerated() && g_engine->getFlagRefreshShadowMask()) {
for (int l = 0; l < 5; l++) {
if (!_shadowArray[l].active)
continue;
@ -657,6 +657,7 @@ void Actor::addShadowPlane(const char *name) {
Sector *sector = g_engine->currScene()->getSectorBase(i);
if (strmatch(sector->name(), name)) {
_shadowArray[_activeShadowSlot].planeList.push_back(sector);
g_engine->flagRefreshShadowMask(true);
return;
}
}
@ -697,6 +698,7 @@ void Actor::clearShadowPlanes() {
delete[] shadow->shadowMask;
shadow->shadowMask = NULL;
shadow->active = false;
shadow->dontNegate = false;
}
}

View File

@ -264,10 +264,10 @@ void DriverTinyGL::finishActorDraw() {
void DriverTinyGL::drawShadowPlanes() {
tglEnable(TGL_SHADOW_MASK_MODE);
if (_currentShadowArray->shadowMask)
memset(_currentShadowArray->shadowMask, 0, _screenWidth * _screenHeight);
else
if (!_currentShadowArray->shadowMask) {
_currentShadowArray->shadowMask = new byte[_screenWidth * _screenHeight];
memset(_currentShadowArray->shadowMask, 0, _screenWidth * _screenHeight);
}
tglSetShadowMaskBuf(_currentShadowArray->shadowMask);
_currentShadowArray->planeList.begin();

View File

@ -646,7 +646,6 @@ void Engine::setScene(const char *name) {
if (b == NULL)
warning("Could not find scene file %s\n", name);
_currScene = new Scene(name, b->data(), b->len());
flagRefreshShadowMask(true);
registerScene(_currScene);
_currScene->setSoundParameters(20, 127);
// should delete the old scene after creating the new one

View File

@ -1489,6 +1489,7 @@ static void ActivateActorShadow() {
bool state = getbool(3);
act->setActivateShadow(shadowId, state);
g_engine->flagRefreshShadowMask(true);
}
static void SetActorShadowValid() {