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


C# Graphics.VertexElement类代码示例

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


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


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