1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-21 21:05:56 +02:00

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
This commit is contained in:
Werner Almesberger 2010-09-23 19:55:11 -03:00
parent 77a2b2d8c6
commit 06b1b08c47

View File

@ -8,6 +8,9 @@
#include "level.h"
#define NEAR 1
static void draw_map(GtkWidget *widget, struct face *f)
{
int x, y, z;
@ -27,19 +30,21 @@ static void draw_map(GtkWidget *widget, struct face *f)
continue;
}
z0 = f->z_ref+f->fx*(x-f->sx/2)+f->fy*(y-f->sy/2);
if (fabs(z-z0) < 1) {
if (fabs(z-z0) < NEAR) {
*p++ = 255*fabs(z-z0);
*p++ = 255*fabs(z-z0);
*p++ = 255;
continue;
}
if (z < z0) {
z = 255.0*(z-z0)/(z0-f->a->min_z);
z = z > z0-2*NEAR ? 255*(z-z0)/NEAR :
255.0*(z-z0)/(z0-f->a->min_z);
*p++ = 255;
*p++ = z;
*p++ = z;
} else {
z = 255.0*(z0-z)/(f->a->max_z-z0);
z = z < z0+2*NEAR ? 255*(z0-z)/NEAR :
255.0*(z0-z)/(f->a->max_z-z0);
*p++ = z;
*p++ = 255;
*p++ = z;