当前位置: 首页>>代码示例>>C#>>正文


C# EffectPass.Apply方法代码示例

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


在下文中一共展示了EffectPass.Apply方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawDebugWorld

        public void DrawDebugWorld(DynamicsWorld world)
        {
            world.DebugDrawWorld();

            if (lines.Count == 0)
                return;

            if (effect == null)
            {
                effect = new BasicEffect(graphics.Device);
                effect.World = Microsoft.Xna.Framework.Matrix.Identity;
                effect.VertexColorEnabled = true;
            }

            effect.Projection = graphics.GetEffect().Projection;
            effect.View = graphics.GetEffect().View;

            pass = effect.CurrentTechnique.Passes[0];
            pass.Apply();

            int pointCount = lines.Count;
            int linesCount = pointCount / 2;
            VertexPositionColor[] linesArray = new VertexPositionColor[pointCount];
            for (int i = 0; i < pointCount; i++)
            {
                int color = lines[i].Color;
                linesArray[i].Color = new Color(color & 0xff, (color & 0xff00) >> 8, (color & 0xff0000) >> 16, 1);
                linesArray[i].Position = MathHelper.Convert(lines[i].Position);
            }
            graphics.Device.DrawUserPrimitives(PrimitiveType.LineList, linesArray, 0, linesCount);
            lines.Clear();
        }
开发者ID:rhynodegreat,项目名称:BulletSharp,代码行数:32,代码来源:PhysicsDebugDraw.cs

示例2: Render

        public override void Render(GraphicsDevice myDevice, EffectPass pass)
        {
            pass.Apply();

            myDevice.Textures[0] = Texture;
            myDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, Vertices, 0, 4, Indexes, 0, 2);
        }
开发者ID:mikeschuld,项目名称:HMEngineXNA,代码行数:7,代码来源:HMQuad.cs

示例3: Draw

        internal void Draw(Texture2D[] textures, GraphicsDevice device, BasicEffect effect, EffectPass pass)
        {
            effect.World = displayObject.WorldTransform;
            effect.Texture = textures[displayObject.TextureIndex];
            device.SetVertexBuffer(vertexBuffer);
            device.Indices = indexBuffer;
            pass.Apply();

            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, indices.Length / 3);
        }
开发者ID:Jamedjo,项目名称:BeatShiftLib,代码行数:10,代码来源:BruteDisplayObjectEntry.cs

示例4: Draw

        /// <summary>
        /// Draws the models managed by the batch.
        /// </summary>
        public void Draw(Effect effect, EffectParameter worldTransformsParameter, EffectParameter textureIndicesParameter, EffectPass pass)
        {
            if (vertices.Length > 0)
            {
                graphicsDevice.SetVertexBuffers(bindings);
                graphicsDevice.Indices = indexBuffer;
                worldTransformsParameter.SetValue(worldTransforms);
                textureIndicesParameter.SetValue(textureIndices);
                pass.Apply();

                graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
                                                     0, 0, vertices.Length,
                                                     0, indices.Length / 3);
            }
        }
开发者ID:Anomalous-Software,项目名称:BEPUPhysics,代码行数:18,代码来源:ModelDisplayObjectBatch.cs

示例5: DrawTexture

        private void DrawTexture(EffectPass pass)
        {
            basicEffect.VertexColorEnabled = false;
            basicEffect.TextureEnabled = true;
            basicEffect.Texture = animals;
            pass.Apply();

            overlayVertexBuffer.SetData(OverlayVertices);
            device.SetVertexBuffer(overlayVertexBuffer);

            device.DrawIndexedPrimitives(PrimitiveType.TriangleStrip, 0, 0, indexBuffer.IndexCount, 0, indexBuffer.IndexCount - 2);
        }
开发者ID:noxo,项目名称:SecondRealityponyWinRT,代码行数:12,代码来源:Fluttershy.cs

示例6: DrawTerrain

        private void DrawTerrain(EffectPass pass)
        {
            basicEffect.VertexColorEnabled = true;
            basicEffect.TextureEnabled = false;
            pass.Apply();

            device.SetVertexBuffer(terrainVertexBuffer);
            device.Indices = indexBuffer;

            device.DrawIndexedPrimitives(PrimitiveType.TriangleStrip, 0, 0, indexBuffer.IndexCount, 0, indexBuffer.IndexCount - 2);
        }
开发者ID:noxo,项目名称:SecondRealityponyWinRT,代码行数:11,代码来源:Fluttershy.cs

示例7: RenderTest

        private void RenderTest(EffectPass pass, float beat)
        {
            var gemTextureOuter = Get1x1Texture(Color.Black);

            basicEffect.View = Matrix.CreateLookAt(new Vector3(0, 0, 5), Vector3.Zero, Vector3.Up);
            var gem = rings[0].gems[0];
            basicEffect.TextureEnabled = true;
            basicEffect.Texture = gemTextureOuter;
            //basicEffect.World = Matrix.CreateRotationY(beat);
            pass.Apply();

            device.SetVertexBuffer(gem.Model.VertexBufferOuter);
            device.DrawPrimitives(PrimitiveType.TriangleList, 0, gem.Model.VertexBufferOuter.VertexCount / 3);

            basicEffect.TextureEnabled = true;
            basicEffect.Texture = gem.Model.Texture;
            //basicEffect.World = Matrix.CreateRotationY(beat);
            pass.Apply();

            device.SetVertexBuffer(gem.Model.VertexBufferInner);
            device.DrawPrimitives(PrimitiveType.TriangleList, 0, gem.Model.VertexBufferInner.VertexCount / 3);
        }
