aboutsummaryrefslogtreecommitdiff
path: root/src/model.c
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-06-01 22:10:29 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-06-01 22:10:29 +0000
commitb593ae5f1d09d3f1a0bf0f955810ab3997ed0df3 (patch)
tree71b4765e1a9eb20e1bcb31f70e32c2a71d46e42e /src/model.c
parentf2f47bfe06cfe29191325d1ed9679f232642111d (diff)
Apply quad subdivisions when shaders aren't available
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@59 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/model.c')
-rw-r--r--src/model.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/model.c b/src/model.c
index 2c3c895..6ccdaa1 100644
--- a/src/model.c
+++ b/src/model.c
@@ -197,6 +197,14 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
GLfloat shininess = 100.0;
PrimitiveAttrib attribs;
char *texture;
+ int subdiv;
+
+ /* Don't subdivide the geometry if we're doing per-fragment lighting anyway */
+ if ( render->shaders ) {
+ subdiv = 0;
+ } else {
+ subdiv = 1;
+ }
snprintf(tmp, 63, "%s/models/%s", DATADIR, name);
fh = fopen(tmp, "r");
@@ -274,7 +282,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
}
/* Subdivide the previous face if requested */
- if ( sscanf(line, "ssubdivide %f %f", &x, &y) == 2 ) {
+ if ( subdiv && (sscanf(line, "subdivide %f %f", &x, &y) == 2) ) {
if ( type == PRIMITIVE_QUADS ) {
if ( (num_vertices % 4)==0 ) {
GLfloat u, v;