32
32
/* exposed internal in render module only! */
33
33
/* ------------------------------------------------------------------------- */
35
#include "DNA_color_types.h"
35
36
#include "DNA_scene_types.h"
36
37
#include "DNA_world_types.h"
37
38
#include "DNA_object_types.h"
38
39
#include "DNA_vec_types.h"
41
#include "BLI_threads.h"
40
43
#include "RE_pipeline.h"
41
44
#include "RE_shader_ext.h" /* TexResult, ShadeResult, ShadeInput */
45
48
struct VertTableNode;
52
struct ObjectInstanceRen;
49
54
#define TABLEINITSIZE 1024
50
55
#define LAMPINITSIZE 256
51
/* hardcoded maximum now, for optimize tables */
54
57
typedef struct SampleTables
65
typedef struct QMCSampler
67
struct QMCSampler *next, *prev;
72
double offs[BLENDER_MAX_THREADS][2];
75
#define SAMP_TYPE_JITTERED 0
76
#define SAMP_TYPE_HALTON 1
77
#define SAMP_TYPE_HAMMERSLEY 2
62
79
/* this is handed over to threaded hiding/passes/shading engine */
63
80
typedef struct RenderPart
65
82
struct RenderPart *next, *prev;
67
/* result of part rendering */
84
RenderResult *result; /* result of part rendering */
85
ListBase fullresult; /* optional full sample buffers */
70
int *rectp; /* polygon index table */
87
int *recto; /* object table for objects */
88
int *rectp; /* polygon index table */
71
89
int *rectz; /* zbuffer */
90
int *rectmask; /* negative zmask */
72
91
long *rectdaps; /* delta acum buffer for pixel structs */
92
int *rectbacko; /* object table for backside sss */
93
int *rectbackp; /* polygon index table for backside sss */
94
int *rectbackz; /* zbuffer for backside sss */
95
long *rectall; /* buffer for all faces for sss */
74
97
rcti disprect; /* part coordinates within total picture */
75
98
int rectx, recty; /* the size */
76
99
short crop, ready; /* crop is amount of pixels we crop, for filter */
77
100
short sample, nr; /* sample can be used by zbuffers, nr is partnr */
78
101
short thread; /* thread id */
103
char *clipflag; /* clipflags for part zbuffering */
82
typedef struct Octree {
83
struct Branch **adrbranch;
84
struct Node **adrnode;
85
float ocsize; /* ocsize: mult factor, max size octree */
86
float ocfacx,ocfacy,ocfacz;
89
int branchcount, nodecount;
92
106
/* controls state of render, everything that's read-only during render stage */
102
116
RenderResult *result;
103
117
/* if render with single-layer option, other rendered layers are stored here */
104
118
RenderResult *pushedresult;
119
/* a list of RenderResults, for fullsample */
106
122
/* window size, display rect, viewplane */
108
124
rcti disprect; /* part within winx winy */
109
125
rctf viewplane; /* mapped on winx winy */
110
126
float viewdx, viewdy; /* size of 1 pixel */
127
float clipcrop; /* 2 pixel boundary to prevent clip when filter used */
112
129
/* final picture width and height (within disprect) */
113
130
int rectx, recty;
121
138
/* values for viewing */
122
139
float lens, ycor, viewfac;
123
float bluroffsx, bluroffsy;
124
140
float panophi, panosi, panoco, panodxp, panodxv;
147
167
/* octree tables and variables for raytrace */
172
ListBase strandsurface;
150
174
/* use this instead of R.r.cfra */
153
177
/* render database */
154
int totvlak, totvert, tothalo, totlamp;
178
int totvlak, totvert, tothalo, totstrand, totlamp;
179
struct HaloRen **sortedhalos;
181
ListBase lights; /* GroupObject pointers */
182
ListBase lampren; /* storage, for free */
158
struct VertTableNode *vertnodes;
160
struct HaloRen **bloha;
162
struct VlakRen **blovl;
163
184
ListBase objecttable;
165
struct Image *backbuf;
186
struct ObjectInstanceRen *objectinstance;
187
ListBase instancetable;
190
struct Image *backbuf, *bakebuf;
167
192
struct GHash *orco_hash;
194
struct GHash *sss_hash;
195
ListBase *sss_points;
196
struct Material *sss_mat;
198
ListBase customdata_names;
200
struct Object *excludeob;
169
202
/* arena for allocating data for use during render, for
170
203
* example dynamic TFaces to go in the VlakRen structure.
206
242
ListBase buffers;
244
/* irregular shadowbufer, result stored per thread */
245
struct ISBData *isb_result[BLENDER_MAX_THREADS];
209
248
/* ------------------------------------------------------------------------- */
210
/* lookup of objects in database */
211
250
typedef struct ObjectRen {
212
251
struct ObjectRen *next, *prev;
213
252
struct Object *ob, *par;
214
int index, startvert, endvert, startface, endface;
254
int index, psysindex, flag, lay;
256
float boundbox[2][3];
258
int totvert, totvlak, totstrand, tothalo;
259
int vertnodeslen, vlaknodeslen, strandnodeslen, blohalen;
260
struct VertTableNode *vertnodes;
261
struct VlakTableNode *vlaknodes;
262
struct StrandTableNode *strandnodes;
263
struct HaloRen **bloha;
264
struct StrandBuffer *strandbuf;
268
int actmtface, actmcol, bakemtface;
270
float obmat[4][4]; /* only used in convertblender.c, for instancing */
273
typedef struct ObjectInstanceRen {
274
struct ObjectInstanceRen *next, *prev;
278
int index, psysindex, lay;
280
float mat[4][4], nmat[3][3]; /* nmat is inverse mat tranposed */
283
float dupliorco[3], dupliuv[2];
284
float (*duplitexmat)[4];
218
290
/* ------------------------------------------------------------------------- */
227
298
unsigned short flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c */
228
299
float accum; /* accum for radio weighting, and for strand texco static particles */
229
300
int index; /* index allows extending vertren with any property */
249
typedef struct VlakRen
251
struct VertRen *v1, *v2, *v3, *v4;
320
typedef struct VlakRen {
321
struct VertRen *v1, *v2, *v3, *v4; /* keep in order for ** addressing */
254
323
struct Material *mat;
263
329
typedef struct HaloRen
276
342
struct Material *mat;
345
/* ------------------------------------------------------------------------- */
347
typedef struct StrandVert {
352
typedef struct StrandSurface {
353
struct StrandSurface *next, *prev;
357
/* for occlusion caching */
359
/* for speedvectors */
360
float (*prevco)[3], (*nextco)[3];
361
int totvert, totface;
364
typedef struct StrandBound {
366
float boundbox[2][3];
369
typedef struct StrandBuffer {
370
struct StrandBuffer *next, *prev;
371
struct StrandVert *vert;
372
struct StrandBound *bound;
373
int totvert, totbound;
375
struct ObjectRen *obr;
377
struct StrandSurface *surface;
381
float adaptcos, minwidth, widthfade;
387
typedef struct StrandRen {
389
StrandBuffer *buffer;
283
400
* For each lamp in a scene, a LampRen is created. It determines the
284
401
* properties of a lightsource.
286
typedef struct LampRen
404
typedef struct LampShadowSubSample {
406
float shadfac[4]; /* rgba shadow */
407
} LampShadowSubSample;
409
typedef struct LampShadowSample {
410
LampShadowSubSample s[16]; /* MAX OSA */
413
typedef struct LampRen {
414
struct LampRen *next, *prev;
288
416
float xs, ys, dist;
290
418
short type, mode;
296
424
float xsp, ysp, distkw, inpr;
297
425
float halokw, halo;
429
struct CurveMapping *curfalloff;
300
431
/* copied from Lamp, to decouple more rendering stuff */
301
432
/** Size of the shadowbuffer */
305
436
/** Softness factor for shadow */
307
/** amount of subsample buffers */
438
/** amount of subsample buffers and type of filter for sampling */
308
439
short buffers, filtertype;
440
/** shadow buffer type (regular, irregular) */
309
444
/** shadow plus halo: detail level */
310
445
short shadhalostep;
311
446
/** Near clip of the lamp */
315
450
/** A small depth offset to prevent self-shadowing. */
318
short ray_samp, ray_sampy, ray_sampz, ray_samp_type, area_shape, ray_totsamp;
319
short xold1, yold1, xold2, yold2; /* last jitter table for area lights */
453
short ray_samp, ray_sampy, ray_sampz, ray_samp_method, ray_samp_type, area_shape, ray_totsamp;
454
short xold[BLENDER_MAX_THREADS], yold[BLENDER_MAX_THREADS]; /* last jitter table for area lights */
320
455
float area_size, area_sizey, area_sizez;
322
458
struct ShadBuf *shb;
329
465
float mat[3][3]; /* 3x3 part from lampmat x viewmat */
330
466
float area[8][3], areasize;
468
/* passes & node shader support: all shadow info for a pixel */
469
LampShadowSample *shadsamp;
332
471
/* yafray: photonlight params */
333
472
int YF_numphotons, YF_numsearch;
334
473
short YF_phdepth, YF_useqmc, YF_bufsize;
337
476
short YF_glowtype;
340
VlakRen *vlr_last[MAX_THREADS];
479
VlakRen *vlr_last[BLENDER_MAX_THREADS];
480
ObjectInstanceRen *obi_last[BLENDER_MAX_THREADS];
342
482
struct MTex *mtex[MAX_MTEX];
345
489
/* **************** defines ********************* */
352
496
#define R_SEC_FIELD 4
353
497
#define R_LAMPHALO 8
498
#define R_GLOB_NOPUNOFLIP 16
499
#define R_NEED_TANGENT 32
500
#define R_SKIP_MULTIRES 64
501
#define R_BAKE_TRACE 128
355
503
/* vlakren->flag (vlak = face in dutch) char!!! */
356
504
#define R_SMOOTH 1
358
506
/* strand flag, means special handling */
359
507
#define R_STRAND 4
360
508
#define R_NOPUNOFLIP 8
365
513
/* vertex normals are tangent or view-corrected vector, for hair strands */
366
514
#define R_TANGENT 128
516
/* strandbuffer->flag */
517
#define R_STRAND_BSPLINE 1
518
#define R_STRAND_B_UNITS 2
520
/* objectren->flag */
521
#define R_INSTANCEABLE 1
523
/* objectinstance->flag */
524
#define R_DUPLI_TRANSFORMED 1
525
#define R_ENV_TRANSFORMED 2
526
#define R_TRANSFORMED (1|2)
527
#define R_NEED_VECTORS 4
372
529
#endif /* RENDER_TYPES_H */