public bool ShouldAttachToParameterSet(IEffectParameterSet parameterSet)
 {
     return parameterSet["WorldViewProj"] != null || (
         parameterSet["World"] != null &&
         parameterSet["View"] != null &&
         parameterSet["Projection"] != null);
 }
 public IRenderRequest CreateInstancedRequestFromState(
     IRenderContext renderContext,
     IEffect effect,
     IEffectParameterSet effectParameterSet,
     VertexBuffer meshVertexBuffer,
     IndexBuffer meshIndexBuffer,
     PrimitiveType primitiveType,
     Matrix[] instancedWorldTransforms,
     Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers,
     LocalisedBoundingRegion boundingRegion)
 {
     return(CreateInstancedRequest(
                renderContext,
                renderContext.GraphicsDevice.RasterizerState,
                renderContext.GraphicsDevice.BlendState,
                renderContext.GraphicsDevice.DepthStencilState,
                effect,
                effectParameterSet,
                meshVertexBuffer,
                meshIndexBuffer,
                primitiveType,
                instancedWorldTransforms,
                computeCombinedBuffers,
                boundingRegion));
 }
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new ScreenDimensionsEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            return(clone);
        }
 public IRenderRequest CreateSingleRequest(
     IRenderContext renderContext,
     RasterizerState rasterizerState,
     BlendState blendState,
     DepthStencilState depthStencilState,
     IEffect effect,
     IEffectParameterSet effectParameterSet,
     VertexBuffer meshVertexBuffer,
     IndexBuffer meshIndexBuffer,
     PrimitiveType primitiveType,
     Matrix world,
     Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers,
     LocalisedBoundingRegion boundingRegion)
 {
     return(new DefaultRenderRequest(
                renderContext,
                rasterizerState,
                blendState,
                depthStencilState,
                effect,
                renderContext.GetCurrentRenderPass <IRenderPass>().EffectTechniqueName,
                effectParameterSet,
                meshVertexBuffer,
                meshIndexBuffer,
                primitiveType,
                new [] { world },
                computeCombinedBuffers,
                boundingRegion));
 }
