Tue, 22 Jul 2025 21:38:02 +0200
resolve several minor TODOs
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * Copyright 2023 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef ASCENSION_SCENE_H #define ASCENSION_SCENE_H #include "scene_node.h" #include "camera.h" #include <cx/list.h> #include <cx/string.h> typedef struct asc_scene_s { AscCamera camera; AscSceneNode *root; cxmutstr name; struct { CxList *render_groups[ASC_RENDER_GROUP_COUNT]; } internal; } AscScene; /** * Initializes a scene graph. * * @param scene the scene graph * @param name optional name for the scene * @param camera_params initial camera parameters */ void asc_scene_init_(AscScene *scene, const char *name, struct asc_camera_init_args camera_params); /** * Initializes a scene graph. * * @param scene the scene graph * @param name optional name for the scene * @param ... initial camera parameters */ #define asc_scene_init(scene, name, ...) asc_scene_init_(scene, name, (struct asc_camera_init_args){__VA_ARGS__}) /** * Destroys a scene graph. * * Does nothing when the scene was not initialized. * * @param scene the scene graph */ void asc_scene_destroy(AscScene *scene); /** * Returns a pointer to the scene's camera. * * @param scene the scene graph */ static inline const AscCamera *asc_scene_camera(const AscScene *scene) { return &scene->camera; } void asc_scene_execute_behaviors(AscScene *scene); /** * Draws the scene with the specified root node. * * If @p scene is not initialized, drawing is skipped. * * @param scene the scene graph */ void asc_scene_draw(AscScene *scene); void asc_scene_add_node(AscScene *scene, AscSceneNode *node); #endif // ASCENSION_SCENE_H