public void TestGenerateBridge() { #region init initializeTW(); throw new NotImplementedException(); TWRenderWrapper renderer = null;//= new TWRenderWrapper(deferredRenderer, game); const string startSemId = "Start"; const bool hideMeshes = false; int width = 4; int height = 2; int length = 20; var startShapes = new List <IBuildingElement>(); rnd.Reset(); var face = new Face(startSemId, Matrix.RotationX(-(float)Math.PI * 0.5f) * Matrix.RotationY((float)Math.PI), new Vector2(width, length)); startShapes.Add(face); #endregion init var builder = new Builder(renderer); builder.Build(startShapes, BridgeRuleBase(startSemId, hideMeshes, height), rnd.GetCurrentSeed()); var exporter = new EasyExporter(); game.GameLoopEvent += delegate { if (game.Keyboard.IsKeyPressed(Key.F)) { exporter.ExportScene(renderer.GetCurrentMeshes(), "bridge"); } if (game.Keyboard.IsKeyPressed(Key.R)) { startShapes = new List <IBuildingElement>(); rnd.Reset(); width = rnd.GetRandInt(2, 6); height = rnd.GetRandInt(2, 4); length = rnd.GetRandInt(15, 35); face = new Face(startSemId, Matrix.RotationX(-(float)Math.PI * 0.5f) * Matrix.RotationY((float)Math.PI), new Vector2(width, length)); startShapes.Add(face); builder.Purge(); builder.Build(startShapes, BridgeRuleBase(startSemId, hideMeshes, height), rnd.GetCurrentSeed()); } renderer.Update(); update(); }; game.Run(); }
public void TestPhysicsDebugRenderer() { var game = new DX11Game(); game.InitDirectX(); PhysicsEngine engine = new PhysicsEngine(); engine.Initialize(); var debugRenderer = new PhysicsDebugRenderer(game, engine.Scene); debugRenderer.Initialize(); InitTestScene(engine.Scene); game.GameLoopEvent += delegate { engine.Update(game.Elapsed); debugRenderer.Render(); }; game.Run(); engine.Dispose(); }
public void TestCreateTexture2D() { var game = new DX11Game(); game.InitDirectX(); var tex = new Texture2D(game.Device, new Texture2DDescription { ArraySize = 1, MipLevels = 1, Format = Format.B8G8R8A8_UNorm, Usage = ResourceUsage.Dynamic, CpuAccessFlags = CpuAccessFlags.Write, Width = 2, Height = 1, SampleDescription = new SampleDescription(1, 0), BindFlags = BindFlags.ShaderResource }); var box = game.Device.ImmediateContext.MapSubresource(tex, 0, 0, MapMode.WriteDiscard, SlimDX.Direct3D11.MapFlags.None); box.Data.Write(new byte[] { 0, 0, 255, 255 }, 0, 4); game.Device.ImmediateContext.UnmapSubresource(tex, 0); var view = new ShaderResourceView(game.Device, tex); game.GameLoopEvent += delegate { game.TextureRenderer.Draw(view, Vector2.Zero, new Vector2(100, 100)); }; game.Run(); }
public void TestCombineFinalSSAO() { //TODO: add a way to show the specular in the alpha channel var game = new DX11Game(); game.InitDirectX(); var test = new DeferredTest.TestCombineFinalClass(game); var ssao = new HorizonSSAORenderer(game, 800, 600); game.GameLoopEvent += delegate { test.DrawUpdatedDeferredRendering(); ssao.OnFrameRender(test.FilledGBuffer.GBuffer.DepthRV, test.FilledGBuffer.GBuffer.NormalRV); game.Device.ImmediateContext.ClearState(); game.SetBackbuffer(); test.DrawCombined(ssao.MSsaoBuffer.pSRV); //game.TextureRenderer.Draw(ssao.MSsaoBuffer.pSRV, new SlimDX.Vector2(0, 0), // new SlimDX.Vector2(800, 600)); }; game.Run(); }
public void TestPlayAnimation() { var controller = new AnimationControllerSkeleton(null); Skeleton skeleton; TheWizards.Animation.Animation animation; CreateTestAnimation(out skeleton, out animation); controller.SetAnimation(0, animation); var p = new Vector3(4, 5, 4); var m1 = Matrix.RotationAxis(Vector3.Normalize(new Vector3(-1, 4, 3)), 4) * Matrix.Translation(p); var m2 = Matrix.RotationAxis(Vector3.Normalize(new Vector3(3, 2, 8)), 4) * Matrix.Translation(p); var game = new DX11Game(); var visualizer = new SkeletonVisualizer(); game.GameLoopEvent += delegate { controller.ProgressTime(game.Elapsed); controller.UpdateSkeleton(); skeleton.UpdateAbsoluteMatrices(); visualizer.VisualizeSkeleton(game, skeleton); }; game.Run(); }
public void TestDeleteMeshNoMemoryLeak() { var game = new DX11Game(); game.InitDirectX(); var renderer = new DeferredRenderer(game); var mesh = UtilityMeshes.CreateBoxColored(new Color4(1, 0, 0), new Vector3(0.1f)); DeferredMeshElement[] elements = new DeferredMeshElement[100]; int i = 0; game.GameLoopEvent += delegate { elements[i] = renderer.CreateMeshElement(mesh); elements[i].WorldMatrix = Matrix.Translation((float)Math.Cos((float)i / elements.Length * MathHelper.TwoPi) * 5, 0, (float)Math.Sin((float)i / elements.Length * MathHelper.TwoPi) * 5); i = (i + 1) % elements.Length; //if (elements[i] != null) elements[i].Delete(); renderer.Draw(); }; game.Run(); }
public void TestRenderManyMeshes() { var game = new DX11Game(); game.InitDirectX(); var renderer = new DeferredRenderer(game); var mesh = UtilityMeshes.CreateBoxColored(new Color4(1, 0, 0), new Vector3(0.1f)); DeferredMeshElement[] elements = new DeferredMeshElement[100]; for (int i = 0; i < elements.Length; i++) { elements[i] = renderer.CreateMeshElement(mesh); elements[i].WorldMatrix = Matrix.Translation((float)Math.Cos((float)i / elements.Length * MathHelper.TwoPi) * 5, 0, (float)Math.Sin((float)i / elements.Length * MathHelper.TwoPi) * 5); } game.GameLoopEvent += delegate { renderer.Draw(); }; game.Run(); }
public void TestDirectX11Game() { var game = new DX11Game(); game.InitDirectX(); game.Run(); }
public void TestSpotLightRendererShadowing() { var game = new DX11Game(); game.InitDirectX(); var device = game.Device; var context = device.ImmediateContext; var filledGBuffer = new TestFilledGBuffer(game, 800, 600); var light = new SpotLightRenderer(game, filledGBuffer.GBuffer); light.LightRadius *= 2; light.ShadowsEnabled = true; var toggle = false; game.GameLoopEvent += delegate { filledGBuffer.DrawUpdatedGBuffer(); light.UpdateLightCamera(); game.Camera = light.LightCamera; light.UpdateShadowMap(filledGBuffer.Draw); game.Camera = game.SpectaterCamera; game.SetBackbuffer(); if (game.Keyboard.IsKeyPressed(Key.C)) { toggle = !toggle; } if (toggle) { light.SpotDirection = game.SpectaterCamera.CameraDirection; light.LightPosition = game.SpectaterCamera.CameraPosition; } if (game.Keyboard.IsKeyDown(Key.I)) { GBufferTest.DrawGBuffer(game, filledGBuffer.GBuffer); } else { light.Draw(); game.TextureRenderer.Draw(light.ShadowMapRv, new Vector2(10, 10), new Vector2(300, 300)); game.LineManager3D.AddViewFrustum(light.LightCamera.ViewProjection, new Color4(1, 0, 0)); } }; game.Run(); }
public void TestToneMap() { var game = new DX11Game(); game.InitDirectX(); var device = game.Device; var context = device.ImmediateContext; var toneMap = new ToneMapRenderer(game); var hdrImage = Texture2D.FromFile(device, HdrImageDDS); var hdrImageRV = new ShaderResourceView(device, hdrImage); var avgLuminance = 1f; game.GameLoopEvent += delegate { if (game.Keyboard.IsKeyDown(Key.UpArrow)) { avgLuminance += game.Elapsed; } if (game.Keyboard.IsKeyDown(Key.DownArrow)) { avgLuminance -= game.Elapsed; } toneMap.DrawTonemapped(hdrImageRV, avgLuminance); }; game.Run(); }
public void TestRenderText() { var game = new DX11Game(); game.InitDirectX(); var txt = new TextTexture(game, 100, 100); txt.DrawText("The Wizards", new Vector2(0, 0), new Color4(0.3f, 0.3f, 0.3f)); txt.UpdateTexture(); game.GameLoopEvent += delegate { txt.Clear(); txt.DrawText("The Wizards", new Vector2(0, 0), new Color4(0.3f, 0.3f, 0.3f)); txt.UpdateTexture(); game.Device.ImmediateContext.OutputMerger.BlendState = game.HelperStates.AlphaBlend; game.TextureRenderer.Draw(txt.GPUTexture.View, new Vector2(0, 0), new Vector2(100, 100)); }; game.Run(); }
public void TestCullerPlaceInTree() { var game = new DX11Game(); Vector3 radius = new Vector3(100, 1000, 100); FrustumCuller culler = new FrustumCuller(new BoundingBox(-radius, radius), 5); var visualizer = new QuadTreeVisualizer(); List <TestCullObject> cullObjects = new List <TestCullObject>(); TestCullObject obj; obj = new TestCullObject(new Vector3(5, 2, 5), 2); cullObjects.Add(obj); obj = new TestCullObject(new Vector3(-20, 2, -20), 15); cullObjects.Add(obj); obj = new TestCullObject(new Vector3(100, 2, -20), 4); cullObjects.Add(obj); obj = new TestCullObject(new Vector3(-50, 9, 24), 20); cullObjects.Add(obj); for (int i = 0; i < cullObjects.Count; i++) { culler.AddCullable(cullObjects[i]); } game.GameLoopEvent += delegate { for (int i = 0; i < cullObjects.Count; i++) { game.LineManager3D.AddBox(cullObjects[i].BoundingBox, Color.Red.dx()); } visualizer.RenderNodeGroundBoundig(game, culler.RootNode, delegate(FrustumCuller.CullNode node, out Color4 col) { col = Color.Green.dx(); return(node.Cullables.Count == 0); }); visualizer.RenderNodeGroundBoundig(game, culler.RootNode, delegate(FrustumCuller.CullNode node, out Color4 col) { col = Color.Orange.dx(); return(node.Cullables.Count > 0); }); }; game.Run(); }
public void BasicBalTest() { Emitter emit; DX11Game game = new DX11Game(); game.InitDirectX(); var texPool = new TexturePool(game); var testTexture = GetTestTexture(); BallParticleCreater creater = new BallParticleCreater(); //SimpleParticleCreater creater = new SimpleParticleCreater(); EmitterParameters param = new EmitterParameters(); param.texture = testTexture; param.particleCreater = creater; emit = new Emitter(texPool, game, param, 800, 600);//note: again screen size //game.Wpf.CreateClassForm(param); Seeder seed = new Seeder(54); var curve = Curve3D.CreateTestCurve(); emit.Initialize(); emit.InitializeRender(); emit.CreateRenderData(); emit.SetRenderData(); emit.SetPosition(Vector3.Zero); float dist = 0; game.GameLoopEvent += delegate { // emit.setShader(); emit.Update(); if (dist > 100) { dist = 0; } else { dist += game.Elapsed * 1; } //emit.SetPosition(new Vector3(dist, 0, 0)); Temp(dist, emit, curve); //Draw part //game.GraphicsDevice.Clear(Color.Black); game.Device.ImmediateContext.Rasterizer.State = game.HelperStates.RasterizerShowAll; emit.Render(game.SpectaterCamera.ViewProjection, game.SpectaterCamera.ViewInverse); }; game.Run(); }
public void TestBasicShaderIncludeRoot() { BasicShader shader = null; FullScreenQuad quad = null; var game = new DX11Game(); game.InitDirectX(); var fi = new FileInfo("../../Common.Core/Shaders/TestAutoReload.fx"); var include = new FileInfo("../../Common.Core/Shaders/IncludeTest.fx"); using (var fs = new StreamWriter(fi.OpenWrite())) { fs.WriteLine("float4 Color = float4(1,0,0,1);"); } using (var fs = new StreamWriter(include.OpenWrite())) { fs.WriteLine("float4 Color2 = float4(0,0,0,1);"); } shader = BasicShader.LoadAutoreload(game, fi); shader.SetTechnique("TestAutoReload"); quad = new FullScreenQuad(game.Device); var inputLayout = FullScreenQuad.CreateInputLayout(game.Device, shader.GetCurrentPass(0)); var time = 0f; game.GameLoopEvent += delegate { shader.Apply(); quad.Draw(inputLayout); if (time > 2 && time < 3) { using (var fs = new StreamWriter(fi.OpenWrite())) { fs.WriteLine("float4 Color = float4(1,1,0,1);"); time = 5; } } if (time > 6 && time < 7) { using (var fs = new StreamWriter(include.OpenWrite())) { fs.WriteLine("float4 Color2 = float4(-1,0,0,1);"); time = 10; } } time += game.Elapsed; }; game.Run(); }
public void TestImportAMCCreateRelativeMatrices() { AMCParser parser = new AMCParser(); using (var strm = EmbeddedFile.GetStream("MHGameWork.TheWizards.Tests.Features.Simulation.Animation.Files.TestAnimation02.amc")) { parser.ImportAMC(strm); } // Import skeleton var asfParser = new ASFParser(); using (var strm = EmbeddedFile.GetStream("MHGameWork.TheWizards.Tests.Features.Simulation.Animation.Files.TestSkeleton02.asf")) { asfParser.ImportASF(strm); } var skeleton = asfParser.ImportSkeleton(); var game = new DX11Game(); var vis = new SkeletonVisualizer(); for (int i = 0; i < skeleton.Joints.Count; i++) { skeleton.Joints[i].RelativeMatrix = Matrix.Identity; } float time = 0; float speed = 1; game.GameLoopEvent += delegate { game.LineManager3D.DrawGroundShadows = true; time += game.Elapsed; var sampleNum = (int)(time * 120 * speed) % parser.Samples.Count; for (int i = 0; i < parser.Samples[sampleNum].Segments.Count; i++) { var seg = parser.Samples[sampleNum].Segments[i]; var asfJoint = asfParser.Joints.Find(j => j.name == seg.JointName); var joint = skeleton.Joints.Find(j => j.Name == seg.JointName); Matrix relativeMat = parser.CalculateRelativeMatrix(seg, asfJoint); joint.RelativeMatrix = relativeMat; } skeleton.UpdateAbsoluteMatrices(); vis.VisualizeSkeleton(game, skeleton, new Vector3(4, 0, 4)); }; game.Run(); }
public void TestSkeletonVisualizer() { var game = new DX11Game(); var skeleton = new Skeleton(); Joint joint; joint = new Joint(); joint.Name = "Root"; joint.Length = 2; joint.AbsoluteMatrix = Matrix.RotationZ(MathHelper.PiOver2) * // This makes X the forward direction Matrix.Translation(5, 0, 5); skeleton.Joints.Add(joint); var parent = joint; joint = new Joint(); joint.Name = "Arm1"; joint.Length = 2; joint.Parent = parent; joint.AbsoluteMatrix = Matrix.RotationZ(MathHelper.PiOver4) * Matrix.Translation(4, 0, 0) * joint.Parent.AbsoluteMatrix; skeleton.Joints.Add(joint); joint = new Joint(); joint.Name = "Arm2Upper"; joint.Length = 2; joint.Parent = parent; joint.AbsoluteMatrix = Matrix.RotationZ(-MathHelper.PiOver4) * Matrix.Translation(4, 0, 0) * joint.Parent.AbsoluteMatrix; skeleton.Joints.Add(joint); parent = joint; joint = new Joint(); joint.Name = "Arm2Lower"; joint.Length = 2; joint.Parent = parent; joint.AbsoluteMatrix = Matrix.RotationZ(MathHelper.PiOver4) * Matrix.Translation(2, 0, 0) * joint.Parent.AbsoluteMatrix; skeleton.Joints.Add(joint); var vis = new SkeletonVisualizer(); game.GameLoopEvent += delegate { vis.VisualizeSkeleton(game, skeleton); }; game.Run(); }
public void FlameTest() { Emitter emit; DX11Game game = new DX11Game(); game.InitDirectX(); FlameParticleCreater creater; //game.DrawFps = true; //var pool = new VertexDeclarationPool(); //pool.SetVertexElements<Emitter.ParticleVertex>(Emitter.ParticleVertex.VertexElements); var texPool = new TexturePool(game); var testTexture = GetTestTexture(); creater = new FlameParticleCreater(); EmitterParameters param = new EmitterParameters(); param.EffectName = "calculateFlame"; param.texture = testTexture; param.particleCreater = creater; emit = new Emitter(texPool, game, param, 800, 600); Seeder seed = new Seeder(54); var curve = Curve3D.CreateTestCurve(); //texPool.Initialize(game); //pool.Initialize(game); emit.Initialize(); emit.InitializeRender(); emit.CreateRenderData(); emit.SetRenderData(); //emit.AddParticles(creater,1); float dist = 0; game.GameLoopEvent += delegate { dist += game.Elapsed; // emit.setShader(); //Temp(dist, emit, curve); //setColors(emit); emit.Update(); emit.Render(game.SpectaterCamera.ViewProjection, game.SpectaterCamera.ViewInverse); }; game.Run(); }
public void TestHorizonSSAO() { var c = new OBJToRAMMeshConverter(new RAMTextureFactory()); var mesh = DefaultMeshes.CreateMerchantsHouseMesh(c); var game = new DX11Game(); game.InitDirectX(); var context = game.Device.ImmediateContext; var texturePool = new TexturePool(game); var gBuffer = new GBuffer(game.Device, 800, 600); var renderer = new DeferredMeshesRenderer(game, gBuffer, texturePool); var ssao = new HorizonSSAORenderer(game, 800, 600); var el = renderer.AddMesh(mesh); el.WorldMatrix = SlimDX.Matrix.Translation(MathHelper.Right * 0 * 2 + SlimDX.Vector3.UnitZ * 0 * 2); game.GameLoopEvent += delegate { gBuffer.Clear(); gBuffer.SetTargetsToOutputMerger(); renderer.Draw(); ssao.OnFrameRender(gBuffer.DepthRV, gBuffer.NormalRV); context.ClearState(); game.SetBackbuffer(); if (game.Keyboard.IsKeyDown(Key.I)) { GBufferTest.DrawGBuffer(game, gBuffer); } else { game.TextureRenderer.Draw(ssao.MSsaoBuffer.pSRV, new SlimDX.Vector2(0, 0), new SlimDX.Vector2(800, 600)); } }; game.Run(); }
public void TestSkeletonUpdateAbsoluteMatrices() { var game = new DX11Game(); var skeleton = new Skeleton(); Joint joint; joint = new Joint(); joint.Name = "Root"; joint.Length = 4; joint.CalculateInitialRelativeMatrix(Matrix.Translation(5, 0, 5)); skeleton.Joints.Add(joint); var parent = joint; joint = new Joint(); joint.Name = "Arm1"; joint.Length = 2; joint.Parent = parent; joint.CalculateInitialRelativeMatrix(Matrix.RotationZ(MathHelper.PiOver4)); skeleton.Joints.Add(joint); joint = new Joint(); joint.Name = "Arm2Upper"; joint.Length = 2; joint.Parent = parent; joint.CalculateInitialRelativeMatrix(Matrix.RotationZ(-MathHelper.PiOver4)); skeleton.Joints.Add(joint); parent = joint; joint = new Joint(); joint.Name = "Arm2Lower"; joint.Length = 2; joint.Parent = parent; joint.CalculateInitialRelativeMatrix(Matrix.RotationY(MathHelper.PiOver4)); skeleton.Joints.Add(joint); var vis = new SkeletonVisualizer(); skeleton.UpdateAbsoluteMatrices(); game.GameLoopEvent += delegate { vis.VisualizeSkeleton(game, skeleton); }; game.Run(); }
public void TestMeshRendererSimple() { var game = new DX11Game(); game.InitDirectX(); var context = game.Device.ImmediateContext; var mesh = RenderingTestsHelper.CreateSimpleTestMesh(); var texturePool = new TexturePool(game); var gBuffer = new GBuffer(game.Device, 800, 600); var renderer = new DeferredMeshesRenderer(game, gBuffer, texturePool); DeferredMeshElement middle = null; for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { var el = renderer.AddMesh(mesh); el.WorldMatrix = Matrix.Translation(MathHelper.Right * i * 2 + Vector3.UnitZ * j * 2); if (i > 20 && i < 30 && j > 20 && j < 30) { el.Delete(); } } } game.GameLoopEvent += delegate { gBuffer.Clear(); gBuffer.SetTargetsToOutputMerger(); context.Rasterizer.State = game.HelperStates.RasterizerShowAll; renderer.Draw(); context.ClearState(); game.SetBackbuffer(); GBufferTest.DrawGBuffer(game, gBuffer); }; game.Run(); }
public void TestPointLightAccumulation() { //TODO: add a way to show the specular in the alpha channel var game = new DX11Game(); game.InitDirectX(); var device = game.Device; var context = device.ImmediateContext; var filledGBuffer = new TestFilledGBuffer(game, 800, 600); var light = new PointLightRenderer(game, filledGBuffer.GBuffer); var toggle = false; game.GameLoopEvent += delegate { filledGBuffer.DrawUpdatedGBuffer(); game.SetBackbuffer(); if (game.Keyboard.IsKeyPressed(Key.C)) { toggle = !toggle; } if (toggle) { light.LightPosition = game.SpectaterCamera.CameraPosition; } if (game.Keyboard.IsKeyDown(Key.I)) { GBufferTest.DrawGBuffer(game, filledGBuffer.GBuffer); } else { light.Draw(); } }; game.Run(); light.Dispose(); filledGBuffer.Dispose(); }
public void TestGame() { var form = new DX11Game(); form.GameLoopEvent += delegate { onEnterFrame(); if (getTotalTime() > testDuration) { form.Exit(); } }; form.Run(); printResults(); }
public void TestDeferredMeshRendererRenderCity() { var c = new OBJToRAMMeshConverter(new RAMTextureFactory()); var importer = new ObjImporter(); importer.AddMaterialFileStream("Town001.mtl", new FileStream("../../bin/GameData/Core/Town/OBJ03/Town001.mtl", FileMode.Open)); importer.ImportObjFile("../../bin/GameData/Core/Town/OBJ03/Town001.obj"); var mesh = c.CreateMesh(importer); var game = new DX11Game(); game.InitDirectX(); var context = game.Device.ImmediateContext; var texturePool = new MHGameWork.TheWizards.Graphics.SlimDX.Rendering.Deferred.TexturePool(game); var gBuffer = new GBuffer(game.Device, 800, 600); var renderer = new DeferredMeshesRenderer(game, gBuffer, texturePool); var el = renderer.AddMesh(mesh); el.WorldMatrix = global::SlimDX.Matrix.Translation(MathHelper.Right * 0 * 2 + global::SlimDX.Vector3.UnitZ * 0 * 2); game.GameLoopEvent += delegate { gBuffer.Clear(); gBuffer.SetTargetsToOutputMerger(); renderer.Draw(); context.ClearState(); game.SetBackbuffer(); GBufferTest.DrawGBuffer(game, gBuffer); }; global::SlimDX.Configuration.EnableObjectTracking = false; game.Run(); }
public void TestMouseCursor() { var game = new DX11Game(); game.GameLoopEvent += delegate(DX11Game dx11Game) { if (game.Keyboard.IsKeyPressed(Key.F)) { game.Mouse.CursorEnabled = !game.Mouse.CursorEnabled; } if (game.Mouse.CursorEnabled) { game.AddToWindowTitle(game.Mouse.CursorPosition.ToString()); } }; game.Run(); }
public void TestDirectionalLightAccumulation() { //TODO: add a way to show the specular in the alpha channel var game = new DX11Game(); game.InitDirectX(); var device = game.Device; var context = device.ImmediateContext; var filledGBuffer = new TestFilledGBuffer(game, 800, 600); var light = new DirectionalLightRenderer(game, filledGBuffer.GBuffer); game.GameLoopEvent += delegate { filledGBuffer.DrawUpdatedGBuffer(); game.SetBackbuffer(); if (game.Keyboard.IsKeyDown(Key.C)) { game.SpectaterCamera.Enabled = false; var mat = Matrix.RotationY(game.Mouse.RelativeX * game.Elapsed * 5) * Matrix.RotationX(game.Mouse.RelativeY * game.Elapsed * 5); light.LightDirection = Vector3.TransformNormal(light.LightDirection, mat); } else { game.SpectaterCamera.Enabled = true; } if (game.Keyboard.IsKeyDown(Key.I)) { GBufferTest.DrawGBuffer(game, filledGBuffer.GBuffer); } else { light.Draw(); } }; game.Run(); }
public void TestLineManager3DFrustum() { var game = new DX11Game(); game.InitDirectX(); var mat = game.SpectaterCamera.ViewProjection; game.GameLoopEvent += delegate { if (game.Keyboard.IsKeyDown(Key.K)) { mat = game.SpectaterCamera.ViewProjection; } game.LineManager3D.AddViewFrustum(mat, new Color4(1, 0, 0)); }; game.Run(); }
public void TestTextRendering() { var game = new DX11Game(); game.InitDirectX(); var wrapper = new DX11FontWrapper(game.Device); game.GameLoopEvent += delegate { wrapper.Draw("Welcome!", 128, 10, 10, new Color4(1, 0, 0)); wrapper.Draw("Welcome!", 128, 10, 210, new Color4(0, 1, 0)); wrapper.Draw("Welcome!", 128, 10, 410, new Color4(0, 0, 1)); //TODO: game.MarkFrameBuffer(); }; game.Run(); }
public void TestGBuffer() { var game = new DX11Game(); game.InitDirectX(); var buffer = new GBuffer(game.Device, 300, 300); buffer.Clear(); game.GameLoopEvent += delegate { ((Action) delegate { })(); DrawGBuffer(game, buffer); }; game.Run(); }
public void TestImportSkeletonFromASF() { var parser = new ASFParser(); var root = new ASFJoint(); parser.RootJoint = root; var child1 = new ASFJoint(); child1.length = 4; child1.direction = MathHelper.Up; root.children.Add(child1); var child2 = new ASFJoint(); child2.direction = MathHelper.Up; child1.children.Add(child2); var skeleton1 = parser.ImportSkeleton(); skeleton1.UpdateAbsoluteMatrices(); using (var strm = EmbeddedFile.GetStream("MHGameWork.TheWizards.Tests.Features.Simulation.Animation.Files.TestSkeleton01.asf")) { parser.ImportASF(strm); } var skeleton2 = parser.ImportSkeleton(); skeleton2.UpdateAbsoluteMatrices(); var game = new DX11Game(); var vis = new SkeletonVisualizer(); game.GameLoopEvent += delegate { vis.VisualizeSkeleton(game, skeleton1, new Vector3(4, 0, 4)); vis.VisualizeSkeleton(game, skeleton2, new Vector3(11, 0, 11)); }; game.Run(); }
public void TestImportASF() { var parser = new ASFParser(); using (var strm = EmbeddedFile.GetStream("MHGameWork.TheWizards.Tests.Features.Simulation.Animation.Files.TestSkeleton01.asf")) { parser.ImportASF(strm); } var game = new DX11Game(); game.GameLoopEvent += delegate { drawASFJoint(game, parser.RootJoint, new Vector3(4, 0, 4)); }; game.Run(); }