-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomVertexFormat.cs
More file actions
34 lines (30 loc) · 1.07 KB
/
CustomVertexFormat.cs
File metadata and controls
34 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace HLMapFileLoader.Example
{
public struct CustomVertexFormat : IVertexType
{
private Vector3 position;
private Vector2 texCoord;
private Vector3 normal;
public CustomVertexFormat(Vector3 position, Vector2 texCoord, Vector3 normal)
{
this.position = position;
this.texCoord = texCoord;
this.normal = normal;
}
public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration
(
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
new VertexElement(sizeof(float) * (3 + 2), VertexElementFormat.Vector3, VertexElementUsage.Normal, 0)
);
VertexDeclaration IVertexType.VertexDeclaration
{
get
{
return VertexDeclaration;
}
}
}
}