mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-21 20:39:57 +01:00
Remove redundant function
This commit is contained in:
parent
eaea810b85
commit
151fa7c283
2 changed files with 11 additions and 32 deletions
26
s3l.h
26
s3l.h
|
@ -1068,32 +1068,6 @@ static inline void S3L_mapCameraToScreen(S3L_Vec4 point, S3L_Camera *camera,
|
|||
// ^ S3L_FRACTIONS_PER_UNIT cancel out
|
||||
}
|
||||
|
||||
/*
|
||||
Helper function to interpolate texture coordinates based on barycentric
|
||||
coordinates. If you're going for max performance, you may want to compute
|
||||
these values yourself -- some specific cases may be possible to compute
|
||||
faster.
|
||||
*/
|
||||
|
||||
void S3L_interpolateTexCoords(
|
||||
S3L_Unit u0,
|
||||
S3L_Unit v0,
|
||||
S3L_Unit u1,
|
||||
S3L_Unit v1,
|
||||
S3L_Unit u2,
|
||||
S3L_Unit v2,
|
||||
S3L_PixelInfo *p,
|
||||
S3L_Unit *u,
|
||||
S3L_Unit *v
|
||||
)
|
||||
{
|
||||
*u = (p->barycentric0 * u0 + p->barycentric1 * u1 + p->barycentric2 * u2) /
|
||||
S3L_FRACTIONS_PER_UNIT;
|
||||
|
||||
*v = (p->barycentric0 * v0 + p->barycentric1 * v1 + p->barycentric2 * v2) /
|
||||
S3L_FRACTIONS_PER_UNIT;
|
||||
}
|
||||
|
||||
void S3L_drawModelIndexed(
|
||||
const S3L_Unit coords[],
|
||||
const S3L_Index triangleVertexIndices[],
|
||||
|
|
17
testSDL.c
17
testSDL.c
|
@ -90,12 +90,17 @@ void drawPixel(S3L_PixelInfo *p)
|
|||
|
||||
coords = tex_coords + p->triangleID * 6;
|
||||
|
||||
S3L_interpolateTexCoords(
|
||||
coords[0] * 16,coords[1] * 16,
|
||||
coords[2] * 16,coords[3] * 16,
|
||||
coords[4] * 16,coords[5] * 16,
|
||||
p,
|
||||
&u,&v);
|
||||
u = S3L_interpolateBarycentric(
|
||||
coords[0] * 16,
|
||||
coords[2] * 16,
|
||||
coords[4] * 16,
|
||||
p->barycentric0, p->barycentric1, p->barycentric2);
|
||||
|
||||
v = S3L_interpolateBarycentric(
|
||||
coords[1] * 16,
|
||||
coords[3] * 16,
|
||||
coords[5] * 16,
|
||||
p->barycentric0, p->barycentric1, p->barycentric2);
|
||||
|
||||
uint8_t col = texturePixel(u,v);
|
||||
|
||||
|
|
Loading…
Reference in a new issue