summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2018-01-02 06:05:43 -0600
committerepoch <epoch@hacking.allowed.org>2018-01-02 06:05:43 -0600
commitbb17403496d39d467b6737880c928e020a50aaec (patch)
treee9bd9d17958caaa76b85201037a9d10f0711716a /src
parentecdf070d79d479655f2a75936845a454cbed84b3 (diff)
downloadhackvr-bb17403496d39d467b6737880c928e020a50aaec.tar.gz
hackvr-bb17403496d39d467b6737880c928e020a50aaec.zip
added different method of calculating distance of a shape to where farthest point is what is used.
Diffstat (limited to 'src')
-rw-r--r--src/graphics_c3.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/graphics_c3.c b/src/graphics_c3.c
index 41fbfcf..b4b9eb9 100644
--- a/src/graphics_c3.c
+++ b/src/graphics_c3.c
@@ -265,6 +265,21 @@ real shitdist2(c3_t p1,c3_t p2) {
real shitdist(struct c3_shape *s,c3_t p) {//this function is a killer. :/
int i;
+ real curdist=0;
+ real maxdist=0;
+ c3_group_rot_t *gr=get_group_rotation(s->id);
+ for(i=0;i< s->len+(s->len==1);i++) {
+ if(gr) {
+ curdist=shitdist2(global.camera.p,rotate_c3_yr(c3_add(gr->p,s->p[i]),gr->p,d2r(gr->r.y)));
+ } else {
+ curdist=shitdist2(global.camera.p,s->p[i]);//if there's no gr we're basically just this point. no rotation, not offests.
+ }
+ if(curdist > maxdist) maxdist=curdist;
+ }
+ return maxdist;
+ //averaging it works ok, but I've decided to now use the farthest to say the distance something is.
+ //why the fuck did we get group rotations each... nevermind. this code just sucks.
+ /*
real total=0;
for(i=0;i< s->len+(s->len==1);i++) {
c3_group_rot_t *gr=get_group_rotation(s->id);
@@ -277,6 +292,7 @@ real shitdist(struct c3_shape *s,c3_t p) {//this function is a killer. :/
,global.camera.p);
}//why the fuck are we rotating this around the camera? that shouldn't make any difference to the distance from the camera...
return (total) / (real)(s->len+(s->len==1));
+ */
}