From b468d010a8a185bd04cdb1fb41810a189971e583 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 11 Aug 2020 18:39:53 +0200 Subject: implemented extended postfx --- src/render/MBlur.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'src/render') diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index 4c805d25..08298a1f 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -11,6 +11,7 @@ #include "Camera.h" #include "MBlur.h" #include "Timer.h" +#include "postfx.h" // Originally taken from RW example 'mblur' @@ -30,6 +31,10 @@ extern "C" D3DCAPS8 _RwD3D8DeviceCaps; RwBool CMBlur::MotionBlurOpen(RwCamera *cam) { +#ifdef EXTENDED_COLOURFILTER + CPostFX::Open(cam); + return TRUE; +#else #ifdef GTA_PS2 RwRect rect = {0, 0, 0, 0}; @@ -130,18 +135,22 @@ CMBlur::MotionBlurOpen(RwCamera *cam) return TRUE; #endif +#endif } RwBool CMBlur::MotionBlurClose(void) { +#ifdef EXTENDED_COLOURFILTER + CPostFX::Close(); +#else if(pFrontBuffer){ RwRasterDestroy(pFrontBuffer); pFrontBuffer = nil; return TRUE; } - +#endif return FALSE; } @@ -197,8 +206,8 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect) RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, 255); - RwIm2DVertexSetScreenX(&Vertex2[0], zero); - RwIm2DVertexSetScreenY(&Vertex2[0], zero); + RwIm2DVertexSetScreenX(&Vertex2[0], zero + 2.0f); + RwIm2DVertexSetScreenY(&Vertex2[0], zero + 2.0f); RwIm2DVertexSetScreenZ(&Vertex2[0], RwIm2DGetNearScreenZ()); RwIm2DVertexSetCameraZ(&Vertex2[0], RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetRecipCameraZ(&Vertex2[0], 1.0f/RwCameraGetNearClipPlane(cam)); @@ -206,8 +215,8 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect) RwIm2DVertexSetV(&Vertex2[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetIntRGBA(&Vertex2[0], 255, 255, 255, 255); - RwIm2DVertexSetScreenX(&Vertex2[1], zero); - RwIm2DVertexSetScreenY(&Vertex2[1], ymax); + RwIm2DVertexSetScreenX(&Vertex2[1], 2.0f); + RwIm2DVertexSetScreenY(&Vertex2[1], ymax + 2.0f); RwIm2DVertexSetScreenZ(&Vertex2[1], RwIm2DGetNearScreenZ()); RwIm2DVertexSetCameraZ(&Vertex2[1], RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetRecipCameraZ(&Vertex2[1], 1.0f/RwCameraGetNearClipPlane(cam)); @@ -215,8 +224,8 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect) RwIm2DVertexSetV(&Vertex2[1], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetIntRGBA(&Vertex2[1], 255, 255, 255, 255); - RwIm2DVertexSetScreenX(&Vertex2[2], xmax); - RwIm2DVertexSetScreenY(&Vertex2[2], ymax); + RwIm2DVertexSetScreenX(&Vertex2[2], xmax + 2.0f); + RwIm2DVertexSetScreenY(&Vertex2[2], ymax + 2.0f); RwIm2DVertexSetScreenZ(&Vertex2[2], RwIm2DGetNearScreenZ()); RwIm2DVertexSetCameraZ(&Vertex2[2], RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetRecipCameraZ(&Vertex2[2], 1.0f/RwCameraGetNearClipPlane(cam)); @@ -224,20 +233,22 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect) RwIm2DVertexSetV(&Vertex2[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetIntRGBA(&Vertex2[2], 255, 255, 255, 255); - RwIm2DVertexSetScreenX(&Vertex2[3], xmax); - RwIm2DVertexSetScreenY(&Vertex2[3], zero); + RwIm2DVertexSetScreenX(&Vertex2[3], xmax + 2.0f); + RwIm2DVertexSetScreenY(&Vertex2[3], zero + 2.0f); RwIm2DVertexSetScreenZ(&Vertex2[3], RwIm2DGetNearScreenZ()); RwIm2DVertexSetCameraZ(&Vertex2[3], RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetRecipCameraZ(&Vertex2[3], 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetU(&Vertex2[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetV(&Vertex2[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetIntRGBA(&Vertex2[3], 255, 255, 255, 255); - } void CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha) { +#ifdef EXTENDED_COLOURFILTER + CPostFX::Render(cam, red, green, blue, blur, type, bluralpha); +#else RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur }; #ifdef GTA_PS2 if( pFrontBuffer ) @@ -253,6 +264,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u RwRasterPopContext(); } #endif +#endif } static uint8 DrunkBlurRed = 128; -- cgit v1.2.3 From 878ffa8998f7fc78064d0e38795f26ee0de57688 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 12 Aug 2020 10:48:00 +0200 Subject: sun reflection fix --- src/render/Coronas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index df5dfadb..2d621d18 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -604,8 +604,8 @@ CCoronas::RenderSunReflection(void) RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+1], r, g, b, 255); RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+1], - sunPos.x + fwdLen*sunDir.x - sideLen*sunDir.x, - sunPos.y + fwdLen*sunDir.y + sideLen*sunDir.y, + sunPos.x + fwdLen*sunDir.x - sideLen*sunDir.y, + sunPos.y + fwdLen*sunDir.y + sideLen*sunDir.x, sunPos.z); RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+0], 0.0f); -- cgit v1.2.3