• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.RasterizerState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.RasterizerState的典型用法代码示例。如果您正苦于以下问题:C# RasterizerState类的具体用法?C# RasterizerState怎么用?C# RasterizerState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RasterizerState类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了RasterizerState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Draw

        public override void Draw(GameTime gameTime)
        {
            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            rs.FillMode = FillMode.WireFrame;
            this.device.RasterizerState = rs;

            Viewport viewport = this.device.Viewport;
            this.defaultEfft.World = Matrix.CreateTranslation(new Vector3(-this.witdth/2, -this.heigh/2, -100.0f));
            this.defaultEfft.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                              viewport.AspectRatio,
                                                                              5.0f,
                                                                              200.0f);

            foreach (EffectPass pass in this.defaultEfft.CurrentTechnique.Passes)
            {
                pass.Apply();
                foreach (VertexPositionColor[] row in this.pointMatrics)
                {
                    this.device.DrawUserPrimitives(PrimitiveType.TriangleStrip,
                                                row, 0, row.Length - 2,
                                                VertexPositionColor.VertexDeclaration);
                }

            }
            base.Draw(gameTime);
        }
开发者ID:kobe1home,项目名称:Project_Origin,代码行数:27,代码来源:Map.cs.LOCAL.8028.cs


示例2: DrawAll

        public override void DrawAll(GameTime gameTime)
        {
            device.Clear(Color.DarkSlateBlue);

            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            rs.FillMode = FillMode.Solid;
            device.RasterizerState = rs;

            effect.TextureEnabled = true;

            effect.World = Matrix.Identity;

            effect.View = viewMatrix;
            effect.Projection = projectionMatrix;

            effect.LightingEnabled = true;
            effect.EnableDefaultLighting();

            device.SetVertexBuffer(vertexBuffer);

            UpdateCamera();

            DrawBall();
            DrawStaticWorld();
            DrawSky();

            drawBonuses();
            DrawBallData();

            base.Draw(gameTime);
        }
开发者ID:pavluntiy,项目名称:superProject,代码行数:32,代码来源:Gaming.cs


示例3: HighlightModule

 static HighlightModule()
 {
     var color = Color.Black;
     CubeVerticies = new[]
     {
         new VertexPositionColor(new XVector3(0, 0, 1), color),
         new VertexPositionColor(new XVector3(1, 0, 1), color),
         new VertexPositionColor(new XVector3(1, 1, 1), color),
         new VertexPositionColor(new XVector3(0, 1, 1), color),
         new VertexPositionColor(new XVector3(0, 0, 0), color),
         new VertexPositionColor(new XVector3(1, 0, 0), color),
         new VertexPositionColor(new XVector3(1, 1, 0), color),
         new VertexPositionColor(new XVector3(0, 1, 0), color)
     };
     CubeIndicies = new short[]
     {
         0, 1,   1, 2,   2, 3,   3, 0,
         0, 4,   4, 7,   7, 6,   6, 2,
         1, 5,   5, 4,   3, 7,   6, 5
     };
     DestructionBlendState = new BlendState
     {
         ColorSourceBlend = Blend.DestinationColor,
         ColorDestinationBlend = Blend.SourceColor,
         AlphaSourceBlend = Blend.DestinationAlpha,
         AlphaDestinationBlend = Blend.SourceAlpha
     };
     RasterizerState = new RasterizerState
     {
         DepthBias = -3,
         SlopeScaleDepthBias = -3
     };
 }
开发者ID:Zoxive,项目名称:TrueCraft,代码行数:33,代码来源:HighlightModule.cs


示例4: Draw

        protected override void Draw(GameTime gameTime)
        {
            RasterizerState rasterizerState1 = new RasterizerState();
            rasterizerState1.CullMode = CullMode.None;
            rasterizerState1.FillMode = FillMode.WireFrame; // for å se kun streker av trekanten
            //rasterizerState1.FillMode = FillMode.Solid; // for å fylle med hel farge
            device.RasterizerState = rasterizerState1;

            device.Clear(Color.Black);

            // Setter world
            world = Matrix.Identity;
            // Setter world-matrisa på effect-objektet (verteks-shaderen)
            effect.World = world;

            // Starter tegning - må bruke effect-objektet
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                // Angir primitivtype, aktuelle vertekser, en offsetverdi og antall
                // primitiver (her 1 siden verteksene beskriver en trekant)
                device.DrawUserPrimitives(PrimitiveType.TriangleStrip, sider, 0, 8, VertexPositionColor.VertexDeclaration);
                device.DrawUserPrimitives(PrimitiveType.TriangleStrip, topp, 0, 2, VertexPositionColor.VertexDeclaration);
                device.DrawUserPrimitives(PrimitiveType.TriangleStrip, bunn, 0, 2, VertexPositionColor.VertexDeclaration);

            }

            base.Draw(gameTime);
        }
