/// <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> /// Deserializes the object and populates it from the input. /// </summary> /// <param name="input">Savable input</param> public override void Read(ISavableReader input) { base.Read(input); // _material = input.ReadExternal<Material>(); _meshData = input.ReadSavable <MeshData>(); _modelBound = input.ReadSavable <BoundingVolume>(); _worldLights = new LightCollection(); SetModelBound(_modelBound); }
/// <summary> /// Deserializes the object and populates it from the input. /// </summary> /// <param name="input">Savable input</param> /// <exception cref="Tesla.Core.TeslaException">Thrown if creating the underlying implementation fails or the render /// system is not set.</exception> public void Read(ISavableReader input) { IRenderSystemProvider renderSystem = input.RenderSystem; if (renderSystem == null) { Dispose(); throw new TeslaException("Render system provider not set, cannot create graphics resource implementation."); } base.RenderSystem = renderSystem; String name = input.ReadString(); VertexDeclaration decl = input.ReadSavable <VertexDeclaration>(); int vertexCount = input.ReadInt(); ResourceUsage usage = input.ReadEnum <ResourceUsage>(); byte[] byteBuffer = input.ReadByteArray(); try { _impl = renderSystem.CreateVertexBufferImplementation(decl, vertexCount, usage); _impl.Name = name; SetData <byte>(byteBuffer); } catch (Exception e) { Dispose(); throw new TeslaException("Error creating underlying implementation, see inner exception for details.", e); } }
/// <summary> /// Deserializes the object and populates it from the input. /// </summary> /// <param name="input">Savable input</param> public override void Read(ISavableReader input) { base.Read(input); _normalGen = input.ReadEnum <NormalGeneration>(); _creaseAngle = input.ReadSingle(); _generateTangentBasis = input.ReadBoolean(); _swapWindingOrder = input.ReadBoolean(); _flipUVs = input.ReadBoolean(); _scale = input.ReadSingle(); _xAngle = input.ReadSingle(); _yAngle = input.ReadSingle(); _zAngle = input.ReadSingle(); _userMaterialFile = input.ReadString(); _materialNamesCorrespondToGeometry = input.ReadBoolean(); _preferLitMaterials = input.ReadBoolean(); _importLights = input.ReadBoolean(); _imageParameters = input.ReadSavable <ImageLoaderParameters>(); _texturePath = input.ReadString(); }
/// <summary> /// Deserializes the object and populates it from the input. /// </summary> /// <param name="input">Savable input</param> public void Read(ISavableReader input) { _fileName = input.ReadString(); _loaderParams = input.ReadSavable <LoaderParameters>(); }