开发者ID:noxo,项目名称:SecondRealityponyWinRT,代码行数:22,代码来源:Rarity.cs

示例8: RenderRings

        private void RenderRings(EffectPass pass, float beat)
        {
            int farRing = (int)((beat - STARTBEAT) * RINGSPERBEAT);
            if (farRing < 0)
                return;
            if (farRing >= rings.Length)
                farRing = rings.Length - 1;

            var cameraPos = new Vector3(
                GetRingCenter(beat - BEATSOFVISIBILITY * 3 / 4),
                GetFarRingDepth(beat) + BEATSOFVISIBILITY * RINGSPERBEAT * DEPTHPERRING
            );

            basicEffect.View = Matrix.CreateLookAt(cameraPos, Vector3.Add(cameraPos, -Vector3.UnitZ), Vector3.Up);

            var gemTextureOuter = Get1x1Texture(Color.Black);

            for (int i = farRing; i >= 0; i--)
            {
                foreach (Gem gem in rings[i].gems)
                {
                    basicEffect.World = gem.Scale;
                    basicEffect.World *= gem.Rotation;
                    basicEffect.World *= Matrix.CreateTranslation(new Vector3(rings[i].center, 0));
                    basicEffect.World *= Matrix.CreateTranslation(gem.Position);
                    basicEffect.TextureEnabled = true;
                    basicEffect.Texture = gemTextureOuter;
                    pass.Apply();

                    device.SetVertexBuffer(gem.Model.VertexBufferOuter);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, gem.Model.VertexBufferOuter.VertexCount / 3);

                    basicEffect.Texture = gem.Model.Texture;
                    pass.Apply();

                    device.SetVertexBuffer(gem.Model.VertexBufferInner);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, gem.Model.VertexBufferInner.VertexCount / 3);
                }

                //Stop drawing gems behind camera
                if (rings[i].gems[0].Position.Z > cameraPos.Z)
                    break;
            }
        }
开发者ID:noxo,项目名称:SecondRealityponyWinRT,代码行数:44,代码来源:Rarity.cs

示例9: DrawFaceBackgrounds

        private void DrawFaceBackgrounds(EffectPass pass)
        {
            device.SetVertexBuffer(faceVertexBuffer);
            for (int i = 0; i < cubeTextures.Length; i++)
            {
                basicEffect.Texture = cubeTextures[i];
                basicEffect.World = faceWorldMatrices[i] * GetCubeWorldMatrix(Beat);
                pass.Apply();

                device.DrawPrimitives(PrimitiveType.TriangleList, 0, faceVertexBuffer.VertexCount - 2);
            }
        }
开发者ID:noxo,项目名称:SecondRealityponyWinRT,代码行数:12,代码来源:Cube.cs

示例10: DrawCutieMarks

        private void DrawCutieMarks(EffectPass pass)
        {
            basicEffect.Texture = spriteSheet;

            //Start animation at beat 10 ramping up to full speed six beats later
            var skewBeat = Beat < 10 ? 0 : GetSkewBeat(Beat - 10, 6);

            for (int i = 0; i < cubeTextures.Length; i++)
            {
                basicEffect.World = faceWorldMatrices[i] * GetCubeWorldMatrix(Beat);
                pass.Apply();

                //List of VertexPositionNormalTextures to be drawn as a triangle list
                var vertices = GetPonyVertices(i, skewBeat);

                device.DrawUserPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, vertices.ToArray(), 0, vertices.Count / 3);
            }
        }
开发者ID:noxo,项目名称:SecondRealityponyWinRT,代码行数:18,代码来源:Cube.cs

示例11: OnNextPass

        protected internal virtual bool OnNextPass(EffectTechnique technique, RenderContext context, ref int index, out EffectPass pass)
        {
            Debug.Assert(index >= 0, "Invalid index.");

              int numberOfPasses = technique.Passes.Count;
              if (index >= numberOfPasses)
              {
            // Finished: All effect passes have been applied.
            context.PassIndex = -1;
            pass = null;
            return false;
              }

              context.PassIndex = index;
              pass = technique.Passes[index];
              index++;

              if (index == numberOfPasses - 1
              && string.Equals(pass.Name, "Restore", StringComparison.OrdinalIgnoreCase))
              {
            // A last effect pass may be used to restore the default render states without
            // drawing anything. The effect pass needs to be called "Restore".
            pass.Apply();

            // Finished: All effect passes have been applied.
            context.PassIndex = -1;
            pass = null;
            return false;
              }

              return true;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:32,代码来源:EffectTechniqueBinding.cs

示例12: Render

		public void Render(EffectWrapper pEffect, EffectPass pEffectPass)
		{
			if (m_bVisible)
			{
				pEffect.SetValue("FineBlockOrig", m_tFineBlockOrig);
				pEffect.SetValue("FineBlockOrig2", m_tFineBlockOrig2);
				pEffect.SetValue("ScaleFactor", m_tScaleFactor);
				pEffectPass.Apply();

				// render
				pEffect.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleStrip,
					0,                              // base vertex
					0,                              // min vertex index
					Settings.BLOCK_NUM_VERTICES,    // total num vertices - note that is NOT just vertices that are indexed, but all vertices
					0,                              // start index
					Settings.BLOCK_NUM_PRIMITIVES); // primitive count
			}
		}
开发者ID:modulexcite,项目名称:torq2,代码行数:18,代码来源:Block.cs


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