[Bf-blender-cvs] [6b6a968] fracture_modifier: Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier

Martin Felke noreply at git.blender.org
Wed Dec 31 14:01:03 CET 2014


Commit: 6b6a968053cd8bb031049094bfc2da8e983e8969
Author: Martin Felke
Date:   Wed Dec 31 13:59:45 2014 +0100
Branches: fracture_modifier
https://developer.blender.org/rB6b6a968053cd8bb031049094bfc2da8e983e8969

Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier

Conflicts:
	extern/SConscript
	release/datafiles/splash.png
	release/datafiles/splash_2x.png
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/editors/physics/rigidbody_constraint.c
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/modifiers/intern/MOD_boolean_util.c
	source/blender/windowmanager/WM_api.h

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



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

diff --cc CMakeLists.txt
index b4c58cf,4ee277b..53d227a
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -146,11 -217,10 +217,11 @@@ option(WITH_FFTW3         "Enable FFTW
  option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
  option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
  mark_as_advanced(WITH_SYSTEM_BULLET)
- option(WITH_GAMEENGINE    "Enable Game Engine" ON)
+ option(WITH_GAMEENGINE    "Enable Game Engine" ${_init_GAMEENGINE})
  option(WITH_PLAYER        "Build Player" OFF)
- option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ON)
+ option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
  option(WITH_COMPOSITOR    "Enable the tile based nodal compositor" ON)
 +option(WITH_VORO    "Enable Voronoi Fracture based on Voro++" ON)
  
  # GHOST Windowing Library Options
  option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
diff --cc SConstruct
index 2689795,4dacf89..1682ae6
--- a/SConstruct
+++ b/SConstruct
@@@ -263,8 -265,8 +265,9 @@@ if 'blenderlite' in B.targets
      target_env_defs['WITH_BF_SMOKE'] = False
      target_env_defs['WITH_BF_BOOLEAN'] = False
      target_env_defs['WITH_BF_REMESH'] = False
 +    target_env_defs['WITH_BF_VORONOI'] = False
      target_env_defs['WITH_BF_PYTHON'] = False
+     target_env_defs['WITH_BF_IME'] = False
      target_env_defs['WITH_BF_3DMOUSE'] = False
      target_env_defs['WITH_BF_LIBMV'] = False
      target_env_defs['WITH_BF_FREESTYLE'] = False
diff --cc extern/SConscript
index f370d30,1f94f50..b5f3c73
--- a/extern/SConscript
+++ b/extern/SConscript
@@@ -51,5 -51,5 +51,8 @@@ if env['WITH_GHOST_XDND']
      if env['OURPLATFORM'] in ('linux', 'openbsd3', 'sunos5', 'aix4', 'aix5'):
          SConscript(['xdnd/SConscript'])
  
 +if env ['WITH_BF_VORONOI']:
 +    SConscript(['voro++/SConscript'])
++    
+ if env['WITH_BF_SDL'] and env['WITH_BF_SDL_DYNLOAD']:
+     SConscript(['sdlew/SConscript'])
diff --cc source/blender/blenkernel/SConscript
index 2c481b9,3da3d64..248ef84
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@@ -165,13 -166,13 +166,17 @@@ if env['WITH_BF_INTERNATIONAL']
  if env['WITH_BF_FREESTYLE']:
      defs.append('WITH_FREESTYLE')
  
 +if env['WITH_BF_VORONOI']:
 +    incs += ' #/extern/voro++'
 +    defs.append('WITH_VORO')
 +
  if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
      incs += ' ' + env['BF_PTHREADS_INC']
+     incs += ' ../../../intern/utfconv'
  
+ if env['WITH_BF_BINRELOC']:
+     incs += ' #extern/binreloc/include'
+     defs.append('WITH_BINRELOC')
  
  if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
      env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25]) #, cc_compileflags = env['CCFLAGS'].append('/WX') )
diff --cc source/blender/blenkernel/intern/rigidbody.c
index 9238245,3bf5c4c..ac73ee3
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@@ -64,430 -61,9 +64,428 @@@
  #include "BKE_object.h"
  #include "BKE_pointcache.h"
  #include "BKE_rigidbody.h"
 +#include "BKE_modifier.h"
 +#include "BKE_depsgraph.h"
 +#include "BKE_scene.h"
  
