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

C# Graphics.VertexElement类代码示例

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

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



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

示例1: MercuryVertex

        /// <summary>
        /// Static constructor.
        /// </summary>
        static MercuryVertex()
        {
            VertexElement posElement = new VertexElement();
            VertexElement colorElement = new VertexElement();
            VertexElement scaleElement = new VertexElement();
            VertexElement rotationElement = new VertexElement();

            VertexElements = new VertexElement[4];

            posElement.VertexElementFormat = VertexElementFormat.Vector2;
            posElement.VertexElementMethod = VertexElementMethod.Default;
            posElement.VertexElementUsage = VertexElementUsage.Position;

            colorElement.Offset = 8;
            colorElement.VertexElementFormat = VertexElementFormat.Vector4;
            colorElement.VertexElementMethod = VertexElementMethod.Default;
            colorElement.VertexElementUsage = VertexElementUsage.Color;

            scaleElement.Offset = 24;
            scaleElement.VertexElementFormat = VertexElementFormat.Single;
            scaleElement.VertexElementMethod = VertexElementMethod.Default;
            scaleElement.VertexElementUsage = VertexElementUsage.PointSize;

            rotationElement.Offset = 28;
            rotationElement.VertexElementFormat = VertexElementFormat.Single;
            rotationElement.VertexElementMethod = VertexElementMethod.Default;
            rotationElement.VertexElementUsage = VertexElementUsage.Color;
            rotationElement.UsageIndex = 1;

            VertexElements[0] = posElement;
            VertexElements[1] = colorElement;
            VertexElements[2] = scaleElement;
            VertexElements[3] = rotationElement;
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:37,代码来源:MercuryVertex.cs


示例2: Vertex

 static Vertex()
 {
     s_elements = new VertexElement[3];
     s_elements[0] = new VertexElement(0, 0, VertexElementFormat.Vector2, VertexElementMethod.Default, VertexElementUsage.Position, 0);
     s_elements[1] = new VertexElement(0, 8, VertexElementFormat.Vector2, VertexElementMethod.Default, VertexElementUsage.TextureCoordinate, 0);
     s_elements[2] = new VertexElement(0, 16, VertexElementFormat.Color, VertexElementMethod.Default, VertexElementUsage.Color, 0);
 }
开发者ID:lodossDev,项目名称:xnamugen,代码行数:7,代码来源:Vertex.cs


示例3: ManagedVertexDeclaration

 /// <summary>
 /// Create a ManagedVertexDeclaration.
 /// </summary>
 /// <param name="device">The graphics device.</param>
 /// <param name="elements">The vertex elements.</param>
 public ManagedVertexDeclaration(GraphicsDevice device, VertexElement[] elements)
 {
     this.elements = elements;
     this.device = device;
     vertexDeclaration = CreateVertexDeclaration();
     device.DeviceReset += device_DeviceReset;
 }
开发者ID:bryanedds,项目名称:Xi,代码行数:12,代码来源:ManagedVertexDeclaration.cs


示例4: VertexPositionVectorColorTexture

 static VertexPositionVectorColorTexture()
 {
     VertexElement[] elements = new VertexElement[] { new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), new VertexElement(12, VertexElementFormat.Vector4, VertexElementUsage.Color, 0), new VertexElement(28, VertexElementFormat.HalfVector2, VertexElementUsage.TextureCoordinate, 0) };
     VertexDeclaration declaration = new VertexDeclaration(elements);
     declaration.Name = "VertexPositionVectorColorTexture.VertexDeclaration";
     VertexDeclaration = declaration;
 }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:7,代码来源:ParticleVertex.cs


