From 31678be1711af6afeb1ba9a7d02cc44e26ee9520 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 12 Dec 2016 00:44:07 -0600 Subject: working on adding particles and trying to figure out where the greyscale broke. --- hackvr.c | 97 ++++++++++++++++++++++++++++++++++++++++-------------------- map2globe.py | 2 ++ 2 files changed, 67 insertions(+), 32 deletions(-) diff --git a/hackvr.c b/hackvr.c index 8868e15..6689258 100644 --- a/hackvr.c +++ b/hackvr.c @@ -28,9 +28,9 @@ int fps=0; //if I don't do hiliting I only need to calculate that upon click. #define WALK_SPEED 1 -#define SPLIT_SCREEN 2 +#define SPLIT_SCREEN 1 #define CAMERA_SEPARATION 4 -#define RED_AND_BLUE 1 +#define RED_AND_BLUE 0 #define SHAPES 16386 #define MAX_SIDES 8 @@ -334,7 +334,7 @@ c3_t rotate_c3_zr(c3_t p1,c3_t p2,real zr) {//rotate x and y around camera based void rotate_shape_yr(struct c3_shape *s) {//changes input value! int i=0; - for(i=0;ilen;i++) s->p[0]=rotate_c3_yr(s->p[0],camera.p,camera.yr); + for(i=0;ilen+(s->len==1);i++) s->p[0]=rotate_c3_yr(s->p[0],camera.p,camera.yr); } c2_t c3_to_c2(c3_t p3) { //DO NOT DRAW STUFF IN HERE @@ -344,8 +344,8 @@ c2_t c3_to_c2(c3_t p3) { //DO NOT DRAW STUFF IN HERE // c3_t tmp3; c3_t final; //these rotations need to be about the previous axis after the axis itself has been rotated. - final=rotate_c3_yr(p3,camera.p,d2r(camera.yr));//rotate everything around the camera's location. -// final=rotate_c3_yr(p3,(c3_t){0,0,0},d2r(camera.yr));//rotate everything around the center no matter what. +// final=rotate_c3_yr(p3,camera.p,d2r(camera.yr));//rotate everything around the camera's location. + final=rotate_c3_yr(p3,(c3_t){0,0,0},d2r(camera.yr));//rotate everything around the center no matter what. // tmp2=rotate_c3_xr(tmp1,camera.p,d2r(camera.xr)); // final=rotate_c3_zr(tmp2,camera.p,d2r(camera.zr)); real delta_x=(camera.p.x - final.x); @@ -393,15 +393,12 @@ real shitdist(struct c3_shape s,c3_t p) { real total; s_=s; rotate_shape_yr(&s_); - for(i=0;iid)) { - XSetForeground(global.dpy,global.backgc,global.green.pixel); + //XSetForeground(global.dpy,global.backgc,global.green.pixel); } else { if(global.greyscale) { if(zs[i].d > 0) { - if(zs[i].d < 10) { + if(zs[i].d < 100) { colori=zs[i].d; } } - XSetForeground(global.dpy,global.backgc,global.colors[(int)(100.0-(colori * 10.0))].pixel); + colori=(int)(zs[i].d)%100; + XSetForeground(global.dpy,global.backgc,global.colors[(int)(100.0-(colori))].pixel);//picking the color here only works if... } } } @@ -907,7 +940,7 @@ int load_stdin() { global.shape[i]=malloc(sizeof(struct c3_shape)); global.shape[i]->id=strdup(id); global.shape[i]->len=strtold(a[2],0); - for(j=0;j < global.shape[i]->len;j++) { + for(j=0;j < global.shape[i]->len+(global.shape[i]->len==1);j++) { global.shape[i]->p[j].x=strtold(a[(j*3)+3],0);//second arg is just for a return value. set to 0 if you don't want it. global.shape[i]->p[j].y=strtold(a[(j*3)+4],0); global.shape[i]->p[j].z=strtold(a[(j*3)+5],0); @@ -923,7 +956,7 @@ int load_stdin() { if(!strcmp(command,"scaleup")) {//should this scale separately so it can be a deform too? for(i=0;global.shape[i];i++) { if(!strcmp(global.shape[i]->id,id)) { - for(j=0;j < global.shape[i]->len;j++) { + for(j=0;j < global.shape[i]->len+(global.shape[i]->len==1);j++) { global.shape[i]->p[j].x*=strtold(a[2],0); global.shape[i]->p[j].y*=strtold(a[2],0); global.shape[i]->p[j].z*=strtold(a[2],0); @@ -937,7 +970,7 @@ int load_stdin() { if(len > 4) { for(i=0;global.shape[i];i++) { if(!strcmp(global.shape[i]->id,id)) { - for(j=0;j < global.shape[i]->len;j++) { + for(j=0;j < global.shape[i]->len+(global.shape[i]->len==1);j++) { global.shape[i]->p[j].x+=strtold(a[2],0); global.shape[i]->p[j].y+=strtold(a[3],0); global.shape[i]->p[j].z+=strtold(a[4],0); diff --git a/map2globe.py b/map2globe.py index 52ab416..8e58752 100755 --- a/map2globe.py +++ b/map2globe.py @@ -16,6 +16,8 @@ z="0" # / 90 * math.pi #they need to be in the range 0 to 2pi? +print("globe addshape 1 0 0 0 1 -1 0") + while(1): #print (plat,plon,lat,lon) try: -- cgit v1.2.3