[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34172] trunk/blender/source/blender: fixed a case with occlusion where uninitialized variable could be used.
Campbell Barton
ideasman42 at gmail.com
Sat Jan 8 11:23:37 CET 2011
Revision: 34172
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34172
Author: campbellbarton
Date: 2011-01-08 10:23:36 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
trunk/blender/source/blender/render/intern/source/occlusion.c
Modified: trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2011-01-08 10:13:59 UTC (rev 34171)
+++ trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c 2011-01-08 10:23:36 UTC (rev 34172)
@@ -190,7 +190,7 @@
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;
Modified: trunk/blender/source/blender/render/intern/source/occlusion.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/occlusion.c 2011-01-08 10:13:59 UTC (rev 34171)
+++ trunk/blender/source/blender/render/intern/source/occlusion.c 2011-01-08 10:23:36 UTC (rev 34172)
@@ -305,7 +305,7 @@
/* ------------------------------ 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 @@
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];
- for(b=0; b<TOTCHILD; b++) {
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 @@
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 @@
/* 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 @@
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 @@
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);
More information about the Bf-blender-cvs
mailing list