示例5: init

 private void init()
 {
     desc = new VertexElement[ElementCount];
     int i = 0;
     foreach (BufferLayoutElement element in Elements)
     {
         desc[i] = new VertexElement();
         switch (element.Usage)
         {
             case BufferLayoutElementUsages.Position: desc[i].VertexElementUsage = VertexElementUsage.Position; break;
             case BufferLayoutElementUsages.Color: desc[i].VertexElementUsage = VertexElementUsage.Color; break;
             case BufferLayoutElementUsages.UV: desc[i].VertexElementUsage = VertexElementUsage.TextureCoordinate; break;
             case BufferLayoutElementUsages.Normal: desc[i].VertexElementUsage = VertexElementUsage.Normal; break;
             case BufferLayoutElementUsages.Index: desc[i].VertexElementUsage = VertexElementUsage.BlendIndices; break;
             case BufferLayoutElementUsages.IndexClassic: desc[i].VertexElementUsage = VertexElementUsage.BlendIndices; break;
         }
         switch (element.Type)
         {
             case BufferLayoutElementTypes.Float: desc[i].VertexElementFormat = VertexElementFormat.Single; break;
             case BufferLayoutElementTypes.Vector2: desc[i].VertexElementFormat = VertexElementFormat.Vector2; break;
             case BufferLayoutElementTypes.Vector3: desc[i].VertexElementFormat = VertexElementFormat.Vector3; break;
             case BufferLayoutElementTypes.Vector4: desc[i].VertexElementFormat = VertexElementFormat.Vector4; break;
             case BufferLayoutElementTypes.RGBAx8: desc[i].VertexElementFormat = VertexElementFormat.Color; break;
         }
         desc[i].UsageIndex = (int)element.UsageIndex;
         desc[i].Offset = element.ByteOffset;
         ++i;
     }
 }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:29,代码来源:BufferLayoutDesc.cs


示例6: Particle

        static Particle()
        {
            // Position vertex element...
            VertexElement positionElement       = new VertexElement();
            positionElement.VertexElementFormat = VertexElementFormat.Vector2;
            positionElement.VertexElementUsage  = VertexElementUsage.Position;

            // Scale vertex element...
            VertexElement scaleElement          = new VertexElement();
            scaleElement.Offset                 = 8;
            scaleElement.VertexElementFormat    = VertexElementFormat.Single;
            scaleElement.VertexElementUsage     = VertexElementUsage.PointSize;

            // Rotation vertex element...
            VertexElement rotationElement       = new VertexElement();
            rotationElement.Offset              = 12;
            rotationElement.VertexElementFormat = VertexElementFormat.Single;
            rotationElement.VertexElementUsage  = VertexElementUsage.TextureCoordinate;

            // Color vertex element...
            VertexElement colourElement         = new VertexElement();
            colourElement.Offset                = 16;
            colourElement.VertexElementFormat   = VertexElementFormat.Vector4;
            colourElement.VertexElementUsage    = VertexElementUsage.Color;

            // Vertex element array...
            Particle.VertexElements = new VertexElement[]
            {
                positionElement,
                scaleElement,
                rotationElement,
                colourElement
            };
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:34,代码来源:Particle.cs


示例7: ExtendVertexDeclaration

        /// <summary>
        /// 頂点宣言クラスに新しい頂点要素を追加する
        /// </summary>
        /// <param name="vertexDeclaration">追加先の頂点宣言</param>
        /// <param name="extraElements">追加する頂点要素</param>
        /// <returns>新要素追加後の頂点宣言</returns>
        public static VertexDeclaration ExtendVertexDeclaration(
            VertexDeclaration vertexDeclaration, VertexElement[] extraElements)
        {
            VertexElement[] originalElements = vertexDeclaration.GetVertexElements();

              return ExtendVertexDeclaration( vertexDeclaration.GraphicsDevice,
                                          originalElements, extraElements );
        }
开发者ID:yxrkt,项目名称:outbreak,代码行数:14,代码来源:RenderHelper.cs


示例8: BaseDrawableComponent

 /// <summary>
 /// CTOR. Creates a new instance
 /// </summary>
 /// <param name="i_Game">hosting game</param>
 /// <param name="i_VertexElements">The vertex elements defining the component.
 /// This is in order to load VertexDeclaration.
 /// Valid values are: null, VertexPositionTexture.VertexElements,
 /// VertexPositionColor</param>
 /// <param name="i_NeedTexture">Defines if a 2D texture is needed by the component</param>
 public BaseDrawableComponent(
     Game i_Game,
     VertexElement[] i_VertexElements,
     bool i_NeedTexture)
     : base(i_Game)
 {
     m_VertexElements = i_VertexElements;
     NeedTexture = i_NeedTexture;
 }
开发者ID:ramimoshe,项目名称:spaceinvaders-ex2,代码行数:18,代码来源:BaseDrawableComponent.cs


示例9: VertexPositionColor

 static VertexPositionColor()
 {
     VertexElement[] elements = new VertexElement[]
     {
         new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position,0),
         new VertexElement(12, VertexElementFormat.Vector4, VertexElementUsage.Color,0)
     };
     VertexDeclaration = new VertexDeclaration(elements);
 }
开发者ID:asprowlfuller,项目名称:Sabre,代码行数:9,代码来源:VertexPositionColor.cs


示例10: VertexPositionColorTexture

 static VertexPositionColorTexture()
 {
     var elements = new VertexElement[] 
     { 
         new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), 
         new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0), 
         new VertexElement(16, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0) 
     };
     VertexDeclaration = new VertexDeclaration(elements);
 }
开发者ID:GhostTap,项目名称:MonoGame,代码行数:10,代码来源:VertexPositionColorTexture.cs


示例11: VertexPositionNormalColor

 static VertexPositionNormalColor()
 {
     VertexElement[] elements = new VertexElement[]
     {
         new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
         new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
         new VertexElement(24, VertexElementFormat.Color, VertexElementUsage.Color, 0)
     };
     VertexDeclaration declaration = new VertexDeclaration(elements);
     VertexDeclaration = declaration;
 }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:11,代码来源:VertexPositionNormalColor.cs


示例12: GetVertexStride

 private static int GetVertexStride(VertexElement[] elements)
 {
   int num1 = 0;
   for (int index = 0; index < elements.Length; ++index)
   {
     int num2 = elements[index].Offset + GraphicsExtensions.GetTypeSize(elements[index].VertexElementFormat);
     if (num1 < num2)
       num1 = num2;
   }
   return num1;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:11,代码来源:VertexDeclaration.cs


示例13: ShadowHullVertex

        static ShadowHullVertex()
        {
            VertexElement[] elements = new VertexElement[]
            {
                new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0),
                new VertexElement(8, VertexElementFormat.Vector2, VertexElementUsage.Normal,0),
                new VertexElement(16, VertexElementFormat.Color, VertexElementUsage.Color,0),
            };

            mVertexDeclaration = new VertexDeclaration(elements);
        }
开发者ID:thoniorf,项目名称:ouya-sdk-examples,代码行数:11,代码来源:ShadowHullVertex.cs


示例14: LoadContent

        /// <summary>
        /// Creates all required variables at load time
        /// </summary>
        /// <param name="game"></param>
        public void LoadContent(GraphicsDevice gd)
        {
            vBuffer = new VertexBuffer(gd, typeof(vertexPos), numV, BufferUsage.WriteOnly);

            VertexElement[] elements = new VertexElement[2];
            elements[0] = new VertexElement(0, 0, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Position, 0);
            elements[1] = new VertexElement(0, 12, VertexElementFormat.Vector2, VertexElementMethod.Default, VertexElementUsage.TextureCoordinate, 0);

            vDecl = new VertexDeclaration(gd, elements);

            vBuffer.SetData<vertexPos>(vertices);
        }
开发者ID:nthfloor,项目名称:Nebulon12,代码行数:16,代码来源:Cube.cs


示例15: GetVertexStride

		private static int GetVertexStride(VertexElement[] elements)
		{
			int max = 0;
			for (var i = 0; i < elements.Length; i++)
			{
                var start = elements[i].Offset + elements[i].VertexElementFormat.GetSize();
				if (max < start)
					max = start;
			}

			return max;
		}
开发者ID:KennethYap,项目名称:MonoGame,代码行数:12,代码来源:VertexDeclaration.cs


示例16: getVertexStride

        private static int getVertexStride(VertexElement[] elements)
        {
            int max = 0;
            for (int i = 0; i < elements.Length; i++)
            {
                int start = elements[i].Offset + elements[i].VertexElementFormat.GetTypeSize();
                if (max < start)
                {
                    max = start;
                }
            }

            return max;
        }
开发者ID:adison,项目名称:Tank-Wars,代码行数:14,代码来源:VertexDeclaration.cs


示例17: Geometry

 /// <summary>
 /// Create a Geometry object.
 /// </summary>
 /// <param name="device">The graphics device that the geometry will be created on.</param>
 /// <param name="vertexElements">The vertex elements that define the vertices that make up the geometry.</param>
 /// <param name="primitiveType">The type of primitive used to draw the geometry.</param>
 /// <param name="vertexBuffer">The vertex buffer that holds the geometry's vertices.</param>
 /// <param name="vertexSize">The size of each vertex in bytes.</param>
 /// <param name="vertexCount">The number of vertices in the vertex buffer.</param>
 /// <param name="indexBuffer">The index buffer that holds the geomety's indices.</param>
 /// <param name="indexCount">The number of indices in the index buffer.</param>
 public Geometry(
     GraphicsDevice device,
     VertexElement[] vertexElements,
     PrimitiveType primitiveType,
     VertexBuffer vertexBuffer,
     int vertexSize,
     int vertexCount,
     IndexBuffer indexBuffer,
     int indexCount)
     : this(device, vertexElements, primitiveType, vertexBuffer, vertexSize, vertexCount)
 {
     XiHelper.ArgumentNullCheck(device, vertexElements, vertexBuffer, indexBuffer);
     this.indexBuffer = indexBuffer;
     this.indexCount = indexCount;
     primitiveCount = primitiveType.GetPrimitiveCount(indexCount);
 }