开发者ID:unk1nd,项目名称:Innlevering1_dataGFX,代码行数:29,代码来源:Del2.cs


示例5: DefaultLightContext

 public DefaultLightContext(
     Texture2D deferredColorMap, 
     Texture2D deferredNormalMap,
     Texture2D deferredDepthMap, 
     Texture2D deferredSpecularMap,
     RenderTarget2D diffuseLightRenderTarget,
     RenderTarget2D specularLightRenderTarget,
     BlendState lightBlendState,
     RasterizerState rasterizerStateCullNone,
     RasterizerState rasterizerStateCullClockwiseFace, 
     RasterizerState rasterizerStateCullCounterClockwiseFace, 
     Vector2 halfPixel)
 {
     DeferredColorMap = deferredColorMap;
     DeferredNormalMap = deferredNormalMap;
     DeferredDepthMap = deferredDepthMap;
     DeferredSpecularMap = deferredSpecularMap;
     DiffuseLightRenderTarget = diffuseLightRenderTarget;
     SpecularLightRenderTarget = specularLightRenderTarget;
     LightBlendState = lightBlendState;
     RasterizerStateCullNone = rasterizerStateCullNone;
     RasterizerStateCullClockwiseFace = rasterizerStateCullClockwiseFace;
     RasterizerStateCullCounterClockwiseFace = rasterizerStateCullCounterClockwiseFace;
     HalfPixel = halfPixel;
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:25,代码来源:DefaultLightContext.cs


示例6: Draw

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (karoGame.KaroGameManager == null ||
                !(karoGame.KaroGameManager.CurrentState is ComputerState))
            {
                // Not loading, stop execution.
                return;
            }

            RasterizerState rs = new RasterizerState();
            rs.DepthBias = -10f;
            RasterizerState rsold = Game.GraphicsDevice.RasterizerState;
            Game.GraphicsDevice.RasterizerState = rs;
            foreach (ModelMesh mesh in _beachBall.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.View = _view;
                    effect.Projection = _projection;
                    effect.World = Matrix.CreateRotationZ(1.5f) *
                        Matrix.CreateRotationX(_rotation) *
                        Matrix.CreateTranslation(_position) *
                        Matrix.CreateTranslation(_offset);
                }
                mesh.Draw();
            }
            Game.GraphicsDevice.RasterizerState = rsold;
        }
开发者ID:Bakkes,项目名称:Karo,代码行数:30,代码来源:BeachBallComponent.cs


示例7: Draw

        public override void Draw(GameTime gameTime)
        {
            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            device.RasterizerState = rs;

            viewMatrix = Game1.Instance.Camera.getView();
            projectionMatrix = Game1.Instance.Camera.getProjection();

            Matrix worldMatrix = Matrix.Identity;
            effect.CurrentTechnique = effect.Techniques["Colored"];
            effect.Parameters["xView"].SetValue(viewMatrix);
            effect.Parameters["xProjection"].SetValue(projectionMatrix);
            effect.Parameters["xWorld"].SetValue(worldMatrix);
            Vector3 lightDirection = new Vector3(1.0f, -1.0f, -1.0f);
            lightDirection.Normalize();
            effect.Parameters["xLightDirection"].SetValue(lightDirection);
            effect.Parameters["xAmbient"].SetValue(0.1f);
            effect.Parameters["xEnableLighting"].SetValue(true);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                device.Indices = myIndexBuffer;
                device.SetVertexBuffer(myVertexBuffer);
                device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, indices.Length / 3);
            }

            base.Draw(gameTime);
        }
开发者ID:DarrenLyne,项目名称:Game-Engine-Assignment1,代码行数:31,代码来源:MarsTerrain.cs


