Blender  V3.3
dice.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include "scene/camera.h"
5 #include "scene/mesh.h"
6 
7 #include "subd/dice.h"
8 #include "subd/patch.h"
9 
11 
12 /* EdgeDice Base */
13 
14 EdgeDice::EdgeDice(const SubdParams &params_) : params(params_)
15 {
16  mesh_P = NULL;
17  mesh_N = NULL;
18  vert_offset = 0;
19 
21 
22  if (params.ptex) {
25  }
26 }
27 
28 void EdgeDice::reserve(int num_verts, int num_triangles)
29 {
30  Mesh *mesh = params.mesh;
31 
32  vert_offset = mesh->get_verts().size();
34 
35  mesh->resize_mesh(mesh->get_verts().size() + num_verts, mesh->num_triangles());
36  mesh->reserve_mesh(mesh->get_verts().size() + num_verts, mesh->num_triangles() + num_triangles);
37 
39 
40  mesh_P = mesh->verts.data() + vert_offset;
41  mesh_N = attr_vN->data_float3() + vert_offset;
42 
43  params.mesh->num_subd_verts += num_verts;
44 }
45 
46 void EdgeDice::set_vert(Patch *patch, int index, float2 uv)
47 {
48  float3 P, N;
49 
50  patch->eval(&P, NULL, NULL, &N, uv.x, uv.y);
51 
52  assert(index < params.mesh->verts.size());
53 
54  mesh_P[index] = P;
55  mesh_N[index] = N;
56  params.mesh->vert_patch_uv[index + vert_offset] = make_float2(uv.x, uv.y);
57 }
58 
59 void EdgeDice::add_triangle(Patch *patch, int v0, int v1, int v2)
60 {
61  Mesh *mesh = params.mesh;
62 
63  mesh->add_triangle(v0 + vert_offset, v1 + vert_offset, v2 + vert_offset, patch->shader, true);
64  params.mesh->triangle_patch[params.mesh->num_triangles() - 1] = patch->patch_index;
65 
66  tri_offset++;
67 }
68 
70 {
71  int Mu = max(sub.edge_u0.T, sub.edge_u1.T);
72  int Mv = max(sub.edge_v0.T, sub.edge_v1.T);
73  Mu = max(Mu, 2);
74  Mv = max(Mv, 2);
75 
76  int outer_T = sub.edges[edge].T;
77  int inner_T = ((edge % 2) == 0) ? Mv - 2 : Mu - 2;
78 
79  if (inner_T < 0 || outer_T < 0)
80  return; // XXX avoid crashes for Mu or Mv == 1, missing polygons
81 
82  /* stitch together two arrays of verts with triangles. at each step,
83  * we compare using the next verts on both sides, to find the split
84  * direction with the smallest diagonal, and use that in order to keep
85  * the triangle shape reasonable. */
86  for (size_t i = 0, j = 0; i < inner_T || j < outer_T;) {
87  int v0, v1, v2;
88 
89  v0 = sub.get_vert_along_grid_edge(edge, i);
90  v1 = sub.get_vert_along_edge(edge, j);
91 
92  if (j == outer_T) {
93  v2 = sub.get_vert_along_grid_edge(edge, ++i);
94  }
95  else if (i == inner_T) {
96  v2 = sub.get_vert_along_edge(edge, ++j);
97  }
98  else {
99  /* length of diagonals */
100  float len1 = len_squared(mesh_P[sub.get_vert_along_grid_edge(edge, i)] -
101  mesh_P[sub.get_vert_along_edge(edge, j + 1)]);
102  float len2 = len_squared(mesh_P[sub.get_vert_along_edge(edge, j)] -
103  mesh_P[sub.get_vert_along_grid_edge(edge, i + 1)]);
104 
105  /* use smallest diagonal */
106  if (len1 < len2)
107  v2 = sub.get_vert_along_edge(edge, ++j);
108  else
109  v2 = sub.get_vert_along_grid_edge(edge, ++i);
110  }
111 
112  add_triangle(sub.patch, v1, v0, v2);
113  }
114 }
115 
116 /* QuadDice */
117 
118 QuadDice::QuadDice(const SubdParams &params_) : EdgeDice(params_)
119 {
120 }
121 
122 float2 QuadDice::map_uv(Subpatch &sub, float u, float v)
123 {
124  /* map UV from subpatch to patch parametric coordinates */
125  float2 d0 = interp(sub.c00, sub.c01, v);
126  float2 d1 = interp(sub.c10, sub.c11, v);
127  return interp(d0, d1, u);
128 }
129 
131 {
132  float2 uv = map_uv(sub, u, v);
133  float3 P;
134 
135  sub.patch->eval(&P, NULL, NULL, NULL, uv.x, uv.y);
136  if (params.camera)
138 
139  return P;
140 }
141 
142 void QuadDice::set_vert(Subpatch &sub, int index, float u, float v)
143 {
144  EdgeDice::set_vert(sub.patch, index, map_uv(sub, u, v));
145 }
146 
147 void QuadDice::set_side(Subpatch &sub, int edge)
148 {
149  int t = sub.edges[edge].T;
150 
151  /* set verts on the edge of the patch */
152  for (int i = 0; i < t; i++) {
153  float f = i / (float)t;
154 
155  float u, v;
156  switch (edge) {
157  case 0:
158  u = 0;
159  v = f;
160  break;
161  case 1:
162  u = f;
163  v = 1;
164  break;
165  case 2:
166  u = 1;
167  v = 1.0f - f;
168  break;
169  case 3:
170  default:
171  u = 1.0f - f;
172  v = 0;
173  break;
174  }
175 
176  set_vert(sub, sub.get_vert_along_edge(edge, i), u, v);
177  }
178 }
179 
180 float QuadDice::quad_area(const float3 &a, const float3 &b, const float3 &c, const float3 &d)
181 {
182  return triangle_area(a, b, d) + triangle_area(a, d, c);
183 }
184 
185 float QuadDice::scale_factor(Subpatch &sub, int Mu, int Mv)
186 {
187  /* estimate area as 4x largest of 4 quads */
188  float3 P[3][3];
189 
190  for (int i = 0; i < 3; i++)
191  for (int j = 0; j < 3; j++)
192  P[i][j] = eval_projected(sub, i * 0.5f, j * 0.5f);
193 
194  float A1 = quad_area(P[0][0], P[1][0], P[0][1], P[1][1]);
195  float A2 = quad_area(P[1][0], P[2][0], P[1][1], P[2][1]);
196  float A3 = quad_area(P[0][1], P[1][1], P[0][2], P[1][2]);
197  float A4 = quad_area(P[1][1], P[2][1], P[1][2], P[2][2]);
198  float Apatch = max(A1, max(A2, max(A3, A4))) * 4.0f;
199 
200  /* solve for scaling factor */
201  float Atri = params.dicing_rate * params.dicing_rate * 0.5f;
202  float Ntris = Apatch / Atri;
203 
204  // XXX does the -sqrt solution matter
205  // XXX max(D, 0.0) is highly suspicious, need to test cases
206  // where D goes negative
207  float N = 0.5f * (Ntris - (sub.edge_u0.T + sub.edge_u1.T + sub.edge_v0.T + sub.edge_v1.T));
208  float D = 4.0f * N * Mu * Mv + (Mu + Mv) * (Mu + Mv);
209  float S = (Mu + Mv + sqrtf(max(D, 0.0f))) / (2 * Mu * Mv);
210 
211  return S;
212 }
213 
214 void QuadDice::add_grid(Subpatch &sub, int Mu, int Mv, int offset)
215 {
216  /* create inner grid */
217  float du = 1.0f / (float)Mu;
218  float dv = 1.0f / (float)Mv;
219 
220  for (int j = 1; j < Mv; j++) {
221  for (int i = 1; i < Mu; i++) {
222  float u = i * du;
223  float v = j * dv;
224 
225  set_vert(sub, offset + (i - 1) + (j - 1) * (Mu - 1), u, v);
226 
227  if (i < Mu - 1 && j < Mv - 1) {
228  int i1 = offset + (i - 1) + (j - 1) * (Mu - 1);
229  int i2 = offset + i + (j - 1) * (Mu - 1);
230  int i3 = offset + i + j * (Mu - 1);
231  int i4 = offset + (i - 1) + j * (Mu - 1);
232 
233  add_triangle(sub.patch, i1, i2, i3);
234  add_triangle(sub.patch, i1, i3, i4);
235  }
236  }
237  }
238 }
239 
241 {
242  /* compute inner grid size with scale factor */
243  int Mu = max(sub.edge_u0.T, sub.edge_u1.T);
244  int Mv = max(sub.edge_v0.T, sub.edge_v1.T);
245 
246 #if 0 /* Doesn't work very well, especially at grazing angles. */
247  float S = scale_factor(sub, ef, Mu, Mv);
248 #else
249  float S = 1.0f;
250 #endif
251 
252  Mu = max((int)ceilf(S * Mu), 2); // XXX handle 0 & 1?
253  Mv = max((int)ceilf(S * Mv), 2); // XXX handle 0 & 1?
254 
255  /* inner grid */
256  add_grid(sub, Mu, Mv, sub.inner_grid_vert_offset);
257 
258  /* sides */
259  set_side(sub, 0);
260  set_side(sub, 1);
261  set_side(sub, 2);
262  set_side(sub, 3);
263 
264  stitch_triangles(sub, 0);
265  stitch_triangles(sub, 1);
266  stitch_triangles(sub, 2);
267  stitch_triangles(sub, 3);
268 }
269 
typedef float(TangentPoint)[2]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
#define A2
Definition: RandGen.cpp:24
#define A1
Definition: RandGen.cpp:23
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
Attribute * add(ustring name, TypeDesc type, AttributeElement element)
float3 * data_float3()
Definition: dice.h:49
void reserve(int num_verts, int num_triangles)
Definition: dice.cpp:28
void add_triangle(Patch *patch, int v0, int v1, int v2)
Definition: dice.cpp:59
float3 * mesh_N
Definition: dice.h:53
size_t vert_offset
Definition: dice.h:54
void stitch_triangles(Subpatch &sub, int edge)
Definition: dice.cpp:69
size_t tri_offset
Definition: dice.h:55
float3 * mesh_P
Definition: dice.h:52
SubdParams params
Definition: dice.h:51
void set_vert(Patch *patch, int index, float2 uv)
Definition: dice.cpp:46
EdgeDice(const SubdParams &params)
Definition: dice.cpp:14
AttributeSet attributes
int shader
Definition: subd/patch.h:23
int patch_index
Definition: subd/patch.h:22
virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v)=0
QuadDice(const SubdParams &params)
Definition: dice.cpp:118
float scale_factor(Subpatch &sub, int Mu, int Mv)
Definition: dice.cpp:185
float2 map_uv(Subpatch &sub, float u, float v)
Definition: dice.cpp:122
void add_grid(Subpatch &sub, int Mu, int Mv, int offset)
Definition: dice.cpp:214
float3 eval_projected(Subpatch &sub, float u, float v)
Definition: dice.cpp:130
void set_vert(Subpatch &sub, int index, float u, float v)
Definition: dice.cpp:142
void dice(Subpatch &sub)
Definition: dice.cpp:240
float quad_area(const float3 &a, const float3 &b, const float3 &c, const float3 &d)
Definition: dice.cpp:180
void set_side(Subpatch &sub, int edge)
Definition: dice.cpp:147
int get_vert_along_grid_edge(int edge, int n) const
Definition: subpatch.h:95
edge_t edges[4]
Definition: subpatch.h:50
float2 c11
Definition: subpatch.h:44
int inner_grid_vert_offset
Definition: subpatch.h:17
edge_t edge_v1
Definition: subpatch.h:52
edge_t edge_u0
Definition: subpatch.h:52
float2 c01
Definition: subpatch.h:44
class Patch * patch
Definition: subpatch.h:16
edge_t edge_u1
Definition: subpatch.h:52
edge_t edge_v0
Definition: subpatch.h:52
float2 c10
Definition: subpatch.h:44
float2 c00
Definition: subpatch.h:44
int get_vert_along_edge(int e, int n) const
Definition: subpatch.h:199
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_device_inline float3 transform_perspective(ccl_private const ProjectionTransform *t, const float3 a)
static float verts[][3]
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
@ ATTR_STD_VERTEX_NORMAL
Definition: kernel/types.h:614
@ ATTR_STD_PTEX_FACE_ID
Definition: kernel/types.h:631
@ ATTR_STD_PTEX_UV
Definition: kernel/types.h:632
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
Definition: math_float2.h:232
ccl_device_inline float len_squared(const float3 a)
Definition: math_float3.h:423
static float P(float k)
Definition: math_interp.c:25
#define N
#define make_float2(x, y)
Definition: metal/compat.h:203
#define ceilf(x)
Definition: metal/compat.h:225
#define sqrtf(x)
Definition: metal/compat.h:243
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
ProjectionTransform worldtoraster
Definition: scene/camera.h:150
float size[3]
void reserve_mesh(int numverts, int numfaces)
Definition: scene/mesh.cpp:220
size_t num_triangles() const
Definition: scene/mesh.h:79
void add_triangle(int v0, int v1, int v2, int shader, bool smooth)
Definition: scene/mesh.cpp:342
void resize_mesh(int numverts, int numfaces)
Definition: scene/mesh.cpp:205
bool ptex
Definition: dice.h:25
Mesh * mesh
Definition: dice.h:24
Camera * camera
Definition: dice.h:31
float dicing_rate
Definition: dice.h:29
float x
Definition: types_float2.h:15
float y
Definition: types_float2.h:15
float max
ccl_device_inline float triangle_area(ccl_private const float3 &v1, ccl_private const float3 &v2, ccl_private const float3 &v3)
Definition: util/math.h:557
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)
Definition: voxel.c:13