Blender  V2.93
subd_dice.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "render/camera.h"
18 #include "render/mesh.h"
19 
20 #include "subd/subd_dice.h"
21 #include "subd/subd_patch.h"
22 
24 
25 /* EdgeDice Base */
26 
27 EdgeDice::EdgeDice(const SubdParams &params_) : params(params_)
28 {
29  mesh_P = NULL;
30  mesh_N = NULL;
31  vert_offset = 0;
32 
34 
35  if (params.ptex) {
38  }
39 }
40 
41 void EdgeDice::reserve(int num_verts, int num_triangles)
42 {
43  Mesh *mesh = params.mesh;
44 
45  vert_offset = mesh->get_verts().size();
47 
48  mesh->resize_mesh(mesh->get_verts().size() + num_verts, mesh->num_triangles());
49  mesh->reserve_mesh(mesh->get_verts().size() + num_verts, mesh->num_triangles() + num_triangles);
50 
52 
53  mesh_P = mesh->verts.data() + vert_offset;
54  mesh_N = attr_vN->data_float3() + vert_offset;
55 
56  params.mesh->num_subd_verts += num_verts;
57 }
58 
59 void EdgeDice::set_vert(Patch *patch, int index, float2 uv)
60 {
61  float3 P, N;
62 
63  patch->eval(&P, NULL, NULL, &N, uv.x, uv.y);
64 
65  assert(index < params.mesh->verts.size());
66 
67  mesh_P[index] = P;
68  mesh_N[index] = N;
69  params.mesh->vert_patch_uv[index + vert_offset] = make_float2(uv.x, uv.y);
70 }
71 
72 void EdgeDice::add_triangle(Patch *patch, int v0, int v1, int v2)
73 {
74  Mesh *mesh = params.mesh;
75 
76  mesh->add_triangle(v0 + vert_offset, v1 + vert_offset, v2 + vert_offset, patch->shader, true);
77  params.mesh->triangle_patch[params.mesh->num_triangles() - 1] = patch->patch_index;
78 
79  tri_offset++;
80 }
81 
83 {
84  int Mu = max(sub.edge_u0.T, sub.edge_u1.T);
85  int Mv = max(sub.edge_v0.T, sub.edge_v1.T);
86  Mu = max(Mu, 2);
87  Mv = max(Mv, 2);
88 
89  int outer_T = sub.edges[edge].T;
90  int inner_T = ((edge % 2) == 0) ? Mv - 2 : Mu - 2;
91 
92  if (inner_T < 0 || outer_T < 0)
93  return; // XXX avoid crashes for Mu or Mv == 1, missing polygons
94 
95  /* stitch together two arrays of verts with triangles. at each step,
96  * we compare using the next verts on both sides, to find the split
97  * direction with the smallest diagonal, and use that in order to keep
98  * the triangle shape reasonable. */
99  for (size_t i = 0, j = 0; i < inner_T || j < outer_T;) {
100  int v0, v1, v2;
101 
102  v0 = sub.get_vert_along_grid_edge(edge, i);
103  v1 = sub.get_vert_along_edge(edge, j);
104 
105  if (j == outer_T) {
106  v2 = sub.get_vert_along_grid_edge(edge, ++i);
107  }
108  else if (i == inner_T) {
109  v2 = sub.get_vert_along_edge(edge, ++j);
110  }
111  else {
112  /* length of diagonals */
113  float len1 = len_squared(mesh_P[sub.get_vert_along_grid_edge(edge, i)] -
114  mesh_P[sub.get_vert_along_edge(edge, j + 1)]);
115  float len2 = len_squared(mesh_P[sub.get_vert_along_edge(edge, j)] -
116  mesh_P[sub.get_vert_along_grid_edge(edge, i + 1)]);
117 
118  /* use smallest diagonal */
119  if (len1 < len2)
120  v2 = sub.get_vert_along_edge(edge, ++j);
121  else
122  v2 = sub.get_vert_along_grid_edge(edge, ++i);
123  }
124 
125  add_triangle(sub.patch, v1, v0, v2);
126  }
127 }
128 
129 /* QuadDice */
130 
131 QuadDice::QuadDice(const SubdParams &params_) : EdgeDice(params_)
132 {
133 }
134 
135 float2 QuadDice::map_uv(Subpatch &sub, float u, float v)
136 {
137  /* map UV from subpatch to patch parametric coordinates */
138  float2 d0 = interp(sub.c00, sub.c01, v);
139  float2 d1 = interp(sub.c10, sub.c11, v);
140  return interp(d0, d1, u);
141 }
142 
144 {
145  float2 uv = map_uv(sub, u, v);
146  float3 P;
147 
148  sub.patch->eval(&P, NULL, NULL, NULL, uv.x, uv.y);
149  if (params.camera)
151 
152  return P;
153 }
154 
155 void QuadDice::set_vert(Subpatch &sub, int index, float u, float v)
156 {
157  EdgeDice::set_vert(sub.patch, index, map_uv(sub, u, v));
158 }
159 
160 void QuadDice::set_side(Subpatch &sub, int edge)
161 {
162  int t = sub.edges[edge].T;
163 
164  /* set verts on the edge of the patch */
165  for (int i = 0; i < t; i++) {
166  float f = i / (float)t;
167 
168  float u, v;
169  switch (edge) {
170  case 0:
171  u = 0;
172  v = f;
173  break;
174  case 1:
175  u = f;
176  v = 1;
177  break;
178  case 2:
179  u = 1;
180  v = 1.0f - f;
181  break;
182  case 3:
183  default:
184  u = 1.0f - f;
185  v = 0;
186  break;
187  }
188 
189  set_vert(sub, sub.get_vert_along_edge(edge, i), u, v);
190  }
191 }
192 
193 float QuadDice::quad_area(const float3 &a, const float3 &b, const float3 &c, const float3 &d)
194 {
195  return triangle_area(a, b, d) + triangle_area(a, d, c);
196 }
197 
198 float QuadDice::scale_factor(Subpatch &sub, int Mu, int Mv)
199 {
200  /* estimate area as 4x largest of 4 quads */
201  float3 P[3][3];
202 
203  for (int i = 0; i < 3; i++)
204  for (int j = 0; j < 3; j++)
205  P[i][j] = eval_projected(sub, i * 0.5f, j * 0.5f);
206 
207  float A1 = quad_area(P[0][0], P[1][0], P[0][1], P[1][1]);
208  float A2 = quad_area(P[1][0], P[2][0], P[1][1], P[2][1]);
209  float A3 = quad_area(P[0][1], P[1][1], P[0][2], P[1][2]);
210  float A4 = quad_area(P[1][1], P[2][1], P[1][2], P[2][2]);
211  float Apatch = max(A1, max(A2, max(A3, A4))) * 4.0f;
212 
213  /* solve for scaling factor */
214  float Atri = params.dicing_rate * params.dicing_rate * 0.5f;
215  float Ntris = Apatch / Atri;
216 
217  // XXX does the -sqrt solution matter
218  // XXX max(D, 0.0) is highly suspicious, need to test cases
219  // where D goes negative
220  float N = 0.5f * (Ntris - (sub.edge_u0.T + sub.edge_u1.T + sub.edge_v0.T + sub.edge_v1.T));
221  float D = 4.0f * N * Mu * Mv + (Mu + Mv) * (Mu + Mv);
222  float S = (Mu + Mv + sqrtf(max(D, 0.0f))) / (2 * Mu * Mv);
223 
224  return S;
225 }
226 
227 void QuadDice::add_grid(Subpatch &sub, int Mu, int Mv, int offset)
228 {
229  /* create inner grid */
230  float du = 1.0f / (float)Mu;
231  float dv = 1.0f / (float)Mv;
232 
233  for (int j = 1; j < Mv; j++) {
234  for (int i = 1; i < Mu; i++) {
235  float u = i * du;
236  float v = j * dv;
237 
238  set_vert(sub, offset + (i - 1) + (j - 1) * (Mu - 1), u, v);
239 
240  if (i < Mu - 1 && j < Mv - 1) {
241  int i1 = offset + (i - 1) + (j - 1) * (Mu - 1);
242  int i2 = offset + i + (j - 1) * (Mu - 1);
243  int i3 = offset + i + j * (Mu - 1);
244  int i4 = offset + (i - 1) + j * (Mu - 1);
245 
246  add_triangle(sub.patch, i1, i2, i3);
247  add_triangle(sub.patch, i1, i3, i4);
248  }
249  }
250  }
251 }
252 
254 {
255  /* compute inner grid size with scale factor */
256  int Mu = max(sub.edge_u0.T, sub.edge_u1.T);
257  int Mv = max(sub.edge_v0.T, sub.edge_v1.T);
258 
259 #if 0 /* Doesn't work very well, especially at grazing angles. */
260  float S = scale_factor(sub, ef, Mu, Mv);
261 #else
262  float S = 1.0f;
263 #endif
264 
265  Mu = max((int)ceilf(S * Mu), 2); // XXX handle 0 & 1?
266  Mv = max((int)ceilf(S * Mv), 2); // XXX handle 0 & 1?
267 
268  /* inner grid */
269  add_grid(sub, Mu, Mv, sub.inner_grid_vert_offset);
270 
271  /* sides */
272  set_side(sub, 0);
273  set_side(sub, 1);
274  set_side(sub, 2);
275  set_side(sub, 3);
276 
277  stitch_triangles(sub, 0);
278  stitch_triangles(sub, 1);
279  stitch_triangles(sub, 2);
280  stitch_triangles(sub, 3);
281 }
282 
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:38
#define A1
Definition: RandGen.cpp:37
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
Attribute * add(ustring name, TypeDesc type, AttributeElement element)
Definition: attribute.cpp:428
float3 * data_float3()
Definition: attribute.h:86
void reserve(int num_verts, int num_triangles)
Definition: subd_dice.cpp:41
void add_triangle(Patch *patch, int v0, int v1, int v2)
Definition: subd_dice.cpp:72
float3 * mesh_N
Definition: subd_dice.h:66
size_t vert_offset
Definition: subd_dice.h:67
void stitch_triangles(Subpatch &sub, int edge)
Definition: subd_dice.cpp:82
size_t tri_offset
Definition: subd_dice.h:68
float3 * mesh_P
Definition: subd_dice.h:65
SubdParams params
Definition: subd_dice.h:64
void set_vert(Patch *patch, int index, float2 uv)
Definition: subd_dice.cpp:59
EdgeDice(const SubdParams &params)
Definition: subd_dice.cpp:27
AttributeSet attributes
Definition: geometry.h:81
int shader
Definition: subd_patch.h:36
int patch_index
Definition: subd_patch.h:35
virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v)=0
QuadDice(const SubdParams &params)
Definition: subd_dice.cpp:131
float scale_factor(Subpatch &sub, int Mu, int Mv)
Definition: subd_dice.cpp:198
float2 map_uv(Subpatch &sub, float u, float v)
Definition: subd_dice.cpp:135
void add_grid(Subpatch &sub, int Mu, int Mv, int offset)
Definition: subd_dice.cpp:227
float3 eval_projected(Subpatch &sub, float u, float v)
Definition: subd_dice.cpp:143
void set_vert(Subpatch &sub, int index, float u, float v)
Definition: subd_dice.cpp:155
void dice(Subpatch &sub)
Definition: subd_dice.cpp:253
float quad_area(const float3 &a, const float3 &b, const float3 &c, const float3 &d)
Definition: subd_dice.cpp:193
void set_side(Subpatch &sub, int edge)
Definition: subd_dice.cpp:160
int get_vert_along_grid_edge(int edge, int n) const
edge_t edges[4]
Definition: subd_subpatch.h:63
float2 c11
Definition: subd_subpatch.h:57
int inner_grid_vert_offset
Definition: subd_subpatch.h:30
edge_t edge_v1
Definition: subd_subpatch.h:65
edge_t edge_u0
Definition: subd_subpatch.h:65
float2 c01
Definition: subd_subpatch.h:57
class Patch * patch
Definition: subd_subpatch.h:29
edge_t edge_u1
Definition: subd_subpatch.h:65
edge_t edge_v0
Definition: subd_subpatch.h:65
float2 c10
Definition: subd_subpatch.h:57
float2 c00
Definition: subd_subpatch.h:57
int get_vert_along_edge(int e, int n) const
static float verts[][3]
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define CCL_NAMESPACE_END
#define make_float2(x, y)
#define ceilf(x)
#define sqrtf(x)
@ ATTR_STD_VERTEX_NORMAL
Definition: kernel_types.h:746
@ ATTR_STD_PTEX_FACE_ID
Definition: kernel_types.h:761
@ ATTR_STD_PTEX_UV
Definition: kernel_types.h:762
static float P(float k)
Definition: math_interp.c:41
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
params N
ProjectionTransform worldtoraster
Definition: camera.h:169
float size[3]
void reserve_mesh(int numverts, int numfaces)
Definition: mesh.cpp:230
size_t num_triangles() const
Definition: mesh.h:92
void add_triangle(int v0, int v1, int v2, int shader, bool smooth)
Definition: mesh.cpp:352
void resize_mesh(int numverts, int numfaces)
Definition: mesh.cpp:215
bool ptex
Definition: subd_dice.h:38
Mesh * mesh
Definition: subd_dice.h:37
Camera * camera
Definition: subd_dice.h:44
float dicing_rate
Definition: subd_dice.h:42
float max
ccl_device_inline float triangle_area(const float3 &v1, const float3 &v2, const float3 &v3)
Definition: util_math.h:467
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
ccl_device_inline float len_squared(const float3 a)
ccl_device_inline float3 transform_perspective(const ProjectionTransform *t, const float3 a)
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)
Definition: voxel.c:29