diff options
Diffstat (limited to 'src/ix3.h')
-rw-r--r-- | src/ix3.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/ix3.h b/src/ix3.h new file mode 100644 index 0000000..5a8d2b1 --- /dev/null +++ b/src/ix3.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2018 Vito Caputo - <vcaputo@pengaru.com> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * 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/>. + */ + +#ifndef _IX3_H +#define _IX3_H + +typedef struct ix3_object_t ix3_object_t; +typedef struct ix3_t ix3_t; +typedef struct bb3f_t bb3f_t; +typedef struct v3f_t v3f_t; + +typedef enum ix3_search_status_t { + IX3_SEARCH_STOP, + IX3_SEARCH_IGNORE, + IX3_SEARCH_CONTINUE +} ix3_search_status_t; + +typedef ix3_search_status_t (*ix3_search_cb)(void *cb_context, ix3_object_t *ix3_object, v3f_t *ix3_object_position, bb3f_t *ix3_object_aabb, void *object); + +ix3_t * ix3_new(bb3f_t *aabb, unsigned max_per_node, unsigned max_depth); +void ix3_free(ix3_t *ix3); +ix3_object_t * ix3_object_new(ix3_t *ix3, v3f_t *position, v3f_t *origin, bb3f_t *aabb, void *object); +void ix3_object_free(ix3_t *ix3, ix3_object_t *object); +ix3_object_t * ix3_object_move(ix3_t *ix3, ix3_object_t *object, v3f_t *object_position, v3f_t *object_origin, bb3f_t *object_aabb); +int ix3_object_aabb_overlap(ix3_t *ix3, ix3_object_t *object, v3f_t *aabb_position, v3f_t *aabb_origin, bb3f_t *aabb); +unsigned ix3_search_by_point(ix3_t *ix3, v3f_t *point, ix3_search_cb cb, void *arg); +unsigned ix3_search_by_aabb(ix3_t *ix3, v3f_t *search_position, v3f_t *search_origin, bb3f_t *search_aabb, ix3_search_cb cb, void *arg); +unsigned ix3_search_by_ray(ix3_t *ix3, v3f_t *origin, v3f_t *direction, ix3_search_cb cb, void *arg); + +#endif |