Date:2010-09-24 00:55:11 (13 years 6 months ago)
Author:Werner Almesberger
Commit:06b1b08c47b19345428f0a84f8776e81a7d50370
Message:Added red and green band to blue band as further visual clues.

- solidify/level.c (draw_map): moved open-coded "almost at the same height"
parameter to constant NEAR
- solidify/level.c (draw_map): draw green and red band next to the "near"
blue band
Files: solidify/level.c (2 diffs)

Change Details

solidify/level.c
88#include "level.h"
99
1010
11#define NEAR 1
12
13
1114static void draw_map(GtkWidget *widget, struct face *f)
1215{
1316    int x, y, z;
...... 
2730                continue;
2831            }
2932            z0 = f->z_ref+f->fx*(x-f->sx/2)+f->fy*(y-f->sy/2);
30            if (fabs(z-z0) < 1) {
33            if (fabs(z-z0) < NEAR) {
3134                *p++ = 255*fabs(z-z0);
3235                *p++ = 255*fabs(z-z0);
3336                *p++ = 255;
3437                continue;
3538            }
3639            if (z < z0) {
37                z = 255.0*(z-z0)/(z0-f->a->min_z);
40                z = z > z0-2*NEAR ? 255*(z-z0)/NEAR :
41                    255.0*(z-z0)/(z0-f->a->min_z);
3842                *p++ = 255;
3943                *p++ = z;
4044                *p++ = z;
4145            } else {
42                z = 255.0*(z0-z)/(f->a->max_z-z0);
46                z = z < z0+2*NEAR ? 255*(z0-z)/NEAR :
47                    255.0*(z0-z)/(f->a->max_z-z0);
4348                *p++ = z;
4449                *p++ = 255;
4550                *p++ = z;

Archive Download the corresponding diff file

Branches:
master



interactive