TINYGL: formatting code

This commit is contained in:
Pawel Kolodziejski 2014-07-02 07:59:22 +02:00
parent 565f488c58
commit e350350908
5 changed files with 12 additions and 12 deletions

View File

@ -212,8 +212,8 @@ void glEndList() {
int glIsList(unsigned int list) {
GLContext *c = gl_get_context();
GLList *l;
l = find_list(c, list);
GLList *l = find_list(c, list);
return (l != NULL);
}

View File

@ -150,7 +150,7 @@ void glopHint(GLContext *, GLParam *) {
// do nothing
}
void glopPolygonOffset(GLContext *c, GLParam *p) {
void glopPolygonOffset(GLContext *c, GLParam *p) {
c->offset_factor = p[1].f;
c->offset_units = p[2].f;
}

View File

@ -73,8 +73,7 @@ FORCEINLINE static void drawLine(FrameBuffer *buffer, ZBufferPoint *p1, ZBufferP
} 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;
unsigned int r, g, b;
unsigned int *pz = NULL;
@ -114,16 +113,16 @@ void FrameBuffer::fillLine(ZBufferPoint *p1, ZBufferPoint *p2, int color) {
if (dx >= dy) {
drawLine<interpRGB, interpZ>(this, p1, p2, pixelOffset, cmode, pz, z, color, r, g, b, dx, dy, sx - 1, -1);
} else {
drawLine<interpRGB,interpZ>(this, p1, p2, pixelOffset, cmode, pz, z, color, r, g, b, dx, dy, sx - 1, sx);
drawLine<interpRGB, interpZ>(this, p1, p2, pixelOffset, cmode, pz, z, color, r, g, b, dx, dy, sx - 1, sx);
}
}
}
void FrameBuffer::plot(ZBufferPoint *p) {
unsigned int *pz;
unsigned int r, g, b;
pz = zbuf + (p->y * xsize + p->x);
unsigned int r, g, b;
int col = RGB_TO_PIXEL(p->r, p->g, p->b);
unsigned int z = p->z;
putPixel<false, true>(this, linesize * p->y + p->x * PSZB, cmode, pz, z, col, r, g, b);

View File

@ -235,14 +235,16 @@ Matrix4 Matrix4::inverseOrtho() const {
Matrix4 Matrix4::inverse() const {
Matrix4 result = *this;
MatrixInverse((float *)result._m);
return result;
}
void Matrix4::rotation(float t, int u) {
identity();
float s, c;
int v, w;
identity();
if ((v = u + 1) > 2)
v = 0;
if ((w = v + 1) > 2)

View File

@ -58,9 +58,9 @@ FORCEINLINE static void putPixelSmooth(FrameBuffer *buffer, int buf, unsigned in
}
FORCEINLINE static void putPixelMappingPerspective(FrameBuffer *buffer, int buf,
Graphics::PixelFormat &textureFormat, Graphics::PixelBuffer &texture, unsigned int *pz, int _a,
unsigned int &z, unsigned int &t, unsigned int &s, int &tmp, unsigned int &rgba, unsigned int &a,
int &dzdx, int &dsdx, int &dtdx, unsigned int &drgbdx, unsigned int dadx) {
Graphics::PixelFormat &textureFormat, Graphics::PixelBuffer &texture, unsigned int *pz, int _a,
unsigned int &z, unsigned int &t, unsigned int &s, int &tmp, unsigned int &rgba, unsigned int &a,
int &dzdx, int &dsdx, int &dtdx, unsigned int &drgbdx, unsigned int dadx) {
if (ZCMP(z, pz[_a])) {
unsigned ttt = (t & 0x003FC000) >> (9 - PSZSH);
unsigned sss = (s & 0x003FC000) >> (17 - PSZSH);
@ -711,5 +711,4 @@ void FrameBuffer::fillTriangleFlatShadow(ZBufferPoint *p0, ZBufferPoint *p1, ZBu
fillTriangle<interpRGB, interpZ, interpST, interpSTZ, DRAW_SHADOW>(p0, p1, p2);
}
} // end of namespace TinyGL