review of sw_texture_sample_linear
This commit is contained in:
parent
3fdefb7839
commit
5027e4481e
14
src/external/rlsw.h
vendored
14
src/external/rlsw.h
vendored
|
|
@ -1942,18 +1942,20 @@ static inline void sw_texture_sample_linear(float *color, const sw_texture_t *te
|
||||||
// TODO: With a bit more cleverness we could clearly reduce the
|
// TODO: With a bit more cleverness we could clearly reduce the
|
||||||
// number of operations here, but for now it works fine.
|
// number of operations here, but for now it works fine.
|
||||||
|
|
||||||
float xf = u*tex->width - 0.5f;
|
float xf = (u * tex->width) - 0.5f;
|
||||||
float yf = v*tex->height - 0.5f;
|
float yf = (v * tex->height) - 0.5f;
|
||||||
|
|
||||||
int x0 = (int)floorf(xf);
|
float fx = sw_fract(xf);
|
||||||
int y0 = (int)floorf(yf);
|
float fy = sw_fract(yf);
|
||||||
|
|
||||||
float fx = xf - x0;
|
int x0 = (int)xf;
|
||||||
float fy = yf - y0;
|
int y0 = (int)yf;
|
||||||
|
|
||||||
int x1 = x0 + 1;
|
int x1 = x0 + 1;
|
||||||
int y1 = y0 + 1;
|
int y1 = y0 + 1;
|
||||||
|
|
||||||
|
// NOTE: If the textures are POT we could avoid the division for SW_REPEAT
|
||||||
|
|
||||||
if (tex->sWrap == SW_CLAMP)
|
if (tex->sWrap == SW_CLAMP)
|
||||||
{
|
{
|
||||||
x0 = (x0 > tex->wMinus1)? tex->wMinus1 : x0;
|
x0 = (x0 > tex->wMinus1)? tex->wMinus1 : x0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user