summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;