Example #5
0
 public IRenderRequest CreateInstancedRequestFromState(IRenderContext renderContext, IEffect effect,
                                                       IEffectParameterSet effectParameterSet, VertexBuffer meshVertexBuffer, IndexBuffer meshIndexBuffer,
                                                       PrimitiveType primitiveType, Matrix[] instancedWorldTransforms, Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers,
                                                       LocalisedBoundingRegion boundingRegion)
 {
     throw new NotImplementedException();
 }
 public IRenderRequest CreateInstancedRequest(
     IRenderContext renderContext,
     RasterizerState rasterizerState,
     BlendState blendState,
     DepthStencilState depthStencilState,
     IEffect effect,
     IEffectParameterSet effectParameterSet,
     VertexBuffer meshVertexBuffer,
     IndexBuffer meshIndexBuffer,
     PrimitiveType primitiveType,
     Matrix[] instanceWorldTransforms,
     Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
 {
     return(new DefaultRenderRequest(
                renderContext,
                rasterizerState,
                blendState,
                depthStencilState,
                effect,
                renderContext.GetCurrentRenderPass <IRenderPass>().EffectTechniqueName,
                effectParameterSet,
                meshVertexBuffer,
                meshIndexBuffer,
                primitiveType,
                instanceWorldTransforms,
                computeCombinedBuffers));
 }
 public void RenderText(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix matrix,
     string text, FontAsset font, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left,
     VerticalAlignment verticalAlignment = VerticalAlignment.Top, Color? textColor = null, bool renderShadow = true,
     Color? shadowColor = null)
 {
     throw new NotSupportedException();
 }
        public void RenderText(
            IRenderContext context,
            IEffect effect,
            IEffectParameterSet effectParameterSet,
            Matrix matrix,
            string text,
            FontAsset font,
            HorizontalAlignment horizontalAlignment,
            VerticalAlignment verticalAlignment,
            Color?textColor,
            bool renderShadow,
            Color?shadowColor)
        {
            if (!context.IsCurrentRenderPass <I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var targets = context.GraphicsDevice.GetRenderTargets();
            var size    = MeasureText(context, text, font);

            var temporary = new RenderTarget2D(
                context.GraphicsDevice,
                (int)size.X,
                (int)size.Y,
                false,
                SurfaceFormat.Color,
                DepthFormat.None,
                0,
                RenderTargetUsage.DiscardContents);

            context.GraphicsDevice.SetRenderTarget(temporary);
            context.GraphicsDevice.Clear(Color.Transparent);

            using (var spriteBatch = new SpriteBatch(context.GraphicsDevice))
            {
                _twoDimensionalRenderUtilities.RenderText(
                    context,
                    new Vector2(0, 0),
                    text,
                    font,
                    HorizontalAlignment.Left,
                    VerticalAlignment.Top,
                    textColor,
                    renderShadow,
                    shadowColor);
                spriteBatch.End();
            }

            var texture = (Texture2D)temporary;

            context.GraphicsDevice.SetRenderTarget(null);

            context.GraphicsDevice.BlendState        = BlendState.Opaque;
            context.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            context.GraphicsDevice.SamplerStates[0]  = SamplerState.LinearWrap;
            context.GraphicsDevice.RasterizerState   = RasterizerState.CullNone;

            RenderTexture(context, effect, effectParameterSet, matrix, texture, Color.White, flipHorizontally: false, flipVertically: false);
        }
        public void RenderRectangle(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, Color color, bool filled = false)
        {
            if (!context.IsCurrentRenderPass <I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = new[]
            {
                new VertexPositionColor(start, color),
                new VertexPositionColor(new Vector3(start.X, end.Y, start.Z), color),
                new VertexPositionColor(new Vector3(end.X, start.Y, end.Z), color), new VertexPositionColor(end, color)
            };
            var indicies = new short[] { 0, 1, 2, 3 };

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.LineStrip,
                    vertexes,
                    0,
                    4,
                    indicies,
                    0,
                    3);
            }
        }
Example #10
0
        /// <summary>
        /// Modifies the specified model to align to this animation at the specified frame and then renders it.
        /// </summary>
        /// <param name="renderContext">
        ///     The current render context.
        /// </param>
        /// <param name="transform">
        ///     The world transformation to apply.
        /// </param>
        /// <param name="effectParameterSet"></param>
        /// <param name="model">
        ///     The model to update.
        /// </param>
        /// <param name="totalSeconds">
        ///     The time elapsed.
        /// </param>
        /// <param name="multiply">
        ///     The multiplication factor to apply to the animation speed.
        /// </param>
        /// <param name="effect"></param>
        public void Render(IRenderContext renderContext, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, IModel model, float totalSeconds, float multiply)
        {
            this.Apply(model, totalSeconds, multiply);

            // Render the model.
            model.Render(renderContext, effect, effectParameterSet, transform);
        }
 public void RenderText(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix matrix,
                        string text, FontAsset font, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment verticalAlignment = VerticalAlignment.Top, Color?textColor = null, bool renderShadow = true,
                        Color?shadowColor = null)
 {
     throw new NotSupportedException();
 }
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new CameraPositionEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            return(clone);
        }
 public bool ShouldAttachToParameterSet(IEffectParameterSet parameterSet)
 {
     return(parameterSet["WorldViewProj"] != null || (
                parameterSet["World"] != null &&
                parameterSet["View"] != null &&
                parameterSet["Projection"] != null));
 }
 public IRenderRequest CreateInstancedRequest(IRenderContext renderContext, RasterizerState rasterizerState,
     BlendState blendState, DepthStencilState depthStencilState, IEffect effect, IEffectParameterSet effectParameterSet,
     VertexBuffer meshVertexBuffer, IndexBuffer meshIndexBuffer, PrimitiveType primitiveType,
     Matrix[] instanceWorldTransforms, Action<List<Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
 {
     throw new NotImplementedException();
 }
 public IEffectSemantic Clone(IEffectParameterSet parameterSet)
 {
     var clone = new TextureEffectSemantic();
     clone.AttachToParameterSet(parameterSet);
     if (_parameterSet != null)
     {
         clone.Texture = this.Texture;
     }
     return clone;
 }
 public IEffectSemantic Clone(IEffectParameterSet parameterSet)
 {
     var clone = new NormalMapEffectSemantic();
     clone.AttachToParameterSet(parameterSet);
     if (_parameterSet != null)
     {
         clone.NormalMap = this.NormalMap;
     }
     return clone;
 }
Example #17
0
        public void AttachToParameterSet(IEffectParameterSet parameterSet)
        {
            if (_parameterSet != null)
            {
                throw new InvalidOperationException("This semantic is already attached.");
            }

            _parameterSet = parameterSet;
            CacheParameters();
        }
        public void AttachToParameterSet(IEffectParameterSet parameterSet)
        {
            if (_parameterSet != null)
            {
                throw new InvalidOperationException("This semantic is already attached.");
            }

            _parameterSet = parameterSet;
            _bonesParam = parameterSet["Bones"];
        }
 public IEffectSemantic Clone(IEffectParameterSet parameterSet)
 {
     var clone = new SpecularEffectSemantic();
     clone.AttachToParameterSet(parameterSet);
     if (_parameterSet != null)
     {
         // TODO
     }
     return clone;
 }
 public IEffectSemantic Clone(IEffectParameterSet parameterSet)
 {
     var clone = new BonesEffectSemantic();
     clone.AttachToParameterSet(parameterSet);
     if (_parameterSet != null)
     {
         clone._bones = this.Bones;
     }
     return clone;
 }
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new NormalMapEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            if (_parameterSet != null)
            {
                clone.NormalMap = this.NormalMap;
            }
            return(clone);
        }
Example #22
0
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new SpecularEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            if (_parameterSet != null)
            {
                // TODO
            }
            return(clone);
        }
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new BonesEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            if (_parameterSet != null)
            {
                clone._bones = this.Bones;
            }
            return(clone);
        }
