~ubuntu-branches/ubuntu/intrepid/blender/intrepid-updates

« back to all changes in this revision

Viewing changes to source/blender/render/intern/include/render_types.h

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-08-08 02:45:40 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080808024540-kkjp7ekfivzhuw3l
Tags: 2.46+dfsg-4
* Fix python syntax warning in import_dxf.py, which led to nasty output
  in installation/upgrade logs during byte-compilation, using a patch
  provided by the script author (Closes: #492280):
   - debian/patches/45_fix_python_syntax_warning

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: render_types.h,v 1.15 2006/07/13 10:26:35 ton Exp $
 
2
 * $Id: render_types.h 14853 2008-05-15 19:40:09Z blendix $
3
3
 *
4
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
32
32
/* exposed internal in render module only! */
33
33
/* ------------------------------------------------------------------------- */
34
34
 
 
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"
39
40
 
 
41
#include "BLI_threads.h"
 
42
 
40
43
#include "RE_pipeline.h"
41
44
#include "RE_shader_ext.h"      /* TexResult, ShadeResult, ShadeInput */
42
45
 
43
46
struct Object;
44
47
struct MemArena;
45
48
struct VertTableNode;
46
 
struct Octree;
 
49
struct VlakTableNode;
47
50
struct GHash;
 
51
struct RenderBuckets;
 
52
struct ObjectInstanceRen;
48
53
 
49
54
#define TABLEINITSIZE 1024
50
55
#define LAMPINITSIZE 256
51
 
                /* hardcoded maximum now, for optimize tables */
52
 
#define MAX_THREADS             2
53
56
 
54
57
typedef struct SampleTables
55
58
{
59
62
        
60
63
} SampleTables;
61
64
 
 
65
typedef struct QMCSampler
 
66
{
 
67
        struct QMCSampler *next, *prev;
 
68
        int type;
 
69
        int tot;
 
70
        int used;
 
71
        double *samp2d;
 
72
        double offs[BLENDER_MAX_THREADS][2];
 
73
} QMCSampler;
 
74
 
 
75
#define SAMP_TYPE_JITTERED              0
 
76
#define SAMP_TYPE_HALTON                1
 
77
#define SAMP_TYPE_HAMMERSLEY    2
 
78
 
62
79
/* this is handed over to threaded hiding/passes/shading engine */
63
80
typedef struct RenderPart
64
81
{
65
82
        struct RenderPart *next, *prev;
66
83
        
67
 
        /* result of part rendering */
68
 
        RenderResult *result;
 
84
        RenderResult *result;                   /* result of part rendering */
 
85
        ListBase fullresult;                    /* optional full sample buffers */
69
86
        
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 */
73
 
        
 
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 */
 
96
 
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 */
79
102
        
 
103
        char *clipflag;                                 /* clipflags for part zbuffering */
80
104
} RenderPart;
81
105
 
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;
87
 
        float min[3], max[3];
88
 
        int ocres;
89
 
        int branchcount, nodecount;
90
 
} Octree;
91
 
 
92
106
/* controls state of render, everything that's read-only during render stage */
93
107
struct Render
94
108
{
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 */
 
120
        ListBase fullresult;    
105
121
        
106
122
        /* window size, display rect, viewplane */
107
123
        int winx, winy;
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 */
111
128
        
112
129
        /* final picture width and height (within disprect) */
113
130
        int rectx, recty;
120
137
        
121
138
        /* values for viewing */
122
139
        float lens, ycor, viewfac;
123
 
        float bluroffsx, bluroffsy;
124
140
        float panophi, panosi, panoco, panodxp, panodxv;
125
141
        
126
142
        /* Matrices */
136
152
        /* samples */
137
153
        SampleTables *samples;
138
154
        float jit[32][2];
 
155
        ListBase *qmcsamplers;
 
156
        
 
157
        /* shadow counter, detect shadow-reuse for shaders */
 
158
        int shadowsamplenr[BLENDER_MAX_THREADS];
139
159
        
140
160
        /* scene, and its full copy of renderdata and world */
141
161
        Scene *scene;
145
165
        ListBase parts;
146
166
        
147
167
        /* octree tables and variables for raytrace */
148
 
        Octree oc;
 
168
        void *raytree;
 
169
 
 
170
        /* occlusion tree */
 
171
        void *occlusiontree;
 
172
        ListBase strandsurface;
149
173
        
150
174
        /* use this instead of R.r.cfra */
151
175
        float cfra;     
152
176
        
153
177
        /* render database */
154
 
        int totvlak, totvert, tothalo, totlamp;
155
 
        ListBase lights;
 
178
        int totvlak, totvert, tothalo, totstrand, totlamp;
 
179
        struct HaloRen **sortedhalos;
 
180
 
 
181
        ListBase lights;        /* GroupObject pointers */
 
182
        ListBase lampren;       /* storage, for free */
156
183
        
157
 
        int vertnodeslen;
158
 
        struct VertTableNode *vertnodes;
159
 
        int blohalen;
160
 
        struct HaloRen **bloha;
161
 
        int blovllen;
162
 
        struct VlakRen **blovl;
163
184
        ListBase objecttable;
164
 
        
165
 
        struct Image *backbuf;
 
185
 
 
186
        struct ObjectInstanceRen *objectinstance;
 
187
        ListBase instancetable;
 
188
        int totinstance;
 
189
 
 
190
        struct Image *backbuf, *bakebuf;
166
191
        
167
192
        struct GHash *orco_hash;
168
193
 
 
194
        struct GHash *sss_hash;
 
195
        ListBase *sss_points;
 
196
        struct Material *sss_mat;
 
197
 
 
198
        ListBase customdata_names;
 
199
 
 
200
        struct Object *excludeob;
 
201
 
169
202
        /* arena for allocating data for use during render, for
170
203
                * example dynamic TFaces to go in the VlakRen structure.
171
204
                */
188
221
 
189
222
/* ------------------------------------------------------------------------- */
190
223
 
 
224
struct ISBData;
 
225
 
191
226
typedef struct ShadSampleBuf {
192
227
        struct ShadSampleBuf *next, *prev;
193
228
        long *zbuf;
195
230
} ShadSampleBuf;
196
231
 
197
232
typedef struct ShadBuf {
 
233
        /* regular shadowbuffer */
198
234
        short samp, shadhalostep, totbuf;
199
235
        float persmat[4][4];
200
236
        float viewmat[4][4];
204
240
        int co[3];
205
241
        int size, bias;
206
242
        ListBase buffers;
 
243
        
 
244
        /* irregular shadowbufer, result stored per thread */
 
245
        struct ISBData *isb_result[BLENDER_MAX_THREADS];
207
246
} ShadBuf;
208
247
 
209
248
/* ------------------------------------------------------------------------- */
210
 
/* lookup of objects in database */
 
249
 
211
250
typedef struct ObjectRen {
212
251
        struct ObjectRen *next, *prev;
213
252
        struct Object *ob, *par;
214
 
        int index, startvert, endvert, startface, endface;
 
253
        struct Scene *sce;
 
254
        int index, psysindex, flag, lay;
 
255
 
 
256
        float boundbox[2][3];
 
257
 
 
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;
 
265
 
 
266
        char (*mtface)[32];
 
267
        char (*mcol)[32];
 
268
        int  actmtface, actmcol, bakemtface;
 
269
 
 
270
        float obmat[4][4];      /* only used in convertblender.c, for instancing */
 
271
} ObjectRen;
 
272
 
 
273
typedef struct ObjectInstanceRen {
 
274
        struct ObjectInstanceRen *next, *prev;
 
275
 
 
276
        ObjectRen *obr;
 
277
        Object *ob, *par;
 
278
        int index, psysindex, lay;
 
279
 
 
280
        float mat[4][4], nmat[3][3]; /* nmat is inverse mat tranposed */
 
281
        short flag;
 
282
 
 
283
        float dupliorco[3], dupliuv[2];
 
284
        float (*duplitexmat)[4];
 
285
 
215
286
        float *vectors;
216
 
} ObjectRen;
 
287
        int totvector;
 
288
} ObjectInstanceRen;
217
289
 
