Blender  V2.59
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, float *v, float d2, float invd2, float *receivenormal)
static void VecAddDir (float *result, float *v1, float *v2, float fac)
static int occ_visible_quad (float *p, float *n, float *v0, float *v1, float *v2, float *q0, float *q1, float *q2, float *q3)
static void normalizef (float *n)
static float occ_quad_form_factor (float *p, float *n, float *q0, float *q1, float *q2, float *q3)
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 70 of file occlusion.c.

Referenced by cache_occ_samples().

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

Definition at line 67 of file occlusion.c.

#define INVPI   0.31830988618379069f

Definition at line 68 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 1746 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 1117 of file occlusion.c.

References simple_enum_gen::d, F, INPR, 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 484 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 456 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 400 of file occlusion.c.

References OcclusionTree::co, DO_MINMAX, and INIT_MINMAX.

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 422 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 ( float *  p,
float *  n,
float *  q0,
float *  q1,
float *  q2,
float *  q3 
) [static]

Definition at line 1132 of file occlusion.c.

References cross_v3_v3v3(), INPR, M_PI, MAX2, normalizef(), saacosf(), and VECSUB.

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,
float *  v,
float  d2,
float  invd2,
float *  receivenormal 
) [static]

Definition at line 749 of file occlusion.c.

References OccNode::area, CLAMP(), INPR, 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,
float *  n,
float *  v0,
float *  v1,
float *  v2,
float *  q0,
float *  q1,
float *  q2,
float *  q3 
) [static]

Definition at line 773 of file occlusion.c.

References KDL::epsilon, fabsf, INPR, VecAddDir(), and VECCOPY.

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 256 of file occlusion.c.

References i.

Referenced by occ_build_recursive().

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

Definition at line 243 of file occlusion.c.

Referenced by sh_from_disc().

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

Definition at line 290 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 264 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 248 of file occlusion.c.

References i.

Referenced by occ_build_sh_normalize(), and sh_from_disc().

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

Definition at line 766 of file occlusion.c.

Referenced by occ_visible_quad().


Variable Documentation

Definition at line 127 of file pipeline.c.