public void EnforceMinimumDepth() { if (_nodeDepth < _parentTree.MinimumDepth) { if (this.HasChildren) { _isActive = false; _isSplit = true; ChildTopLeft.EnforceMinimumDepth(); ChildTopRight.EnforceMinimumDepth(); ChildBottomLeft.EnforceMinimumDepth(); ChildBottomRight.EnforceMinimumDepth(); } else { this.Activate(); _isSplit = false; } return; } if (_nodeDepth == _parentTree.MinimumDepth || (_nodeDepth < _parentTree.MinimumDepth && !this.HasChildren)) { this.Activate(); _isSplit = false; } }
public void Update(GameTime gameTime) { View = camera.World; Projection = camera.Projection; CameraPosition = camera.Position; //Only update if the camera position has changed if (_cameraPosition == _lastCameraPosition) { return; } //Effect.View = View; //Effect.Projection = Projection; _lastCameraPosition = _cameraPosition; IndexCount = 0; _rootNode.EnforceMinimumDepth(); _activeNode = _rootNode.DeepestNodeWithPoint(CameraPosition); if (_activeNode != null) { _activeNode.Split(); } _rootNode.SetActiveVertices(); _buffers.UpdateIndexBuffer(Indices, IndexCount); _buffers.SwapBuffer(); }