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

« back to all changes in this revision

Viewing changes to source/blender/render/intern/source/pointdensity.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:
36
36
 
37
37
#include "BLI_math.h"
38
38
#include "BLI_blenlib.h"
 
39
#include "BLI_noise.h"
39
40
#include "BLI_kdopbvh.h"
40
41
#include "BLI_utildefines.h"
41
42
 
106
107
        ParticleKey state;
107
108
        ParticleSimulationData sim= {NULL};
108
109
        ParticleData *pa=NULL;
109
 
        float cfra = BKE_curframe(re->scene);
 
110
        float cfra = BKE_scene_frame_get(re->scene);
110
111
        int i /*, childexists*/ /* UNUSED */;
111
112
        int total_particles, offset=0;
112
113
        int data_used = point_data_used(pd);
121
122
        /* Just to create a valid rendering context for particles */
122
123
        psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, 0);
123
124
        
124
 
        dm = mesh_create_derived_render(re->scene, ob,CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 
125
        dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
125
126
        
126
127
        if ( !psys_check_enabled(ob, psys)) {
127
128
                psys_render_restore(ob, psys);
170
171
                                pd->point_data[i*3 + 0] = state.vel[0];
171
172
                                pd->point_data[i*3 + 1] = state.vel[1];
172
173
                                pd->point_data[i*3 + 2] = state.vel[2];
173
 
                        } 
 
174
                        }
174
175
                        if (data_used & POINT_DATA_LIFE) {
175
176
                                float pa_time;
176
177
                                
221
222
                
222
223
                copy_v3_v3(co, mvert->co);
223
224
 
224
 
                switch(pd->ob_cache_space) {
 
225
                switch (pd->ob_cache_space) {
225
226
                        case TEX_PD_OBJECTSPACE:
226
227
                                break;
227
228
                        case TEX_PD_OBJECTLOC:
325
326
        }
326
327
}
327
328
 
328
 
typedef struct PointDensityRangeData
329
 
{
 
329
typedef struct PointDensityRangeData {
330
330
        float *density;
331
331
        float squared_radius;
332
332
        float *point_data;
380
380
        }
381
381
        
382
382
        if (pdr->density_curve && dist != 0.0f) {
 
383
                curvemapping_initialize(pdr->density_curve);
383
384
                density = curvemapping_evaluateF(pdr->density_curve, 0, density/dist)*dist;
384
385
        }
385
386
        
405
406
}
406
407
 
407
408
 
408
 
int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
 
409
int pointdensitytex(Tex *tex, const float texvec[3], TexResult *texres)
409
410
{
410
411
        int retval = TEX_INT;
411
412
        PointDensity *pd = tex->pd;
418
419
        
419
420
        texres->tin = 0.0f;
420
421
        
421
 
        if ((!pd) || (!pd->point_tree))         
 
422
        if ((!pd) || (!pd->point_tree))
422
423
                return 0;
423
424
                
424
425
        init_pointdensityrangedata(pd, &pdr, &density, vec, &age, 
446
447
                        turb = BLI_gTurbulence(pd->noise_size, texvec[0]+age, texvec[1]+age, texvec[2]+age, pd->noise_depth, 0, pd->noise_basis);
447
448
                }
448
449
                else if (pd->noise_influence == TEX_PD_NOISE_TIME) {
449
 
                        time = R.cfra / (float)R.r.efra;
 
450
                        time = R.r.cfra / (float)R.r.efra;
450
451
                        turb = BLI_gTurbulence(pd->noise_size, texvec[0]+time, texvec[1]+time, texvec[2]+time, pd->noise_depth, 0, pd->noise_basis);
451
452
                        //turb = BLI_turbulence(pd->noise_size, texvec[0]+time, texvec[1]+time, texvec[2]+time, pd->noise_depth);
452
453
                }
481
482
                case TEX_PD_COLOR_PARTAGE:
482
483
                        if (pd->coba) {
483
484
                                if (do_colorband(pd->coba, age, col)) {
484
 
                                        texres->talpha= 1;
 
485
                                        texres->talpha = TRUE;
485
486
                                        copy_v3_v3(&texres->tr, col);
486
487
                                        texres->tin *= col[3];
487
488
                                        texres->ta = texres->tin;
494
495
                        
495
496
                        if (pd->coba) {
496
497
                                if (do_colorband(pd->coba, speed, col)) {
497
 
                                        texres->talpha= 1;      
 
498
                                        texres->talpha = TRUE;
498
499
                                        copy_v3_v3(&texres->tr, col);
499
500
                                        texres->tin *= col[3];
500
501
                                        texres->ta = texres->tin;
503
504
                        break;
504
505
                }
505
506
                case TEX_PD_COLOR_PARTVEL:
506
 
                        texres->talpha= 1;
 
507
                        texres->talpha = TRUE;
507
508
                        mul_v3_fl(vec, pd->speed_scale);
508
509
                        copy_v3_v3(&texres->tr, vec);
509
510
                        texres->ta = texres->tin;