Cleanup: use "num" as a suffix in: source/blender/render
See T85728
This commit is contained in:
parent
83c274ccfc
commit
556384ca1d
|
@ -180,7 +180,7 @@ static bool write_internal_bake_pixels(Image *image,
|
|||
void *lock;
|
||||
bool is_float;
|
||||
char *mask_buffer = NULL;
|
||||
const size_t num_pixels = (size_t)width * (size_t)height;
|
||||
const size_t pixels_num = (size_t)width * (size_t)height;
|
||||
|
||||
ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
|
||||
|
||||
|
@ -189,8 +189,8 @@ static bool write_internal_bake_pixels(Image *image,
|
|||
}
|
||||
|
||||
if (margin > 0 || !is_clear) {
|
||||
mask_buffer = MEM_callocN(sizeof(char) * num_pixels, "Bake Mask");
|
||||
RE_bake_mask_fill(pixel_array, num_pixels, mask_buffer);
|
||||
mask_buffer = MEM_callocN(sizeof(char) * pixels_num, "Bake Mask");
|
||||
RE_bake_mask_fill(pixel_array, pixels_num, mask_buffer);
|
||||
}
|
||||
|
||||
is_float = (ibuf->rect_float != NULL);
|
||||
|
@ -298,7 +298,7 @@ static bool write_internal_bake_pixels(Image *image,
|
|||
/* force OpenGL reload */
|
||||
static void bake_targets_refresh(BakeTargets *targets)
|
||||
{
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
Image *ima = targets->images[i].image;
|
||||
|
||||
if (ima) {
|
||||
|
@ -374,10 +374,10 @@ static bool write_external_bake_pixels(const char *filepath,
|
|||
/* margins */
|
||||
if (margin > 0) {
|
||||
char *mask_buffer = NULL;
|
||||
const size_t num_pixels = (size_t)width * (size_t)height;
|
||||
const size_t pixels_num = (size_t)width * (size_t)height;
|
||||
|
||||
mask_buffer = MEM_callocN(sizeof(char) * num_pixels, "Bake Mask");
|
||||
RE_bake_mask_fill(pixel_array, num_pixels, mask_buffer);
|
||||
mask_buffer = MEM_callocN(sizeof(char) * pixels_num, "Bake Mask");
|
||||
RE_bake_mask_fill(pixel_array, pixels_num, mask_buffer);
|
||||
RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer);
|
||||
|
||||
if (mask_buffer) {
|
||||
|
@ -670,9 +670,9 @@ static bool bake_targets_init_image_textures(const BakeAPIRender *bkr,
|
|||
Object *ob,
|
||||
ReportList *reports)
|
||||
{
|
||||
int num_materials = ob->totcol;
|
||||
int materials_num = ob->totcol;
|
||||
|
||||
if (num_materials == 0) {
|
||||
if (materials_num == 0) {
|
||||
if (bkr->save_mode == R_BAKE_SAVE_INTERNAL) {
|
||||
BKE_report(
|
||||
reports, RPT_ERROR, "No active image found, add a material or bake to an external file");
|
||||
|
@ -688,15 +688,15 @@ static bool bake_targets_init_image_textures(const BakeAPIRender *bkr,
|
|||
}
|
||||
|
||||
/* Over-allocate in case there is more materials than images. */
|
||||
targets->num_materials = num_materials;
|
||||
targets->images = MEM_callocN(sizeof(BakeImage) * targets->num_materials, "BakeTargets.images");
|
||||
targets->material_to_image = MEM_callocN(sizeof(int) * targets->num_materials,
|
||||
targets->materials_num = materials_num;
|
||||
targets->images = MEM_callocN(sizeof(BakeImage) * targets->materials_num, "BakeTargets.images");
|
||||
targets->material_to_image = MEM_callocN(sizeof(int) * targets->materials_num,
|
||||
"BakeTargets.material_to_image");
|
||||
|
||||
/* Error handling and tag (in case multiple materials share the same image). */
|
||||
BKE_main_id_tag_idcode(bkr->main, ID_IM, LIB_TAG_DOIT, false);
|
||||
|
||||
for (int i = 0; i < num_materials; i++) {
|
||||
for (int i = 0; i < materials_num; i++) {
|
||||
Image *image;
|
||||
ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
|
||||
|
||||
|
@ -713,10 +713,10 @@ static bool bake_targets_init_image_textures(const BakeAPIRender *bkr,
|
|||
}
|
||||
}
|
||||
else {
|
||||
targets->material_to_image[i] = targets->num_images;
|
||||
targets->images[targets->num_images].image = image;
|
||||
targets->material_to_image[i] = targets->images_num;
|
||||
targets->images[targets->images_num].image = image;
|
||||
image->id.tag |= LIB_TAG_DOIT;
|
||||
targets->num_images++;
|
||||
targets->images_num++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -733,7 +733,7 @@ static bool bake_targets_init_internal(const BakeAPIRender *bkr,
|
|||
}
|
||||
|
||||
/* Saving to image datablocks. */
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
BakeImage *bk_image = &targets->images[i];
|
||||
void *lock;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(bk_image->image, NULL, &lock);
|
||||
|
@ -741,9 +741,9 @@ static bool bake_targets_init_internal(const BakeAPIRender *bkr,
|
|||
if (ibuf) {
|
||||
bk_image->width = ibuf->x;
|
||||
bk_image->height = ibuf->y;
|
||||
bk_image->offset = targets->num_pixels;
|
||||
bk_image->offset = targets->pixels_num;
|
||||
|
||||
targets->num_pixels += (size_t)ibuf->x * (size_t)ibuf->y;
|
||||
targets->pixels_num += (size_t)ibuf->x * (size_t)ibuf->y;
|
||||
}
|
||||
else {
|
||||
BKE_image_release_ibuf(bk_image->image, ibuf, lock);
|
||||
|
@ -765,12 +765,12 @@ static bool bake_targets_output_internal(const BakeAPIRender *bkr,
|
|||
{
|
||||
bool all_ok = true;
|
||||
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
BakeImage *bk_image = &targets->images[i];
|
||||
const bool ok = write_internal_bake_pixels(bk_image->image,
|
||||
pixel_array + bk_image->offset,
|
||||
targets->result +
|
||||
bk_image->offset * targets->num_channels,
|
||||
bk_image->offset * targets->channels_num,
|
||||
bk_image->width,
|
||||
bk_image->height,
|
||||
bkr->margin,
|
||||
|
@ -809,15 +809,15 @@ static bool bake_targets_init_external(const BakeAPIRender *bkr,
|
|||
}
|
||||
|
||||
/* Saving to disk. */
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
BakeImage *bk_image = &targets->images[i];
|
||||
|
||||
bk_image->width = bkr->width;
|
||||
bk_image->height = bkr->height;
|
||||
bk_image->offset = targets->num_pixels;
|
||||
bk_image->offset = targets->pixels_num;
|
||||
bk_image->image = NULL;
|
||||
|
||||
targets->num_pixels += (size_t)bkr->width * (size_t)bkr->height;
|
||||
targets->pixels_num += (size_t)bkr->width * (size_t)bkr->height;
|
||||
|
||||
if (!bkr->is_split_materials) {
|
||||
break;
|
||||
|
@ -826,7 +826,7 @@ static bool bake_targets_init_external(const BakeAPIRender *bkr,
|
|||
|
||||
if (!bkr->is_split_materials) {
|
||||
/* saving a single image */
|
||||
for (int i = 0; i < targets->num_materials; i++) {
|
||||
for (int i = 0; i < targets->materials_num; i++) {
|
||||
targets->material_to_image[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ static bool bake_targets_output_external(const BakeAPIRender *bkr,
|
|||
{
|
||||
bool all_ok = true;
|
||||
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
BakeImage *bk_image = &targets->images[i];
|
||||
|
||||
BakeData *bake = &bkr->scene->r.bake;
|
||||
|
@ -888,7 +888,7 @@ static bool bake_targets_output_external(const BakeAPIRender *bkr,
|
|||
const bool ok = write_external_bake_pixels(name,
|
||||
pixel_array + bk_image->offset,
|
||||
targets->result +
|
||||
bk_image->offset * targets->num_channels,
|
||||
bk_image->offset * targets->channels_num,
|
||||
bk_image->width,
|
||||
bk_image->height,
|
||||
bkr->margin,
|
||||
|
@ -934,11 +934,11 @@ static bool bake_targets_init_vertex_colors(BakeTargets *targets, Object *ob, Re
|
|||
}
|
||||
|
||||
targets->images = MEM_callocN(sizeof(BakeImage), "BakeTargets.images");
|
||||
targets->num_images = 1;
|
||||
targets->images_num = 1;
|
||||
|
||||
targets->material_to_image = MEM_callocN(sizeof(int) * ob->totcol,
|
||||
"BakeTargets.material_to_image");
|
||||
targets->num_materials = ob->totcol;
|
||||
targets->materials_num = ob->totcol;
|
||||
|
||||
BakeImage *bk_image = &targets->images[0];
|
||||
bk_image->width = me->totloop;
|
||||
|
@ -946,7 +946,7 @@ static bool bake_targets_init_vertex_colors(BakeTargets *targets, Object *ob, Re
|
|||
bk_image->offset = 0;
|
||||
bk_image->image = NULL;
|
||||
|
||||
targets->num_pixels = bk_image->width * bk_image->height;
|
||||
targets->pixels_num = bk_image->width * bk_image->height;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -984,10 +984,10 @@ static void bake_targets_populate_pixels_vertex_colors(BakeTargets *targets,
|
|||
BakePixel *pixel_array)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
const int num_pixels = targets->num_pixels;
|
||||
const int pixels_num = targets->pixels_num;
|
||||
|
||||
/* Initialize blank pixels. */
|
||||
for (int i = 0; i < num_pixels; i++) {
|
||||
for (int i = 0; i < pixels_num; i++) {
|
||||
BakePixel *pixel = &pixel_array[i];
|
||||
|
||||
pixel->primitive_id = -1;
|
||||
|
@ -1059,12 +1059,12 @@ static void bake_targets_populate_pixels_vertex_colors(BakeTargets *targets,
|
|||
MEM_freeN(looptri);
|
||||
}
|
||||
|
||||
static void bake_result_add_to_rgba(float rgba[4], const float *result, const int num_channels)
|
||||
static void bake_result_add_to_rgba(float rgba[4], const float *result, const int channels_num)
|
||||
{
|
||||
if (num_channels == 4) {
|
||||
if (channels_num == 4) {
|
||||
add_v4_v4(rgba, result);
|
||||
}
|
||||
else if (num_channels == 3) {
|
||||
else if (channels_num == 3) {
|
||||
add_v3_v3(rgba, result);
|
||||
rgba[3] += 1.0f;
|
||||
}
|
||||
|
@ -1082,7 +1082,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
|
|||
MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
|
||||
const bool mcol_valid = (mcol != NULL && U.experimental.use_sculpt_vertex_colors);
|
||||
MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL);
|
||||
const int num_channels = targets->num_channels;
|
||||
const int channels_num = targets->channels_num;
|
||||
const float *result = targets->result;
|
||||
|
||||
if (mcol_valid) {
|
||||
|
@ -1096,7 +1096,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
|
|||
MLoop *mloop = me->mloop;
|
||||
for (int i = 0; i < totloop; i++, mloop++) {
|
||||
const int v = mloop->v;
|
||||
bake_result_add_to_rgba(mcol[v].color, &result[i * num_channels], num_channels);
|
||||
bake_result_add_to_rgba(mcol[v].color, &result[i * channels_num], channels_num);
|
||||
num_loops_for_vertex[v]++;
|
||||
}
|
||||
|
||||
|
@ -1118,7 +1118,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
|
|||
for (int i = 0; i < totloop; i++, mloop++, mloopcol++) {
|
||||
float rgba[4];
|
||||
zero_v4(rgba);
|
||||
bake_result_add_to_rgba(rgba, &result[i * num_channels], num_channels);
|
||||
bake_result_add_to_rgba(rgba, &result[i * channels_num], channels_num);
|
||||
|
||||
if (is_noncolor) {
|
||||
unit_float_to_uchar_clamp_v4(&mloopcol->r, rgba);
|
||||
|
@ -1160,13 +1160,13 @@ static bool bake_targets_init(const BakeAPIRender *bkr,
|
|||
}
|
||||
}
|
||||
|
||||
if (targets->num_pixels == 0) {
|
||||
if (targets->pixels_num == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
targets->is_noncolor = is_noncolor_pass(bkr->pass_type);
|
||||
targets->num_channels = RE_pass_depth(bkr->pass_type);
|
||||
targets->result = MEM_callocN(sizeof(float) * targets->num_channels * targets->num_pixels,
|
||||
targets->channels_num = RE_pass_depth(bkr->pass_type);
|
||||
targets->result = MEM_callocN(sizeof(float) * targets->channels_num * targets->pixels_num,
|
||||
"bake return pixels");
|
||||
|
||||
return true;
|
||||
|
@ -1182,7 +1182,7 @@ static void bake_targets_populate_pixels(const BakeAPIRender *bkr,
|
|||
bake_targets_populate_pixels_vertex_colors(targets, ob, me_eval, pixel_array);
|
||||
}
|
||||
else {
|
||||
RE_bake_pixels_populate(me_eval, pixel_array, targets->num_pixels, targets, bkr->uv_layer);
|
||||
RE_bake_pixels_populate(me_eval, pixel_array, targets->pixels_num, targets, bkr->uv_layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1329,7 +1329,7 @@ static int bake(const BakeAPIRender *bkr,
|
|||
|
||||
/* Populate the pixel array with the face data. Except if we use a cage, then
|
||||
* it is populated later with the cage mesh (smoothed version of the mesh). */
|
||||
pixel_array_low = MEM_mallocN(sizeof(BakePixel) * targets.num_pixels, "bake pixels low poly");
|
||||
pixel_array_low = MEM_mallocN(sizeof(BakePixel) * targets.pixels_num, "bake pixels low poly");
|
||||
if ((bkr->is_selected_to_active && (ob_cage == NULL) && bkr->is_cage) == false) {
|
||||
bake_targets_populate_pixels(bkr, &targets, ob_low, me_low_eval, pixel_array_low);
|
||||
}
|
||||
|
@ -1422,7 +1422,7 @@ static int bake(const BakeAPIRender *bkr,
|
|||
ob_low_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER);
|
||||
|
||||
/* populate the pixel arrays with the corresponding face data for each high poly object */
|
||||
pixel_array_high = MEM_mallocN(sizeof(BakePixel) * targets.num_pixels,
|
||||
pixel_array_high = MEM_mallocN(sizeof(BakePixel) * targets.pixels_num,
|
||||
"bake pixels high poly");
|
||||
|
||||
if (!RE_bake_pixels_populate_from_objects(me_low_eval,
|
||||
|
@ -1430,7 +1430,7 @@ static int bake(const BakeAPIRender *bkr,
|
|||
pixel_array_high,
|
||||
highpoly,
|
||||
tot_highpoly,
|
||||
targets.num_pixels,
|
||||
targets.pixels_num,
|
||||
ob_cage != NULL,
|
||||
bkr->cage_extrusion,
|
||||
bkr->max_ray_distance,
|
||||
|
@ -1491,16 +1491,16 @@ static int bake(const BakeAPIRender *bkr,
|
|||
break;
|
||||
}
|
||||
RE_bake_normal_world_to_world(pixel_array_low,
|
||||
targets.num_pixels,
|
||||
targets.num_channels,
|
||||
targets.pixels_num,
|
||||
targets.channels_num,
|
||||
targets.result,
|
||||
bkr->normal_swizzle);
|
||||
break;
|
||||
}
|
||||
case R_BAKE_SPACE_OBJECT: {
|
||||
RE_bake_normal_world_to_object(pixel_array_low,
|
||||
targets.num_pixels,
|
||||
targets.num_channels,
|
||||
targets.pixels_num,
|
||||
targets.channels_num,
|
||||
targets.result,
|
||||
ob_low_eval,
|
||||
bkr->normal_swizzle);
|
||||
|
@ -1509,8 +1509,8 @@ static int bake(const BakeAPIRender *bkr,
|
|||
case R_BAKE_SPACE_TANGENT: {
|
||||
if (bkr->is_selected_to_active) {
|
||||
RE_bake_normal_world_to_tangent(pixel_array_low,
|
||||
targets.num_pixels,
|
||||
targets.num_channels,
|
||||
targets.pixels_num,
|
||||
targets.channels_num,
|
||||
targets.result,
|
||||
me_low_eval,
|
||||
bkr->normal_swizzle,
|
||||
|
@ -1535,8 +1535,8 @@ static int bake(const BakeAPIRender *bkr,
|
|||
}
|
||||
|
||||
RE_bake_normal_world_to_tangent(pixel_array_low,
|
||||
targets.num_pixels,
|
||||
targets.num_channels,
|
||||
targets.pixels_num,
|
||||
targets.channels_num,
|
||||
targets.result,
|
||||
(me_nores) ? me_nores : me_low_eval,
|
||||
bkr->normal_swizzle,
|
||||
|
|
|
@ -27,16 +27,16 @@ typedef struct BakeImage {
|
|||
typedef struct BakeTargets {
|
||||
/* All images of the object. */
|
||||
BakeImage *images;
|
||||
int num_images;
|
||||
int images_num;
|
||||
|
||||
/* Lookup table from Material number to BakeImage. */
|
||||
int *material_to_image;
|
||||
int num_materials;
|
||||
int materials_num;
|
||||
|
||||
/* Pixel buffer to bake to. */
|
||||
float *result;
|
||||
int num_pixels;
|
||||
int num_channels;
|
||||
int pixels_num;
|
||||
int channels_num;
|
||||
|
||||
/* Baking to non-color data image. */
|
||||
bool is_noncolor;
|
||||
|
@ -81,7 +81,7 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
|
|||
BakePixel pixel_array_to[],
|
||||
BakeHighPolyData highpoly[],
|
||||
int tot_highpoly,
|
||||
size_t num_pixels,
|
||||
size_t pixels_num,
|
||||
bool is_custom_cage,
|
||||
float cage_extrusion,
|
||||
float max_ray_distance,
|
||||
|
@ -91,11 +91,11 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
|
|||
|
||||
void RE_bake_pixels_populate(struct Mesh *me,
|
||||
struct BakePixel *pixel_array,
|
||||
size_t num_pixels,
|
||||
size_t pixels_num,
|
||||
const struct BakeTargets *targets,
|
||||
const char *uv_layer);
|
||||
|
||||
void RE_bake_mask_fill(const BakePixel pixel_array[], size_t num_pixels, char *mask);
|
||||
void RE_bake_mask_fill(const BakePixel pixel_array[], size_t pixels_num, char *mask);
|
||||
|
||||
void RE_bake_margin(struct ImBuf *ibuf,
|
||||
char *mask,
|
||||
|
@ -105,7 +105,7 @@ void RE_bake_margin(struct ImBuf *ibuf,
|
|||
char const *uv_layer);
|
||||
|
||||
void RE_bake_normal_world_to_object(const BakePixel pixel_array[],
|
||||
size_t num_pixels,
|
||||
size_t pixels_num,
|
||||
int depth,
|
||||
float result[],
|
||||
struct Object *ob,
|
||||
|
@ -115,14 +115,14 @@ void RE_bake_normal_world_to_object(const BakePixel pixel_array[],
|
|||
* to a tangent space normal map for a given low poly mesh.
|
||||
*/
|
||||
void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[],
|
||||
size_t num_pixels,
|
||||
size_t pixels_num,
|
||||
int depth,
|
||||
float result[],
|
||||
struct Mesh *me,
|
||||
const eBakeNormalSwizzle normal_swizzle[3],
|
||||
float mat[4][4]);
|
||||
void RE_bake_normal_world_to_world(const BakePixel pixel_array[],
|
||||
size_t num_pixels,
|
||||
size_t pixels_num,
|
||||
int depth,
|
||||
float result[],
|
||||
const eBakeNormalSwizzle normal_swizzle[3]);
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
* The Bake API is fully implemented with Python rna functions.
|
||||
* The operator expects/call a function:
|
||||
*
|
||||
* `def bake(scene, object, pass_type, object_id, pixel_array, num_pixels, depth, result)`
|
||||
* `def bake(scene, object, pass_type, object_id, pixel_array, pixels_num, depth, result)`
|
||||
* - scene: current scene (Python object)
|
||||
* - object: object to render (Python object)
|
||||
* - pass_type: pass to render (string, e.g., "COMBINED", "AO", "NORMAL", ...)
|
||||
* - object_id: index of object to bake (to use with the pixel_array)
|
||||
* - pixel_array: list of primitive ids and barycentric coordinates to
|
||||
* `bake(Python object, see bake_pixel)`.
|
||||
* - num_pixels: size of pixel_array, number of pixels to bake (int)
|
||||
* - pixels_num: size of pixel_array, number of pixels to bake (int)
|
||||
* - depth: depth of pixels to return (int, assuming always 4 now)
|
||||
* - result: array to be populated by the engine (float array, PyLong_AsVoidPtr)
|
||||
*
|
||||
|
@ -126,7 +126,7 @@ static void store_bake_pixel(void *handle, int x, int y, float u, float v)
|
|||
pixel->seed = i;
|
||||
}
|
||||
|
||||
void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask)
|
||||
void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t pixels_num, char *mask)
|
||||
{
|
||||
size_t i;
|
||||
if (!mask) {
|
||||
|
@ -134,7 +134,7 @@ void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, c
|
|||
}
|
||||
|
||||
/* only extend to pixels outside the mask area */
|
||||
for (i = 0; i < num_pixels; i++) {
|
||||
for (i = 0; i < pixels_num; i++) {
|
||||
if (pixel_array[i].primitive_id != -1) {
|
||||
mask[i] = FILTER_MASK_USED;
|
||||
}
|
||||
|
@ -539,7 +539,7 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
|
|||
BakePixel pixel_array_to[],
|
||||
BakeHighPolyData highpoly[],
|
||||
const int tot_highpoly,
|
||||
const size_t num_pixels,
|
||||
const size_t pixels_num,
|
||||
const bool is_custom_cage,
|
||||
const float cage_extrusion,
|
||||
const float max_ray_distance,
|
||||
|
@ -603,7 +603,7 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_pixels; i++) {
|
||||
for (i = 0; i < pixels_num; i++) {
|
||||
float co[3];
|
||||
float dir[3];
|
||||
TriTessFace *tri_low;
|
||||
|
@ -707,7 +707,7 @@ static void bake_differentials(BakeDataZSpan *bd,
|
|||
|
||||
void RE_bake_pixels_populate(Mesh *me,
|
||||
BakePixel pixel_array[],
|
||||
const size_t num_pixels,
|
||||
const size_t pixels_num,
|
||||
const BakeTargets *targets,
|
||||
const char *uv_layer)
|
||||
{
|
||||
|
@ -726,15 +726,15 @@ void RE_bake_pixels_populate(Mesh *me,
|
|||
|
||||
BakeDataZSpan bd;
|
||||
bd.pixel_array = pixel_array;
|
||||
bd.zspan = MEM_callocN(sizeof(ZSpan) * targets->num_images, "bake zspan");
|
||||
bd.zspan = MEM_callocN(sizeof(ZSpan) * targets->images_num, "bake zspan");
|
||||
|
||||
/* initialize all pixel arrays so we know which ones are 'blank' */
|
||||
for (int i = 0; i < num_pixels; i++) {
|
||||
for (int i = 0; i < pixels_num; i++) {
|
||||
pixel_array[i].primitive_id = -1;
|
||||
pixel_array[i].object_id = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
zbuf_alloc_span(&bd.zspan[i], targets->images[i].width, targets->images[i].height);
|
||||
}
|
||||
|
||||
|
@ -772,7 +772,7 @@ void RE_bake_pixels_populate(Mesh *me,
|
|||
zspan_scanconvert(&bd.zspan[image_id], (void *)&bd, vec[0], vec[1], vec[2], store_bake_pixel);
|
||||
}
|
||||
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
zbuf_free_span(&bd.zspan[i]);
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ static void normal_compress(float out[3],
|
|||
}
|
||||
|
||||
void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[],
|
||||
const size_t num_pixels,
|
||||
const size_t pixels_num,
|
||||
const int depth,
|
||||
float result[],
|
||||
Mesh *me,
|
||||
|
@ -838,9 +838,9 @@ void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[],
|
|||
|
||||
triangles = mesh_calc_tri_tessface(me, true, me_eval);
|
||||
|
||||
BLI_assert(num_pixels >= 3);
|
||||
BLI_assert(pixels_num >= 3);
|
||||
|
||||
for (i = 0; i < num_pixels; i++) {
|
||||
for (i = 0; i < pixels_num; i++) {
|
||||
TriTessFace *triangle;
|
||||
float tangents[3][3];
|
||||
float normals[3][3];
|
||||
|
@ -948,7 +948,7 @@ void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[],
|
|||
}
|
||||
|
||||
void RE_bake_normal_world_to_object(const BakePixel pixel_array[],
|
||||
const size_t num_pixels,
|
||||
const size_t pixels_num,
|
||||
const int depth,
|
||||
float result[],
|
||||
struct Object *ob,
|
||||
|
@ -959,7 +959,7 @@ void RE_bake_normal_world_to_object(const BakePixel pixel_array[],
|
|||
|
||||
invert_m4_m4(iobmat, ob->obmat);
|
||||
|
||||
for (i = 0; i < num_pixels; i++) {
|
||||
for (i = 0; i < pixels_num; i++) {
|
||||
size_t offset;
|
||||
float nor[3];
|
||||
|
||||
|
@ -980,14 +980,14 @@ void RE_bake_normal_world_to_object(const BakePixel pixel_array[],
|
|||
}
|
||||
|
||||
void RE_bake_normal_world_to_world(const BakePixel pixel_array[],
|
||||
const size_t num_pixels,
|
||||
const size_t pixels_num,
|
||||
const int depth,
|
||||
float result[],
|
||||
const eBakeNormalSwizzle normal_swizzle[3])
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < num_pixels; i++) {
|
||||
for (i = 0; i < pixels_num; i++) {
|
||||
size_t offset;
|
||||
float nor[3];
|
||||
|
||||
|
|
|
@ -827,14 +827,14 @@ bool RE_bake_engine(Render *re,
|
|||
type->update(engine, re->main, engine->depsgraph);
|
||||
}
|
||||
|
||||
for (int i = 0; i < targets->num_images; i++) {
|
||||
for (int i = 0; i < targets->images_num; i++) {
|
||||
const BakeImage *image = targets->images + i;
|
||||
|
||||
engine->bake.pixels = pixel_array + image->offset;
|
||||
engine->bake.result = result + image->offset * targets->num_channels;
|
||||
engine->bake.result = result + image->offset * targets->channels_num;
|
||||
engine->bake.width = image->width;
|
||||
engine->bake.height = image->height;
|
||||
engine->bake.depth = targets->num_channels;
|
||||
engine->bake.depth = targets->channels_num;
|
||||
engine->bake.object_id = object_id;
|
||||
|
||||
type->bake(
|
||||
|
|
|
@ -1061,23 +1061,23 @@ static void create_ao_raytree(MultiresBakeRender *bkr, MAOBakeData *ao_data)
|
|||
RayFace *face;
|
||||
CCGElem **grid_data;
|
||||
CCGKey key;
|
||||
int num_grids, grid_size /*, face_side */, num_faces;
|
||||
int grids_num, grid_size /*, face_side */, faces_num;
|
||||
int i;
|
||||
|
||||
num_grids = hidm->getNumGrids(hidm);
|
||||
grids_num = hidm->getNumGrids(hidm);
|
||||
grid_size = hidm->getGridSize(hidm);
|
||||
grid_data = hidm->getGridData(hidm);
|
||||
hidm->getGridKey(hidm, &key);
|
||||
|
||||
/* face_side = (grid_size << 1) - 1; */ /* UNUSED */
|
||||
num_faces = num_grids * (grid_size - 1) * (grid_size - 1);
|
||||
faces_num = grids_num * (grid_size - 1) * (grid_size - 1);
|
||||
|
||||
raytree = ao_data->raytree = RE_rayobject_create(
|
||||
bkr->raytrace_structure, num_faces, bkr->octree_resolution);
|
||||
face = ao_data->rayfaces = (RayFace *)MEM_callocN(num_faces * sizeof(RayFace),
|
||||
bkr->raytrace_structure, faces_num, bkr->octree_resolution);
|
||||
face = ao_data->rayfaces = (RayFace *)MEM_callocN(faces_num * sizeof(RayFace),
|
||||
"ObjectRen faces");
|
||||
|
||||
for (i = 0; i < num_grids; i++) {
|
||||
for (i = 0; i < grids_num; i++) {
|
||||
int x, y;
|
||||
for (x = 0; x < grid_size - 1; x++) {
|
||||
for (y = 0; y < grid_size - 1; y++) {
|
||||
|
|
Loading…
Reference in New Issue