diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Fluff.cpp | 5 | ||||
-rw-r--r-- | src/render/Font.h | 2 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 6 | ||||
-rw-r--r-- | src/render/Rubbish.h | 4 | ||||
-rw-r--r-- | src/render/Shadows.cpp | 63 | ||||
-rw-r--r-- | src/render/Shadows.h | 11 | ||||
-rw-r--r-- | src/render/Sprite2d.cpp | 9 |
7 files changed, 56 insertions, 44 deletions
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index f86801bf..690a1d3f 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -152,9 +152,9 @@ void CMovingThings::Shutdown() void CMovingThings::Update() { - const int TIME_SPAN = 64; // frames to process all aMovingThings - int16 i; +#ifndef SQUEEZE_PERFORMANCE + const int TIME_SPAN = 64; // frames to process all aMovingThings int block = CTimer::GetFrameCounter() % TIME_SPAN; @@ -167,6 +167,7 @@ void CMovingThings::Update() if (aMovingThings[i].m_nHidden == 0) aMovingThings[i].Update(); } +#endif for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i) { diff --git a/src/render/Font.h b/src/render/Font.h index 9b4e7132..48f5703d 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -68,8 +68,8 @@ class CFont static int16 Size[MAX_FONTS][193]; #endif static int16 NewLine; - static CSprite2d Sprite[MAX_FONTS]; public: + static CSprite2d Sprite[MAX_FONTS]; static CFontDetails Details; static void Initialise(void); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 88d412c9..717021a7 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -73,8 +73,12 @@ CRenderer::PreRender(void) for(i = 0; i < ms_nNoOfVisibleEntities; i++) ms_aVisibleEntityPtrs[i]->PreRender(); - for(i = 0; i < ms_nNoOfInVisibleEntities; i++) + for (i = 0; i < ms_nNoOfInVisibleEntities; i++) { +#ifdef SQUEEZE_PERFORMANCE + if (ms_aInVisibleEntityPtrs[i]->IsVehicle() && ((CVehicle*)ms_aInVisibleEntityPtrs[i])->IsHeli()) +#endif ms_aInVisibleEntityPtrs[i]->PreRender(); + } for(node = CVisibilityPlugins::m_alphaEntityList.head.next; node != &CVisibilityPlugins::m_alphaEntityList.tail; diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h index 2be592fe..37f895f3 100644 --- a/src/render/Rubbish.h +++ b/src/render/Rubbish.h @@ -4,7 +4,11 @@ class CVehicle; enum { // NB: not all values are allowed, check the code +#ifdef SQUEEZE_PERFORMANCE + NUM_RUBBISH_SHEETS = 32 +#else NUM_RUBBISH_SHEETS = 64 +#endif }; class COneSheet diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index c169c351..8c892be3 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -458,7 +458,7 @@ CShadows::StoreShadowForCar(CAutomobile *pCar) if ( CTimeCycle::GetShadowStrength() != 0 ) { CVector CarPos = pCar->GetPosition(); - float fDistToCamSqr = (CarPos - TheCamera.GetPosition()).MagnitudeSqr(); + float fDistToCamSqr = (CarPos - TheCamera.GetPosition()).MagnitudeSqr2D(); if ( CCutsceneMgr::IsRunning() ) fDistToCamSqr /= SQR(TheCamera.LODDistMultiplier) * 4.0f; @@ -1027,7 +1027,9 @@ CShadows::CastShadowEntity(CEntity *pEntity, float fStartX, float fStartY, floa CColTrianglePlane *pColTriPlanes = pCol->trianglePlanes; ASSERT(pColTriPlanes != NULL); - if ( Abs(pColTriPlanes[i].normal.z) > 0.1f ) + CVector normal; + pColTriPlanes[i].GetNormal(normal); + if ( Abs(normal.z) > 0.1f ) { CColTriangle *pColTri = pCol->triangles; ASSERT(pColTri != NULL); @@ -1578,40 +1580,41 @@ CStaticShadow::Free(void) void CShadows::CalcPedShadowValues(CVector vecLightDir, - float *pfDisplacementX, float *pfDisplacementY, float *pfFrontX, float *pfFrontY, - float *pfSideX, float *pfSideY) + float *pfSideX, float *pfSideY, + float *pfDisplacementX, float *pfDisplacementY) { - ASSERT(pfDisplacementX != NULL); - ASSERT(pfDisplacementY != NULL); - ASSERT(pfFrontX != NULL); - ASSERT(pfFrontY != NULL); - ASSERT(pfSideX != NULL); - ASSERT(pfSideY != NULL); + ASSERT(pfFrontX != nil); + ASSERT(pfFrontY != nil); + ASSERT(pfSideX != nil); + ASSERT(pfSideY != nil); + ASSERT(pfDisplacementX != nil); + ASSERT(pfDisplacementY != nil); - *pfDisplacementX = -vecLightDir.x; - *pfDisplacementY = -vecLightDir.y; + *pfFrontX = -vecLightDir.x; + *pfFrontY = -vecLightDir.y; - float fDist = Sqrt(*pfDisplacementY * *pfDisplacementY + *pfDisplacementX * *pfDisplacementX); + float fDist = Sqrt(*pfFrontY * *pfFrontY + *pfFrontX * *pfFrontX); float fMult = (fDist + 1.0f) / fDist; - *pfDisplacementX *= fMult; - *pfDisplacementY *= fMult; - - *pfFrontX = -vecLightDir.y / fDist; - *pfFrontY = vecLightDir.x / fDist; + *pfFrontX *= fMult; + *pfFrontY *= fMult; - *pfSideX = -vecLightDir.x; - *pfSideY = -vecLightDir.y; + *pfSideX = -vecLightDir.y / fDist; + *pfSideY = vecLightDir.x / fDist; - *pfDisplacementX /= 2; - *pfDisplacementY /= 2; + *pfDisplacementX = -vecLightDir.x; + *pfDisplacementY = -vecLightDir.y; *pfFrontX /= 2; *pfFrontY /= 2; *pfSideX /= 2; *pfSideY /= 2; + + *pfDisplacementX /= 2; + *pfDisplacementY /= 2; + } void @@ -1656,22 +1659,22 @@ CShadows::RenderExtraPlayerShadows(void) vecLight.y *= fInv; vecLight.z *= fInv; - float fDisplacementX, fDisplacementY, fFrontX, fFrontY, fSideX, fSideY; + float fFrontX, fFrontY, fSideX, fSideY, fDisplacementX, fDisplacementY; CalcPedShadowValues(vecLight, - &fDisplacementX, &fDisplacementY, - &fFrontX, &fFrontY, - &fSideX, &fSideY); + &fFrontX, &fFrontY, + &fSideX, &fSideY, + &fDisplacementX, &fDisplacementY); CVector shadowPos = FindPlayerCoors(); - shadowPos.x += fSideX; - shadowPos.y += fSideY; + shadowPos.x += fDisplacementX; + shadowPos.y += fDisplacementY; StoreShadowToBeRendered(SHADOWTYPE_DARK, gpShadowPedTex, &shadowPos, - fDisplacementX, fDisplacementY, fFrontX, fFrontY, + fSideX, fSideY, nColorStrength, 0, 0, 0, 4.0f, false, 1.0f); } @@ -1768,7 +1771,7 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur { 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, 2048, 0.2f, 0); } diff --git a/src/render/Shadows.h b/src/render/Shadows.h index 63aaaaf2..8c909df3 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -128,21 +128,12 @@ class CPed; class CShadows { public: -#if 1 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]; -#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 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); static void UpdateStaticShadows (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 TidyUpShadows (void); static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity); diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index 52b85018..453ed004 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -4,6 +4,7 @@ #include "Draw.h" #include "Camera.h" #include "Sprite2d.h" +#include "Font.h" RwIm2DVertex CSprite2d::maVertices[8]; float CSprite2d::RecipNearClip; @@ -27,14 +28,18 @@ CSprite2d::InitPerFrame(void) mCurrentBank = 0; for(i = 0; i < 10; i++) mCurrentSprite[i] = 0; +#ifndef SQUEEZE_PERFORMANCE for(i = 0; i < 10; i++) mpBankTextures[i] = nil; +#endif } int32 CSprite2d::GetBank(int32 n, RwTexture *tex) { +#ifndef SQUEEZE_PERFORMANCE mpBankTextures[mCurrentBank] = tex; +#endif mCurrentSprite[mCurrentBank] = 0; mBankStart[mCurrentBank+1] = mBankStart[mCurrentBank] + n; return mCurrentBank++; @@ -59,8 +64,12 @@ CSprite2d::DrawBank(int32 bank) { if(mCurrentSprite[bank] == 0) return; +#ifndef SQUEEZE_PERFORMANCE RwRenderStateSet(rwRENDERSTATETEXTURERASTER, mpBankTextures[bank] ? RwTextureGetRaster(mpBankTextures[bank]) : nil); +#else + CFont::Sprite[bank].SetRenderState(); +#endif RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwIm2DRenderPrimitive(rwPRIMTYPETRILIST, &maBankVertices[6*mBankStart[bank]], 6*mCurrentSprite[bank]); |