Ejemplo n.º 1
0
        protected override void RecordCommandsInternal(ref MyRenderableProxy_2 proxy, int instanceIndex, int sectionIndex)
        {
            RC.SetSRVs(ref proxy.ObjectSRVs);
            RC.BindVertexData(ref proxy.VertexData);

            Stats.Meshes++;

            if (instanceIndex == -1)
            {
                RC.BindShaders(proxy.HighlightShaders.MultiInstance);
                for (int it = 0; it < proxy.Submeshes.Length; it++)
                {
                    MyDrawSubmesh_2 submesh = proxy.Submeshes[it];
                    DrawSubmesh(ref proxy, ref submesh, sectionIndex);
                }
            }
            else
            {
                RC.BindShaders(proxy.HighlightShaders.SingleInstance);
                MyDrawSubmesh_2 submesh;
                if (sectionIndex == -1)
                {
                    submesh = proxy.Submeshes[instanceIndex];
                }
                else
                {
                    submesh = proxy.SectionSubmeshes[instanceIndex][sectionIndex];
                }

                DrawSubmesh(ref proxy, ref submesh, instanceIndex);
            }
        }
Ejemplo n.º 2
0
        protected override void RecordCommandsInternal(ref MyRenderableProxy_2 proxy, int instanceIndex, int sectionIndex)
        {
            RC.SetSRVs(ref proxy.ObjectSRVs);
            RC.BindVertexData(ref proxy.VertexData);

            Debug.Assert(proxy.ForwardShaders.MultiInstance.VS != null);

            RC.BindShaders(proxy.ForwardShaders.MultiInstance);

            SetProxyConstants(ref proxy);

            for (int i = 0; i < proxy.Submeshes.Length; i++)
            {
                var submesh  = proxy.Submeshes[i];
                var material = MyMaterials1.ProxyPool.Data[submesh.MaterialId.Index];
                RC.MoveConstants(ref material.MaterialConstants);
                RC.SetConstants(ref material.MaterialConstants, MyCommon.MATERIAL_SLOT);
                RC.SetSRVs(ref material.MaterialSRVs);

                if (proxy.InstanceCount == 0)
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        RC.DeviceContext.DrawIndexed(submesh.Count, submesh.Start, submesh.BaseVertex);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.DeviceContext.Draw(submesh.Count, submesh.Start);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        //MyRender11.AddDebugQueueMessage("ForwardPass DrawIndexedInstanced " + proxy.VertexData.VB[0].DebugName);
                        RC.DeviceContext.DrawIndexedInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, submesh.BaseVertex, proxy.StartInstance);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.DeviceContext.DrawInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, proxy.StartInstance);
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        internal override void RecordCommands(ref MyRenderableProxy_2 proxy)
        {
            RC.SetSRVs(ref proxy.ObjectSRVs);
            RC.BindVertexData(ref proxy.VertexData);

            Debug.Assert(proxy.Shaders.VS != null);

            RC.BindShaders(proxy.Shaders);

            for (int i = 0; i < proxy.Submeshes.Length; i++)
            {
                var submesh  = proxy.Submeshes[i];
                var material = MyMaterials1.ProxyPool.Data[submesh.MaterialId.Index];
                RC.MoveConstants(ref material.MaterialConstants);
                RC.SetConstants(ref material.MaterialConstants, MyCommon.MATERIAL_SLOT);
                RC.SetSRVs(ref material.MaterialSRVs);

                if (proxy.InstanceCount == 0)
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        RC.Context.DrawIndexed(submesh.Count, submesh.Start, submesh.BaseVertex);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.Context.Draw(submesh.Count, submesh.Start);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        RC.Context.DrawIndexedInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, submesh.BaseVertex, proxy.StartInstance);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.Context.DrawInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, proxy.StartInstance);
                        break;

                    default:
                        break;
                    }
                }
            }

            base.RecordCommands(ref proxy);
        }
Ejemplo n.º 4
0
        internal override void RecordCommands(ref MyRenderableProxy_2 proxy)
        {
            RC.SetSRVs(ref proxy.ObjectSRVs);
            RC.BindVertexData(ref proxy.VertexData);

            Debug.Assert(proxy.DepthShaders.VS != null);

            RC.SetRS(DefaultRasterizer);

            RC.BindShaders(proxy.DepthShaders);

            for (int i = 0; i < proxy.SubmeshesDepthOnly.Length; i++)
            {
                var submesh = proxy.SubmeshesDepthOnly[i];
                //RC.SetSRVs(ref proxy.Submeshes[i].MaterialProxy.MaterialSRVs);

                if (proxy.InstanceCount == 0)
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        RC.Context.DrawIndexed(submesh.Count, submesh.Start, submesh.BaseVertex);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.Context.Draw(submesh.Count, submesh.Start);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        RC.Context.DrawIndexedInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, submesh.BaseVertex, proxy.StartInstance);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.Context.DrawInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, proxy.StartInstance);
                        break;

                    default:
                        break;
                    }
                }
            }

            base.RecordCommands(ref proxy);
        }
Ejemplo n.º 5
0
        protected override void RecordCommandsInternal(ref MyRenderableProxy_2 proxy, int instanceIndex, int sectionIndex)
        {
            RC.SetSRVs(ref proxy.ObjectSRVs);
            RC.BindVertexData(ref proxy.VertexData);

            Debug.Assert(proxy.DepthShaders.MultiInstance.VS != null);

            RC.SetRS(DefaultRasterizer);

            RC.BindShaders(proxy.DepthShaders.MultiInstance);

            SetProxyConstants(ref proxy);

            for (int i = 0; i < proxy.SubmeshesDepthOnly.Length; i++)
            {
                var submesh = proxy.SubmeshesDepthOnly[i];

                if (proxy.InstanceCount == 0)
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        RC.DeviceContext.DrawIndexed(submesh.Count, submesh.Start, submesh.BaseVertex);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.DeviceContext.Draw(submesh.Count, submesh.Start);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    switch (submesh.DrawCommand)
                    {
                    case MyDrawCommandEnum.DrawIndexed:
                        //MyRender11.AddDebugQueueMessage("DepthPass DrawIndexedInstanced " + proxy.VertexData.VB[0].DebugName);
                        RC.DeviceContext.DrawIndexedInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, submesh.BaseVertex, proxy.StartInstance);
                        break;

                    case MyDrawCommandEnum.Draw:
                        RC.DeviceContext.DrawInstanced(submesh.Count, proxy.InstanceCount, submesh.Start, proxy.StartInstance);
                        break;

                    default:
                        break;
                    }
                }
            }
        }