[Bf-blender-cvs] [f1cd1e6] cycles_memory_experiments: Merge branch 'master' into cycles_memory_experiments

Sergey Sharybin noreply at git.blender.org
Mon Jun 8 15:51:38 CEST 2015


Commit: f1cd1e650354dd9096cd35914234441047cc393b
Author: Sergey Sharybin
Date:   Mon Jun 8 14:20:07 2015 +0200
Branches: cycles_memory_experiments
https://developer.blender.org/rBf1cd1e650354dd9096cd35914234441047cc393b

Merge branch 'master' into cycles_memory_experiments

Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
	intern/cycles/render/graph.h
	intern/cycles/render/mesh.cpp

===================================================================



===================================================================

diff --cc intern/cycles/blender/addon/ui.py
index 1c70a1e,7fa7139..29ddff3
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@@ -1404,14 -1440,20 +1451,21 @@@ class CyclesScene_PT_simplify(CyclesBut
      def draw(self, context):
          layout = self.layout
  
 -        rd = context.scene.render
 +        scene = context.scene
 +        rd = scene.render
  
          layout.active = rd.use_simplify
+         split = layout.split()
  
-         row = layout.row()
-         row.prop(rd, "simplify_subdivision", text="Subdivision")
-         row.prop(rd, "simplify_child_particles", text="Child Particles")
+         col = split.column()
+         col.label(text="Viewport:")
+         col.prop(rd, "simplify_subdivision", text="Subdivision")
+         col.prop(rd, "simplify_child_particles", text="Child Particles")
+ 
+         col = split.column()
+         col.label(text="Render:")
+         col.prop(rd, "simplify_subdivision_render", text="Subdivision")
+         col.prop(rd, "simplify_child_particles_render", text="Child Particles")
  
  
  def draw_device(self, context):
diff --cc intern/cycles/blender/blender_object.cpp
index a4cdb3e,bcc3667..ae49d3e
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@@ -222,52 -234,8 +234,53 @@@ void BlenderSync::sync_background_light
  
  /* Object */
  
 -Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
 -                                 Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal)
 +static bool object_boundbox_clip(Scene *scene,
 +                                 BL::Object b_ob,
 +                                 Transform& tfm,
 +                                 float margin)
 +{
 +	Camera *cam = scene->camera;
 +	Transform& worldtondc = cam->worldtondc;
 +	BL::Array<float, 24> boundbox = b_ob.bound_box();
 +	float3 bb_min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
 +	       bb_max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
 +	bool all_behind = true;
 +	for(int i = 0; i < 8; ++i) {
 +		float3 p = make_float3(boundbox[3 * i + 0],
 +		                       boundbox[3 * i + 1],
 +		                       boundbox[3 * i + 2]);
 +		p = transform_point(&tfm, p);
 +		p = transform_point(&worldtondc, p);
 +		if(p.z >= -margin) {
 +			all_behind = false;
 +		}
 +		p /= p.z;
 +		bb_min = min(bb_min, p);
 +		bb_max = max(bb_max, p);
 +	}
 +	if(!all_behind) {
 +		if(bb_min.x >= 1.0f + margin ||
 +		   bb_min.y >= 1.0f + margin ||
 +		   bb_max.x <= -margin ||
 +		   bb_max.y <= -margin)
 +		{
 +			return true;
 +		}
 +		return false;
 +	}
 +	return true;
 +}
 +
 +Object *BlenderSync::sync_object(BL::Object b_parent,
 +                                 int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
 +                                 BL::DupliObject b_dupli_ob,
 +                                 Transform& tfm,
 +                                 uint layer_flag,
 +                                 float motion_time,
 +                                 bool hide_tris,
++                                 bool *use_portal,
 +                                 bool use_camera_cull,
 +                                 float camera_cull_margin)
  {
  	BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
  	bool motion = motion_time != 0.0f;
@@@ -570,15 -519,7 +584,16 @@@ void BlenderSync::sync_objects(BL::Spac
  							BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
  
  							/* sync object and mesh or light data */
 -							Object *object = sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, hide_tris, &use_portal);
 +							Object *object = sync_object(b_ob,
 +							                             persistent_id.data,
 +							                             *b_dup,
 +							                             tfm,
 +							                             ob_layer,
 +							                             motion_time,
 +							                             hide_tris,
++							                             &use_portal,
 +							                             use_camera_cull,
 +							                             camera_cull_margin);
  
  							/* sync possible particle data, note particle_id
  							 * starts counting at 1, first is dummy particle */
@@@ -598,15 -539,7 +613,16 @@@
  				if(!object_render_hide(b_ob, true, true, hide_tris)) {
  					/* object itself */
  					Transform tfm = get_transform(b_ob.matrix_world());
 -					sync_object(b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris, &use_portal);
 +					sync_object(b_ob,
 +					            NULL,
 +					            PointerRNA_NULL,
 +					            tfm,
 +					            ob_layer,
 +					            motion_time,
 +					            hide_tris,
++					            &use_portal,
 +					            use_camera_cull,
 +					            camera_cull_margin);
  				}
  			}
  
diff --cc intern/cycles/blender/blender_sync.h
index 04c26ef,89d93e1..c903584
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@@ -85,17 -85,10 +85,18 @@@ private
  	void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
  	Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
  	void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index = 0);
 -	Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
 -	                                 Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal);
 +	Object *sync_object(BL::Object b_parent,
 +	                    int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
 +	                    BL::DupliObject b_dupli_ob,
 +	                    Transform& tfm,
 +	                    uint layer_flag,
 +	                    float motion_time,
 +	                    bool hide_tris,
++	                    bool *use_portal,
 +	                    bool use_camera_cull,
 +	                    float camera_cull_margin);
- 	void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
- 	void sync_background_light();
+ 	void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal);
+ 	void sync_background_light(bool use_portal);
  	void sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time);
  	void sync_camera_motion(BL::Object b_ob, float motion_time);
  
diff --cc intern/cycles/render/mesh.cpp
index 884186c,45685fe..4f99bfc
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@@ -1317,16 -1320,17 +1324,26 @@@ void MeshManager::device_update(Device 
  
  	device_update_bvh(device, dscene, scene, progress);
  
 +	if(free_data_after_update) {
 +		foreach(Object *object, scene->objects) {
 +			if(object->mesh->bvh != NULL) {
 +				delete object->mesh->bvh;
 +				object->mesh->bvh = NULL;
 +			}
 +		}
 +	}
 +
  	need_update = false;
+ 
+ 	if(need_displacement_images) {
+ 		/* Re-tag flags for update, so they're re-evaluated
+ 		 * for meshes with correct bounding boxes.
+ 		 *
+ 		 * This wouldn't cause wrong results, just true
+ 		 * displacement might be less optimal ot calculate.
+ 		 */
+ 		scene->object_manager->need_flags_update = old_need_object_flags_update;
+ 	}
  }
  
  void MeshManager::device_free(Device *device, DeviceScene *dscene)




More information about the Bf-blender-cvs mailing list