122 const int vert_index)
124 const int poly_index =
data->mlooptri[tri_num].poly;
125 const MPoly *mp = &
data->mpoly[poly_index];
129 if (
data->precomputed_normals) {
137 const int vi =
data->mloop[
data->mlooptri[tri_num].tri[vert_index]].v;
138 const short *no =
data->mvert[vi].no;
156 bake_rast->
w = ibuf->
x;
157 bake_rast->
h = ibuf->
y;
165 const float st[2] = {(
x + 0.5f) /
data->w, (
y + 0.5f) /
data->h};
166 const float *st0, *st1, *st2;
167 const float *tang0, *tang1, *tang2;
168 float no0[3], no1[3], no2[3];
169 float fUV[2], from_tang[3][3], to_tang[3][3];
173 st0 =
data->mloopuv[
data->mlooptri[
data->tri_index].tri[0]].uv;
174 st1 =
data->mloopuv[
data->mlooptri[
data->tri_index].tri[1]].uv;
175 st2 =
data->mloopuv[
data->mlooptri[
data->tri_index].tri[2]].uv;
187 if (
data->pvtangent) {
188 tang0 =
data->pvtangent +
data->mlooptri[
data->tri_index].tri[0] * 4;
189 tang1 =
data->pvtangent +
data->mlooptri[
data->tri_index].tri[1] * 4;
190 tang2 =
data->pvtangent +
data->mlooptri[
data->tri_index].tri[2] * 4;
194 sign = (tang0[3] * u + tang1[3] *
v + tang2[3] *
w) < 0 ? (-1.0f) : 1.0f;
198 for (
r = 0;
r < 3;
r++) {
199 from_tang[0][
r] = tang0[
r] * u + tang1[
r] *
v + tang2[
r] *
w;
200 from_tang[2][
r] = no0[
r] * u + no1[
r] *
v + no2[
r] *
w;
226 const int w = bake_rast->
w;
227 const int h = bake_rast->
h;
229 if (
x >= 0 && x < w && y >= 0 &&
y < h) {
230 if ((bake_rast->
texels[
y *
w +
x]) == 0) {
251 const int is_mid_right)
253 const int s_stable =
fabsf(t1_s - t0_s) > FLT_EPSILON ? 1 : 0;
254 const int l_stable =
fabsf(t1_l - t0_l) > FLT_EPSILON ? 1 : 0;
255 const int w = bake_rast->
w;
256 const int h = bake_rast->
h;
259 if (y1_in <= 0 || y0_in >= h) {
263 y0 = y0_in < 0 ? 0 : y0_in;
264 y1 = y1_in >= h ? h : y1_in;
266 for (
y = y0;
y <
y1;
y++) {
269 float x_l = s_stable != 0 ? (s0_s + (((s1_s - s0_s) * (
y - t0_s)) / (t1_s - t0_s))) : s0_s;
270 float x_r = l_stable != 0 ? (s0_l + (((s1_l - s0_l) * (
y - t0_l)) / (t1_l - t0_l))) : s0_l;
272 if (is_mid_right != 0) {
273 SWAP(
float, x_l, x_r);
276 iXl = (int)
ceilf(x_l);
277 iXr = (int)
ceilf(x_r);
279 if (iXr > 0 && iXl <
w) {
280 iXl = iXl < 0 ? 0 : iXl;
281 iXr = iXr >=
w ?
w : iXr;
283 for (
x = iXl;
x < iXr;
x++) {
291 const float st0_in[2],
292 const float st1_in[2],
293 const float st2_in[2])
295 const int w = bake_rast->
w;
296 const int h = bake_rast->
h;
297 float slo = st0_in[0] *
w - 0.5f;
298 float tlo = st0_in[1] * h - 0.5f;
299 float smi = st1_in[0] *
w - 0.5f;
300 float tmi = st1_in[1] * h - 0.5f;
301 float shi = st2_in[0] *
w - 0.5f;
302 float thi = st2_in[1] * h - 0.5f;
303 int is_mid_right = 0, ylo, yhi, yhi_beg;
306 if ((slo == smi && tlo == tmi) || (slo == shi && tlo == thi) || (smi == shi && tmi == thi)) {
311 if (tlo > tmi && tlo > thi) {
312 SWAP(
float, shi, slo);
313 SWAP(
float, thi, tlo);
315 else if (tmi > thi) {
316 SWAP(
float, shi, smi);
317 SWAP(
float, thi, tmi);
321 SWAP(
float, slo, smi);
322 SWAP(
float, tlo, tmi);
326 is_mid_right = (-(shi - slo) * (tmi - thi) + (thi - tlo) * (smi - shi)) > 0 ? 1 : 0;
327 ylo = (int)
ceilf(tlo);
328 yhi_beg = (int)
ceilf(tmi);
329 yhi = (int)
ceilf(thi);
332 rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right);
333 rasterize_half(bake_rast, smi, tmi, shi, thi, slo, tlo, shi, thi, yhi_beg, yhi, is_mid_right);
343 return *bkr->
stop ||
G.is_break;
379 face =
queue->cur_tri;
398 const short mat_nr = mp->
mat_nr;
406 if (tri_image != handle->
image) {
410 data->tri_index = tri_index;
413 bake_rast, mloopuv[lt->
tri[0]].
uv, mloopuv[lt->
tri[1]].
uv, mloopuv[lt->
tri[2]].
uv);
416 if (
data->ibuf->rect_float) {
450 const int *grid_offset;
464 bool require_tangent,
472 const int lvl = bkr->
lvl;
485 float *pvtangent =
NULL;
490 void *bake_data =
NULL;
492 if (require_tangent) {
502 bake_data = initBakeData(bkr, ima);
505 if (tot_thread > 1) {
515 queue.tot_tri = tot_tri;
519 for (i = 0; i < tot_thread; i++) {
548 if (tot_thread > 1) {
554 if (tot_thread > 1) {
565 for (i = 1; i < tot_thread; i++) {
574 freeBakeData(bake_data);
586 CCGKey *key,
CCGElem *grid,
float crn_x,
float crn_y,
int mode,
float res[3])
619 const int *index_mp_to_orig,
630 int grid_size, S, face_side;
631 int *grid_offset, g_index;
632 int poly_index = lt->
poly;
641 face_side = (grid_size << 1) - 1;
644 g_index = grid_offset[poly_index];
657 int polys_per_grid_side = (1 << (lvl - 1));
659 int cage_face_index = index_mp_to_orig ? index_mp_to_orig[poly_index] : poly_index;
662 int loc_cage_poly_ofs = poly_index % (1 << (2 * lvl));
664 int cell_index = loc_cage_poly_ofs % (polys_per_grid_side * polys_per_grid_side);
665 int cell_side = (grid_size - 1) / polys_per_grid_side;
667 int row = cell_index / polys_per_grid_side;
668 int col = cell_index % polys_per_grid_side;
671 S = poly_index / (1 << (2 * (lvl - 1))) - grid_offset[cage_face_index];
673 g_index = grid_offset[cage_face_index];
675 crn_y = (row * cell_side) + u * cell_side;
676 crn_x = (
col * cell_side) +
v * cell_side;
679 CLAMP(crn_x, 0.0f, grid_size);
680 CLAMP(crn_y, 0.0f, grid_size);
755 "MultiresBake heights");
760 height_data->
ima = ima;
784 return (
void *)height_data;
791 if (height_data->
ssdm) {
812 float UNUSED(tangmat[3][3]),
822 float uv[2], *st0, *st1, *st2, *st3;
823 int pixel = ibuf->
x *
y +
x;
824 float vec[3], p0[3], p1[3], n[3],
len;
836 st0 = mloopuv[lt->
tri[0]].
uv;
837 st1 = mloopuv[lt->
tri[1]].
uv;
838 st2 = mloopuv[lt->
tri[2]].
uv;
847 if (height_data->
ssdm) {
879 rrgbf[0] = rrgbf[1] = rrgbf[2] =
len;
883 char *rrgb = (
char *)ibuf->
rect + pixel * 4;
900 return (
void *)normal_data;
920 void *
UNUSED(thread_data),
934 float uv[2], *st0, *st1, *st2, *st3;
935 int pixel = ibuf->
x *
y +
x;
936 float n[3], vec[3], tmp[3] = {0.5, 0.5, 0.5};
948 st0 = mloopuv[lt->
tri[0]].
uv;
949 st1 = mloopuv[lt->
tri[1]].
uv;
950 st2 = mloopuv[lt->
tri[2]].
uv;
971 unsigned char *rrgb = (
unsigned char *)ibuf->
rect + pixel * 4;
982 # define MAX_NUMBER_OF_AO_RAYS 1024
984 static unsigned short ao_random_table_1[MAX_NUMBER_OF_AO_RAYS];
985 static unsigned short ao_random_table_2[MAX_NUMBER_OF_AO_RAYS];
987 static void init_ao_random(
void)
991 for (i = 0; i < MAX_NUMBER_OF_AO_RAYS; i++) {
992 ao_random_table_1[i] = rand() & 0xffff;
993 ao_random_table_2[i] = rand() & 0xffff;
997 static unsigned short get_ao_random1(
const int i)
999 return ao_random_table_1[i & (MAX_NUMBER_OF_AO_RAYS - 1)];
1002 static unsigned short get_ao_random2(
const int i)
1004 return ao_random_table_2[i & (MAX_NUMBER_OF_AO_RAYS - 1)];
1007 static void build_permutation_table(
unsigned short permutation[],
1008 unsigned short temp_permutation[],
1009 const int number_of_rays,
1010 const int is_first_perm_table)
1014 for (i = 0; i < number_of_rays; i++) {
1015 temp_permutation[i] = i;
1018 for (i = 0; i < number_of_rays; i++) {
1019 const unsigned int nr_entries_left = number_of_rays - i;
1020 unsigned short rnd = is_first_perm_table !=
false ? get_ao_random1(i) : get_ao_random2(i);
1021 const unsigned short entry = rnd % nr_entries_left;
1024 permutation[i] = temp_permutation[entry];
1027 for (k = entry; k < nr_entries_left - 1; k++) {
1028 temp_permutation[k] = temp_permutation[k + 1];
1036 for (i = 0; i < number_of_rays; i++) temp_permutation[i] = 0;
1037 for (i = 0; i < number_of_rays; i++) ++temp_permutation[permutation[i]];
1038 for (i = 0; i < number_of_rays; i++)
BLI_assert(temp_permutation[i] == 1);
1049 int num_grids, grid_size , num_faces;
1058 num_faces = num_grids * (grid_size - 1) * (grid_size - 1);
1060 raytree = ao_data->raytree = RE_rayobject_create(
1062 face = ao_data->rayfaces = (RayFace *)
MEM_callocN(num_faces *
sizeof(RayFace),
1065 for (i = 0; i < num_grids; i++) {
1067 for (
x = 0;
x < grid_size - 1;
x++) {
1068 for (
y = 0;
y < grid_size - 1;
y++) {
1076 RE_rayface_from_coords(face, ao_data, face, co[0], co[1], co[2], co[3]);
1077 RE_rayobject_add(raytree, RE_rayobject_unalignRayFace(face));
1084 RE_rayobject_done(raytree);
1089 MAOBakeData *ao_data;
1091 unsigned short *temp_permutation_table;
1092 size_t permutation_size;
1096 ao_data =
MEM_callocN(
sizeof(MAOBakeData),
"MultiresBake aoData");
1099 ao_data->bias = bkr->
bias;
1103 create_ao_raytree(bkr, ao_data);
1107 ao_data->permutation_table_1 =
MEM_callocN(permutation_size,
"multires AO baker perm1");
1108 ao_data->permutation_table_2 =
MEM_callocN(permutation_size,
"multires AO baker perm2");
1109 temp_permutation_table =
MEM_callocN(permutation_size,
"multires AO baker temp perm");
1111 build_permutation_table(
1112 ao_data->permutation_table_1, temp_permutation_table, bkr->
number_of_rays, 1);
1113 build_permutation_table(
1114 ao_data->permutation_table_2, temp_permutation_table, bkr->
number_of_rays, 0);
1118 return (
void *)ao_data;
1121 static void free_ao_data(
void *bake_data)
1123 MAOBakeData *ao_data = (MAOBakeData *)bake_data;
1125 RE_rayobject_free(ao_data->raytree);
1128 MEM_freeN(ao_data->permutation_table_1);
1129 MEM_freeN(ao_data->permutation_table_2);
1135 static void build_coordinate_frame(
float axisX[3],
float axisY[3],
const float axisZ[3])
1137 const float faX =
fabsf(axisZ[0]);
1138 const float faY =
fabsf(axisZ[1]);
1139 const float faZ =
fabsf(axisZ[2]);
1141 if (faX <= faY && faX <= faZ) {
1142 const float len =
sqrtf(axisZ[1] * axisZ[1] + axisZ[2] * axisZ[2]);
1144 axisY[1] = axisZ[2] /
len;
1145 axisY[2] = -axisZ[1] /
len;
1148 else if (faY <= faZ) {
1149 const float len =
sqrtf(axisZ[0] * axisZ[0] + axisZ[2] * axisZ[2]);
1150 axisX[0] = axisZ[2] /
len;
1152 axisX[2] = -axisZ[0] /
len;
1156 const float len =
sqrtf(axisZ[0] * axisZ[0] + axisZ[1] * axisZ[1]);
1157 axisX[0] = axisZ[1] /
len;
1158 axisX[1] = -axisZ[0] /
len;
1165 static int trace_ao_ray(MAOBakeData *ao_data,
float ray_start[3],
float ray_direction[3])
1167 Isect isect = {{0}};
1169 isect.dist = RE_RAYTRACE_MAXDIST;
1176 return RE_rayobject_raycast(ao_data->raytree, &isect);
1179 static void apply_ao_callback(
DerivedMesh *lores_dm,
1181 void *
UNUSED(thread_data),
1184 const int tri_index,
1187 float UNUSED(tangmat[3][3]),
1194 MAOBakeData *ao_data = (MAOBakeData *)bake_data;
1197 float pos[3], nrm[3];
1199 float axisX[3], axisY[3], axisZ[3];
1202 int pixel = ibuf->
x *
y +
x;
1203 float uv[2], *st0, *st1, *st2, *st3;
1215 st0 = mloopuv[lt->
tri[0]].
uv;
1216 st1 = mloopuv[lt->
tri[1]].
uv;
1217 st2 = mloopuv[lt->
tri[2]].
uv;
1224 lores_dm, hires_dm, ao_data->orig_index_mp_to_orig, lvl, lt, uv[0], uv[1],
pos, nrm);
1227 for (i = 0; i < 3; i++) {
1228 cen[i] =
pos[i] + ao_data->bias * nrm[i];
1232 for (i = 0; i < 3; i++) {
1236 build_coordinate_frame(axisX, axisY, axisZ);
1239 perm_ofs = (get_ao_random2(get_ao_random1(
x) +
y)) & (MAX_NUMBER_OF_AO_RAYS - 1);
1242 for (i = 0; i < ao_data->number_of_rays; i++) {
1248 const unsigned short I =
1249 ao_data->permutation_table_1[(i + perm_ofs) % ao_data->number_of_rays];
1250 const unsigned short J = ao_data->permutation_table_2[i];
1252 const float JitPh = (get_ao_random2(
I + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
1253 ((
float)MAX_NUMBER_OF_AO_RAYS);
1254 const float JitTh = (get_ao_random1(J + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
1255 ((
float)MAX_NUMBER_OF_AO_RAYS);
1256 const float SiSqPhi = (
I + JitPh) / ao_data->number_of_rays;
1257 const float Theta = (
float)(2 *
M_PI) * ((J + JitTh) / ao_data->number_of_rays);
1262 float SiPhi =
sqrtf(SiSqPhi);
1263 float CoPhi = SiSqPhi < 1.0f ?
sqrtf(1.0f - SiSqPhi) : 0;
1264 float CoThe =
cosf(Theta);
1265 float SiThe =
sinf(Theta);
1267 const float dx = CoThe * CoPhi;
1268 const float dy = SiThe * CoPhi;
1269 const float dz = SiPhi;
1273 for (k = 0; k < 3; k++) {
1274 dv[k] = axisX[k] * dx + axisY[k] * dy + axisZ[k] * dz;
1277 hit_something = trace_ao_ray(ao_data, cen, dv);
1279 if (hit_something != 0) {
1284 value = 1.0f - (shadow / ao_data->number_of_rays);
1288 rrgbf[0] = rrgbf[1] = rrgbf[2] = value;
1292 unsigned char *rrgb = (
unsigned char *)ibuf->
rect + pixel * 4;
1324 const float *displacement,
1326 float displacement_min,
1327 float displacement_max)
1330 const float *current_displacement = displacement;
1331 const char *current_mask =
mask;
1336 for (i = 0; i < ibuf->
x * ibuf->
y; i++) {
1338 float normalized_displacement;
1340 if (max_distance > 1e-5f) {
1341 normalized_displacement = (*current_displacement + max_distance) / (max_distance * 2);
1344 normalized_displacement = 0.5f;
1350 fp[0] = fp[1] = fp[2] = normalized_displacement;
1355 unsigned char *cp = (
unsigned char *)(ibuf->
rect + i);
1361 current_displacement++;
1408 if (ibuf->
x > 0 && ibuf->
y > 0) {
1410 "MultiresBake userdata");
1414 switch (bkr->
mode) {
1453 if (ibuf->
x <= 0 || ibuf->
y <= 0) {
1457 if (use_displacement_buffer) {
typedef float(TangentPoint)[2]
void DM_calc_loop_tangents(DerivedMesh *dm, bool calc_active_tangent, const char(*tangent_names)[MAX_NAME], int tangent_names_len)
void * DM_get_loop_data_layer(struct DerivedMesh *dm, int type)
BLI_INLINE float * CCG_grid_elem_co(const CCGKey *key, CCGElem *elem, int x, int y)
BLI_INLINE float * CCG_grid_elem_no(const CCGKey *key, CCGElem *elem, int x, int y)
int CustomData_get_layer_index(const struct CustomData *data, int type)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
bool BKE_imbuf_alpha_test(struct ImBuf *ibuf)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf)
General operations, lookup, etc. for materials.
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_no[3])
int mdisp_rot_face_to_crn(struct MVert *mvert, struct MPoly *mpoly, struct MLoop *mloop, const struct MLoopTri *lt, const int face_side, const float u, const float v, float *x, float *y)
struct DerivedMesh * subsurf_make_derived_from_derived(struct DerivedMesh *dm, struct SubsurfModifierData *smd, const struct Scene *scene, float(*vertCos)[3], SubsurfFlags flags)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
struct LinkData * BLI_genericNodeN(void *data)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
void resolve_tri_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2])
void resolve_quad_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3])
void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3])
void zero_m3(float m[3][3])
bool invert_m3_m3(float R[3][3], const float A[3][3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void normal_short_to_float_v3(float r[3], const short n[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void clamp_v2(float vec[2], const float min, const float max)
MINLINE float normalize_v3_length(float r[3], const float unit_scale)
MINLINE void add_v3_v3(float r[3], const float a[3])
pthread_spinlock_t SpinLock
void BLI_threadpool_init(struct ListBase *threadbase, void *(*do_thread)(void *), int tot)
int BLI_system_thread_count(void)
void BLI_threadpool_end(struct ListBase *threadbase)
void BLI_spin_init(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
void BLI_threadpool_insert(struct ListBase *threadbase, void *callerdata)
void BLI_spin_end(SpinLock *spin)
void DEG_id_tag_update(struct ID *id, int flag)
@ SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES
Object is a sort of wrapper for general info.
#define R_IMF_PLANES_RGBA
_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 y1
_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 GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 y
void imb_freemipmapImBuf(struct ImBuf *ibuf)
void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value)
Contains defines and structs used throughout the imbuf module.
@ IB_DISPLAY_BUFFER_INVALID
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
#define RE_BAKE_DISPLACEMENT
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
static int multiresbake_test_break(MultiresBakeRender *bkr)
struct MultiresBakeQueue MultiresBakeQueue
struct BakeImBufuserData BakeImBufuserData
static void rasterize_half(const MBakeRast *bake_rast, const float s0_s, const float t0_s, const float s1_s, const float t1_s, const float s0_l, const float t0_l, const float s1_l, const float t1_l, const int y0_in, const int y1_in, const int is_mid_right)
static void bake_ibuf_normalize_displacement(ImBuf *ibuf, const float *displacement, const char *mask, float displacement_min, float displacement_max)
static void bake_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
static void count_images(MultiresBakeRender *bkr)
static void bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter)
void(* MPassKnownData)(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void *thread_data, void *bake_data, ImBuf *ibuf, const int face_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y)
static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResolvePixelData *data, MFlushPixel flush_pixel, short *do_update)
static void finish_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
struct MultiresBakeResult MultiresBakeResult
static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int tri_num, const int vert_index)
static void init_ccgdm_arrays(DerivedMesh *dm)
static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int y)
static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, bool require_tangent, MPassKnownData passKnownData, MInitBakeData initBakeData, MFreeBakeData freeBakeData, MultiresBakeResult *result)
static void interp_bilinear_mpoly(DerivedMesh *dm, MLoop *mloop, MPoly *mpoly, const float u, const float v, const int mode, float res[3])
static void interp_barycentric_mlooptri(DerivedMesh *dm, MLoop *mloop, const MLoopTri *lt, const float u, const float v, const int mode, float res[3])
static void free_normal_data(void *bake_data)
static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], const float st1_in[2], const float st2_in[2])
static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *index_mp_to_orig, const int lvl, const MLoopTri *lt, const float u, const float v, float co[3], float n[3])
void RE_multires_bake_images(MultiresBakeRender *bkr)
static void * init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
static void * init_heights_data(MultiresBakeRender *bkr, Image *ima)
static int multires_bake_queue_next_tri(MultiresBakeQueue *queue)
static void interp_bilinear_grid(CCGKey *key, CCGElem *grid, float crn_x, float crn_y, int mode, float res[3])
void(* MFreeBakeData)(void *bake_data)
void *(* MInitBakeData)(MultiresBakeRender *bkr, Image *ima)
static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
static void free_heights_data(void *bake_data)
struct MultiresBakeThread MultiresBakeThread
static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void *thread_data_v, void *bake_data, ImBuf *ibuf, const int tri_index, const int lvl, const float st[2], float UNUSED(tangmat[3][3]), const int x, const int y)
static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void *UNUSED(thread_data), void *bake_data, ImBuf *ibuf, const int tri_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y)
void(* MFlushPixel)(const MResolvePixelData *data, const int x, const int y)
static void * do_multires_bake_thread(void *data_v)
ThreadQueue * queue
all scheduled work for the cpu
ListBase threads
list of all thread for every CPUDevice in cpudevices a thread exists.
float * displacement_buffer
int(* getGridSize)(DerivedMesh *dm)
struct MLoop *(* getLoopArray)(DerivedMesh *dm)
void(* getVertNo)(DerivedMesh *dm, int index, float r_no[3])
struct MVert *(* getVertArray)(DerivedMesh *dm)
const struct MLoopTri *(* getLoopTriArray)(DerivedMesh *dm)
int(* getNumLoopTri)(DerivedMesh *dm)
struct CCGElem **(* getGridData)(DerivedMesh *dm)
void *(* getLoopDataArray)(DerivedMesh *dm, int type)
int(* getNumGrids)(DerivedMesh *dm)
void *(* getPolyDataArray)(DerivedMesh *dm, int type)
void(* getGridKey)(DerivedMesh *dm, struct CCGKey *key)
struct MPoly *(* getPolyArray)(DerivedMesh *dm)
void(* release)(DerivedMesh *dm)
void(* getVertCo)(DerivedMesh *dm, int index, float r_co[3])
int *(* getGridOffset)(DerivedMesh *dm)
struct ImBuf * mipmap[IMB_MIPMAP_LEVELS]
const MResolvePixelData * data
const int * orig_index_mp_to_orig
const int * orig_index_mp_to_orig
const float * precomputed_normals
const MLoopTri * mlooptri
struct MultiresBakeRender::@1137 ob_image
MultiresBakeQueue * queue
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)