Cleanup: comments (long lines) in render
This commit is contained in:
parent
380ce86a7f
commit
797539e76c
Notes:
blender-bot
2023-02-14 02:57:08 +01:00
Referenced by issue #63799, Crash deleting a face
|
@ -91,7 +91,8 @@ typedef struct RenderPass {
|
|||
|
||||
/* a renderlayer is a full image, but with all passes and samples */
|
||||
/* size of the rects is defined in RenderResult */
|
||||
/* after render, the Combined pass is in combined, for renderlayers read from files it is a real pass */
|
||||
/* after render, the Combined pass is in combined,
|
||||
* for renderlayers read from files it is a real pass */
|
||||
typedef struct RenderLayer {
|
||||
struct RenderLayer *next, *prev;
|
||||
|
||||
|
@ -125,8 +126,8 @@ typedef struct RenderResult {
|
|||
int rectx, recty;
|
||||
short crop, sample_nr;
|
||||
|
||||
/* the following rect32, rectf and rectz buffers are for temporary storage only, for RenderResult structs
|
||||
* created in #RE_AcquireResultImage - which do not have RenderView */
|
||||
/* The following rect32, rectf and rectz buffers are for temporary storage only,
|
||||
* for RenderResult structs created in #RE_AcquireResultImage - which do not have RenderView */
|
||||
|
||||
/* optional, 32 bits version of picture, used for ogl render and image curves */
|
||||
int *rect32;
|
||||
|
|
|
@ -17,19 +17,22 @@
|
|||
/** \file
|
||||
* \ingroup render
|
||||
*
|
||||
* \brief The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an
|
||||
* array of floats with the result.
|
||||
* \brief The API itself is simple.
|
||||
* Blender sends a populated array of BakePixels to the renderer,
|
||||
* and gets back an array of floats with the result.
|
||||
*
|
||||
* \section bake_api Development Notes for External Engines
|
||||
*
|
||||
* The Bake API is fully implemented with Python rna functions. The operator expects/call a function:
|
||||
* 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)``
|
||||
* - 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)
|
||||
* - 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)
|
||||
* - depth: depth of pixels to return (int, assuming always 4 now)
|
||||
* - result: array to be populated by the engine (float array, PyLong_AsVoidPtr)
|
||||
|
@ -158,8 +161,10 @@ void RE_bake_margin(ImBuf *ibuf, char *mask, const int margin)
|
|||
}
|
||||
|
||||
/**
|
||||
* This function returns the coordinate and normal of a barycentric u,v for a face defined by the primitive_id index.
|
||||
* The returned normal is actually the direction from the same barycentric coordinate in the cage to the base mesh
|
||||
* This function returns the coordinate and normal of a barycentric u,v
|
||||
* for a face defined by the primitive_id index.
|
||||
* The returned normal is actually the direction from the same barycentric coordinate
|
||||
* in the cage to the base mesh
|
||||
* The returned coordinate is the point in the cage mesh
|
||||
*/
|
||||
static void calc_point_from_barycentric_cage(TriTessFace *triangles_low,
|
||||
|
@ -201,7 +206,8 @@ static void calc_point_from_barycentric_cage(TriTessFace *triangles_low,
|
|||
}
|
||||
|
||||
/**
|
||||
* This function returns the coordinate and normal of a barycentric u,v for a face defined by the primitive_id index.
|
||||
* This function returns the coordinate and normal of a barycentric u,v
|
||||
* for a face defined by the primitive_id index.
|
||||
* The returned coordinate is extruded along the normal by cage_extrusion
|
||||
*/
|
||||
static void calc_point_from_barycentric_extrusion(TriTessFace *triangles,
|
||||
|
@ -722,8 +728,8 @@ void RE_bake_pixels_populate(Mesh *me,
|
|||
for (a = 0; a < 3; a++) {
|
||||
const float *uv = mloopuv[lt->tri[a]].uv;
|
||||
|
||||
/* Note, workaround for pixel aligned UVs which are common and can screw up our intersection tests
|
||||
* where a pixel gets in between 2 faces or the middle of a quad,
|
||||
/* Note, workaround for pixel aligned UVs which are common and can screw up our
|
||||
* intersection tests where a pixel gets in between 2 faces or the middle of a quad,
|
||||
* camera aligned quads also have this problem but they are less common.
|
||||
* Add a small offset to the UVs, fixes bug #18685 - Campbell */
|
||||
vec[a][0] = uv[0] * (float)bd.bk_image->width - (0.5f + 0.001f);
|
||||
|
@ -796,7 +802,8 @@ static void normal_compress(float out[3],
|
|||
}
|
||||
|
||||
/**
|
||||
* This function converts an object space normal map to a tangent space normal map for a given low poly mesh
|
||||
* This function converts an object space normal map
|
||||
* to a tangent space normal map for a given low poly mesh.
|
||||
*/
|
||||
void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[],
|
||||
const size_t num_pixels,
|
||||
|
|
|
@ -410,7 +410,8 @@ float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, bool us
|
|||
{
|
||||
Render *re = engine->re;
|
||||
|
||||
/* when using spherical stereo, get camera shift without multiview, leaving stereo to be handled by the engine */
|
||||
/* When using spherical stereo, get camera shift without multiview,
|
||||
* leaving stereo to be handled by the engine. */
|
||||
if (use_spherical_stereo)
|
||||
re = NULL;
|
||||
|
||||
|
@ -424,7 +425,8 @@ void RE_engine_get_camera_model_matrix(RenderEngine *engine,
|
|||
{
|
||||
Render *re = engine->re;
|
||||
|
||||
/* when using spherical stereo, get model matrix without multiview, leaving stereo to be handled by the engine */
|
||||
/* When using spherical stereo, get model matrix without multiview,
|
||||
* leaving stereo to be handled by the engine. */
|
||||
if (use_spherical_stereo)
|
||||
re = NULL;
|
||||
|
||||
|
|
|
@ -597,7 +597,8 @@ static void boxsample(ImBuf *ibuf,
|
|||
* If variable 'imaprepeat' has been set, the
|
||||
* clipped-away parts are sampled as well.
|
||||
*/
|
||||
/* note: actually minx etc isn't in the proper range... this due to filter size and offset vectors for bump */
|
||||
/* note: actually minx etc isn't in the proper range...
|
||||
* this due to filter size and offset vectors for bump */
|
||||
/* note: talpha must be initialized */
|
||||
/* note: even when 'imaprepeat' is set, this can only repeat once in any direction.
|
||||
* the point which min/max is derived from is assumed to be wrapped */
|
||||
|
@ -682,8 +683,8 @@ static void boxsample(ImBuf *ibuf,
|
|||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------
|
||||
* from here, some functions only used for the new filtering */
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* from here, some functions only used for the new filtering */
|
||||
|
||||
/* anisotropic filters, data struct used instead of long line of (possibly unused) func args */
|
||||
typedef struct afdata_t {
|
||||
|
@ -1043,7 +1044,8 @@ static int imagewraposa_aniso(Tex *tex,
|
|||
miny = (maxy - miny) * 0.5f;
|
||||
|
||||
if (tex->imaflag & TEX_FILTER_MIN) {
|
||||
/* make sure the filtersize is minimal in pixels (normal, ref map can have miniature pixel dx/dy) */
|
||||
/* Make sure the filtersize is minimal in pixels
|
||||
* (normal, ref map can have miniature pixel dx/dy). */
|
||||
const float addval = (0.5f * tex->filtersize) / (float)MIN2(ibuf->x, ibuf->y);
|
||||
if (addval > minx)
|
||||
minx = addval;
|
||||
|
@ -1063,8 +1065,9 @@ static int imagewraposa_aniso(Tex *tex,
|
|||
float t;
|
||||
SWAP(float, minx, miny);
|
||||
/* must rotate dxt/dyt 90 deg
|
||||
* yet another blender problem is that swapping X/Y axes (or any tex proj switches) should do something similar,
|
||||
* but it doesn't, it only swaps coords, so filter area will be incorrect in those cases. */
|
||||
* yet another blender problem is that swapping X/Y axes (or any tex proj switches)
|
||||
* should do something similar, but it doesn't, it only swaps coords,
|
||||
* so filter area will be incorrect in those cases. */
|
||||
t = dxt[0];
|
||||
dxt[0] = dxt[1];
|
||||
dxt[1] = -t;
|
||||
|
@ -1368,8 +1371,9 @@ static int imagewraposa_aniso(Tex *tex,
|
|||
}
|
||||
|
||||
/* de-premul, this is being premulled in shade_input_do_shade()
|
||||
* TXF: this currently does not (yet?) work properly, destroys edge AA in clip/checker mode, so for now commented out
|
||||
* also disabled in imagewraposa() to be able to compare results with blender's default texture filtering */
|
||||
* TXF: this currently does not (yet?) work properly, destroys edge AA in clip/checker mode,
|
||||
* so for now commented out also disabled in imagewraposa()
|
||||
* to be able to compare results with blender's default texture filtering */
|
||||
|
||||
/* brecht: tried to fix this, see "TXF alpha" comments */
|
||||
|
||||
|
@ -1404,8 +1408,8 @@ int imagewraposa(Tex *tex,
|
|||
float maxd, pixsize, val1, val2, val3;
|
||||
int curmap, retval, imaprepeat, imapextend;
|
||||
|
||||
/* TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call,
|
||||
* make a local copy here so that original vecs remain untouched */
|
||||
/* TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa()
|
||||
* call, make a local copy here so that original vecs remain untouched. */
|
||||
copy_v2_v2(dxt, DXT);
|
||||
copy_v2_v2(dyt, DYT);
|
||||
|
||||
|
@ -1471,7 +1475,8 @@ int imagewraposa(Tex *tex,
|
|||
miny = (maxy - miny) / 2.0f;
|
||||
|
||||
if (tex->imaflag & TEX_FILTER_MIN) {
|
||||
/* make sure the filtersize is minimal in pixels (normal, ref map can have miniature pixel dx/dy) */
|
||||
/* Make sure the filtersize is minimal in pixels
|
||||
* (normal, ref map can have miniature pixel dx/dy). */
|
||||
float addval = (0.5f * tex->filtersize) / (float)MIN2(ibuf->x, ibuf->y);
|
||||
|
||||
if (addval > minx)
|
||||
|
|
|
@ -219,7 +219,8 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs)
|
|||
/* Flush stdout to be sure python callbacks are printing stuff after blender. */
|
||||
fflush(stdout);
|
||||
|
||||
/* NOTE: using G_MAIN seems valid here??? Not sure it's actually even used anyway, we could as well pass NULL? */
|
||||
/* NOTE: using G_MAIN seems valid here???
|
||||
* Not sure it's actually even used anyway, we could as well pass NULL? */
|
||||
BLI_callback_exec(G_MAIN, NULL, BLI_CB_EVT_RENDER_STATS);
|
||||
|
||||
fputc('\n', stdout);
|
||||
|
@ -1248,7 +1249,8 @@ static void render_scene(Render *re, Scene *sce, int cfra)
|
|||
do_render(resc);
|
||||
}
|
||||
|
||||
/* helper call to detect if this scene needs a render, or if there's a any render layer to render */
|
||||
/* helper call to detect if this scene needs a render,
|
||||
* or if there's a any render layer to render. */
|
||||
static int composite_needs_render(Scene *sce, int this_scene)
|
||||
{
|
||||
bNodeTree *ntree = sce->nodetree;
|
||||
|
@ -1668,7 +1670,8 @@ static void do_render_all_options(Render *re)
|
|||
* work with copy-on-write. */
|
||||
BKE_animsys_evaluate_all_animation(re->main, NULL, re->scene, (float)cfra);
|
||||
|
||||
/* Update for masks (these do not use animsys but own lighter weight structure to define animation). */
|
||||
/* Update for masks
|
||||
* (these do not use animsys but own lighter weight structure to define animation). */
|
||||
BKE_mask_evaluate_all_masks(re->main, (float)cfra, true);
|
||||
|
||||
if (RE_engine_render(re, 1)) {
|
||||
|
@ -1967,7 +1970,8 @@ static int render_initialize_from_main(Render *re,
|
|||
winx = (rd->size * rd->xsch) / 100;
|
||||
winy = (rd->size * rd->ysch) / 100;
|
||||
|
||||
/* we always render smaller part, inserting it in larger image is compositor bizz, it uses disprect for it */
|
||||
/* We always render smaller part, inserting it in larger image is compositor bizz,
|
||||
* it uses disprect for it. */
|
||||
if (scene->r.mode & R_BORDER) {
|
||||
disprect.xmin = rd->border.xmin * winx;
|
||||
disprect.xmax = rd->border.xmax * winx;
|
||||
|
@ -2041,7 +2045,8 @@ void RE_BlenderFrame(Render *re,
|
|||
{
|
||||
BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_INIT);
|
||||
|
||||
/* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */
|
||||
/* Ugly global still...
|
||||
* is to prevent preview events and signal subsurfs etc to make full resol. */
|
||||
G.is_rendering = true;
|
||||
|
||||
scene->r.cfra = frame;
|
||||
|
@ -2365,7 +2370,8 @@ static int do_write_image_or_movie(Render *re,
|
|||
/* Flush stdout to be sure python callbacks are printing stuff after blender. */
|
||||
fflush(stdout);
|
||||
|
||||
/* NOTE: using G_MAIN seems valid here??? Not sure it's actually even used anyway, we could as well pass NULL? */
|
||||
/* NOTE: using G_MAIN seems valid here???
|
||||
* Not sure it's actually even used anyway, we could as well pass NULL? */
|
||||
BLI_callback_exec(G_MAIN, NULL, BLI_CB_EVT_RENDER_STATS);
|
||||
|
||||
BLI_timecode_string_from_time_simple(name, sizeof(name), re->i.lastframetime - render_time);
|
||||
|
@ -2469,8 +2475,8 @@ void RE_BlenderAnim(Render *re,
|
|||
}
|
||||
}
|
||||
|
||||
/* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */
|
||||
/* is also set by caller renderwin.c */
|
||||
/* Ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol
|
||||
* is also set by caller renderwin.c */
|
||||
G.is_rendering = true;
|
||||
|
||||
re->flag |= R_ANIMATION;
|
||||
|
|
|
@ -85,7 +85,8 @@ void render_result_free(RenderResult *res)
|
|||
while (res->layers.first) {
|
||||
RenderLayer *rl = res->layers.first;
|
||||
|
||||
/* acolrect and scolrect are optionally allocated in shade_tile, only free here since it can be used for drawing */
|
||||
/* acolrect and scolrect are optionally allocated in shade_tile,
|
||||
* only free here since it can be used for drawing. */
|
||||
if (rl->acolrect)
|
||||
MEM_freeN(rl->acolrect);
|
||||
if (rl->scolrect)
|
||||
|
@ -684,7 +685,8 @@ static int order_render_passes(const void *a, const void *b)
|
|||
return (rpa->view_id < rpb->view_id);
|
||||
}
|
||||
|
||||
/* from imbuf, if a handle was returned and it's not a singlelayer multiview we convert this to render result */
|
||||
/* From imbuf, if a handle was returned and
|
||||
* it's not a singlelayer multiview we convert this to render result. */
|
||||
RenderResult *render_result_new_from_exr(
|
||||
void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty)
|
||||
{
|
||||
|
|
|
@ -723,7 +723,10 @@ static float mg_distNoiseTex(Tex *tex, const float texvec[3], TexResult *texres)
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* newnoise: Voronoi texture type, probably the slowest, especially with minkovsky, bumpmapping, could be done another way */
|
||||
/* newnoise: Voronoi texture type
|
||||
*
|
||||
* probably the slowest, especially with minkovsky, bumpmapping, could be done another way.
|
||||
*/
|
||||
|
||||
static float voronoiTex(Tex *tex, const float texvec[3], TexResult *texres)
|
||||
{
|
||||
|
@ -1387,8 +1390,10 @@ int multitex_nodes(Tex *tex,
|
|||
true);
|
||||
}
|
||||
|
||||
/* Warning, if the texres's values are not declared zero, check the return value to be sure
|
||||
* the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell
|
||||
/**
|
||||
* \warning if the texres's values are not declared zero,
|
||||
* check the return value to be sure the color values are set before using the r/g/b values,
|
||||
* otherwise you may use uninitialized values - Campbell
|
||||
*
|
||||
* Use it for stuff which is out of render pipeline.
|
||||
*/
|
||||
|
|
|
@ -165,7 +165,8 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
|
|||
/* Functions */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* scanconvert for strand triangles, calls func for each x, y coordinate and gives UV barycentrics and z */
|
||||
/* Scanconvert for strand triangles, calls func for each x, y coordinate
|
||||
* and gives UV barycentrics and z. */
|
||||
|
||||
void zspan_scanconvert(ZSpan *zspan,
|
||||
void *handle,
|
||||
|
|
Loading…
Reference in New Issue