[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47166] trunk/blender/intern/cycles: Fix #31556: cycles object info random value was not properly randomized for
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue May 29 12:34:16 CEST 2012
Revision: 47166
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47166
Author: blendix
Date: 2012-05-29 10:34:16 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Fix #31556: cycles object info random value was not properly randomized for
dupligroups.
Modified Paths:
--------------
trunk/blender/intern/cycles/blender/blender_object.cpp
trunk/blender/intern/cycles/render/object.cpp
trunk/blender/intern/cycles/render/object.h
Modified: trunk/blender/intern/cycles/blender/blender_object.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_object.cpp 2012-05-29 10:34:10 UTC (rev 47165)
+++ trunk/blender/intern/cycles/blender/blender_object.cpp 2012-05-29 10:34:16 UTC (rev 47166)
@@ -29,6 +29,7 @@
#include "blender_util.h"
#include "util_foreach.h"
+#include "util_hash.h"
CCL_NAMESPACE_BEGIN
@@ -245,17 +246,20 @@
/* object sync */
if(object_updated || (object->mesh && object->mesh->need_update)) {
object->name = b_ob.name().c_str();
- object->instance_id = b_index;
object->pass_id = b_ob.pass_index();
object->tfm = tfm;
object->motion.pre = tfm;
object->motion.post = tfm;
object->use_motion = false;
+ object->random_id = hash_int_2d(hash_string(object->name.c_str()), b_index);
+
/* visibility flags for both parent */
object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
- if(b_parent.ptr.data != b_ob.ptr.data)
+ if(b_parent.ptr.data != b_ob.ptr.data) {
object->visibility &= object_ray_visibility(b_parent);
+ object->random_id ^= hash_int(hash_string(b_parent.name().c_str()));
+ }
/* camera flag is not actually used, instead is tested
against render layer flags */
Modified: trunk/blender/intern/cycles/render/object.cpp
===================================================================
--- trunk/blender/intern/cycles/render/object.cpp 2012-05-29 10:34:10 UTC (rev 47165)
+++ trunk/blender/intern/cycles/render/object.cpp 2012-05-29 10:34:16 UTC (rev 47166)
@@ -23,7 +23,6 @@
#include "scene.h"
#include "util_foreach.h"
-#include "util_hash.h"
#include "util_map.h"
#include "util_progress.h"
@@ -37,7 +36,7 @@
mesh = NULL;
tfm = transform_identity();
visibility = ~0;
- instance_id = 0;
+ random_id = 0;
pass_id = 0;
bounds = BoundBox::empty;
motion.pre = transform_identity();
@@ -165,10 +164,8 @@
float uniform_scale;
float surface_area = 0.0f;
float pass_id = ob->pass_id;
+ float random_number = (float)ob->random_id * (1.0f/(float)0xFFFFFFFF);
- uint ob_hash = hash_int_2d(hash_string(ob->name.c_str()), ob->instance_id);
- float random_number = (float)ob_hash * (1.0f/(float)0xFFFFFFFF);
-
if(transform_uniform_scale(tfm, uniform_scale)) {
map<Mesh*, float>::iterator it = surface_area_map.find(mesh);
Modified: trunk/blender/intern/cycles/render/object.h
===================================================================
--- trunk/blender/intern/cycles/render/object.h 2012-05-29 10:34:10 UTC (rev 47165)
+++ trunk/blender/intern/cycles/render/object.h 2012-05-29 10:34:16 UTC (rev 47166)
@@ -41,7 +41,7 @@
Transform tfm;
BoundBox bounds;
ustring name;
- int instance_id;
+ int random_id;
int pass_id;
vector<ParamValue> attributes;
uint visibility;
More information about the Bf-blender-cvs
mailing list