开发者ID:bryanedds,项目名称:Xi,代码行数:27,代码来源:Geometry.cs


示例18: CircleHardwareInstancingData

        internal CircleHardwareInstancingData()
        {
            Effect =
                FlatRedBallServices.Load<Effect>(@"Assets\Shaders\HardwareInstancedLine.fx");

            Vector2[] vertices =
                new Vector2[21];

            for (int i = 0; i < vertices.Length; i++)
            {
                vertices[i] = new Vector2(
                    (float)System.Math.Cos(2 * System.Math.PI * ((float)i / (float)(vertices.Length))),
                    (float)System.Math.Sin(2 * System.Math.PI * ((float)i / (float)(vertices.Length))));
            }

            HardwareInstancedGeometry = new VertexBuffer(
                FlatRedBallServices.GraphicsDevice,
                21 * (2 * 4), // 21 points @ 2 floats per vertex @ 4 bytes each
                BufferUsage.None);

            HardwareInstancedGeometry.SetData<Vector2>(vertices);

            HardwareInstancedIndexBuffer = new IndexBuffer(
                FlatRedBallServices.GraphicsDevice,
                21 * 2, // two floats per point
                BufferUsage.None,
                IndexElementSize.SixteenBits);

            HardwareInstancedIndexBuffer.SetData<short>(
                new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 
                            11, 12, 13, 14, 15, 16, 17, 18, 19, 20 });

            VertexElement[] elements = new VertexElement[
                2]; // Position the individual vertex + offset position per instance
            elements[0] = new VertexElement(0, 0, 
                VertexElementFormat.Vector2, 
                VertexElementMethod.Default, 
                VertexElementUsage.Position, 1);

            elements[1] = new VertexElement(1, 0,
                VertexElementFormat.Vector3, 
                VertexElementMethod.Default, 
                VertexElementUsage.Position, 1);

            VertexDeclaration = new VertexDeclaration(
                FlatRedBallServices.GraphicsDevice, elements);
        }
开发者ID:GorillaOne,项目名称:FlatRedBall,代码行数:47,代码来源:CircleHardwareInstancingData.cs


示例19: AddModelPart

        /// <summary>
        /// Helper function used by the CustomModelProcessor
        /// to add new ModelPart information.
        /// </summary>
        public void AddModelPart( int triangleCount, int vertexCount, int vertexStride,
            VertexElement[] vertexElements,
            VertexBufferContent vertexBufferContent,
            IndexCollection indexCollection,
            MaterialContent materialContent)
        {
            ModelPart modelPart = new ModelPart();

              modelPart.TriangleCount = triangleCount;
              modelPart.VertexCount = vertexCount;
              modelPart.VertexStride = vertexStride;
              modelPart.VertexElements = vertexElements;
              modelPart.VertexBufferContent = vertexBufferContent;
              modelPart.IndexCollection = indexCollection;
              modelPart.MaterialContent = materialContent;

              modelParts.Add( modelPart );
        }
开发者ID:yxrkt,项目名称:AvatarHamsterPanic,代码行数:22,代码来源:CustomModelContent.cs


示例20: GetSkinningType

        public static SkinningType GetSkinningType(VertexElement[] elements)
#endif
        {
            int numIndexChannels = 0;
            int numWeightChannels = 0;
            foreach (VertexElement e in elements)
            {
                if (e.VertexElementUsage == VertexElementUsage.BlendIndices)
                    numIndexChannels++;
                else if (e.VertexElementUsage == VertexElementUsage.BlendWeight)
                    numWeightChannels++;
            }
            if (numIndexChannels == 3 || numWeightChannels == 3)
                return SkinningType.TwelveBonesPerVertex;
            else if (numIndexChannels == 2 || numWeightChannels == 2)
                return SkinningType.EightBonesPerVertex;
            else if (numIndexChannels == 1 || numWeightChannels == 1)
                return SkinningType.FourBonesPerVertex;
            return SkinningType.None;

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:21,代码来源:ContentUtil.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.VertexPositionColor类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.VertexDeclaration类代码示例发布时间: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