/// <summary> /// Deserializes the object and populates it from the input. /// </summary> /// <param name="input">Savable input</param> public virtual void Read(ISavableReader input) { _name = input.ReadString(); _localTransform = input.ReadSavable <Transform>(); _sceneHints = input.ReadSavable <SceneHints>(); _sceneHints.HintableSource = this; _localLights = input.ReadSavable <LightCollection>(); _localLights._spatial = this; bool hasControllers = input.ReadBoolean(); _controllers = new TeslaList <ISpatialController>(1); if (hasControllers) { ISavable[] savableControllers = input.ReadSavableArray <ISavable>(); for (int i = 0; i < savableControllers.Length; i++) { ISpatialController controller = savableControllers[i] as ISpatialController; if (controller != null) { _controllers.Add(controller); } } } _worldTransform = new Transform(_localTransform); _frustumIntersect = ContainmentType.Intersects; _parent = null; _dirtyMark = DirtyMark.Bounding | DirtyMark.Transform | DirtyMark.Lighting; }
/// <summary> /// Creates a new spatial with the specified name. /// </summary> /// <param name="name"></param> public Spatial(String name) { _name = name; _parent = null; _localTransform = new Transform(); _worldTransform = new Transform(); _controllers = new TeslaList <ISpatialController>(1); _dirtyMark = DirtyMark.Bounding | DirtyMark.Transform | DirtyMark.Lighting; _sceneHints = new SceneHints(this); _localLights = new LightCollection(this); }