Example #24
0
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new ColorDiffuseEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            if (_parameterSet != null)
            {
                clone.Diffuse = this.Diffuse;
            }
            return(clone);
        }
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new TextureEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            if (_parameterSet != null)
            {
                clone.Texture = this.Texture;
            }
            return(clone);
        }
        public IEffectSemantic Clone(IEffectParameterSet parameterSet)
        {
            var clone = new WorldViewProjectionEffectSemantic();

            clone.AttachToParameterSet(parameterSet);
            if (_parameterSet != null)
            {
                clone.World      = World;
                clone.View       = View;
                clone.Projection = Projection;
            }
            return(clone);
        }
        public void RenderPlane(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, TextureAsset texture, Vector2 topLeftUV, Vector2 bottomRightUV)
        {
            if (!context.IsCurrentRenderPass <I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = new[]
            {
                new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, -1, 0), new Vector2(topLeftUV.X, topLeftUV.Y)),
                new VertexPositionNormalTexture(new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector2(topLeftUV.X, bottomRightUV.Y)),
                new VertexPositionNormalTexture(new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector2(bottomRightUV.X, topLeftUV.Y)),
                new VertexPositionNormalTexture(new Vector3(1, 0, 1), new Vector3(0, -1, 0), new Vector2(bottomRightUV.X, bottomRightUV.Y))
            };

            var indicies = new short[]
            {
                0, 2, 1,
                3, 1, 2
            };

            var semantic = effectParameterSet.GetSemantic <ITextureEffectSemantic>();

            if (semantic.Texture != texture.Texture)
            {
                semantic.Texture = texture.Texture;
            }

            var world = context.World;

            context.World = transform;

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.TriangleList,
                    vertexes,
                    0,
                    vertexes.Length,
                    indicies,
                    0,
                    indicies.Length / 3);
            }

            context.World = world;
        }
Example #28
0
        public void LoadParameterSet(IRenderContext renderContext, IEffectParameterSet effectParameters, bool skipMatricSync)
        {
            if (!skipMatricSync)
            {
                if (effectParameters.HasSemantic <IWorldViewProjectionEffectSemantic>())
                {
                    var semantic = effectParameters.GetSemantic <IWorldViewProjectionEffectSemantic>();
                    semantic.World      = renderContext.World;
                    semantic.Projection = renderContext.Projection;
                    semantic.View       = renderContext.View;
                }
            }

            ((ProtogameParameterSet)effectParameters).Load(renderContext, _targetEffect);
        }
Example #29
0
        public DefaultRenderRequest(
            IRenderContext renderContext,
            RasterizerState rasterizerState,
            BlendState blendState,
            DepthStencilState depthStencilState,
            IEffect effect,
            string techniqueName,
            IEffectParameterSet effectParameterSet,
            VertexBuffer meshVertexBuffer,
            IndexBuffer meshIndexBuffer,
            PrimitiveType primitiveType,
            Matrix[] instances,
            Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers,
            LocalisedBoundingRegion boundingRegion)
        {
#if DEBUG
            GraphicsMetricsProfilerVisualiser.RenderRequestsCreated++;
#endif

            RasterizerState         = rasterizerState;
            BlendState              = blendState;
            DepthStencilState       = depthStencilState;
            Effect                  = effect;
            TechniqueName           = techniqueName;
            EffectParameterSet      = effectParameterSet;
            MeshVertexBuffer        = meshVertexBuffer;
            MeshIndexBuffer         = meshIndexBuffer;
            PrimitiveType           = primitiveType;
            Instances               = instances;
            BoundingRegion          = boundingRegion;
            _computeCombinedBuffers = computeCombinedBuffers;

            // Now that the parameter set has been used in a request, prevent it
            // from being changed.
            EffectParameterSet.Lock(renderContext);

            StateHash =
                RasterizerState.GetHashCode() ^ 397 +
                BlendState.GetHashCode() ^ 397 +
                DepthStencilState.GetHashCode() ^ 397 +
                Effect.GetHashCode() ^ 397 +
                TechniqueName.GetHashCode() ^ 397 +
                EffectParameterSet.GetStateHash() ^ 397 +
                MeshVertexBuffer.GetHashCode() ^ 397 +
                MeshIndexBuffer.GetHashCode() ^ 397 +
                PrimitiveType.GetHashCode() ^ 397;
        }
