code cleanup: removed/renamed shadow & duplicate variable definitions.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 9 Jun 2012 18:20:40 +0000 (18:20 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 9 Jun 2012 18:20:40 +0000 (18:20 +0000)
intern/cycles/blender/blender_mesh.cpp
intern/cycles/bvh/bvh_params.h
intern/cycles/device/device_opencl.cpp
intern/cycles/render/nodes.h
intern/cycles/render/svm.cpp
intern/cycles/subd/subd_build.cpp
intern/cycles/subd/subd_dice.cpp
intern/cycles/subd/subd_split.cpp
source/blender/makesrna/intern/makesrna.c

index f9d26c40a741bd4b8e38035a85b6737b2c4d7c32..f3266435040cfcd78126536cbc49d3f43491b3f0 100644 (file)
@@ -82,7 +82,6 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
                loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
 
                float3 *fdata = attr->data_float3();
-               BL::Mesh::vertices_iterator v;
                size_t i = 0;
 
                for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v)
@@ -212,8 +211,6 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
 
        BL::Object::material_slots_iterator slot;
        for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
-               BL::Material material_override = render_layer.material_override;
-
                if(material_override)
                        find_shader(material_override, used_shaders, scene->default_surface);
                else
@@ -321,7 +318,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
                AttributeStandard std = (motion == -1)? ATTR_STD_MOTION_PRE: ATTR_STD_MOTION_POST;
                Attribute *attr_M = mesh->attributes.add(std);
                float3 *M = attr_M->data_float3();
-               size_t i = 0, size = mesh->verts.size();
+               size_t i = 0;
 
                for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < size; ++v, M++, i++)
                        *M = get_float3(v->co());
index 0cf5e905fea535591612a2abeaa210604ec6d6ac..a78496d841d66f900a500c8cbc01b3e364a1892f 100644 (file)
@@ -98,11 +98,11 @@ class BVHReference
 public:
        __forceinline BVHReference() {}
 
-       __forceinline BVHReference(const BoundBox& bounds_, int prim_index, int prim_object)
+       __forceinline BVHReference(const BoundBox& bounds_, int prim_index_, int prim_object_)
        : rbounds(bounds_)
        {
-               rbounds.min.w = __int_as_float(prim_index);
-               rbounds.max.w = __int_as_float(prim_object);
+               rbounds.min.w = __int_as_float(prim_index_);
+               rbounds.max.w = __int_as_float(prim_object_);
        }
 
        __forceinline const BoundBox& bounds() const { return rbounds; }
index c979065d23acbc3b53cb242c131f00d69922f6af..13ebeff70d22d0709f32ea7d4bab92b67b53f746 100644 (file)
@@ -680,8 +680,6 @@ public:
                else
                        tasks.push_back(maintask);
 
