//-------------------------------------------------------------- #region Creation & Cleanup //-------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="Scene"/> class. /// </summary> public Scene() { Children = new SceneNodeCollection(); if ((GlobalSettings.ValidationLevelInternal & GlobalSettings.ValidationLevelUserHighExpensive) != 0) { SceneChanged += OnSceneChangedValidation; } // Create a default collision filter. var filter = new SceneNodeCollisionFilter(this); filter.Set(1, 1, false); // Ignore camera vs. camera. filter.Set(2, 3, false); // Ignore light vs. lens flare. filter.Set(3, 3, false); // Ignore lens flare vs. lens flare. filter.Set(3, 4, false); // Ignore lens flare vs. mesh. filter.Set(4, 4, false); // Ignore mesh vs. mesh. _filter = filter; _collisionObjectFilter = new SceneCollisionObjectFilter(filter); var collisionDetection = new CollisionDetection { CollisionFilter = null, }; // DualPartition is better for frustum culling. _collisionDomain = new CollisionDomain(collisionDetection) { BroadPhase = new DualPartition <CollisionObject> { Filter = _collisionObjectFilter }, }; }
protected virtual void CloneCore(SceneNode source) { _flags = source._flags; Name = source.Name; ScaleLocal = source.ScaleLocal; PoseLocal = source.PoseLocal; LastScaleWorld = source.LastScaleWorld; LastPoseWorld = source.LastPoseWorld; Shape = source.Shape; // Shallow copy. MaxDistance = source.MaxDistance; SortTag = source.SortTag; UserData = source.UserData; // Do not clone: RenderData, SceneData if (source.Children != null) { if (Children == null) { Children = new SceneNodeCollection(); } else { Children.Clear(); } foreach (var child in source.Children) { Children.Add(child.Clone()); } } }