Example #30
0
        public DefaultStandardPointLight(
            IAssetManagerProvider assetManagerProvider,
            Vector3 lightPosition,
            Color lightColor,
            float lightRadius,
            float lightIntensity)
        {
            LightPosition  = lightPosition;
            LightColor     = lightColor;
            LightRadius    = lightRadius;
            LightIntensity = lightIntensity;

            _pointLightEffect      = assetManagerProvider.GetAssetManager().Get <EffectAsset>("effect.PointLight");
            _pointLightSphereModel = assetManagerProvider.GetAssetManager().Get <ModelAsset>("model.LightSphere").InstantiateModel();

            _parameterSet = _pointLightEffect.Effect.CreateParameterSet();
        }
        public DefaultStandardPointLight(
            IAssetManagerProvider assetManagerProvider,
            Vector3 lightPosition,
            Color lightColor,
            float lightRadius,
            float lightIntensity)
        {
            LightPosition = lightPosition;
            LightColor = lightColor;
            LightRadius = lightRadius;
            LightIntensity = lightIntensity;

            _pointLightEffect = assetManagerProvider.GetAssetManager().Get<EffectAsset>("effect.PointLight");
            _pointLightSphereModel = assetManagerProvider.GetAssetManager().Get<ModelAsset>("model.LightSphere").InstantiateModel();

            _parameterSet = _pointLightEffect.Effect.CreateParameterSet();
        }
        public DefaultRenderRequest(
            IRenderContext renderContext,
            RasterizerState rasterizerState,
            BlendState blendState,
            DepthStencilState depthStencilState,
            IEffect effect,
            string techniqueName, 
            IEffectParameterSet effectParameterSet,
            VertexBuffer meshVertexBuffer,
            IndexBuffer meshIndexBuffer,
            PrimitiveType primitiveType,
            Matrix[] instances, 
            Action<List<Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
        {
#if DEBUG
            GraphicsMetricsProfilerVisualiser.RenderRequestsCreated++;
#endif

            RasterizerState = rasterizerState;
            BlendState = blendState;
            DepthStencilState = depthStencilState;
            Effect = effect;
            TechniqueName = techniqueName;
            EffectParameterSet = effectParameterSet;
            MeshVertexBuffer = meshVertexBuffer;
            MeshIndexBuffer = meshIndexBuffer;
            PrimitiveType = primitiveType;
            Instances = instances;
            _computeCombinedBuffers = computeCombinedBuffers;

            // Now that the parameter set has been used in a request, prevent it
            // from being changed.
            EffectParameterSet.Lock(renderContext);

            StateHash =
                RasterizerState.GetHashCode() ^ 397 +
                BlendState.GetHashCode() ^ 397 +
                DepthStencilState.GetHashCode() ^ 397 +
                Effect.GetHashCode() ^ 397 +
                TechniqueName.GetHashCode() ^ 397 +
                EffectParameterSet.GetStateHash() ^ 397 +
                MeshVertexBuffer.GetHashCode() ^ 397 +
                MeshIndexBuffer.GetHashCode() ^ 397 +
                PrimitiveType.GetHashCode() ^ 397;
        }
        public void RenderTexture(
            IRenderContext context,
            IEffect effect,
            IEffectParameterSet effectParameterSet,
            Matrix matrix,
            TextureAsset texture,
            Color?color,
            bool flipHorizontally,
            bool flipVertically,
            Rectangle?sourceArea)
        {
            if (!context.IsCurrentRenderPass <I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            RenderTexture(context, effect, effectParameterSet, matrix, texture.Texture, color, flipHorizontally, flipVertically, sourceArea);
        }
        public void RenderLine(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, TextureAsset texture, Vector2 startUV, Vector2 endUV)
        {
            if (!context.IsCurrentRenderPass <I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = _renderCache.GetOrSet(
                "renderlinetex3dvb:" + start + ":" + end + ":" + startUV + ":" + endUV,
                () =>
            {
                var vb = new VertexBuffer(context.GraphicsDevice, VertexPositionTexture.VertexDeclaration, 2,
                                          BufferUsage.WriteOnly);
                vb.SetData(new[] { new VertexPositionTexture(start, startUV), new VertexPositionTexture(end, endUV) });
                return(vb);
            });
            var indicies = _renderCache.GetOrSet(
                "renderline3dib",
                () =>
            {
                var ib = new IndexBuffer(context.GraphicsDevice, IndexElementSize.SixteenBits, 2,
                                         BufferUsage.WriteOnly);
                ib.SetData(new short[] { 0, 1 });
                return(ib);
            });

            context.GraphicsDevice.SetVertexBuffer(vertexes);
            context.GraphicsDevice.Indices = indicies;

            var semantic = effectParameterSet.GetSemantic <ITextureEffectSemantic>();

            if (semantic.Texture != texture.Texture)
            {
                semantic.Texture = texture.Texture;
            }

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawPrimitives(PrimitiveType.LineList, 0, 1);
            }
        }
        public void RenderLine(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, TextureAsset texture, Vector2 startUV, Vector2 endUV)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = _renderCache.GetOrSet(
                "renderlinetex3dvb:" + start + ":" + end + ":" + startUV + ":" + endUV,
                () =>
                {
                    var vb = new VertexBuffer(context.GraphicsDevice, VertexPositionTexture.VertexDeclaration, 2,
                        BufferUsage.WriteOnly);
                    vb.SetData(new[] { new VertexPositionTexture(start, startUV), new VertexPositionTexture(end, endUV) });
                    return vb;
                });
            var indicies = _renderCache.GetOrSet(
                "renderline3dib",
                () =>
                {
                    var ib = new IndexBuffer(context.GraphicsDevice, IndexElementSize.SixteenBits, 2,
                        BufferUsage.WriteOnly);
                    ib.SetData(new short[] { 0, 1 });
                    return ib;
                });

            context.GraphicsDevice.SetVertexBuffer(vertexes);
            context.GraphicsDevice.Indices = indicies;

            var semantic = effectParameterSet.GetSemantic<ITextureEffectSemantic>();
            if (semantic.Texture != texture.Texture)
            {
                semantic.Texture = texture.Texture;
            }

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawPrimitives(PrimitiveType.LineList, 0, 1);
            }
        }
        public void RenderPlane(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, Color color)
        {
            if (!context.IsCurrentRenderPass <I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = new[]
            {
                new VertexPositionColor(new Vector3(0, 0, 0), color),
                new VertexPositionColor(new Vector3(0, 0, 1), color),
                new VertexPositionColor(new Vector3(1, 0, 0), color),
                new VertexPositionColor(new Vector3(1, 0, 1), color)
            };

            var indicies = new short[]
            {
                0, 2, 1,
                3, 1, 2
            };

            var world = context.World;

            context.World = transform;

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.TriangleList,
                    vertexes,
                    0,
                    vertexes.Length,
                    indicies,
                    0,
                    indicies.Length / 3);
            }

            context.World = world;
        }
