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