public void Serialization() { var tr = new TestRenderable(); var tr2 = RenderableFactory.Deserialize(RenderableFactory.Serialize(tr).ToString()); Assert.IsInstanceOfType(tr2, typeof(TestRenderable), "Deserialized result should be an instance of TestRenderable"); }
public static XElement Serialize(SceneGraph SceneGraph) { var tr = new XElement("SceneGraph", new XElement("Translation", Util.SerializeVector(SceneGraph.Translation)), new XElement("Rotation", Util.SerializeQuaternion(SceneGraph.Rotation)), new XElement("Scaling", Util.SerializeVector(SceneGraph.Scale)), new XElement("Renderable", RenderableFactory.Serialize(SceneGraph.Renderable)) ); foreach (var Child in SceneGraph.Children) { tr.Add(new XElement("Child", new XElement("Name", Child.Key), Serialize(Child.Value) )); } return(tr); }