- #include "RNA_access.h"
- 
  #ifdef WITH_BULLET
  
 +static void activateRigidbody(RigidBodyOb* rbo)
 +{
 +	rbo->flag &= ~RBO_FLAG_KINEMATIC;
 +	RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
 +	RB_body_set_kinematic_state(rbo->physics_object, false);
 +	rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
 +}
 +
 +static void validateShard(RigidBodyWorld *rbw, MeshIsland *mi, Object *ob, int rebuild);
 +
 +static bool isModifierActive(FractureModifierData *rmd) {
 +	return ((rmd != NULL) && (rmd->modifier.mode & (eModifierMode_Realtime | eModifierMode_Render)) && (rmd->refresh == false));
 +}
 +
 +static void calc_dist_angle(RigidBodyShardCon *con, float *dist, float *angle)
 +{
 +	float q1[4], q2[4], qdiff[4], axis[3];
 +	if ((con->mi1->rigidbody == NULL) || (con->mi2->rigidbody == NULL)) {
 +		*dist = 0;
 +		*angle = 0;
 +		return;
 +	}
 +	
 +	sub_v3_v3v3(axis, con->mi1->rigidbody->pos, con->mi2->rigidbody->pos);
 +	*dist = len_v3(axis);
 +	copy_qt_qt(q1, con->mi1->rigidbody->orn);
 +	copy_qt_qt(q2, con->mi2->rigidbody->orn);
 +	invert_qt(q1);
 +	mul_qt_qtqt(qdiff, q1, q2);
 +	quat_to_axis_angle(axis, angle, qdiff);
 +}
 +
 +void BKE_rigidbody_start_dist_angle(RigidBodyShardCon *con)
 +{
 +	/* store starting angle and distance per constraint*/
 +	float dist, angle;
 +	calc_dist_angle(con, &dist, &angle);
 +	con->start_dist = dist;
 +	con->start_angle = angle;
 +}
 +
 +float BKE_rigidbody_calc_max_con_mass(Object *ob)
 +{
 +	FractureModifierData *rmd;
 +	ModifierData *md;
 +	RigidBodyShardCon *con;
 +	float max_con_mass = 0, con_mass;
 +
 +	for (md = ob->modifiers.first; md; md = md->next) {
 +		if (md->type == eModifierType_Fracture) {
 +			rmd = (FractureModifierData *)md;
 +			for (con = rmd->meshConstraints.first; con; con = con->next) {
 +				if ((con->mi1 != NULL && con->mi1->rigidbody != NULL) &&
 +				    (con->mi2 != NULL && con->mi2->rigidbody != NULL)) {
 +					con_mass = con->mi1->rigidbody->mass + con->mi2->rigidbody->mass;
 +					if (con_mass > max_con_mass) {
 +						max_con_mass = con_mass;
 +					}
 +				}
 +			}
 +
 +			return max_con_mass;
 +		}
 +	}
 +
 +	return 0;
 +}
 +
 +float BKE_rigidbody_calc_min_con_dist(Object *ob)
 +{
 +	FractureModifierData *rmd;
 +	ModifierData *md;
 +	RigidBodyShardCon *con;
 +	float min_con_dist = FLT_MAX, con_dist, con_vec[3];
 +
 +	for (md = ob->modifiers.first; md; md = md->next) {
 +		if (md->type == eModifierType_Fracture) {
 +			rmd = (FractureModifierData *)md;
 +			for (con = rmd->meshConstraints.first; con; con = con->next) {
 +				if ((con->mi1 != NULL && con->mi1->rigidbody != NULL) &&
 +				    (con->mi2 != NULL && con->mi2->rigidbody != NULL)) {
 +					sub_v3_v3v3(con_vec, con->mi1->centroid, con->mi2->centroid);
 +					con_dist = len_v3(con_vec);
 +					if (con_dist < min_con_dist) {
 +						min_con_dist = con_dist;
 +					}
 +				}
 +			}
 +
 +			return min_con_dist;
 +		}
 +	}
 +
 +	return FLT_MAX;
 +}
 +
 +
 +void BKE_rigidbody_calc_threshold(float max_con_mass, FractureModifierData *rmd, RigidBodyShardCon *con) {
 +
 +	float max_thresh, thresh = 0.0f, con_mass;
 +	if ((max_con_mass == 0) && (rmd->use_mass_dependent_thresholds)) {
 +		return;
 +	}
 +
 +	if ((con->mi1 == NULL) || (con->mi2 == NULL)) {
 +		return;
 +	}
 +
 +	max_thresh = rmd->breaking_threshold;
 +	if ((con->mi1->rigidbody != NULL) && (con->mi2->rigidbody != NULL)) {
 +		con_mass = con->mi1->rigidbody->mass + con->mi2->rigidbody->mass;
 +
 +		if (rmd->use_mass_dependent_thresholds)
 +		{
 +			thresh = (con_mass / max_con_mass) * max_thresh;
 +		}
 +
 +		con->breaking_threshold = thresh;
 +	}
 +}
 +
 +static int DM_mesh_minmax(DerivedMesh *dm, float r_min[3], float r_max[3])
 +{
 +	MVert *v;
 +	int i = 0;
 +	for (i = 0; i < dm->numVertData; i++) {
 +		v = CDDM_get_vert(dm, i);
 +		minmax_v3v3_v3(r_min, r_max, v->co);
 +	}
 +
 +	return (dm->numVertData != 0);
 +}
 +
 +static void DM_mesh_boundbox(DerivedMesh *bm, float r_loc[3], float r_size[3])
 +{
 +	float min[3], max[3];
 +	float mloc[3], msize[3];
 +
 +	if (!r_loc) r_loc = mloc;
 +	if (!r_size) r_size = msize;
 +
 +	INIT_MINMAX(min, max);
 +	if (!DM_mesh_minmax(bm, min, max)) {
 +		min[0] = min[1] = min[2] = -1.0f;
 +		max[0] = max[1] = max[2] = 1.0f;
 +	}
 +
 +	mid_v3_v3v3(r_loc, min, max);
 +
 +	r_size[0] = (max[0] - min[0]) / 2.0f;
 +	r_size[1] = (max[1] - min[1]) / 2.0f;
 +	r_size[2] = (max[2] - min[2]) / 2.0f;
 +}
 +
 +/* helper function to calculate volume of rigidbody object */
 +float BKE_rigidbody_calc_volume(DerivedMesh *dm, RigidBodyOb *rbo)
 +{
 +	float loc[3]  = {0.0f, 0.0f, 0.0f};
 +	float size[3]  = {1.0f, 1.0f, 1.0f};
 +	float radius = 1.0f;
 +	float height = 1.0f;
 +
 +	float volume = 0.0f;
 +
 +	/* if automatically determining dimensions, use the Object's boundbox
 +	 *	- assume that all quadrics are standing upright on local z-axis
 +	 *	- assume even distribution of mass around the Object's pivot
 +	 *	  (i.e. Object pivot is centralised in boundbox)
 +	 *	- boundbox gives full width
 +	 */
 +	/* XXX: all dimensions are auto-determined now... later can add stored settings for this*/
 +	DM_mesh_boundbox(dm, loc, size);
 +
 +	if (ELEM(rbo->shape, RB_SHAPE_CAPSULE, RB_SHAPE_CYLINDER, RB_SHAPE_CONE)) {
 +		/* take radius as largest x/y dimension, and height as z-dimension */
 +		radius = MAX2(size[0], size[1]) * 0.5f;
 +		height = size[2];
 +	}
 +	else if (rbo->shape == RB_SHAPE_SPHERE) {
 +		/* take radius to the the largest dimension to try and encompass everything */
 +		radius = max_fff(size[0], size[1], size[2]) * 0.5f;
 +	}
 +
 +	/* calculate volume as appropriate  */
 +	switch (rbo->shape) {
 +	
 +		case RB_SHAPE_SPHERE:
 +			volume = 4.0f / 3.0f * (float)M_PI * radius * radius * radius;
 +			break;
 +
 +		/* for now, assume that capsule is close enough to a cylinder... */
 +		case RB_SHAPE_CAPSULE:
 +		case RB_SHAPE_CYLINDER:
 +			volume = (float)M_PI * radius * radius * height;
 +			break;
 +
 +		case RB_SHAPE_CONE:
 +			volume = (float)M_PI / 3.0f * radius * radius * height;
 +			break;
 +
 +		/* for now, all mesh shapes are just treated as boxes...
 +		 * NOTE: this may overestimate the volume, but other methods are overkill
 +		 */
 +		case RB_SHAPE_BOX:
 +		case RB_SHAPE_CONVEXH:
 +		case RB_SHAPE_TRIMESH:
 +			volume = size[0] * size[1] * size[2];
 +			if (size[0] == 0) {
 +				volume = size[1] * size[2];
 +			}
 +			else if (size[1] == 0) {
 +				volume = size[0] * size[2];
 +			}
 +			else if (size[2] == 0) {
 +				volume = size[0] * size[1];
 +			}
 +			break;
 +
 +#if 0 // XXX: not defined yet
 +		case RB_SHAPE_COMPOUND:
 +			volume = 0.0f;
 +			break;
 +#endif
 +	}
 +
 +	/* return the volume calculated */
 +	return volume;
 +}
 +
 +void BKE_rigidbody_calc_shard_mass(Object *ob, MeshIsland *mi, DerivedMesh *orig_dm)
 +{
 +	DerivedMesh *dm_ob = orig_dm, *dm_mi;
 +	float vol_mi = 0, mass_mi = 0, vol_ob = 0, mass_ob = 0;
 +
 +	if (dm_ob =

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list