Exemple #1
0
 // This constructor for the top node
 public SphereTreeNode(Vector3 center, float radius, SphereTree sphereTree)
     : base(center, radius)
 {
     this.sphereTree    = sphereTree;
     parent             = null;
     children           = new SphereTreeNode[childCount];
     containedShape     = null;
     intersectingShapes = new List <CollisionShape>();
     leafNode           = false;
     sphereTree.idCounter++;
     id = sphereTree.idCounter;
     sphereTree.nodeCount++;
 }
Exemple #2
0
 // Create a SphereTreeNode leaf node
 public SphereTreeNode(CollisionShape shape, SphereTree sphereTree)
     : base(shape.center, shape.radius)
 {
     this.sphereTree     = sphereTree;
     this.containedShape = shape;
     parent             = null;
     children           = new SphereTreeNode[childCount];
     intersectingShapes = new List <CollisionShape>();
     leafNode           = true;
     sphereTree.idCounter++;
     id = sphereTree.idCounter;
     sphereTree.nodeCount++;
     RenderedNode.MaybeCreateRenderedNodes(true, shape, id, ref renderedNodes);
 }
//////////////////////////////////////////////////////////////////////
//
// The external interface to the collision library
//
//////////////////////////////////////////////////////////////////////

        public CollisionAPI(bool logCollisions)
        {
            if (logCollisions)
#if NOT
            { MO.InitLog(true); }
#else
            { MO.DoLog = true; }
#endif
            sphereTree = new SphereTree();
            sphereTree.Initialize();
            topLevelCalls      = 0;
            partCalls          = 0;
            topLevelCollisions = 0;
            collisionTestCount = 0;
            ParameterRegistry.RegisterSubsystemHandlers("CollisionAPI", setParameterHandler, getParameterHandler);
        }
 //////////////////////////////////////////////////////////////////////
 //
 // The external interface to the collision library
 //
 //////////////////////////////////////////////////////////////////////
 public CollisionAPI(bool logCollisions)
 {
     if (logCollisions)
     #if NOT
     MO.InitLog(true);
     #else
     MO.DoLog = true;
     #endif
     sphereTree = new SphereTree();
     sphereTree.Initialize();
     topLevelCalls = 0;
     partCalls = 0;
     topLevelCollisions = 0;
     collisionTestCount = 0;
     ParameterRegistry.RegisterSubsystemHandlers("CollisionAPI", setParameterHandler, getParameterHandler);
 }
 // This constructor for the top node
 public SphereTreeNode(Vector3 center, float radius, SphereTree sphereTree)
     : base(center, radius)
 {
     this.sphereTree = sphereTree;
     parent = null;
     children = new SphereTreeNode[childCount];
     containedShape = null;
     intersectingShapes = new List<CollisionShape>();
     leafNode = false;
     sphereTree.idCounter++;
     id = sphereTree.idCounter;
     sphereTree.nodeCount++;
 }
 // Create a SphereTreeNode leaf node
 public SphereTreeNode(CollisionShape shape, SphereTree sphereTree)
     : base(shape.center, shape.radius)
 {
     this.sphereTree = sphereTree;
     this.containedShape = shape;
     parent = null;
     children = new SphereTreeNode[childCount];
     intersectingShapes = new List<CollisionShape>();
     leafNode = true;
     sphereTree.idCounter++;
     id = sphereTree.idCounter;
     sphereTree.nodeCount++;
     RenderedNode.MaybeCreateRenderedNodes(true, shape, id, ref renderedNodes);
 }