mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 21:55:27 +00:00
implement special case for shadow and connect it into SetActorShadowValid lua opcode
This commit is contained in:
parent
cae978e7aa
commit
321112a248
@ -63,6 +63,7 @@ Actor::Actor(const char *name) :
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
_shadowArray[i].active = false;
|
||||
_shadowArray[i].dontNegate = false;
|
||||
_shadowArray[i].shadowMask = NULL;
|
||||
}
|
||||
|
||||
@ -669,10 +670,10 @@ void Actor::setActiveShadow(int shadowId) {
|
||||
}
|
||||
|
||||
void Actor::setShadowValid(int valid) {
|
||||
/* if (valid == -1)
|
||||
_shadowArray[_activeShadowSlot].active = false;
|
||||
if (valid == -1)
|
||||
_shadowArray[_activeShadowSlot].dontNegate = true;
|
||||
else
|
||||
_shadowArray[_activeShadowSlot].active = true;*/
|
||||
_shadowArray[_activeShadowSlot].dontNegate = false;
|
||||
}
|
||||
|
||||
void Actor::setActivateShadow(int shadowId, bool state) {
|
||||
|
@ -48,6 +48,7 @@ struct Shadow {
|
||||
SectorListType planeList;
|
||||
byte *shadowMask;
|
||||
bool active;
|
||||
bool dontNegate;
|
||||
};
|
||||
|
||||
class Actor {
|
||||
|
@ -185,7 +185,7 @@ bool DriverTinyGL::isHardwareAccelerated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void tglShadowProjection(Vector3d light, Vector3d plane, Vector3d normal) {
|
||||
void tglShadowProjection(Vector3d light, Vector3d plane, Vector3d normal, bool dontNegate) {
|
||||
// Based on GPL shadow projection example by
|
||||
// (c) 2002-2003 Phaetos <phaetos@gaffga.de>
|
||||
float d, c;
|
||||
@ -196,6 +196,11 @@ void tglShadowProjection(Vector3d light, Vector3d plane, Vector3d normal) {
|
||||
nx = -normal.x();
|
||||
ny = -normal.y();
|
||||
nz = -normal.z();
|
||||
if (dontNegate) {
|
||||
nx = -nx;
|
||||
ny = -ny;
|
||||
nz = -nz;
|
||||
}
|
||||
lx = light.x();
|
||||
ly = light.y();
|
||||
lz = light.z();
|
||||
@ -239,7 +244,7 @@ void DriverTinyGL::startActorDraw(Vector3d pos, float yaw, float pitch, float ro
|
||||
tglSetShadowMaskBuf(_currentShadowArray->shadowMask);
|
||||
SectorListType::iterator i = _currentShadowArray->planeList.begin();
|
||||
Sector *shadowSector = *i;
|
||||
tglShadowProjection(_currentShadowArray->pos, shadowSector->getVertices()[0], shadowSector->getNormal());
|
||||
tglShadowProjection(_currentShadowArray->pos, shadowSector->getVertices()[0], shadowSector->getNormal(), _currentShadowArray->dontNegate);
|
||||
}
|
||||
tglTranslatef(pos.x(), pos.y(), pos.z());
|
||||
tglRotatef(yaw, 0, 0, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user