示例8: drawBigbuffer

        public void drawBigbuffer(DrawabeElement element, int[] index, Camera came, GraphicsDevice graphicsDevice, bool trans)
        {
            WIREFRAME_RASTERIZER_STATE = new RasterizerState() { CullMode = CullMode.CullClockwiseFace, FillMode = FillMode.Solid };

            graphicsDevice.RasterizerState = WIREFRAME_RASTERIZER_STATE;

            // draw in wireframe

            if (trans)
            {
                graphicsDevice.BlendState = BlendState.AlphaBlend;

            }
            else
            {
                graphicsDevice.BlendState = BlendState.Opaque;
            }

            graphicsDevice.DepthStencilState = DepthStencilState.Default;

            //   effect.DiffuseColor = Color.Red.ToVector3();
            element.effect.View = came.getview();
            element.effect.CurrentTechnique.Passes[0].Apply();
            // vb.GetData<VertexPositionNormalTexture>(vertexData);

            graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, element.vpc, 0, element.vpc.Count() / 3);
            // graphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertexData, 0, vertexData.Count(), index, 0, index.Count() / 3);
        }
开发者ID:Jupotter,项目名称:Nameless-Tales,代码行数:28,代码来源:DrawThings.cs


示例9: Draw

        public override void Draw()
        {
            MilkShake.Graphics.SamplerStates[0] = new SamplerState()
            {
                AddressU = TextureAddressMode.Wrap,
                AddressV = TextureAddressMode.Clamp,
                AddressW = TextureAddressMode.Wrap
            };

            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            rs.FillMode = (KeyboardInput.isKeyDown(Keys.LeftShift)) ? FillMode.WireFrame : FillMode.Solid;
            rs.MultiSampleAntiAlias = true;
            MilkShake.Graphics.RasterizerState = rs;

            _effect.TextureEnabled = true;
            _effect.Texture = _texture.Texture;
            _effect.LightingEnabled = false;
            _effect.VertexColorEnabled = false;

            foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                foreach (VertexPositionTexture[] currentQuad in _renderVerticies.Values)
                {
                    MilkShake.GraphicsManager.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, currentQuad, 0, 2, VertexPositionTexture.VertexDeclaration);
                }
            }

            base.Draw();
        }
开发者ID:lucas-jones,项目名称:MilkShake-old,代码行数:32,代码来源:TextureGiftWrapRenderer.cs


示例10: Initialize

        /// <summary>
        /// Inicializa os componentes da camara
        /// </summary>
        /// <param name="graphics">Instância de GraphicsDevice</param>
        public static void Initialize(GraphicsDevice graphics)
        {
            //Posição inicial da camâra
            position = new Vector3(0, 3, 15);
            //Inicializar as matrizes world, view e projection
            World = Matrix.Identity;
            UpdateViewMatrix();
            Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45),
                graphics.Viewport.AspectRatio,
                nearPlane,
                farPlane);

            //Criar e definir o resterizerState a utilizar para desenhar a geometria
            RasterizerState rasterizerState = new RasterizerState();
            //Desenha todas as faces, independentemente da orientação
            rasterizerState.CullMode = CullMode.None;
            //rasterizerState.FillMode = FillMode.WireFrame;
            rasterizerState.MultiSampleAntiAlias = true;
            graphics.RasterizerState = rasterizerState;

            //Coloca o rato no centro do ecrã
            Mouse.SetPosition(graphics.Viewport.Width / 2, graphics.Viewport.Height / 2);

            originalMouseState = Mouse.GetState();
        }
开发者ID:pedroabgmarques,项目名称:IP3D,代码行数:29,代码来源:Camera.cs


示例11: Draw

        protected override void Draw(GameTime gameTime)
        {
            float time = (float)gameTime.TotalGameTime.TotalMilliseconds / 100.0f;
            RasterizerState rs = new RasterizerState();
            if (_geometryAndSettings.WireFramesOnly)
            {
                rs.FillMode = FillMode.WireFrame;
            }
            rs.CullMode = CullMode.None; // CullCounterClockwiseFace;

            _geometryAndSettings.device.RasterizerState = rs;

            DrawRefractionMap();
            DrawReflectionMap();

            Color bgColor = new Color(0.94140625f, 0.7421875f, 0.21484375f);

            _geometryAndSettings.device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, bgColor, 1.0f, 0);

            DrawSkyDome(_geometryAndSettings.viewMatrix);

            DrawTerrain(_geometryAndSettings.viewMatrix);

            DrawWater(time / 10);

            base.Draw(gameTime);
        }
