correct names

This commit is contained in:
Milang 2019-10-25 22:46:36 +02:00
parent 371251f049
commit be6214a41e
1 changed files with 17 additions and 17 deletions

View File

@ -69,24 +69,24 @@ int render_triangle_nobfc(fe_point const s1, fe_point const s2, fe_point const s
if (!side) return RENDER_NOBMP;
// clipping (incomplete)
if (face->s1->x < 0 && face->s2->x < 0 && face->s3->x < 0) return RENDER_OUT_OF_SCREEN;
if (face->s1->x >= fe_width && face->s2->x >= fe_width && face->s3->x >= fe_width) return RENDER_OUT_OF_SCREEN;
if (face->s1->y < 0 && face->s2->y < 0 && face->s3->y < 0) return RENDER_OUT_OF_SCREEN;
if (face->s1->y >= fe_height && face->s2->y >= fe_height && face->s3->y >= fe_height) return RENDER_OUT_OF_SCREEN;
if (face->s1->z <= 0 && face->s2->z <= 0 && face->s3->z <= 0) return RENDER_OUT_OF_SCREEN;
if (s1.x < 0 && s2.x < 0 && s3.x < 0) return RENDER_OUT_OF_SCREEN;
if (s1.x >= fe_width && s2.x >= fe_width && s3.x >= fe_width) return RENDER_OUT_OF_SCREEN;
if (s1.y < 0 && s2.y < 0 && s.>y < 0) return RENDER_OUT_OF_SCREEN;
if (s1.y >= fe_height && s2.y >= fe_height && s3.y >= fe_height) return RENDER_OUT_OF_SCREEN;
if (s1.z <= 0 && s2.z <= 0 && s3.z <= 0) return RENDER_OUT_OF_SCREEN;
line cotes[3];
line_set(&cotes[0], face->s1, face->s2);
line_set(&cotes[1], face->s1, face->s3);
line_set(&cotes[2], face->s2, face->s3);
line_set(&cotes[0], &s1, &s2);
line_set(&cotes[1], &s1, &s3);
line_set(&cotes[2], &s2, &s3);
if (cotes[0].no_line || cotes[1].no_line || cotes[2].no_line) return RENDER_INVISIBLE;
const int32_t ymin = max(min(face->s1->y, min(face->s2->y, face->s3->y)), 0);
const int32_t ymax = min(max(face->s1->y, max(face->s2->y, face->s3->y)), 63);
const int32_t ymin = max(min(s1->y, min(s2->y, s3->y)), 0);
const int32_t ymax = min(max(s1->y, max(s2->y, s3->y)), 63);
const int32_t xAB = face->s2->x - face->s1->x, yAB = face->s2->y - face->s1->y, zAB=face->s2->z-face->s1->z;
const int32_t xAC = face->s3->x - face->s1->x, yAC = face->s3->y - face->s1->y, zAC=face->s3->z-face->s1->z;
const int32_t xAB = s2.x - s1.x, yAB = s2.y - s1.y, zAB=s2->z-s1.z;
const int32_t xAC = s3.x - s1.x, yAC = s3.y - s1.y, zAC=s3->z-s1.z;
const int32_t diviseur_commun = (xAB * yAC - yAB * xAC);
const int32_t fact_1= (32768 * yAC) / diviseur_commun, fact_2 = (32768 * xAC) / diviseur_commun;
@ -113,18 +113,18 @@ int render_triangle_nobfc(fe_point const s1, fe_point const s2, fe_point const s
{
int32_t vx, vy, z;
const int32_t xcalc = x - face->s1->x, ycalc = y - face->s1->y;
const int32_t xcalc = x - s1.x, ycalc = y - s1.y;
// calcul de vx, vy
vx = (xcalc*fact_1 - ycalc*fact_2);
vy = (ycalc*fact_3 - xcalc*fact_4);
z = face->s1->z + (vx * zAB + vy * zAC)/32768;
z = s1->z + (vx * zAB + vy * zAC)/32768;
if (z>0)
{
int32_t vx2= ( vx*face->texture->size_px_x/face->s2->z ) / ((32768-vx)/face->s1->z + vx/face->s2->z);
int32_t vy2= ( vy*face->texture->size_px_y/face->s3->z ) / ((32768-vy)/face->s1->z + vy/face->s3->z);
int32_t vx2= ( vx*texture->size_px_x/s2.z ) / ((32768-vx)/s1->z + vx/s2.z);
int32_t vy2= ( vy*texture->size_px_y/s3.z ) / ((32768-vy)/s1->z + vy/s3.z);
// Affichage du point
const uint8_t color = fe_texture_get_pixel_r(face->texture, vx2, vy2);
const uint8_t color = fe_texture_get_pixel_r(texture, vx2, vy2);
if (color >> 1)
{