Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

occlusion.c File Reference

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_material_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_memarena.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_global.h"
#include "BKE_scene.h"
#include "RE_shader_ext.h"
#include "occlusion.h"
#include "render_types.h"
#include "rendercore.h"
#include "renderdatabase.h"
#include "pixelshading.h"
#include "shading.h"
#include "zbuf.h"

Go to the source code of this file.

Classes

struct  OcclusionCacheSample
struct  OcclusionCache
struct  OccFace
struct  OccNode
struct  OcclusionTree
struct  OcclusionThread
struct  OcclusionBuildThread

Defines

#define INVALID_INDEX   ((int)(~0))
#define INVPI   0.31830988618379069f
#define TOTCHILD   8
#define CACHE_STEP   3

Typedefs

typedef struct OcclusionCacheSample OcclusionCacheSample
typedef struct OcclusionCache OcclusionCache
typedef struct OccFace OccFace
typedef struct OccNode OccNode
typedef struct OcclusionTree OcclusionTree
typedef struct OcclusionThread OcclusionThread
typedef struct OcclusionBuildThread OcclusionBuildThread

Functions

static void occ_shade (ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr, float *rad)
static void occ_build_shade (Render *re, OcclusionTree *tree)
static void sh_copy (float *shresult, float *sh)
static void sh_mul (float *sh, float f)
static void sh_add (float *shresult, float *sh1, float *sh2)
static void sh_from_disc (float *n, float area, float *shresult)
static float sh_eval (float *sh, float *v)
static void occ_face (const OccFace *face, float co[3], float normal[3], float *area)
static void occ_sum_occlusion (OcclusionTree *tree, OccNode *node)
static int occ_find_bbox_axis (OcclusionTree *tree, int begin, int end, float *min, float *max)
static void occ_node_from_face (OccFace *face, OccNode *node)
static void occ_build_dco (OcclusionTree *tree, OccNode *node, const float co[3], float *dco)
static void occ_build_split (OcclusionTree *tree, int begin, int end, int *split)
static void occ_build_8_split (OcclusionTree *tree, int begin, int end, int *offset, int *count)
static void occ_build_recursive (OcclusionTree *tree, OccNode *node, int begin, int end, int depth)
static void * exec_occ_build (void *data)
static void occ_build_sh_normalize (OccNode *node)
static OcclusionTreeocc_tree_build (Render *re)
static void occ_free_tree (OcclusionTree *tree)
static float occ_solid_angle (OccNode *node, const float v[3], float d2, float invd2, const float receivenormal[3])
static void VecAddDir (float result[3], const float v1[3], const float v2[3], const float fac)
static int occ_visible_quad (float *p, const float n[3], const float v0[3], const float *v1, const float *v2, float q0[3], float q1[3], float q2[3], float q3[3])
static void normalizef (float *n)
static float occ_quad_form_factor (const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3])
static float occ_form_factor (OccFace *face, float *p, float *n)
static void occ_lookup (OcclusionTree *tree, int thread, OccFace *exclude, float *pp, float *pn, float *occ, float rad[3], float bentn[3])
static void occ_compute_bounces (Render *re, OcclusionTree *tree, int totbounce)
static void occ_compute_passes (Render *re, OcclusionTree *tree, int totpass)
static void sample_occ_tree (Render *re, OcclusionTree *tree, OccFace *exclude, float *co, float *n, int thread, int onlyshadow, float *ao, float *env, float *indirect)
static OcclusionCacheSamplefind_occ_sample (OcclusionCache *cache, int x, int y)
static int sample_occ_cache (OcclusionTree *tree, float *co, float *n, int x, int y, int thread, float *ao, float *env, float *indirect)
static void sample_occ_surface (ShadeInput *shi)
static void * exec_strandsurface_sample (void *data)
void make_occ_tree (Render *re)
void free_occ (Render *re)
void sample_occ (Render *re, ShadeInput *shi)
void cache_occ_samples (Render *re, RenderPart *pa, ShadeSample *ssamp)
void free_occ_samples (Render *re, RenderPart *pa)

Variables

Render R

Detailed Description

Definition in file occlusion.c.


Define Documentation

#define CACHE_STEP   3

Definition at line 69 of file occlusion.c.

Referenced by cache_occ_samples().

#define INVALID_INDEX   ((int)(~0))

Definition at line 66 of file occlusion.c.

#define INVPI   0.31830988618379069f

Definition at line 67 of file occlusion.c.

Referenced by occ_solid_angle().

#define TOTCHILD   8

Typedef Documentation

typedef struct OccFace OccFace
typedef struct OcclusionTree OcclusionTree
typedef struct OccNode OccNode

Function Documentation

void cache_occ_samples ( Render re,
RenderPart pa,
ShadeSample ssamp 
)
static void* exec_occ_build ( void *  data) [static]
static void* exec_strandsurface_sample ( void *  data) [static]
static OcclusionCacheSample* find_occ_sample ( OcclusionCache cache,
int  x,
int  y 
) [static]
void free_occ ( Render re)

Definition at line 1745 of file occlusion.c.

References NULL, occ_free_tree(), and Render::occlusiontree.

Referenced by RE_Database_Free().

void free_occ_samples ( Render re,
RenderPart pa 
)
void make_occ_tree ( Render re)
static void normalizef ( float *  n) [static]

Definition at line 1116 of file occlusion.c.

References simple_enum_gen::d, dot_v3v3(), credits_svn_gen::e, F, and sqrtf.

