star-2d

Contour structuring for efficient 2D geometric queries
git clone git://git.meso-star.fr/star-2d.git
Log | Files | Refs | README | LICENSE

s2d_geometry.h (1794B)


      1 /* Copyright (C) 2016-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 S2D_GEOMETRY_H
     17 #define S2D_GEOMETRY_H
     18 
     19 #include "s2d.h"
     20 #include "s2d_backend.h"
     21 #include <rsys/ref_count.h>
     22 
     23 enum embree_attrib {
     24   EMBREE_ENABLE = BIT(0),
     25   EMBREE_FILTER_FUNCTION = BIT(1),
     26   EMBREE_INDICES = BIT(2),
     27   EMBREE_VERTICES = BIT(4)
     28 };
     29 
     30 /* Backend geometry */
     31 struct geometry {
     32   unsigned name; /* Client side identifier */
     33   RTCGeometry rtc; /* Embree geometry */
     34   unsigned rtc_id; /* Embree geometry identifier */
     35   unsigned scene_prim_id_offset; /* Offset from local to scene prim_id */
     36 
     37   int embree_outdated_mask; /* Combination of embree_attrib */
     38 
     39   char flip_contour; /* Is the geometry contour flipped? */
     40   char is_enabled; /* Is the geometry enabled? */
     41 
     42   struct line_segments* lines; /* Reference toward the client side data */
     43 
     44   struct s2d_device* dev;
     45   ref_T ref;
     46 };
     47 
     48 extern LOCAL_SYM res_T
     49 geometry_create
     50   (struct s2d_device* dev,
     51    struct geometry** geom);
     52 
     53 extern LOCAL_SYM void
     54 geometry_ref_get
     55   (struct geometry* geometry);
     56 
     57 extern LOCAL_SYM void
     58 geometry_ref_put
     59   (struct geometry* geometry);
     60 
     61 #endif /* S2D_GEOMETRY_H */
     62