當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。