Blender  V3.3
RE_pipeline.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2006 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "DNA_ID.h"
11 #include "DNA_listBase.h"
12 #include "DNA_vec_types.h"
13 
14 struct ImBuf;
15 struct Image;
16 struct ImageFormatData;
17 struct Main;
18 struct Object;
19 struct RenderData;
20 struct RenderResult;
21 struct ReportList;
22 struct Scene;
23 struct StampData;
24 struct ViewLayer;
25 struct bMovieHandle;
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
32 /* this include is what is exposed of render to outside world */
33 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
34 
35 /* length of the scene name + passname */
36 #define RE_MAXNAME ((MAX_ID_NAME - 2) + 10)
37 
38 /* only used as handle */
39 typedef struct Render Render;
40 
41 /* Render Result usage:
42  *
43  * - render engine allocates/frees and delivers raw floating point rects
44  * - right now it's full rects, but might become tiles or file
45  * - the display client has to allocate display rects, sort out what to display,
46  * and how it's converted
47  */
48 
49 typedef struct RenderView {
50  struct RenderView *next, *prev;
51  char name[64]; /* EXR_VIEW_MAXNAME */
52 
53  /* if this exists, result of composited layers */
54  float *rectf;
55  /* if this exists, result of composited layers */
56  float *rectz;
57  /* optional, 32 bits version of picture, used for sequencer, ogl render and image curves */
58  int *rect32;
59 
61 
62 typedef struct RenderPass {
63  struct RenderPass *next, *prev;
64  int channels;
65  char name[64]; /* amount defined in IMB_openexr.h */
66  char chan_id[8]; /* amount defined in IMB_openexr.h */
67  float *rect;
68  int rectx, recty;
69 
70  char fullname[64]; /* EXR_PASS_MAXNAME */
71  char view[64]; /* EXR_VIEW_MAXNAME */
72  int view_id; /* quick lookup */
73 
74  int pad;
76 
83 typedef struct RenderLayer {
84  struct RenderLayer *next, *prev;
85 
89 
90  int rectx, recty;
91 
93  void *exrhandle;
94 
96 
98 
99 typedef struct RenderResult {
100  struct RenderResult *next, *prev;
101 
102  /* target image size */
103  int rectx, recty;
104  short sample_nr;
105 
106  /* The following rect32, rectf and rectz buffers are for temporary storage only,
107  * for RenderResult structs created in #RE_AcquireResultImage - which do not have RenderView */
108 
109  /* optional, 32 bits version of picture, used for ogl render and image curves */
110  int *rect32;
111  /* if this exists, a copy of one of layers, or result of composited layers */
112  float *rectf;
113  /* if this exists, a copy of one of layers, or result of composited layers */
114  float *rectz;
115 
116  /* coordinates within final image (after cropping) */
118  /* offset to apply to get a border render in full image */
119  int xof, yof;
120 
121  /* the main buffers */
123 
124  /* multiView maps to a StringVector in OpenEXR */
125  ListBase views; /* RenderView */
126 
127  /* allowing live updates: */
130 
131  /* for render results in Image, verify validity for sequences */
132  int framenr;
133 
134  /* for acquire image, to indicate if it there is a combined layer */
136 
137  /* render info text */
138  char *text;
139  char *error;
140 
142 
145 
146 typedef struct RenderStats {
147  int cfra;
148  bool localview;
150  const char *infostr, *statstr;
154 
155 /* *********************** API ******************** */
156 
161 struct Render *RE_NewRender(const char *name);
162 struct Render *RE_GetRender(const char *name);
163 
164 struct Scene;
165 struct Render *RE_NewSceneRender(const struct Scene *scene);
166 struct Render *RE_GetSceneRender(const struct Scene *scene);
167 
168 /* Assign default dummy callbacks. */
169 
174 void RE_InitRenderCB(struct Render *re);
175 
181 void RE_FreeRender(struct Render *re);
185 void RE_FreeAllRender(void);
186 
190 void RE_FreeAllRenderResults(void);
195 void RE_FreeAllPersistentData(void);
199 void RE_FreePersistentData(const struct Scene *scene);
200 
204 void RE_FreeRenderResult(struct RenderResult *rr);
208 struct RenderResult *RE_AcquireResultRead(struct Render *re);
209 struct RenderResult *RE_AcquireResultWrite(struct Render *re);
210 void RE_ReleaseResult(struct Render *re);
216 void RE_AcquireResultImageViews(struct Render *re, struct RenderResult *rr);
220 void RE_ReleaseResultImageViews(struct Render *re, struct RenderResult *rr);
221 
227 void RE_AcquireResultImage(struct Render *re, struct RenderResult *rr, int view_id);
228 void RE_ReleaseResultImage(struct Render *re);
229 void RE_SwapResult(struct Render *re, struct RenderResult **rr);
230 void RE_ClearResult(struct Render *re);
231 struct RenderStats *RE_GetStats(struct Render *re);
232 
236 void RE_ResultGet32(struct Render *re, unsigned int *rect);
242 void RE_AcquiredResultGet32(struct Render *re,
243  struct RenderResult *result,
244  unsigned int *rect,
245  int view_id);
246 
247 void RE_render_result_full_channel_name(char *fullname,
248  const char *layname,
249  const char *passname,
250  const char *viewname,
251  const char *chan_id,
252  int channel);
253 
255  const struct ImageFormatData *imf,
256  const float dither,
257  int view_id);
259  const struct ImBuf *ibuf,
260  int view_id);
261 
262 struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name);
263 float *RE_RenderLayerGetPass(struct RenderLayer *rl, const char *name, const char *viewname);
264 
265 bool RE_HasSingleLayer(struct Render *re);
266 
271 struct RenderPass *RE_create_gp_pass(struct RenderResult *rr,
272  const char *layername,
273  const char *viewname);
274 
275 void RE_create_render_pass(struct RenderResult *rr,
276  const char *name,
277  int channels,
278  const char *chan_id,
279  const char *layername,
280  const char *viewname,
281  bool allocate);
282 
287 void RE_InitState(struct Render *re,
288  struct Render *source,
289  struct RenderData *rd,
290  struct ListBase *render_layers,
291  struct ViewLayer *single_layer,
292  int winx,
293  int winy,
294  rcti *disprect);
295 
301 struct Object *RE_GetCamera(struct Render *re);
302 void RE_SetOverrideCamera(struct Render *re, struct Object *cam_ob);
308 void RE_SetCamera(struct Render *re, const struct Object *cam_ob);
309 
313 void RE_GetViewPlane(struct Render *re, rctf *r_viewplane, rcti *r_disprect);
314 
318 void RE_init_threadcount(Render *re);
319 
320 bool RE_WriteRenderViewsMovie(struct ReportList *reports,
321  struct RenderResult *rr,
322  struct Scene *scene,
323  struct RenderData *rd,
324  struct bMovieHandle *mh,
325  void **movie_ctx_arr,
326  int totvideos,
327  bool preview);
328 
338 void RE_RenderFrame(struct Render *re,
339  struct Main *bmain,
340  struct Scene *scene,
341  struct ViewLayer *single_layer,
342  struct Object *camera_override,
343  int frame,
344  float subframe,
345  bool write_still);
349 void RE_RenderAnim(struct Render *re,
350  struct Main *bmain,
351  struct Scene *scene,
352  struct ViewLayer *single_layer,
353  struct Object *camera_override,
354  int sfra,
355  int efra,
356  int tfra);
357 #ifdef WITH_FREESTYLE
358 void RE_RenderFreestyleStrokes(struct Render *re,
359  struct Main *bmain,
360  struct Scene *scene,
361  int render);
362 void RE_RenderFreestyleExternal(struct Render *re);
363 #endif
364 
365 void RE_SetActiveRenderView(struct Render *re, const char *viewname);
366 const char *RE_GetActiveRenderView(struct Render *re);
367 
371 void RE_SetReports(struct Render *re, struct ReportList *reports);
372 
376 void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene);
377 
381 bool RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
382 
384  void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty);
385 
386 /* Display and event callbacks. */
387 
391 void RE_display_init_cb(struct Render *re,
392  void *handle,
393  void (*f)(void *handle, RenderResult *rr));
394 void RE_display_clear_cb(struct Render *re,
395  void *handle,
396  void (*f)(void *handle, RenderResult *rr));
397 void RE_display_update_cb(struct Render *re,
398  void *handle,
399  void (*f)(void *handle, RenderResult *rr, struct rcti *rect));
400 void RE_stats_draw_cb(struct Render *re, void *handle, void (*f)(void *handle, RenderStats *rs));
401 void RE_progress_cb(struct Render *re, void *handle, void (*f)(void *handle, float));
402 void RE_draw_lock_cb(struct Render *re, void *handle, void (*f)(void *handle, bool lock));
403 void RE_test_break_cb(struct Render *re, void *handle, int (*f)(void *handle));
405  void *handle,
406  void (*f)(void *handle, struct Scene *scene));
407 
408 void RE_gl_context_create(Render *re);
409 void RE_gl_context_destroy(Render *re);
410 void *RE_gl_context_get(Render *re);
411 void *RE_gpu_context_get(Render *re);
412 
418 float RE_filter_value(int type, float x);
419 
420 int RE_seq_render_active(struct Scene *scene, struct RenderData *rd);
421 
426 bool RE_passes_have_name(struct RenderLayer *rl);
427 
428 struct RenderPass *RE_pass_find_by_name(struct RenderLayer *rl,
429  const char *name,
430  const char *viewname);
434 struct RenderPass *RE_pass_find_by_type(struct RenderLayer *rl,
435  int passtype,
436  const char *viewname);
437 
438 /* shaded view or baking options */
439 #define RE_BAKE_NORMALS 0
440 #define RE_BAKE_DISPLACEMENT 1
441 #define RE_BAKE_AO 2
442 
443 void RE_GetCameraWindow(struct Render *re, const struct Object *camera, float mat[4][4]);
447 void RE_GetCameraWindowWithOverscan(const struct Render *re, float overscan, float r_winmat[4][4]);
448 void RE_GetCameraModelMatrix(const struct Render *re,
449  const struct Object *camera,
450  float r_modelmat[4][4]);
451 
452 struct Scene *RE_GetScene(struct Render *re);
453 void RE_SetScene(struct Render *re, struct Scene *sce);
454 
455 bool RE_is_rendering_allowed(struct Scene *scene,
456  struct ViewLayer *single_layer,
457  struct Object *camera_override,
458  struct ReportList *reports);
459 
460 bool RE_allow_render_generic_object(struct Object *ob);
461 
462 /******* defined in render_result.c *********/
463 
464 bool RE_HasCombinedLayer(const RenderResult *res);
465 bool RE_HasFloatPixels(const RenderResult *res);
466 bool RE_RenderResult_is_stereo(const RenderResult *res);
467 struct RenderView *RE_RenderViewGetById(struct RenderResult *rr, int view_id);
468 struct RenderView *RE_RenderViewGetByName(struct RenderResult *rr, const char *viewname);
469 
471 
472 #ifdef __cplusplus
473 }
474 #endif
ID and Library types, which are fundamental for sdna.
#define MAX_ID_NAME
Definition: DNA_ID.h:337
These structs are the foundation for all linked lists in the library system.
_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 type
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
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 a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
void RE_current_scene_update_cb(struct Render *re, void *handle, void(*f)(void *handle, struct Scene *scene))
void RE_ResultGet32(struct Render *re, unsigned int *rect)
Definition: pipeline.c:481
struct Object * RE_GetCamera(struct Render *re)
Definition: initrender.c:150
void RE_FreeRender(struct Render *re)
Definition: pipeline.c:584
void RE_GetCameraWindowWithOverscan(const struct Render *re, float overscan, float r_winmat[4][4])
Definition: initrender.c:187
struct RenderLayer RenderLayer
bool RE_HasFloatPixels(const RenderResult *res)
void RE_FreePersistentData(const struct Scene *scene)
bool RE_layers_have_name(struct RenderResult *result)
Definition: pipeline.c:2567
void * RE_gpu_context_get(Render *re)
Definition: pipeline.c:932
void RE_AcquireResultImage(struct Render *re, struct RenderResult *rr, int view_id)
Definition: pipeline.c:428
void RE_display_update_cb(struct Render *re, void *handle, void(*f)(void *handle, RenderResult *rr, struct rcti *rect))
void * RE_gl_context_get(Render *re)
Definition: pipeline.c:927
void RE_render_result_full_channel_name(char *fullname, const char *layname, const char *passname, const char *viewname, const char *chan_id, int channel)
struct Scene * RE_GetScene(struct Render *re)
Definition: pipeline.c:358
void RE_ReleaseResult(struct Render *re)
Definition: pipeline.c:351
void RE_test_break_cb(struct Render *re, void *handle, int(*f)(void *handle))
Definition: pipeline.c:891
void RE_GetCameraWindow(struct Render *re, const struct Object *camera, float mat[4][4])
Definition: initrender.c:181
void RE_SetScene(struct Render *re, struct Scene *sce)
Definition: pipeline.c:366
struct RenderView * RE_RenderViewGetByName(struct RenderResult *rr, const char *viewname)
void RE_draw_lock_cb(struct Render *re, void *handle, void(*f)(void *handle, bool lock))
Definition: pipeline.c:885
struct RenderStats RenderStats
void RE_RenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct ViewLayer *single_layer, struct Object *camera_override, int frame, float subframe, bool write_still)
Definition: pipeline.c:1813
struct RenderLayer * RE_GetRenderLayer(struct RenderResult *rr, const char *name)
Definition: pipeline.c:244
bool RE_passes_have_name(struct RenderLayer *rl)
Definition: pipeline.c:2580
void RE_RenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, struct ViewLayer *single_layer, struct Object *camera_override, int sfra, int efra, int tfra)
Definition: pipeline.c:2142
void RE_FreeAllPersistentData(void)
Definition: pipeline.c:639
void RE_InitState(struct Render *re, struct Render *source, struct RenderData *rd, struct ListBase *render_layers, struct ViewLayer *single_layer, int winx, int winy, rcti *disprect)
Definition: pipeline.c:728
struct Render * RE_GetRender(const char *name)
Definition: pipeline.c:300
struct RenderResult * RE_MultilayerConvert(void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty)
Definition: pipeline.c:258
struct RenderResult * RE_AcquireResultWrite(struct Render *re)
Definition: pipeline.c:324
void RE_gl_context_destroy(Render *re)
Definition: pipeline.c:911
struct RenderResult RenderResult
void RE_ReleaseResultImage(struct Render *re)
Definition: pipeline.c:474
struct ImBuf * RE_render_result_rect_to_ibuf(struct RenderResult *rr, const struct ImageFormatData *imf, const float dither, int view_id)
void RE_SetActiveRenderView(struct Render *re, const char *viewname)
Definition: pipeline.c:1666
struct Render * RE_NewSceneRender(const struct Scene *scene)
void RE_InitRenderCB(struct Render *re)
Definition: pipeline.c:565
void RE_GetCameraModelMatrix(const struct Render *re, const struct Object *camera, float r_modelmat[4][4])
void RE_SwapResult(struct Render *re, struct RenderResult **rr)
Definition: pipeline.c:343
void RE_AcquiredResultGet32(struct Render *re, struct RenderResult *result, unsigned int *rect, int view_id)
Definition: pipeline.c:497
void RE_SetReports(struct Render *re, struct ReportList *reports)
Definition: pipeline.c:1753
void RE_ClearResult(struct Render *re)
Definition: pipeline.c:335
void RE_FreeRenderResult(struct RenderResult *rr)
Definition: pipeline.c:233
#define RE_MAXNAME
Definition: RE_pipeline.h:36
void RE_ReleaseResultImageViews(struct Render *re, struct RenderResult *rr)
Definition: pipeline.c:418
struct Render * RE_NewRender(const char *name)
Definition: pipeline.c:516
bool RE_WriteRenderViewsMovie(struct ReportList *reports, struct RenderResult *rr, struct Scene *scene, struct RenderData *rd, struct bMovieHandle *mh, void **movie_ctx_arr, int totvideos, bool preview)
Definition: pipeline.c:1954
bool RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode)
Definition: pipeline.c:2447
bool RE_allow_render_generic_object(struct Object *ob)
Definition: pipeline.c:2678
void RE_stats_draw_cb(struct Render *re, void *handle, void(*f)(void *handle, RenderStats *rs))
Definition: pipeline.c:874
void RE_gl_context_create(Render *re)
Definition: pipeline.c:903
bool RE_is_rendering_allowed(struct Scene *scene, struct ViewLayer *single_layer, struct Object *camera_override, struct ReportList *reports)
Definition: pipeline.c:1596
void RE_display_clear_cb(struct Render *re, void *handle, void(*f)(void *handle, RenderResult *rr))
Definition: pipeline.c:857
void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene)
Definition: pipeline.c:2421
struct RenderView RenderView
void RE_create_render_pass(struct RenderResult *rr, const char *name, int channels, const char *chan_id, const char *layername, const char *viewname, bool allocate)
void RE_GetViewPlane(struct Render *re, rctf *r_viewplane, rcti *r_disprect)
Definition: initrender.c:210
bool RE_HasCombinedLayer(const RenderResult *res)
struct RenderPass * RE_create_gp_pass(struct RenderResult *rr, const char *layername, const char *viewname)
Definition: pipeline.c:2646
struct RenderStats * RE_GetStats(struct Render *re)
Definition: pipeline.c:511
void RE_render_result_rect_from_ibuf(struct RenderResult *rr, const struct ImBuf *ibuf, int view_id)
float * RE_RenderLayerGetPass(struct RenderLayer *rl, const char *name, const char *viewname)
Definition: pipeline.c:238
void RE_FreeAllRender(void)
Definition: pipeline.c:614
bool RE_HasSingleLayer(struct Render *re)
Definition: pipeline.c:253
struct RenderView * RE_RenderViewGetById(struct RenderResult *rr, int view_id)
struct RenderPass * RE_pass_find_by_name(struct RenderLayer *rl, const char *name, const char *viewname)
Definition: pipeline.c:2591
void RE_display_init_cb(struct Render *re, void *handle, void(*f)(void *handle, RenderResult *rr))
Definition: pipeline.c:852
struct RenderPass RenderPass
void RE_AcquireResultImageViews(struct Render *re, struct RenderResult *rr)
Definition: pipeline.c:373
void RE_SetCamera(struct Render *re, const struct Object *cam_ob)
float RE_filter_value(int type, float x)
Definition: initrender.c:108
void RE_FreeAllRenderResults(void)
Definition: pipeline.c:626
struct RenderPass * RE_pass_find_by_type(struct RenderLayer *rl, int passtype, const char *viewname)
Definition: pipeline.c:2608
int RE_seq_render_active(struct Scene *scene, struct RenderData *rd)
Definition: pipeline.c:1264
void RE_SetOverrideCamera(struct Render *re, struct Object *cam_ob)
Definition: initrender.c:156
const char * RE_GetActiveRenderView(struct Render *re)
Definition: pipeline.c:1671
bool RE_RenderResult_is_stereo(const RenderResult *res)
void RE_progress_cb(struct Render *re, void *handle, void(*f)(void *handle, float))
Definition: pipeline.c:879
struct RenderResult * RE_AcquireResultRead(struct Render *re)
Definition: pipeline.c:314
RenderResult * RE_DuplicateRenderResult(RenderResult *rr)
void RE_init_threadcount(Render *re)
Definition: pipeline.c:2690
struct Render * RE_GetSceneRender(const struct Scene *scene)
volatile int lock
Scene scene
static const pxr::TfToken preview("preview", pxr::TfToken::Immortal)
float dither
Definition: BKE_main.h:121
ListBase passes
Definition: RE_pipeline.h:95
char name[RE_MAXNAME]
Definition: RE_pipeline.h:87
struct RenderLayer * next
Definition: RE_pipeline.h:84
void * exrhandle
Definition: RE_pipeline.h:93
struct RenderLayer * prev
Definition: RE_pipeline.h:84
char chan_id[8]
Definition: RE_pipeline.h:66
char name[64]
Definition: RE_pipeline.h:65
char fullname[64]
Definition: RE_pipeline.h:70
char view[64]
Definition: RE_pipeline.h:71
int channels
Definition: RE_pipeline.h:64
float * rect
Definition: RE_pipeline.h:67
struct RenderPass * prev
Definition: RE_pipeline.h:63
struct RenderPass * next
Definition: RE_pipeline.h:63
struct RenderResult * next
Definition: RE_pipeline.h:100
ListBase views
Definition: RE_pipeline.h:125
short sample_nr
Definition: RE_pipeline.h:104
ListBase layers
Definition: RE_pipeline.h:122
float * rectz
Definition: RE_pipeline.h:114
struct RenderResult * prev
Definition: RE_pipeline.h:100
char * error
Definition: RE_pipeline.h:139
struct StampData * stamp_data
Definition: RE_pipeline.h:141
float * rectf
Definition: RE_pipeline.h:112
bool passes_allocated
Definition: RE_pipeline.h:143
RenderLayer * renlay
Definition: RE_pipeline.h:129
const char * statstr
Definition: RE_pipeline.h:150
char scene_name[MAX_ID_NAME - 2]
Definition: RE_pipeline.h:151
float mem_peak
Definition: RE_pipeline.h:152
double starttime
Definition: RE_pipeline.h:149
float mem_used
Definition: RE_pipeline.h:152
double lastframetime
Definition: RE_pipeline.h:149
const char * infostr
Definition: RE_pipeline.h:150
bool localview
Definition: RE_pipeline.h:148
struct RenderView * prev
Definition: RE_pipeline.h:50
float * rectf
Definition: RE_pipeline.h:54
float * rectz
Definition: RE_pipeline.h:56
int * rect32
Definition: RE_pipeline.h:58
struct RenderView * next
Definition: RE_pipeline.h:50
char name[64]
Definition: RE_pipeline.h:51
char name[RE_MAXNAME]
Definition: render_types.h:42