Commit: 63384a87ad784961627001d0eb315906d04a96e7 Author: Lukas Tönne Date: Fri Aug 8 16:04:21 2014 +0200 Branches: testbuild https://developer.blender.org/rB63384a87ad784961627001d0eb315906d04a96e7
Revert "Merge branch 'hair_system_squash' into testbuild" This reverts commit 641aceef9573127f8dcab6f9773b5875beb3c54b, reversing changes made to 525b4bcb9cf75a53bfda52e36ed3df4ee4b5c30c. =================================================================== M build_files/cmake/macros.cmake M intern/rigidbody/CMakeLists.txt M intern/rigidbody/RBI_api.h M intern/rigidbody/rb_bullet_api.cpp D intern/rigidbody/rb_internal_types.h M release/scripts/startup/bl_ui/properties_data_modifier.py M source/blender/CMakeLists.txt M source/blender/SConscript D source/blender/blenkernel/BKE_hair.h D source/blender/blenkernel/BKE_mesh_sample.h M source/blender/blenkernel/BKE_object.h M source/blender/blenkernel/BKE_particle.h M source/blender/blenkernel/BKE_rigidbody.h M source/blender/blenkernel/CMakeLists.txt M source/blender/blenkernel/SConscript D source/blender/blenkernel/intern/hair.c D source/blender/blenkernel/intern/mesh_sample.c M source/blender/blenkernel/intern/object.c M source/blender/blenkernel/intern/particle.c M source/blender/blenkernel/intern/rigidbody.c D source/blender/blenkernel/intern/rigidbody_objects.c M source/blender/blenkernel/intern/scene.c M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/writefile.c M source/blender/editors/physics/CMakeLists.txt M source/blender/editors/physics/SConscript D source/blender/editors/physics/hair_ops.c M source/blender/editors/physics/physics_intern.h M source/blender/editors/physics/physics_ops.c M source/blender/editors/space_view3d/CMakeLists.txt M source/blender/editors/space_view3d/SConscript D source/blender/editors/space_view3d/drawhair.c M source/blender/editors/space_view3d/drawobject.c M source/blender/editors/space_view3d/view3d_intern.h M source/blender/editors/transform/transform_conversions.c D source/blender/hair/CMakeLists.txt D source/blender/hair/HAIR_capi.cpp D source/blender/hair/HAIR_capi.h D source/blender/hair/SConscript D source/blender/hair/intern/HAIR_collision.cpp D source/blender/hair/intern/HAIR_curve.cpp D source/blender/hair/intern/HAIR_curve.h D source/blender/hair/intern/HAIR_debug.cpp D source/blender/hair/intern/HAIR_debug.h D source/blender/hair/intern/HAIR_math.cpp D source/blender/hair/intern/HAIR_math.h D source/blender/hair/intern/HAIR_memalloc.h D source/blender/hair/intern/HAIR_scene.cpp D source/blender/hair/intern/HAIR_scene.h D source/blender/hair/intern/HAIR_smoothing.cpp D source/blender/hair/intern/HAIR_smoothing.h D source/blender/hair/intern/HAIR_solver.cpp D source/blender/hair/intern/HAIR_solver.h D source/blender/hair/intern/HAIR_types.cpp D source/blender/hair/intern/HAIR_types.h D source/blender/makesdna/DNA_hair_types.h M source/blender/makesdna/DNA_meshdata_types.h M source/blender/makesdna/DNA_modifier_types.h M source/blender/makesdna/DNA_rigidbody_types.h M source/blender/makesdna/intern/makesdna.c M source/blender/makesrna/intern/CMakeLists.txt M source/blender/makesrna/intern/makesrna.c D source/blender/makesrna/intern/rna_hair.c M source/blender/makesrna/intern/rna_internal.h D source/blender/makesrna/intern/rna_mesh_sample.c M source/blender/makesrna/intern/rna_modifier.c M source/blender/makesrna/intern/rna_rigidbody.c M source/blender/modifiers/CMakeLists.txt M source/blender/modifiers/MOD_modifiertypes.h M source/blender/modifiers/SConscript D source/blender/modifiers/intern/MOD_hair.c M source/blender/modifiers/intern/MOD_util.c =================================================================== diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 788a359..adbba81 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -496,7 +496,6 @@ macro(SETUP_BLENDER_SORTED_LIBS) bf_freestyle bf_ikplugin bf_modifiers - bf_hair bf_bmesh bf_blenkernel bf_nodes diff --git a/intern/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt index dae0e36..5d84c2c 100644 --- a/intern/rigidbody/CMakeLists.txt +++ b/intern/rigidbody/CMakeLists.txt @@ -31,7 +31,6 @@ set(INC_SYS set(SRC rb_bullet_api.cpp - rb_internal_types.h RBI_api.h ) diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h index 6078e1d..688ca91 100644 --- a/intern/rigidbody/RBI_api.h +++ b/intern/rigidbody/RBI_api.h @@ -37,8 +37,6 @@ extern "C" { #endif -#include <string.h> - /* API Notes: * Currently, this API is optimised for Bullet RigidBodies, and doesn't * take into account other Physics Engines. Some tweaking may be necessary @@ -58,11 +56,6 @@ typedef struct rbDynamicsWorld rbDynamicsWorld; /* Rigid Body */ typedef struct rbRigidBody rbRigidBody; -extern const size_t rbRigidBodySize; - -/* Ghost Object */ -typedef struct rbGhostObject rbGhostObject; -extern const size_t rbGhostObjectSize; /* Collision Shape */ typedef struct rbCollisionShape rbCollisionShape; @@ -73,9 +66,6 @@ typedef struct rbMeshData rbMeshData; /* Constraint */ typedef struct rbConstraint rbConstraint; -/* Callback type for handling simulation ticks */ -typedef void (*rbSimulationTickCallback)(void *userdata, float timestep); - /* ********************************** */ /* Dynamics World Methods */ @@ -102,8 +92,7 @@ void RB_dworld_set_split_impulse(rbDynamicsWorld *world, int split_impulse); /* Simulation ----------------------- */ /* Step the simulation by the desired amount (in seconds) with extra controls on substep sizes and maximum substeps */ -void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int maxSubSteps, float timeSubStep, - rbSimulationTickCallback cb, void *userdata, bool is_pre_tick); +void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int maxSubSteps, float timeSubStep); /* Export -------------------------- */ @@ -121,10 +110,6 @@ void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *body, int col_group /* Remove RigidBody from dynamics world */ void RB_dworld_remove_body(rbDynamicsWorld *world, rbRigidBody *body); -/* Ghost Object for detecting collisions */ -void RB_dworld_add_ghost(rbDynamicsWorld *world, rbGhostObject *object, int col_groups); -void RB_dworld_remove_ghost(rbDynamicsWorld *world, rbGhostObject *object); - /* Collision detection */ void RB_world_convex_sweep_test( @@ -135,14 +120,10 @@ void RB_world_convex_sweep_test( /* ............ */ /* Create new RigidBody instance */ -void RB_body_init(rbRigidBody *object, rbCollisionShape *shape, const float loc[3], const float rot[4]); +rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4]); /* Delete the given RigidBody instance */ -void RB_body_free(rbRigidBody *object); - -/* Ghost Object for detecting collisions */ -void RB_ghost_init(rbGhostObject *object, rbCollisionShape *shape, const float loc[3], const float rot[4]); -void RB_ghost_free(rbGhostObject *object); +void RB_body_delete(rbRigidBody *body); /* Settings ------------------------- */ @@ -156,11 +137,6 @@ void RB_body_set_collision_shape(rbRigidBody *body, rbCollisionShape *shape); /* ............ */ -/* Generic flagging */ -extern int RB_body_get_flags(rbRigidBody *body); -extern void RB_body_set_flag(rbRigidBody *body, int flag); -extern void RB_body_clear_flag(rbRigidBody *body, int flag); - /* Mass */ float RB_body_get_mass(rbRigidBody *body); void RB_body_set_mass(rbRigidBody *body, float value); @@ -234,14 +210,6 @@ void RB_body_get_orientation(rbRigidBody *body, float v_out[4]); void RB_body_apply_central_force(rbRigidBody *body, const float v_in[3]); -/* ............ */ - -int RB_ghost_get_flags(rbGhostObject *ghost); -void RB_ghost_set_flag(rbGhostObject *ghost, int flag); -void RB_ghost_clear_flag(rbGhostObject *ghost, int flag); - -void RB_ghost_set_loc_rot(rbGhostObject *ghost, const float loc[3], const float rot[4]); - /* ********************************** */ /* Collision Shape Methods */ diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp index 07ffe20..17bb381 100644 --- a/intern/rigidbody/rb_bullet_api.cpp +++ b/intern/rigidbody/rb_bullet_api.cpp @@ -72,12 +72,19 @@ subject to the following restrictions: #include "BulletCollision/Gimpact/btGImpactShape.h" #include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h" #include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h" -#include "BulletCollision/CollisionDispatch/btGhostObject.h" -#include "rb_internal_types.h" - -const size_t rbRigidBodySize = sizeof(rbRigidBody); -const size_t rbGhostObjectSize = sizeof(rbGhostObject); +struct rbDynamicsWorld { + btDiscreteDynamicsWorld *dynamicsWorld; + btDefaultCollisionConfiguration *collisionConfiguration; + btDispatcher *dispatcher; + btBroadphaseInterface *pairCache; + btConstraintSolver *constraintSolver; + btOverlapFilterCallback *filterCallback; +}; +struct rbRigidBody { + btRigidBody *body; + int col_groups; +}; struct rbVert { float x, y, z; @@ -103,13 +110,13 @@ struct rbFilterCallback : public btOverlapFilterCallback { virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const { - rbCollisionObject *ob0 = (rbCollisionObject *)((btCollisionObject *)proxy0->m_clientObject)->getUserPointer(); - rbCollisionObject *ob1 = (rbCollisionObject *)((btCollisionObject *)proxy1->m_clientObject)->getUserPointer(); + rbRigidBody *rb0 = (rbRigidBody *)((btRigidBody *)proxy0->m_clientObject)->getUserPointer(); + rbRigidBody *rb1 = (rbRigidBody *)((btRigidBody *)proxy1->m_clientObject)->getUserPointer(); bool collides; collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); - collides = collides && (ob0->col_groups & ob1->col_groups); + collides = collides && (rb0->col_groups & rb1->col_groups); return collides; } @@ -148,8 +155,6 @@ rbDynamicsWorld *RB_dworld_new(const float gravity[3]) world->filterCallback = new rbFilterCallback(); world->pairCache->getOverlappingPairCache()->setOverlapFilterCallback(world->filterCallback); - world->ghostPairCallback = new btGhostPairCallback(); - world->pairCache->getOverlappingPairCache()->setInternalGhostPairCallback(world->ghostPairCallback); /* constraint solving */ world->constraintSolver = new btSequentialImpulseConstraintSolver(); @@ -174,7 +179,6 @@ void RB_dworld_delete(rbDynamicsWorld *world) delete world->dispatcher; delete world->collisionConfiguration; delete world->filterCallback; - delete world->ghostPairCallback; delete world; } @@ -209,32 +213,9 @@ void RB_dworld_set_split_impulse(rbDynamicsWorld *world, int split_impulse) /* Simulation ----------------------- */ -struct rbSimulationTickData { - rbSimulationTickData(rbSimulationTickCallback cb, void *userdata) : cb(cb), userdata(userdata) {} - - rbSimulationTickCallback cb; - void *userdata; -}; - -/* wrapper for our own callback type */ -static void rb_simulation_step_cb(btDynamicsWorld *world, btScalar timestep) -{ - rbSimulationTickData *data = (rbSimulationTickData *)world->getWorldUserInfo(); - data->cb(data->userdata, timestep); -} - -void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int maxSubSteps, float timeSubStep, - rbSimulationTickCallback cb, void *userdata, bool is_pre_tick) +void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int maxSubSteps, float timeSubStep) { - /* set the tick callback */ - rbSimulationTickData data(cb, userdata); - world->dynamicsWorld->setInternalTickCallback(rb_simulation_step_cb, (void *)(&data), is_pre_tick); - - /* perform actual time step */ world->dynamicsWorld->stepSimulation(timeStep, maxSubSteps, timeSubStep); - - /* clean up */ - world->dynamicsWorld->setWorldUserInfo(NULL); } /* Export -------------------------- */ @@ -271,7 +252,7 @@ void RB_dworld_export(rbDynamicsWorld *world, const char *filename) void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int col_groups) { - btRigidBody *body = &object->body; + btRigidBody *body = object->body; object->col_groups = col_groups; world->dynamicsWorld->addRigidBody(body); @@ -279,26 +260,11 @@ void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int col_gro void RB_dworld_remove_body(rbDynamicsWorld *world, rbRigidBody *object) { - btRigidBody *body = &object->body; + btRigidBody *body = object->body; world->dynamicsWorld->removeRigidBody(body); } -void RB_dworld_add_ghost(rbDynamicsWorld *world, rbGhostObject *object, int col_groups) -{ - btGhostObject *ghost = &object->ghost; - object->col_groups = col_groups; - - world->dynamicsWorld->addCollisionObject(ghost, btBroadphaseProxy::DefaultFilter, btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::DefaultFilter); -} - -void RB_dworld_remove_ghost(rbDynamicsWorld *world, rbGhostObject *object) -{ - btGhostObject *ghost = &object->ghost; - - world->dynamicsWorld->removeCollisionObject(ghost); -} - /* Collision detection */ void RB_world_convex_sweep_test( @@ -306,7 +272,7 @@ void RB_world_convex_sweep_test( const float loc_start[3], const float loc_end[3], float v_location[3], float v_hitpoint[3], float v_normal[3], int *r_hit) { - btRigidBody *body = &object->body; + btRigidBody *body = object->body; btCollisionShape *collisionShape = body->getCollisionShape(); /* only convex shapes are supported, but user can specify a non convex shape */ if (collisionShape->isConvex()) { @@ -354,8 +320,9 @@ void RB_world_convex_sweep_test( /* ............ */ -void RB_body_init(rbRigidBody *object, rbCollisionShape *shape, c @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs