~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to extern/bullet/BulletDynamics/CollisionDispatch/ManifoldResult.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
3
 
 *
4
 
 * Permission to use, copy, modify, distribute and sell this software
5
 
 * and its documentation for any purpose is hereby granted without fee,
6
 
 * provided that the above copyright notice appear in all copies.
7
 
 * Erwin Coumans makes no representations about the suitability 
8
 
 * of this software for any purpose.  
9
 
 * It is provided "as is" without express or implied warranty.
10
 
*/
11
 
 
12
 
#include "ManifoldResult.h"
13
 
#include "NarrowPhaseCollision/PersistentManifold.h"
14
 
#include "Dynamics/RigidBody.h"
15
 
 
16
 
ManifoldResult::ManifoldResult(RigidBody* body0,RigidBody* body1,PersistentManifold* manifoldPtr)
17
 
                :m_manifoldPtr(manifoldPtr),
18
 
                m_body0(body0),
19
 
                m_body1(body1)
20
 
        {
21
 
        }
22
 
 
23
 
void ManifoldResult::AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth)
24
 
{
25
 
        if (depth > m_manifoldPtr->GetManifoldMargin())
26
 
                return;
27
 
 
28
 
        SimdTransform transAInv = m_body0->getCenterOfMassTransform().inverse();
29
 
        SimdTransform transBInv= m_body1->getCenterOfMassTransform().inverse();
30
 
        SimdVector3 pointA = pointInWorld + normalOnBInWorld * depth;
31
 
        SimdVector3 localA = transAInv(pointA );
32
 
        SimdVector3 localB = transBInv(pointInWorld);
33
 
        ManifoldPoint newPt(localA,localB,normalOnBInWorld,depth);
34
 
 
35
 
        
36
 
 
37
 
        int insertIndex = m_manifoldPtr->GetCacheEntry(newPt);
38
 
        if (insertIndex >= 0)
39
 
        {
40
 
                m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex);
41
 
        } else
42
 
        {
43
 
                m_manifoldPtr->AddManifoldPoint(newPt);
44
 
        }
45
 
}
46