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


C# VertexDeclaration.GetVertexElements方法代码示例

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


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

示例1: 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

示例2: PrepareForUse

        public static void PrepareForUse(VertexDeclaration vd)
        {
            GLStateManager.VertexArray(true);

            bool normal = false;
            bool texcoord = false;

            foreach (var ve in vd.GetVertexElements())
            {
                switch (ve.VertexElementUsage)
                {
                    case VertexElementUsage.Position:
                        GL11.VertexPointer(
                            ve.VertexElementFormat.OpenGLNumberOfElements(),
                            ve.VertexElementFormat.OpenGLValueType(),
                            vd.VertexStride,
                            //ve.Offset
                            (IntPtr)ve.Offset
                            );
                        break;
                    case VertexElementUsage.Color:
                        GL11.ColorPointer(
                            ve.VertexElementFormat.OpenGLNumberOfElements(),
                            ve.VertexElementFormat.OpenGLValueType(),
                            vd.VertexStride,
                            //ve.Offset
                            (IntPtr)ve.Offset
                            );
                        break;
                    case VertexElementUsage.Normal:
                        GL11.NormalPointer(
                            ve.VertexElementFormat.OpenGLValueType(),
                            vd.VertexStride,
                            //ve.Offset
                            (IntPtr)ve.Offset
                            );
                        normal = true;
                        break;
                    case VertexElementUsage.TextureCoordinate:
                        GL11.TexCoordPointer(
                            ve.VertexElementFormat.OpenGLNumberOfElements(),
                            ve.VertexElementFormat.OpenGLValueType(),
                            vd.VertexStride,
                            //ve.Offset
                            (IntPtr)ve.Offset
                            );
                        texcoord = true;
                        break;
                    default:
                        throw new NotImplementedException();
                }
            }

            GLStateManager.TextureCoordArray(texcoord);
            GLStateManager.NormalArray(normal);
        }
开发者ID:jbekkedal,项目名称:MonoGame,代码行数:56,代码来源:VertexDeclaration.cs

示例3: PrepareForUse

        public static void PrepareForUse(VertexDeclaration vd, IntPtr arrayStart)
        {
            GLStateManager.VertexArray(true);

            bool normal = false;
            bool color = false;
            bool texcoord = false;

            foreach (var ve in vd.GetVertexElements())
            {
                    switch (ve.VertexElementUsage)
                    {
                        case VertexElementUsage.Position:
                            /* TODO GL.VertexPointer(
                                ve.VertexElementFormat.OpenGLNumberOfElements(),
                                ve.VertexElementFormat.OpenGLValueType(),
                                vd.VertexStride,
                                new IntPtr(arrayStart.ToInt32() + ve.Offset)
                                );*/
                            break;
                        case VertexElementUsage.Color:
                            /* TODO GL.ColorPointer(
                                ve.VertexElementFormat.OpenGLNumberOfElements(),
                                ve.VertexElementFormat.OpenGLValueType(),
                                vd.VertexStride,
                                new IntPtr(arrayStart.ToInt32() + ve.Offset)
                                );*/
                            color = true;
                            break;
                        case VertexElementUsage.Normal:
                            /* TODO GL.NormalPointer(
                                ve.VertexElementFormat.OpenGLValueType(),
                                vd.VertexStride,
                                new IntPtr(arrayStart.ToInt32() + ve.Offset)
                                );*/
                            normal = true;
                            break;
                        case VertexElementUsage.TextureCoordinate:
                            /* TODO GL.TexCoordPointer(
                                ve.VertexElementFormat.OpenGLNumberOfElements(),
                                ve.VertexElementFormat.OpenGLValueType(),
                                vd.VertexStride,
                                new IntPtr(arrayStart.ToInt32() + ve.Offset)
                                );*/
                            texcoord = true;
                            break;
                        default:
                            throw new NotImplementedException();
                    }
            }

            GLStateManager.TextureCoordArray(texcoord);
            GLStateManager.ColorArray(color);
            GLStateManager.NormalArray(normal);
        }
开发者ID:QHebert,项目名称:monogame,代码行数:55,代码来源:VertexDeclaration.cs

示例4: InstancedModelPart

        internal InstancedModelPart( InstancedModel owner, ContentReader input,
            GraphicsDevice graphicsDevice)
        {
            this.owner = owner;

              indexCount = input.ReadInt32();
              vertexCount = input.ReadInt32();
              vertexStride = input.ReadInt32();

              vertexDeclaration = input.ReadObject<VertexDeclaration>();
              vertexBuffer = input.ReadObject<VertexBuffer>();
              indexBuffer = input.ReadObject<IndexBuffer>();

              input.ReadSharedResource<Effect>( delegate( Effect value )
              {
            Effect = value;
            effectVertexCountParam = Effect.Parameters["VertexCount"];
            effectViewParam = Effect.Parameters["View"];
            effectProjectionParam = Effect.Parameters["Projection"];
            effectEyeParam = Effect.Parameters["EyePosition"];
              } );

              originalVertexDeclaration = vertexDeclaration.GetVertexElements();
        }
开发者ID:yxrkt,项目名称:outbreak,代码行数:24,代码来源:InstancedModelPart.cs

示例5: AreEqual

        internal static bool AreEqual(VertexDeclaration vertexDeclarationA, VertexDeclaration vertexDeclarationB)
        {
            // Compare vertex strides.
              if (vertexDeclarationA.VertexStride != vertexDeclarationB.VertexStride)
            return false;

              // Compare vertex element count.
              var vertexElementsA = vertexDeclarationA.GetVertexElements();
              var vertexElementsB = vertexDeclarationB.GetVertexElements();
              if (vertexElementsA.Length != vertexElementsB.Length)
            return false;

              // Compare each vertex element structure.
              for (int j = 0; j < vertexElementsA.Length; j++)
              {
            if (vertexElementsA[j] != vertexElementsB[j])
              return false;
              }

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


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