1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-26 18:15:27 +00:00

finished sprites

This commit is contained in:
aap 2020-08-24 14:26:17 +02:00
parent 38a01a59fa
commit 0a19925e99
2 changed files with 13 additions and 11 deletions

View file

@ -148,10 +148,10 @@ CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, fl
// Fade out when too near // Fade out when too near
// why not in buffered version? // why not in buffered version?
if(z < 3.0f){ if(z < 2.3f){
if(z < 1.5f) if(z < 1.3f)
return; return;
int f = (z - 1.5f)/1.5f * 255; int f = (z - 1.3f)/(2.3f-1.3f) * 255;
r = f*r >> 8; r = f*r >> 8;
g = f*g >> 8; g = f*g >> 8;
b = f*b >> 8; b = f*b >> 8;

View file

@ -120,6 +120,8 @@ CSprite2d::Draw(float x1, float y1, float x2, float y2, float x3, float y3, floa
void void
CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3) CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3)
{ {
float offset = 1.0f/1024.0f;
// This is what we draw: // This is what we draw:
// 0---1 // 0---1
// | / | // | / |
@ -130,8 +132,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[0], NearCamZ); RwIm2DVertexSetCameraZ(&maVertices[0], NearCamZ);
RwIm2DVertexSetRecipCameraZ(&maVertices[0], RecipNearClip); RwIm2DVertexSetRecipCameraZ(&maVertices[0], RecipNearClip);
RwIm2DVertexSetIntRGBA(&maVertices[0], c2.r, c2.g, c2.b, c2.a); RwIm2DVertexSetIntRGBA(&maVertices[0], c2.r, c2.g, c2.b, c2.a);
RwIm2DVertexSetU(&maVertices[0], 0.0f, RecipNearClip); RwIm2DVertexSetU(&maVertices[0], 0.0f+offset, RecipNearClip);
RwIm2DVertexSetV(&maVertices[0], 0.0f, RecipNearClip); RwIm2DVertexSetV(&maVertices[0], 0.0f+offset, RecipNearClip);
RwIm2DVertexSetScreenX(&maVertices[1], r.right); RwIm2DVertexSetScreenX(&maVertices[1], r.right);
RwIm2DVertexSetScreenY(&maVertices[1], r.top); RwIm2DVertexSetScreenY(&maVertices[1], r.top);
@ -139,8 +141,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[1], NearCamZ); RwIm2DVertexSetCameraZ(&maVertices[1], NearCamZ);
RwIm2DVertexSetRecipCameraZ(&maVertices[1], RecipNearClip); RwIm2DVertexSetRecipCameraZ(&maVertices[1], RecipNearClip);
RwIm2DVertexSetIntRGBA(&maVertices[1], c3.r, c3.g, c3.b, c3.a); RwIm2DVertexSetIntRGBA(&maVertices[1], c3.r, c3.g, c3.b, c3.a);
RwIm2DVertexSetU(&maVertices[1], 1.0f, RecipNearClip); RwIm2DVertexSetU(&maVertices[1], 1.0f+offset, RecipNearClip);
RwIm2DVertexSetV(&maVertices[1], 0.0f, RecipNearClip); RwIm2DVertexSetV(&maVertices[1], 0.0f+offset, RecipNearClip);
RwIm2DVertexSetScreenX(&maVertices[2], r.right); RwIm2DVertexSetScreenX(&maVertices[2], r.right);
RwIm2DVertexSetScreenY(&maVertices[2], r.bottom); RwIm2DVertexSetScreenY(&maVertices[2], r.bottom);
@ -148,8 +150,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[2], NearCamZ); RwIm2DVertexSetCameraZ(&maVertices[2], NearCamZ);
RwIm2DVertexSetRecipCameraZ(&maVertices[2], RecipNearClip); RwIm2DVertexSetRecipCameraZ(&maVertices[2], RecipNearClip);
RwIm2DVertexSetIntRGBA(&maVertices[2], c1.r, c1.g, c1.b, c1.a); RwIm2DVertexSetIntRGBA(&maVertices[2], c1.r, c1.g, c1.b, c1.a);
RwIm2DVertexSetU(&maVertices[2], 1.0f, RecipNearClip); RwIm2DVertexSetU(&maVertices[2], 1.0f+offset, RecipNearClip);
RwIm2DVertexSetV(&maVertices[2], 1.0f, RecipNearClip); RwIm2DVertexSetV(&maVertices[2], 1.0f+offset, RecipNearClip);
RwIm2DVertexSetScreenX(&maVertices[3], r.left); RwIm2DVertexSetScreenX(&maVertices[3], r.left);
RwIm2DVertexSetScreenY(&maVertices[3], r.bottom); RwIm2DVertexSetScreenY(&maVertices[3], r.bottom);
@ -157,8 +159,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[3], NearCamZ); RwIm2DVertexSetCameraZ(&maVertices[3], NearCamZ);
RwIm2DVertexSetRecipCameraZ(&maVertices[3], RecipNearClip); RwIm2DVertexSetRecipCameraZ(&maVertices[3], RecipNearClip);
RwIm2DVertexSetIntRGBA(&maVertices[3], c0.r, c0.g, c0.b, c0.a); RwIm2DVertexSetIntRGBA(&maVertices[3], c0.r, c0.g, c0.b, c0.a);
RwIm2DVertexSetU(&maVertices[3], 0.0f, RecipNearClip); RwIm2DVertexSetU(&maVertices[3], 0.0f+offset, RecipNearClip);
RwIm2DVertexSetV(&maVertices[3], 1.0f, RecipNearClip); RwIm2DVertexSetV(&maVertices[3], 1.0f+offset, RecipNearClip);
} }
void void