[Scummvm-cvs-logs] SF.net SVN: scummvm: [33015] residual/trunk/engine

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Sat Jul 12 19:12:38 CEST 2008


Revision: 33015
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33015&view=rev
Author:   aquadran
Date:     2008-07-12 10:12:38 -0700 (Sat, 12 Jul 2008)

Log Message:
-----------
implement special case for shadow and connect it into SetActorShadowValid lua opcode

Modified Paths:
--------------
    residual/trunk/engine/actor.cpp
    residual/trunk/engine/actor.h
    residual/trunk/engine/backend/sdl/driver_tinygl.cpp

Modified: residual/trunk/engine/actor.cpp
===================================================================
--- residual/trunk/engine/actor.cpp	2008-07-12 15:21:38 UTC (rev 33014)
+++ residual/trunk/engine/actor.cpp	2008-07-12 17:12:38 UTC (rev 33015)
@@ -63,6 +63,7 @@
 
 	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::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) {

Modified: residual/trunk/engine/actor.h
===================================================================
--- residual/trunk/engine/actor.h	2008-07-12 15:21:38 UTC (rev 33014)
+++ residual/trunk/engine/actor.h	2008-07-12 17:12:38 UTC (rev 33015)
@@ -48,6 +48,7 @@
 	SectorListType planeList;
 	byte *shadowMask;
 	bool active;
+	bool dontNegate;
 };
 
 class Actor {

Modified: residual/trunk/engine/backend/sdl/driver_tinygl.cpp
===================================================================
--- residual/trunk/engine/backend/sdl/driver_tinygl.cpp	2008-07-12 15:21:38 UTC (rev 33014)
+++ residual/trunk/engine/backend/sdl/driver_tinygl.cpp	2008-07-12 17:12:38 UTC (rev 33015)
@@ -185,7 +185,7 @@
 	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 at gaffga.de>
 	float d, c;
@@ -196,6 +196,11 @@
 	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 @@
 		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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list