开发者ID:mikerandrup,项目名称:XNA_WaterFlow3D,代码行数:27,代码来源:WaterFlowSim.cs


示例12: Draw

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            mDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);

            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            mDevice.RasterizerState = rs;

            effect.Parameters["xView"].SetValue(viewMatrix);
            effect.Parameters["xProjection"].SetValue(projectionMatrix);
            effect.Parameters["xWorld"].SetValue(Matrix.Identity);
            effect.Parameters["xTexture"].SetValue(mTerrain.getTexture());

            effect.CurrentTechnique = effect.Techniques["Textured"];
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                mTerrain.draw(mDevice);
            }

            effect.CurrentTechnique = effect.Techniques["Colored"];
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                mXWing.draw(viewMatrix, projectionMatrix);
                mTable.draw(viewMatrix, projectionMatrix);
                mSkydome.draw(viewMatrix, projectionMatrix);
            }

            base.Draw(gameTime);
        }
开发者ID:mattgmg1990,项目名称:Computer-Graphics-Final-Project,代码行数:37,代码来源:FinalProject.cs


示例13: LoadContent

        protected override void LoadContent()
        {
            map = new TiledMap(Content, "Content/HacksoiContent/test.tmx", "HacksoiContent/");

            graphics.PreferredBackBufferWidth = map.Map.Width * map.Map.TileWidth;
            graphics.PreferredBackBufferHeight = map.Map.Height * map.Map.TileHeight;
            graphics.ApplyChanges();
            centerWindow();
            
            cameraPosition = Vector2.Zero;
            screenCenter = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2f, graphics.GraphicsDevice.Viewport.Height / 2f);
            batch = new SpriteBatch(graphics.GraphicsDevice);

            basicEffect = new BasicEffect(graphics.GraphicsDevice);
            basicEffect.Projection = Matrix.CreateOrthographic(graphics.GraphicsDevice.Viewport.Width, -graphics.GraphicsDevice.Viewport.Height, 0.1f, 1000f);
            basicEffect.View = Matrix.Identity;
            basicEffect.World = Matrix.Identity;
            basicEffect.TextureEnabled = true;

            rasterizerState = new RasterizerState();
            rasterizerState.CullMode = CullMode.None;

            font = Content.Load<SpriteFont>("Font");

            LoadWorld();
        }
开发者ID:AnotherProgrammingGroup,项目名称:Project-CS,代码行数:26,代码来源:HacksoiGame.cs


示例14: GdxSpriteBatch

        public GdxSpriteBatch(GraphicsDevice graphicsDevice)
        {
            if (graphicsDevice == null)
                throw new ArgumentNullException("graphicsDevice");

            _device = graphicsDevice;

            _spriteEffect = new LocalSpriteEffect(graphicsDevice);
            _matrixTransform = _spriteEffect.Parameters["MatrixTransform"];
            _spritePass = _spriteEffect.CurrentTechnique.Passes[0];

            _transformMatrix = Matrix.Identity;
            //_projectionMatrix = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0, 0, 1);
            _projectionMatrix = XnaExt.Matrix.CreateOrthographic2D(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, -1, 0);

            Color = Color.White;

            CalculateIndexBuffer();

            _rasterizerScissorState = new RasterizerState() {
                CullMode = CullMode.None,
                ScissorTestEnable = true,
            };

            // projection uses CreateOrthographicOffCenter to create 2d projection
            // matrix with 0,0 in the upper left.
            /*_basicEffect.Projection = Matrix.CreateOrthographicOffCenter
                (0, graphicsDevice.Viewport.Width,
                graphicsDevice.Viewport.Height, 0,
                0, 1);
            this._basicEffect.World = Matrix.Identity;
            this._basicEffect.View = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward,
                Vector3.Up);*/
        }
开发者ID:jaquadro,项目名称:MonoGdx,代码行数:34,代码来源:GdxSpriteBatch.cs


