Example #1
0
            /// <summary>
            /// It assumes that this shader is not the default LPP shader, and it will use ONLY the first technique
            /// </summary>
            /// <param name="camera"></param>
            /// <param name="graphicsDevice"></param>
            /// <param name="renderStatistics"></param>
            public void GenericRender(Camera camera, GraphicsDevice graphicsDevice)
            {
                RenderEffect.SetMatrices(GlobalTransform, camera.EyeTransform, camera.ProjectionTransform);

                if (_parent.BoneMatrixes != null)
                {
                    RenderEffect.SetBones(_parent.BoneMatrixes);
                }

                RenderEffect.Apply();

                graphicsDevice.SetVertexBuffer(_meshPart.VertexBuffer, _meshPart.VertexOffset);
                graphicsDevice.Indices = _meshPart.IndexBuffer;

                graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, _meshPart.NumVertices, _meshPart.StartIndex, _meshPart.PrimitiveCount);
            }
Example #2
0
            public virtual void RenderToGBuffer(Camera camera, GraphicsDevice graphicsDevice)
            {
                RenderEffect.SetCurrentTechnique(0);
                RenderEffect.SetMatrices(GlobalTransform, camera.EyeTransform, camera.ProjectionTransform);
                //our first pass is responsible for rendering into GBuffer
                RenderEffect.SetFarClip(camera.FarClip);

                if (_parent.BoneMatrixes != null)
                {
                    RenderEffect.SetBones(_parent.BoneMatrixes);
                }

                RenderEffect.Apply();

                graphicsDevice.SetVertexBuffer(_meshPart.VertexBuffer, _meshPart.VertexOffset);
                graphicsDevice.Indices = _meshPart.IndexBuffer;

                graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, _meshPart.NumVertices, _meshPart.StartIndex, _meshPart.PrimitiveCount);
            }