mirror of
git://projects.qi-hardware.com/ben-scans.git
synced 2024-11-22 01:21:32 +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:
parent
77a2b2d8c6
commit
06b1b08c47
@ -8,6 +8,9 @@
|
|||||||
#include "level.h"
|
#include "level.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define NEAR 1
|
||||||
|
|
||||||
|
|
||||||
static void draw_map(GtkWidget *widget, struct face *f)
|
static void draw_map(GtkWidget *widget, struct face *f)
|
||||||
{
|
{
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
@ -27,19 +30,21 @@ static void draw_map(GtkWidget *widget, struct face *f)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
z0 = f->z_ref+f->fx*(x-f->sx/2)+f->fy*(y-f->sy/2);
|
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*fabs(z-z0);
|
*p++ = 255*fabs(z-z0);
|
||||||
*p++ = 255;
|
*p++ = 255;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (z < z0) {
|
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++ = 255;
|
||||||
*p++ = z;
|
*p++ = z;
|
||||||
*p++ = z;
|
*p++ = z;
|
||||||
} else {
|
} 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++ = z;
|
||||||
*p++ = 255;
|
*p++ = 255;
|
||||||
*p++ = z;
|
*p++ = z;
|
||||||
|
Loading…
Reference in New Issue
Block a user