Upgrade Bullet to version 2.83.
[blender.git] / extern / bullet2 / src / BulletCollision / CollisionDispatch / btCollisionObject.h
index 89cad16821093c14d1c56aa9464502220deee09e..c68402418f72061f548b0fd3db67a34fa8d927e9 100644 (file)
@@ -92,11 +92,10 @@ protected:
        int                             m_internalType;
 
        ///users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
-       union
-       {
-               void*                   m_userObjectPointer;
-               int     m_userIndex;
-       };
+
+    void*                      m_userObjectPointer;
+    
+    int        m_userIndex;
 
        ///time of impact calculation
        btScalar                m_hitFraction; 
@@ -110,13 +109,11 @@ protected:
        /// If some object should have elaborate collision filtering by sub-classes
        int                     m_checkCollideWith;
 
+       btAlignedObjectArray<const btCollisionObject*> m_objectsWithoutCollisionCheck;
+
        ///internal update revision number. It will be increased when the object changes. This allows some subsystems to perform lazy evaluation.
        int                     m_updateRevision;
 
-       virtual bool    checkCollideWithOverride(const btCollisionObject* /* co */) const
-       {
-               return true;
-       }
 
 public:
 
@@ -225,7 +222,34 @@ public:
                return m_collisionShape;
        }
 
-       
+       void    setIgnoreCollisionCheck(const btCollisionObject* co, bool ignoreCollisionCheck)
+       {
+               if (ignoreCollisionCheck)
+               {
+                       //We don't check for duplicates. Is it ok to leave that up to the user of this API?
+                       //int index = m_objectsWithoutCollisionCheck.findLinearSearch(co);
+                       //if (index == m_objectsWithoutCollisionCheck.size())
+                       //{
+                       m_objectsWithoutCollisionCheck.push_back(co);
+                       //}
+               }
+               else
+               {
+                       m_objectsWithoutCollisionCheck.remove(co);
+               }
+               m_checkCollideWith = m_objectsWithoutCollisionCheck.size() > 0;
+       }
+
+       virtual bool    checkCollideWithOverride(const btCollisionObject*  co) const
+       {
+               int index = m_objectsWithoutCollisionCheck.findLinearSearch(co);
+               if (index < m_objectsWithoutCollisionCheck.size())
+               {
+                       return false;
+               }
+               return true;
+       }
+