示例15: Game1

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            collisionSystem = new CollisionSystemPersistentSAP();
            collisionSystem.CollisionDetected += new CollisionDetectedHandler(CollisionDetected);

            world = new World(collisionSystem);

            Random rr = new Random();
            rndColors = new Color[20];
            for (int i = 0; i < 20; i++)
            {
                rndColors[i] = new Color((float)rr.NextDouble(), (float)rr.NextDouble(), (float)rr.NextDouble());
            }

            wireframe = new RasterizerState();
            wireframe.FillMode = FillMode.WireFrame;

            cullMode = new RasterizerState();
            cullMode.CullMode = CullMode.None;

            normal = new RasterizerState();
        }
开发者ID:scy7he,项目名称:Pong,代码行数:25,代码来源:Game1.cs


示例16: UIStaticInfo

 protected UIStaticInfo()
 {
     scissorDisabledState = new RasterizerState();
     scissorEnabledState = new RasterizerState();
     scissorEnabledState.ScissorTestEnable = true;
     spriteBatch = new SpriteBatch(UIManager.Instance.mainDevice);
 }
开发者ID:KatekovAnton,项目名称:MAX,代码行数:7,代码来源:UIStaticInfo.cs


示例17: Terrain

        /// <summary>
        /// Public constructor.
        /// </summary>
        /// <param name="terrainSize">The size of the terrain.</param>
        /// <param name="blockSize">The size of a single block. The terrain size should be dividable by it.</param>
        /// <param name="maxDepth">The maximum division depth for the quad trees.</param>
        /// <param name="name">The name of the entity.</param>
        public Terrain(Vector2 terrainSize, float blockSize, int maxDepth, string name = "Terrain")
            : base(name)
        {
            if (_terrainSize.X % blockSize > 0.0f)
            {
                throw new Exception("The width of the terrain size is not dividable by the block size.");
            }
            if (_terrainSize.Y % blockSize > 0.0f)
            {
                throw new Exception("The height of the terrain size is not dividable by the block size.");
            }

            _terrainSize = terrainSize;
            _blockSize = blockSize;
            _maxDepth = maxDepth;

            DebugEnabled = false;
            _rasterizerState = new RasterizerState
            {
                CullMode = CullMode.CullCounterClockwiseFace,
                FillMode = FillMode.Solid
            };
            _debugRasterizerState = new RasterizerState
            {
                CullMode = CullMode.CullCounterClockwiseFace,
                FillMode = FillMode.WireFrame
            };
        }
开发者ID:jwvdiermen,项目名称:LD28,代码行数:35,代码来源:Terrain.cs


示例18: Start

        /// <summary>
        /// Starts the specified batch.
        /// </summary>
        /// <param name="batch">The batch.</param>
        /// <param name="useCamera">if set to <c>true</c> camera matrix will be applied.</param>
        /// <param name="sortMode">The sort mode.</param>
        /// <param name="blendState">State of the blend.</param>
        /// <param name="samplerState">State of the sampler.</param>
        /// <param name="depthStencilState">State of the depth stencil.</param>
        /// <param name="rasterizerState">State of the rasterizer.</param>
        /// <param name="effect">The effect.</param>
        /// <param name="transform">The transformation matrix.</param>
        public static void Start(this SpriteBatch batch,
            bool useCamera = false,
            SpriteSortMode sortMode = SpriteSortMode.Deferred,
            BlendState blendState = null,
            SamplerState samplerState = null,
            DepthStencilState depthStencilState = null,
            RasterizerState rasterizerState = null,
            Effect effect = null,
            Matrix? transform = null)
        {
            Matrix matrix = AlmiranteEngine.IsWinForms ? Matrix.Identity : AlmiranteEngine.Settings.Resolution.Matrix;

            if (useCamera)
            {
                matrix = AlmiranteEngine.Camera.Matrix * matrix;
            }

            if (transform.HasValue)
            {
                matrix = transform.Value * matrix;
            }

            BatchExtensions._sortMode = sortMode;
            BatchExtensions._blendState = blendState;
            BatchExtensions._samplerState = samplerState;
            BatchExtensions._depthStencilState = depthStencilState;
            BatchExtensions._rasterizerState = rasterizerState;
            BatchExtensions._effect = effect;
            BatchExtensions._matrix = matrix;

            batch.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, matrix);
        }
