public void Render(RenderParamsListArray paramsListArray) { foreach(Emitter it in m_Emitters) { var device = Engine.Global.Device3d.GetDevice(); // try to get the matched input-layout var layout = Engine.Global.Device3d.GetInputLayout("ParticleFX", Particle.ParticleVSIn.GetVertexDesc()); device.ImmediateContext.InputAssembler.InputLayout = layout; device.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.PointList; device.ImmediateContext.InputAssembler.SetVertexBuffers(0, it.m_VBBinding); // setup effect float scale = 5.0f; Matrix objToWorld = Matrix.Transformation(new Vector3(scale), Quaternion.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero, Quaternion.Identity, new Vector3(0.0f, 0.0f, 5.0f)); var paramslist = new RenderParamsList(); paramslist.Set("WorldXf", objToWorld); paramsListArray.Push(paramslist); var fx = Engine.Global.Device3d.GetEffect("ParticleFX"); fx.Apply(paramsListArray); // draw device.ImmediateContext.Draw(it.GetNumAliveParticles(), 0); Engine.Global.Device3d.SetDefaultstate(); paramsListArray.Pop(); } }
public override void Render(RenderParamsListArray paramsListArray ) { { var device = Engine.Global.Device3d.GetDevice(); // try to get the matched input-layout var layout = Engine.Global.Device3d.GetInputLayout("Tess_Generic", m_VertDesc.Decl); device.ImmediateContext.InputAssembler.InputLayout = layout; device.ImmediateContext.InputAssembler.PrimitiveTopology = m_MeshDesc.Topology; device.ImmediateContext.InputAssembler.SetIndexBuffer(Engine.Global.Device3d.GetBuffer("QuadIB"), Format.R32_UInt, 0); device.ImmediateContext.InputAssembler.SetVertexBuffers(0, m_MeshDesc.VBBinding); // setup effect float scale = 5.0f; Matrix objToWorld = Matrix.Transformation(new Vector3(scale), Quaternion.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero, Quaternion.Identity, new Vector3(0.0f, 0.0f, 20.0f)); var paramslist = new RenderParamsList(); paramslist.Set("WorldXf", objToWorld); paramslist.Set("g_TessFactor", m_TessParam); paramsListArray.Push(paramslist); var fx = Engine.Global.Device3d.GetEffect("Tess_Generic"); fx.Apply(paramsListArray); // draw device.ImmediateContext.DrawIndexed(m_MeshDesc.IndexCount, 0, 0); Engine.Global.Device3d.SetDefaultstate(); paramsListArray.Pop(); } }
public void Render() { // set the scene variable var paramslist = new RenderParamsList(); paramslist.Set("ViewXf", m_currCamera.WorldToCam()); paramslist.Set("ViewIXf", m_currCamera.CamToWorld()); paramslist.Set("ProjectionXf", m_currCamera.CamToProj()); m_GlobalParams.Push(paramslist); // set RenderTarget and ViewPort if (m_currPostprocessChain.Enable) { Global.Device3d.SetRenderTarget("MainGameRT"); } else { Global.Device3d.SetRenderTarget("BackBuffer"); Global.Device3d.SetDepthStencilTarget("BackBuffer"); } Global.Device3d.BeginFrame(); // clear the current back buffer Global.Device3d.ClearColor(Color.Turquoise); Global.Device3d.ClearDepthStencil(1.0f, 0); m_TerrainRenderer.Render(m_GlobalParams); m_BasicRenderer.Render(m_GlobalParams); m_ParticleRenderer.Render(m_GlobalParams); // draw the world foreach (World.Entity ent in m_currWorld.EntityList) { // draw code } Global.Device3d.EndFrame(); m_GlobalParams.Pop(); }
public override void Render(RenderParamsListArray paramsListArray) { var device = Engine.Global.Device3d.GetDevice(); // try to get the matched input-layout var layout = Engine.Global.Device3d.GetInputLayout("FxRendercraft_Terrain", m_VertDesc.Decl); device.ImmediateContext.InputAssembler.InputLayout = layout; device.ImmediateContext.InputAssembler.PrimitiveTopology = m_MeshDesc.Topology; //device.ImmediateContext.InputAssembler.SetIndexBuffer(Engine.Global.Device3d.GetBuffer("QuadIB"), Format.R32_UInt, 0); device.ImmediateContext.InputAssembler.SetVertexBuffers(0, m_MeshDesc.VBBinding); var paramslist = new RenderParamsList(); paramslist.Set("WorldXf", Matrix.Identity); paramsListArray.Push(paramslist); var fx = Engine.Global.Device3d.GetEffect("FxRendercraft_Terrain"); fx.Apply(paramsListArray); // draw device.ImmediateContext.Draw(m_MeshDesc.VertexCount, 0); Engine.Global.Device3d.SetDefaultstate(); paramsListArray.Pop(); }