Example #37
0
 public void Blit(
     IRenderContext renderContext,
     Texture2D source,
     RenderTarget2D destination             = null,
     IEffect shader                         = null,
     IEffectParameterSet effectParameterSet = null,
     BlendState blendState                  = null,
     Vector2?offset                         = null,
     Vector2?size = null)
 {
     BlitInternal(
         renderContext,
         source,
         destination == null ? null : new [] { destination },
         shader,
         effectParameterSet,
         blendState,
         offset,
         size);
 }
Example #38
0
 public void BlitMRT(
     IRenderContext renderContext,
     Texture2D source,
     RenderTarget2D[] destinations,
     IEffect shader,
     IEffectParameterSet effectParameterSet,
     BlendState blendState = null,
     Vector2?offset        = null,
     Vector2?size          = null)
 {
     BlitInternal(
         renderContext,
         source,
         destinations,
         shader,
         effectParameterSet,
         blendState,
         offset,
         size);
 }
 public void BlitMRT(
     IRenderContext renderContext,
     Texture2D source,
     RenderTarget2D[] destinations,
     IEffect shader,
     IEffectParameterSet effectParameterSet,
     BlendState blendState = null,
     Vector2? offset = null,
     Vector2? size = null)
 {
     BlitInternal(
         renderContext,
         source,
         destinations,
         shader,
         effectParameterSet,
         blendState,
         offset,
         size);
 }
 public void Blit(
     IRenderContext renderContext,
     Texture2D source,
     RenderTarget2D destination = null,
     IEffect shader = null,
     IEffectParameterSet effectParameterSet = null,
     BlendState blendState = null,
     Vector2? offset = null,
     Vector2? size = null)
 {
     BlitInternal(
         renderContext,
         source,
         destination == null ? null : new [] { destination },
         shader,
         effectParameterSet,
         blendState,
         offset,
         size);
 }
 public IRenderRequest CreateSingleRequestFromState(
     IRenderContext renderContext,
     IEffect effect,
     IEffectParameterSet effectParameterSet,
     VertexBuffer meshVertexBuffer,
     IndexBuffer meshIndexBuffer,
     PrimitiveType primitiveType,
     Matrix world,
     Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
 {
     return(CreateSingleRequest(
                renderContext,
                renderContext.GraphicsDevice.RasterizerState,
                renderContext.GraphicsDevice.BlendState,
                renderContext.GraphicsDevice.DepthStencilState,
                effect,
                effectParameterSet,
                meshVertexBuffer,
                meshIndexBuffer,
                primitiveType,
                world,
                computeCombinedBuffers));
 }
        public void RenderText(
            IRenderContext context,
            IEffect effect, 
            IEffectParameterSet effectParameterSet,
            Matrix matrix, 
            string text, 
            FontAsset font, 
            HorizontalAlignment horizontalAlignment, 
            VerticalAlignment verticalAlignment,
            Color? textColor, 
            bool renderShadow,
            Color? shadowColor)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var targets = context.GraphicsDevice.GetRenderTargets();
            var size = MeasureText(context, text, font);

            var temporary = new RenderTarget2D(
                context.GraphicsDevice, 
                (int)size.X, 
                (int)size.Y, 
                false, 
                SurfaceFormat.Color, 
                DepthFormat.None, 
                0, 
                RenderTargetUsage.DiscardContents);
            context.GraphicsDevice.SetRenderTarget(temporary);
            context.GraphicsDevice.Clear(Color.Transparent);

            using (var spriteBatch = new SpriteBatch(context.GraphicsDevice))
            {
                _twoDimensionalRenderUtilities.RenderText(
                    context, 
                    new Vector2(0, 0), 
                    text, 
                    font, 
                    HorizontalAlignment.Left, 
                    VerticalAlignment.Top, 
                    textColor, 
                    renderShadow, 
                    shadowColor);
                spriteBatch.End();
            }

            var texture = (Texture2D)temporary;
            context.GraphicsDevice.SetRenderTarget(null);

            context.GraphicsDevice.BlendState = BlendState.Opaque;
            context.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            context.GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
            context.GraphicsDevice.RasterizerState = RasterizerState.CullNone;

            RenderTexture(context, effect, effectParameterSet, matrix, texture, Color.White, flipHorizontally: false, flipVertically: false);
        }
 public bool ShouldAttachToParameterSet(IEffectParameterSet parameterSet)
 {
     return parameterSet["Bones"] != null;
 }
 public void RenderPlane(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform,
     Color color)
 {
     throw new NotSupportedException();
 }
        private IEffectParameterSet GetEffectParameterSet(IMaterial material, ref bool changedRenderRequest, ref string changedRenderRequestBy)
        {
            if (_effectUsedForParameterSetCache == _cachedEffect &&
                changedRenderRequest == false &&
                (!_lastDidSetDiffuseTexture || _lastSetDiffuseTexture == _lastCachedDiffuseTexture?.Texture) &&
                (!_lastDidSetNormalMap || _lastSetNormalMap == _lastCachedNormalMapTexture?.Texture) &&
                (!_lastDidSetSpecularPower || _lastSetSpecularPower == _lastCachedSpecularPower) &&
                (!_lastDidSetSpecularColorMap || _lastSetSpecularColorMap == _lastCachedSpecularColorMapTexture?.Texture) &&
                (!_lastDidSetSpecularColor || _lastSetSpecularColor == _lastCachedSpecularColor) &&
                (!_lastDidSetDiffuseColor || _lastSetDiffuseColor == (material.ColorDiffuse ?? Color.Black)))
            {
                // Reuse the existing parameter set.
                return _cachedEffectParameterSet;
            }

            changedRenderRequest = true;
            changedRenderRequestBy += ":parameterset";

            // Create a new parameter set and cache it.
            _cachedEffectParameterSet = _cachedEffect.CreateParameterSet();
            _effectUsedForParameterSetCache = _cachedEffect;

            _lastSetDiffuseTexture = null;
            _lastSetNormalMap = null;
            _lastSetSpecularPower = null;
            _lastSetSpecularColorMap = null;
            _lastSetSpecularColor = null;
            _lastSetDiffuseColor = null;
            _lastDidSetDiffuseTexture = false;
            _lastDidSetNormalMap = false;
            _lastDidSetSpecularPower = false;
            _lastDidSetSpecularColorMap = false;
            _lastDidSetSpecularColor = false;
            _lastDidSetDiffuseColor = false;

            if (_cachedEffectParameterSet.HasSemantic<ITextureEffectSemantic>())
            {
                if (_lastCachedDiffuseTexture?.Texture != null)
                {
                    _cachedEffectParameterSet.GetSemantic<ITextureEffectSemantic>().Texture =
                        _lastCachedDiffuseTexture.Texture;
                    _lastSetDiffuseTexture = _lastCachedDiffuseTexture.Texture;
                    _lastDidSetDiffuseTexture = true;
                }
            }

            if (_cachedEffectParameterSet.HasSemantic<INormalMapEffectSemantic>())
            {
                if (_lastCachedNormalMapTexture?.Texture != null)
                {
                    _cachedEffectParameterSet.GetSemantic<INormalMapEffectSemantic>().NormalMap =
                        _lastCachedNormalMapTexture.Texture;
                    _lastSetNormalMap = _lastCachedNormalMapTexture.Texture;
                    _lastDidSetNormalMap = true;
                }
            }

            if (_cachedEffectParameterSet.HasSemantic<ISpecularEffectSemantic>())
            {
                if (_lastCachedSpecularPower != null)
                {
                    var semantic = _cachedEffectParameterSet.GetSemantic<ISpecularEffectSemantic>();
                    semantic.SpecularPower = _lastCachedSpecularPower.Value;
                    _lastSetSpecularPower = _lastCachedSpecularPower.Value;
                    _lastDidSetSpecularPower = true;

                    if (_lastCachedSpecularColorMapTexture != null)
                    {
                        semantic.SpecularColorMap = _lastCachedSpecularColorMapTexture.Texture;
                        _lastSetSpecularColorMap = _lastCachedSpecularColorMapTexture.Texture;
                        _lastDidSetSpecularColorMap = true;
                    }
                    else if (_lastCachedSpecularColor != null)
                    {
                        semantic.SpecularColor = _lastCachedSpecularColor.Value;
                        _lastSetSpecularColor = _lastCachedSpecularColor.Value;
                        _lastDidSetSpecularColor = true;
                    }
                }
            }

            if (_cachedEffectParameterSet.HasSemantic<IColorDiffuseEffectSemantic>())
            {
                var v = material.ColorDiffuse ?? Color.Black;
                _cachedEffectParameterSet.GetSemantic<IColorDiffuseEffectSemantic>().Diffuse = v;
                _lastSetDiffuseColor = v;
                _lastDidSetDiffuseColor = true;
            }

            return _cachedEffectParameterSet;
        }
 public void RenderPlane(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform,
     TextureAsset texture, Vector2 topLeftUV, Vector2 bottomRightUV)
 {
     throw new NotSupportedException();
 }
 public void RenderCircle(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix matrix,
     Vector2 center, int radius, Color color, bool filled = false)
 {
     throw new NotSupportedException();
 }
        public void RenderCircle(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, Vector2 center, int radius, Color color, bool filled = false)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var points = 8;

            double angle = MathHelper.TwoPi / points;

            var vertexesList = new List<VertexPositionColor>();
            var indicesList = new List<short>();

            vertexesList.Add(new VertexPositionColor(new Vector3(center, 0), color));

            for (int i = 1; i <= points; i++)
            {
                var pos = new Vector2(
                    (float)Math.Round(Math.Sin(angle * i), 4) * radius,
                    (float)Math.Round(Math.Cos(angle * i), 4) * radius);
                
                vertexesList.Add(new VertexPositionColor(new Vector3(center + pos, 0), color));
            }

            if (filled)
            {
                for (int i = 1; i < points; i++)
                {
                    indicesList.Add(0);
                    indicesList.Add((short)(i + 1));
                    indicesList.Add((short) i);
                }
                indicesList.Add(0);
                indicesList.Add(1);
                indicesList.Add((short) points);
            }
            else
            {
                for (int i = 1; i <= points; i++)
                {
                    indicesList.Add((short) i);
                }
                indicesList.Add(1);
            }

            var vertexes = vertexesList.ToArray();
            var indicies = indicesList.ToArray();

            var world = context.World;

            context.World = transform;

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    filled ? PrimitiveType.TriangleList : PrimitiveType.LineStrip,
                    vertexes,
                    0,
                    vertexes.Length,
                    indicies,
                    0,
                    indicies.Length / 3);
            }

            context.World = world;
        }
        public void RenderPlane(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, TextureAsset texture, Vector2 topLeftUV, Vector2 bottomRightUV)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = new[]
            {
                new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, -1, 0), new Vector2(topLeftUV.X, topLeftUV.Y)),
                new VertexPositionNormalTexture(new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector2(topLeftUV.X, bottomRightUV.Y)),
                new VertexPositionNormalTexture(new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector2(bottomRightUV.X, topLeftUV.Y)),
                new VertexPositionNormalTexture(new Vector3(1, 0, 1), new Vector3(0, -1, 0), new Vector2(bottomRightUV.X, bottomRightUV.Y))
            };

            var indicies = new short[]
            {
                0, 2, 1,
                3, 1, 2
            };

            var semantic = effectParameterSet.GetSemantic<ITextureEffectSemantic>();
            if (semantic.Texture != texture.Texture)
            {
                semantic.Texture = texture.Texture;
            }

            var world = context.World;

            context.World = transform;

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.TriangleList,
                    vertexes,
                    0,
                    vertexes.Length,
                    indicies,
                    0,
                    indicies.Length / 3);
            }

            context.World = world;
        }
        public void RenderPlane(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, Color color)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = new[]
            {
                new VertexPositionColor(new Vector3(0, 0, 0), color),
                new VertexPositionColor(new Vector3(0, 0, 1), color),
                new VertexPositionColor(new Vector3(1, 0, 0), color),
                new VertexPositionColor(new Vector3(1, 0, 1), color)
            };

            var indicies = new short[]
            {
                0, 2, 1,
                3, 1, 2
            };

            var world = context.World;

            context.World = transform;

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.TriangleList,
                    vertexes,
                    0,
                    vertexes.Length,
                    indicies,
                    0,
                    indicies.Length / 3);
            }

            context.World = world;
        }
 public void RenderLine(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Vector3 start,
     Vector3 end, TextureAsset texture, Vector2 startUV, Vector2 endUV)
 {
     throw new NotSupportedException();
 }
