public void RenderedCamera() { var tc = new TestCore(); tc.Init(); var texture = Altseed2.RenderTexture.Create(new Vector2I(100, 100), TextureFormat.R8G8B8A8_UNORM); Assert.NotNull(texture); var camera1 = Altseed2.RenderedCamera.Create(); Assert.NotNull(camera1); camera1.ViewMatrix = Matrix44F.GetTranslation2D(new Vector2F(10, 10)); camera1.TargetTexture = texture; const string path = "Serialization/RenderedCamera.bin"; Serialize(path, camera1); var camera2 = Deserialize <RenderedCamera>(path); Assert.NotNull(camera2); Assert.AreEqual(camera1.RenderPassParameter.ClearColor, camera2.RenderPassParameter.ClearColor); Assert.AreEqual(camera1.RenderPassParameter.IsColorCleared, camera2.RenderPassParameter.IsColorCleared); Assert.AreEqual(camera1.RenderPassParameter.IsDepthCleared, camera2.RenderPassParameter.IsDepthCleared); Assert.AreEqual(camera1.TargetTexture.Size, camera2.TargetTexture.Size); Assert.AreEqual(camera1.ViewMatrix, camera2.ViewMatrix); tc.End(); }
public void NoRenderTexture() { var tc = new TestCore(); tc.Init(); var texture = Texture2D.Load(@"../../Core/TestData/IO/AltseedPink.png"); Assert.NotNull(texture); var node = new SpriteNode(); node.Src = new RectF(new Vector2F(100, 100), new Vector2F(200, 200)); node.Texture = texture; node.Pivot = texture.Size / 2; node.CameraGroup = 1 << 0; Engine.AddNode(node); var camera = new CameraNode(); camera.Transform = Matrix44F.GetTranslation2D(new Vector2F(-200, -200)); camera.Group = 0; Engine.AddNode(camera); tc.LoopBody(c => { node.Angle++; } , null); tc.End(); }