Cleanup: style (render module)
This commit is contained in:
parent
abd18f6ec0
commit
07f6be87a9
Notes:
blender-bot
2023-02-14 08:39:23 +01:00
Referenced by issue #64470, Selecting Weight Paint Vertices With A Multi Selection Tool Doesn't Update Vertex Weights Selection Referenced by issue #64471, Global and Local Coordinates Don't Keep Track of Vertices Being Positioned By Shape Key Referenced by issue #62989, ctrl-tab pie menu shortcut is broken. Referenced by issue #62968, F-Curve imprecision for large numbers Referenced by issue #62958, F-Curve imprecisions for exponential interpolation Referenced by issue #62937, Object parenting doesn't show up in the Outliner UI Referenced by issue #62945, Shortcuts don't appear on tooltips for tool icons. Referenced by issue #61474, Laggy interaction with gizmos, does not happen when running other 3D apps at the same time
|
@ -362,7 +362,7 @@ static bool cast_ray_highpoly(
|
|||
|
||||
/* transfer position differentials */
|
||||
float tmp[3];
|
||||
mul_v3_v3fl(tmp, dir_high, 1.0f/dot_v3v3(dir_high, triangle_high->normal));
|
||||
mul_v3_v3fl(tmp, dir_high, 1.0f / dot_v3v3(dir_high, triangle_high->normal));
|
||||
madd_v3_v3fl(dxco, tmp, -dot_v3v3(dxco, triangle_high->normal));
|
||||
madd_v3_v3fl(dyco, tmp, -dot_v3v3(dyco, triangle_high->normal));
|
||||
|
||||
|
@ -421,10 +421,10 @@ static TriTessFace *mesh_calc_tri_tessface(
|
|||
}
|
||||
|
||||
BKE_mesh_recalc_looptri(
|
||||
me->mloop, me->mpoly,
|
||||
me->mvert,
|
||||
me->totloop, me->totpoly,
|
||||
looptri);
|
||||
me->mloop, me->mpoly,
|
||||
me->mvert,
|
||||
me->totloop, me->totpoly,
|
||||
looptri);
|
||||
|
||||
const float *precomputed_normals = CustomData_get_layer(&me->pdata, CD_NORMAL);
|
||||
const bool calculate_normal = precomputed_normals ? false : true;
|
||||
|
|
|
@ -273,7 +273,7 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result, bool cance
|
|||
RenderPart *pa = get_part_from_result(re, result);
|
||||
|
||||
if (pa) {
|
||||
pa->status = (!cancel && merge_results)? PART_STATUS_MERGED: PART_STATUS_RENDERED;
|
||||
pa->status = (!cancel && merge_results) ? PART_STATUS_MERGED : PART_STATUS_RENDERED;
|
||||
}
|
||||
else if (re->result->do_exr_tile) {
|
||||
/* if written result does not match any tile and we are using save
|
||||
|
@ -505,7 +505,7 @@ static void engine_depsgraph_free(RenderEngine *engine)
|
|||
|
||||
void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
|
||||
{
|
||||
if(!engine->depsgraph) {
|
||||
if (!engine->depsgraph) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -118,7 +118,7 @@ float RE_filter_value(int type, float x)
|
|||
{
|
||||
const float two_gaussfac2 = 2.0f * gaussfac * gaussfac;
|
||||
x *= 3.0f * gaussfac;
|
||||
return 1.0f / sqrtf((float)M_PI * two_gaussfac2) * expf(-x*x / two_gaussfac2);
|
||||
return 1.0f / sqrtf((float)M_PI * two_gaussfac2) * expf(-x * x / two_gaussfac2);
|
||||
}
|
||||
|
||||
case R_FILTER_MITCH:
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef struct {
|
|||
const int *orig_index_mp_to_orig;
|
||||
} MNormalBakeData;
|
||||
|
||||
static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],const int tri_num, const int vert_index)
|
||||
static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int tri_num, const int vert_index)
|
||||
{
|
||||
const int poly_index = data->mlooptri[tri_num].poly;
|
||||
const MPoly *mp = &data->mpoly[poly_index];
|
||||
|
@ -129,7 +129,7 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
|
|||
static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResolvePixelData *data,
|
||||
MFlushPixel flush_pixel, short *do_update)
|
||||
{
|
||||
BakeImBufuserData *userdata = (BakeImBufuserData *) ibuf->userdata;
|
||||
BakeImBufuserData *userdata = (BakeImBufuserData *)ibuf->userdata;
|
||||
|
||||
memset(bake_rast, 0, sizeof(MBakeRast));
|
||||
|
||||
|
@ -281,9 +281,9 @@ static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], co
|
|||
|
||||
/* check if mid point is to the left or to the right of the lo-hi edge */
|
||||
is_mid_right = (-(shi - slo) * (tmi - thi) + (thi - tlo) * (smi - shi)) > 0 ? 1 : 0;
|
||||
ylo = (int) ceilf(tlo);
|
||||
yhi_beg = (int) ceilf(tmi);
|
||||
yhi = (int) ceilf(thi);
|
||||
ylo = (int)ceilf(tlo);
|
||||
yhi_beg = (int)ceilf(tmi);
|
||||
yhi = (int)ceilf(thi);
|
||||
|
||||
/*if (fTmi>ceilf(fTlo))*/
|
||||
rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right);
|
||||
|
@ -343,7 +343,7 @@ static int multires_bake_queue_next_tri(MultiresBakeQueue *queue)
|
|||
|
||||
static void *do_multires_bake_thread(void *data_v)
|
||||
{
|
||||
MultiresBakeThread *handle = (MultiresBakeThread *) data_v;
|
||||
MultiresBakeThread *handle = (MultiresBakeThread *)data_v;
|
||||
MResolvePixelData *data = &handle->data;
|
||||
MBakeRast *bake_rast = &handle->bake_rast;
|
||||
MultiresBakeRender *bkr = handle->bkr;
|
||||
|
@ -403,9 +403,9 @@ static void init_ccgdm_arrays(DerivedMesh *dm)
|
|||
grid_offset = dm->getGridOffset(dm);
|
||||
dm->getGridKey(dm, &key);
|
||||
|
||||
(void) grid_size;
|
||||
(void) grid_data;
|
||||
(void) grid_offset;
|
||||
(void)grid_size;
|
||||
(void)grid_data;
|
||||
(void)grid_offset;
|
||||
}
|
||||
|
||||
static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, bool require_tangent, MPassKnownData passKnownData,
|
||||
|
@ -525,10 +525,10 @@ static void interp_bilinear_grid(CCGKey *key, CCGElem *grid, float crn_x, float
|
|||
float u, v;
|
||||
float data[4][3];
|
||||
|
||||
x0 = (int) crn_x;
|
||||
x0 = (int)crn_x;
|
||||
x1 = x0 >= (key->grid_size - 1) ? (key->grid_size - 1) : (x0 + 1);
|
||||
|
||||
y0 = (int) crn_y;
|
||||
y0 = (int)crn_y;
|
||||
y1 = y0 >= (key->grid_size - 1) ? (key->grid_size - 1) : (y0 + 1);
|
||||
|
||||
u = crn_x - x0;
|
||||
|
@ -717,7 +717,7 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
|
|||
MPoly *mpoly = lores_dm->getPolyArray(lores_dm) + lt->poly;
|
||||
MLoopUV *mloopuv = lores_dm->getLoopDataArray(lores_dm, CD_MLOOPUV);
|
||||
MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
|
||||
MultiresBakeThread *thread_data = (MultiresBakeThread *) thread_data_v;
|
||||
MultiresBakeThread *thread_data = (MultiresBakeThread *)thread_data_v;
|
||||
float uv[2], *st0, *st1, *st2, *st3;
|
||||
int pixel = ibuf->x * y + x;
|
||||
float vec[3], p0[3], p1[3], n[3], len;
|
||||
|
@ -941,7 +941,7 @@ static void create_ao_raytree(MultiresBakeRender *bkr, MAOBakeData *ao_data)
|
|||
num_faces = num_grids * (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), "ObjectRen faces");
|
||||
face = ao_data->rayfaces = (RayFace *)MEM_callocN(num_faces * sizeof(RayFace), "ObjectRen faces");
|
||||
|
||||
for (i = 0; i < num_grids; i++) {
|
||||
int x, y;
|
||||
|
@ -999,7 +999,7 @@ static void *init_ao_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
|
|||
|
||||
static void free_ao_data(void *bake_data)
|
||||
{
|
||||
MAOBakeData *ao_data = (MAOBakeData *) bake_data;
|
||||
MAOBakeData *ao_data = (MAOBakeData *)bake_data;
|
||||
|
||||
RE_rayobject_free(ao_data->raytree);
|
||||
MEM_freeN(ao_data->rayfaces);
|
||||
|
@ -1056,7 +1056,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void
|
|||
const MLoopTri *lt = lores_dm->getLoopTriArray(lores_dm) + tri_index;
|
||||
MPoly *mpoly = lores_dm->getPolyArray(lores_dm) + lt->poly;
|
||||
MLoopUV *mloopuv = lores_dm->getLoopDataArray(lores_dm, CD_MLOOPUV);
|
||||
MAOBakeData *ao_data = (MAOBakeData *) bake_data;
|
||||
MAOBakeData *ao_data = (MAOBakeData *)bake_data;
|
||||
|
||||
int i, k, perm_offs;
|
||||
float pos[3], nrm[3];
|
||||
|
@ -1113,8 +1113,8 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void
|
|||
const unsigned short I = ao_data->permutation_table_1[(i + perm_offs) % ao_data->number_of_rays];
|
||||
const unsigned short J = ao_data->permutation_table_2[i];
|
||||
|
||||
const float JitPh = (get_ao_random2(I + perm_offs) & (MAX_NUMBER_OF_AO_RAYS-1))/((float) MAX_NUMBER_OF_AO_RAYS);
|
||||
const float JitTh = (get_ao_random1(J + perm_offs) & (MAX_NUMBER_OF_AO_RAYS-1))/((float) MAX_NUMBER_OF_AO_RAYS);
|
||||
const float JitPh = (get_ao_random2(I + perm_offs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / ((float)MAX_NUMBER_OF_AO_RAYS);
|
||||
const float JitTh = (get_ao_random1(J + perm_offs) & (MAX_NUMBER_OF_AO_RAYS - 1)) / ((float)MAX_NUMBER_OF_AO_RAYS);
|
||||
const float SiSqPhi = (I + JitPh) / ao_data->number_of_rays;
|
||||
const float Theta = (float)(2 * M_PI) * ((J + JitTh) / ao_data->number_of_rays);
|
||||
|
||||
|
@ -1149,7 +1149,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void
|
|||
rrgbf[3] = 1.0f;
|
||||
}
|
||||
else {
|
||||
unsigned char *rrgb = (unsigned char *) ibuf->rect + pixel * 4;
|
||||
unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4;
|
||||
rrgb[0] = rrgb[1] = rrgb[2] = unit_float_to_uchar_clamp(value);
|
||||
rrgb[3] = 255;
|
||||
}
|
||||
|
@ -1206,7 +1206,7 @@ static void bake_ibuf_normalize_displacement(ImBuf *ibuf, float *displacement, c
|
|||
}
|
||||
|
||||
if (ibuf->rect) {
|
||||
unsigned char *cp = (unsigned char *) (ibuf->rect + i);
|
||||
unsigned char *cp = (unsigned char *)(ibuf->rect + i);
|
||||
cp[0] = cp[1] = cp[2] = unit_float_to_uchar_clamp(normalized_displacement);
|
||||
cp[3] = 255;
|
||||
}
|
||||
|
@ -1294,14 +1294,14 @@ static void finish_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
|
|||
for (link = bkr->image.first; link; link = link->next) {
|
||||
Image *ima = (Image *)link->data;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
|
||||
BakeImBufuserData *userdata = (BakeImBufuserData *) ibuf->userdata;
|
||||
BakeImBufuserData *userdata = (BakeImBufuserData *)ibuf->userdata;
|
||||
|
||||
if (ibuf->x <= 0 || ibuf->y <= 0)
|
||||
continue;
|
||||
|
||||
if (use_displacement_buffer) {
|
||||
bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer,
|
||||
result->height_min, result->height_max);
|
||||
result->height_min, result->height_max);
|
||||
}
|
||||
|
||||
bake_ibuf_filter(ibuf, userdata->mask_buffer, bkr->bake_filter);
|
||||
|
|
|
@ -863,8 +863,8 @@ static void render_result_rescale(Render *re)
|
|||
}
|
||||
}
|
||||
|
||||
scale_x = (float) result->rectx / re->result->rectx;
|
||||
scale_y = (float) result->recty / re->result->recty;
|
||||
scale_x = (float)result->rectx / re->result->rectx;
|
||||
scale_y = (float)result->recty / re->result->recty;
|
||||
for (x = 0; x < re->result->rectx; ++x) {
|
||||
for (y = 0; y < re->result->recty; ++y) {
|
||||
int src_x = x * scale_x;
|
||||
|
@ -1261,7 +1261,7 @@ static void ntree_render_scenes(Render *re)
|
|||
/* bad call... need to think over proper method still */
|
||||
static void render_composit_stats(void *arg, const char *str)
|
||||
{
|
||||
Render *re = (Render*)arg;
|
||||
Render *re = (Render *)arg;
|
||||
|
||||
RenderStats i;
|
||||
memcpy(&i, &re->i, sizeof(i));
|
||||
|
@ -1319,7 +1319,7 @@ static void free_all_freestyle_renders(void)
|
|||
Render *re1;
|
||||
LinkData *link;
|
||||
|
||||
for (re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
|
||||
for (re1 = RenderGlobal.renderlist.first; re1; re1 = re1->next) {
|
||||
for (link = (LinkData *)re1->freestyle_renders.first; link; link = link->next) {
|
||||
Render *freestyle_render = (Render *)link->data;
|
||||
|
||||
|
@ -1445,7 +1445,7 @@ static void renderresult_stampinfo(Render *re)
|
|||
|
||||
/* this is the basic trick to get the displayed float or char rect from render result */
|
||||
nr = 0;
|
||||
for (rv = re->result->views.first;rv;rv = rv->next, nr++) {
|
||||
for (rv = re->result->views.first; rv; rv = rv->next, nr++) {
|
||||
RE_SetActiveRenderView(re, rv->name);
|
||||
RE_AcquireResultImage(re, &rres, nr);
|
||||
BKE_image_stamp_buf(re->scene,
|
||||
|
@ -2019,7 +2019,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, ViewLayer *single_la
|
|||
#ifdef WITH_FREESTYLE
|
||||
void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene, int render)
|
||||
{
|
||||
re->result_ok= 0;
|
||||
re->result_ok = 0;
|
||||
if (render_initialize_from_main(re, &scene->r, bmain, scene, NULL, NULL, 0, 0)) {
|
||||
if (render)
|
||||
do_render_3d(re);
|
||||
|
@ -2181,7 +2181,7 @@ bool RE_WriteRenderViewsMovie(
|
|||
&scene->display_settings, &scene->r.im_format);
|
||||
|
||||
ok &= mh->append_movie(movie_ctx_arr[view_id], rd, preview ? scene->r.psfra : scene->r.sfra, scene->r.cfra,
|
||||
(int *) ibuf->rect, ibuf->x, ibuf->y, suffix, reports);
|
||||
(int *)ibuf->rect, ibuf->x, ibuf->y, suffix, reports);
|
||||
|
||||
/* imbuf knows which rects are not part of ibuf */
|
||||
IMB_freeImBuf(ibuf);
|
||||
|
@ -2205,7 +2205,7 @@ bool RE_WriteRenderViewsMovie(
|
|||
|
||||
ibuf_arr[2] = IMB_stereo3d_ImBuf(&scene->r.im_format, ibuf_arr[0], ibuf_arr[1]);
|
||||
|
||||
ok = mh->append_movie(movie_ctx_arr[0], rd, preview ? scene->r.psfra : scene->r.sfra, scene->r.cfra, (int *) ibuf_arr[2]->rect,
|
||||
ok = mh->append_movie(movie_ctx_arr[0], rd, preview ? scene->r.psfra : scene->r.sfra, scene->r.cfra, (int *)ibuf_arr[2]->rect,
|
||||
ibuf_arr[2]->x, ibuf_arr[2]->y, "", reports);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
|
|
@ -251,9 +251,9 @@ static void pointdensity_cache_psys(Depsgraph *depsgraph, Scene *scene,
|
|||
BLI_bvhtree_insert(pd->point_tree, i, partco, 1);
|
||||
|
||||
if (data_vel) {
|
||||
data_vel[i*3 + 0] = state.vel[0];
|
||||
data_vel[i*3 + 1] = state.vel[1];
|
||||
data_vel[i*3 + 2] = state.vel[2];
|
||||
data_vel[i * 3 + 0] = state.vel[0];
|
||||
data_vel[i * 3 + 1] = state.vel[1];
|
||||
data_vel[i * 3 + 2] = state.vel[2];
|
||||
}
|
||||
if (data_life) {
|
||||
data_life[i] = state.time;
|
||||
|
@ -309,7 +309,7 @@ static void pointdensity_cache_vertex_color(PointDensity *pd, Object *UNUSED(ob)
|
|||
*/
|
||||
for (i = 0; i < pd->totpoints; i++) {
|
||||
if (mcorners[i] > 0)
|
||||
mul_v3_fl(&data_color[i*3], 1.0f / mcorners[i]);
|
||||
mul_v3_fl(&data_color[i * 3], 1.0f / mcorners[i]);
|
||||
}
|
||||
|
||||
MEM_freeN(mcorners);
|
||||
|
@ -566,8 +566,9 @@ static void accum_density(void *userdata, int index, const float co[3], float sq
|
|||
}
|
||||
|
||||
|
||||
static void init_pointdensityrangedata(PointDensity *pd, PointDensityRangeData *pdr,
|
||||
float *density, float *vec, float *age, float *col, struct CurveMapping *density_curve, float velscale)
|
||||
static void init_pointdensityrangedata(
|
||||
PointDensity *pd, PointDensityRangeData *pdr,
|
||||
float *density, float *vec, float *age, float *col, struct CurveMapping *density_curve, float velscale)
|
||||
{
|
||||
pdr->squared_radius = pd->radius * pd->radius;
|
||||
pdr->density = density;
|
||||
|
@ -600,9 +601,9 @@ static int pointdensity(PointDensity *pd,
|
|||
texres->tin = 0.0f;
|
||||
|
||||
init_pointdensityrangedata(pd, &pdr, &density, vec, &age, col,
|
||||
(pd->flag & TEX_PD_FALLOFF_CURVE ? pd->falloff_curve : NULL),
|
||||
pd->falloff_speed_scale * 0.001f);
|
||||
noise_fac = pd->noise_fac * 0.5f; /* better default */
|
||||
(pd->flag & TEX_PD_FALLOFF_CURVE ? pd->falloff_curve : NULL),
|
||||
pd->falloff_speed_scale * 0.001f);
|
||||
noise_fac = pd->noise_fac * 0.5f; /* better default */
|
||||
|
||||
copy_v3_v3(co, texvec);
|
||||
|
||||
|
@ -626,7 +627,7 @@ static int pointdensity(PointDensity *pd,
|
|||
turb = BLI_gTurbulence(pd->noise_size, texvec[0] + vec[0], texvec[1] + vec[1], texvec[2] + vec[2],
|
||||
pd->noise_depth, 0, pd->noise_basis);
|
||||
|
||||
turb -= 0.5f; /* re-center 0.0-1.0 range around 0 to prevent offsetting result */
|
||||
turb -= 0.5f; /* re-center 0.0-1.0 range around 0 to prevent offsetting result */
|
||||
|
||||
/* now we have an offset coordinate to use for the density lookup */
|
||||
co[0] = texvec[0] + noise_fac * turb;
|
||||
|
@ -894,8 +895,8 @@ static void point_density_sample_func(
|
|||
pointdensity(pd, texvec, &texres, vec, &age, col);
|
||||
pointdensity_color(pd, &texres, age, vec, col);
|
||||
|
||||
copy_v3_v3(&values[index*4 + 0], &texres.tr);
|
||||
values[index*4 + 3] = texres.tin;
|
||||
copy_v3_v3(&values[index * 4 + 0], &texres.tr);
|
||||
values[index * 4 + 3] = texres.tin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,12 +325,12 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
|
|||
IMB_exr_add_view(rl->exrhandle, view);
|
||||
|
||||
#define RENDER_LAYER_ADD_PASS_SAFE(rr, rl, channels, name, viewname, chan_id) \
|
||||
do { \
|
||||
if (render_layer_add_pass(rr, rl, channels, name, viewname, chan_id) == NULL) { \
|
||||
render_result_free(rr); \
|
||||
return NULL; \
|
||||
} \
|
||||
} while (false)
|
||||
do { \
|
||||
if (render_layer_add_pass(rr, rl, channels, name, viewname, chan_id) == NULL) { \
|
||||
render_result_free(rr); \
|
||||
return NULL; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
/* a renderlayer should always have a Combined pass*/
|
||||
render_layer_add_pass(rr, rl, 4, "Combined", view, "RGBA");
|
||||
|
@ -598,8 +598,8 @@ static void *ml_addview_cb(void *base, const char *str)
|
|||
static int order_render_passes(const void *a, const void *b)
|
||||
{
|
||||
// 1 if a is after b
|
||||
RenderPass *rpa = (RenderPass *) a;
|
||||
RenderPass *rpb = (RenderPass *) b;
|
||||
RenderPass *rpa = (RenderPass *)a;
|
||||
RenderPass *rpb = (RenderPass *)b;
|
||||
unsigned int passtype_a = passtype_from_name(rpa->name);
|
||||
unsigned int passtype_b = passtype_from_name(rpb->name);
|
||||
|
||||
|
@ -838,7 +838,7 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil
|
|||
}
|
||||
|
||||
if (write_z && rview->rectz) {
|
||||
const char *layname = (multi_layer)? "Composite": "";
|
||||
const char *layname = (multi_layer) ? "Composite" : "";
|
||||
IMB_exr_add_channel(exrhandle, layname, "Z", viewname,
|
||||
1, rr->rectx, rview->rectz, false);
|
||||
}
|
||||
|
@ -846,7 +846,7 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil
|
|||
}
|
||||
|
||||
/* Other render layers. */
|
||||
int nr = (rr->have_combined)? 1: 0;
|
||||
int nr = (rr->have_combined) ? 1 : 0;
|
||||
for (RenderLayer *rl = rr->layers.first; rl; rl = rl->next, nr++) {
|
||||
/* Skip other render layers if requested. */
|
||||
if (!multi_layer && nr != layer) {
|
||||
|
@ -1304,7 +1304,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd, const int vi
|
|||
RenderView *rv = RE_RenderViewGetById(rr, view_id);
|
||||
|
||||
/* if not exists, BKE_imbuf_write makes one */
|
||||
ibuf->rect = (unsigned int *) rv->rect32;
|
||||
ibuf->rect = (unsigned int *)rv->rect32;
|
||||
ibuf->rect_float = rv->rectf;
|
||||
ibuf->zbuf_float = rv->rectz;
|
||||
|
||||
|
@ -1392,7 +1392,7 @@ void render_result_rect_get_pixels(RenderResult *rr, unsigned int *rect, int rec
|
|||
if (rv->rect32)
|
||||
memcpy(rect, rv->rect32, sizeof(int) * rr->rectx * rr->recty);
|
||||
else if (rv->rectf)
|
||||
IMB_display_buffer_transform_apply((unsigned char *) rect, rv->rectf, rr->rectx, rr->recty, 4,
|
||||
IMB_display_buffer_transform_apply((unsigned char *)rect, rv->rectf, rr->rectx, rr->recty, 4,
|
||||
view_settings, display_settings, true);
|
||||
else
|
||||
/* else fill with black */
|
||||
|
@ -1431,11 +1431,13 @@ bool RE_HasFloatPixels(RenderResult *res)
|
|||
|
||||
bool RE_RenderResult_is_stereo(RenderResult *res)
|
||||
{
|
||||
if (! BLI_findstring(&res->views, STEREO_LEFT_NAME, offsetof(RenderView, name)))
|
||||
if (!BLI_findstring(&res->views, STEREO_LEFT_NAME, offsetof(RenderView, name))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! BLI_findstring(&res->views, STEREO_RIGHT_NAME, offsetof(RenderView, name)))
|
||||
if (!BLI_findstring(&res->views, STEREO_RIGHT_NAME, offsetof(RenderView, name))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -48,11 +48,11 @@ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty)
|
|||
{
|
||||
memset(zspan, 0, sizeof(ZSpan));
|
||||
|
||||
zspan->rectx= rectx;
|
||||
zspan->recty= recty;
|
||||
zspan->rectx = rectx;
|
||||
zspan->recty = recty;
|
||||
|
||||
zspan->span1= MEM_mallocN(recty*sizeof(float), "zspan");
|
||||
zspan->span2= MEM_mallocN(recty*sizeof(float), "zspan");
|
||||
zspan->span1 = MEM_mallocN(recty * sizeof(float), "zspan");
|
||||
zspan->span2 = MEM_mallocN(recty * sizeof(float), "zspan");
|
||||
}
|
||||
|
||||
void zbuf_free_span(ZSpan *zspan)
|
||||
|
@ -60,16 +60,16 @@ void zbuf_free_span(ZSpan *zspan)
|
|||
if (zspan) {
|
||||
if (zspan->span1) MEM_freeN(zspan->span1);
|
||||
if (zspan->span2) MEM_freeN(zspan->span2);
|
||||
zspan->span1= zspan->span2= NULL;
|
||||
zspan->span1 = zspan->span2 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* reset range for clipping */
|
||||
static void zbuf_init_span(ZSpan *zspan)
|
||||
{
|
||||
zspan->miny1= zspan->miny2= zspan->recty+1;
|
||||
zspan->maxy1= zspan->maxy2= -1;
|
||||
zspan->minp1= zspan->maxp1= zspan->minp2= zspan->maxp2= NULL;
|
||||
zspan->miny1 = zspan->miny2 = zspan->recty + 1;
|
||||
zspan->maxy1 = zspan->maxy2 = -1;
|
||||
zspan->minp1 = zspan->maxp1 = zspan->minp2 = zspan->maxp2 = NULL;
|
||||
}
|
||||
|
||||
static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
|
||||
|
@ -79,30 +79,30 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
|
|||
float xx1, dx0, xs0;
|
||||
int y, my0, my2;
|
||||
|
||||
if (v1[1]<v2[1]) {
|
||||
minv= v1; maxv= v2;
|
||||
if (v1[1] < v2[1]) {
|
||||
minv = v1; maxv = v2;
|
||||
}
|
||||
else {
|
||||
minv= v2; maxv= v1;
|
||||
minv = v2; maxv = v1;
|
||||
}
|
||||
|
||||
my0= ceil(minv[1]);
|
||||
my2= floor(maxv[1]);
|
||||
my0 = ceil(minv[1]);
|
||||
my2 = floor(maxv[1]);
|
||||
|
||||
if (my2<0 || my0>= zspan->recty) return;
|
||||
if (my2 < 0 || my0 >= zspan->recty) return;
|
||||
|
||||
/* clip top */
|
||||
if (my2>=zspan->recty) my2= zspan->recty-1;
|
||||
if (my2 >= zspan->recty) my2 = zspan->recty - 1;
|
||||
/* clip bottom */
|
||||
if (my0<0) my0= 0;
|
||||
if (my0 < 0) my0 = 0;
|
||||
|
||||
if (my0>my2) return;
|
||||
if (my0 > my2) return;
|
||||
/* if (my0>my2) should still fill in, that way we get spans that skip nicely */
|
||||
|
||||
xx1= maxv[1]-minv[1];
|
||||
if (xx1>FLT_EPSILON) {
|
||||
dx0= (minv[0]-maxv[0])/xx1;
|
||||
xs0= dx0*(minv[1]-my2) + minv[0];
|
||||
xx1 = maxv[1] - minv[1];
|
||||
if (xx1 > FLT_EPSILON) {
|
||||
dx0 = (minv[0] - maxv[0]) / xx1;
|
||||
xs0 = dx0 * (minv[1] - my2) + minv[0];
|
||||
}
|
||||
else {
|
||||
dx0 = 0.0f;
|
||||
|
@ -111,43 +111,43 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
|
|||
|
||||
/* empty span */
|
||||
if (zspan->maxp1 == NULL) {
|
||||
span= zspan->span1;
|
||||
span = zspan->span1;
|
||||
}
|
||||
else { /* does it complete left span? */
|
||||
if ( maxv == zspan->minp1 || minv==zspan->maxp1) {
|
||||
span= zspan->span1;
|
||||
else { /* does it complete left span? */
|
||||
if (maxv == zspan->minp1 || minv == zspan->maxp1) {
|
||||
span = zspan->span1;
|
||||
}
|
||||
else {
|
||||
span= zspan->span2;
|
||||
span = zspan->span2;
|
||||
}
|
||||
}
|
||||
|
||||
if (span==zspan->span1) {
|
||||
if (span == zspan->span1) {
|
||||
// printf("left span my0 %d my2 %d\n", my0, my2);
|
||||
if (zspan->minp1==NULL || zspan->minp1[1] > minv[1] ) {
|
||||
zspan->minp1= minv;
|
||||
if (zspan->minp1 == NULL || zspan->minp1[1] > minv[1]) {
|
||||
zspan->minp1 = minv;
|
||||
}
|
||||
if (zspan->maxp1==NULL || zspan->maxp1[1] < maxv[1] ) {
|
||||
zspan->maxp1= maxv;
|
||||
if (zspan->maxp1 == NULL || zspan->maxp1[1] < maxv[1]) {
|
||||
zspan->maxp1 = maxv;
|
||||
}
|
||||
if (my0<zspan->miny1) zspan->miny1= my0;
|
||||
if (my2>zspan->maxy1) zspan->maxy1= my2;
|
||||
if (my0 < zspan->miny1) zspan->miny1 = my0;
|
||||
if (my2 > zspan->maxy1) zspan->maxy1 = my2;
|
||||
}
|
||||
else {
|
||||
// printf("right span my0 %d my2 %d\n", my0, my2);
|
||||
if (zspan->minp2==NULL || zspan->minp2[1] > minv[1] ) {
|
||||
zspan->minp2= minv;
|
||||
if (zspan->minp2 == NULL || zspan->minp2[1] > minv[1]) {
|
||||
zspan->minp2 = minv;
|
||||
}
|
||||
if (zspan->maxp2==NULL || zspan->maxp2[1] < maxv[1] ) {
|
||||
zspan->maxp2= maxv;
|
||||
if (zspan->maxp2 == NULL || zspan->maxp2[1] < maxv[1]) {
|
||||
zspan->maxp2 = maxv;
|
||||
}
|
||||
if (my0<zspan->miny2) zspan->miny2= my0;
|
||||
if (my2>zspan->maxy2) zspan->maxy2= my2;
|
||||
if (my0 < zspan->miny2) zspan->miny2 = my0;
|
||||
if (my2 > zspan->maxy2) zspan->maxy2 = my2;
|
||||
}
|
||||
|
||||
for (y=my2; y>=my0; y--, xs0+= dx0) {
|
||||
for (y = my2; y >= my0; y--, xs0 += dx0) {
|
||||
/* xs0 is the xcoord! */
|
||||
span[y]= xs0;
|
||||
span[y] = xs0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,57 +173,57 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
|
|||
zbuf_add_to_span(zspan, v3, v1);
|
||||
|
||||
/* clipped */
|
||||
if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
|
||||
if (zspan->minp2 == NULL || zspan->maxp2 == NULL) return;
|
||||
|
||||
my0 = max_ii(zspan->miny1, zspan->miny2);
|
||||
my2 = min_ii(zspan->maxy1, zspan->maxy2);
|
||||
|
||||
// printf("my %d %d\n", my0, my2);
|
||||
if (my2<my0) return;
|
||||
if (my2 < my0) return;
|
||||
|
||||
/* ZBUF DX DY, in floats still */
|
||||
x1= v1[0]- v2[0];
|
||||
x2= v2[0]- v3[0];
|
||||
y1= v1[1]- v2[1];
|
||||
y2= v2[1]- v3[1];
|
||||
x1 = v1[0] - v2[0];
|
||||
x2 = v2[0] - v3[0];
|
||||
y1 = v1[1] - v2[1];
|
||||
y2 = v2[1] - v3[1];
|
||||
|
||||
z1= 1.0f; /* (u1 - u2) */
|
||||
z2= 0.0f; /* (u2 - u3) */
|
||||
z1 = 1.0f; /* (u1 - u2) */
|
||||
z2 = 0.0f; /* (u2 - u3) */
|
||||
|
||||
x0= y1*z2-z1*y2;
|
||||
y0= z1*x2-x1*z2;
|
||||
z0= x1*y2-y1*x2;
|
||||
x0 = y1 * z2 - z1 * y2;
|
||||
y0 = z1 * x2 - x1 * z2;
|
||||
z0 = x1 * y2 - y1 * x2;
|
||||
|
||||
if (z0==0.0f) return;
|
||||
if (z0 == 0.0f) return;
|
||||
|
||||
xx1= (x0*v1[0] + y0*v1[1])/z0 + 1.0f;
|
||||
uxd= -(double)x0/(double)z0;
|
||||
uyd= -(double)y0/(double)z0;
|
||||
uy0= ((double)my2)*uyd + (double)xx1;
|
||||
xx1 = (x0 * v1[0] + y0 * v1[1]) / z0 + 1.0f;
|
||||
uxd = -(double)x0 / (double)z0;
|
||||
uyd = -(double)y0 / (double)z0;
|
||||
uy0 = ((double)my2) * uyd + (double)xx1;
|
||||
|
||||
z1= -1.0f; /* (v1 - v2) */
|
||||
z2= 1.0f; /* (v2 - v3) */
|
||||
z1 = -1.0f; /* (v1 - v2) */
|
||||
z2 = 1.0f; /* (v2 - v3) */
|
||||
|
||||
x0= y1*z2-z1*y2;
|
||||
y0= z1*x2-x1*z2;
|
||||
x0 = y1 * z2 - z1 * y2;
|
||||
y0 = z1 * x2 - x1 * z2;
|
||||
|
||||
xx1= (x0*v1[0] + y0*v1[1])/z0;
|
||||
vxd= -(double)x0/(double)z0;
|
||||
vyd= -(double)y0/(double)z0;
|
||||
vy0= ((double)my2)*vyd + (double)xx1;
|
||||
xx1 = (x0 * v1[0] + y0 * v1[1]) / z0;
|
||||
vxd = -(double)x0 / (double)z0;
|
||||
vyd = -(double)y0 / (double)z0;
|
||||
vy0 = ((double)my2) * vyd + (double)xx1;
|
||||
|
||||
/* correct span */
|
||||
span1= zspan->span1+my2;
|
||||
span2= zspan->span2+my2;
|
||||
span1 = zspan->span1 + my2;
|
||||
span2 = zspan->span2 + my2;
|
||||
|
||||
for (i = 0, y = my2; y >= my0; i++, y--, span1--, span2--) {
|
||||
|
||||
sn1= floor(min_ff(*span1, *span2));
|
||||
sn2= floor(max_ff(*span1, *span2));
|
||||
sn1 = floor(min_ff(*span1, *span2));
|
||||
sn2 = floor(max_ff(*span1, *span2));
|
||||
sn1++;
|
||||
|
||||
if (sn2>=rectx) sn2= rectx-1;
|
||||
if (sn1<0) sn1= 0;
|
||||
if (sn2 >= rectx) sn2 = rectx - 1;
|
||||
if (sn1 < 0) sn1 = 0;
|
||||
|
||||
u = (((double)sn1 * uxd) + uy0) - (i * uyd);
|
||||
v = (((double)sn1 * vxd) + vy0) - (i * vyd);
|
||||
|
|
Loading…
Reference in New Issue