From 8a4fa58cd42b7cca4a86fe2d9913b839b554bf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Mon, 11 May 2020 05:55:57 +0300 Subject: Linux build support --- src/rw/VisibilityPlugins.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rw/VisibilityPlugins.cpp') diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 5184860b..cb514f07 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -114,7 +114,7 @@ CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera) RpMaterial* SetAlphaCB(RpMaterial *material, void *data) { - ((RwRGBA*)RpMaterialGetColor(material))->alpha = (uint8)(uint32)data; + ((RwRGBA*)RpMaterialGetColor(material))->alpha = (uint8)(uintptr)data; return material; } @@ -833,15 +833,15 @@ void CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo) { CVehicleModelInfo *vmi; - SetFrameHierarchyId(RpClumpGetFrame(clump), (int32)modelInfo); + SetFrameHierarchyId(RpClumpGetFrame(clump), (uintptr)modelInfo); // Unused switch (modelInfo->GetModelType()) { // ignore MLO case MITYPE_VEHICLE: vmi = (CVehicleModelInfo*)modelInfo; - if(vmi->m_vehicleType == VEHICLE_TYPE_TRAIN || - vmi->m_vehicleType == VEHICLE_TYPE_HELI || + if(vmi->m_vehicleType == VEHICLE_TYPE_TRAIN || + vmi->m_vehicleType == VEHICLE_TYPE_HELI || vmi->m_vehicleType == VEHICLE_TYPE_PLANE) CLUMPEXT(clump)->visibilityCB = VehicleVisibilityCB_BigVehicle; else -- cgit v1.2.3 From 70a8234dad441b73c998ee11b2932071ce55c540 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 11 May 2020 22:24:53 +0200 Subject: RenderPedCB from VC --- src/rw/VisibilityPlugins.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/rw/VisibilityPlugins.cpp') diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 5184860b..46ec8ae2 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -557,12 +557,16 @@ RpAtomic* CVisibilityPlugins::RenderPedCB(RpAtomic *atomic) { int32 alpha; + RwV3d cam2atm; - alpha = GetClumpAlpha(RpAtomicGetClump(atomic)); - if(alpha == 255) - AtomicDefaultRenderCallBack(atomic); - else - RenderAlphaAtomic(atomic, alpha); + RwV3dSub(&cam2atm, &RwFrameGetLTM(RpAtomicGetFrame(atomic))->pos, ms_pCameraPosn); + if(RwV3dDotProduct(&cam2atm, &cam2atm) < ms_pedLod1Dist){ + alpha = GetClumpAlpha(RpAtomicGetClump(atomic)); + if(alpha == 255) + AtomicDefaultRenderCallBack(atomic); + else + RenderAlphaAtomic(atomic, alpha); + } return atomic; } -- cgit v1.2.3 From c2ac6b3759901ecede7b22c1e9ab9f5a04ddd527 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 12 May 2020 01:24:57 +0200 Subject: Fix linux warnings --- src/rw/VisibilityPlugins.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/rw/VisibilityPlugins.cpp') diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index d034391c..22edcb68 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -231,7 +231,7 @@ CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist) { RpAtomic *lodatm; float fadefactor; - uint8 alpha; + uint32 alpha; CSimpleModelInfo *mi; mi = GetAtomicModelInfo(atomic); @@ -730,11 +730,13 @@ CVisibilityPlugins::SetAtomicModelInfo(RpAtomic *atomic, { AtomicExt *ext = ATOMICEXT(atomic); ext->modelInfo = modelInfo; - switch (modelInfo->GetModelType()) - case MITYPE_SIMPLE: - case MITYPE_TIME: - if(modelInfo->m_normalCull) - SetAtomicRenderCallback(atomic, RenderObjNormalAtomic); + switch (modelInfo->GetModelType()) { + case MITYPE_SIMPLE: + case MITYPE_TIME: + if(modelInfo->m_normalCull) + SetAtomicRenderCallback(atomic, RenderObjNormalAtomic); + default: break; + } } CSimpleModelInfo* @@ -851,6 +853,7 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo else CLUMPEXT(clump)->visibilityCB = VehicleVisibilityCB; break; + default: break; } } -- cgit v1.2.3