开发者ID:WoLfulus,项目名称:Almirante,代码行数:44,代码来源:BatchStart.cs


示例19: Draw

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            device.Clear(Color.Black);
            RasterizerState rasterizerState1 = new RasterizerState();
            rasterizerState1.CullMode = CullMode.None;
            rasterizerState1.FillMode = FillMode.WireFrame;
            device.RasterizerState = rasterizerState1;

            //Setter world=I:
            world = Matrix.Identity;
            // Setter world-matrisa på effect-objektet (verteks-shaderen):
            effect.World = world;

            //Starter tegning - må bruke effect-objektet:
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                // Angir primitivtype, aktuelle vertekser, en offsetverdi og antall
                // primitiver (her 1 siden verteksene beskriver en trekant):
                //Trekant fra Trekant1
                device.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
                //2 enkle linjer
                device.DrawUserPrimitives(PrimitiveType.LineList, linelist, 0, 1);
                device.DrawUserPrimitives(PrimitiveType.LineList, linelist2, 0, 1);
                //3 sammenhengende linjer
                device.DrawUserPrimitives(PrimitiveType.LineStrip, linestrip, 0, 3);
                //Trekant
                device.DrawUserPrimitives(PrimitiveType.TriangleStrip, trianglestrip, 0, 3);
            }

            base.Draw(gameTime);
        }
开发者ID:basso,项目名称:Datamaskingrafikk-2011-Lab-1,代码行数:36,代码来源:Primitiver.cs


示例20: InvalidOperationException

        /// <summary>
        /// Begins a new sprite and text batch with the specified render state.
        /// </summary>
        /// <param name="sortMode">The drawing order for sprite and text drawing. <see cref="SpriteSortMode.Deferred"/> by default.</param>
        /// <param name="blendState">State of the blending. Uses <see cref="BlendState.AlphaBlend"/> if null.</param>
        /// <param name="samplerState">State of the sampler. Uses <see cref="SamplerState.LinearClamp"/> if null.</param>
        /// <param name="depthStencilState">State of the depth-stencil buffer. Uses <see cref="DepthStencilState.None"/> if null.</param>
        /// <param name="rasterizerState">State of the rasterization. Uses <see cref="RasterizerState.CullCounterClockwise"/> if null.</param>
        /// <param name="effect">A custom <see cref="Effect"/> to override the default sprite effect. Uses default sprite effect if null.</param>
        /// <param name="transformMatrix">An optional matrix used to transform the sprite geometry. Uses <see cref="Matrix.Identity"/> if null.</param>
        /// <exception cref="InvalidOperationException">Thrown if <see cref="Begin"/> is called next time without previous <see cref="End"/>.</exception>
        /// <remarks>This method uses optional parameters.</remarks>
        /// <remarks>The <see cref="Begin"/> Begin should be called before drawing commands, and you cannot call it again before subsequent <see cref="End"/>.</remarks>
        public void Begin
        (
             SpriteSortMode sortMode = SpriteSortMode.Deferred,
             BlendState blendState = null,
             SamplerState samplerState = null,
             DepthStencilState depthStencilState = null,
             RasterizerState rasterizerState = null,
             Effect effect = null,
             Matrix? transformMatrix = null
        )
        {
            if (_beginCalled)
                throw new InvalidOperationException("Begin cannot be called again until End has been successfully called.");

            // defaults
            _sortMode = sortMode;
            _blendState = blendState ?? BlendState.AlphaBlend;
            _samplerState = samplerState ?? SamplerState.LinearClamp;
            _depthStencilState = depthStencilState ?? DepthStencilState.None;
            _rasterizerState = rasterizerState ?? RasterizerState.CullCounterClockwise;
            _effect = effect;
            _matrix = transformMatrix ?? Matrix.Identity;

            // Setup things now so a user can change them.
            if (sortMode == SpriteSortMode.Immediate)
            {
                Setup();
            }

            _beginCalled = true;
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:44,代码来源:SpriteBatch.cs



注:本文中的Microsoft.Xna.Framework.Graphics.RasterizerState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.RenderTarget2D类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.PresentationParameters类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap