~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/nodes/composite/nodes/node_composite_glare.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include "node_composite_util.h"
34
34
 
35
 
static bNodeSocketTemplate cmp_node_glare_in[]= {
36
 
        {       SOCK_RGBA, 1, "Image",                  1.0f, 1.0f, 1.0f, 1.0f},
37
 
        {       -1, 0, ""       }
38
 
};
39
 
static bNodeSocketTemplate cmp_node_glare_out[]= {
40
 
        {       SOCK_RGBA, 0, "Image"},
41
 
        {       -1, 0, ""       }
42
 
};
43
 
 
44
 
 
45
 
// mix two images, src buffer does not have to be same size,
46
 
static void mixImages(CompBuf *dst, CompBuf *src, float mix)
47
 
{
48
 
        int x, y;
49
 
        fRGB c1, c2, *dcolp, *scolp;
50
 
        const float mf = 2.f - 2.f*fabsf(mix - 0.5f);
51
 
        if ((dst->x == src->x) && (dst->y == src->y)) {
52
 
                for (y=0; y<dst->y; y++) {
53
 
                        dcolp = (fRGB*)&dst->rect[y*dst->x*dst->type];
54
 
                        scolp = (fRGB*)&src->rect[y*dst->x*dst->type];
55
 
                        for (x=0; x<dst->x; x++) {
56
 
                                fRGB_copy(c1, dcolp[x]);
57
 
                                fRGB_copy(c2, scolp[x]);
58
 
                                c1[0] += mix*(c2[0] - c1[0]);
59
 
                                c1[1] += mix*(c2[1] - c1[1]);
60
 
                                c1[2] += mix*(c2[2] - c1[2]);
61
 
                                if (c1[0] < 0.f) c1[0] = 0.f;
62
 
                                if (c1[1] < 0.f) c1[1] = 0.f;
63
 
                                if (c1[2] < 0.f) c1[2] = 0.f;
64
 
                                fRGB_mult(c1, mf);
65
 
                                fRGB_copy(dcolp[x], c1);
66
 
                        }
67
 
                }
68
 
        }
69
 
        else {
70
 
                float xr = src->x / (float)dst->x;
71
 
                float yr = src->y / (float)dst->y;
72
 
                for (y=0; y<dst->y; y++) {
73
 
                        dcolp = (fRGB*)&dst->rect[y*dst->x*dst->type];
74
 
                        for (x=0; x<dst->x; x++) {
75
 
                                fRGB_copy(c1, dcolp[x]);
76
 
                                qd_getPixelLerp(src, (x + 0.5f)*xr - 0.5f, (y + 0.5f)*yr - 0.5f, c2);
77
 
                                c1[0] += mix*(c2[0] - c1[0]);
78
 
                                c1[1] += mix*(c2[1] - c1[1]);
79
 
                                c1[2] += mix*(c2[2] - c1[2]);
80
 
                                if (c1[0] < 0.f) c1[0] = 0.f;
81
 
                                if (c1[1] < 0.f) c1[1] = 0.f;
82
 
                                if (c1[2] < 0.f) c1[2] = 0.f;
83
 
                                fRGB_mult(c1, mf);
84
 
                                fRGB_copy(dcolp[x], c1);
85
 
                        }
86
 
                }
87
 
        }
88
 
}
89
 
 
90
 
 
91
 
// adds src to dst image, must be of same size
92
 
static void addImage(CompBuf* dst, CompBuf* src, float scale)
93
 
{
94
 
        if ((dst->x == src->x) && (dst->y == src->y)) {
95
 
                int p = dst->x*dst->y*dst->type;
96
 
                float *dcol = dst->rect, *scol = src->rect;
97
 
                while (p--) *dcol++ += *scol++ * scale;
98
 
        }
99
 
}
100
 
 
101
 
 
102
 
// returns possibly downscaled copy of all pixels above threshold
103
 
static CompBuf* BTP(CompBuf* src, float threshold, int scaledown)
104
 
{
105
 
        int x, y;
106
 
        CompBuf* bsrc = qd_downScaledCopy(src, scaledown);
107
 
        float* cr = bsrc->rect;
108
 
        for (y=0; y<bsrc->y; ++y)
109
 
                for (x=0; x<bsrc->x; ++x, cr+=4) {
110
 
                        if ((0.212671f*cr[0] + 0.71516f*cr[1] + 0.072169f*cr[2]) >= threshold) {
111
 
                                cr[0] -= threshold, cr[1] -= threshold, cr[2] -= threshold;
112
 
                                cr[0] = MAX2(cr[0], 0.f);
113
 
                                cr[1] = MAX2(cr[1], 0.f);
114
 
                                cr[2] = MAX2(cr[2], 0.f);
115
 
                        }
116
 
                        else cr[0] = cr[1] = cr[2] = 0.f;
117
 
                }
118
 
        return bsrc;
119
 
}
120
 
 
121
 
//--------------------------------------------------------------------------------------------
122
 
// simple 4-point star filter
123
 
 
124
 
static void star4(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
125
 
{
126
 
        int x, y, i, xm, xp, ym, yp;
127
 
        float c[4] = {0,0,0,0}, tc[4] = {0,0,0,0};
128
 
        CompBuf *tbuf1, *tbuf2, *tsrc;
129
 
        const float f1 = 1.f - ndg->fade, f2 = (1.f - f1)*0.5f;
130
 
        //const float t3 = ndg->threshold*3.f;
131
 
        const float sc = (float)(1 << ndg->quality);
132
 
        const float isc = 1.f/sc;
133
 
 
134
 
        tsrc = BTP(src, ndg->threshold, (int)sc);
135
 
 
136
 
        tbuf1 = dupalloc_compbuf(tsrc);
137
 
        tbuf2 = dupalloc_compbuf(tsrc);
138
 
 
139
 
        for (i=0; i<ndg->iter; i++) {
140
 
                // (x || x-1, y-1) to (x || x+1, y+1)
141
 
                // F
142
 
                for (y=0; y<tbuf1->y; y++) {
143
 
                        ym = y - i;
144
 
                        yp = y + i;
145
 
                        for (x=0; x<tbuf1->x; x++) {
146
 
                                xm = x - i;
147
 
                                xp = x + i;
148
 
                                qd_getPixel(tbuf1, x, y, c);
149
 
                                fRGB_mult(c, f1);
150
 
                                qd_getPixel(tbuf1, (ndg->angle ? xm : x), ym, tc);
151
 
                                fRGB_madd(c, tc, f2);
152
 
                                qd_getPixel(tbuf1, (ndg->angle ? xp : x), yp, tc);
153
 
                                fRGB_madd(c, tc, f2);
154
 
                                qd_setPixel(tbuf1, x, y, c);
155
 
                        }
156
 
                }
157
 
                // B
158
 
                for (y=tbuf1->y-1; y>=0; y--) {
159
 
                        ym = y - i;
160
 
                        yp = y + i;
161
 
                        for (x=tbuf1->x-1; x>=0; x--) {
162
 
                                xm = x - i;
163
 
                                xp = x + i;
164
 
                                qd_getPixel(tbuf1, x, y, c);
165
 
                                fRGB_mult(c, f1);
166
 
                                qd_getPixel(tbuf1, (ndg->angle ? xm : x), ym, tc);
167
 
                                fRGB_madd(c, tc, f2);
168
 
                                qd_getPixel(tbuf1, (ndg->angle ? xp : x), yp, tc);
169
 
                                fRGB_madd(c, tc, f2);
170
 
                                qd_setPixel(tbuf1, x, y, c);
171
 
                        }
172
 
                }
173
 
                // (x-1, y || y+1) to (x+1, y || y-1)
174
 
                // F
175
 
                for (y=0; y<tbuf2->y; y++) {
176
 
                        ym = y - i;
177
 
                        yp = y + i;
178
 
                        for (x=0; x<tbuf2->x; x++) {
179
 
                                xm = x - i;
180
 
                                xp = x + i;
181
 
                                qd_getPixel(tbuf2, x, y, c);
182
 
                                fRGB_mult(c, f1);
183
 
                                qd_getPixel(tbuf2, xm, (ndg->angle ? yp : y), tc);
184
 
                                fRGB_madd(c, tc, f2);
185
 
                                qd_getPixel(tbuf2, xp, (ndg->angle ? ym : y), tc);
186
 
                                fRGB_madd(c, tc, f2);
187
 
                                qd_setPixel(tbuf2, x, y, c);
188
 
                        }
189
 
                }
190
 
                // B
191
 
                for (y=tbuf2->y-1; y>=0; y--) {
192
 
                        ym = y - i;
193
 
                        yp = y + i;
194
 
                        for (x=tbuf2->x-1; x>=0; x--) {
195
 
                                xm = x - i;
196
 
                                xp = x + i;
197
 
                                qd_getPixel(tbuf2, x, y, c);
198
 
                                fRGB_mult(c, f1);
199
 
                                qd_getPixel(tbuf2, xm, (ndg->angle ? yp : y), tc);
200
 
                                fRGB_madd(c, tc, f2);
201
 
                                qd_getPixel(tbuf2, xp, (ndg->angle ? ym : y), tc);
202
 
                                fRGB_madd(c, tc, f2);
203
 
                                qd_setPixel(tbuf2, x, y, c);
204
 
                        }
205
 
                }
206
 
        }
207
 
 
208
 
        for (y=0; y<tbuf1->y; ++y)
209
 
                for (x=0; x<tbuf1->x; ++x) {
210
 
                        unsigned int p = (x + y*tbuf1->x)*tbuf1->type;
211
 
                        tbuf1->rect[p] += tbuf2->rect[p];
212
 
                        tbuf1->rect[p+1] += tbuf2->rect[p+1];
213
 
                        tbuf1->rect[p+2] += tbuf2->rect[p+2];
214
 
                }
215
 
 
216
 
        for (y=0; y<dst->y; ++y) {
217
 
                const float m = 0.5f + 0.5f*ndg->mix;
218
 
                for (x=0; x<dst->x; ++x) {
219
 
                        unsigned int p = (x + y*dst->x)*dst->type;
220
 
                        qd_getPixelLerp(tbuf1, x*isc, y*isc, tc);
221
 
                        dst->rect[p] = src->rect[p] + m*(tc[0] - src->rect[p]);
222
 
                        dst->rect[p+1] = src->rect[p+1] + m*(tc[1] - src->rect[p+1]);
223
 
                        dst->rect[p+2] = src->rect[p+2] + m*(tc[2] - src->rect[p+2]);
224
 
                }
225
 
        }
226
 
 
227
 
        free_compbuf(tbuf1);
228
 
        free_compbuf(tbuf2);
229
 
        free_compbuf(tsrc);
230
 
}
231
 
 
232
 
//--------------------------------------------------------------------------------------------
233
 
// streak filter
234
 
 
235
 
static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
236
 
{
237
 
        CompBuf *bsrc, *tsrc, *tdst, *sbuf;
238
 
        int x, y, n;
239
 
        unsigned int nump=0;
240
 
        fRGB c1, c2, c3, c4;
241
 
        float a, ang = DEG2RADF(360.0f)/(float)ndg->angle;
242
 
 
243
 
        bsrc = BTP(src, ndg->threshold, 1 << ndg->quality);
244
 
        tsrc = dupalloc_compbuf(bsrc); // sample from buffer
245
 
        tdst = alloc_compbuf(tsrc->x, tsrc->y, tsrc->type, 1); // sample to buffer
246
 
        sbuf = alloc_compbuf(tsrc->x, tsrc->y, tsrc->type, 1);  // streak sum buffer
247
 
 
248
 
        
249
 
        for (a=0.f; a<DEG2RADF(360.0f); a+=ang) {
250
 
                const float an = a + ndg->angle_ofs;
251
 
                const float vx = cos((double)an), vy = sin((double)an);
252
 
                for (n=0; n<ndg->iter; ++n) {
253
 
                        const float p4 = pow(4.0, (double)n);
254
 
                        const float vxp = vx*p4, vyp = vy*p4;
255
 
                        const float wt = pow((double)ndg->fade, (double)p4);
256
 
                        const float cmo = 1.f - (float)pow((double)ndg->colmod, (double)n+1);   // colormodulation amount relative to current pass
257
 
                        float* tdstcol = tdst->rect;
258
 
                        for (y=0; y<tsrc->y; ++y) {
259
 
                                for (x=0; x<tsrc->x; ++x, tdstcol+=4) {
260
 
                                        // first pass no offset, always same for every pass, exact copy,
261
 
                                        // otherwise results in uneven brightness, only need once
262
 
                                        if (n==0) qd_getPixel(tsrc, x, y, c1); else c1[0]=c1[1]=c1[2]=0;
263
 
                                        qd_getPixelLerp(tsrc, x + vxp,     y + vyp,     c2);
264
 
                                        qd_getPixelLerp(tsrc, x + vxp*2.f, y + vyp*2.f, c3);
265
 
                                        qd_getPixelLerp(tsrc, x + vxp*3.f, y + vyp*3.f, c4);
266
 
                                        // modulate color to look vaguely similar to a color spectrum
267
 
                                        fRGB_rgbmult(c2, 1.f, cmo, cmo);
268
 
                                        fRGB_rgbmult(c3, cmo, cmo, 1.f);
269
 
                                        fRGB_rgbmult(c4, cmo, 1.f, cmo);
270
 
                                        tdstcol[0] = 0.5f*(tdstcol[0] + c1[0] + wt*(c2[0] + wt*(c3[0] + wt*c4[0])));
271
 
                                        tdstcol[1] = 0.5f*(tdstcol[1] + c1[1] + wt*(c2[1] + wt*(c3[1] + wt*c4[1])));
272
 
                                        tdstcol[2] = 0.5f*(tdstcol[2] + c1[2] + wt*(c2[2] + wt*(c3[2] + wt*c4[2])));
273
 
                                }
274
 
                        }
275
 
                        memcpy(tsrc->rect, tdst->rect, sizeof(float)*tdst->x*tdst->y*tdst->type);
276
 
                }
277
 
 
278
 
                addImage(sbuf, tsrc, 1.f/(float)(6 - ndg->iter));
279
 
                memset(tdst->rect, 0, tdst->x*tdst->y*tdst->type*sizeof(float));
280
 
                memcpy(tsrc->rect, bsrc->rect, bsrc->x*bsrc->y*bsrc->type*sizeof(float));
281
 
                nump++;
282
 
        }
283
 
 
284
 
        mixImages(dst, sbuf, 0.5f + 0.5f*ndg->mix);
285
 
 
286
 
        free_compbuf(tsrc);
287
 
        free_compbuf(tdst);
288
 
        free_compbuf(sbuf);
289
 
        free_compbuf(bsrc);
290
 
}
291
 
 
292
 
 
293
 
//--------------------------------------------------------------------------------------------
294
 
// Ghosts (lensflare)
295
 
 
296
 
static float smoothMask(float x, float y)
297
 
{
298
 
        float t;
299
 
        x = 2.f*x - 1.f, y = 2.f*y - 1.f;
300
 
        if ((t = 1.f - sqrtf(x*x + y*y)) <= 0.f) return 0.f;
301
 
        return t;
302
 
}
303
 
 
304
 
static void ghosts(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
305
 
{
306
 
        // colormodulation and scale factors (cm & scalef) for 16 passes max: 64
307
 
        int x, y, n, p, np;
308
 
        fRGB c, tc, cm[64];
309
 
        float sc, isc, u, v, sm, s, t, ofs, scalef[64];
310
 
        CompBuf *tbuf1, *tbuf2, *gbuf;
311
 
        const float cmo = 1.f - ndg->colmod;
312
 
        const int qt = 1 << ndg->quality;
313
 
        const float s1 = 4.f/(float)qt, s2 = 2.f*s1;
314
 
 
315
 
        gbuf = BTP(src, ndg->threshold, qt);
316
 
        tbuf1 = dupalloc_compbuf(gbuf);
317
 
        IIR_gauss(tbuf1, s1, 0, 3);
318
 
        IIR_gauss(tbuf1, s1, 1, 3);
319
 
        IIR_gauss(tbuf1, s1, 2, 3);
320
 
        tbuf2 = dupalloc_compbuf(tbuf1);
321
 
        IIR_gauss(tbuf2, s2, 0, 3);
322
 
        IIR_gauss(tbuf2, s2, 1, 3);
323
 
        IIR_gauss(tbuf2, s2, 2, 3);
324
 
 
325
 
        if (ndg->iter & 1) ofs = 0.5f; else ofs = 0.f;
326
 
        for (x=0; x<(ndg->iter*4); x++) {
327
 
                y = x & 3;
328
 
                cm[x][0] = cm[x][1] = cm[x][2] = 1;
329
 
                if (y==1) fRGB_rgbmult(cm[x], 1.f, cmo, cmo);
330
 
                if (y==2) fRGB_rgbmult(cm[x], cmo, cmo, 1.f);
331
 
                if (y==3) fRGB_rgbmult(cm[x], cmo, 1.f, cmo);
332
 
                scalef[x] = 2.1f*(1.f-(x+ofs)/(float)(ndg->iter*4));
333
 
                if (x & 1) scalef[x] = -0.99f/scalef[x];
334
 
        }
335
 
 
336
 
        sc = 2.13;
337
 
        isc = -0.97;
338
 
        for (y=0; y<gbuf->y; y++) {
339
 
                v = (float)(y+0.5f) / (float)gbuf->y;
340
 
                for (x=0; x<gbuf->x; x++) {
341
 
                        u = (float)(x+0.5f) / (float)gbuf->x;
342
 
                        s = (u-0.5f)*sc + 0.5f, t = (v-0.5f)*sc + 0.5f;
343
 
                        qd_getPixelLerp(tbuf1, s*gbuf->x, t*gbuf->y, c);
344
 
                        sm = smoothMask(s, t);
345
 
                        fRGB_mult(c, sm);
346
 
                        s = (u-0.5f)*isc + 0.5f, t = (v-0.5f)*isc + 0.5f;
347
 
                        qd_getPixelLerp(tbuf2, s*gbuf->x - 0.5f, t*gbuf->y - 0.5f, tc);
348
 
                        sm = smoothMask(s, t);
349
 
                        fRGB_madd(c, tc, sm);
350
 
                        qd_setPixel(gbuf, x, y, c);
351
 
                }
352
 
        }
353
 
 
354
 
        memset(tbuf1->rect, 0, tbuf1->x*tbuf1->y*tbuf1->type*sizeof(float));
355
 
        for (n=1; n<ndg->iter; n++) {
356
 
                for (y=0; y<gbuf->y; y++) {
357
 
                        v = (float)(y+0.5f) / (float)gbuf->y;
358
 
                        for (x=0; x<gbuf->x; x++) {
359
 
                                u = (float)(x+0.5f) / (float)gbuf->x;
360
 
                                tc[0] = tc[1] = tc[2] = 0.f;
361
 
                                for (p=0;p<4;p++) {
362
 
                                        np = (n<<2) + p;
363
 
                                        s = (u-0.5f)*scalef[np] + 0.5f;
364
 
                                        t = (v-0.5f)*scalef[np] + 0.5f;
365
 
                                        qd_getPixelLerp(gbuf, s*gbuf->x - 0.5f, t*gbuf->y - 0.5f, c);
366
 
                                        fRGB_colormult(c, cm[np]);
367
 
                                        sm = smoothMask(s, t)*0.25f;
368
 
                                        fRGB_madd(tc, c, sm);
369
 
                                }
370
 
                                p = (x + y*tbuf1->x)*tbuf1->type;
371
 
                                tbuf1->rect[p] += tc[0];
372
 
                                tbuf1->rect[p+1] += tc[1];
373
 
                                tbuf1->rect[p+2] += tc[2];
374
 
                        }
375
 
                }
376
 
                memcpy(gbuf->rect, tbuf1->rect, tbuf1->x*tbuf1->y*tbuf1->type*sizeof(float));
377
 
        }
378
 
 
379
 
        free_compbuf(tbuf1);
380
 
        free_compbuf(tbuf2);
381
 
 
382
 
        mixImages(dst, gbuf, 0.5f + 0.5f*ndg->mix);
383
 
        free_compbuf(gbuf);
384
 
}
385
 
 
386
 
//--------------------------------------------------------------------------------------------
387
 
// Fog glow (convolution with kernel of exponential falloff)
388
 
 
389
 
static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
390
 
{
391
 
        int x, y;
392
 
        float scale, u, v, r, w, d;
393
 
        fRGB fcol;
394
 
        CompBuf *tsrc, *ckrn;
395
 
        unsigned int sz = 1 << ndg->size;
396
 
        const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f;
397
 
 
398
 
        // temp. src image
399
 
        tsrc = BTP(src, ndg->threshold, 1 << ndg->quality);
400
 
        // make the convolution kernel
401
 
        ckrn = alloc_compbuf(sz, sz, CB_RGBA, 1);
402
 
 
403
 
        scale = 0.25f*sqrtf(sz*sz);
404
 
 
405
 
        for (y=0; y<sz; ++y) {
406
 
                v = 2.f*(y / (float)sz) - 1.f;
407
 
                for (x=0; x<sz; ++x) {
408
 
                        u = 2.f*(x / (float)sz) - 1.f;
409
 
                        r = (u*u + v*v)*scale;
410
 
                        d = -sqrtf(sqrtf(sqrtf(r)))*9.f;
411
 
                        fcol[0] = expf(d*cs_r), fcol[1] = expf(d*cs_g), fcol[2] = expf(d*cs_b);
412
 
                        // linear window good enough here, visual result counts, not scientific analysis
413
 
                        //w = (1.f-fabs(u))*(1.f-fabs(v));
414
 
                        // actually, Hanning window is ok, cos^2 for some reason is slower
415
 
                        w = (0.5f + 0.5f*cos((double)u*M_PI))*(0.5f + 0.5f*cos((double)v*M_PI));
416
 
                        fRGB_mult(fcol, w);
417
 
                        qd_setPixel(ckrn, x, y, fcol);
418
 
                }
419
 
        }
420
 
 
421
 
        convolve(tsrc, tsrc, ckrn);
422
 
        free_compbuf(ckrn);
423
 
        mixImages(dst, tsrc, 0.5f + 0.5f*ndg->mix);
424
 
        free_compbuf(tsrc);
425
 
}
426
 
 
427
 
//--------------------------------------------------------------------------------------------
428
 
 
429
 
static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
430
 
{
431
 
        CompBuf *new, *src, *img = in[0]->data;
432
 
        NodeGlare* ndg = node->storage;
433
 
 
434
 
        if ((img == NULL) || (out[0]->hasoutput == 0)) return;
435
 
 
436
 
        if (img->type != CB_RGBA) {
437
 
                new = typecheck_compbuf(img, CB_RGBA);
438
 
                src = typecheck_compbuf(img, CB_RGBA);
439
 
        }
440
 
        else {
441
 
                new = dupalloc_compbuf(img);
442
 
                src = dupalloc_compbuf(img);
443
 
        }
444
 
 
445
 
        {
446
 
                int x, y;
447
 
                for (y=0; y<new->y; ++y) {
448
 
                        fRGB* col = (fRGB*)&new->rect[y*new->x*new->type];
449
 
                        for (x=0; x<new->x; ++x) {
450
 
                                col[x][0] = MAX2(col[x][0], 0.f);
451
 
                                col[x][1] = MAX2(col[x][1], 0.f);
452
 
                                col[x][2] = MAX2(col[x][2], 0.f);
453
 
                        }
454
 
                }
455
 
        }
456
 
 
457
 
        switch (ndg->type) {
458
 
                case 0:
459
 
                        star4(ndg, new, src);
460
 
                        break;
461
 
                case 1:
462
 
                        fglow(ndg, new, src);
463
 
                        break;
464
 
                case 3:
465
 
                        ghosts(ndg, new, src);
466
 
                        break;
467
 
                case 2:
468
 
                default:
469
 
                        streaks(ndg, new, src);
470
 
                        break;
471
 
        }
472
 
 
473
 
        free_compbuf(src);
474
 
        out[0]->data = new;
475
 
}
476
 
 
477
 
static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
 
35
static bNodeSocketTemplate cmp_node_glare_in[] = {
 
36
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
 
37
        {       -1, 0, ""       }
 
38
};
 
39
static bNodeSocketTemplate cmp_node_glare_out[] = {
 
40
        {       SOCK_RGBA, 0, N_("Image")},
 
41
        {       -1, 0, ""       }
 
42
};
 
43
 
 
44
static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
478
45
{
479
46
        NodeGlare *ndg = MEM_callocN(sizeof(NodeGlare), "node glare data");
480
47
        ndg->quality = 1;
499
66
        node_type_size(&ntype, 150, 120, 200);
500
67
        node_type_init(&ntype, node_composit_init_glare);
501
68
        node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage);
502
 
        node_type_exec(&ntype, node_composit_exec_glare);
503
69
 
504
70
        nodeRegisterType(ttype, &ntype);
505
71
}