Beispiel #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            base.Draw(gameTime);

            DebugShapeRenderer.Draw(gameTime, camera.ViewMatrix, camera.ProjectionMatrix);
        }
Beispiel #2
0
        protected override void Initialize()
        {
            DebugShapeRenderer.Initialize(GraphicsDevice);

            CreateCamera();

            tree = OctreeNode.CreateTree(PropagationThreshold, MaxDepth, TreePosition, TreeDimensions);

            base.Initialize();
        }
Beispiel #3
0
        private OctreeNode(OctreeNode parent, Vector3 nodePosition, Vector3 dimensions)
        {
            if (parent != null)
            {
                propagationThreshold = parent.propagationThreshold;
                maximumDepth         = parent.maximumDepth;
                nodeDepth            = parent.nodeDepth + 1;
            }

            position    = nodePosition;
            boundingBox = new BoundingBox(nodePosition, nodePosition + dimensions);

            DebugShapeRenderer.AddBoundingBox(boundingBox, Color.Red, 10000000000);
        }
Beispiel #4
0
        public void Insert(BoundingSphere item)
        {
            DebugShapeRenderer.AddBoundingSphere(item, Color.LimeGreen, 100000000000);

            if (TryInsertInChildNode(item))
            {
                return;
            }

            contents.Add(item);

            if (!isPartitioned && (maximumDepth < 0 || nodeDepth < maximumDepth) && contents.Count >= propagationThreshold)
            {
                PartitionNode();
            }
        }