summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2020-06-03 04:16:16 -0500
committerepoch <epoch@hacking.allowed.org>2020-06-03 04:16:16 -0500
commit6148145ea75d2fceb9a57bafea8c9e0122bdf8c2 (patch)
treeee7993b67f93cdb325ca8707dbbe9803d43a3179 /src
parent7a5184e58e92bbef17feaf9a91449880ee55d937 (diff)
downloadhackvr-6148145ea75d2fceb9a57bafea8c9e0122bdf8c2.tar.gz
hackvr-6148145ea75d2fceb9a57bafea8c9e0122bdf8c2.zip
added the "subsume" command
Diffstat (limited to 'src')
-rw-r--r--src/common.h7
-rw-r--r--src/graphics_c3.h2
-rw-r--r--src/hackvr.c19
-rw-r--r--src/math.h4
4 files changed, 20 insertions, 12 deletions
diff --git a/src/common.h b/src/common.h
index eff423d..99ac1fa 100644
--- a/src/common.h
+++ b/src/common.h
@@ -50,11 +50,12 @@ typedef struct {
typedef struct {
char *id;//for the camera this is $USER, right?
+ char *parent;//the position is relative to the parent's data.
c3_rot_t r;//rotation
c3_t p;//position
c3_t s;//??? shape??? I dunno. really. wtf was this for? PROBABLY SCALE. DUH. that's what it is going to bed used for now anyway.
c3_t v;//velocity
-} c3_group_rot_t;
+} c3_group_rel_t;
//typedef struct c3_line {//is this even used? I think I just use c3_s_t with 2 points.
// char *id;
@@ -112,8 +113,8 @@ struct hvr_global {
struct c3_shape *shape[SHAPES];
int shapes;
struct hashtable ht_group;
- c3_group_rot_t eye[MAX_SIDES];//lol. 1000 eyes! array of group_rots for each eye. how to arrange eyes?
- c3_group_rot_t camera;//should there be an array for this? camera has .s which is a shape struct. each point is the eye?
+ c3_group_rel_t eye[MAX_SIDES];//lol. 1000 eyes! array of group_rels for each eye. how to arrange eyes?
+ c3_group_rel_t camera;//should there be an array for this? camera has .s which is a shape struct. each point is the eye?
real zoom;
int derp;
real split;
diff --git a/src/graphics_c3.h b/src/graphics_c3.h
index 7ea5c74..ce3354c 100644
--- a/src/graphics_c3.h
+++ b/src/graphics_c3.h
@@ -44,7 +44,7 @@ void draw_screen();
void set_aspect_ratio();
void recalculate_eyes();
int selfcommand(char *s);
-cs_t c3_to_cs(c3_group_rot_t eye,c3_t p);
+cs_t c3_to_cs(c3_group_rel_t eye,c3_t p);
radians d2r(degrees d);
real shitdist(struct c3_shape *s,c3_t p);
c3_t rotate_c3_xr(c3_t p1,c3_t p2,radians xr);
diff --git a/src/hackvr.c b/src/hackvr.c
index f2bc438..b789dbe 100644
--- a/src/hackvr.c
+++ b/src/hackvr.c
@@ -155,7 +155,7 @@ int hackvr_handler(char *line) {
int len;
int j,i,k,l;
unsigned int key_count;
- c3_group_rot_t *gr;
+ c3_group_rel_t *gr;
real tmpx,tmpy,tmpz;
char **a;
char **keys;
@@ -226,7 +226,7 @@ int hackvr_handler(char *line) {
global.shape[k]=global.shape[l];
global.shape[l]=0;
}
- //now do the same stuff but for the group_rot structs.
+ //now do the same stuff but for the group_rel structs.
keys=ht_getkeys(&global.ht_group,&key_count);
for(i=0;i<key_count;i++) {
if((m=ht_getentry(&global.ht_group,keys[i]))) {
@@ -305,7 +305,7 @@ int hackvr_handler(char *line) {
/* ---------- */
if(helping) fprintf(stderr,"# assimilate grou*\n");
- if(!strcmp(command,"assimilate")) {//um... what do we do with the group_rotation? flatten it?
+ if(!strcmp(command,"assimilate")) {//um... what do we do with the group_relative? flatten it?
if(len == 3) {
for(j=0;global.shape[j];j++) {
if(!glob_match(a[2],global.shape[j]->id)) {
@@ -444,6 +444,15 @@ int hackvr_handler(char *line) {
/* ---------- */
+ if(helping) fprintf(stderr,"# subsume child-group\n");
+ if(!strcmp(command,"subsume")) {
+ gr=get_group_relative(a[2]);//we need the child's group relative...
+ gr->parent = gr->id;
+ ret=0;
+ return ret;
+ }
+
+/* ---------- */
if(helping) fprintf(stderr,"# addshape color N x1 y1 z1 ... xN yN zN\n");
if(!strcmp(command,"addshape")) {
if(len > 3) {
@@ -639,7 +648,7 @@ int hackvr_handler(char *line) {
fprintf(stderr,"# * move [+]x [+]y [+]z\n");
fprintf(stderr,"# * move forward|backward|up|down|left|right\n");
}
- if(!strcmp(command,"move")) {//this is only moving the first group_rot it finds instead of all group_rots that match the pattern
+ if(!strcmp(command,"move")) {//this is only moving the first group_rel it finds instead of all group_rels that match the pattern
if(len > 2) {
gr=get_group_relative(id);
}
@@ -673,10 +682,8 @@ int hackvr_handler(char *line) {
tmprady=d2r((degrees){global.camera.r.y.d+180});
} else if(!strcmp(a[2],"up")) {
tmprady=(radians){0};
- tmpy=WALK_SPEED*1;
} else if(!strcmp(a[2],"down")) {
tmprady=(radians){0};
- tmpy=-WALK_SPEED*1;
} else if(!strcmp(a[2],"left")) {
tmprady=d2r((degrees){global.camera.r.y.d+270});
} else if(!strcmp(a[2],"right")) {
diff --git a/src/math.h b/src/math.h
index b333767..9c69599 100644
--- a/src/math.h
+++ b/src/math.h
@@ -14,12 +14,12 @@ c2_t rotate_c2(c2_t p1,c2_t p2,radians dr);
c3_t rotate_c3_xr(c3_t p1,c3_t p2,radians xr);
c3_t rotate_c3_yr(c3_t p1,c3_t p2,radians yr);
c3_t rotate_c3_zr(c3_t p1,c3_t p2,radians zr);
-c3_group_rot_t *get_group_relative(char *id);
+c3_group_rel_t *get_group_relative(char *id);
radians d2r(degrees d);
degrees r2d(radians r);
radians points_to_angle(c2_t p1,c2_t p2);
int between_angles(degrees d,real lower,real upper);
-c3_s_t apply_group_relative(c3_s_t s,c3_group_rot_t *group_rot);
+c3_s_t apply_group_relative(c3_s_t s,c3_group_rel_t *group_rel);
c3_t c3_add(c3_t p1,c3_t p2);
c2_t c2_add(c2_t p1,c2_t p2);
real distance3(c3_t p1,c3_t p2);