本文整理汇总了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 );
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}