aboutsummaryrefslogtreecommitdiff
path: root/src/model.c
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-08-10 19:14:40 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-08-10 19:14:40 +0000
commit9836d52cebef33002b8cea7d2e15d4e0da043e76 (patch)
treebe29c88526015ce27b8c480b4ce79c2b5a038ab2 /src/model.c
parent98315c0a86e2d8157e3aec73d532bb4c87860ed2 (diff)
Process texture and Ks components from OBJ files
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@246 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/model.c')
-rw-r--r--src/model.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/model.c b/src/model.c
index 570a128..81958ec 100644
--- a/src/model.c
+++ b/src/model.c
@@ -78,7 +78,7 @@ static Model *model_new(const char *name) {
static Primitive *model_add_primitive(Model *model, GLenum type, GLfloat *vertices, GLfloat *normals,
GLfloat *texcoords, int n, PrimitiveAttrib attribs, GLfloat r, GLfloat g,
GLfloat b, char *texture, GLfloat radius, GLfloat shininess,
- int vbos, int coll) {
+ int vbos, int coll, GLfloat colspec) {
Primitive *p;
@@ -116,6 +116,7 @@ static Primitive *model_add_primitive(Model *model, GLenum type, GLfloat *vertic
p->col_r = r;
p->col_g = g;
p->col_b = b;
+ p->colspec = colspec;
p->texture = texture;
p->radius = radius;
p->shininess = shininess;
@@ -198,6 +199,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
GLfloat col_r = 0.0;
GLfloat col_g = 0.0;
GLfloat col_b = 0.0;
+ GLfloat colspec = 0.0;
GLfloat radius = 0.0;
GLfloat shininess = 100.0;
PrimitiveAttrib attribs;
@@ -267,7 +269,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
if ( num_vertices > 0 ) {
model_add_primitive(model, type, vertices, normals, texcoords, num_vertices,
attribs, col_r, col_g, col_b, texture, radius, shininess,
- render->vbos, coll);
+ render->vbos, coll, colspec);
num_vertices = 0;
type = PRIMITIVE_TRIANGLES;
attribs = ATTRIB_NONE;
@@ -452,6 +454,10 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
attribs = attribs | ATTRIB_COLOUR;
col_r = r; col_g = g; col_b = b;
}
+ if ( sscanf(line, "colspec %f %f %f", &r, &g, &b) == 3 ) {
+ attribs = attribs | ATTRIB_COLSPEC;
+ colspec = r;
+ }
if ( sscanf(line, "radius %f", &radius) == 1 ) {
attribs = attribs | ATTRIB_RADIUS;
}