diff options
| author | iCatButler <i.am.catbutler@gmail.com> | 2016-04-27 12:18:13 +0100 |
|---|---|---|
| committer | iCatButler <i.am.catbutler@gmail.com> | 2016-04-27 12:18:13 +0100 |
| commit | 153c8eb4997d21d3b2965cf38d4348f05c29860f (patch) | |
| tree | 994a8995a888c47eacb6d650f8c28c0c631d3c50 /plugins/peopsxgl/draw.c | |
| parent | 580df75296286b65812afdac64d82054279fb235 (diff) | |
| download | pcsxr-153c8eb4997d21d3b2965cf38d4348f05c29860f.tar.gz | |
Perspective correct texturing
- replace calls to glOrtho with new matrix (z value becomes w)
- store w value for each vertex
- if any vertex does not have a w value set whole polygon to 1.0
- Reset vertex between draw calls to prevent stale w values persisting
- validate PGXP values using stored copy of original (allow greater variance)
- properly convert addresses before passing to plugin
- rework memory to use a single pool with offsets
- Implement floating point RTPS/RTPT transform, currently disabled.
Diffstat (limited to 'plugins/peopsxgl/draw.c')
| -rwxr-xr-x | plugins/peopsxgl/draw.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/plugins/peopsxgl/draw.c b/plugins/peopsxgl/draw.c index 922145f0..0e2e440a 100755 --- a/plugins/peopsxgl/draw.c +++ b/plugins/peopsxgl/draw.c @@ -599,8 +599,10 @@ int GLinitialize() glMatrixMode(GL_PROJECTION); // init projection with psx resolution glLoadIdentity(); - glOrtho(0,PSXDisplay.DisplayMode.x, - PSXDisplay.DisplayMode.y, 0, -1, 1); + //glOrtho(0,PSXDisplay.DisplayMode.x, + // PSXDisplay.DisplayMode.y, 0, -1, 1); + + PGXP_SetMatrix(0, PSXDisplay.DisplayMode.x, PSXDisplay.DisplayMode.y, 0, -1, 1); if(iZBufferDepth) // zbuffer? { @@ -1019,8 +1021,6 @@ BOOL offsetline(unsigned int* addr) vertex[2].y=(short)((float)y1+py); - PGXP_GetVertices(addr, vertex); - if(vertex[0].x==vertex[3].x && // ortho rect? done vertex[1].x==vertex[2].x && vertex[0].y==vertex[1].y && @@ -1039,6 +1039,8 @@ BOOL offsetline(unsigned int* addr) vertex[3].x-=VERTEX_OFFX; vertex[3].y-=VERTEX_OFFY; + PGXP_GetVertices(addr, vertex, -VERTEX_OFFX, -VERTEX_OFFY); + return FALSE; } @@ -1070,13 +1072,13 @@ BOOL offset2(unsigned int* addr) vertex[1].y=ly1; } - PGXP_GetVertices(addr, vertex); - vertex[0].x+=PSXDisplay.CumulOffset.x; vertex[1].x+=PSXDisplay.CumulOffset.x; vertex[0].y+=PSXDisplay.CumulOffset.y; vertex[1].y+=PSXDisplay.CumulOffset.y; + PGXP_GetVertices(addr, vertex, PSXDisplay.CumulOffset.x, PSXDisplay.CumulOffset.y); + return FALSE; } @@ -1115,8 +1117,6 @@ BOOL offset3(unsigned int* addr) vertex[2].y=ly2; } - PGXP_GetVertices(addr, vertex); - vertex[0].x+=PSXDisplay.CumulOffset.x; vertex[1].x+=PSXDisplay.CumulOffset.x; vertex[2].x+=PSXDisplay.CumulOffset.x; @@ -1124,6 +1124,8 @@ BOOL offset3(unsigned int* addr) vertex[1].y+=PSXDisplay.CumulOffset.y; vertex[2].y+=PSXDisplay.CumulOffset.y; + PGXP_GetVertices(addr, vertex, PSXDisplay.CumulOffset.x, PSXDisplay.CumulOffset.y); + return FALSE; } @@ -1168,8 +1170,6 @@ BOOL offset4(unsigned int* addr) vertex[3].x=lx3; vertex[3].y=ly3; } - - PGXP_GetVertices(addr, vertex); vertex[0].x+=PSXDisplay.CumulOffset.x; vertex[1].x+=PSXDisplay.CumulOffset.x; @@ -1180,12 +1180,14 @@ BOOL offset4(unsigned int* addr) vertex[2].y+=PSXDisplay.CumulOffset.y; vertex[3].y+=PSXDisplay.CumulOffset.y; + PGXP_GetVertices(addr, vertex, PSXDisplay.CumulOffset.x, PSXDisplay.CumulOffset.y); + return FALSE; } ///////////////////////////////////////////////////////// -void offsetST(void) +void offsetST(unsigned int* addr) { if(bDisplayNotSet) SetOGLDisplaySettings(1); @@ -1215,6 +1217,8 @@ void offsetST(void) vertex[1].y=ly1+PSXDisplay.CumulOffset.y; vertex[2].y=ly2+PSXDisplay.CumulOffset.y; vertex[3].y=ly3+PSXDisplay.CumulOffset.y; + + PGXP_GetVertices(addr, vertex, PSXDisplay.CumulOffset.x, PSXDisplay.CumulOffset.y); } ///////////////////////////////////////////////////////// @@ -1282,7 +1286,7 @@ void offsetScreenUpload(int Position) ///////////////////////////////////////////////////////// -void offsetBlk(void) +void offsetBlk(unsigned int* addr) { if(bDisplayNotSet) SetOGLDisplaySettings(1); @@ -1296,6 +1300,8 @@ void offsetBlk(void) vertex[2].y=ly2-PSXDisplay.GDrawOffset.y + PreviousPSXDisplay.Range.y0; vertex[3].y=ly3-PSXDisplay.GDrawOffset.y + PreviousPSXDisplay.Range.y0; + PGXP_GetVertices(addr, vertex, PreviousPSXDisplay.Range.x0, PreviousPSXDisplay.Range.y0); + if(iUseMask) { vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=gl_z; |
