71 const float (*precomputed_normals)[3];
111 const int vert_index,
114 const int poly_index =
data->mlooptri[tri_num].poly;
115 const MPoly *mp = &
data->mpoly[poly_index];
119 const int vi =
data->mloop[
data->mlooptri[tri_num].tri[vert_index]].v;
123 if (
data->precomputed_normals) {
143 bake_rast->
w = ibuf->
x;
144 bake_rast->
h = ibuf->
y;
152 const float st[2] = {(
x + 0.5f) /
data->w +
data->uv_offset[0],
153 (
y + 0.5f) /
data->h +
data->uv_offset[1]};
154 const float *st0, *st1, *st2;
155 const float *tang0, *tang1, *tang2;
156 float no0[3], no1[3], no2[3];
157 float fUV[2], from_tang[3][3], to_tang[3][3];
161 st0 =
data->mloopuv[
data->mlooptri[
data->tri_index].tri[0]].uv;
162 st1 =
data->mloopuv[
data->mlooptri[
data->tri_index].tri[1]].uv;
163 st2 =
data->mloopuv[
data->mlooptri[
data->tri_index].tri[2]].uv;
175 if (
data->pvtangent) {
176 tang0 =
data->pvtangent +
data->mlooptri[
data->tri_index].tri[0] * 4;
177 tang1 =
data->pvtangent +
data->mlooptri[
data->tri_index].tri[1] * 4;
178 tang2 =
data->pvtangent +
data->mlooptri[
data->tri_index].tri[2] * 4;
182 sign = (tang0[3] * u + tang1[3] *
v + tang2[3] *
w) < 0 ? (-1.0f) : 1.0f;
186 for (
r = 0;
r < 3;
r++) {
187 from_tang[0][
r] = tang0[
r] * u + tang1[
r] *
v + tang2[
r] *
w;
188 from_tang[2][
r] = no0[
r] * u + no1[
r] *
v + no2[
r] *
w;
214 const int w = bake_rast->
w;
215 const int h = bake_rast->
h;
217 if (
x >= 0 && x < w && y >= 0 &&
y < h) {
218 if ((bake_rast->
texels[
y *
w +
x]) == 0) {
239 const int is_mid_right)
241 const int s_stable =
fabsf(t1_s - t0_s) > FLT_EPSILON ? 1 : 0;
242 const int l_stable =
fabsf(t1_l - t0_l) > FLT_EPSILON ? 1 : 0;
243 const int w = bake_rast->
w;
244 const int h = bake_rast->
h;
247 if (y1_in <= 0 || y0_in >= h) {
251 y0 = y0_in < 0 ? 0 : y0_in;
252 y1 = y1_in >= h ? h : y1_in;
254 for (
y = y0;
y <
y1;
y++) {
257 float x_l = s_stable != 0 ? (s0_s + (((s1_s - s0_s) * (
y - t0_s)) / (t1_s - t0_s))) : s0_s;
258 float x_r = l_stable != 0 ? (s0_l + (((s1_l - s0_l) * (
y - t0_l)) / (t1_l - t0_l))) : s0_l;
260 if (is_mid_right != 0) {
261 SWAP(
float, x_l, x_r);
264 iXl = (int)
ceilf(x_l);
265 iXr = (int)
ceilf(x_r);
267 if (iXr > 0 && iXl <
w) {
268 iXl = iXl < 0 ? 0 : iXl;
269 iXr = iXr >=
w ?
w : iXr;
271 for (
x = iXl;
x < iXr;
x++) {
279 const float st0_in[2],
280 const float st1_in[2],
281 const float st2_in[2])
283 const int w = bake_rast->
w;
284 const int h = bake_rast->
h;
285 float slo = st0_in[0] *
w - 0.5f;
286 float tlo = st0_in[1] * h - 0.5f;
287 float smi = st1_in[0] *
w - 0.5f;
288 float tmi = st1_in[1] * h - 0.5f;
289 float shi = st2_in[0] *
w - 0.5f;
290 float thi = st2_in[1] * h - 0.5f;
291 int is_mid_right = 0, ylo, yhi, yhi_beg;
294 if ((slo == smi && tlo == tmi) || (slo == shi && tlo == thi) || (smi == shi && tmi == thi)) {
299 if (tlo > tmi && tlo > thi) {
300 SWAP(
float, shi, slo);
301 SWAP(
float, thi, tlo);
303 else if (tmi > thi) {
304 SWAP(
float, shi, smi);
305 SWAP(
float, thi, tmi);
309 SWAP(
float, slo, smi);
310 SWAP(
float, tlo, tmi);
314 is_mid_right = (-(shi - slo) * (tmi - thi) + (thi - tlo) * (smi - shi)) > 0 ? 1 : 0;
315 ylo = (int)
ceilf(tlo);
316 yhi_beg = (int)
ceilf(tmi);
317 yhi = (int)
ceilf(thi);
320 rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right);
321 rasterize_half(bake_rast, smi, tmi, shi, thi, slo, tlo, shi, thi, yhi_beg, yhi, is_mid_right);
331 return *bkr->
stop ||
G.is_break;
367 face =
queue->cur_tri;
386 const short mat_nr = mp->
mat_nr;
394 if (tri_image != handle->
image) {
398 data->tri_index = tri_index;
408 if (
data->ibuf->rect_float) {
442 const int *grid_offset;
458 bool require_tangent,
466 const int lvl = bkr->
lvl;
479 float *pvtangent =
NULL;
484 void *bake_data =
NULL;
495 if (require_tangent) {
523 bake_data = initBakeData(bkr, ibuf);
526 if (tot_thread > 1) {
536 queue.tot_tri = tot_tri;
540 for (i = 0; i < tot_thread; i++) {
571 if (tot_thread > 1) {
577 if (tot_thread > 1) {
584 for (i = 0; i < tot_thread; i++) {
593 freeBakeData(bake_data);
604 CCGKey *key,
CCGElem *grid,
float crn_x,
float crn_y,
int mode,
float res[3])
637 const int *index_mp_to_orig,
648 int grid_size, S, face_side;
649 int *grid_offset, g_index;
650 int poly_index = lt->
poly;
659 face_side = (grid_size << 1) - 1;
662 g_index = grid_offset[poly_index];
675 int polys_per_grid_side = (1 << (lvl - 1));
677 int cage_face_index = index_mp_to_orig ? index_mp_to_orig[poly_index] : poly_index;
680 int loc_cage_poly_ofs = poly_index % (1 << (2 * lvl));
682 int cell_index = loc_cage_poly_ofs % (polys_per_grid_side * polys_per_grid_side);
683 int cell_side = (grid_size - 1) / polys_per_grid_side;
685 int row = cell_index / polys_per_grid_side;
686 int col = cell_index % polys_per_grid_side;
689 S = poly_index / (1 << (2 * (lvl - 1))) - grid_offset[cage_face_index];
691 g_index = grid_offset[cage_face_index];
693 crn_y = (row * cell_side) + u * cell_side;
694 crn_x = (
col * cell_side) +
v * cell_side;
697 CLAMP(crn_x, 0.0f, grid_size);
698 CLAMP(crn_y, 0.0f, grid_size);
772 "MultiresBake heights");
798 return (
void *)height_data;
805 if (height_data->
ssdm) {
826 float UNUSED(tangmat[3][3]),
836 float uv[2], *st0, *st1, *st2, *st3;
837 int pixel = ibuf->
x *
y +
x;
838 float vec[3], p0[3], p1[3], n[3],
len;
850 st0 = mloopuv[lt->
tri[0]].
uv;
851 st1 = mloopuv[lt->
tri[1]].
uv;
852 st2 = mloopuv[lt->
tri[2]].
uv;
861 if (height_data->
ssdm) {
893 rrgbf[0] = rrgbf[1] = rrgbf[2] =
len;
897 char *rrgb = (
char *)ibuf->
rect + pixel * 4;
914 return (
void *)normal_data;
934 void *
UNUSED(thread_data),
948 float uv[2], *st0, *st1, *st2, *st3;
949 int pixel = ibuf->
x *
y +
x;
950 float n[3], vec[3], tmp[3] = {0.5, 0.5, 0.5};
962 st0 = mloopuv[lt->
tri[0]].
uv;
963 st1 = mloopuv[lt->
tri[1]].
uv;
964 st2 = mloopuv[lt->
tri[2]].
uv;
985 unsigned char *rrgb = (
unsigned char *)ibuf->
rect + pixel * 4;
996 # define MAX_NUMBER_OF_AO_RAYS 1024
998 static unsigned short ao_random_table_1[MAX_NUMBER_OF_AO_RAYS];
999 static unsigned short ao_random_table_2[MAX_NUMBER_OF_AO_RAYS];
1001 static void init_ao_random(
void)
1005 for (i = 0; i < MAX_NUMBER_OF_AO_RAYS; i++) {
1006 ao_random_table_1[i] = rand() & 0xffff;
1007 ao_random_table_2[i] = rand() & 0xffff;
1011 static unsigned short get_ao_random1(
const int i)
1013 return ao_random_table_1[i & (MAX_NUMBER_OF_AO_RAYS - 1)];
1016 static unsigned short get_ao_random2(
const int i)
1018 return ao_random_table_2[i & (MAX_NUMBER_OF_AO_RAYS - 1)];
1021 static void build_permutation_table(
unsigned short permutation[],
1022 unsigned short temp_permutation[],
1023 const int number_of_rays,
1024 const int is_first_perm_table)
1028 for (i = 0; i < number_of_rays; i++) {
1029 temp_permutation[i] = i;
1032 for (i = 0; i < number_of_rays; i++) {
1033 const unsigned int nr_entries_left = number_of_rays - i;
1034 unsigned short rnd = is_first_perm_table !=
false ? get_ao_random1(i) : get_ao_random2(i);
1035 const unsigned short entry = rnd % nr_entries_left;
1038 permutation[i] = temp_permutation[entry];
1041 for (k = entry; k < nr_entries_left - 1; k++) {
1042 temp_permutation[k] = temp_permutation[k + 1];
1050 for (i = 0; i < number_of_rays; i++) temp_permutation[i] = 0;
1051 for (i = 0; i < number_of_rays; i++) ++temp_permutation[permutation[i]];
1052 for (i = 0; i < number_of_rays; i++)
BLI_assert(temp_permutation[i] == 1);
1063 int grids_num, grid_size , faces_num;
1072 faces_num = grids_num * (grid_size - 1) * (grid_size - 1);
1074 raytree = ao_data->raytree = RE_rayobject_create(
1076 face = ao_data->rayfaces = (RayFace *)
MEM_callocN(faces_num *
sizeof(RayFace),
1079 for (i = 0; i < grids_num; i++) {
1081 for (
x = 0;
x < grid_size - 1;
x++) {
1082 for (
y = 0;
y < grid_size - 1;
y++) {
1090 RE_rayface_from_coords(face, ao_data, face, co[0], co[1], co[2], co[3]);
1091 RE_rayobject_add(raytree, RE_rayobject_unalignRayFace(face));
1098 RE_rayobject_done(raytree);
1103 MAOBakeData *ao_data;
1105 unsigned short *temp_permutation_table;
1106 size_t permutation_size;
1110 ao_data =
MEM_callocN(
sizeof(MAOBakeData),
"MultiresBake aoData");
1113 ao_data->bias = bkr->
bias;
1117 create_ao_raytree(bkr, ao_data);
1121 ao_data->permutation_table_1 =
MEM_callocN(permutation_size,
"multires AO baker perm1");
1122 ao_data->permutation_table_2 =
MEM_callocN(permutation_size,
"multires AO baker perm2");
1123 temp_permutation_table =
MEM_callocN(permutation_size,
"multires AO baker temp perm");
1125 build_permutation_table(
1126 ao_data->permutation_table_1, temp_permutation_table, bkr->
number_of_rays, 1);
1127 build_permutation_table(
1128 ao_data->permutation_table_2, temp_permutation_table, bkr->
number_of_rays, 0);
1132 return (
void *)ao_data;
1135 static void free_ao_data(
void *bake_data)
1137 MAOBakeData *ao_data = (MAOBakeData *)bake_data;
1139 RE_rayobject_free(ao_data->raytree);
1142 MEM_freeN(ao_data->permutation_table_1);
1143 MEM_freeN(ao_data->permutation_table_2);
1149 static void build_coordinate_frame(
float axisX[3],
float axisY[3],
const float axisZ[3])
1151 const float faX =
fabsf(axisZ[0]);
1152 const float faY =
fabsf(axisZ[1]);
1153 const float faZ =
fabsf(axisZ[2]);
1155 if (faX <= faY && faX <= faZ) {
1156 const float len =
sqrtf(axisZ[1] * axisZ[1] + axisZ[2] * axisZ[2]);
1158 axisY[1] = axisZ[2] /
len;
1159 axisY[2] = -axisZ[1] /
len;
1162 else if (faY <= faZ) {
1163 const float len =
sqrtf(axisZ[0] * axisZ[0] + axisZ[2] * axisZ[2]);
1164 axisX[0] = axisZ[2] /
len;
1166 axisX[2] = -axisZ[0] /
len;
1170 const float len =
sqrtf(axisZ[0] * axisZ[0] + axisZ[1] * axisZ[1]);
1171 axisX[0] = axisZ[1] /
len;
1172 axisX[1] = -axisZ[0] /
len;
1179 static int trace_ao_ray(MAOBakeData *ao_data,
float ray_start[3],
float ray_direction[3])
1181 Isect isect = {{0}};
1183 isect.dist = RE_RAYTRACE_MAXDIST;
1190 return RE_rayobject_raycast(ao_data->raytree, &isect);
1193 static void apply_ao_callback(
DerivedMesh *lores_dm,
1195 void *
UNUSED(thread_data),
1198 const int tri_index,
1201 float UNUSED(tangmat[3][3]),
1208 MAOBakeData *ao_data = (MAOBakeData *)bake_data;
1211 float pos[3], nrm[3];
1213 float axisX[3], axisY[3], axisZ[3];
1216 int pixel = ibuf->
x *
y +
x;
1217 float uv[2], *st0, *st1, *st2, *st3;
1229 st0 = mloopuv[lt->
tri[0]].
uv;
1230 st1 = mloopuv[lt->
tri[1]].
uv;
1231 st2 = mloopuv[lt->
tri[2]].
uv;
1238 lores_dm, hires_dm, ao_data->orig_index_mp_to_orig, lvl, lt, uv[0], uv[1],
pos, nrm);
1241 for (i = 0; i < 3; i++) {
1242 cen[i] =
pos[i] + ao_data->bias * nrm[i];
1246 for (i = 0; i < 3; i++) {
1250 build_coordinate_frame(axisX, axisY, axisZ);
1253 perm_ofs = (get_ao_random2(get_ao_random1(
x) +
y)) & (MAX_NUMBER_OF_AO_RAYS - 1);
1256 for (i = 0; i < ao_data->number_of_rays; i++) {
1262 const unsigned short I =
1263 ao_data->permutation_table_1[(i + perm_ofs) % ao_data->number_of_rays];
1264 const unsigned short J = ao_data->permutation_table_2[i];
1266 const float JitPh = (get_ao_random2(
I + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
1267 ((
float)MAX_NUMBER_OF_AO_RAYS);
1268 const float JitTh = (get_ao_random1(J + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
1269 ((
float)MAX_NUMBER_OF_AO_RAYS);
1270 const float SiSqPhi = (
I + JitPh) / ao_data->number_of_rays;
1271 const float Theta = (
float)(2 *
M_PI) * ((J + JitTh) / ao_data->number_of_rays);
1276 float SiPhi =
sqrtf(SiSqPhi);
1277 float CoPhi = SiSqPhi < 1.0f ?
sqrtf(1.0f - SiSqPhi) : 0;
1278 float CoThe =
cosf(Theta);
1279 float SiThe =
sinf(Theta);
1281 const float dx = CoThe * CoPhi;
1282 const float dy = SiThe * CoPhi;
1283 const float dz = SiPhi;
1287 for (k = 0; k < 3; k++) {
1288 dv[k] = axisX[k] * dx + axisY[k] * dy + axisZ[k] * dz;
1291 hit_something = trace_ao_ray(ao_data, cen, dv);
1293 if (hit_something != 0) {
1298 value = 1.0f - (shadow / ao_data->number_of_rays);
1302 rrgbf[0] = rrgbf[1] = rrgbf[2] = value;
1306 unsigned char *rrgb = (
unsigned char *)ibuf->
rect + pixel * 4;
1318 const char margin_type,
1320 const float uv_offset[2])
1326 switch (margin_type) {
1351 const float *displacement,
1353 float displacement_min,
1354 float displacement_max)
1357 const float *current_displacement = displacement;
1358 const char *current_mask =
mask;
1363 for (i = 0; i < ibuf->
x * ibuf->
y; i++) {
1365 float normalized_displacement;
1367 if (max_distance > 1e-5f) {
1368 normalized_displacement = (*current_displacement + max_distance) / (max_distance * 2);
1371 normalized_displacement = 0.5f;
1377 fp[0] = fp[1] = fp[2] = normalized_displacement;
1382 unsigned char *cp = (
unsigned char *)(ibuf->
rect + i);
1388 current_displacement++;
1432 result->height_min = FLT_MAX;
1433 result->height_max = -FLT_MAX;
1445 if (ibuf->
x > 0 && ibuf->
y > 0) {
1447 "MultiresBake userdata");
1451 switch (bkr->
mode) {
1506 if (ibuf->
x <= 0 || ibuf->
y <= 0) {
1510 if (use_displacement_buffer) {
typedef float(TangentPoint)[2]
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)
void BKE_image_get_tile_uv(const struct Image *ima, const int tile_number, float r_uv[2])
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)
void BKE_imageuser_default(struct ImageUser *iuser)
void BKE_id_free(struct Main *bmain, void *idv)
General operations, lookup, etc. for materials.
const float(* BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
struct Mesh * BKE_mesh_new_nomain(int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_no[3])
void BKE_mesh_calc_loop_tangent_ex(const struct MVert *mvert, const struct MPoly *mpoly, uint mpoly_len, const struct MLoop *mloop, const struct MLoopTri *looptri, uint looptri_len, struct CustomData *loopdata, bool calc_active_tangent, const char(*tangent_names)[64], int tangent_names_len, const float(*vert_normals)[3], const float(*poly_normals)[3], const float(*loop_normals)[3], const float(*vert_orco)[3], struct CustomData *loopdata_out, uint loopdata_out_len, short *tangent_mask_curr_p)
int mdisp_rot_face_to_crn(struct MVert *mvert, struct MPoly *mpoly, struct MLoop *mloop, const struct MLoopTri *lt, int face_side, float u, 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)
#define LISTBASE_FOREACH(type, var, list)
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 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], float min, float max)
MINLINE float normalize_v3_length(float r[3], float unit_scale)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
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_rectfill_alpha(struct ImBuf *ibuf, float value)
void imb_freemipmapImBuf(struct ImBuf *ibuf)
void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
Contains defines and structs used throughout the imbuf module.
@ IB_DISPLAY_BUFFER_INVALID
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
#define RE_BAKE_DISPLACEMENT
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SyclQueue void void size_t num_bytes void
ccl_global const KernelWorkTile * tile
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static void * init_normal_data(MultiresBakeRender *bkr, ImBuf *UNUSED(ibuf))
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)
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)
void *(* MInitBakeData)(MultiresBakeRender *bkr, ImBuf *ibuf)
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, const int tri_num, const int vert_index, float r_normal[3])
static void init_ccgdm_arrays(DerivedMesh *dm)
static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int y)
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 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)
static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
static void bake_ibuf_filter(ImBuf *ibuf, char *mask, const int margin, const char margin_type, DerivedMesh *dm, const float uv_offset[2])
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 do_multires_bake(MultiresBakeRender *bkr, Image *ima, ImageTile *tile, ImBuf *ibuf, bool require_tangent, MPassKnownData passKnownData, MInitBakeData initBakeData, MFreeBakeData freeBakeData, MultiresBakeResult *result)
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 * init_heights_data(MultiresBakeRender *bkr, ImBuf *ibuf)
static void * do_multires_bake_thread(void *data_v)
ListBase threads
list of all thread for every CPUDevice in cpudevices a thread exists.
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
float * displacement_buffer
int(* getGridSize)(DerivedMesh *dm)
struct MLoop *(* getLoopArray)(DerivedMesh *dm)
void(* getVertNo)(DerivedMesh *dm, int index, float r_no[3])
void *(* getVertDataArray)(DerivedMesh *dm, int type)
struct MVert *(* getVertArray)(DerivedMesh *dm)
int(* getNumVerts)(DerivedMesh *dm)
const struct MLoopTri *(* getLoopTriArray)(DerivedMesh *dm)
int(* getNumLoopTri)(DerivedMesh *dm)
int(* getNumPolys)(DerivedMesh *dm)
int(* getNumEdges)(DerivedMesh *dm)
struct CCGElem **(* getGridData)(DerivedMesh *dm)
void *(* getLoopDataArray)(DerivedMesh *dm, int type)
int(* getNumGrids)(DerivedMesh *dm)
void *(* getPolyDataArray)(DerivedMesh *dm, int type)
struct MEdge *(* getEdgeArray)(DerivedMesh *dm)
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(* getNumLoops)(DerivedMesh *dm)
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)[3]
const MLoopTri * mlooptri
const float(* vert_normals)[3]
struct MultiresBakeRender::@1173 ob_image
MultiresBakeQueue * queue
void RE_generate_texturemargin_adjacentfaces_dm(ImBuf *ibuf, char *mask, const int margin, DerivedMesh *dm, const float uv_offset[2])