mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-15 16:58:01 +00:00
TINYGL: fixed formatting and minor cleanup
This commit is contained in:
parent
485face105
commit
f33e1384f1
@ -74,7 +74,6 @@ void gl_draw_point(GLContext *c, GLVertex *p0) {
|
||||
// line
|
||||
|
||||
static inline void interpolate(GLVertex *q, GLVertex *p0, GLVertex *p1, float t) {
|
||||
|
||||
q->pc = p0->pc + (p1->pc - p0->pc) * t;
|
||||
q->color = p0->color + (p1->color - p0->color) * t;
|
||||
}
|
||||
|
@ -154,9 +154,6 @@ void glopTexImage2D(GLContext *c, GLParam *p) {
|
||||
|
||||
pixels1 = new byte[256 * 256 * bytes];
|
||||
if (width != 256 || height != 256) {
|
||||
// no interpolation is done here to respect the original image aliasing !
|
||||
//gl_resizeImageNoInterpolate(pixels1, 256, 256, (unsigned char *)pixels, width, height);
|
||||
// used interpolation anyway, it look much better :) --- aquadran
|
||||
gl_resizeImage(pixels1, 256, 256, pixels, width, height);
|
||||
width = 256;
|
||||
height = 256;
|
||||
|
@ -6,7 +6,8 @@ namespace TinyGL {
|
||||
#define ZCMP(z,zpix) ((z) >= (zpix))
|
||||
|
||||
template <bool interpRGB, bool interpZ>
|
||||
FORCEINLINE static void putPixel(PIXEL *pp, const Graphics::PixelFormat &cmode, unsigned int *pz, unsigned int &z, int &color, unsigned int &r, unsigned int &g, unsigned int &b) {
|
||||
FORCEINLINE static void putPixel(PIXEL *pp, const Graphics::PixelFormat &cmode, unsigned int *pz,
|
||||
unsigned int &z, int &color, unsigned int &r, unsigned int &g, unsigned int &b) {
|
||||
if (interpZ) {
|
||||
if (ZCMP(z, *pz)) {
|
||||
if (interpRGB) {
|
||||
@ -28,8 +29,9 @@ FORCEINLINE static void putPixel(PIXEL *pp, const Graphics::PixelFormat &cmode,
|
||||
}
|
||||
}
|
||||
|
||||
template <bool interpRGB, bool interpZ>
|
||||
FORCEINLINE static void drawLine(ZBufferPoint *p1, ZBufferPoint *p2, PIXEL *pp, const Graphics::PixelFormat &cmode, unsigned int *pz, unsigned int &z, int &color, unsigned int &r, unsigned int &g, unsigned int &b, int dx, int dy, int inc_1, int inc_2) {
|
||||
template <bool interpRGB, bool interpZ> FORCEINLINE static void drawLine(ZBufferPoint *p1, ZBufferPoint *p2, PIXEL *pp,
|
||||
const Graphics::PixelFormat &cmode, unsigned int *pz, unsigned int &z, int &color,
|
||||
unsigned int &r, unsigned int &g, unsigned int &b, int dx, int dy, int inc_1, int inc_2) {
|
||||
int n = dx;
|
||||
int rinc, ginc, binc;
|
||||
int zinc;
|
||||
@ -41,7 +43,7 @@ FORCEINLINE static void drawLine(ZBufferPoint *p1, ZBufferPoint *p2, PIXEL *pp,
|
||||
ginc = ((p2->g - p1->g) << 8) / n;
|
||||
binc = ((p2->b - p1->b) << 8) / n;
|
||||
}
|
||||
int a = 2 * dy - dx;
|
||||
int a = 2 * dy - dx;
|
||||
dy = 2 * dy;
|
||||
dx = 2 * dx - dy;
|
||||
int pp_inc_1 = (inc_1) * PSZB;
|
||||
@ -61,8 +63,8 @@ FORCEINLINE static void drawLine(ZBufferPoint *p1, ZBufferPoint *p2, PIXEL *pp,
|
||||
if (interpZ) {
|
||||
pz += inc_1;
|
||||
}
|
||||
a -= dx;
|
||||
} else {
|
||||
a -= dx;
|
||||
} else {
|
||||
pp = (PIXEL *)((char *)pp + pp_inc_2);
|
||||
if (interpZ) {
|
||||
pz += inc_2;
|
||||
@ -72,8 +74,7 @@ FORCEINLINE static void drawLine(ZBufferPoint *p1, ZBufferPoint *p2, PIXEL *pp,
|
||||
} while (--n >= 0);
|
||||
}
|
||||
|
||||
template <bool interpRGB, bool interpZ>
|
||||
void FrameBuffer::fillLine(ZBufferPoint *p1, ZBufferPoint *p2, int color) {
|
||||
template <bool interpRGB, bool interpZ> void FrameBuffer::fillLine(ZBufferPoint *p1, ZBufferPoint *p2, int color) {
|
||||
int dx, dy, sx;
|
||||
PIXEL *pp;
|
||||
unsigned int r, g, b;
|
||||
|
@ -5,7 +5,8 @@
|
||||
namespace TinyGL {
|
||||
|
||||
// Inversion of a 4x4 matrix.
|
||||
// It's not just unrolling, this is a different implementation that directly uses the formula whereas the previous one is using another method (which is generic and thus, slower)
|
||||
// It's not just unrolling, this is a different implementation that directly
|
||||
// uses the formula whereas the previous one is using another method (which is generic and thus, slower)
|
||||
int MatrixInverse(float *m) {
|
||||
double inv[16];
|
||||
|
||||
@ -135,8 +136,7 @@ int MatrixInverse(float *m) {
|
||||
}
|
||||
|
||||
void Vector3::normalize() {
|
||||
float n;
|
||||
n = sqrt(X * X + Y * Y + Z * Z);
|
||||
float n = sqrt(X * X + Y * Y + Z * Z);
|
||||
if (n != 0) {
|
||||
X /= n;
|
||||
Y /= n;
|
||||
|
Loading…
x
Reference in New Issue
Block a user