From babe533a9e544a0edfcef3228fe704b7fbcfc047 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 21 Sep 2003 18:54:54 +0000 Subject: [PATCH] fix D3D lighting --- stepmania/src/RageDisplay.h | 1 - stepmania/src/RageDisplay_D3D.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 56255b9764..6b3f794e3a 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -182,7 +182,6 @@ public: RageColor specular, RageVector3 dir ) = 0; - void DrawQuad( const RageSpriteVertex v[] ) { DrawQuads(v,4); } /* alias. upper-left, upper-right, lower-left, lower-right */ virtual void DrawQuads( const RageSpriteVertex v[], int iNumVerts ) = 0; virtual void DrawFan( const RageSpriteVertex v[], int iNumVerts ) = 0; diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 508d9a7f0b..74a7504a44 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -906,11 +906,11 @@ void RageDisplay_D3D::SetLightDirectional( ZERO( light ); light.Type = D3DLIGHT_DIRECTIONAL; - /* Without this, characters are lit from behind, so the directional light can - * barely be seen. I'm not sure that this is generally correct, since I don't - * know how the coordinate systems are different, but it works for - * DancingCharacters::DrawPrimitives. XXX: figure out exactly why this is needed */ - float position[] = { -dir.x, -dir.y, -dir.z }; + /* Z for lighting is flipped for D3D compared to OpenGL. + * XXX: figure out exactly why this is needed. Our transforms + * are probably goofed up, but the Z test is the same for both + * API's, so I'm not sure why we don't see other weirdness. -Chris */ + float position[] = { dir.x, dir.y, -dir.z }; memcpy( &light.Direction, position, sizeof(position) ); memcpy( &light.Diffuse, diffuse, sizeof(diffuse) ); memcpy( &light.Ambient, ambient, sizeof(ambient) );