summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Hud.cpp63
-rw-r--r--src/render/MBlur.cpp16
-rw-r--r--src/render/Sprite2d.cpp17
3 files changed, 59 insertions, 37 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 1e536382..08c0cb85 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -175,7 +175,8 @@ void CHud::Draw()
rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.6f);
rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.6f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
else {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.4f);
@@ -183,7 +184,8 @@ void CHud::Draw()
rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.4f);
rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.4f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
}
else {
@@ -194,7 +196,9 @@ void CHud::Draw()
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f);
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f);
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+
}
else if (Mode == CCam::MODE_1STPERSON_RUNABOUT) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f);
@@ -202,7 +206,8 @@ void CHud::Draw()
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f);
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f * 0.7f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
else if (Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
@@ -216,29 +221,33 @@ void CHud::Draw()
}
else {
// Sniper
- rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f);
- rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f);
- rect.right = SCREEN_WIDTH / 2;
- rect.bottom = SCREEN_HEIGHT / 2;
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
-
- rect.right = (SCREEN_WIDTH / 2);
- rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f);
- rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2);
- rect.bottom = SCREEN_HEIGHT / 2;
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
-
- rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f);
- rect.bottom = (SCREEN_HEIGHT / 2);
- rect.right = (SCREEN_WIDTH / 2);
- rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2);
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
-
- rect.right = (SCREEN_WIDTH / 2);
- rect.bottom = (SCREEN_HEIGHT / 2);
- rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2);
- rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2);
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ rect.left = SCREEN_WIDTH/2 - SCREEN_SCALE_X(210.0f);
+ rect.top = SCREEN_HEIGHT/2 - SCREEN_SCALE_Y(210.0f);
+ rect.right = SCREEN_WIDTH/2;
+ rect.bottom = SCREEN_HEIGHT/2;
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.01f, 0.01f, 1.0f, 0.0f, 0.01f, 1.0f, 1.0f, 1.0f);
+
+ rect.left = SCREEN_WIDTH/2;
+ rect.top = SCREEN_HEIGHT/2 - SCREEN_SCALE_Y(210.0f);
+ rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
+ rect.bottom = SCREEN_HEIGHT/2;
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.99f, 0.0f, 0.01f, 0.01f, 0.99f, 1.0f, 0.01f, 1.0f);
+
+ rect.left = SCREEN_WIDTH/2 - SCREEN_SCALE_X(210.0f);
+ rect.top = SCREEN_HEIGHT/2;
+ rect.right = SCREEN_WIDTH/2;
+ rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.01f, 0.99f, 1.0f, 0.99f, 0.01f, 0.01f, 1.0f, 0.01f);
+
+ rect.left = SCREEN_WIDTH/2;
+ rect.top = SCREEN_HEIGHT/2;
+ rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
+ rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.99f, 0.99f, 0.01f, 0.99f, 0.99f, 0.01f, 0.1f, 0.01f);
}
}
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index ec811e56..de15358e 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -10,6 +10,7 @@
#include "RwHelper.h"
#include "Camera.h"
#include "MBlur.h"
+#include "postfx.h"
// Originally taken from RW example 'mblur'
@@ -27,6 +28,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};
@@ -127,18 +132,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;
}
@@ -192,12 +201,14 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
RwIm2DVertexSetU(&Vertex[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetV(&Vertex[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex[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 )
@@ -217,6 +228,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
OverlayRender(cam, nil, color, type, bluralpha);
}
#endif
+#endif
}
void
diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp
index 453ed004..98bb6eb2 100644
--- a/src/render/Sprite2d.cpp
+++ b/src/render/Sprite2d.cpp
@@ -178,6 +178,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
z = 1.0f/RecipNearClip;
}
recipz = 1.0f/z;
+ float offset = 1.0f/1024.0f;
// This is what we draw:
// 0---1
@@ -189,8 +190,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[0], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[0], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[0], c2.r, c2.g, c2.b, c2.a);
- RwIm2DVertexSetU(&maVertices[0], 0.0f, recipz);
- RwIm2DVertexSetV(&maVertices[0], 0.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[0], 0.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[0], 0.0f+offset, recipz);
RwIm2DVertexSetScreenX(&maVertices[1], r.right);
RwIm2DVertexSetScreenY(&maVertices[1], r.top);
@@ -198,8 +199,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[1], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[1], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[1], c3.r, c3.g, c3.b, c3.a);
- RwIm2DVertexSetU(&maVertices[1], 1.0f, recipz);
- RwIm2DVertexSetV(&maVertices[1], 0.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[1], 1.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[1], 0.0f+offset, recipz);
RwIm2DVertexSetScreenX(&maVertices[2], r.right);
RwIm2DVertexSetScreenY(&maVertices[2], r.bottom);
@@ -207,8 +208,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[2], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[2], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[2], c1.r, c1.g, c1.b, c1.a);
- RwIm2DVertexSetU(&maVertices[2], 1.0f, recipz);
- RwIm2DVertexSetV(&maVertices[2], 1.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[2], 1.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[2], 1.0f+offset, recipz);
RwIm2DVertexSetScreenX(&maVertices[3], r.left);
RwIm2DVertexSetScreenY(&maVertices[3], r.bottom);
@@ -216,8 +217,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[3], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[3], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[3], c0.r, c0.g, c0.b, c0.a);
- RwIm2DVertexSetU(&maVertices[3], 0.0f, recipz);
- RwIm2DVertexSetV(&maVertices[3], 1.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[3], 0.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[3], 1.0f+offset, recipz);
}
void