Ejemplo n.º 1
0
        public void Draw(BaseEffect effect)
        {
            if (this.Geometry == null)
            {
                return;
            }
            GraphicsDevice graphicsDevice = this.Mesh.GraphicsDevice;

            if (this.AlwaysOnTop.HasValue)
            {
                GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).DepthBufferFunction = this.AlwaysOnTop.Value ? CompareFunction.Always : CompareFunction.LessEqual;
            }
            if (this.Blending.HasValue)
            {
                GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, this.Blending.Value);
            }
            if (this.SamplerState != null)
            {
                for (int index = 0; index < this.Mesh.UsedSamplers; ++index)
                {
                    graphicsDevice.SamplerStates[index] = this.SamplerState;
                }
            }
            if (this.CullMode.HasValue)
            {
                GraphicsDeviceExtensions.SetCullMode(graphicsDevice, this.CullMode.Value);
            }
            if (this.NoAlphaWrite.HasValue)
            {
                GraphicsDeviceExtensions.GetBlendCombiner(graphicsDevice).ColorWriteChannels = ColorWriteChannels.Red | ColorWriteChannels.Green | ColorWriteChannels.Blue;
            }
            effect.Prepare(this);
            GraphicsDeviceExtensions.ApplyCombiners(graphicsDevice);
            this.Geometry.Draw(effect);
        }