Esempio n. 1
0
        /// <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 state implementation fails or the render
        /// system is not set.</exception>
        public override 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;
            try {
                _impl = renderSystem.CreateRasterizerStateImplementation();
            } catch (Exception e) {
                Dispose();
                throw new TeslaException("Error creating underlying implementation, see inner exception for details.", e);
            }

            _impl.Cull                       = input.ReadEnum <CullMode>();
            _impl.VertexWinding              = input.ReadEnum <VertexWinding>();
            _impl.Fill                       = input.ReadEnum <FillMode>();
            _impl.DepthBias                  = input.ReadInt();
            _impl.SlopeScaledDepthBias       = input.ReadSingle();
            _impl.EnableMultiSampleAntiAlias = input.ReadBoolean();
            _impl.EnableScissorTest          = input.ReadBoolean();
        }
Esempio n. 2
0
 /// <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);
     m_genMipMaps       = input.ReadBoolean();
     m_genMipMaps       = input.ReadBoolean();
     m_resizePowerOfTwo = input.ReadBoolean();
     m_textureFormat    = input.ReadEnum <TextureConversionFormat>();
     m_colorKey         = input.ReadColor();
     m_colorKeyEnabled  = input.ReadBoolean();
     m_preMultiplyAlpha = input.ReadBoolean();
 }
Esempio n. 3
0
 /// <summary>
 /// Deserializes this Light.
 /// </summary>
 /// <param name="input">Input to read from</param>
 public virtual void Read(ISavableReader input)
 {
     _name      = input.ReadString();
     _ambient   = input.ReadColor();
     _diffuse   = input.ReadColor();
     _specular  = input.ReadColor();
     _constant  = input.ReadSingle();
     _linear    = input.ReadSingle();
     _quadratic = input.ReadSingle();
     _attenuate = input.ReadBoolean();
     _enabled   = input.ReadBoolean();
 }
Esempio n. 4
0
        /// <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;
        }
Esempio n. 5
0
 /// <summary>
 /// Deserializes this Mesh.
 /// </summary>
 /// <param name="input">Input to read from</param>
 public override void Read(ISavableReader input)
 {
     base.Read(input);
     _extents     = input.ReadVector3();
     _center      = input.ReadVector3();
     _xAxis       = input.ReadVector3();
     _yAxis       = input.ReadVector3();
     _zAxis       = input.ReadVector3();
     _insideOut   = input.ReadBoolean();
     _constructed = true;
 }
Esempio n. 6
0
 /// <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();
 }
Esempio n. 7
0
 /// <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();
     _isEnabled = input.ReadBoolean();
 }
Esempio n. 8
0
 /// <summary>
 /// Deserializes the object and populates it from the input.
 /// </summary>
 /// <param name="input">Savable input</param>
 public virtual void Read(ISavableReader input)
 {
     _overrideCache = input.ReadBoolean();
 }