star-3d

Surface structuring for efficient 3D geometric queries
git clone git://git.meso-star.com/star-3d.git
Log | Files | Refs | README | LICENSE

commit 4ded5947f4ad186a35c006be02249d380d08efe2
parent a747de24ed69332241e65167f91c04b43dd22994
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 10 Jul 2026 15:56:03 +0200

Merge branch 'release_0.10.1'

Diffstat:
MMakefile | 145+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
MREADME.md | 8+++++++-
Mconfig.mk | 16++++++++--------
Dmake.sh | 84-------------------------------------------------------------------------------
Msrc/s3d.h | 10++++++----
Msrc/s3d_backend.h | 10++++++----
Msrc/s3d_buffer.h | 10++++++----
Msrc/s3d_c.h | 10++++++----
Msrc/s3d_device.c | 10++++++----
Msrc/s3d_device_c.h | 10++++++----
Msrc/s3d_geometry.c | 10++++++----
Msrc/s3d_geometry.h | 10++++++----
Msrc/s3d_instance.c | 10++++++----
Msrc/s3d_instance.h | 10++++++----
Msrc/s3d_mesh.c | 10++++++----
Msrc/s3d_mesh.h | 10++++++----
Msrc/s3d_primitive.c | 10++++++----
Msrc/s3d_scene.c | 10++++++----
Msrc/s3d_scene_c.h | 10++++++----
Msrc/s3d_scene_view.c | 25++++++++++++++++++++-----
Msrc/s3d_scene_view_c.h | 10++++++----
Msrc/s3d_scene_view_closest_point.c | 10++++++----
Msrc/s3d_scene_view_trace_ray.c | 10++++++----
Msrc/s3d_shape.c | 10++++++----
Msrc/s3d_shape_c.h | 10++++++----
Msrc/s3d_sphere.c | 10++++++----
Msrc/s3d_sphere.h | 10++++++----
Msrc/test_s3d_accel_struct_conf.c | 10++++++----
Msrc/test_s3d_camera.h | 10++++++----
Msrc/test_s3d_cbox.h | 10++++++----
Msrc/test_s3d_closest_point.c | 10++++++----
Msrc/test_s3d_device.c | 10++++++----
Msrc/test_s3d_primitive.c | 10++++++----
Msrc/test_s3d_sample_sphere.c | 10++++++----
Msrc/test_s3d_sampler.c | 10++++++----
Msrc/test_s3d_scene.c | 10++++++----
Msrc/test_s3d_scene_view.c | 10++++++----
Msrc/test_s3d_scene_view_aabb.c | 10++++++----
Asrc/test_s3d_scene_view_delayed_cache_update.c | 139+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/test_s3d_seams.c | 10++++++----
Msrc/test_s3d_shape.c | 10++++++----
Msrc/test_s3d_sphere.c | 10++++++----
Msrc/test_s3d_sphere_box.c | 10++++++----
Msrc/test_s3d_sphere_instance.c | 10++++++----
Msrc/test_s3d_trace_ray.c | 10++++++----
Msrc/test_s3d_trace_ray_instance.c | 10++++++----
Msrc/test_s3d_trace_ray_sphere.c | 10++++++----
Msrc/test_s3d_utils.h | 10++++++----
48 files changed, 512 insertions(+), 325 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,17 +1,19 @@ -# Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +# Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) # -# This program is free software: you can redistribute it and/or modify +# This file is part of Star-3D. +# +# Star-3D is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# Star-3D is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with Star-3D. If not, see <http://www.gnu.org/licenses/>. .POSIX: .SUFFIXES: # Clean up default inference rules @@ -22,6 +24,9 @@ LIBNAME_STATIC = libs3d.a LIBNAME_SHARED = libs3d.so LIBNAME = $(LIBNAME_$(LIB_TYPE)) +default: library +all: library tests + ################################################################################ # Star-3D building ################################################################################ @@ -40,18 +45,21 @@ SRC =\ OBJ = $(SRC:.c=.o) DEP = $(SRC:.c=.d) -build_library: .config $(DEP) - @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f "$${i}"; done)\ - $$(if [ -n "$(LIBNAME)" ]; then\ - echo "$(LIBNAME)";\ - else\ - echo "$(LIBNAME_SHARED)";\ - fi) +CFLAGS_LIB = -std=c99 $(CFLAGS_SO) $(INCS) -DS3D_SHARED_BUILD +LDFLAGS_LIB = $(LDFLAGS_SO) $(LIBS) + +library: .config $(DEP) + @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f "$${i}"; done) \ + $$(if [ -n "$(LIBNAME)" ]; then \ + echo "$(LIBNAME)"; \ + else \ + echo "$(LIBNAME_SHARED)"; \ + fi) $(DEP) $(OBJ): config.mk $(LIBNAME_SHARED): $(OBJ) - $(CC) -std=c99 $(CFLAGS_SO) $(DPDC_CFLAGS) -o $@ $(OBJ) $(LDFLAGS_SO) $(DPDC_LIBS) + $(CC) $(CFLAGS_LIB) -o $@ $(OBJ) $(LDFLAGS_LIB) $(LIBNAME_STATIC): libs3d.o $(AR) -rc $@ $? @@ -62,18 +70,16 @@ libs3d.o: $(OBJ) $(OBJCOPY) $(OCPFLAGS) $@ .config: Makefile config.mk - @if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then\ - echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi - @if ! $(PKG_CONFIG) --atleast-version $(EMBREE_VERSION) embree4; then\ - echo "embree $(EMBREE_VERSION) not found" >&2; exit 1; fi - @echo "config done" > $@ + $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys + $(PKG_CONFIG) --atleast-version $(EMBREE_VERSION) embree4 + echo "config done" > $@ .SUFFIXES: .c .d .o .c.d: - @$(CC) -std=c99 $(CFLAGS_SO) $(DPDC_CFLAGS) -MM -MT "$(@:.d=.o) $@" $< -MF $@ + @$(CC) $(CFLAGS_LIB) -MM -MT "$(@:.d=.o) $@" $< -MF $@ .c.o: - $(CC) -std=c99 $(CFLAGS_SO) $(DPDC_CFLAGS) -DS3D_SHARED_BUILD -c $< -o $@ + $(CC) $(CFLAGS_LIB) -c $< -o $@ ################################################################################ # Installation @@ -94,35 +100,31 @@ s3d-local.pc: s3d.pc.in -e 's#@EMBREE_VERSION@#$(EMBREE_VERSION)#g'\ s3d.pc.in > $@ -install: build_library pkg - @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib" $(LIBNAME) - @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/lib/pkgconfig" s3d.pc - @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/include/star" src/s3d.h - @$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/star-3d"\ - COPYING README.md - +install: library pkg + install() { mode="$$1"; prefix="$$2"; shift 2; \ + mkdir -p "$${prefix}"; \ + cp "$$@" "$${prefix}"; \ + printf '%s\n' "$${@}" | while read -r i; do \ + chmod "$${mode}" "$${prefix}/$${i##*/}"; \ + done; \ + }; \ + if [ "$(LIB_TYPE)" = "STATIC" ]; then mode=644; else mode=755; fi; \ + install "$${mode}" "$(DESTDIR)$(LIBPREFIX)" $(LIBNAME); \ + install 644 "$(DESTDIR)$(LIBPREFIX)/pkgconfig" s3d.pc; \ + install 644 "$(DESTDIR)$(INCPREFIX)/star" src/s3d.h; \ + install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-3d" COPYING README.md + uninstall: - rm -f "$(DESTDIR)$(PREFIX)/lib/$(LIBNAME)" - rm -f "$(DESTDIR)$(PREFIX)/lib/pkgconfig/s3d.pc" + rm -f "$(DESTDIR)$(LIBPREFIX)/$(LIBNAME)" + rm -f "$(DESTDIR)$(LIBPREFIX)/pkgconfig/s3d.pc" + rm -f "$(DESTDIR)$(INCPREFIX)/star/s3d.h" rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-3d/COPYING" rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-3d/README.md" - rm -f "$(DESTDIR)$(PREFIX)/include/star/s3d.h" - -################################################################################ -# Miscellaneous targets -################################################################################ -all: build_library build_tests clean: clean_test - rm -f $(OBJ) $(TEST_OBJ) $(LIBNAME) + rm -f $(OBJ) $(DEP) $(LIBNAME) rm -f .config .test libs3d.o s3d.pc s3d-local.pc -distclean: clean - rm -f $(DEP) $(TEST_DEP) - -lint: - shellcheck -o all make.sh - ################################################################################ # Tests ################################################################################ @@ -134,8 +136,9 @@ TEST_SRC =\ src/test_s3d_sampler.c\ src/test_s3d_sample_sphere.c\ src/test_s3d_scene.c\ - src/test_s3d_scene_view_aabb.c\ src/test_s3d_scene_view.c\ + src/test_s3d_scene_view_aabb.c\ + src/test_s3d_scene_view_delayed_cache_update.c\ src/test_s3d_seams.c\ src/test_s3d_shape.c\ src/test_s3d_sphere_box.c\ @@ -146,40 +149,46 @@ TEST_SRC =\ src/test_s3d_trace_ray_sphere.c TEST_OBJ = $(TEST_SRC:.c=.o) TEST_DEP = $(TEST_SRC:.c=.d) +TEST_TGT = $(TEST_SRC:.c=.t) PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./:$${PKG_CONFIG_PATH}" $(PKG_CONFIG) -S3D_CFLAGS = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags s3d-local.pc) -S3D_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs s3d-local.pc) -build_tests: build_library $(TEST_DEP) .test - @$(MAKE) -fMakefile -f.test \ - $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) test_bin +INCS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags s3d) +LIBS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --libs s3d) -test: build_tests - @$(SHELL) make.sh run_test $(TEST_SRC) +CFLAGS_TEST = -std=c89 $(CFLAGS_EXE) $(INCS_TEST) +LDFLAGS_TEST = $(LDFLAGS_EXE) $(LIBS_TEST) -.test: Makefile - @$(SHELL) make.sh config_test $(TEST_SRC) > .test +tests: library $(TEST_DEP) $(TEST_TGT) + @$(MAKE) -fMakefile \ + $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) \ + $$(for i in $(TEST_TGT); do echo -f"$${i}"; done) \ + test_list + +$(TEST_TGT): + @{ \ + exe="$$(basename "$@" ".t")"; \ + printf '%s: %s\n' "$${exe}" $(@:.t=.o); \ + printf 'test_list: %s\n' "$${exe}"; \ + } > $@ -clean_test: - @$(SHELL) make.sh clean_test $(TEST_SRC) $(TEST_DEP): config.mk s3d-local.pc - @$(CC) -std=c89 $(CFLAGS_EXE) $(S3D_CFLAGS) \ - -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ + @$(CC) $(CFLAGS_TEST) -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@ $(TEST_OBJ): config.mk s3d-local.pc - $(CC) -std=c89 $(CFLAGS_EXE) $(S3D_CFLAGS) -c $(@:.o=.c) -o $@ + $(CC) $(CFLAGS_TEST) -c $(@:.o=.c) -o $@ test_s3d_device \ test_s3d_primitive \ test_s3d_sampler \ test_s3d_scene \ -test_s3d_scene_view_aabb \ test_s3d_scene_view \ +test_s3d_scene_view_aabb \ +test_s3d_scene_view_delayed_cache_update \ test_s3d_shape \ : config.mk s3d-local.pc $(LIBNAME) - $(CC) -std=c89 $(CFLAGS_EXE) -o $@ src/$@.o $(LDFLAGS_EXE) $(S3D_LIBS) + $(CC) $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST) test_s3d_accel_struct_conf \ test_s3d_closest_point \ @@ -192,4 +201,22 @@ test_s3d_trace_ray \ test_s3d_trace_ray_instance \ test_s3d_trace_ray_sphere \ : config.mk s3d-local.pc $(LIBNAME) - $(CC) -std=c89 $(CFLAGS_EXE) -o $@ src/$@.o $(LDFLAGS_EXE) $(S3D_LIBS) -lm + $(CC) -std=c89 $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST) -lm + +clean_test: + rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT) + for i in $(TEST_SRC); do rm -f "$$(basename "$${i}" ".c")"; done + +test: tests + @err=0; \ + for i in $(TEST_SRC); do \ + test="$$(basename "$${i}" ".c")"; \ + printf '%s' "$${test}"; \ + if "./$${test}" > /dev/null 2>&1; then \ + printf '\n'; \ + else \ + printf ': error %s\n' "$$?"; \ + err=$$((err+1)); \ + fi \ + done; \ + [ "$${err}" -eq 0 ] diff --git a/README.md b/README.md @@ -40,6 +40,12 @@ Edit config.mk as needed, then run: ## Release notes +### Version 0.10.1 + +- Fix an issue related to deleting a scene view. + The process could crash when the same shape was repeatedly detected as + being detached from the scene for which the view was created. + ### Version 0.10 - Replace CMake by Makefile as build system. @@ -172,7 +178,7 @@ radius. ## License -Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) Star-3D is free software released under GPL v3+ license: GNU GPL version 3 or later. You are welcome to redistribute it under certain conditions; diff --git a/config.mk b/config.mk @@ -1,5 +1,10 @@ -VERSION = 0.10.0 +VERSION = 0.10.1 + +# Default install paths PREFIX = /tmp/local +LIBPREFIX = $(PREFIX)/lib +INCPREFIX = $(PREFIX)/include + LIB_TYPE = SHARED #LIB_TYPE = STATIC @@ -25,15 +30,10 @@ PCFLAGS_STATIC = --static PCFLAGS = $(PCFLAGS_$(LIB_TYPE)) RSYS_VERSION=0.14 -RSYS_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys) -RSYS_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys) - EMBREE_VERSION=4.0 -EMBREE_CFLAGS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags embree4) -EMBREE_LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs embree4) -DPDC_CFLAGS=$(RSYS_CFLAGS) $(EMBREE_CFLAGS) -DPDC_LIBS=$(RSYS_LIBS) $(EMBREE_LIBS) -lm +INCS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys embree4) +LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys embree4) -lm ################################################################################ # Compilation options diff --git a/make.sh b/make.sh @@ -1,84 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -set -e - -config_test() -{ - for i in "$@"; do - test=$(basename "${i}" ".c") - test_list="${test_list} ${test}" - printf "%s: %s\n" "${test}" "src/${test}.o" - done - printf "test_bin: %s\n" "${test_list}" -} - -check() -{ - name="$1" - prog="$2" - shift 2 - - printf "%s " "${name}" - if ./"${prog}" "$@" > /dev/null 2>&1; then - printf "\033[1;32mOK\033[m\n" - else - printf "\033[1;31mError\033[m\n" - fi -} - -run_test() -{ - for i in "$@"; do - test=$(basename "${i}" ".c") - if [ "${test}" = "test_s3d_sphere_instance" ]\ - || [ "${test}" = "test_s3d_trace_ray" ]; then - check "${test}_legacy" "${test}" - check "${test}_filter" "${test}" filter - else - check "${test}" "${test}" - fi - done 2> /dev/null -} - -clean_test() -{ - for i in "$@"; do - rm -f "$(basename "${i}" ".c")" - done -} - -install() -{ - prefix=$1 - shift 1 - - mkdir -p "${prefix}" - - for i in "$@"; do - dst="${prefix}/${i##*/}" - - if cmp -s "${i}" "${dst}"; then - printf "Up to date %s\n" "${dst}" - else - printf "Installing %s\n" "${dst}" - cp "${i}" "${prefix}" - fi - done -} - -"$@" diff --git a/src/s3d.h b/src/s3d.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_H #define S3D_H diff --git a/src/s3d_backend.h b/src/s3d_backend.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_BACKEND_H #define S3D_BACKEND_H diff --git a/src/s3d_buffer.h b/src/s3d_buffer.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #if !defined(BUFFER_NAME) && !defined(BUFFER_DARRAY) diff --git a/src/s3d_c.h b/src/s3d_c.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_C_H #define S3D_C_H diff --git a/src/s3d_device.c b/src/s3d_device.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_c.h" diff --git a/src/s3d_device_c.h b/src/s3d_device_c.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_DEVICE_C_H #define S3D_DEVICE_C_H diff --git a/src/s3d_geometry.c b/src/s3d_geometry.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d_device_c.h" #include "s3d_geometry.h" diff --git a/src/s3d_geometry.h b/src/s3d_geometry.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_GEOMETRY_H #define S3D_GEOMETRY_H diff --git a/src/s3d_instance.c b/src/s3d_instance.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_backend.h" diff --git a/src/s3d_instance.h b/src/s3d_instance.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_INSTANCE_H #define S3D_INSTANCE_H diff --git a/src/s3d_mesh.c b/src/s3d_mesh.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d_c.h" #include "s3d_device_c.h" diff --git a/src/s3d_mesh.h b/src/s3d_mesh.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_MESH_H #define S3D_MESH_H diff --git a/src/s3d_primitive.c b/src/s3d_primitive.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d_c.h" #include "s3d_device_c.h" diff --git a/src/s3d_scene.c b/src/s3d_scene.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_device_c.h" diff --git a/src/s3d_scene_c.h b/src/s3d_scene_c.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_SCENE_C_H #define S3D_SCENE_C_H diff --git a/src/s3d_scene_view.c b/src/s3d_scene_view.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_device_c.h" @@ -1073,8 +1075,21 @@ scene_view_release(ref_T* ref) FOR_EACH(i, 0, n) { const unsigned shape_id = darray_uint_cdata_get(&scnview->detached_shapes)[i]; struct geometry** pgeom = htable_geom_find(&scnview->cached_geoms, &shape_id); - struct geometry* geom = *pgeom; + struct geometry* geom = NULL; size_t tmp; (void)tmp; + + /* It is possible that there is no geometry in the cache associated with the + * registered shape Id. This is the sign that this geometry has already + * been removed from the cache, and that its shape has been detached several + * times from the scene while the scene view was active. + * + * Indeed, each detachment is simply saved in the "detached shapes" list, + * without checking that the shape has already been saved as being to be + * detached. In other words, only the first occurrence of the shape in the + * said list is valid, the others must be ignored. */ + if(pgeom == NULL) { ASSERT(n > 0); continue; } + + geom = *pgeom; scene_view_destroy_geometry(scnview, geom); tmp = htable_geom_erase(&scnview->cached_geoms, &shape_id); ASSERT(tmp == 1); diff --git a/src/s3d_scene_view_c.h b/src/s3d_scene_view_c.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_SCENE_VIEW_C_H #define S3D_SCENE_VIEW_C_H diff --git a/src/s3d_scene_view_closest_point.c b/src/s3d_scene_view_closest_point.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_device_c.h" diff --git a/src/s3d_scene_view_trace_ray.c b/src/s3d_scene_view_trace_ray.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_c.h" diff --git a/src/s3d_shape.c b/src/s3d_shape.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "s3d_c.h" diff --git a/src/s3d_shape_c.h b/src/s3d_shape_c.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_SHAPE_C_H #define S3D_SHAPE_C_H diff --git a/src/s3d_sphere.c b/src/s3d_sphere.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d_device_c.h" #include "s3d_sphere.h" diff --git a/src/s3d_sphere.h b/src/s3d_sphere.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef S3D_SPHERE_H #define S3D_SPHERE_H diff --git a/src/test_s3d_accel_struct_conf.c b/src/test_s3d_accel_struct_conf.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_camera.h b/src/test_s3d_camera.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TEST_S3D_CAMERA_H #define TEST_S3D_CAMERA_H diff --git a/src/test_s3d_cbox.h b/src/test_s3d_cbox.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TEST_S3D_CBOX_H #define TEST_S3D_CBOX_H diff --git a/src/test_s3d_closest_point.c b/src/test_s3d_closest_point.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #define _POSIX_C_SOURCE 200112L /* exp2f, fabsf, nextafterf */ diff --git a/src/test_s3d_device.c b/src/test_s3d_device.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_primitive.c b/src/test_s3d_primitive.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_cbox.h" diff --git a/src/test_s3d_sample_sphere.c b/src/test_s3d_sample_sphere.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_sampler.c b/src/test_s3d_sampler.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_cbox.h" diff --git a/src/test_s3d_scene.c b/src/test_s3d_scene.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_scene_view.c b/src/test_s3d_scene_view.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_scene_view_aabb.c b/src/test_s3d_scene_view_aabb.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_scene_view_delayed_cache_update.c b/src/test_s3d_scene_view_delayed_cache_update.c @@ -0,0 +1,139 @@ +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) + * + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Star-3D is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ + +#include "s3d.h" + +#include <rsys/float3.h> +#include <rsys/mem_allocator.h> + +/******************************************************************************* + * Helper functions + ******************************************************************************/ +static void +get_ids(const unsigned itri, unsigned ids[3], void* data) +{ + (void)itri, (void)ids, (void)data; + ids[0] = 0; + ids[1] = 1; + ids[2] = 2; +} + +static void +get_pos(const unsigned ivtx, float pos[3], void* data) +{ + (void)data; + + switch(ivtx) { + case 0: f3(pos, 0.f, 0.f, 0.f); break; + case 1: f3(pos, 1.f, 0.f, 0.f); break; + case 2: f3(pos, 1.f, 1.f, 0.f); break; + default: FATAL("Unreachable code\n"); break; + } +} + +static struct s3d_shape* +create_triangle(struct s3d_device* dev) +{ + struct s3d_vertex_data vdata; + struct s3d_shape* tri = NULL; + + vdata.type = S3D_FLOAT3; + vdata.usage = S3D_POSITION; + vdata.get = get_pos; + + CHK(s3d_shape_create_mesh(dev, &tri) == RES_OK); + CHK(s3d_mesh_setup_indexed_vertices(tri, 1, get_ids, 3, &vdata, 1, NULL) + == RES_OK); + + return tri; +} + +/* Detach, attach and re-attach the same shape while the view is active */ +static void +test_scenario1(struct s3d_device* dev) +{ + struct s3d_shape* triangle; + struct s3d_scene* scn = NULL; + struct s3d_scene_view* view = NULL; + const int mask = S3D_SAMPLE | S3D_TRACE; + + CHK(s3d_scene_create(dev, &scn) == RES_OK); + + triangle = create_triangle(dev); + CHK(s3d_scene_attach_shape(scn, triangle) == RES_OK); + CHK(s3d_scene_view_create(scn, mask, &view) == RES_OK); + + CHK(s3d_scene_detach_shape(scn, triangle) == RES_OK); + CHK(s3d_scene_attach_shape(scn, triangle) == RES_OK); + CHK(s3d_scene_detach_shape(scn, triangle) == RES_OK); + + CHK(s3d_shape_ref_put(triangle) == RES_OK); + CHK(s3d_scene_ref_put(scn) == RES_OK); + + CHK(s3d_scene_view_ref_put(view) == RES_OK); +} + +/* Detach and delete a shape. Then create a new one that in doing so could reuse + * the Id of the previous shape, before attaching it and detach it from the + * scene. All this while a view of the scene continues to rely on the geometry + * of the first shape */ +static void +test_scenario2(struct s3d_device* dev) +{ + struct s3d_scene* scn = NULL; + struct s3d_scene_view* view; + struct s3d_shape* triangle; + const int mask = S3D_SAMPLE | S3D_TRACE; + + CHK(s3d_scene_create(dev, &scn) == RES_OK); + + triangle = create_triangle(dev); + CHK(s3d_scene_attach_shape(scn, triangle) == RES_OK); + CHK(s3d_scene_view_create(scn, mask, &view) == RES_OK); + + CHK(s3d_scene_detach_shape(scn, triangle) == RES_OK); + CHK(s3d_shape_ref_put(triangle) == RES_OK); + + triangle = create_triangle(dev); + CHK(s3d_scene_attach_shape(scn, triangle) == RES_OK); + CHK(s3d_scene_detach_shape(scn, triangle) == RES_OK); + CHK(s3d_shape_ref_put(triangle) == RES_OK); + + CHK(s3d_scene_ref_put(scn) == RES_OK); + + CHK(s3d_scene_view_ref_put(view) == RES_OK); +} + + +/******************************************************************************* + * The test + ******************************************************************************/ +int +main(void) +{ + struct s3d_device* dev = NULL; + + CHK(s3d_device_create(NULL, NULL, 0, &dev) == RES_OK); + + test_scenario1(dev); + test_scenario2(dev); + + CHK(s3d_device_ref_put(dev) == RES_OK); + + CHK(mem_allocated_size() == 0); + return 0; +} diff --git a/src/test_s3d_seams.c b/src/test_s3d_seams.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_shape.c b/src/test_s3d_shape.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_cbox.h" diff --git a/src/test_s3d_sphere.c b/src/test_s3d_sphere.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_utils.h" diff --git a/src/test_s3d_sphere_box.c b/src/test_s3d_sphere_box.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_camera.h" diff --git a/src/test_s3d_sphere_instance.c b/src/test_s3d_sphere_instance.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_camera.h" diff --git a/src/test_s3d_trace_ray.c b/src/test_s3d_trace_ray.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #define _POSIX_C_SOURCE 200112L /* exp2f, fabsf */ diff --git a/src/test_s3d_trace_ray_instance.c b/src/test_s3d_trace_ray_instance.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_camera.h" diff --git a/src/test_s3d_trace_ray_sphere.c b/src/test_s3d_trace_ray_sphere.c @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #include "s3d.h" #include "test_s3d_camera.h" diff --git a/src/test_s3d_utils.h b/src/test_s3d_utils.h @@ -1,17 +1,19 @@ -/* Copyright (C) 2015-2023 |Méso|Star> (contact@meso-star.com) +/* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) * - * This program is free software: you can redistribute it and/or modify + * This file is part of Star-3D. + * + * Star-3D is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Star-3D is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TEST_S3D_UTILS_H #define TEST_S3D_UTILS_H