Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-08 13:23:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-08 13:23:36 +0300
commitd3d5fe42bf4fd07dfd9638b5e18ec2d2e7422b94 (patch)
tree98dc5605135c0a1f58b78efd590493492b518ba0 /source
parentc35db522dae8622de9ce10316feae08361769621 (diff)
fixed a case with occlusion where uninitialized variable could be used.
also removed unused vars. can_pbvh_draw() had a NULL check which is never needed (callers check for this), a NULL ob would have crashed the function anyway.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c2
-rw-r--r--source/blender/render/intern/source/occlusion.c24
2 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index a0750308a2d..8bb336d1c4d 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -190,7 +190,7 @@ static ListBase *cdDM_getFaceMap(Object *ob, DerivedMesh *dm)
static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
- Mesh *me= (ob)? ob->data: NULL;
+ Mesh *me= ob->data;
if(ob->sculpt->modifiers_active) return 0;
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 8661d0d89a0..4d129312672 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -305,7 +305,7 @@ static float sh_eval(float *sh, float *v)
/* ------------------------------ Building --------------------------------- */
-static void occ_face(const OccFace *face, float *co, float *normal, float *area)
+static void occ_face(const OccFace *face, float co[3], float normal[3], float *area)
{
ObjectInstanceRen *obi;
VlakRen *vlr;
@@ -422,21 +422,23 @@ static void occ_node_from_face(OccFace *face, OccNode *node)
sh_from_disc(n, node->area, node->sh);
}
-static void occ_build_dco(OcclusionTree *tree, OccNode *node, float *co, float *dco)
+static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3], float *dco)
{
- OccNode *child;
- float dist, d[3], nco[3];
int b;
-
for(b=0; b<TOTCHILD; b++) {
+ float dist, d[3], nco[3];
+
if(node->childflag & (1<<b)) {
- occ_face(tree->face+node->child[b].face, nco, 0, 0);
+ occ_face(tree->face+node->child[b].face, nco, NULL, NULL);
}
else if(node->child[b].node) {
- child= node->child[b].node;
+ OccNode *child= node->child[b].node;
occ_build_dco(tree, child, co, dco);
VECCOPY(nco, child->co);
}
+ else {
+ continue;
+ }
VECSUB(d, nco, co);
dist= INPR(d, d);
@@ -522,7 +524,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
ListBase threads;
OcclusionBuildThread othreads[BLENDER_MAX_THREADS];
OccNode *child, tmpnode;
- OccFace *face;
+ /* OccFace *face; */
int a, b, totthread=0, offset[TOTCHILD], count[TOTCHILD];
/* add a new node */
@@ -531,7 +533,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
/* leaf node with only children */
if(end - begin <= TOTCHILD) {
for(a=begin, b=0; a<end; a++, b++) {
- face= &tree->face[a];
+ /* face= &tree->face[a]; */
node->child[b].face= a;
node->childflag |= (1<<b);
}
@@ -548,7 +550,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
node->child[b].node= NULL;
}
else if(count[b] == 1) {
- face= &tree->face[offset[b]];
+ /* face= &tree->face[offset[b]]; */
node->child[b].face= offset[b];
node->childflag |= (1<<b);
}
@@ -1527,7 +1529,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
for(i=0; i<4; i++) {
VECSUB(d, samples[i]->co, co);
- dist2= INPR(d, d);
+ //dist2= INPR(d, d);
wz[i]= 1.0f; //(samples[i]->dist2/(1e-4f + dist2));
wn[i]= pow(INPR(samples[i]->n, n), 32.0f);