Blender  V2.93
lineart_intern.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2019 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "BLI_linklist.h"
27 #include "BLI_listbase.h"
28 #include "BLI_math.h"
29 #include "BLI_threads.h"
30 
31 #include "DNA_lineart_types.h"
32 
33 #include <math.h>
34 #include <string.h>
35 
38 struct LineartEdge;
39 struct LineartRenderBuffer;
40 
43  struct LineartStaticMemPool *smp,
44  void *data,
45  int size);
48  struct LineartStaticMemPool *smp,
49  void *p,
50  int size);
51 
54 
56  size_t size);
57 void *lineart_mem_aquire(struct LineartStaticMemPool *smp, size_t size);
58 void *lineart_mem_aquire_thread(struct LineartStaticMemPool *smp, size_t size);
60 
61 void lineart_prepend_edge_direct(struct LineartEdge **first, void *node);
62 void lineart_prepend_pool(LinkNode **first, struct LineartStaticMemPool *smp, void *link);
63 
64 void lineart_matrix_ortho_44d(double (*mProjection)[4],
65  double xMin,
66  double xMax,
67  double yMin,
68  double yMax,
69  double zMin,
70  double zMax);
72  double (*mProjection)[4], double fFov_rad, double fAspect, double zMin, double zMax);
73 
75 
77 
78 #define LRT_ITER_ALL_LINES_BEGIN \
79  LineartEdge *e, *next_e, **current_list; \
80  e = rb->contours; \
81  for (current_list = &rb->contours; e; e = next_e) { \
82  next_e = e->next;
83 
84 #define LRT_ITER_ALL_LINES_NEXT \
85  while (!next_e) { \
86  if (current_list == &rb->contours) { \
87  current_list = &rb->crease_lines; \
88  } \
89  else if (current_list == &rb->crease_lines) { \
90  current_list = &rb->material_lines; \
91  } \
92  else if (current_list == &rb->material_lines) { \
93  current_list = &rb->edge_marks; \
94  } \
95  else if (current_list == &rb->edge_marks) { \
96  current_list = &rb->intersection_lines; \
97  } \
98  else { \
99  break; \
100  } \
101  next_e = *current_list; \
102  }
103 
104 #define LRT_ITER_ALL_LINES_END \
105  LRT_ITER_ALL_LINES_NEXT \
106  }
107 
108 #define LRT_BOUND_AREA_CROSSES(b1, b2) \
109  ((b1)[0] < (b2)[1] && (b1)[1] > (b2)[0] && (b1)[3] < (b2)[2] && (b1)[2] > (b2)[3])
110 
111 /* Initial bounding area row/column count, setting 4 is the simplest way algorithm could function
112  * efficiently. */
113 #define LRT_BA_ROWS 4
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
OperationNode * node
void lineart_prepend_edge_direct(struct LineartEdge **first, void *node)
Definition: lineart_util.c:138
void * lineart_list_pop_pointer_no_free(ListBase *h)
Definition: lineart_util.c:66
void * lineart_list_append_pointer_pool_sized(ListBase *h, struct LineartStaticMemPool *smp, void *data, int size)
Definition: lineart_util.c:51
struct LineartStaticMemPoolNode * lineart_mem_new_static_pool(struct LineartStaticMemPool *smp, size_t size)
Definition: lineart_util.c:82
int lineart_count_intersection_segment_count(struct LineartRenderBuffer *rb)
void lineart_prepend_pool(LinkNode **first, struct LineartStaticMemPool *smp, void *link)
Definition: lineart_util.c:145
void * lineart_mem_aquire(struct LineartStaticMemPool *smp, size_t size)
Definition: lineart_util.c:95
void lineart_matrix_perspective_44d(double(*mProjection)[4], double fFov_rad, double fAspect, double zMin, double zMax)
Definition: lineart_util.c:155
void * lineart_mem_aquire_thread(struct LineartStaticMemPool *smp, size_t size)
Definition: lineart_util.c:110
void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb)
Definition: lineart_util.c:206
void lineart_list_remove_pointer_item_no_free(ListBase *h, LinkData *lip)
Definition: lineart_util.c:77
void * list_push_pointer_static(ListBase *h, struct LineartStaticMemPool *smp, void *p)
void lineart_mem_destroy(struct LineartStaticMemPool *smp)
Definition: lineart_util.c:130
void * list_push_pointer_static_sized(ListBase *h, struct LineartStaticMemPool *smp, void *p, int size)
void * lineart_list_append_pointer_pool(ListBase *h, struct LineartStaticMemPool *smp, void *data)
Definition: lineart_util.c:40
void lineart_matrix_ortho_44d(double(*mProjection)[4], double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
Definition: lineart_util.c:187