Make things C89 friendly
This commit is contained in:
parent
de1fb05ac1
commit
4218111ab8
18
GL/draw.c
18
GL/draw.c
|
@ -90,23 +90,25 @@ static void _parseColour(uint32* out, const GLubyte* in, GLint size, GLenum type
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _parseFloats(GLfloat* out, const GLubyte* in, GLint size, GLenum type) {
|
static void _parseFloats(GLfloat* out, const GLubyte* in, GLint size, GLenum type) {
|
||||||
|
GLubyte i = 0;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case GL_SHORT: {
|
case GL_SHORT: {
|
||||||
GLshort* inp = (GLshort*) in;
|
GLshort* inp = (GLshort*) in;
|
||||||
for(GLubyte i = 0; i < size; ++i) {
|
for(i = 0; i < size; ++i) {
|
||||||
out[i] = (GLfloat) inp[i];
|
out[i] = (GLfloat) inp[i];
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case GL_INT: {
|
case GL_INT: {
|
||||||
GLint* inp = (GLint*) in;
|
GLint* inp = (GLint*) in;
|
||||||
for(GLubyte i = 0; i < size; ++i) {
|
for(i = 0; i < size; ++i) {
|
||||||
out[i] = (GLfloat) inp[i];
|
out[i] = (GLfloat) inp[i];
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case GL_FLOAT:
|
case GL_FLOAT:
|
||||||
case GL_DOUBLE: /* Double == Float */
|
case GL_DOUBLE: /* Double == Float */
|
||||||
default:
|
default:
|
||||||
for(GLubyte i = 0; i < size; ++i) out[i] = ((GLfloat*) in)[i];
|
for(i = 0; i < size; ++i) out[i] = ((GLfloat*) in)[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +167,8 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
|
||||||
|
|
||||||
GLboolean lighting_enabled = isLightingEnabled();
|
GLboolean lighting_enabled = isLightingEnabled();
|
||||||
|
|
||||||
for(GLuint i = first; i < count; ++i) {
|
GLushort i;
|
||||||
|
for(i = first; i < count; ++i) {
|
||||||
pvr_vertex_t* vertex = (pvr_vertex_t*) dst;
|
pvr_vertex_t* vertex = (pvr_vertex_t*) dst;
|
||||||
vertex->u = vertex->v = 0.0f;
|
vertex->u = vertex->v = 0.0f;
|
||||||
vertex->argb = 0;
|
vertex->argb = 0;
|
||||||
|
@ -202,9 +205,12 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
|
||||||
GLfloat contribution [] = {0.0f, 0.0f, 0.0f, 0.0f};
|
GLfloat contribution [] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
GLfloat to_add [] = {0.0f, 0.0f, 0.0f, 0.0f};
|
GLfloat to_add [] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
|
||||||
for(GLubyte i = 0; i < MAX_LIGHTS; ++i) {
|
/* FIXME!!! Transform the position to eye space */
|
||||||
|
|
||||||
|
GLubyte j;
|
||||||
|
for(j = 0; j < MAX_LIGHTS; ++j) {
|
||||||
if(isLightEnabled(i)) {
|
if(isLightEnabled(i)) {
|
||||||
calculateLightingContribution(i, &vertex->x, normal, to_add);
|
calculateLightingContribution(j, &vertex->x, normal, to_add);
|
||||||
|
|
||||||
contribution[0] += to_add[0];
|
contribution[0] += to_add[0];
|
||||||
contribution[1] += to_add[1];
|
contribution[1] += to_add[1];
|
||||||
|
|
|
@ -23,7 +23,8 @@ void initLights() {
|
||||||
MATERIAL.diffuse_color_index = 1.0f;
|
MATERIAL.diffuse_color_index = 1.0f;
|
||||||
MATERIAL.specular_color_index = 1.0f;
|
MATERIAL.specular_color_index = 1.0f;
|
||||||
|
|
||||||
for(GLubyte i = 0; i < MAX_LIGHTS; ++i) {
|
GLubyte i;
|
||||||
|
for(i = 0; i < MAX_LIGHTS; ++i) {
|
||||||
memcpy(LIGHTS[i].ambient, ZERO, sizeof(GLfloat) * 4);
|
memcpy(LIGHTS[i].ambient, ZERO, sizeof(GLfloat) * 4);
|
||||||
memcpy(LIGHTS[i].diffuse, ONE, sizeof(GLfloat) * 4);
|
memcpy(LIGHTS[i].diffuse, ONE, sizeof(GLfloat) * 4);
|
||||||
memcpy(LIGHTS[i].specular, ONE, sizeof(GLfloat) * 4);
|
memcpy(LIGHTS[i].specular, ONE, sizeof(GLfloat) * 4);
|
||||||
|
|
|
@ -189,7 +189,8 @@ void initContext() {
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
for(GLubyte i = 0; i < MAX_LIGHTS; ++i) {
|
GLubyte i;
|
||||||
|
for(i = 0; i < MAX_LIGHTS; ++i) {
|
||||||
glDisable(GL_LIGHT0 + i);
|
glDisable(GL_LIGHT0 + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -549,7 +549,8 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform the conversion */
|
/* Perform the conversion */
|
||||||
for(GLuint i = 0; i < bytes; i += 2) {
|
GLuint i;
|
||||||
|
for(i = 0; i < bytes; i += 2) {
|
||||||
convert(source, dest);
|
convert(source, dest);
|
||||||
|
|
||||||
dest++;
|
dest++;
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -3,6 +3,7 @@
|
||||||
# kos-ports/libgl Makefile
|
# kos-ports/libgl Makefile
|
||||||
# Copyright (C) 2013, 2014 Josh Pearson
|
# Copyright (C) 2013, 2014 Josh Pearson
|
||||||
# Copyright (C) 2014 Lawrence Sebald
|
# Copyright (C) 2014 Lawrence Sebald
|
||||||
|
# Copyright (C) 2018 Luke Benstead
|
||||||
|
|
||||||
TARGET = libGL.a
|
TARGET = libGL.a
|
||||||
OBJS = gl-rgb.o gl-fog.o gl-sh4-light.o gl-light.o gl-clip.o gl-clip-arrays.o
|
OBJS = gl-rgb.o gl-fog.o gl-sh4-light.o gl-light.o gl-clip.o gl-clip-arrays.o
|
||||||
|
|
|
@ -43,8 +43,9 @@ inline char named_array_used(NamedArray* array, unsigned int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void* named_array_alloc(NamedArray* array, unsigned int* new_id) {
|
inline void* named_array_alloc(NamedArray* array, unsigned int* new_id) {
|
||||||
for(unsigned int i = 0; i < array->marker_count; ++i) {
|
unsigned int i = 0, j = 0;
|
||||||
for(unsigned int j = 0; j < 8; ++j) {
|
for(i = 0; i < array->marker_count; ++i) {
|
||||||
|
for(j = 0; j < 8; ++j) {
|
||||||
unsigned int id = (i * 8) + j + 1;
|
unsigned int id = (i * 8) + j + 1;
|
||||||
if(!named_array_used(array, id)) {
|
if(!named_array_used(array, id)) {
|
||||||
array->used_markers[i] |= (unsigned char) 1 << j;
|
array->used_markers[i] |= (unsigned char) 1 << j;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user