diff options
author | aap <aap@papnet.eu> | 2020-05-11 17:03:32 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-05-11 17:03:44 +0200 |
commit | d4250fc2c7e382b095a4ae09daae4ee3beb65527 (patch) | |
tree | c2cf6c78147b1fc49c0a7ff2860eee616e8852d1 /src/rw | |
parent | little fix for cam (diff) | |
download | re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.tar re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.tar.gz re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.tar.bz2 re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.tar.lz re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.tar.xz re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.tar.zst re3-d4250fc2c7e382b095a4ae09daae4ee3beb65527.zip |
Diffstat (limited to 'src/rw')
-rw-r--r-- | src/rw/RwHelper.cpp | 10 | ||||
-rw-r--r-- | src/rw/RwHelper.h | 2 | ||||
-rw-r--r-- | src/rw/VisibilityPlugins.cpp | 54 | ||||
-rw-r--r-- | src/rw/VisibilityPlugins.h | 3 |
4 files changed, 47 insertions, 22 deletions
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index cb1d4ab5..525c2910 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -12,6 +12,7 @@ RtCharset *debugCharset; #endif bool gPS2alphaTest = 1; +bool gBackfaceCulling; #ifndef FINAL static bool charsetOpen; @@ -116,6 +117,15 @@ DefinedState(void) #endif } +void +SetCullMode(uint32 mode) +{ + if(gBackfaceCulling) + RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)mode); + else + RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE); +} + RwFrame* GetFirstFrameCallback(RwFrame *child, void *data) { diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h index a751ee39..993acd89 100644 --- a/src/rw/RwHelper.h +++ b/src/rw/RwHelper.h @@ -1,6 +1,7 @@ #pragma once extern bool gPS2alphaTest; +extern bool gBackfaceCulling; void *RwMallocAlign(RwUInt32 size, RwUInt32 align); void RwFreeAlign(void *mem); @@ -11,6 +12,7 @@ void DestroyDebugFont(); void ObrsPrintfString(const char *str, short x, short y); void FlushObrsPrintfs(); void DefinedState(void); +void SetCullMode(uint32 mode); RwFrame *GetFirstChild(RwFrame *frame); RwObject *GetFirstObject(RwFrame *frame); RpAtomic *GetFirstAtomic(RpClump *clump); diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index c24677e0..fe2ad06f 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -111,6 +111,11 @@ CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera) ms_pedFadeDist = sq(70.0f * TheCamera.LODDistMultiplier); } +void +CVisibilityPlugins::SetupVehicleVariables(RpClump *vehicle) +{ +} + RpMaterial* SetAlphaCB(RpMaterial *material, void *data) { @@ -164,6 +169,11 @@ CVisibilityPlugins::RenderFadingEntities(void) } } +void +CVisibilityPlugins::RenderFadingUnderwaterEntities(void) +{ +} + RpAtomic* CVisibilityPlugins::RenderWheelAtomicCB(RpAtomic *atomic) { @@ -237,6 +247,7 @@ CVisibilityPlugins::RenderWeaponCB(RpAtomic *atomic) return atomic; } +//--MIAMI: done RpAtomic* CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist) { @@ -247,29 +258,30 @@ CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist) mi = GetAtomicModelInfo(atomic); lodatm = mi->GetAtomicFromDistance(camdist - FADE_DISTANCE); - if(mi->m_additive){ - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); + if(mi->m_additive) AtomicDefaultRenderCallBack(atomic); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - }else{ - fadefactor = (mi->GetLargestLodDistance() - (camdist - FADE_DISTANCE))/FADE_DISTANCE; - if(fadefactor > 1.0f) - fadefactor = 1.0f; - alpha = mi->m_alpha * fadefactor; - if(alpha == 255) - AtomicDefaultRenderCallBack(atomic); - else{ - RpGeometry *geo = RpAtomicGetGeometry(lodatm); - uint32 flags = RpGeometryGetFlags(geo); - RpGeometrySetFlags(geo, flags | rpGEOMETRYMODULATEMATERIALCOLOR); - RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)alpha); - if(geo != RpAtomicGetGeometry(atomic)) - RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?) - AtomicDefaultRenderCallBack(atomic); - RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)255); - RpGeometrySetFlags(geo, flags); - } + + fadefactor = (mi->GetLargestLodDistance() - (camdist - FADE_DISTANCE))/FADE_DISTANCE; + if(fadefactor > 1.0f) + fadefactor = 1.0f; + alpha = mi->m_alpha * fadefactor; + if(alpha == 255) + AtomicDefaultRenderCallBack(atomic); + else{ + RpGeometry *geo = RpAtomicGetGeometry(lodatm); + uint32 flags = RpGeometryGetFlags(geo); + RpGeometrySetFlags(geo, flags | rpGEOMETRYMODULATEMATERIALCOLOR); + RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)alpha); + if(geo != RpAtomicGetGeometry(atomic)) + RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?) + AtomicDefaultRenderCallBack(atomic); + RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)255); + RpGeometrySetFlags(geo, flags); } + + if(mi->m_additive) + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + return atomic; } diff --git a/src/rw/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h index 3f20044f..d21562b6 100644 --- a/src/rw/VisibilityPlugins.h +++ b/src/rw/VisibilityPlugins.h @@ -42,6 +42,7 @@ public: static bool InsertAtomicIntoSortedList(RpAtomic *a, float dist); static void SetRenderWareCamera(RwCamera *camera); + static void SetupVehicleVariables(RpClump *vehicle); static RpAtomic *RenderWheelAtomicCB(RpAtomic *atomic); static RpAtomic *RenderObjNormalAtomic(RpAtomic *atomic); @@ -70,11 +71,11 @@ public: static void RenderAlphaAtomics(void); static void RenderFadingEntities(void); + static void RenderFadingUnderwaterEntities(void); // All actually unused static bool DefaultVisibilityCB(RpClump *clump); static bool FrustumSphereCB(RpClump *clump); - static bool MloVisibilityCB(RpClump *clump); static bool VehicleVisibilityCB(RpClump *clump); static bool VehicleVisibilityCB_BigVehicle(RpClump *clump); |