Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GpuSamplerStateSerializer.cs
Go to the documentation of this file.
1 using System;
2 using Paradox.Framework.Serialization;
3 using Paradox.Framework.Serialization.Contents;
4 
5 namespace Paradox.Framework.Graphics.Data
6 {
7  public class GpuSamplerStateSerializer : ContentSerializerBase<SamplerState>
8  {
9  public GraphicsDevice graphicsDevice;
10 
11  public GpuSamplerStateSerializer(GraphicsDevice graphicsDevice)
12  {
13  this.graphicsDevice = graphicsDevice;
14  }
15 
16  public override void Serialize(ContentSerializerContext context, ref SamplerState samplerState, ref object intermediateData)
17  {
18  if (context.RootContext.ArchiveMode == ArchiveMode.Deserialize)
19  {
20  var samplerStateDescription = default(SamplerStateDescription);
21  context.SerializationStream.Serialize(ref samplerStateDescription, context.RootContext.ArchiveMode);
22  samplerState = SamplerState.New(graphicsDevice, samplerStateDescription);
23  }
24  else
25  {
26  throw new NotImplementedException();
27  }
28  }
29 
30  public override object Construct(ContentSerializerContext context)
31  {
32  return null;
33  }
34  }
35 }
override void Serialize(ContentSerializerContext context, ref SamplerState samplerState, ref object intermediateData)
ArchiveMode
Enumerates the different mode of serialization (either serialization or deserialization).
Definition: ArchiveMode.cs:8
override object Construct(ContentSerializerContext context)