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
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-10-29 05:09:12 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-10-29 05:09:12 +0400
commit15ed8343437c6b304de72cd14591455da1d5b3ec (patch)
treecbe40f76668f5e8539744c4d2f8aeaa0ded72f52 /source/blender/render/intern
parent5acd5d14970c829c2873623716a67beeb6da5278 (diff)
parentdd106b5c7a129e00bebe121c4da8cb90a16d48cb (diff)
Merged changes in the trunk up to revision 51718.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/makesrna/intern/rna_scene.c release/datafiles/startup.blend
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/include/render_types.h2
-rw-r--r--source/blender/render/intern/include/shadbuf.h18
-rw-r--r--source/blender/render/intern/include/sunsky.h3
-rw-r--r--source/blender/render/intern/raytrace/bvh.h2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_blibvh.cpp4
-rw-r--r--source/blender/render/intern/raytrace/rayobject_instance.cpp2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_internal.h2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_qbvh.cpp2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_raycounter.cpp4
-rw-r--r--source/blender/render/intern/raytrace/rayobject_rtbuild.cpp30
-rw-r--r--source/blender/render/intern/raytrace/rayobject_vbvh.cpp4
-rw-r--r--source/blender/render/intern/raytrace/reorganize.h20
-rw-r--r--source/blender/render/intern/raytrace/svbvh.h20
-rw-r--r--source/blender/render/intern/raytrace/vbvh.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c121
-rw-r--r--source/blender/render/intern/source/envmap.c8
-rw-r--r--source/blender/render/intern/source/external_engine.c2
-rw-r--r--source/blender/render/intern/source/gammaCorrectionTables.c8
-rw-r--r--source/blender/render/intern/source/imagetexture.c22
-rw-r--r--source/blender/render/intern/source/occlusion.c6
-rw-r--r--source/blender/render/intern/source/pipeline.c36
-rw-r--r--source/blender/render/intern/source/pixelshading.c4
-rw-r--r--source/blender/render/intern/source/pointdensity.c4
-rw-r--r--source/blender/render/intern/source/rayshade.c26
-rw-r--r--source/blender/render/intern/source/render_result.c2
-rw-r--r--source/blender/render/intern/source/render_texture.c34
-rw-r--r--source/blender/render/intern/source/rendercore.c37
-rw-r--r--source/blender/render/intern/source/renderdatabase.c8
-rw-r--r--source/blender/render/intern/source/shadbuf.c26
-rw-r--r--source/blender/render/intern/source/shadeinput.c4
-rw-r--r--source/blender/render/intern/source/shadeoutput.c24
-rw-r--r--source/blender/render/intern/source/sss.c2
-rw-r--r--source/blender/render/intern/source/strand.c2
-rw-r--r--source/blender/render/intern/source/sunsky.c7
-rw-r--r--source/blender/render/intern/source/volume_precache.c4
-rw-r--r--source/blender/render/intern/source/volumetric.c6
-rw-r--r--source/blender/render/intern/source/voxeldata.c8
-rw-r--r--source/blender/render/intern/source/zbuf.c47
38 files changed, 270 insertions, 293 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index dab89e1d1c0..5e4417a3bc6 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -128,7 +128,7 @@ struct Render
/* if render with single-layer option, other rendered layers are stored here */
RenderResult *pushedresult;
/* a list of RenderResults, for fullsample */
- ListBase fullresult;
+ ListBase fullresult;
/* read/write mutex, all internal code that writes to re->result must use a
* write lock, all external code must use a read lock. internal code is assumed
* to not conflict with writes, so no lock used for that */
diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h
index 5cde8e5106a..7c168baada7 100644
--- a/source/blender/render/intern/include/shadbuf.h
+++ b/source/blender/render/intern/include/shadbuf.h
@@ -79,19 +79,19 @@ float ISB_getshadow(ShadeInput *shi, ShadBuf *shb);
/* buffer samples, allocated in camera buffer and pointed to in lampbuffer nodes */
typedef struct ISBSample {
- float zco[3]; /* coordinate in lampview projection */
- short *shadfac; /* initialized zero = full lighted */
- int obi; /* object for face lookup */
- int facenr; /* index in faces list */
+ float zco[3]; /* coordinate in lampview projection */
+ short *shadfac; /* initialized zero = full lighted */
+ int obi; /* object for face lookup */
+ int facenr; /* index in faces list */
} ISBSample;
/* transparent version of buffer sample */
typedef struct ISBSampleA {
- float zco[3]; /* coordinate in lampview projection */
- short *shadfac; /* NULL = full lighted */
- int obi; /* object for face lookup */
- int facenr; /* index in faces list */
- struct ISBSampleA *next; /* in end, we want the first items to align with ISBSample */
+ float zco[3]; /* coordinate in lampview projection */
+ short *shadfac; /* NULL = full lighted */
+ int obi; /* object for face lookup */
+ int facenr; /* index in faces list */
+ struct ISBSampleA *next; /* in end, we want the first items to align with ISBSample */
} ISBSampleA;
/* used for transparent storage only */
diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h
index 04aff810bbb..60fa8aa51ba 100644
--- a/source/blender/render/intern/include/sunsky.h
+++ b/source/blender/render/intern/include/sunsky.h
@@ -43,8 +43,7 @@ typedef struct SunSky {
float perez_Y[5], perez_x[5], perez_y[5];
- /* suggested by glome in
- * http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
+ /* suggested by glome in patch [#8063] */
float horizon_brightness;
float spread;
float sun_brightness;
diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h
index 103c04a590f..47d3a892e84 100644
--- a/source/blender/render/intern/raytrace/bvh.h
+++ b/source/blender/render/intern/raytrace/bvh.h
@@ -91,7 +91,7 @@ static inline int rayobject_bb_intersect_test(const Isect *isec, const float *_b
if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0;
if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
- RE_RC_COUNT(isec->raycounter->bb.hit);
+ RE_RC_COUNT(isec->raycounter->bb.hit);
return 1;
}
diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
index 2d642a0a0d8..198577f61c6 100644
--- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
@@ -79,7 +79,7 @@ typedef struct BVHObject {
RayObject *RE_rayobject_blibvh_create(int size)
{
BVHObject *obj = (BVHObject *)MEM_callocN(sizeof(BVHObject), "BVHObject");
- assert(RE_rayobject_isAligned(obj)); /* RayObject API assumes real data to be 4-byte aligned */
+ assert(RE_rayobject_isAligned(obj)); /* RayObject API assumes real data to be 4-byte aligned */
obj->rayobj.api = &bvh_api;
obj->bvh = BLI_bvhtree_new(size, 0.0, 4, 6);
@@ -137,7 +137,7 @@ static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob)
DO_MIN(min_max, obj->bb[0]);
DO_MAX(min_max + 3, obj->bb[1]);
- BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2);
+ BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2);
*(obj->next_leaf++) = ob;
}
diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp
index c3e761ae069..f797f7a4311 100644
--- a/source/blender/render/intern/raytrace/rayobject_instance.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp
@@ -59,7 +59,7 @@ static RayObjectAPI instance_api =
RE_rayobject_instance_free,
RE_rayobject_instance_bb,
RE_rayobject_instance_cost,
- RE_rayobject_instance_hint_bb
+ RE_rayobject_instance_hint_bb
};
typedef struct InstanceRayObject {
diff --git a/source/blender/render/intern/raytrace/rayobject_internal.h b/source/blender/render/intern/raytrace/rayobject_internal.h
index 07672f7bfb2..92ac39909a8 100644
--- a/source/blender/render/intern/raytrace/rayobject_internal.h
+++ b/source/blender/render/intern/raytrace/rayobject_internal.h
@@ -50,7 +50,7 @@ typedef int (*RE_rayobjectcontrol_test_break_callback)(void *data);
typedef struct RayObjectControl {
void *data;
- RE_rayobjectcontrol_test_break_callback test_break;
+ RE_rayobjectcontrol_test_break_callback test_break;
} RayObjectControl;
/* Returns true if for some reason a heavy processing function should stop
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index 16d70297a34..33ce3bd33d5 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -68,7 +68,7 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
//Build and optimize the tree
//TODO do this in 1 pass (half memory usage during building)
- VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
+ VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
BLI_memarena_free(arena1);
diff --git a/source/blender/render/intern/raytrace/rayobject_raycounter.cpp b/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
index 7d86b6cf8cb..5335bf50cbc 100644
--- a/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
@@ -43,10 +43,10 @@ void RE_RC_INFO(RayCounter *info)
printf("\n");
printf("BB tests: %llu\n", info->bb.test );
printf("BB hits: %llu\n", info->bb.hit );
- printf("\n");
+ printf("\n");
printf("SIMD BB tests: %llu\n", info->simd_bb.test );
printf("SIMD BB hits: %llu\n", info->simd_bb.hit );
- printf("\n");
+ printf("\n");
printf("Primitives tests: %llu\n", info->faces.test );
printf("Primitives hits: %llu\n", info->faces.hit );
printf("------------------------------------\n");
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index 678aa8e5634..bae65c492f4 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -77,7 +77,7 @@ RTBuilder *rtbuild_create(int size)
for (int i = 0; i < 3; i++) {
builder->sorted_begin[i] = (RTBuilder::Object **)MEM_mallocN(sizeof(RTBuilder::Object *) * size, "RTBuilder.sorted_objects");
builder->sorted_end[i] = builder->sorted_begin[i];
- }
+ }
return builder;
@@ -224,7 +224,7 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis)
Mleafs_per_child = s / nchilds;
mleafs_per_child = Mleafs_per_child / nchilds;
- //split min leafs per child
+ //split min leafs per child
b->child_offset[0] = 0;
for (i = 1; i <= nchilds; i++)
b->child_offset[i] = mleafs_per_child;
@@ -295,7 +295,7 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis)
return rtbuild_mean_split(b, nchilds, axis);
return nchilds;
- }
+ }
}
int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds)
@@ -324,7 +324,7 @@ struct SweepCost {
/* Object Surface Area Heuristic splitter */
int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
{
- int size = rtbuild_size(b);
+ int size = rtbuild_size(b);
assert(nchilds == 2);
assert(size > 1);
int baxis = -1, boffset = 0;
@@ -348,12 +348,12 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
sweep[i].cost = obj[i]->cost;
}
else {
- sweep[i].bb[0] = MIN2(obj[i]->bb[0], sweep[i + 1].bb[0]);
- sweep[i].bb[1] = MIN2(obj[i]->bb[1], sweep[i + 1].bb[1]);
- sweep[i].bb[2] = MIN2(obj[i]->bb[2], sweep[i + 1].bb[2]);
- sweep[i].bb[3] = MAX2(obj[i]->bb[3], sweep[i + 1].bb[3]);
- sweep[i].bb[4] = MAX2(obj[i]->bb[4], sweep[i + 1].bb[4]);
- sweep[i].bb[5] = MAX2(obj[i]->bb[5], sweep[i + 1].bb[5]);
+ sweep[i].bb[0] = min_ff(obj[i]->bb[0], sweep[i + 1].bb[0]);
+ sweep[i].bb[1] = min_ff(obj[i]->bb[1], sweep[i + 1].bb[1]);
+ sweep[i].bb[2] = min_ff(obj[i]->bb[2], sweep[i + 1].bb[2]);
+ sweep[i].bb[3] = max_ff(obj[i]->bb[3], sweep[i + 1].bb[3]);
+ sweep[i].bb[4] = max_ff(obj[i]->bb[4], sweep[i + 1].bb[4]);
+ sweep[i].bb[5] = max_ff(obj[i]->bb[5], sweep[i + 1].bb[5]);
sweep[i].cost = obj[i]->cost + sweep[i + 1].cost;
}
// right_cost += obj[i]->cost;
@@ -375,8 +375,8 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
// not using log seems to have no impact on raytracing perf, but
// makes tree construction quicker, left out for now to test (brecht)
- // left_side = bb_area(sweep_left.bb, sweep_left.bb+3)*(sweep_left.cost+logf((float)i));
- // right_side= bb_area(sweep[i].bb, sweep[i].bb+3)*(sweep[i].cost+logf((float)size-i));
+ // left_side = bb_area(sweep_left.bb, sweep_left.bb + 3) * (sweep_left.cost + logf((float)i));
+ // right_side = bb_area(sweep[i].bb, sweep[i].bb + 3) * (sweep[i].cost + logf((float)size - i));
left_side = bb_area(sweep_left.bb, sweep_left.bb + 3) * (sweep_left.cost);
right_side = bb_area(sweep[i].bb, sweep[i].bb + 3) * (sweep[i].cost);
hcost = left_side + right_side;
@@ -429,7 +429,7 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
for (int i = 0; i < 3; i++)
std::stable_partition(b->sorted_begin[i], b->sorted_end[i], selected_node);
- return nchilds;
+ return nchilds;
}
/*
@@ -494,7 +494,7 @@ int bb_largest_axis(const float min[3], const float max[3])
return 1;
else
return 2;
- }
+ }
}
/* only returns 0 if merging inner and outerbox would create a box larger than outer box */
@@ -508,5 +508,5 @@ int bb_fits_inside(const float outer_min[3], const float outer_max[3],
for (i = 0; i < 3; i++)
if (outer_max[i] < inner_max[i]) return 0;
- return 1;
+ return 1;
}
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index 85c9d0d402f..d03bdb74407 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -112,7 +112,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
//Finds the optimal packing of this tree using a given cost model
//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
- OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena2).transform(obj->builder);
+ OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena2).transform(obj->builder);
VBVH_optimalPackSIMD<OVBVHNode, PackCost>(PackCost()).transform(root);
obj->root = Reorganize_VBVH<OVBVHNode>(arena1).transform(root);
@@ -125,7 +125,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
obj->builder = NULL;
obj->node_arena = arena1;
- obj->cost = 1.0;
+ obj->cost = 1.0;
}
template<int StackSize>
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index a9ed71a76bc..9d9711eee56 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -75,7 +75,7 @@ void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float, Nod
float pcost = bb_area(parent->bb, parent->bb + 3);
cost = std::min(cost, std::make_pair(pcost, parent) );
for (Node *child = parent->child; child; child = child->sibling)
- q.push(child);
+ q.push(child);
}
}
}
@@ -140,7 +140,7 @@ void remove_useless(Node *node, Node **new_node)
(*prev)->sibling = next;
prev = &((*prev)->sibling);
}
- }
+ }
}
if (node->child) {
if (RE_rayobject_isAligned(node->child) && node->child->sibling == 0)
@@ -181,7 +181,7 @@ void pushup(Node *parent)
*prev = child;
prev = &(*prev)->sibling;
child = *prev;
- }
+ }
}
for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
@@ -205,13 +205,13 @@ void pushup_simd(Node *parent)
n += (cn - 1);
append_sibling(child, child->child);
child = child->sibling;
- *prev = child;
+ *prev = child;
}
else {
*prev = child;
prev = &(*prev)->sibling;
child = *prev;
- }
+ }
}
for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
@@ -320,7 +320,7 @@ struct OVBVHNode {
/*
* Reorganize the node based on calculated cut costs
- */
+ */
int best_cutsize;
void set_cut(int cutsize, OVBVHNode ***cut)
{
@@ -357,7 +357,7 @@ struct OVBVHNode {
//Optimize new childs
for (OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
child->optimize();
- }
+ }
}
};
@@ -431,7 +431,7 @@ struct VBVH_optimalPackSIMD {
current_size -= bt[j][current_size];
}
}
- }
+ }
}
};
@@ -493,6 +493,6 @@ struct VBVH_optimalPackSIMD {
if ((G.debug & G_DEBUG) && first) printf("expected cost = %f (%d)\n", node->cut_cost[0], node->best_cutsize);
node->optimize();
}
- return node;
- }
+ return node;
+ }
};
diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h
index 4fdf3ac23e8..757ebc4c4d3 100644
--- a/source/blender/render/intern/raytrace/svbvh.h
+++ b/source/blender/render/intern/raytrace/svbvh.h
@@ -96,7 +96,7 @@ static int svbvh_bb_intersect_test(const Isect *isec, const float *_bb)
if (t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
- RE_RC_COUNT(isec->raycounter->bb.hit);
+ RE_RC_COUNT(isec->raycounter->bb.hit);
return 1;
}
@@ -165,16 +165,16 @@ inline void bvh_node_merge_bb<SVBVHNode>(SVBVHNode *node, float min[3], float ma
for (i = 0; i + 4 <= node->nchilds; i += 4) {
float *res = node->child_bb + 6 * i;
for (int j = 0; j < 3; j++) {
- min[j] = minf(res[4 * j + 0],
- minf(res[4 * j + 1],
- minf(res[4 * j + 2],
- minf(res[4 * j + 3], min[j]))));
+ min[j] = min_ff(res[4 * j + 0],
+ min_ff(res[4 * j + 1],
+ min_ff(res[4 * j + 2],
+ min_ff(res[4 * j + 3], min[j]))));
}
for (int j = 0; j < 3; j++) {
- max[j] = maxf(res[4 * (j + 3) + 0],
- maxf(res[4 * (j + 3) + 1],
- maxf(res[4 * (j + 3) + 2],
- maxf(res[4 * (j + 3) + 3], max[j]))));
+ max[j] = max_ff(res[4 * (j + 3) + 0],
+ max_ff(res[4 * (j + 3) + 1],
+ max_ff(res[4 * (j + 3) + 2],
+ max_ff(res[4 * (j + 3) + 3], max[j]))));
}
}
@@ -307,7 +307,7 @@ struct Reorganize_SVBVH {
prepare_for_simd(node);
return node;
- }
+ }
};
#endif /* __SSE__ */
diff --git a/source/blender/render/intern/raytrace/vbvh.h b/source/blender/render/intern/raytrace/vbvh.h
index ec671f95c76..9755bf89668 100644
--- a/source/blender/render/intern/raytrace/vbvh.h
+++ b/source/blender/render/intern/raytrace/vbvh.h
@@ -233,6 +233,6 @@ struct Reorganize_VBVH {
*child_ptr = 0;
return node;
- }
+ }
};
#endif
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index e399951bd15..4aa30e6c4cf 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -157,7 +157,7 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, const float vec[3], float h
*/
void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
- void (*vertexfunc)(float*), void (*termfunc)(void))
+ void (*vertexfunc)(float*), void (*termfunc)(void))
{
extern unsigned char hash[512];
ObjectRen *obr= NULL;
@@ -228,7 +228,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
hlfrand = 2.0 * dblrand;
if (initfunc) {
- initfunc();
+ initfunc();
}
if (re) /* add render object for stars */
@@ -365,7 +365,7 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int UNUSED(startv
if (v==0) {
vlr->v1 = RE_vertren_copy(obr, vlr->v1);
- }
+ }
}
}
}
@@ -447,7 +447,7 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
}
/* gets tangent from tface or orco */
-static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemArena *arena, VlakRen *vlr, int do_nmap_tangent, int do_tangent)
+static void calc_tangent_vector(ObjectRen *obr, VlakRen *vlr, int do_tangent)
{
MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
VertRen *v1=vlr->v1, *v2=vlr->v2, *v3=vlr->v3, *v4=vlr->v4;
@@ -482,12 +482,6 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
add_v3_v3(tav, tang);
}
- if (do_nmap_tangent) {
- sum_or_add_vertex_tangent(arena, &vtangents[v1->index], tang, uv1);
- sum_or_add_vertex_tangent(arena, &vtangents[v2->index], tang, uv2);
- sum_or_add_vertex_tangent(arena, &vtangents[v3->index], tang, uv3);
- }
-
if (v4) {
tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, vlr->n, tang);
@@ -499,12 +493,6 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
tav= RE_vertren_get_tangent(obr, v4, 1);
add_v3_v3(tav, tang);
}
-
- if (do_nmap_tangent) {
- sum_or_add_vertex_tangent(arena, &vtangents[v1->index], tang, uv1);
- sum_or_add_vertex_tangent(arena, &vtangents[v3->index], tang, uv3);
- sum_or_add_vertex_tangent(arena, &vtangents[v4->index], tang, uv4);
- }
}
}
@@ -569,8 +557,14 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
//assert(vert_index>=0 && vert_index<4);
SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num);
- const float *n= (&vlr->v1)[vert_index]->n;
- copy_v3_v3(fNorm, n);
+
+ if (vlr->flag & ME_SMOOTH) {
+ const float *n = (&vlr->v1)[vert_index]->n;
+ copy_v3_v3(fNorm, n);
+ }
+ else {
+ negate_v3_v3(fNorm, vlr->n);
+ }
}
static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)
{
@@ -586,17 +580,8 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent
static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangent, int do_nmap_tangent)
{
- MemArena *arena= NULL;
- VertexTangent **vtangents= NULL;
int a;
- if (do_nmap_tangent) {
- arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
- BLI_memarena_use_calloc(arena);
-
- vtangents= MEM_callocN(sizeof(VertexTangent*)*obr->totvert, "VertexTangent");
- }
-
/* clear all vertex normals */
for (a=0; a<obr->totvert; a++) {
VertRen *ver= RE_findOrAddVert(obr, a);
@@ -614,10 +599,10 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
accumulate_vertex_normals(vlr->v1->n, vlr->v2->n, vlr->v3->n, n4,
vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co, c4);
}
- if (do_nmap_tangent || do_tangent) {
+ if (do_tangent) {
/* tangents still need to be calculated for flat faces too */
/* weighting removed, they are not vertexnormals */
- calc_tangent_vector(obr, vtangents, arena, vlr, do_nmap_tangent, do_tangent);
+ calc_tangent_vector(obr, vlr, do_tangent);
}
}
@@ -631,32 +616,6 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
if (is_zero_v3(vlr->v3->n)) copy_v3_v3(vlr->v3->n, vlr->n);
if (vlr->v4 && is_zero_v3(vlr->v4->n)) copy_v3_v3(vlr->v4->n, vlr->n);
}
-
- if (do_nmap_tangent) {
- VertRen *v1=vlr->v1, *v2=vlr->v2, *v3=vlr->v3, *v4=vlr->v4;
- MTFace *tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
-
- if (tface) {
- int k=0;
- float *vtang, *ftang= RE_vlakren_get_nmap_tangent(obr, vlr, 1);
-
- vtang= find_vertex_tangent(vtangents[v1->index], tface->uv[0]);
- copy_v3_v3(ftang, vtang);
- normalize_v3(ftang);
- vtang= find_vertex_tangent(vtangents[v2->index], tface->uv[1]);
- copy_v3_v3(ftang+4, vtang);
- normalize_v3(ftang+4);
- vtang= find_vertex_tangent(vtangents[v3->index], tface->uv[2]);
- copy_v3_v3(ftang+8, vtang);
- normalize_v3(ftang+8);
- if (v4) {
- vtang= find_vertex_tangent(vtangents[v4->index], tface->uv[3]);
- copy_v3_v3(ftang+12, vtang);
- normalize_v3(ftang+12);
- }
- for (k=0; k<4; k++) ftang[4*k+3]=1;
- }
- }
}
/* normalize vertex normals */
@@ -676,6 +635,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
}
}
+ /* normal mapping tangent with mikktspace */
if (do_nmap_tangent != FALSE) {
SRenderMeshToTangent mesh2tangent;
SMikkTSpaceContext sContext;
@@ -697,11 +657,6 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
genTangSpaceDefault(&sContext);
}
-
- if (arena)
- BLI_memarena_free(arena);
- if (vtangents)
- MEM_freeN(vtangents);
}
/* ------------------------------------------------------------------------- */
@@ -883,7 +838,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
else
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
- }
+ }
}
/* ------------------------------------------------------------------------- */
@@ -1614,7 +1569,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
psys->flag |= PSYS_DRAWING;
- rng= rng_new(psys->seed);
+ rng= BLI_rng_new(psys->seed);
totpart=psys->totpart;
@@ -1764,7 +1719,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* 3. start creating renderable things */
for (a=0, pa=pars; a<totpart+totchild; a++, pa++, seed++) {
- random = rng_getFloat(rng);
+ random = BLI_rng_get_float(rng);
/* setup per particle individual stuff */
if (a<totpart) {
if (pa->flag & PARS_UNEXIST) continue;
@@ -1940,7 +1895,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
copy_v3_v3(state.vel, (cache+k)->vel);
}
else
- continue;
+ continue;
if (k > 0)
curlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
@@ -2100,7 +2055,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if (states)
MEM_freeN(states);
- rng_free(rng);
+ BLI_rng_free(rng);
psys->flag &= ~PSYS_DRAWING;
@@ -2368,7 +2323,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
/* Recalculate the face normal - if flipped before, flip now */
if (vlr->v4) {
normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
- }
+ }
else {
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
@@ -2537,7 +2492,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
copy_v3_v3(v1->co, data); data += 3;
if (orco) {
v1->orco= orco; orco+= 3; orcoret++;
- }
+ }
mul_m4_v3(mat, v1->co);
for (v = 1; v < sizev; v++) {
@@ -2545,7 +2500,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
copy_v3_v3(ver->co, data); data += 3;
if (orco) {
ver->orco= orco; orco+= 3; orcoret++;
- }
+ }
mul_m4_v3(mat, ver->co);
}
/* if V-cyclic, add extra vertices at end of the row */
@@ -2555,8 +2510,8 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
if (orco) {
ver->orco= orco; orco+=3; orcoret++; //orcobase + 3*(u*sizev + 0);
}
- }
- }
+ }
+ }
/* Done before next loop to get corner vert */
if (dl->flag & DL_CYCL_U) nsizev++;
@@ -2609,7 +2564,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
p1++; p2++; p3++; p4++;
}
- }
+ }
/* fix normals for U resp. V cyclic faces */
sizeu--; sizev--; /* dec size for face array */
if (dl->flag & DL_CYCL_V) {
@@ -2930,8 +2885,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
vlr->v2= RE_findOrAddVert(obr, startvert+index[1]);
vlr->v3= RE_findOrAddVert(obr, startvert+index[2]);
vlr->v4= NULL;
-
- if (area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON) {
+ if (area_tri_v3(vlr->v3->co, vlr->v2->co, vlr->v1->co)>FLT_EPSILON10) {
normal_tri_v3(tmp, vlr->v3->co, vlr->v2->co, vlr->v1->co);
add_v3_v3(n, tmp);
}
@@ -3293,11 +3247,11 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
/* normalmaps, test if tangents needed, separated from shading */
if (ma->mode_l & MA_TANGENT_V) {
need_tangent= 1;
- if (me->mtface==NULL)
+ if (me->mtpoly==NULL)
need_orco= 1;
}
if (ma->mode_l & MA_NORMAP_TANG) {
- if (me->mtface==NULL) {
+ if (me->mtpoly==NULL) {
need_orco= 1;
need_tangent= 1;
}
@@ -3308,7 +3262,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
if (re->flag & R_NEED_TANGENT) {
/* exception for tangent space baking */
- if (me->mtface==NULL) {
+ if (me->mtpoly==NULL) {
need_orco= 1;
need_tangent= 1;
}
@@ -3659,22 +3613,22 @@ static void area_lamp_vectors(LampRen *lar)
/* corner vectors */
lar->area[0][0]= lar->co[0] - xsize*lar->mat[0][0] - ysize*lar->mat[1][0];
lar->area[0][1]= lar->co[1] - xsize*lar->mat[0][1] - ysize*lar->mat[1][1];
- lar->area[0][2]= lar->co[2] - xsize*lar->mat[0][2] - ysize*lar->mat[1][2];
+ lar->area[0][2]= lar->co[2] - xsize*lar->mat[0][2] - ysize*lar->mat[1][2];
/* corner vectors */
lar->area[1][0]= lar->co[0] - xsize*lar->mat[0][0] + ysize*lar->mat[1][0];
lar->area[1][1]= lar->co[1] - xsize*lar->mat[0][1] + ysize*lar->mat[1][1];
- lar->area[1][2]= lar->co[2] - xsize*lar->mat[0][2] + ysize*lar->mat[1][2];
+ lar->area[1][2]= lar->co[2] - xsize*lar->mat[0][2] + ysize*lar->mat[1][2];
/* corner vectors */
lar->area[2][0]= lar->co[0] + xsize*lar->mat[0][0] + ysize*lar->mat[1][0];
lar->area[2][1]= lar->co[1] + xsize*lar->mat[0][1] + ysize*lar->mat[1][1];
- lar->area[2][2]= lar->co[2] + xsize*lar->mat[0][2] + ysize*lar->mat[1][2];
+ lar->area[2][2]= lar->co[2] + xsize*lar->mat[0][2] + ysize*lar->mat[1][2];
/* corner vectors */
lar->area[3][0]= lar->co[0] + xsize*lar->mat[0][0] - ysize*lar->mat[1][0];
lar->area[3][1]= lar->co[1] + xsize*lar->mat[0][1] - ysize*lar->mat[1][1];
- lar->area[3][2]= lar->co[2] + xsize*lar->mat[0][2] - ysize*lar->mat[1][2];
+ lar->area[3][2]= lar->co[2] + xsize*lar->mat[0][2] - ysize*lar->mat[1][2];
/* only for correction button size, matrix size works on energy */
lar->areasize= lar->dist*lar->dist/(4.0f*xsize*ysize);
}
@@ -4995,7 +4949,8 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
* a dupligroup that has already been created before */
if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
mult_m4_m4m4(mat, re->viewmat, dob->mat);
- obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat, obd->lay);
+ /* ob = particle system, use that layer */
+ obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat, ob->lay);
/* fill in instance variables for texturing */
set_dupli_tex_mat(re, obi, dob);
@@ -5396,7 +5351,7 @@ static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen
calculate_speedvector(vec, 1, winsq, winroot, mesh->co[a], ho, winspeed[a]);
}
- return (float*)winspeed;
+ return (float *)winspeed;
}
return NULL;
@@ -5654,7 +5609,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
re->i.infostr= "Calculating next frame vectors";
database_fromscene_vectors(re, sce, lay, +1);
- }
+ }
/* copy away vertex info */
copy_dbase_object_vectors(re, &newtable);
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 910307f370b..558ba8fe062 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -76,7 +76,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
BLI_lock_thread(LOCK_IMAGE);
if (env->cube[1] == NULL) {
- BKE_free_envmapdata(env);
+ BKE_free_envmapdata(env);
dx = ibuf->y;
dx /= 2;
@@ -120,7 +120,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
IMB_float_from_rect(env->cube[1]);
}
}
- }
+ }
BLI_unlock_thread(LOCK_IMAGE);
}
@@ -216,7 +216,7 @@ static void envmap_transmatrix(float mat[][4], int part)
eul[0] = eul[1] = eul[2] = 0.0;
if (part == 0) { /* neg z */
- ;
+ /* pass */
}
else if (part == 1) { /* pos z */
eul[0] = M_PI;
@@ -576,7 +576,7 @@ void make_envmaps(Render *re)
re->display_init(re->dih, re->result);
re->display_clear(re->dch, re->result);
// re->flag |= R_REDRAW_PRV;
- }
+ }
/* restore */
re->r.mode |= trace;
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 636b3205b23..94146467145 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -138,7 +138,7 @@ void RE_engine_free(RenderEngine *engine)
{
#ifdef WITH_PYTHON
if (engine->py_instance) {
- BPY_DECREF(engine->py_instance);
+ BPY_DECREF_RNA_INVALIDATE(engine->py_instance);
}
#endif
diff --git a/source/blender/render/intern/source/gammaCorrectionTables.c b/source/blender/render/intern/source/gammaCorrectionTables.c
index 1c2613e8d18..8efdf472232 100644
--- a/source/blender/render/intern/source/gammaCorrectionTables.c
+++ b/source/blender/render/intern/source/gammaCorrectionTables.c
@@ -107,13 +107,13 @@ void makeGammaTables(float gamma)
color_step = 1.0 / RE_GAMMA_TABLE_SIZE;
inv_color_step = (float) RE_GAMMA_TABLE_SIZE;
- /* We could squeeze out the two range tables to gain some memory. */
+ /* We could squeeze out the two range tables to gain some memory. */
for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
- color_domain_table[i] = i * color_step;
+ color_domain_table[i] = i * color_step;
gamma_range_table[i] = pow(color_domain_table[i],
- valid_gamma);
+ valid_gamma);
inv_gamma_range_table[i] = pow(color_domain_table[i],
- valid_inv_gamma);
+ valid_inv_gamma);
}
/* The end of the table should match 1.0 carefully. In order to avoid */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 154292a3065..44faee73d35 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -102,7 +102,7 @@ static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
col[1] = ((float)rect[1])*(1.0f/255.0f);
col[2] = ((float)rect[2])*(1.0f/255.0f);
col[3] = ((float)rect[3])*(1.0f/255.0f);
- }
+ }
}
int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResult *texres)
@@ -209,7 +209,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
if (tex->imaflag & TEX_USEALPHA) {
if ((tex->imaflag & TEX_CALCALPHA) == 0) {
texres->talpha = TRUE;
- }
+ }
}
/* interpolate */
@@ -693,7 +693,7 @@ static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extf
}
}
else {
- char* rect = (char*)(ibuf->rect + x + y*ibuf->x);
+ char *rect = (char *)(ibuf->rect + x + y*ibuf->x);
col[0] = rect[0]*(1.f/255.f);
col[1] = rect[1]*(1.f/255.f);
col[2] = rect[2]*(1.f/255.f);
@@ -989,7 +989,7 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl
alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
alphaclip *= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
- alphaclip = maxf(alphaclip, 0.0f);
+ alphaclip = max_ff(alphaclip, 0.0f);
if (alphaclip!=1.0f) {
/* premul it all */
@@ -1011,7 +1011,7 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
if (ibuf->userflags & IB_MIPMAP_INVALID) {
IMB_remakemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
ibuf->userflags &= ~IB_MIPMAP_INVALID;
- }
+ }
BLI_unlock_thread(LOCK_IMAGE);
}
if (ibuf->mipmap[0] == NULL) {
@@ -1247,8 +1247,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
float fProbes;
a *= ff;
b *= ff;
- a = maxf(a, 1.0f);
- b = maxf(b, 1.0f);
+ a = max_ff(a, 1.0f);
+ b = max_ff(b, 1.0f);
fProbes = 2.f*(a / b) - 1.f;
AFD.iProbes = (int)floorf(fProbes + 0.5f);
AFD.iProbes = MIN2(AFD.iProbes, tex->afmax);
@@ -1264,7 +1264,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
if (ecc > (float)tex->afmax) b = a / (float)tex->afmax;
b *= ff;
}
- maxd = maxf(b, 1e-8f);
+ maxd = max_ff(b, 1e-8f);
levf = ((float)M_LOG2E) * logf(maxd);
curmap = 0;
@@ -1349,8 +1349,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
a *= ff;
b *= ff;
- a = maxf(a, 1.0f);
- b = maxf(b, 1.0f);
+ a = max_ff(a, 1.0f);
+ b = max_ff(b, 1.0f);
fProbes = 2.f*(a / b) - 1.f;
/* no limit to number of Probes here */
AFD.iProbes = (int)floorf(fProbes + 0.5f);
@@ -1645,7 +1645,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
dx = minx;
dy = miny;
- maxd = maxf(dx, dy);
+ maxd = max_ff(dx, dy);
if (maxd > 0.5f) maxd = 0.5f;
pixsize = 1.0f / (float) MIN2(ibuf->x, ibuf->y);
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 895c5d6c8fb..a7308821843 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -184,7 +184,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
if (shi->flippednor)
shade_input_flip_normals(shi);
- madd_v3_v3fl(shi->co, shi->vn, 0.0001f); /* ugly.. */
+ madd_v3_v3fl(shi->co, shi->facenor, -0.0001f); /* ugly.. */
/* not a pretty solution, but fixes common cases */
if (shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
@@ -1130,7 +1130,7 @@ static void normalizef(float *n)
n[0] *= d;
n[1] *= d;
n[2] *= d;
- }
+ }
}
/* TODO: exact duplicate of ff_quad_form_factor() in math_geom.c
@@ -1547,7 +1547,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
for (i = 0; i < 4; i++) {
sub_v3_v3v3(d, samples[i]->co, co);
- //dist2= dot_v3v3(d, d);
+ //dist2 = dot_v3v3(d, d);
wz[i] = 1.0f; //(samples[i]->dist2/(1e-4f + dist2));
wn[i] = pow(dot_v3v3(samples[i]->n, n), 32.0f);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 648c27e0d2f..8f1037ec051 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -502,7 +502,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
}
/* always call, checks for gamma, gamma tables and jitter too */
- make_sample_tables(re);
+ make_sample_tables(re);
/* if preview render, we try to keep old result */
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -994,7 +994,7 @@ static void addblur_rect_key(RenderResult *rr, float *rectf, float *rectf1, floa
rf[1] = mfac * rf[1] + blurfac * rf1[1];
rf[2] = mfac * rf[2] + blurfac * rf1[2];
rf[3] = mfac * rf[3] + blurfac * rf1[3];
- }
+ }
}
}
rectf += stride;
@@ -1086,7 +1086,7 @@ static void do_render_blur_3d(Render *re)
/* weak... the display callback wants an active renderlayer pointer... */
re->result->renlay = render_get_active_layer(re, re->result);
- re->display_draw(re->ddh, re->result, NULL);
+ re->display_draw(re->ddh, re->result, NULL);
}
@@ -1646,7 +1646,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
ntreeFreeCache(ntree);
do_render_fields_blur_3d(re);
- }
+ }
else {
/* ensure new result gets added, like for regular renders */
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -1953,7 +1953,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
if (scene->r.border.xmax <= scene->r.border.xmin ||
scene->r.border.ymax <= scene->r.border.ymin)
{
- BKE_report(reports, RPT_ERROR, "No border area selected.");
+ BKE_report(reports, RPT_ERROR, "No border area selected");
return 0;
}
}
@@ -1964,13 +1964,13 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
render_result_exr_file_path(scene, "", 0, str);
if (BLI_file_is_writable(str) == 0) {
- BKE_report(reports, RPT_ERROR, "Can not save render buffers, check the temp default path");
+ BKE_report(reports, RPT_ERROR, "Cannot save render buffers, check the temp default path");
return 0;
}
/* no fullsample and edge */
if ((scene->r.scemode & R_FULL_SAMPLE) && (scene->r.mode & R_EDGE)) {
- BKE_report(reports, RPT_ERROR, "Full Sample doesn't support Edge Enhance");
+ BKE_report(reports, RPT_ERROR, "Full sample does not support edge enhance");
return 0;
}
@@ -1981,18 +1981,18 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
if (scene->r.scemode & R_DOCOMP) {
if (scene->use_nodes) {
if (!scene->nodetree) {
- BKE_report(reports, RPT_ERROR, "No node tree in Scene");
+ BKE_report(reports, RPT_ERROR, "No node tree in scene");
return 0;
}
if (!check_composite_output(scene)) {
- BKE_report(reports, RPT_ERROR, "No Render Output Node in Scene");
+ BKE_report(reports, RPT_ERROR, "No render output node in scene");
return 0;
}
if (scene->r.scemode & R_FULL_SAMPLE) {
if (composite_needs_render(scene, 0) == 0) {
- BKE_report(reports, RPT_ERROR, "Full Sample AA not supported without 3d rendering");
+ BKE_report(reports, RPT_ERROR, "Full sample AA not supported without 3D rendering");
return 0;
}
}
@@ -2011,7 +2011,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
/* forbidden combinations */
if (scene->r.mode & R_PANORAMA) {
if (scene->r.mode & R_ORTHO) {
- BKE_report(reports, RPT_ERROR, "No Ortho render possible for Panorama");
+ BKE_report(reports, RPT_ERROR, "No ortho render possible for panorama");
return 0;
}
}
@@ -2027,7 +2027,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
if (!(srl->layflag & SCE_LAY_DISABLE))
break;
if (srl == NULL) {
- BKE_report(reports, RPT_ERROR, "All RenderLayers are disabled");
+ BKE_report(reports, RPT_ERROR, "All render layers are disabled");
return 0;
}
@@ -2230,7 +2230,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
IMB_freeImBuf(ibuf);
printf("Append frame %d", scene->r.cfra);
- }
+ }
else {
if (name_override)
BLI_strncpy(name, name_override, sizeof(name));
@@ -2550,25 +2550,25 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char
IMB_freeImBuf(ibuf_clip);
}
else {
- BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to allocate clip buffer '%s'\n", filename);
+ BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to allocate clip buffer '%s'", filename);
}
}
else {
- BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: incorrect dimensions for partial copy '%s'\n", filename);
+ BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: incorrect dimensions for partial copy '%s'", filename);
}
}
IMB_freeImBuf(ibuf);
}
else {
- BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename);
+ BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'", filename);
}
}
void RE_result_load_from_file(RenderResult *result, ReportList *reports, const char *filename)
{
if (!render_result_exr_file_read_path(result, NULL, filename)) {
- BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename);
+ BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'", filename);
return;
}
}
@@ -2629,7 +2629,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
return TRUE;
}
else {
- BKE_report(reports, RPT_ERROR, "Error writing environment map.");
+ BKE_report(reports, RPT_ERROR, "Error writing environment map");
return FALSE;
}
}
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 8e6078b18e0..3420648cb52 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -162,7 +162,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
copy_v3_v3(lvrot, lv);
mul_m3_v3(lar->imat, lvrot);
- x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
+ x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
/* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
inpr= 1.0/(sqrt(1.0f+x*x));
@@ -614,7 +614,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
copy_v3_v3(collector, &R.wrld.horr);
collector[3] = 0.0f;
- }
+ }
else {
/* 2. */
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index f8462dcd888..a540cdb85d5 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -171,7 +171,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
pd->point_data[i*3 + 0] = state.vel[0];
pd->point_data[i*3 + 1] = state.vel[1];
pd->point_data[i*3 + 2] = state.vel[2];
- }
+ }
if (data_used & POINT_DATA_LIFE) {
float pa_time;
@@ -419,7 +419,7 @@ int pointdensitytex(Tex *tex, const float texvec[3], TexResult *texres)
texres->tin = 0.0f;
- if ((!pd) || (!pd->point_tree))
+ if ((!pd) || (!pd->point_tree))
return 0;
init_pointdensityrangedata(pd, &pdr, &density, vec, &age,
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 260a80d70e9..127e0bc07b9 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -239,7 +239,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
if (faces == 0)
return NULL;
- //Create Ray cast accelaration structure
+ //Create Ray cast accelaration structure
raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces );
if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
vlakprimitive = obr->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "ObjectRen primitives");
@@ -549,7 +549,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
/* raytrace likes to separate the spec color */
sub_v3_v3v3(shr->diff, shr->combined, shr->spec);
- }
+ }
}
@@ -564,12 +564,12 @@ static int refraction(float refract[3], const float n[3], const float view[3], f
if (dot>0.0f) {
index = 1.0f/index;
fac= 1.0f - (1.0f - dot*dot)*index*index;
- if (fac<= 0.0f) return 0;
+ if (fac <= 0.0f) return 0;
fac= -dot*index + sqrtf(fac);
}
else {
fac= 1.0f - (1.0f - dot*dot)*index*index;
- if (fac<= 0.0f) return 0;
+ if (fac <= 0.0f) return 0;
fac= -dot*index - sqrtf(fac);
}
@@ -632,7 +632,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
if (shi->mat->tx_limit <= 0.0f) {
d= 1.0f;
- }
+ }
else {
float p;
@@ -733,7 +733,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
if (depth>0) {
float fr, fg, fb, f, f1;
- if ((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
+ if ((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
float nf, f, refract[3], tracol[4];
tracol[0]= shi.r;
@@ -938,7 +938,7 @@ void init_jitter_plane(LampRen *lar)
DP_energy(lar->jitter, fp, tot, lar->area_size, lar->area_sizey);
}
}
- }
+ }
/* create the dithered tables (could just check lamp type!) */
jitter_plane_offset(lar->jitter, lar->jitter+2*tot, tot, lar->area_size, lar->area_sizey, 0.5f, 0.0f);
jitter_plane_offset(lar->jitter, lar->jitter+4*tot, tot, lar->area_size, lar->area_sizey, 0.5f, 0.5f);
@@ -1151,7 +1151,7 @@ static void QMC_sampleHemiCosine(float vec[3], QMCSampler *qsa, int thread, int
QMC_getSample(s, qsa, thread, num);
- phi = s[0]*2.f*M_PI;
+ phi = s[0]*2.f*M_PI;
sqr = s[1]*sqrt(2-s[1]*s[1]);
vec[0] = cos(phi)*sqr;
@@ -1295,7 +1295,7 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
max_samples = 1;
- while (samples < max_samples) {
+ while (samples < max_samples) {
if (refraction(v_refract, shi->vn, shi->view, shi->ang)) {
traflag |= RAY_INSIDE;
}
@@ -1515,7 +1515,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
if (!(shi->combinedflag & SCE_PASS_REFRACT))
sub_v3_v3v3(diff, diff, shr->refr);
- shr->alpha = minf(1.0f, tracol[3]);
+ shr->alpha = min_ff(1.0f, tracol[3]);
}
if (do_mir) {
@@ -1822,7 +1822,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in
}
return sphere;
- }
+ }
else {
float *sphere;
float *vec1;
@@ -1847,7 +1847,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in
for (a=0; a<tot; a++, vec+=3, vec1+=3) {
vec1[0]= cost*cosfi*vec[0] - sinfi*vec[1] + sint*cosfi*vec[2];
vec1[1]= cost*sinfi*vec[0] + cosfi*vec[1] + sint*sinfi*vec[2];
- vec1[2]= -sint*vec[0] + cost*vec[2];
+ vec1[2]= -sint*vec[0] + cost*vec[2];
}
}
return sphere;
@@ -1981,7 +1981,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
samples++;
if (qsa && qsa->type == SAMP_TYPE_HALTON) {
- /* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */
+ /* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */
if (adapt_thresh > 0.0f && (samples > max_samples/2) ) {
if (adaptive_sample_contrast_val(samples, prev, fac, adapt_thresh)) {
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index a226556828e..eb330177bac 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -789,7 +789,7 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
}
else {
/* TODO, get the error from openexr's exception */
- BKE_report(reports, RPT_ERROR, "Error Writing Render Result, see console");
+ BKE_report(reports, RPT_ERROR, "Error writing render result (see console)");
success = FALSE;
}
IMB_exr_close(exrhandle);
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 167e91272e2..c507d6595e0 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -303,7 +303,7 @@ static float tex_tri(float a)
/* computes basic wood intensity value at x,y,z */
static float wood_int(Tex *tex, float x, float y, float z)
{
- float wi=0;
+ float wi = 0;
short wf = tex->noisebasis2; /* wave form: TEX_SIN=0, TEX_SAW=1, TEX_TRI=2 */
short wt = tex->stype; /* wood type: TEX_BAND=0, TEX_RING=1, TEX_BANDNOISE=2, TEX_RINGNOISE=3 */
@@ -374,7 +374,7 @@ static float marble_int(Tex *tex, float x, float y, float z)
mi = waveform[wf](mi);
if (mt==TEX_SHARP) {
mi = sqrt(mi);
- }
+ }
else if (mt==TEX_SHARPER) {
mi = sqrt(sqrt(mi));
}
@@ -494,7 +494,7 @@ static int stucci(Tex *tex, const float texvec[3], TexResult *texres)
if (tex->stype) ofs*=(b2*b2);
nor[0] = BLI_gNoise(tex->noisesize, texvec[0]+ofs, texvec[1], texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
- nor[1] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1]+ofs, texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
+ nor[1] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1]+ofs, texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
nor[2] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1], texvec[2]+ofs, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
texres->tin= nor[2];
@@ -769,7 +769,7 @@ static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1
else {
*adr1 = (y + 1.0f) / 2.0f;
*adr2 = (z + 1.0f) / 2.0f;
- ret= 2;
+ ret= 2;
}
return ret;
}
@@ -824,8 +824,8 @@ static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y,
*adr1 = (y + 1.0f) / 2.0f;
*adr2 = (z + 1.0f) / 2.0f;
ret= 2;
- }
- }
+ }
+ }
else {
return cubemap_glob(n, x, y, z, adr1, adr2);
}
@@ -862,7 +862,7 @@ static int cubemap_ob(Object *ob, const float n[3], float x, float y, float z, f
else {
*adr1 = (y + 1.0f) / 2.0f;
*adr2 = (z + 1.0f) / 2.0f;
- ret= 2;
+ ret= 2;
}
return ret;
}
@@ -971,7 +971,7 @@ static void do_2d_mapping(MTex *mtex, float texvec[3], VlakRen *vlr, const float
map_to_tube(area + 2, area + 3, texvec[0] + dxt[0], texvec[1] + dxt[1], texvec[2] + dxt[2]);
map_to_tube(area + 4, area + 5, texvec[0] + dyt[0], texvec[1] + dyt[1], texvec[2] + dyt[2]);
}
- else {
+ else {
map_to_sphere(area, area+1, texvec[0], texvec[1], texvec[2]);
map_to_sphere(area + 2, area + 3, texvec[0] + dxt[0], texvec[1] + dxt[1], texvec[2] + dxt[2]);
map_to_sphere(area + 4, area + 5, texvec[0] + dyt[0], texvec[1] + dyt[1], texvec[2] + dyt[2]);
@@ -1262,6 +1262,14 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os
do_2d_mapping(&localmtex, texvec_l, NULL, NULL, dxt_l, dyt_l);
rgbnor= multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output);
+
+ {
+ ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+
+ /* don't linearize float buffers, assumed to be linear */
+ if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
+ IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
+ }
}
return rgbnor;
@@ -1745,7 +1753,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
if (mtex->texco == TEXCO_UV) {
/* for the uv case, use the same value for both du/dv,
* since individually scaling the normal derivatives makes them useless... */
- du = minf(du, dv);
+ du = min_ff(du, dv);
idu = (du < 1e-5f) ? bf : (bf/du);
/* +u val */
@@ -2664,8 +2672,8 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
copy_v3_v3(co, xyz);
if (mtex->texflag & MTEX_OB_DUPLI_ORIG) {
if (shi->obi && shi->obi->duplitexmat)
- mul_m4_v3(shi->obi->duplitexmat, co);
- }
+ mul_m4_v3(shi->obi->duplitexmat, co);
+ }
mul_m4_v3(ob->imat_ren, co);
if (mtex->texflag & MTEX_MAPTO_BOUNDS && ob->bb) {
@@ -3078,7 +3086,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
break;
}
- /* placement */
+ /* placement */
if (mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
@@ -3241,7 +3249,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
}
co= tempvec;
- dx= dxt; dy= dyt;
+ dx= dxt; dy= dyt;
if (shi->osatex) {
copy_v3_v3(dxt, shi->dxlv);
copy_v3_v3(dyt, shi->dylv);
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 0bfbed8e58c..217fcc3c4ac 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -185,7 +185,8 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
fullsample= (totsample > 1);
amount= 0;
- accol[0]=accol[1]=accol[2]=accol[3]= 0.0f;
+ accol[0] = accol[1] = accol[2] = accol[3]= 0.0f;
+ col[0] = col[1] = col[2] = col[3]= 0.0f;
flarec= har->flarec;
while (ps) {
@@ -294,11 +295,11 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
}
else {
- minx= MAX2(minx, testrect.xmin);
- maxx= MIN2(maxx, testrect.xmax);
+ minx = max_ii(minx, testrect.xmin);
+ maxx = min_ii(maxx, testrect.xmax);
- miny= MAX2(har->miny, testrect.ymin);
- maxy= MIN2(har->maxy, testrect.ymax);
+ miny = max_ii(har->miny, testrect.ymin);
+ maxy = min_ii(har->maxy, testrect.ymax);
for (y=miny; y<maxy; y++) {
int rectofs= (y-disprect.ymin)*pa->rectx + (minx - disprect.xmin);
@@ -671,7 +672,7 @@ int get_sample_layers(RenderPart *pa, RenderLayer *rl, RenderLayer **rlpp)
RenderResult *rr= BLI_findlink(&pa->fullresult, sample);
rlpp[sample]= BLI_findlink(&rr->layers, nr);
- }
+ }
return R.osa;
}
else {
@@ -714,7 +715,7 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
addAlphaUnderFloat(pass, col);
}
}
- }
+ }
}
if (y&1)
@@ -772,8 +773,8 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
if (*zrect >= 9.9e10f || rgbrect[3]==0.0f) {
continue;
}
-
- if ((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {
+
+ if ((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {
float tmp_rgb[3];
/* skip if worldspace lamp vector is below horizon */
@@ -928,7 +929,7 @@ static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int ma
PixStrMain *psm;
PixStr *ps, *last= NULL;
- if (*rd) {
+ if (*rd) {
ps= (PixStr *)(*rd);
while (ps) {
@@ -1582,7 +1583,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
copy_v3_v3(shi->facenor, nor);
shade_input_set_viewco(shi, x, y, sx, sy, z);
- *area = minf(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea);
+ *area = min_ff(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea);
shade_input_set_uv(shi);
shade_input_set_normals(shi);
@@ -2012,7 +2013,7 @@ void add_halo_flare(Render *re)
re->display_draw(re->ddh, rr, NULL);
}
- R.r.mode= mode;
+ R.r.mode= mode;
}
/* ************************* bake ************************ */
@@ -2474,7 +2475,7 @@ static int get_next_bake_face(BakeShade *bs)
return 0;
}
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_lock_thread(LOCK_CUSTOM1);
for (; obi; obi=obi->next, v=0) {
obr= obi->obr;
@@ -2516,12 +2517,12 @@ static int get_next_bake_face(BakeShade *bs)
if (R.r.bake_flag & R_BAKE_CLEAR)
IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
-
/* might be read by UI to set active image for display */
R.bakebuf= ima;
- }
-
+ }
+
+ ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+
bs->obi= obi;
bs->vlr= vlr;
@@ -2557,7 +2558,7 @@ static void shade_tface(BakeShade *bs)
/* note, these calls only free/fill contents of zspan struct, not zspan itself */
zbuf_free_span(bs->zspan);
zbuf_alloc_span(bs->zspan, bs->ibuf->x, bs->ibuf->y, R.clipcrop);
- }
+ }
bs->rectx= bs->ibuf->x;
bs->recty= bs->ibuf->y;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 1721741d64d..886f266b22f 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -244,7 +244,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
memset(obr->vertnodes+obr->vertnodeslen, 0, TABLEINITSIZE*sizeof(VertTableNode));
obr->vertnodeslen+=TABLEINITSIZE;
- if (temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
v= obr->vertnodes[a].vert;
@@ -487,7 +487,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
memset(obr->vlaknodes+obr->vlaknodeslen, 0, TABLEINITSIZE*sizeof(VlakTableNode));
obr->vlaknodeslen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
- if (temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
v= obr->vlaknodes[a].vlak;
@@ -658,7 +658,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
memset(obr->strandnodes+obr->strandnodeslen, 0, TABLEINITSIZE*sizeof(StrandTableNode));
obr->strandnodeslen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
- if (temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
v= obr->strandnodes[a].strand;
@@ -892,7 +892,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE*sizeof(void*));
obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
- if (temp) MEM_freeN(temp);
+ if (temp) MEM_freeN(temp);
}
h= obr->bloha[a];
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index bed3fb5f754..2253557955e 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -89,7 +89,7 @@ extern struct Render R;
static void copy_to_ztile(int *rectz, int size, int x1, int y1, int tile, char *r1)
{
- int len4, *rz;
+ int len4, *rz;
int x2, y2;
x2= x1+tile;
@@ -528,21 +528,21 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
for (y=0; y<size; y+=16) {
if (y< size/2) miny= y+15-size/2;
- else miny= y-size/2;
+ else miny= y-size/2;
for (x=0; x<size; x+=16) {
/* is tile within spotbundle? */
a= size/2;
if (x< a) minx= x+15-a;
- else minx= x-a;
+ else minx= x-a;
dist= sqrt( (float)(minx*minx+miny*miny) );
if (square==0 && dist>(float)(a+12)) { /* 12, tested with a onlyshadow lamp */
a= 256; verg= 0; /* 0x80000000; */ /* 0x7FFFFFFF; */
rz1= (&verg)+1;
- }
+ }
else {
copy_to_ztile(rectz, size, x, y, 16, rcline);
rz1= (int *)rcline;
@@ -669,8 +669,8 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
clipflag[vlr->v2->index]= 1;
clipflag[vlr->v3->index]= 1;
if (vlr->v4) clipflag[vlr->v4->index]= 1;
- }
- }
+ }
+ }
/* calculate min and max */
for (a=0; a< obr->totvert;a++) {
@@ -856,10 +856,10 @@ void threaded_makeshadowbufs(Render *re)
if (lar->shb)
totthread++;
- totthread= MIN2(totthread, re->r.threads);
+ totthread = min_ii(totthread, re->r.threads);
}
else
- totthread= 1; /* preview render */
+ totthread = 1; /* preview render */
if (totthread <= 1) {
for (lar=re->lampren.first; lar; lar= lar->next) {
@@ -1394,7 +1394,7 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
}
}
- labda = minf(labdax, labday);
+ labda = min_ff(labdax, labday);
if (labda==labdao || labda>=1.0f) break;
zf= zf1 + labda*(zf2-zf1);
@@ -1867,7 +1867,7 @@ static void isb_bsp_recalc_box(ISBBranch *root)
init_box(&root->box);
for (a=root->totsamp-1; a>=0; a--)
bound_boxf(&root->box, root->samples[a]->zco);
- }
+ }
}
/* callback function for zbuf clip */
@@ -2040,7 +2040,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
if (vlr->v4)
c4= testclip(hoco[3]);
- /* ***** NO WIRE YET */
+ /* ***** NO WIRE YET */
if (ma->material_type == MA_TYPE_WIRE) {
if (vlr->v4)
zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
@@ -2187,7 +2187,7 @@ static int isb_add_samples(RenderPart *pa, ISBBranch *root, MemArena *memarena,
}
if (bsp_err) break;
}
- }
+ }
MEM_freeN(xcos);
MEM_freeN(ycos);
@@ -2394,7 +2394,7 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem
}
if (bsp_err) break;
}
- }
+ }
MEM_freeN(xcos);
MEM_freeN(ycos);
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 36e9f4cb785..db93a21de2d 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -236,7 +236,7 @@ void vlr_set_uv_indices(VlakRen *vlr, int *i1, int *i2, int *i3)
/* 1---2 1---2 0 = orig face, 1 = new face */
/* Update vert nums to point to correct verts of original face */
- if (vlr->flag & R_DIVIDE_24) {
+ if (vlr->flag & R_DIVIDE_24) {
if (vlr->flag & R_FACE_SPLIT) {
(*i1)++; (*i2)++; (*i3)++;
}
@@ -777,7 +777,7 @@ void shade_input_set_uv(ShadeInput *shi)
CLAMP(shi->u, -2.0f, 1.0f);
CLAMP(shi->v, -2.0f, 1.0f);
}
- }
+ }
}
void shade_input_set_normals(ShadeInput *shi)
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 100cbd416e0..ea155f944e4 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -114,7 +114,7 @@ static void fogcolor(const float colf[3], float *rco, float *view)
addAlphaOverFloat(colf, hor);
sub_v3_v3(vec, dview);
- }
+ }
}
#endif
@@ -168,7 +168,7 @@ float mistfactor(float zcor, float const co[3])
}
}
- return (1.0f-fac)* (1.0f-R.wrld.misi);
+ return (1.0f-fac)* (1.0f-R.wrld.misi);
}
static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
@@ -228,7 +228,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
}
}
- /* scale z to make sure volume is normalized */
+ /* scale z to make sure volume is normalized */
nray[2] *= (double)lar->sh_zfac;
/* nray does not need normalization */
@@ -548,7 +548,7 @@ static float spec(float inp, int hard)
b1= inp*inp;
/* avoid FPE */
- if (b1<0.01f) b1= 0.01f;
+ if (b1<0.01f) b1= 0.01f;
if ((hard & 1)==0) inp= 1.0f;
if (hard & 2) inp*= b1;
@@ -561,7 +561,7 @@ static float spec(float inp, int hard)
b1*= b1;
/* avoid FPE */
- if (b1<0.001f) b1= 0.0f;
+ if (b1<0.001f) b1= 0.0f;
if (hard & 32) inp*= b1;
b1*= b1;
@@ -569,7 +569,7 @@ static float spec(float inp, int hard)
b1*= b1;
if (hard & 128) inp*=b1;
- if (b1<0.001f) b1= 0.0f;
+ if (b1<0.001f) b1= 0.0f;
if (hard & 256) {
b1*= b1;
@@ -827,7 +827,7 @@ static float Minnaert_Diff(float nl, const float n[3], const float v[3], float d
nv = 0.0f;
if (darkness <= 1.0f)
- i = nl * pow(maxf(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/
+ i = nl * pow(max_ff(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/
else
i = nl * pow( (1.001f - nv), (darkness - 1.0f) ); /*Nvidia model*/
@@ -1233,7 +1233,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
copy_v3_v3(lvrot, lv);
mul_m3_v3(lar->imat, lvrot);
- x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
+ x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
/* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
inpr= 1.0f/(sqrt(1.0f+x*x));
@@ -1317,7 +1317,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
if (lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
if (lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX);
- /* tangent case; calculate fake face normal, aligned with lampvector */
+ /* tangent case; calculate fake face normal, aligned with lampvector */
/* note, vnor==vn is used as tangent trigger for buffer shadow */
if (vlr->flag & R_TANGENT) {
float cross[3], nstrand[3], blend;
@@ -1363,7 +1363,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
/* inp = dotproduct, is = shader result, i = lamp energy (with shadow), i_noshad = i without shadow */
inp= dot_v3v3(vn, lv);
- /* phong threshold to prevent backfacing faces having artefacts on ray shadow (terminator problem) */
+ /* phong threshold to prevent backfacing faces having artifacts on ray shadow (terminator problem) */
/* this complex construction screams for a nicer implementation! (ton) */
if (R.r.mode & R_SHADOW) {
if (ma->mode & MA_SHADOW) {
@@ -1637,7 +1637,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
}
}
- /* quite disputable this... also note it doesn't mirror-raytrace */
+ /* quite disputable this... also note it doesn't mirror-raytrace */
if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
float f;
@@ -1851,7 +1851,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
}
}
- if (shi->combinedflag & SCE_PASS_SHADOW)
+ if (shi->combinedflag & SCE_PASS_SHADOW)
copy_v3_v3(shr->combined, shr->shad); /* note, no ';' ! */
else
copy_v3_v3(shr->combined, shr->diff);
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index 77d68e6c85a..6d0e15ea46e 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -307,7 +307,7 @@ ScatterSettings *scatter_settings_new(float refl, float radius, float ior, float
ss->Fdr= -1.440f/ior*ior + 0.710f/ior + 0.668f + 0.0636f*ior;
ss->A= (1.0f + ss->Fdr)/(1.0f - ss->Fdr);
ss->ld= radius;
- ss->ro= minf(refl, 0.999f);
+ ss->ro= min_ff(refl, 0.999f);
ss->color= ss->ro*reflfac + (1.0f-reflfac);
ss->alpha_= compute_reduced_albedo(ss);
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index dc3225b7f09..6e2e97b95de 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -545,7 +545,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
bufferz= 0x7FFFFFFF;
if (spart->rectmask) maskz= 0x7FFFFFFF;
- if (*rd) {
+ if (*rd) {
for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
if (mask & ps->mask) {
bufferz= ps->z;
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index 1288b0305b1..e4a42fcd675 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -217,8 +217,7 @@ void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float h
sunsky->perez_y[3] = -0.04405f * T - 1.65369f;
sunsky->perez_y[4] = -0.01092f * T + 0.05291f;
- /* suggested by glome in
- * http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
+ /* suggested by glome in patch [#8063] */
sunsky->perez_Y[0] *= sunsky->horizon_brightness;
sunsky->perez_x[0] *= sunsky->horizon_brightness;
sunsky->perez_y[0] *= sunsky->horizon_brightness;
@@ -330,8 +329,8 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
int i;
float fLambda[3];
- fLambda[0] = 0.65f;
- fLambda[1] = 0.57f;
+ fLambda[0] = 0.65f;
+ fLambda[1] = 0.57f;
fLambda[2] = 0.475f;
fAlpha = 1.3f;
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index fb7ea38ef68..8757be740f3 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -270,7 +270,7 @@ BLI_INLINE int ms_I(int x, int y, int z, int *n) /* has a pad of 1 voxel surroun
BLI_INLINE int v_I_pad(int x, int y, int z, int *n) /* has a pad of 1 voxel surrounding the core for boundary simulation */
{
/* same ordering to light cache, with padding */
- return z*(n[1]+2)*(n[0]+2) + y*(n[0]+2) + x;
+ return z*(n[1]+2)*(n[0]+2) + y*(n[0]+2) + x;
}
BLI_INLINE int lc_to_ms_I(int x, int y, int z, int *n)
@@ -389,7 +389,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
const int j = ms_I(x, y, z, n); //ms index
time= PIL_check_seconds_timer();
- c++;
+ c++;
if (vp->data_r[i] > 0.0f)
sr[j] += vp->data_r[i];
if (vp->data_g[i] > 0.0f)
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 220fcd3e986..fe4cff76093 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -76,7 +76,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
if (lar->shb) {
float dxco[3] = {0.f, 0.f, 0.f}, dyco[3] = {0.f, 0.f, 0.f};
- visibility = testshadowbuf(&R, lar->shb, co, dxco, dyco, 1.0, 0.0);
+ visibility = testshadowbuf(&R, lar->shb, co, dxco, dyco, 1.0, 0.0);
}
else if (lar->mode & LA_SHAD_RAY) {
/* trace shadow manually, no good lamp api atm */
@@ -205,7 +205,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], f
else {
shadeSkyView(col_r, co, shi->view, NULL, shi->thread);
shadeSunView(col_r, shi->view);
- }
+ }
}
@@ -221,7 +221,7 @@ static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float scat
/* find sample point in global space bounding box 0.0-1.0 */
global_bounds_obi(re, shi->obi, bbmin, bbmax);
sub_v3_v3v3(dim, bbmax, bbmin);
- mul_v3_m4v3(world_co, re->viewinv, co);
+ mul_v3_m4v3(world_co, re->viewinv, co);
/* sample_co in 0.0-1.0 */
sample_co[0] = (world_co[0] - bbmin[0]) / dim[0];
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 7eccacb816d..b486407c61c 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -285,7 +285,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
}
/* always store copy, as smoke internal data can change */
- totRes= vd_resol_size(vd);
+ totRes = vd_resol_size(vd);
vd->dataset = MEM_mapallocN(sizeof(float)*(totRes), "smoke data");
memcpy(vd->dataset, flame, sizeof(float)*totRes);
}
@@ -414,7 +414,7 @@ void make_voxeldata(struct Render *re)
int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres)
{
- VoxelData *vd = tex->vd;
+ VoxelData *vd = tex->vd;
float co[3], offset[3] = {0.5, 0.5, 0.5}, a;
int retval = (vd->data_type == TEX_VD_RGBA_PREMUL) ? TEX_RGB : TEX_INT;
int depth = (vd->data_type == TEX_VD_RGBA_PREMUL) ? 4 : 1;
@@ -482,7 +482,7 @@ int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texre
break;
case TEX_VD_LINEAR:
*result = BLI_voxel_sample_trilinear(dataset, vd->resol, co);
- break;
+ break;
case TEX_VD_QUADRATIC:
*result = BLI_voxel_sample_triquadratic(dataset, vd->resol, co);
break;
@@ -515,5 +515,5 @@ int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texre
texres->ta = texres->tin;
BRICONTRGB;
- return retval;
+ return retval;
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index ba62baae897..8e53ce11e4d 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -150,7 +150,7 @@ static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2)
}
else {
dx0 = 0.0f;
- xs0 = minf(minv[0], maxv[0]);
+ xs0 = min_ff(minv[0], maxv[0]);
}
/* empty span */
@@ -409,7 +409,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr,
if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
if (apn->next==NULL) apn->next= addpsA(zspan);
apn= apn->next;
- }
+ }
}
}
zverg+= zxd;
@@ -501,7 +501,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
if (apn->next==0) apn->next= addpsA(zspan);
apn= apn->next;
- }
+ }
}
}
}
@@ -572,7 +572,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
if (apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
if (apn->next==0) apn->next= addpsA(zspan);
apn= apn->next;
- }
+ }
}
}
}
@@ -1029,7 +1029,7 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
/**
* Fill the z buffer, but invert z order, and add the face index to
- * the corresponing face buffer.
+ * the corresponding face buffer.
*
* This is one of the z buffer fill functions called in zbufclip() and
* zbufwireclip().
@@ -1624,7 +1624,7 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
else {
dw= clipcrop*(v2[3]-v1[3]);
v13= clipcrop*v1[3];
- }
+ }
/* according the original article by Liang&Barsky, for clipping of
* homogeneous coordinates with viewplane, the value of "0" is used instead of "-w" .
* This differs from the other clipping cases (like left or top) and I considered
@@ -1682,7 +1682,7 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
adr[1]= v1[1]+l1*(v2[1]-v1[1]);
adr[2]= v1[2]+l1*(v2[2]-v1[2]);
adr[3]= v1[3]+l1*(v2[3]-v1[3]);
- }
+ }
else trias[*b1]= v1;
(*b1)++;
@@ -2022,7 +2022,7 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
EXTEND_PIXEL(row1 + 2);
EXTEND_PIXEL(row2 + 2);
EXTEND_PIXEL(row3 + 2);
- }
+ }
if (tot) {
len++;
curz[0]= (int)(z/(float)tot);
@@ -2047,7 +2047,7 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
if (rectp[len]==0) {
rectz[len] = -0x7FFFFFFF;
rectp[len]= -1; /* env code */
- }
+ }
}
}
}
@@ -3233,7 +3233,7 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
*rza= 0x7FFFFFFF;
if (rectmask) *rma= 0x7FFFFFFF;
- if (*rd) {
+ if (*rd) {
/* when there's a sky pixstruct, fill in sky-Z, otherwise solid Z */
for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
if (sample & ps->mask) {
@@ -3517,7 +3517,7 @@ static void add_transp_obindex(RenderLayer *rl, int offset, Object *ob)
RenderPass *rpass;
for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
- if (rpass->passtype == SCE_PASS_INDEXOB||rpass->passtype == SCE_PASS_INDEXMA) {
+ if (rpass->passtype == SCE_PASS_INDEXOB) {
float *fp= rpass->rect + offset;
*fp= (float)ob->index;
break;
@@ -3525,6 +3525,19 @@ static void add_transp_obindex(RenderLayer *rl, int offset, Object *ob)
}
}
+static void add_transp_material_index(RenderLayer *rl, int offset, Material *mat)
+{
+ RenderPass *rpass;
+
+ for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
+ if (rpass->passtype == SCE_PASS_INDEXMA) {
+ float *fp= rpass->rect + offset;
+ *fp= (float)mat->index;
+ break;
+ }
+ }
+}
+
/* ONLY OSA! merge all shaderesult samples to one */
/* target should have been cleared */
static void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
@@ -3876,7 +3889,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
addAlphaUnderFloat(samp_shr->combined, shr->combined);
- samp_shr->z = minf(samp_shr->z, shr->z);
+ samp_shr->z = min_ff(samp_shr->z, shr->z);
if (addpassflag & SCE_PASS_VECTOR) {
copy_v4_v4(samp_shr->winspeed, shr->winspeed);
@@ -4129,10 +4142,12 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
}
}
if (addpassflag & SCE_PASS_INDEXMA) {
- ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr;
- if (obr->ob) {
+ ObjectRen *obr = R.objectinstance[zrow[totface-1].obi].obr;
+ VlakRen *vr = obr->vlaknodes->vlak;
+ Material *mat = vr->mat;
+ if (mat) {
for (a= 0; a<totfullsample; a++)
- add_transp_obindex(rlpp[a], od, obr->ob);
+ add_transp_material_index(rlpp[a], od, mat);
}
}
@@ -4243,7 +4258,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
MEM_freeN(APixbufstrand);
if (sscache)
strand_shade_cache_free(sscache);
- freepsA(&apsmbase);
+ freepsA(&apsmbase);
if (R.r.mode & R_SHADOW)
ISB_free(pa);