solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

ssol_object_c.h (2065B)


      1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2016, 2018 CNRS
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License as published by
      6  * the Free Software Foundation, either version 3 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     12  * GNU General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     16 
     17 #ifndef SSOL_OBJECT_C_H
     18 #define SSOL_OBJECT_C_H
     19 
     20 #include <rsys/dynamic_array.h>
     21 #include <rsys/hash_table.h>
     22 #include <rsys/ref_count.h>
     23 
     24 struct shaded_shape {
     25   struct ssol_shape* shape;
     26   struct ssol_material* mtl_back; /* Material of the front faces */
     27   struct ssol_material* mtl_front; /* Material of the back faces */
     28 };
     29 
     30 /* Define the darray_shaded_shape data structure */
     31 #define DARRAY_NAME shaded_shape
     32 #define DARRAY_DATA struct shaded_shape
     33 #include <rsys/dynamic_array.h>
     34 
     35 /* Define the htable_shaded_shape data structure */
     36 #define HTABLE_NAME shaded_shape
     37 #define HTABLE_KEY unsigned /* S3D object instance identifier */
     38 #define HTABLE_DATA size_t
     39 #include <rsys/hash_table.h>
     40 
     41 struct ssol_object {
     42   /* List of shaded shapes added to the object */
     43   struct darray_shaded_shape shaded_shapes;
     44 
     45   /* Map the RT/Samp S3D id to an entry into the shaded_shapes array */
     46   struct htable_shaded_shape shaded_shapes_rt;
     47   struct htable_shaded_shape shaded_shapes_samp;
     48 
     49   struct s3d_scene* scn_rt; /* RT scene to instantiate */
     50   struct s3d_scene* scn_samp; /* Sampling scene to instantiate */
     51   double scn_rt_area, scn_samp_area;
     52 
     53   struct ssol_device* dev;
     54   ref_T ref;
     55 };
     56 
     57 extern LOCAL_SYM int
     58 object_has_shape
     59   (struct ssol_object* obj,
     60    const struct ssol_shape* shape);
     61 
     62 #endif /* SSOL_OBJECT_C_H */
     63