218
290
/* ------------------------------------------------------------------------- */
219
291
 
221
293
{
222
294
        float co[3];
223
295
        float n[3];
224
 
        float ho[4];
225
296
        float *orco;
226
 
        short clip;     
 
297
        short clip;
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 */
238
309
 
239
310
/* ------------------------------------------------------------------------- */
240
311
struct Material;
241
 
struct TFace;
 
312
struct MTFace;
242
313
 
243
314
typedef struct RadFace {
244
315
        float unshot[3], totrad[3];
246
317
        int flag;
247
318
} RadFace;
248
319
 
249
 
typedef struct VlakRen
250
 
{
251
 
        struct VertRen *v1, *v2, *v3, *v4;
252
 
        unsigned int lay;
 
320
typedef struct VlakRen {
 
321
        struct VertRen *v1, *v2, *v3, *v4;      /* keep in order for ** addressing */
253
322
        float n[3];
254
323
        struct Material *mat;
255
 
        struct TFace *tface;
256
 
        unsigned int *vcol;
257
 
        char snproj, puno;
 
324
        char puno;
258
325
        char flag, ec;
259
 
        RadFace *radface;
260
 
        Object *ob;
 
326
        int index;
261
327
} VlakRen;
262
328
 
263
329
typedef struct HaloRen
276
342
    struct Material *mat;
277
343
} HaloRen;
278
344
 
 
345
/* ------------------------------------------------------------------------- */
 
346
 
 
347
typedef struct StrandVert {
 
348
        float co[3];
 
349
        float strandco;
 
350
} StrandVert;
 
351
 
 
352
typedef struct StrandSurface {
 
353
        struct StrandSurface *next, *prev;
 
354
        ObjectRen obr;
 
355
        int (*face)[4];
 
356
        float (*co)[3];
 
357
        /* for occlusion caching */
 
358
        float (*col)[3];
 
359
        /* for speedvectors */
 
360
        float (*prevco)[3], (*nextco)[3];
 
361
        int totvert, totface;
 
362
} StrandSurface;
 
363
 
 
364
typedef struct StrandBound {
 
365
        int start, end;
 
366
        float boundbox[2][3];
 
367
} StrandBound;
 
368
 
 
369
typedef struct StrandBuffer {
 
370
        struct StrandBuffer *next, *prev;
 
371
        struct StrandVert *vert;
 
372
        struct StrandBound *bound;
 
373
        int totvert, totbound;
 
374
 
 
375
        struct ObjectRen *obr;
 
376
        struct Material *ma;
 
377
        struct StrandSurface *surface;
 
378
        unsigned int lay;
 
379
        int overrideuv;
 
380
        int flag, maxdepth;
 
381
        float adaptcos, minwidth, widthfade;
 
382
 
 
383
        float winmat[4][4];
 
384
        int winx, winy;
 
385
} StrandBuffer;
 
386
 
 
387
typedef struct StrandRen {
 
388
        StrandVert *vert;
 
389
        StrandBuffer *buffer;
 
390
        int totvert, flag;
 
391
        int clip, index;
 
392
        float orco[3];
 
393
} StrandRen;
 
394
 
 
395
 
279
396
struct LampRen;
280
397
struct MTex;
281
398
 
283
400
 * For each lamp in a scene, a LampRen is created. It determines the
284
401
 * properties of a lightsource.
285
402
 */
286
 
typedef struct LampRen
287
 
{
 
403
 
 
404
typedef struct LampShadowSubSample {
 
405
        int samplenr;
 
406
        float shadfac[4];       /* rgba shadow */
 
407
} LampShadowSubSample;
 
408
 
 
409
typedef struct LampShadowSample {
 
410
        LampShadowSubSample s[16];      /* MAX OSA */
 
411
} LampShadowSample;
 
412
 
 
413
typedef struct LampRen {
 
414
        struct LampRen *next, *prev;
 
415
        
288
416
        float xs, ys, dist;
289
417
        float co[3];
290
418
        short type, mode;
295
423
        float vec[3];
296
424
        float xsp, ysp, distkw, inpr;
297
425
        float halokw, halo;
 
426
        
 
427
        short falloff_type;
298
428
        float ld1,ld2;
 
429
        struct CurveMapping *curfalloff;
299
430
 
300
431
        /* copied from Lamp, to decouple more rendering stuff */
301
432
        /** Size of the shadowbuffer */
304
435
        short samp;
305
436
        /** Softness factor for shadow */
306
437
        float soft;
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) */
 
441
        short buftype;
 
442
        /** autoclip */
 
443
        short bufflag;
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. */
316
451
        float bias;
317
452
        
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;
321
 
        
 
456
        float adapt_thresh;
 
457
 
322
458
        struct ShadBuf *shb;
323
459
        float *jitter;
324
460
        
329
465
        float mat[3][3];        /* 3x3 part from lampmat x viewmat */
330
466
        float area[8][3], areasize;
331
467
        
 
468
        /* passes & node shader support: all shadow info for a pixel */
 
469
        LampShadowSample *shadsamp;
 
470
                
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;
338
477
        
339
478
        /* ray optim */
340
 
        VlakRen *vlr_last[MAX_THREADS];
 
479
        VlakRen *vlr_last[BLENDER_MAX_THREADS];
 
480
        ObjectInstanceRen *obi_last[BLENDER_MAX_THREADS];
341
481
        
342
482
        struct MTex *mtex[MAX_MTEX];
 
483
 
 
484
        /* threading */
 
485
        int thread_assigned;
 
486
        int thread_ready;
343
487
} LampRen;
344
488
 
345
489
/* **************** defines ********************* */
351
495
#define R_HALO                  2
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
354
502
 
355
503
/* vlakren->flag (vlak = face in dutch) char!!! */
356
504
#define R_SMOOTH                1
357
 
#define R_VISIBLE               2
 
505
#define R_HIDDEN                2
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             
367
515
 
368
 
 
369
 
 
370
 
 
 
516
/* strandbuffer->flag */
 
517
#define R_STRAND_BSPLINE        1
 
518
#define R_STRAND_B_UNITS        2
 
519
 
 
520
/* objectren->flag */
 
521
#define R_INSTANCEABLE          1
 
522
 
 
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
371
528
 
372
529
#endif /* RENDER_TYPES_H */
373
530