Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp @ 1963

Last change on this file since 1963 was 1963, checked in by rgrieder, 15 years ago

Added Bullet physics engine.

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#include "btSoftRigidCollisionAlgorithm.h"
17#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
18#include "BulletCollision/CollisionShapes/btSphereShape.h"
19#include "BulletCollision/CollisionShapes/btBoxShape.h"
20#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
21#include "btSoftBody.h"
22///TODO: include all the shapes that the softbody can collide with
23///alternatively, implement special case collision algorithms (just like for rigid collision shapes)
24
25//#include <stdio.h>
26
27btSoftRigidCollisionAlgorithm::btSoftRigidCollisionAlgorithm(btPersistentManifold* /*mf*/,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* /*col0*/,btCollisionObject* /*col1*/, bool isSwapped)
28: btCollisionAlgorithm(ci),
29//m_ownManifold(false),
30//m_manifoldPtr(mf),
31m_isSwapped(isSwapped)
32{
33}
34
35
36btSoftRigidCollisionAlgorithm::~btSoftRigidCollisionAlgorithm()
37{
38
39        //m_softBody->m_overlappingRigidBodies.remove(m_rigidCollisionObject);
40
41        /*if (m_ownManifold)
42        {
43        if (m_manifoldPtr)
44        m_dispatcher->releaseManifold(m_manifoldPtr);
45        }
46        */
47
48}
49
50
51#include <stdio.h>
52
53void btSoftRigidCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
54{
55        (void)dispatchInfo;
56        (void)resultOut;
57        //printf("btSoftRigidCollisionAlgorithm\n");
58
59        btSoftBody* softBody =  m_isSwapped? (btSoftBody*)body1 : (btSoftBody*)body0;
60        btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1;
61
62        softBody->defaultCollisionHandler(rigidCollisionObject);
63
64
65}
66
67btScalar btSoftRigidCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btCollisionObject* col1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
68{
69        (void)resultOut;
70        (void)dispatchInfo;
71        (void)col0;
72        (void)col1;
73
74        //not yet
75        return btScalar(1.);
76}
77
78
79
Note: See TracBrowser for help on using the repository browser.