s3d_instance.h (1516B)
1 /* Copyright (C) 2015-2023, 2026 |Méso|Star> (contact@meso-star.com) 2 * 3 * This file is part of Star-3D. 4 * 5 * Star-3D is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Star-3D is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Star-3D. If not, see <http://www.gnu.org/licenses/>. */ 17 18 #ifndef S3D_INSTANCE_H 19 #define S3D_INSTANCE_H 20 21 #include "s3d_geometry.h" 22 #include <rsys/dynamic_array.h> 23 #include <rsys/ref_count.h> 24 25 struct instance { 26 float transform[12]; /* local to world 3x4 column major matrix */ 27 struct s3d_scene* scene; /* Instantiated scene */ 28 /* Current view of the instantiated scene. Note that the instance does not 29 * own the scnview; the instance scnview lifetime is managed by the scnview 30 * into which the instance lies */ 31 struct s3d_scene_view* scnview; 32 ref_T ref; 33 }; 34 35 extern LOCAL_SYM res_T 36 instance_create 37 (struct s3d_scene* scene, 38 struct instance** inst); 39 40 extern LOCAL_SYM void 41 instance_ref_get 42 (struct instance* inst); 43 44 extern LOCAL_SYM void 45 instance_ref_put 46 (struct instance* inst); 47 48 #endif /* S3D_INSTANCE_H */ 49