s3dstl.h (2799B)
1 /* Copyright (C) 2016, 2018, 2021, 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 S3DSTL_H 17 #define S3DSTL_H 18 19 #include <rsys/rsys.h> 20 21 /* Library symbol management */ 22 #if defined(S3DSTL_SHARED_BUILD) 23 #define S3DSTL_API extern EXPORT_SYM /* Build shared library */ 24 #elif defined(S3DSTL_STATUC) /* Use/build statuc library */ 25 #define S3DSTL_API extern LOCAL_SYM 26 #else /* Use shared library */ 27 #define S3DSTL_API extern IMPORT_SYM 28 #endif 29 30 /* Helper macro that asserts if the invocation of the s3dstl function `Func' 31 * returns an error. One should use this macro on s3dstl function calls for which 32 * no explicit error checking is performed. */ 33 #ifndef NDEBUG 34 #define S3DSTL(Func) ASSERT(s3dstl_ ## Func == RES_OK) 35 #else 36 #define S3DSTL(Func) s3dstl_ ## Func 37 #endif 38 39 /* Forward declaration of external types */ 40 struct logger; 41 struct mem_allocator; 42 struct s3d_device; 43 struct s3d_shape; 44 struct sstl; 45 46 /* Forward declaration of opaque data types */ 47 struct s3dstl; 48 49 /******************************************************************************* 50 * Star-3DSTL API 51 ******************************************************************************/ 52 BEGIN_DECLS 53 54 S3DSTL_API res_T 55 s3dstl_create 56 (struct logger* logger, /* May be NULL <=> use default logger */ 57 struct mem_allocator* allocator, /* May be NULL <=> use default allocator */ 58 struct sstl* loader_sstl, /* May be NULL <=> Internally create the loader */ 59 struct s3d_device* s3d, 60 const int verbose, /* Verbosity level */ 61 struct s3dstl** s3dstl); 62 63 S3DSTL_API res_T 64 s3dstl_ref_get 65 (struct s3dstl* s3dstl); 66 67 S3DSTL_API res_T 68 s3dstl_ref_put 69 (struct s3dstl* s3dstl); 70 71 S3DSTL_API res_T 72 s3dstl_get_sstl 73 (struct s3dstl* s3dstl, 74 struct sstl** sstl); 75 76 S3DSTL_API res_T 77 s3dstl_load 78 (struct s3dstl* s3dstl, 79 const char* filename); 80 81 S3DSTL_API res_T 82 s3dstl_load_stream 83 (struct s3dstl* s3dstl, 84 FILE* file); 85 86 /* Remove the loaded shape */ 87 S3DSTL_API res_T 88 s3dstl_clear 89 (struct s3dstl* s3dstl); 90 91 S3DSTL_API res_T 92 s3dstl_get_shape 93 (struct s3dstl* s3dstl, 94 struct s3d_shape** shape); /* The returned value may be NULL <=> no shape */ 95 96 END_DECLS 97 98 #endif /* S3DSTL_H */ 99