tried to fix some half-pixel bugs

This commit is contained in:
aap 2020-04-26 21:50:52 +02:00
parent c076998ba3
commit 1b5616688e
3 changed files with 23 additions and 16 deletions

View File

@ -31,6 +31,7 @@
#define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id) #define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id)
#define HANIMFRAMES(anim) ((anim)->keyframes) #define HANIMFRAMES(anim) ((anim)->keyframes)
#else #else
#define RWHALFPIXEL // always d3d
#define STREAMPOS(str) ((str)->Type.memory.position) #define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile) #define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo) #define HIERNODEINFO(hier) ((hier)->pNodeInfo)
@ -38,6 +39,12 @@
#define HANIMFRAMES(anim) ((anim)->pFrames) #define HANIMFRAMES(anim) ((anim)->pFrames)
#endif #endif
#ifdef RWHALFPIXEL
#define HALFPX (0.5f)
#else
#define HALFPX (0.0f)
#endif
#define rwVENDORID_ROCKSTAR 0x0253F2 #define rwVENDORID_ROCKSTAR 0x0253F2
// Get rid of bullshit windows definitions, we're not running on an 8086 // Get rid of bullshit windows definitions, we're not running on an 8086

View File

@ -1068,13 +1068,13 @@ drawArrow(RwRect r, int direction, int style)
int top = r.y; int top = r.y;
int bottom = r.y+r.h; int bottom = r.y+r.h;
float umin = 0.5f / width; float umin = HALFPX / width;
float vmin = 0.5f / height; float vmin = HALFPX / height;
float umax = (width + 0.5f) / width; float umax = (width + HALFPX) / width;
float vmax = (height + 0.5f) / height; float vmax = (height + HALFPX) / height;
if(direction < 0){ if(direction < 0){
vmin = (height - 0.5f) / height; vmin = (height - HALFPX) / height;
vmax = -0.5f / height; vmax = -HALFPX / height;
} }
if(style){ if(style){
@ -1167,10 +1167,10 @@ drawMouse(void)
float h = RwRasterGetHeight(cursor); float h = RwRasterGetHeight(cursor);
float recipz = 1.0f/RwCameraGetNearClipPlane(cam); float recipz = 1.0f/RwCameraGetNearClipPlane(cam);
float umin = 0.5f / w; float umin = HALFPX / w;
float vmin = 0.5f / h; float vmin = HALFPX / h;
float umax = (w + 0.5f) / w; float umax = (w + HALFPX) / w;
float vmax = (h + 0.5f) / h; float vmax = (h + HALFPX) / h;
vert = vertices; vert = vertices;
RwIm2DVertexSetScreenX(vert, x); RwIm2DVertexSetScreenX(vert, x);

View File

@ -58,13 +58,13 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
float zero, xmax, ymax; float zero, xmax, ymax;
if(RwRasterGetDepth(RwCameraGetRaster(cam)) == 16){ if(RwRasterGetDepth(RwCameraGetRaster(cam)) == 16){
zero = 0.5f; zero = HALFPX;
xmax = rect->w + 0.5f; xmax = rect->w + HALFPX;
ymax = rect->h + 0.5f; ymax = rect->h + HALFPX;
}else{ }else{
zero = -0.5f; zero = -HALFPX;
xmax = rect->w - 0.5f; xmax = rect->w - HALFPX;
ymax = rect->h - 0.5f; ymax = rect->h - HALFPX;
} }
RwIm2DVertexSetScreenX(&Vertex[0], zero); RwIm2DVertexSetScreenX(&Vertex[0], zero);