Beispiel #1
0
 public static void collideOCL(btDbvtNode root, btVector3 normals, SWIGTYPE_p_float offsets, btVector3 sortaxis, int count, btDbvt.ICollide policy)
 {
     BulletPINVOKE.btDbvt_collideOCL__SWIG_1(btDbvtNode.getCPtr(root), btVector3.getCPtr(normals), SWIGTYPE_p_float.getCPtr(offsets), btVector3.getCPtr(sortaxis), count, btDbvt.ICollide.getCPtr(policy));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #2
0
 public static void collideTU(btDbvtNode root, btDbvt.ICollide policy)
 {
     BulletPINVOKE.btDbvt_collideTU(btDbvtNode.getCPtr(root), btDbvt.ICollide.getCPtr(policy));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #3
0
 public static void rayTest(btDbvtNode root, btVector3 rayFrom, btVector3 rayTo, btDbvt.ICollide policy)
 {
     BulletPINVOKE.btDbvt_rayTest(btDbvtNode.getCPtr(root), btVector3.getCPtr(rayFrom), btVector3.getCPtr(rayTo), btDbvt.ICollide.getCPtr(policy));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #4
0
 public void rayTestInternal(btDbvtNode root, btVector3 rayFrom, btVector3 rayTo, btVector3 rayDirectionInverse, SWIGTYPE_p_unsigned_int signs, float lambda_max, btVector3 aabbMin, btVector3 aabbMax, btDbvt.ICollide policy)
 {
     BulletPINVOKE.btDbvt_rayTestInternal(swigCPtr, btDbvtNode.getCPtr(root), btVector3.getCPtr(rayFrom), btVector3.getCPtr(rayTo), btVector3.getCPtr(rayDirectionInverse), SWIGTYPE_p_unsigned_int.getCPtr(signs), lambda_max, btVector3.getCPtr(aabbMin), btVector3.getCPtr(aabbMax), btDbvt.ICollide.getCPtr(policy));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #5
0
 public void collideTTpersistentStack(btDbvtNode root0, btDbvtNode root1, btDbvt.ICollide policy)
 {
     BulletPINVOKE.btDbvt_collideTTpersistentStack(swigCPtr, btDbvtNode.getCPtr(root0), btDbvtNode.getCPtr(root1), btDbvt.ICollide.getCPtr(policy));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #6
0
 public void collideTV(btDbvtNode root, btDbvtAabbMm volume, btDbvt.ICollide policy)
 {
     BulletPINVOKE.btDbvt_collideTV(swigCPtr, btDbvtNode.getCPtr(root), btDbvtAabbMm.getCPtr(volume), btDbvt.ICollide.getCPtr(policy));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #7
0
 public void update(btDbvtNode leaf, btDbvtAabbMm volume)
 {
     BulletPINVOKE.btDbvt_update__SWIG_2(swigCPtr, btDbvtNode.getCPtr(leaf), btDbvtAabbMm.getCPtr(volume));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #8
0
 public static void extractLeaves(btDbvtNode node, SWIGTYPE_p_btAlignedObjectArrayT_btDbvtNode_const_p_t leaves)
 {
     BulletPINVOKE.btDbvt_extractLeaves(btDbvtNode.getCPtr(node), SWIGTYPE_p_btAlignedObjectArrayT_btDbvtNode_const_p_t.getCPtr(leaves));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #9
0
        public bool update(btDbvtNode leaf, btDbvtAabbMm volume, float margin)
        {
            bool ret = BulletPINVOKE.btDbvt_update__SWIG_5(swigCPtr, btDbvtNode.getCPtr(leaf), btDbvtAabbMm.getCPtr(volume), margin);

            if (BulletPINVOKE.SWIGPendingException.Pending)
            {
                throw BulletPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #10
0
        public bool update(btDbvtNode leaf, btDbvtAabbMm volume, btVector3 velocity)
        {
            bool ret = BulletPINVOKE.btDbvt_update__SWIG_4(swigCPtr, btDbvtNode.getCPtr(leaf), btDbvtAabbMm.getCPtr(volume), btVector3.getCPtr(velocity));

            if (BulletPINVOKE.SWIGPendingException.Pending)
            {
                throw BulletPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #11
0
        public btDbvtNode insert(btDbvtAabbMm box, SWIGTYPE_p_void data)
        {
            global::System.IntPtr cPtr = BulletPINVOKE.btDbvt_insert(swigCPtr, btDbvtAabbMm.getCPtr(box), SWIGTYPE_p_void.getCPtr(data));
            btDbvtNode            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new btDbvtNode(cPtr, false);

            if (BulletPINVOKE.SWIGPendingException.Pending)
            {
                throw BulletPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #12
0
		public static void CollideTT( btDbvtNode root0, btDbvtNode root1, ICollide collideable )
		{
			CollideTTCount++;
			Debug.Assert( CollideTTCount < 2 );
			CollideTTStack.Clear();

			if( root0 != null && root1 != null )
			{
				int depth = 1;
				int treshold = DOUBLE_STACKSIZE - 4;
				CollideTTStack[0].Initialize( root0, root1 );

				do
				{
					sStkNN p = CollideTTStack[--depth];

					if( depth > treshold )
					{
						CollideTTStack.Count = ( CollideTTStack.Count * 2 );
						treshold = CollideTTStack.Count - 4;
					}

					if( p.a == p.b )
					{
						if( p.a.IsInternal() )
						{
							CollideTTStack[depth++].Initialize( p.a._children0, p.a._children0 );
							CollideTTStack[depth++].Initialize( p.a._children1, p.a._children1 );
							CollideTTStack[depth++].Initialize( p.a._children0, p.a._children1 );
						}
					}
					else if( btDbvtVolume.Intersect( ref p.a.volume, ref p.b.volume ) )
					{
						if( p.a.IsInternal() )
						{
							if( p.b.IsInternal() )
							{
								CollideTTStack[depth++].Initialize( p.a._children0, p.b._children0 );
								CollideTTStack[depth++].Initialize( p.a._children1, p.b._children0 );
								CollideTTStack[depth++].Initialize( p.a._children0, p.b._children1 );
								CollideTTStack[depth++].Initialize( p.a._children1, p.b._children1 );
							}
							else
							{
								CollideTTStack[depth++].Initialize( p.a._children0, p.b );
								CollideTTStack[depth++].Initialize( p.a._children1, p.b );
							}
						}
						else
						{
							if( p.b.IsInternal() )
							{
								CollideTTStack[depth++].Initialize( p.a, p.b._children0 );
								CollideTTStack[depth++].Initialize( p.a, p.b._children1 );
							}
							else
							{
								collideable.Process( p.a, p.b );
							}
						}
					}
				} while( depth > 0 );
			}
			CollideTTCount--;
		}
Beispiel #13
0
            public virtual bool AllLeaves(btDbvtNode arg0)
            {
                bool ret = BulletPINVOKE.btDbvt_ICollide_AllLeaves(swigCPtr, btDbvtNode.getCPtr(arg0));

                return(ret);
            }
Beispiel #14
0
		public void remove( btDbvtNode leaf )
		{
			RemoveLeaf( this, leaf );
			DeleteNode( this, leaf );
			--m_leaves;
		}
Beispiel #15
0
		public bool update( btDbvtNode leaf, ref btDbvtVolume volume, ref btVector3 velocity )
		{
			if( leaf.volume.Contain( ref volume ) )
			{
				return ( false );
			}
			volume.SignedExpand( velocity );
			update( leaf, ref volume );
			return ( true );
		}
Beispiel #16
0
		public void update( btDbvtNode leaf, int lookahead )
		{
			btDbvtNode root = RemoveLeaf( this, leaf );
			if( root != null )
			{
				if( lookahead >= 0 )
				{
					for( int i = 0; ( i < lookahead ) && ( root.parent != null ); ++i )
					{
						root = root.parent;
					}
				}
				else
				{
					root = Root;
				}
			}
			InsertLeaf( this, root, leaf );
		}
Beispiel #17
0
 public virtual void WriteLeaf(btDbvtNode arg0, int index, int parent)
 {
     BulletPINVOKE.btDbvt_IWriter_WriteLeaf(swigCPtr, btDbvtNode.getCPtr(arg0), index, parent);
 }
Beispiel #18
0
 public sStkCLN(btDbvtNode n, btDbvtNode p) : this(BulletPINVOKE.new_btDbvt_sStkCLN(btDbvtNode.getCPtr(n), btDbvtNode.getCPtr(p)), true)
 {
 }
Beispiel #19
0
 public sStkNP(btDbvtNode n, uint m) : this(BulletPINVOKE.new_btDbvt_sStkNP(btDbvtNode.getCPtr(n), m), true)
 {
 }
Beispiel #20
0
 public virtual void Prepare(btDbvtNode root, int numnodes)
 {
     BulletPINVOKE.btDbvt_IWriter_Prepare(swigCPtr, btDbvtNode.getCPtr(root), numnodes);
 }
Beispiel #21
0
 public void update(btDbvtNode leaf)
 {
     BulletPINVOKE.btDbvt_update__SWIG_1(swigCPtr, btDbvtNode.getCPtr(leaf));
 }
Beispiel #22
0
 public void update(btDbvtNode leaf, int lookahead)
 {
     BulletPINVOKE.btDbvt_update__SWIG_0(swigCPtr, btDbvtNode.getCPtr(leaf), lookahead);
 }
Beispiel #23
0
 public virtual void CloneLeaf(btDbvtNode arg0)
 {
     BulletPINVOKE.btDbvt_IClone_CloneLeaf(swigCPtr, btDbvtNode.getCPtr(arg0));
 }
Beispiel #24
0
 public virtual void Process(btDbvtNode n, float arg1)
 {
     BulletPINVOKE.btDbvt_ICollide_Process__SWIG_2(swigCPtr, btDbvtNode.getCPtr(n), arg1);
 }
Beispiel #25
0
			public virtual void Process( btDbvtNode n, double f )
			{
				//IndexedMatrix im = IndexedMatrix.Identity;
				btVector3 color = new btVector3( 1, 1, 1 );
				BulletGlobals.gDebugDraw.drawBox( ref n.volume._min, ref n.volume._max, ref btTransform.Identity, ref color );

			}
Beispiel #26
0
		public static btDbvtNode CreateNode( btDbvt pdbvt, btDbvtNode parent, Object data )
		{
			btDbvtNode node = BulletGlobals.DbvtNodePool.Get();
			node.parent = parent;
			node.data = data;
			if( node.data is int )
			{
				//Debug.Assert(false);
				node.dataAsInt = (int)node.data;
			}
			node._children0 = null;
			node._children1 = null;
			return ( node );
		}
Beispiel #27
0
			public virtual bool AllLeaves( btDbvtNode n )
			{
				return true;
			}
Beispiel #28
0
		public static void InsertLeaf( btDbvt pdbvt, btDbvtNode root, btDbvtNode leaf )
		{
			if( pdbvt.Root == null )
			{
				pdbvt.Root = leaf;
				leaf.parent = null;
			}
			else
			{
				if( !root.IsLeaf() )
				{
					do
					{
						if( btDbvtVolume.Select( ref leaf.volume,
												ref root._children0.volume,
												ref root._children1.volume ) == 0 )
							root = root._children0;
						else
							root = root._children1;

					} while( !root.IsLeaf() );
				}
				btDbvtNode prev = root.parent;
				btDbvtVolume mergeResults = btDbvtVolume.Merge( ref leaf.volume, ref root.volume );

				btDbvtNode node = CreateNode2( pdbvt, prev, ref mergeResults, null );
				if( prev != null )
				{
					if( IndexOf( root ) == 0 )
						prev._children0 = node;
					else
						prev._children1 = node;
					node._children0 = root;
					root.parent = node;
					node._children1 = leaf;
					leaf.parent = node;
					do
					{
						if( !prev.volume.Contain( ref node.volume ) )
						{
							btDbvtVolume.Merge( ref prev._children0.volume, ref prev._children1.volume, out prev.volume );
						}
						else
						{
							break;
						}
						node = prev;
					} while( null != ( prev = node.parent ) );
				}
				else
				{
					node._children0 = root;
					root.parent = node;
					node._children1 = leaf;
					leaf.parent = node;
					pdbvt.Root = node;
				}
			}
		}
Beispiel #29
0
 public virtual void WriteNode(btDbvtNode arg0, int index, int parent, int child0, int child1)
 {
     BulletPINVOKE.btDbvt_IWriter_WriteNode(swigCPtr, btDbvtNode.getCPtr(arg0), index, parent, child0, child1);
 }
Beispiel #30
0
			public virtual void Process( btDbvtNode n )
			{
				btVector3 color = new btVector3( 1, 1, 1 );
				BulletGlobals.gDebugDraw.drawBox( ref n.volume._min, ref n.volume._max, ref btTransform.Identity, ref color );

			}
Beispiel #31
0
 public void remove(btDbvtNode leaf)
 {
     BulletPINVOKE.btDbvt_remove(swigCPtr, btDbvtNode.getCPtr(leaf));
 }
Beispiel #32
0
			public virtual bool Descent( btDbvtNode n )
			{
				return true;
			}
Beispiel #33
0
        public static int maxdepth(btDbvtNode node)
        {
            int ret = BulletPINVOKE.btDbvt_maxdepth(btDbvtNode.getCPtr(node));

            return(ret);
        }
Beispiel #34
0
		public void update( btDbvtNode leaf )
		{
			update( leaf, -1 );
		}
Beispiel #35
0
        public static int countLeaves(btDbvtNode node)
        {
            int ret = BulletPINVOKE.btDbvt_countLeaves(btDbvtNode.getCPtr(node));

            return(ret);
        }
Beispiel #36
0
		public void update( btDbvtNode leaf, ref btDbvtVolume volume )
		{
			btDbvtNode root = RemoveLeaf( this, leaf );
			if( root != null )
			{
				if( m_lkhd >= 0 )
				{
					for( int i = 0; ( i < m_lkhd ) && ( root.parent != null ); ++i )
					{
						root = root.parent;
					}
				}
				else
				{
					root = Root;
				}
			}
			leaf.volume = volume;
			InsertLeaf( this, root, leaf );
		}
Beispiel #37
0
		//
		// depth is defaulted to -1
		public static void FetchLeafs( btDbvt pdbvt, btDbvtNode root, btList<btDbvtNode> leafs )
		{
			FetchLeafs( pdbvt, root, leafs, -1 );
		}
Beispiel #38
0
		public bool update( btDbvtNode leaf, ref btDbvtVolume volume, double margin )
		{
			if( leaf.volume.Contain( ref volume ) )
			{
				return ( false );
			}
			volume.Expand( new btVector3( margin ) );
			update( leaf, ref volume );
			return ( true );
		}
Beispiel #39
0
		public static void GetMaxDepth( btDbvtNode node, int depth, ref int maxDepth )
		{
			if( node.IsInternal() )
			{
				GetMaxDepth( node._children0, depth + 1, ref maxDepth );
				GetMaxDepth( node._children1, depth + 1, ref maxDepth );
			}
			else
			{
				maxDepth = Math.Max( depth, maxDepth );
			}
		}
Beispiel #40
0
		public static btDbvtNode Sort( btDbvtNode n, btDbvtNode r )
		{
			btDbvtNode p = n.parent;
			Debug.Assert( n.IsInternal() );
			if( p != null && ( p.id > n.id ) )
			{
				int i = IndexOf( n );
				int j = 1 - i;
				btDbvtNode s = (j==0)?p._children0:p._children1;
				btDbvtNode q = p.parent;
				Debug.Assert( n == ((i==0)?p._children0:p._children1) );
				if( q != null )
				{
					if( IndexOf( p ) == 1 )
	                    q._children1 = n;
					else
						q._children0 = n;
				}
				else
				{
					r = n;
				}
				s.parent = n;
				p.parent = n;
				n.parent = q;
				p._children0 = n._children0;
				p._children1 = n._children1;
				n._children0.parent = p;
				n._children1.parent = p;
				if( i == 0 )
					n._children0 = p;
				else
					n._children1 = p;
				if( j == 0 )
					n._children0 = s;
				else
					n._children1 = s;

				// swap id's? as well - probably not.

				swap( ref p.volume, ref n.volume );
				return ( p );
			}
			return ( n );
		}
Beispiel #41
0
            public virtual bool Descent(btDbvtNode arg0)
            {
                bool ret = BulletPINVOKE.btDbvt_ICollide_Descent(swigCPtr, btDbvtNode.getCPtr(arg0));

                return(ret);
            }
Beispiel #42
0
		public static void FetchLeafs( btDbvt pdbvt, btDbvtNode root, btList<btDbvtNode> leafs, int depth )
		{
			if( root.IsInternal() && depth != 0 )
			{
				FetchLeafs( pdbvt, root._children0, leafs, depth - 1 );
				FetchLeafs( pdbvt, root._children1, leafs, depth - 1 );
				DeleteNode( pdbvt, root );
			}
			else
			{
				leafs.Add( root );
			}
		}
Beispiel #43
0
		public static void rayTest( btDbvtNode root,
								ref btVector3 rayFrom,
								ref btVector3 rayTo,
								ICollide policy )
		{

			using( btDbvtStackDataBlock stackDataBlock = new btDbvtStackDataBlock() )
			{
				if( root != null )
				{
					btVector3 rayDir = ( rayTo - rayFrom );
					rayDir.normalize();

					///what about division by zero? -. just set rayDirection[i] to INF/BT_LARGE_FLOAT
					btVector3 rayDirectionInverse = new btVector3(
						rayDir.x == 0.0f ? btScalar.BT_LARGE_FLOAT : 1.0f / rayDir.x,
						rayDir.y == 0.0f ? btScalar.BT_LARGE_FLOAT : 1.0f / rayDir.y,
						rayDir.z == 0.0f ? btScalar.BT_LARGE_FLOAT : 1.0f / rayDir.z );

					stackDataBlock.signs[0] = rayDirectionInverse.x < 0.0f ? (uint)1 :0;
					stackDataBlock.signs[1] = rayDirectionInverse.y < 0.0f ? (uint)1 :0;
					stackDataBlock.signs[2] = rayDirectionInverse.z < 0.0f ? (uint)1 :0;


					btVector3 tmp; rayTo.Sub( ref rayFrom, out tmp );
					double lambda_max = btVector3.dot( ref rayDir, ref tmp );


					int depth = 1;
					int treshold = DOUBLE_STACKSIZE - 2;

					stackDataBlock.stack.Count = ( DOUBLE_STACKSIZE );
					stackDataBlock.stack[0] = root;
					do
					{
						btDbvtNode node = stackDataBlock.stack[--depth];

						stackDataBlock.bounds0 = node.volume._min;
						stackDataBlock.bounds1 = node.volume._max;

						double tmin = 1.0f, lambda_min = 0.0f;
						bool result1 = btAabbUtil.btRayAabb2( ref rayFrom, ref rayDirectionInverse, stackDataBlock.signs
							, ref stackDataBlock.bounds0
							, ref stackDataBlock.bounds1
							, out tmin, lambda_min, lambda_max );

#if COMPARE_BTRAY_AABB2
				double param=1.0f;
				bool result2 = AabbUtil.RayAabb(ref rayFrom,ref rayTo,node.volume.Mins(),node.volume.Maxs(),param,resultNormal);
				Debug.Assert(result1 == result2);
#endif //TEST_BTRAY_AABB2

						if( result1 )
						{
							if( node.IsInternal() )
							{
								if( depth > treshold )
								{
									stackDataBlock.stack.Count = ( stackDataBlock.stack.Count * 2 );
									treshold = stackDataBlock.stack.Count - 2;
								}
								stackDataBlock.stack[depth++] = node._children0;
								stackDataBlock.stack[depth++] = node._children1;
							}
							else
							{
								policy.Process( node );
							}
						}
					} while( depth != 0 );

				}
			}
		}
Beispiel #44
0
		public static void EnumLeaves( btDbvtNode root, ICollide collideable )
		{
			if( root.IsInternal() )
			{
				EnumLeaves( root._children0, collideable );
				EnumLeaves( root._children1, collideable );
			}
			else
			{
				collideable.Process( root );
			}
		}
Beispiel #45
0
		public static void CollideTV( btDbvtNode root, ref btDbvtVolume volume, ICollide collideable )
		{
			CollideTVCount++;
			Debug.Assert( CollideTVCount < 2 );
			CollideTVStack.Clear();
			if( root != null )
			{
				CollideTVStack.Push( root );
				do
				{
					btDbvtNode n = CollideTVStack.Pop();
					if( btDbvtVolume.Intersect( ref n.volume, ref volume ) )
					{
						if( n.IsInternal() )
						{
							CollideTVStack.Push( n._children0 );
							CollideTVStack.Push( n._children1 );
						}
						else
						{
							collideable.Process( n );
						}
					}
				} while( CollideTVStack.Count > 0 );
			}
			CollideTVCount--;
		}
Beispiel #46
0
		public static void CollideTTpersistentStack( btDbvtNode root0,
								  btDbvtNode root1,
								  ICollide collideable )
		{
			//CollideTT(root0, root1, collideable);
			//return;
			if( root0 != null && root1 != null )
			{
				int depth = 1;
				int treshold = m_stkStack.Length - 4;

				//m_stkStack.Capacity = DOUBLE_STACKSIZE;
				m_stkStack[0].Initialize( root0, root1 );
				do
				{
					sStkNN p = m_stkStack[--depth];
					if( depth > treshold )
					{
						sStkNN[] newArray = new sStkNN[m_stkStack.Length * 2];
						for( int n = 0; n < depth; n++ )
							newArray[n] = m_stkStack[n];
						m_stkStack = newArray;
						treshold = newArray.Length - 4;
					}
					if( p.a == p.b )
					{
						if( p.a.IsInternal() )
						{
							m_stkStack[depth++].Initialize( p.a._children0, p.a._children0 );
							m_stkStack[depth++].Initialize( p.a._children1, p.a._children1 );
							m_stkStack[depth++].Initialize( p.a._children0, p.a._children1 );
						}
					}
					else if( btDbvtVolume.Intersect( ref p.a.volume, ref p.b.volume ) )
					{
						if( p.a.IsInternal() )
						{
							if( p.b.IsInternal() )
							{
								m_stkStack[depth++].Initialize( p.a._children0, p.b._children0 );
								m_stkStack[depth++].Initialize( p.a._children1, p.b._children0 );
								m_stkStack[depth++].Initialize( p.a._children0, p.b._children1 );
								m_stkStack[depth++].Initialize( p.a._children1, p.b._children1 );
							}
							else
							{
								m_stkStack[depth++].Initialize( p.a._children0, p.b );
								m_stkStack[depth++].Initialize( p.a._children1, p.b );
							}
						}
						else
						{
							if( p.b.IsInternal() )
							{
								m_stkStack[depth++].Initialize( p.a, p.b._children0 );
								m_stkStack[depth++].Initialize( p.a, p.b._children1 );
							}
							else
							{
								collideable.Process( p.a, p.b );
							}
						}
					}
				} while( depth > 0 );
			}
		}
Beispiel #47
0
 public virtual void Process(btDbvtNode arg0)
 {
     BulletPINVOKE.btDbvt_ICollide_Process__SWIG_1(swigCPtr, btDbvtNode.getCPtr(arg0));
 }
Beispiel #48
0
		public static void rayTestInternal( btDbvtNode root,
									ref btVector3 rayFrom,
									ref btVector3 rayTo,
									ref btVector3 rayDirectionInverse,
									uint[] signs,
									double lambda_max,
									ref btVector3 aabbMin,
									ref btVector3 aabbMax,
									ICollide policy )
		{
			using( btDbvtStackDataBlock stackDataBlock = BulletGlobals.DbvtStackDataBlockPool.Get() )
			{
				//	(void) rayTo;
				//DBVT_CHECKTYPE
				if( root != null )
				{
					btVector3 resultNormal = new btVector3( 0, 1, 0 );

					int depth = 1;
					int treshold = DOUBLE_STACKSIZE - 2;
					stackDataBlock.stack[0] = root;
					do
					{
						btDbvtNode node = stackDataBlock.stack[--depth];
						node.volume._min.Sub( ref aabbMax, out stackDataBlock.bounds0 );
						node.volume._max.Sub( ref aabbMin, out stackDataBlock.bounds1 );
						double tmin = 1.0f, lambda_min = 0.0f;
						bool result1 = btAabbUtil.btRayAabb2( ref rayFrom, ref rayDirectionInverse, signs
							, ref stackDataBlock.bounds0
							, ref stackDataBlock.bounds1
							, out tmin, lambda_min, lambda_max );
						if( result1 )
						{
							if( node.IsInternal() )
							{
								if( depth > treshold )
								{
									stackDataBlock.stack.Count = ( stackDataBlock.stack.Count * 2 );
									treshold = stackDataBlock.stack.Count - 2;
								}
								stackDataBlock.stack[depth++] = node._children0;
								stackDataBlock.stack[depth++] = node._children1;
							}
							else
							{
								policy.Process( node );
							}
						}
					} while( depth != 0 );
				}

			}
		}
Beispiel #49
0
		//
		public static btDbvtNode CreateNode( btDbvt pdbvt,
											   btDbvtNode parent,
											   ref btDbvtVolume volume,
											   Object data )
		{
			btDbvtNode node = CreateNode( pdbvt, parent, data );
			node.volume = volume;
			return ( node );
		}
Beispiel #50
0
		public static btDbvtNode CreateNode( btDbvt pdbvt, btDbvtNode parent, int data )
		{
			btDbvtNode node = BulletGlobals.DbvtNodePool.Get();
			node.parent = parent;
			node.data = null;
			node.dataAsInt = data;
			node._children0 = null;
			node._children1 = null;
			return ( node );
		}
Beispiel #51
0
		public static void DeleteNode( btDbvt pdbvt, btDbvtNode node )
		{
			//btAlignedFree(pdbvt.m_free);
			//pdbvt.m_free = node;
			node.Reset();
			BulletGlobals.DbvtNodePool.Free( node );
		}
Beispiel #52
0
		public static btDbvtNode CreateNode2( btDbvt tree, btDbvtNode aparent, ref btDbvtVolume avolume, Object adata )
		{
			btDbvtNode node = BulletGlobals.DbvtNodePool.Get();
			node.volume = avolume;
			node.parent = aparent;
			node.data = adata;
			node._children0 = null;
			node._children1 = null;

			if( node.data is int )
			{
				Debug.Assert( false );
				node.dataAsInt = (int)node.data;
			}

			return node;
		}
Beispiel #53
0
 public sStkNPS(btDbvtNode n, uint m, float v) : this(BulletPINVOKE.new_btDbvt_sStkNPS__SWIG_1(btDbvtNode.getCPtr(n), m, v), true)
 {
 }
Beispiel #54
0
		//
		public static btDbvtNode CreateNode( btDbvt pdbvt,
									btDbvtNode parent,
									ref btDbvtVolume volume0,
									ref btDbvtVolume volume1,
									Object data )
		{
			btDbvtNode node = CreateNode( pdbvt, parent, data );
			btDbvtVolume.Merge( ref volume0, ref volume1, out node.volume );
			return ( node );
		}
Beispiel #55
0
			public virtual void Process( btDbvtNode n, double f )
			{
				Process( n );
			}
Beispiel #56
0
		public static void RecurseDeleteNode( btDbvt pdbvt, btDbvtNode node )
		{
			if( !node.IsLeaf() )
			{
				RecurseDeleteNode( pdbvt, node._children0 );
				RecurseDeleteNode( pdbvt, node._children1 );
			}
			if( node == pdbvt.m_root )
			{
				pdbvt.m_root = null;
			}
			DeleteNode( pdbvt, node );
		}
Beispiel #57
0
			public virtual void Process( btDbvtNode n, btDbvtNode n2 ) { }
Beispiel #58
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(btDbvtNode obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #59
0
 public sStkNN(btDbvtNode na, btDbvtNode nb) : this(BulletPINVOKE.new_btDbvt_sStkNN__SWIG_1(btDbvtNode.getCPtr(na), btDbvtNode.getCPtr(nb)), true)
 {
 }