mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-25 18:33:44 +00:00
shadow fixes
This commit is contained in:
parent
4b614333c6
commit
90689a1717
2 changed files with 34 additions and 42 deletions
|
@ -458,7 +458,7 @@ CShadows::StoreShadowForCar(CAutomobile *pCar)
|
||||||
if ( CTimeCycle::GetShadowStrength() != 0 )
|
if ( CTimeCycle::GetShadowStrength() != 0 )
|
||||||
{
|
{
|
||||||
CVector CarPos = pCar->GetPosition();
|
CVector CarPos = pCar->GetPosition();
|
||||||
float fDistToCamSqr = (CarPos - TheCamera.GetPosition()).MagnitudeSqr();
|
float fDistToCamSqr = (CarPos - TheCamera.GetPosition()).MagnitudeSqr2D();
|
||||||
|
|
||||||
if ( CCutsceneMgr::IsRunning() )
|
if ( CCutsceneMgr::IsRunning() )
|
||||||
fDistToCamSqr /= SQR(TheCamera.LODDistMultiplier) * 4.0f;
|
fDistToCamSqr /= SQR(TheCamera.LODDistMultiplier) * 4.0f;
|
||||||
|
@ -1578,40 +1578,41 @@ CStaticShadow::Free(void)
|
||||||
|
|
||||||
void
|
void
|
||||||
CShadows::CalcPedShadowValues(CVector vecLightDir,
|
CShadows::CalcPedShadowValues(CVector vecLightDir,
|
||||||
float *pfDisplacementX, float *pfDisplacementY,
|
|
||||||
float *pfFrontX, float *pfFrontY,
|
float *pfFrontX, float *pfFrontY,
|
||||||
float *pfSideX, float *pfSideY)
|
float *pfSideX, float *pfSideY,
|
||||||
|
float *pfDisplacementX, float *pfDisplacementY)
|
||||||
{
|
{
|
||||||
ASSERT(pfDisplacementX != NULL);
|
ASSERT(pfFrontX != nil);
|
||||||
ASSERT(pfDisplacementY != NULL);
|
ASSERT(pfFrontY != nil);
|
||||||
ASSERT(pfFrontX != NULL);
|
ASSERT(pfSideX != nil);
|
||||||
ASSERT(pfFrontY != NULL);
|
ASSERT(pfSideY != nil);
|
||||||
ASSERT(pfSideX != NULL);
|
ASSERT(pfDisplacementX != nil);
|
||||||
ASSERT(pfSideY != NULL);
|
ASSERT(pfDisplacementY != nil);
|
||||||
|
|
||||||
|
*pfFrontX = -vecLightDir.x;
|
||||||
|
*pfFrontY = -vecLightDir.y;
|
||||||
|
|
||||||
|
float fDist = Sqrt(*pfFrontY * *pfFrontY + *pfFrontX * *pfFrontX);
|
||||||
|
float fMult = (fDist + 1.0f) / fDist;
|
||||||
|
|
||||||
|
*pfFrontX *= fMult;
|
||||||
|
*pfFrontY *= fMult;
|
||||||
|
|
||||||
|
*pfSideX = -vecLightDir.y / fDist;
|
||||||
|
*pfSideY = vecLightDir.x / fDist;
|
||||||
|
|
||||||
*pfDisplacementX = -vecLightDir.x;
|
*pfDisplacementX = -vecLightDir.x;
|
||||||
*pfDisplacementY = -vecLightDir.y;
|
*pfDisplacementY = -vecLightDir.y;
|
||||||
|
|
||||||
float fDist = Sqrt(*pfDisplacementY * *pfDisplacementY + *pfDisplacementX * *pfDisplacementX);
|
|
||||||
float fMult = (fDist + 1.0f) / fDist;
|
|
||||||
|
|
||||||
*pfDisplacementX *= fMult;
|
|
||||||
*pfDisplacementY *= fMult;
|
|
||||||
|
|
||||||
*pfFrontX = -vecLightDir.y / fDist;
|
|
||||||
*pfFrontY = vecLightDir.x / fDist;
|
|
||||||
|
|
||||||
*pfSideX = -vecLightDir.x;
|
|
||||||
*pfSideY = -vecLightDir.y;
|
|
||||||
|
|
||||||
*pfDisplacementX /= 2;
|
|
||||||
*pfDisplacementY /= 2;
|
|
||||||
|
|
||||||
*pfFrontX /= 2;
|
*pfFrontX /= 2;
|
||||||
*pfFrontY /= 2;
|
*pfFrontY /= 2;
|
||||||
|
|
||||||
*pfSideX /= 2;
|
*pfSideX /= 2;
|
||||||
*pfSideY /= 2;
|
*pfSideY /= 2;
|
||||||
|
|
||||||
|
*pfDisplacementX /= 2;
|
||||||
|
*pfDisplacementY /= 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1656,22 +1657,22 @@ CShadows::RenderExtraPlayerShadows(void)
|
||||||
vecLight.y *= fInv;
|
vecLight.y *= fInv;
|
||||||
vecLight.z *= fInv;
|
vecLight.z *= fInv;
|
||||||
|
|
||||||
float fDisplacementX, fDisplacementY, fFrontX, fFrontY, fSideX, fSideY;
|
float fFrontX, fFrontY, fSideX, fSideY, fDisplacementX, fDisplacementY;
|
||||||
|
|
||||||
CalcPedShadowValues(vecLight,
|
CalcPedShadowValues(vecLight,
|
||||||
&fDisplacementX, &fDisplacementY,
|
|
||||||
&fFrontX, &fFrontY,
|
&fFrontX, &fFrontY,
|
||||||
&fSideX, &fSideY);
|
&fSideX, &fSideY,
|
||||||
|
&fDisplacementX, &fDisplacementY);
|
||||||
|
|
||||||
CVector shadowPos = FindPlayerCoors();
|
CVector shadowPos = FindPlayerCoors();
|
||||||
|
|
||||||
shadowPos.x += fSideX;
|
shadowPos.x += fDisplacementX;
|
||||||
shadowPos.y += fSideY;
|
shadowPos.y += fDisplacementY;
|
||||||
|
|
||||||
|
|
||||||
StoreShadowToBeRendered(SHADOWTYPE_DARK, gpShadowPedTex, &shadowPos,
|
StoreShadowToBeRendered(SHADOWTYPE_DARK, gpShadowPedTex, &shadowPos,
|
||||||
fDisplacementX, fDisplacementY,
|
|
||||||
fFrontX, fFrontY,
|
fFrontX, fFrontY,
|
||||||
|
fSideX, fSideY,
|
||||||
nColorStrength, 0, 0, 0,
|
nColorStrength, 0, 0, 0,
|
||||||
4.0f, false, 1.0f);
|
4.0f, false, 1.0f);
|
||||||
}
|
}
|
||||||
|
@ -1768,7 +1769,7 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur
|
||||||
{
|
{
|
||||||
ASSERT(pPosn != NULL);
|
ASSERT(pPosn != NULL);
|
||||||
|
|
||||||
C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, Max(fFrontX, -fSideY),
|
C3dMarkers::PlaceMarkerSet(nID, MARKERTYPE_CYLINDER, *pPosn, Max(fFrontX, -fSideY),
|
||||||
0, 128, 255, 128,
|
0, 128, 255, 128,
|
||||||
2048, 0.2f, 0);
|
2048, 0.2f, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,21 +128,12 @@ class CPed;
|
||||||
class CShadows
|
class CShadows
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if 1
|
|
||||||
static int16 ShadowsStoredToBeRendered;
|
static int16 ShadowsStoredToBeRendered;
|
||||||
static CStoredShadow asShadowsStored [MAX_STOREDSHADOWS];
|
static CStoredShadow asShadowsStored [MAX_STOREDSHADOWS];
|
||||||
static CPolyBunch aPolyBunches [MAX_POLYBUNCHES];
|
static CPolyBunch aPolyBunches [MAX_POLYBUNCHES];
|
||||||
static CStaticShadow aStaticShadows [MAX_STATICSHADOWS];
|
static CStaticShadow aStaticShadows [MAX_STATICSHADOWS];
|
||||||
static CPolyBunch *pEmptyBunchList;
|
static CPolyBunch *pEmptyBunchList;
|
||||||
static CPermanentShadow aPermanentShadows[MAX_PERMAMENTSHADOWS];
|
static CPermanentShadow aPermanentShadows[MAX_PERMAMENTSHADOWS];
|
||||||
#else
|
|
||||||
static int16 &ShadowsStoredToBeRendered;
|
|
||||||
static CStoredShadow (&asShadowsStored) [MAX_STOREDSHADOWS];
|
|
||||||
static CPolyBunch (&aPolyBunches) [MAX_POLYBUNCHES];
|
|
||||||
static CStaticShadow (&aStaticShadows) [MAX_STATICSHADOWS];
|
|
||||||
static CPolyBunch *&pEmptyBunchList;
|
|
||||||
static CPermanentShadow (&aPermanentShadows)[MAX_PERMAMENTSHADOWS];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void Init (void);
|
static void Init (void);
|
||||||
static void Shutdown (void);
|
static void Shutdown (void);
|
||||||
|
@ -166,7 +157,7 @@ public:
|
||||||
CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch);
|
CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, float fScale, CPolyBunch **ppPolyBunch);
|
||||||
static void UpdateStaticShadows (void);
|
static void UpdateStaticShadows (void);
|
||||||
static void UpdatePermanentShadows (void);
|
static void UpdatePermanentShadows (void);
|
||||||
static void CalcPedShadowValues (CVector vecLightDir, float *pfDisplacementX, float *pfDisplacementY, float *pfFrontX, float *pfFrontY, float *pfSideX, float *pfSideY);
|
static void CalcPedShadowValues (CVector vecLightDir, float *pfFrontX, float *pfFrontY, float *pfSideX, float *pfSideY, float *pfDisplacementX, float *pfDisplacementY);
|
||||||
static void RenderExtraPlayerShadows (void);
|
static void RenderExtraPlayerShadows (void);
|
||||||
static void TidyUpShadows (void);
|
static void TidyUpShadows (void);
|
||||||
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
|
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
|
||||||
|
|
Loading…
Reference in a new issue