Example #52
0
 public IRenderRequest CreateInstancedRequest(IRenderContext renderContext, RasterizerState rasterizerState,
                                              BlendState blendState, DepthStencilState depthStencilState, IEffect effect, IEffectParameterSet effectParameterSet,
                                              VertexBuffer meshVertexBuffer, IndexBuffer meshIndexBuffer, PrimitiveType primitiveType,
                                              Matrix[] instanceWorldTransforms,
                                              Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
 {
     throw new NotSupportedException();
 }
        public void RenderRectangle(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, Color color, bool filled = false)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            var vertexes = new[]
            {
                new VertexPositionColor(start, color), 
                new VertexPositionColor(new Vector3(start.X, end.Y, start.Z), color), 
                new VertexPositionColor(new Vector3(end.X, start.Y, end.Z), color), new VertexPositionColor(end, color)
            };
            var indicies = new short[] { 0, 1, 2, 3 };

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.LineStrip, 
                    vertexes, 
                    0, 
                    4, 
                    indicies, 
                    0, 
                    3);
            }
        }
 public bool ShouldAttachToParameterSet(IEffectParameterSet parameterSet)
 {
     return parameterSet["SpecularPower"] != null;
 }
        public void RenderTexture(
            IRenderContext context,
            IEffect effect, 
            IEffectParameterSet effectParameterSet, 
            Matrix matrix, 
            TextureAsset texture,
            Color? color, 
            bool flipHorizontally, 
            bool flipVertically, 
            Rectangle? sourceArea)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }

            RenderTexture(context, effect, effectParameterSet, matrix, texture.Texture, color, flipHorizontally, flipVertically, sourceArea);
        }
        private void RenderTexture(
            IRenderContext context,
            IEffect effect, 
            IEffectParameterSet effectParameterSet, 
            Matrix matrix, 
            Texture2D texture, 
            Color? color = null, 
            bool flipHorizontally = false, 
            bool flipVertically = false, 
            Rectangle? sourceArea = null)
        {
            if (color != null)
            {
                throw new NotSupportedException();
            }

            if (flipHorizontally)
            {
                throw new NotSupportedException();
            }

            if (flipVertically)
            {
                throw new NotSupportedException();
            }

            if (sourceArea != null)
            {
                throw new NotSupportedException();
            }

            var semantic = effectParameterSet.GetSemantic<ITextureEffectSemantic>();
            if (semantic.Texture != texture)
            {
                semantic.Texture = texture;
            }

            var vertexes = new[]
            {
                new VertexPositionTexture(Vector3.Transform(new Vector3(0, 0, 0), matrix), new Vector2(0, 1)), 
                new VertexPositionTexture(Vector3.Transform(new Vector3(0, 1, 0), matrix), new Vector2(0, 0)), 
                new VertexPositionTexture(Vector3.Transform(new Vector3(1, 0, 0), matrix), new Vector2(1, 1)), 
                new VertexPositionTexture(Vector3.Transform(new Vector3(1, 1, 0), matrix), new Vector2(1, 0))
            };
            var indicies = new short[] { 1, 3, 0, 2 };

            context.GraphicsDevice.BlendState = BlendState.NonPremultiplied;

            effect.LoadParameterSet(context, effectParameterSet);
            foreach (var pass in effect.NativeEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                context.GraphicsDevice.DrawUserIndexedPrimitives(
                    PrimitiveType.TriangleStrip, 
                    vertexes, 
                    0, 
                    vertexes.Length, 
                    indicies, 
                    0, 
                    vertexes.Length - 2);
            }

            context.GraphicsDevice.BlendState = BlendState.Opaque;
        }
