aboutsummaryrefslogtreecommitdiff
path: root/src/model.c
diff options
context:
space:
mode:
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;
}