-               DeviceTask task;
-
                foreach(DeviceTask& task, tasks) {
                        if(task.type == DeviceTask::TONEMAP)
                                tonemap(task);
index 650758a611371a67d3121544d6e94d4db83479ce..eb9effc2658c7d16545e7cd3f55fb52f381b350d 100644 (file)
@@ -55,7 +55,7 @@ public:
 
 class TextureNode : public ShaderNode {
 public:
-       TextureNode(const char *name) : ShaderNode(name) {}
+       TextureNode(const char *name_) : ShaderNode(name_) {}
        TextureMapping tex_mapping;
 };
 
index e160f1c93af9a52098acf9340f128d207f09f1f2..844ce01569f53a4813221d8326bc34f97499dc5b 100644 (file)
@@ -597,10 +597,10 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
        memset(&active_stack, 0, sizeof(active_stack));
        svm_nodes.clear();
 
-       foreach(ShaderNode *node, graph->nodes) {
-               foreach(ShaderInput *input, node->inputs)
+       foreach(ShaderNode *node_iter, graph->nodes) {
+               foreach(ShaderInput *input, node_iter->inputs)
                        input->stack_offset = SVM_STACK_INVALID;
-               foreach(ShaderOutput *output, node->outputs)
+               foreach(ShaderOutput *output, node_iter->outputs)
                        output->stack_offset = SVM_STACK_INVALID;
        }
 
index 07f89b2a371b155e2962b53188ad40a112f94f04..c8181838ec3fdce250177f097ec6440a18334ab2 100644 (file)
@@ -314,7 +314,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
                        stencil->get(eid1) = stencil->get(cid);
                        stencil->get(eid2) = stencil->get(cid);
 
-                       int j = 0;
+                       j = 0;
                        for(SubdVert::EdgeIterator eit(vert->edges()); !eit.isDone(); eit.advance(), j++) {
                                SubdEdge *edge = eit.current();
                                assert(vert->co == edge->from()->co);
@@ -402,8 +402,8 @@ void SubdAccBuilder::computeInteriorStencil(SubdFaceRing *ring, GregoryAccStenci
                        int idx2 = interior2Indices[primitiveOffset+v];
 
                        int i = 0;
-                       for(SubdFace::EdgeIterator it(face->edges(edge)); !it.isDone(); it.advance(), i++) {
-                               SubdVert *vert = it.current()->from();
+                       for(SubdFace::EdgeIterator it_sub(face->edges(edge)); !it_sub.isDone(); it_sub.advance(), i++) {
+                               SubdVert *vert = it_sub.current()->from();
                                stencil->get(idx1, vert) += weights1[i];
                                stencil->get(idx2, vert) += weights2[i];
                        }
index 583abb2b58a43404637aeff715f706788cfe0dcc..6920df9954c871f568fde77097d6cd9a16de5e4a 100644 (file)
@@ -388,13 +388,13 @@ void TriangleDice::add_grid(SubPatch& sub, EdgeFactors& ef, int M)
        for(m = M-2; m > 0; m -= 2) {
                vector<int> inner_u, inner_v, inner_w;
 
-               float t = m/(float)M;
+               const float t0 = m / (float)M;
                float2 center = make_float2(1.0f/3.0f, 1.0f/3.0f);
 
                /* 3 corner vertices */
-               float2 p_u = interp(center, make_float2(1.0f, 0.0f), t);
-               float2 p_v = interp(center, make_float2(0.0f, 1.0f), t);
-               float2 p_w = interp(center, make_float2(0.0f, 0.0f), t);
+               float2 p_u = interp(center, make_float2(1.0f, 0.0f), t0);
+               float2 p_v = interp(center, make_float2(0.0f, 1.0f), t0);
+               float2 p_w = interp(center, make_float2(0.0f, 0.0f), t0);
 
                int corner_u = add_vert(sub, p_u);
                int corner_v = add_vert(sub, p_v);
@@ -407,11 +407,11 @@ void TriangleDice::add_grid(SubPatch& sub, EdgeFactors& ef, int M)
 
                for(int i = 1; i < m; i++) {
                        /* add vertices between corners */
-                       float t = i/(float)m;
+                       const float t1 = i / (float)m;
 
-                       inner_u.push_back(add_vert(sub, interp(p_v, p_w, t)));
-                       inner_v.push_back(add_vert(sub, interp(p_w, p_u, t)));
-                       inner_w.push_back(add_vert(sub, interp(p_u, p_v, t)));
+                       inner_u.push_back(add_vert(sub, interp(p_v, p_w, t1)));
+                       inner_v.push_back(add_vert(sub, interp(p_w, p_u, t1)));
+                       inner_w.push_back(add_vert(sub, interp(p_u, p_v, t1)));
                }
 
                inner_u.push_back(corner_w);
index f0b87200f08c753d2ef8c051c365ff47db1395ad..074c82a23481ce179cfb09c165974746fce12331 100644 (file)
@@ -248,19 +248,19 @@ void DiagSplit::split(QuadDice::SubPatch& sub, QuadDice::EdgeFactors& ef, int de
 
 void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth)
 {
-       TriangleDice::SubPatch sub;
-       TriangleDice::EdgeFactors ef;
+       TriangleDice::SubPatch sub_split;
+       TriangleDice::EdgeFactors ef_split;
 
-       sub.patch = patch;
-       sub.Pu = make_float2(1.0f, 0.0f);
-       sub.Pv = make_float2(0.0f, 1.0f);
-       sub.Pw = make_float2(0.0f, 0.0f);
+       sub_split.patch = patch;
+       sub_split.Pu = make_float2(1.0f, 0.0f);
+       sub_split.Pv = make_float2(0.0f, 1.0f);
+       sub_split.Pw = make_float2(0.0f, 0.0f);
 
-       ef.tu = T(patch, sub.Pv, sub.Pw);
-       ef.tv = T(patch, sub.Pw, sub.Pu);
-       ef.tw = T(patch, sub.Pu, sub.Pv);
+       ef_split.tu = T(patch, sub_split.Pv, sub_split.Pw);
+       ef_split.tv = T(patch, sub_split.Pw, sub_split.Pu);
+       ef_split.tw = T(patch, sub_split.Pu, sub_split.Pv);
 
-       split(sub, ef);
+       split(sub_split, ef_split);
 
        TriangleDice dice(mesh, shader, smooth, dicing_rate);
        dice.camera = camera;
@@ -286,21 +286,21 @@ void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth
 
 void DiagSplit::split_quad(Mesh *mesh, Patch *patch, int shader, bool smooth)
 {
-       QuadDice::SubPatch sub;
-       QuadDice::EdgeFactors ef;
+       QuadDice::SubPatch sub_split;
+       QuadDice::EdgeFactors ef_split;
 
-       sub.patch = patch;
-       sub.P00 = make_float2(0.0f, 0.0f);
-       sub.P10 = make_float2(1.0f, 0.0f);
-       sub.P01 = make_float2(0.0f, 1.0f);
-       sub.P11 = make_float2(1.0f, 1.0f);
+       sub_split.patch = patch;
+       sub_split.P00 = make_float2(0.0f, 0.0f);
+       sub_split.P10 = make_float2(1.0f, 0.0f);
+       sub_split.P01 = make_float2(0.0f, 1.0f);
+       sub_split.P11 = make_float2(1.0f, 1.0f);
 
-       ef.tu0 = T(patch, sub.P00, sub.P10);
-       ef.tu1 = T(patch, sub.P01, sub.P11);
-       ef.tv0 = T(patch, sub.P00, sub.P01);
-       ef.tv1 = T(patch, sub.P10, sub.P11);
+       ef_split.tu0 = T(patch, sub_split.P00, sub_split.P10);
+       ef_split.tu1 = T(patch, sub_split.P01, sub_split.P11);
+       ef_split.tv0 = T(patch, sub_split.P00, sub_split.P01);
+       ef_split.tv1 = T(patch, sub_split.P10, sub_split.P11);
 
-       split(sub, ef);
+       split(sub_split, ef_split);
 
        QuadDice dice(mesh, shader, smooth, dicing_rate);
        dice.camera = camera;
index 3741d53c3783e2e53389cae9ea70fd92a3bf8265..9cab08cbc346d1f6af09a352592306917edc292b 100644 (file)
@@ -2961,12 +2961,12 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
 
                fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer");
                fprintf(f, "public:\n");
-               fprintf(f, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", srna->identifier,
+               fprintf(f, "\t%s(const PointerRNA& ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier,
                        (srna->base) ? srna->base->identifier : "Pointer");
                for (dp = ds->cont.properties.first; dp; dp = dp->next)
                        if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)))
                                if (dp->prop->type == PROP_COLLECTION)
-                                       fprintf(f, ",\n\t\t%s(ptr)", dp->prop->identifier);
+                                       fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier);
                fprintf(f, "\n\t\t{}\n\n");
 
                for (dp = ds->cont.properties.first; dp; dp = dp->next)