예제 #1
0
        //
        
        public static int ListCount(DbvtProxy root)
        {
	        int	n=0;
	        while(root != null) 
            { 
                ++n;
                root=root.links[1]; 
            }
	        return n;
        }
예제 #2
0
        //
        // Helpers
        //

        //

        public static void ListAppend(DbvtProxy item, ref DbvtProxy list)
        {
	        item.links[0]=null;
	        item.links[1]=list;
	        if(list != null)
            {   
                list.links[0]=item;
            }
	        list=item;
        }
예제 #3
0
        //
        public static void ListRemove(DbvtProxy item,ref DbvtProxy list)
        {
	        if(item.links[0] != null)
            {
                item.links[0].links[1]=item.links[1]; 
            }
            else 
            {
                list=item.links[1];
            }
	        if(item.links[1] != null) 
            {
                item.links[1].links[0]=item.links[0];
            }
        }
예제 #4
0
        public virtual BroadphaseProxy CreateProxy(ref Vector3 aabbMin, ref Vector3 aabbMax, BroadphaseNativeTypes shapeType, Object userPtr, CollisionFilterGroups collisionFilterGroup, CollisionFilterGroups collisionFilterMask, IDispatcher dispatcher, Object multiSapProxy)
        {
	        DbvtProxy proxy=new DbvtProxy(ref aabbMin,ref aabbMax,userPtr,collisionFilterGroup,collisionFilterMask);

	        DbvtAabbMm aabb = DbvtAabbMm.FromMM(ref aabbMin,ref aabbMax);

	        //bproxy.aabb			=	btDbvtAabbMm::FromMM(aabbMin,aabbMax);
	        proxy.stage		=	m_stageCurrent;
	        proxy.m_uniqueId	=	++m_gid;
	        proxy.leaf			=	m_sets[0].Insert(ref aabb,proxy);
	        ListAppend(proxy,ref m_stageRoots[m_stageCurrent]);
	        if(!m_deferedcollide)
	        {
		        DbvtTreeCollider collider = new DbvtTreeCollider(this);
		        collider.proxy=proxy;
		        Dbvt.CollideTV(m_sets[0].m_root,ref aabb,collider);
		        Dbvt.CollideTV(m_sets[1].m_root,ref aabb,collider);
	        }
	        return(proxy);

        }