Example #57
0
 public bool ShouldAttachToParameterSet(IEffectParameterSet parameterSet)
 {
     return(parameterSet["ColorDiffuse"] != null);
 }
        public void RenderCube(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix transform, Color color)
        {
            if (!context.IsCurrentRenderPass<I3DRenderPass>())
            {
                throw new InvalidOperationException("Can't use 3D rendering utilities in 2D context.");
            }
            
            var vertexes = _renderCache.GetOrSet(
                "rendercube3dvb:" + color,
                () =>
                {
                    var vb = new VertexBuffer(context.GraphicsDevice, VertexPositionNormalColor.VertexDeclaration, 24, BufferUsage.WriteOnly);
                    vb.SetData(new[]
                    {
                        new VertexPositionNormalColor(new Vector3(0, 0, 0), new Vector3(-1, 0, 0), color),
                        new VertexPositionNormalColor(new Vector3(0, 0, 1), new Vector3(-1, 0, 0), color),
                        new VertexPositionNormalColor(new Vector3(0, 1, 0), new Vector3(-1, 0, 0), color),
                        new VertexPositionNormalColor(new Vector3(0, 1, 1), new Vector3(-1, 0, 0), color),

                        new VertexPositionNormalColor(new Vector3(1, 0, 0), new Vector3(1, 0, 0), color),
                        new VertexPositionNormalColor(new Vector3(1, 0, 1), new Vector3(1, 0, 0), color),
                        new VertexPositionNormalColor(new Vector3(1, 1, 0), new Vector3(1, 0, 0), color),
                        new VertexPositionNormalColor(new Vector3(1, 1, 1), new Vector3(1, 0, 0), color),

                        new VertexPositionNormalColor(new Vector3(0, 0, 0), new Vector3(0, -1, 0), color),
                        new VertexPositionNormalColor(new Vector3(0, 0, 1), new Vector3(0, -1, 0), color),
                        new VertexPositionNormalColor(new Vector3(0, 1, 0), new Vector3(0, 1, 0), color),
                        new VertexPositionNormalColor(new Vector3(0, 1, 1), new Vector3(0, 1, 0), color),

                        new VertexPositionNormalColor(new Vector3(1, 0, 0), new Vector3(0, -1, 0), color),
                        new VertexPositionNormalColor(new Vector3(1, 0, 1), new Vector3(0, -1, 0), color),
                        new VertexPositionNormalColor(new Vector3(1, 1, 0), new Vector3(0, 1, 0), color),
                        new VertexPositionNormalColor(new Vector3(1, 1, 1), new Vector3(0, 1, 0), color),

                        new VertexPositionNormalColor(new Vector3(0, 0, 0), new Vector3(0, 0, -1), color),
                        new VertexPositionNormalColor(new Vector3(0, 0, 1), new Vector3(0, 0, 1), color),
                        new VertexPositionNormalColor(new Vector3(0, 1, 0), new Vector3(0, 0, -1), color),
                        new VertexPositionNormalColor(new Vector3(0, 1, 1), new Vector3(0, 0, 1), color),

                        new VertexPositionNormalColor(new Vector3(1, 0, 0), new Vector3(0, 0, -1), color),
                        new VertexPositionNormalColor(new Vector3(1, 0, 1), new Vector3(0, 0, 1), color),
                        new VertexPositionNormalColor(new Vector3(1, 1, 0), new Vector3(0, 0, -1), color),
                        new VertexPositionNormalColor(new Vector3(1, 1, 1), new Vector3(0, 0, 1), color)
                    });
                    return vb;
                });
            var indicies = _renderCache.GetOrSet(
                "rendercube3dib",
                () =>
                {
                    var ib = new IndexBuffer(context.GraphicsDevice, IndexElementSize.SixteenBits, 36, BufferUsage.WriteOnly);
                    ib.SetData(new short[]
                    {
                        0, 2, 1,
                        3, 1, 2,

                        4, 5, 6,
                        7, 6, 5,

                        0 + 8, 1 + 8, 4 + 8,
                        5 + 8, 4 + 8, 1 + 8,

                        2 + 8, 6 + 8, 3 + 8,
                        7 + 8, 3 + 8, 6 + 8,

                        0 + 16, 4 + 16, 2 + 16,
                        6 + 16, 2 + 16, 4 + 16,

                        1 + 16, 3 + 16, 5 + 16,
                        7 + 16, 5 + 16, 3 + 16
                    });
                    return ib;
                });

            _renderBatcher.QueueRequest(
                context,
                _renderBatcher.CreateSingleRequestFromState(
                    context,
                    effect,
                    effectParameterSet,
                    vertexes,
                    indicies,
                    PrimitiveType.TriangleList,
                    transform, 
                    null));
        }
 public void RenderTexture(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Matrix matrix,
     TextureAsset texture, Color? color = null, bool flipHorizontally = false, bool flipVertically = false,
     Rectangle? sourceArea = null)
 {
     throw new NotSupportedException();
 }
 public void RenderRectangle(IRenderContext context, IEffect effect, IEffectParameterSet effectParameterSet, Vector3 start,
     Vector3 end, Color color, bool filled = false)
 {
     throw new NotSupportedException();
 }