summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-11 13:24:39 -0500
committerXANTRONIX Development2022-03-11 13:24:39 -0500
commit204e2666262247e1c87e27808cac4652e443c5e1 (patch)
tree0d83fe28abc4c1bcb12462e7406ee716bffc08d5 /src
parent5007578cacbc64d4b9854d1cfde857c00647eb35 (diff)
downloadxas-204e2666262247e1c87e27808cac4652e443c5e1.tar.gz
xas-204e2666262247e1c87e27808cac4652e443c5e1.tar.bz2
xas-204e2666262247e1c87e27808cac4652e443c5e1.zip
Save a few CPU cycles (the drones need 'em)
Diffstat (limited to 'src')
-rw-r--r--src/spatial.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/spatial.c b/src/spatial.c
index c79b8e8..fc13a53 100644
--- a/src/spatial.c
+++ b/src/spatial.c
@@ -255,6 +255,9 @@ ssize_t scene_fill(xas_spatial_scene *scene,
size_t value_l, index_l,
value_r, index_r;
+ int within_cone_l = within_cone(obj->point, cone_l),
+ within_cone_r = within_cone(obj->point, cone_r);
+
if (obj->speed != 0.0f) {
xas_spatial_coord point = obj->point;
@@ -269,16 +272,16 @@ ssize_t scene_fill(xas_spatial_scene *scene,
value_l = sample_scale(src[i], obj->distance_l);
value_r = sample_scale(src[i], obj->distance_r);
- if (!within_cone(obj->point, cone_l)) {
- if (within_cone(obj->point, cone_r)) {
+ if (!within_cone_l) {
+ if (within_cone_r) {
value_l /= 8.0f;
} else {
value_l /= 3.0f;
}
}
- if (!within_cone(obj->point, cone_r)) {
- if (within_cone(obj->point, cone_l)) {
+ if (!within_cone_r) {
+ if (within_cone_l) {
value_r /= 8.0f;
} else {
value_r /= 3.0f;