diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-05-17 22:49:34 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-05-17 22:49:34 +0000 |
commit | 5699033bfb75587970fda3bcb0a538a19c5da5b8 (patch) | |
tree | 1709f67f3d3e8fcf3b75686207cb3ae03eda921e /src/model.c | |
parent | d862034071446734f9929d15c4770f43456efaef (diff) |
Use own convention for primitive types
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@23 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/model.c')
-rw-r--r-- | src/model.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/model.c b/src/model.c index 2f768f5..bb8758f 100644 --- a/src/model.c +++ b/src/model.c @@ -154,7 +154,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render FILE *fh; char tmp[64]; Model *model; - GLenum type; + PrimitiveType type; int num_vertices; GLfloat *vertices; GLfloat *normals; @@ -176,7 +176,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render normals = malloc(MAX_VERTICES*3*sizeof(GLfloat)); texcoords = malloc(MAX_VERTICES*2*sizeof(GLfloat)); num_vertices = 0; - type = GL_TRIANGLES; + type = PRIMITIVE_TRIANGLES; attribs = ATTRIB_NONE; texture = NULL; while ( !feof(fh) ) { @@ -199,17 +199,17 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render model_add_primitive(model, type, vertices, normals, texcoords, num_vertices, attribs, col_r, col_g, col_b, texture); num_vertices = 0; - type = GL_TRIANGLES; + type = PRIMITIVE_TRIANGLES; attribs = ATTRIB_NONE; texture = NULL; } } if ( strncmp(line, "QUADS", 5) == 0 ) { - type = GL_QUADS; + type = PRIMITIVE_QUADS; } if ( strncmp(line, "TRIANGLES", 9) == 0 ) { - type = GL_TRIANGLES; + type = PRIMITIVE_TRIANGLES; } if ( sscanf(line, "%f %f %f %f %f", &forget, &forget, &forget, &x, &y) == 5 ) { @@ -223,11 +223,11 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render texcoords[2*num_vertices+0] = texx; texcoords[2*num_vertices+1] = texy; num_vertices++; - if ( (type == GL_QUADS) && ((num_vertices % 4)==0) ) { + if ( (type == PRIMITIVE_QUADS) && ((num_vertices % 4)==0) ) { model_calculate_normals(vertices, normals, num_vertices-4, num_vertices-1, num_vertices-4, num_vertices-3, num_vertices-2); } - if ( (type == GL_TRIANGLES) && ((num_vertices % 3)==0) ) { + if ( (type == PRIMITIVE_TRIANGLES) && ((num_vertices % 3)==0) ) { model_calculate_normals(vertices, normals, num_vertices-3, num_vertices-1, num_vertices-3, num_vertices-2, num_vertices-1); } |