public override void OnInitialize(Microsoft.DirectX.Direct3D.Device d) { ShowMouseCursor = true; d.RenderState.Lighting = true; d.RenderState.FillMode = FillMode.Solid; d.RenderState.ZBufferEnable = true; d.RenderState.ShadeMode = ShadeMode.Phong; d.RenderState.SpecularEnable = true; d.RenderState.AntiAliasedLineEnable = true; d.RenderState.MultiSampleAntiAlias = true; d.RenderState.Ambient = Color.White; d.Lights[0].Diffuse = Color.White; d.Lights[0].Type = LightType.Directional; d.Lights[0].Falloff = 132f; d.Lights[0].InnerConeAngle = 10; d.Lights[0].OuterConeAngle = 20; d.Lights[0].Specular = Color.White; d.Lights[0].Position = new Vector3(0, 0, -100); d.Lights[0].Direction = new Vector3(0, 0, 1); d.Lights[0].Update(); d.Lights[0].Enabled = true; _Projection_ = Matrix.PerspectiveFovLH(.8f, (float)d.Viewport.Width / (float)d.Viewport.Height, 1.0f, 100.0f); _View_ = Matrix.LookAtLH(new Vector3(0, 0, -4f), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); selected_material.Diffuse = Color.Yellow; selected_material.Specular = Color.White; selected_material.SpecularSharpness = 32f; teapot_material.Diffuse = Color.DodgerBlue; teapot_material.Specular = Color.White; teapot_material.SpecularSharpness = 32f; font = new Microsoft.DirectX.Direct3D.Font(d, new System.Drawing.Font("Arial", 12)); teapot = Mesh.Teapot(d); _Line_ = new Microsoft.DirectX.Direct3D.Line(d); RenderLayers.Add(new RenderableLayer(this.Layer1)); RenderLayers.Add(new RenderableLayer(this.Layer2)); /* Remember to set the appropriate State, or risk being stuck in INIT * forever. To begin rendering set the scene state to RENDER. * */ State = SceneState.RENDER; }
public override void Initialise() { base.Initialise(); //Setup the render as a forward renderer Renderer = new RendererForward(); //Load a scene Scene = new DummyScene(); // Load the shaders from disk Shader = new Shader(GraphicsDevice, "ShaderTest0"); var cubeShader = new Shader(GraphicsDevice, "Cube"); // Define the model's vertices and indices VertexPositionColor[] quadVertices = { new VertexPositionColor(new Vector2(-.75f, .75f), Color.Red), new VertexPositionColor(new Vector2(.75f, .75f), Color.Green), new VertexPositionColor(new Vector2(-.75f, -.75f), Color.Blue), new VertexPositionColor(new Vector2(.75f, -.75f), Color.Yellow) }; ushort[] quadIndices = { 0, 1, 2, 3 }; //Create a vertex buffer vertexBuffer = new VertexBuffer <VertexPositionColor>( GraphicsDevice, new VertexPositionColor(), quadVertices.Length, VertexPositionColor.SizeInBytes); //Set the data of the vertex buffer to the vertices vertexBuffer.SetData(0, quadVertices); //Create an index buffer indexBuffer = new IndexBuffer( GraphicsDevice, quadIndices.Length, IndexFormat.UInt16); //Set the data of the index buffer to the indices indexBuffer.SetData(0, quadIndices); // Register the ImGUI Layer RenderLayers.Add(new ImGUILayer(GraphicsDevice)); // Init RenderDoc // RenderDoc.LaunchReplayUI(); }
public override void OnInitialize(Microsoft.DirectX.Direct3D.Device d) { RenderLayers.Add(new RenderableLayer(this.Layer1)); State = SceneState.RENDER; }