Blender V2.61 - r43446
|
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_threads.h"
#include "BLI_voxel.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "RE_shader_ext.h"
#include "DNA_material_types.h"
#include "rayintersection.h"
#include "rayobject.h"
#include "render_types.h"
#include "rendercore.h"
#include "renderdatabase.h"
#include "volumetric.h"
#include "volume_precache.h"
#include "BKE_global.h"
Go to the source code of this file.
Classes | |
struct | VolPrecacheQueue |
Typedefs | |
typedef struct VolPrecacheQueue | VolPrecacheQueue |
Functions | |
static int | intersect_outside_volume (RayObject *tree, Isect *isect, float *offset, int limit, int depth) |
static int | point_inside_obi (RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) |
void | global_bounds_obi (Render *re, ObjectInstanceRen *obi, float *bbmin, float *bbmax) |
static float | get_avg_surrounds (float *cache, int *res, int xx, int yy, int zz) |
static void | lightcache_filter (VolumePrecache *vp) |
static int | ms_I (int x, int y, int z, int *n) |
static int | v_I_pad (int x, int y, int z, int *n) |
static int | lc_to_ms_I (int x, int y, int z, int *n) |
static float | total_ss_energy (Render *re, int do_test_break, VolumePrecache *vp) |
static float | total_ms_energy (Render *re, int do_test_break, float *sr, float *sg, float *sb, int *res) |
static void | ms_diffuse (Render *re, int do_test_break, float *x0, float *x, float diff, int *n) |
static void | multiple_scattering_diffusion (Render *re, VolumePrecache *vp, Material *ma) |
static void * | vol_precache_part (void *data) |
static void | precache_setup_shadeinput (Render *re, ObjectInstanceRen *obi, Material *ma, ShadeInput *shi) |
static void | precache_init_parts (Render *re, RayObject *tree, ShadeInput *shi, ObjectInstanceRen *obi, int totthread, int *parts) |
static int | precache_resolution (Render *re, VolumePrecache *vp, ObjectInstanceRen *obi, int res) |
static void | vol_precache_objectinstance_threads (Render *re, ObjectInstanceRen *obi, Material *ma) |
static int | using_lightcache (Material *ma) |
void | volume_precache (Render *re) |
void | free_volume_precache (Render *re) |
int | point_inside_volume_objectinstance (Render *re, ObjectInstanceRen *obi, float *co) |
Variables | |
struct Render | R |
Definition in file volume_precache.c.
typedef struct VolPrecacheQueue VolPrecacheQueue |
void free_volume_precache | ( | Render * | re | ) |
Definition at line 823 of file volume_precache.c.
References VolumePrecache::bbmax, VolumePrecache::bbmin, BLI_freelistN(), VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, ListBase::first, Render::instancetable, MEM_freeN(), ObjectInstanceRen::next, NULL, ObjectInstanceRen::volume_precache, and Render::volumes.
Referenced by RE_Database_Free().
static float get_avg_surrounds | ( | float * | cache, |
int * | res, | ||
int | xx, | ||
int | yy, | ||
int | zz | ||
) | [static] |
Definition at line 166 of file volume_precache.c.
Referenced by lightcache_filter().
void global_bounds_obi | ( | Render * | re, |
ObjectInstanceRen * | obi, | ||
float * | bbmin, | ||
float * | bbmax | ||
) |
Definition at line 124 of file volume_precache.c.
References VolumePrecache::bbmax, VolumePrecache::bbmin, VertRen::co, co, copy_v3_v3(), DO_MINMAX, ObjectInstanceRen::flag, INIT_MINMAX, ObjectInstanceRen::mat, MEM_callocN(), mul_m4_v3(), NULL, ObjectInstanceRen::obr, R_TRANSFORMED, ObjectRen::totvert, VertTableNode::vert, ObjectRen::vertnodes, Render::viewinv, and ObjectInstanceRen::volume_precache.
Referenced by precache_init_parts(), precache_resolution(), and vol_get_precached_scattering().
static int intersect_outside_volume | ( | RayObject * | tree, |
Isect * | isect, | ||
float * | offset, | ||
int | limit, | ||
int | depth | ||
) | [static] |
Definition at line 76 of file volume_precache.c.
References Isect::dir, Isect::dist, Isect::face, FLT_MAX, Isect::hit, Isect::ob, Isect::orig, RE_rayobject_raycast(), RE_SKIP_VLR_NEIGHBOUR, Isect::skip, and Isect::start.
Referenced by point_inside_obi().
static int lc_to_ms_I | ( | int | x, |
int | y, | ||
int | z, | ||
int * | n | ||
) | [inline, static] |
Definition at line 279 of file volume_precache.c.
Referenced by multiple_scattering_diffusion().
static void lightcache_filter | ( | VolumePrecache * | vp | ) | [static] |
Definition at line 206 of file volume_precache.c.
References VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, get_avg_surrounds(), i, VolumePrecache::res, and V_I.
Referenced by vol_precache_objectinstance_threads().
static void ms_diffuse | ( | Render * | re, |
int | do_test_break, | ||
float * | x0, | ||
float * | x, | ||
float | diff, | ||
int * | n | ||
) | [static] |
Definition at line 333 of file volume_precache.c.
References i, size(), Render::tbh, Render::test_break, v_I_pad(), and VOL_MS_TIMESTEP.
Referenced by multiple_scattering_diffusion().
static int ms_I | ( | int | x, |
int | y, | ||
int | z, | ||
int * | n | ||
) | [inline, static] |
Definition at line 267 of file volume_precache.c.
Referenced by multiple_scattering_diffusion(), and total_ms_energy().
static void multiple_scattering_diffusion | ( | Render * | re, |
VolumePrecache * | vp, | ||
Material * | ma | ||
) | [static] |
Definition at line 361 of file volume_precache.c.
References BLI_snprintf(), VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, KDL::diff(), Render::i, i, RenderStats::infostr, lc_to_ms_I(), MA_VOL_SHADE_SHADEDPLUSMULTIPLE, MAX3(), MEM_callocN(), MEM_freeN(), VolumeSettings::ms_diff, ms_diffuse(), ms_I(), VolumeSettings::ms_intensity, VolumeSettings::ms_spread, NULL, PIL_check_seconds_timer(), VolumePrecache::res, Render::sdh, VolumeSettings::shade_type, size(), Render::stats_draw, str, SWAP, Render::tbh, Render::test_break, total_ms_energy(), total_ss_energy(), and Material::vol.
Referenced by vol_precache_objectinstance_threads().
static int point_inside_obi | ( | RayObject * | tree, |
ObjectInstanceRen * | UNUSEDobi, | ||
float * | co | ||
) | [static] |
Definition at line 98 of file volume_precache.c.
References copy_v3_v3(), Isect::dir, Isect::dist, Isect::face, FLT_MAX, intersect_outside_volume(), Isect::last_hit, Isect::lay, Isect::mode, NULL, Isect::ob, Isect::orig, RE_RAY_MIRROR, and Isect::start.
Referenced by point_inside_volume_objectinstance(), and vol_precache_part().
int point_inside_volume_objectinstance | ( | Render * | re, |
ObjectInstanceRen * | obi, | ||
float * | co | ||
) |
Definition at line 842 of file volume_precache.c.
References makeraytree_object(), and point_inside_obi().
Referenced by init_camera_inside_volumes().
static void precache_init_parts | ( | Render * | re, |
RayObject * | tree, | ||
ShadeInput * | shi, | ||
ObjectInstanceRen * | obi, | ||
int | totthread, | ||
int * | parts | ||
) | [static] |
Definition at line 586 of file volume_precache.c.
References VolPrecachePart::bbmin, BLI_addtail(), BLI_freelistN(), copy_m4_m4(), copy_v3_v3(), copy_v3_v3_int(), global_bounds_obi(), i, VolPrecachePart::maxx, VolPrecachePart::maxy, VolPrecachePart::maxz, MEM_callocN(), VolPrecachePart::minx, VolPrecachePart::miny, VolPrecachePart::minz, VolPrecachePart::num, VolPrecachePart::obi, VolPrecachePart::re, VolPrecachePart::res, VolumePrecache::res, VolPrecachePart::shi, sub_v3_v3v3(), VolPrecachePart::tree, Render::viewmat, VolPrecachePart::viewmat, ObjectInstanceRen::volume_precache, Render::volume_precache_parts, and VolPrecachePart::voxel.
Referenced by vol_precache_objectinstance_threads().
static int precache_resolution | ( | Render * | re, |
VolumePrecache * | vp, | ||
ObjectInstanceRen * | obi, | ||
int | res | ||
) | [static] |
Definition at line 659 of file volume_precache.c.
References div, global_bounds_obi(), MAX3(), VolumePrecache::res, and sub_v3_v3v3().
Referenced by vol_precache_objectinstance_threads().
static void precache_setup_shadeinput | ( | Render * | re, |
ObjectInstanceRen * | obi, | ||
Material * | ma, | ||
ShadeInput * | shi | ||
) | [static] |
Definition at line 572 of file volume_precache.c.
References ShadeInput::depth, Material::har, ShadeInput::har, ShadeInput::lay, Render::lay, ShadeInput::mask, ShadeInput::mat, NULL, ShadeInput::obi, ObjectInstanceRen::obr, ShadeInput::obr, ShadeInput::r, Material::r, and ShadeInput::vlr.
Referenced by vol_precache_objectinstance_threads().
static float total_ms_energy | ( | Render * | re, |
int | do_test_break, | ||
float * | sr, | ||
float * | sg, | ||
float * | sb, | ||
int * | res | ||
) | [static] |
Definition at line 311 of file volume_precache.c.
References i, ms_I(), Render::tbh, and Render::test_break.
Referenced by multiple_scattering_diffusion().
static float total_ss_energy | ( | Render * | re, |
int | do_test_break, | ||
VolumePrecache * | vp | ||
) | [static] |
Definition at line 288 of file volume_precache.c.
References VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, i, VolumePrecache::res, Render::tbh, Render::test_break, and V_I.
Referenced by multiple_scattering_diffusion().
static int using_lightcache | ( | Material * | ma | ) | [static] |
Definition at line 787 of file volume_precache.c.
References ELEM, MA_VOL_PRECACHESHADING, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_SHADEDPLUSMULTIPLE, VolumeSettings::shade_type, VolumeSettings::shadeflag, and Material::vol.
Referenced by volume_precache().
static int v_I_pad | ( | int | x, |
int | y, | ||
int | z, | ||
int * | n | ||
) | [inline, static] |
Definition at line 273 of file volume_precache.c.
Referenced by ms_diffuse().
static void vol_precache_objectinstance_threads | ( | Render * | re, |
ObjectInstanceRen * | obi, | ||
Material * | ma | ||
) | [static] |
Definition at line 688 of file volume_precache.c.
References BLI_end_threads(), BLI_freelistN(), BLI_init_threads(), BLI_insert_thread(), BLI_snprintf(), BLI_thread_queue_free(), BLI_thread_queue_init(), BLI_thread_queue_nowait(), BLI_thread_queue_pop_timeout(), BLI_thread_queue_push(), VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, VolPrecacheQueue::done, ELEM, ListBase::first, Render::i, RenderStats::infostr, lightcache_filter(), MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE, makeraytree_object(), MEM_callocN(), MEM_freeN(), multiple_scattering_diffusion(), VolPrecachePart::next, NULL, PIL_check_seconds_timer(), precache_init_parts(), VolumeSettings::precache_resolution, precache_resolution(), precache_setup_shadeinput(), R, Render::r, VolumePrecache::res, Render::sdh, VolumeSettings::shade_type, Render::stats_draw, str, Render::tbh, Render::test_break, RenderData::threads, threads, Material::vol, vol_precache_part(), ObjectInstanceRen::volume_precache, Render::volume_precache_parts, and VolPrecacheQueue::work.
Referenced by volume_precache().
static void* vol_precache_part | ( | void * | data | ) | [static] |
Definition at line 507 of file volume_precache.c.
References VolPrecachePart::bbmin, BLI_thread_queue_pop(), BLI_thread_queue_push(), co, copy_v3_v3(), VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, VolPrecacheQueue::done, i, VolPrecachePart::minx, VolPrecachePart::miny, VolPrecachePart::minz, mul_v3_m4v3(), normalize_v3(), NULL, VolPrecachePart::obi, point_inside_obi(), VolPrecachePart::re, VolPrecachePart::res, VolPrecachePart::shi, Render::tbh, Render::test_break, VolPrecachePart::tree, V_I, VolPrecachePart::viewmat, vol_get_scattering(), ObjectInstanceRen::volume_precache, VolPrecachePart::voxel, and VolPrecacheQueue::work.
Referenced by vol_precache_objectinstance_threads().
void volume_precache | ( | Render * | re | ) |
Definition at line 795 of file volume_precache.c.
References ListBase::first, Render::i, RenderStats::infostr, Render::instancetable, VolumeOb::ma, VolumeOb::next, ObjectInstanceRen::next, NULL, VolumeOb::obr, ObjectInstanceRen::obr, Render::sdh, Render::stats_draw, Render::tbh, Render::test_break, using_lightcache(), vol_precache_objectinstance_threads(), and Render::volumes.
Referenced by RE_Database_FromScene().
Definition at line 127 of file pipeline.c.