Referenced by occ_quad_form_factor().

static void occ_build_8_split ( OcclusionTree tree,
int  begin,
int  end,
int *  offset,
int *  count 
) [static]

Definition at line 483 of file occlusion.c.

References occ_build_split().

Referenced by occ_build_recursive().

static void occ_build_dco ( OcclusionTree tree,
OccNode node,
const float  co[3],
float *  dco 
) [static]
static void occ_build_recursive ( OcclusionTree tree,
OccNode node,
int  begin,
int  end,
int  depth 
) [static]
static void occ_build_sh_normalize ( OccNode node) [static]
static void occ_build_shade ( Render re,
OcclusionTree tree 
) [static]
static void occ_build_split ( OcclusionTree tree,
int  begin,
int  end,
int *  split 
) [static]

Definition at line 455 of file occlusion.c.

References OcclusionTree::co, OcclusionTree::face, max, min, occ_find_bbox_axis(), and SWAP.

Referenced by occ_build_8_split().

static void occ_compute_bounces ( Render re,
OcclusionTree tree,
int  totbounce 
) [static]
static void occ_compute_passes ( Render re,
OcclusionTree tree,
int  totpass 
) [static]
static void occ_face ( const OccFace face,
float  co[3],
float  normal[3],
float *  area 
) [static]
static int occ_find_bbox_axis ( OcclusionTree tree,
int  begin,
int  end,
float *  min,
float *  max 
) [static]

Definition at line 399 of file occlusion.c.

References OcclusionTree::co, DO_MINMAX, INIT_MINMAX, and len().

Referenced by occ_build_split().

static float occ_form_factor ( OccFace face,
float *  p,
float *  n 
) [static]
static void occ_free_tree ( OcclusionTree tree) [static]
static void occ_lookup ( OcclusionTree tree,
int  thread,
OccFace exclude,
float *  pp,
float *  pn,
float *  occ,
float  rad[3],
float  bentn[3] 
) [static]
static void occ_node_from_face ( OccFace face,
OccNode node 
) [static]

Definition at line 421 of file occlusion.c.

References OccNode::area, OccNode::co, OccNode::dco, occ_face(), OccNode::sh, and sh_from_disc().

Referenced by occ_build_recursive().

static float occ_quad_form_factor ( const float  p[3],
const float  n[3],
const float  q0[3],
const float  q1[3],
const float  q2[3],
const float  q3[3] 
) [static]

Definition at line 1131 of file occlusion.c.

References cross_v3_v3v3(), dot_v3v3(), M_PI, MAX2, normalizef(), saacosf(), and sub_v3_v3v3().

Referenced by occ_form_factor().

static void occ_shade ( ShadeSample ssamp,
ObjectInstanceRen obi,
VlakRen vlr,
float *  rad 
) [static]
static float occ_solid_angle ( OccNode node,
const float  v[3],
float  d2,
float  invd2,
const float  receivenormal[3] 
) [static]

Definition at line 748 of file occlusion.c.

References OccNode::area, CLAMP(), dot_v3v3(), INVPI, OccNode::sh, and sh_eval().

Referenced by occ_lookup().

static void occ_sum_occlusion ( OcclusionTree tree,
OccNode node 
) [static]
static OcclusionTree* occ_tree_build ( Render re) [static]
static int occ_visible_quad ( float *  p,
const float  n[3],
const float  v0[3],
const float *  v1,
const float *  v2,
float  q0[3],
float  q1[3],
float  q2[3],
float  q3[3] 
) [static]

Definition at line 772 of file occlusion.c.

References copy_v3_v3(), dot_v3v3(), credits_svn_gen::e, KDL::epsilon, fabsf, and VecAddDir().

Referenced by occ_form_factor().

void sample_occ ( Render re,
ShadeInput shi 
)
static int sample_occ_cache ( OcclusionTree tree,
float *  co,
float *  n,
int  x,
int  y,
int  thread,
float *  ao,
float *  env,
float *  indirect 
) [static]
static void sample_occ_surface ( ShadeInput shi) [static]
static void sample_occ_tree ( Render re,
OcclusionTree tree,
OccFace exclude,
float *  co,
float *  n,
int  thread,
int  onlyshadow,
float *  ao,
float *  env,
float *  indirect 
) [static]
static void sh_add ( float *  shresult,
float *  sh1,
float *  sh2 
) [static]

Definition at line 255 of file occlusion.c.

References i.

Referenced by occ_build_recursive().

static void sh_copy ( float *  shresult,
float *  sh 
) [static]

Definition at line 242 of file occlusion.c.

Referenced by sh_from_disc().

static float sh_eval ( float *  sh,
float *  v 
) [static]

Definition at line 289 of file occlusion.c.

References sum().

Referenced by occ_solid_angle().

static void sh_from_disc ( float *  n,
float  area,
float *  shresult 
) [static]

Definition at line 263 of file occlusion.c.

References sh_copy(), and sh_mul().

Referenced by occ_node_from_face().

static void sh_mul ( float *  sh,
float  f 
) [static]

Definition at line 247 of file occlusion.c.

References i.

Referenced by occ_build_sh_normalize(), and sh_from_disc().

static void VecAddDir ( float  result[3],
const float  v1[3],
const float  v2[3],
const float  fac 
) [static]

Definition at line 765 of file occlusion.c.

Referenced by occ_visible_quad().


Variable Documentation

Definition at line 127 of file pipeline.c.