Original Post
I've created a structure that has the first elements of data assign as follows: and then in the struct it has a field that describes the format: I tried using Texture0 for the texture but I get an error and says that Texture0 is None. I also declare the format as such: Is this correct. I'm getting strange results from my vertex shader which is really super basic which I'm sure is not causing the problems.
[source lang = "c#"]
/// <summary>
/// The X location of the vertex.
/// </summary>
public float X;
/// <summary>
/// The Y location of the vertex.
/// </summary>
public float Y;
/// <summary>
/// The X location of the vertex.
/// </summary>
public float Z;
/// <summary>
/// The horizontal texture coordinate for the vertex.
/// </summary>
public float Tu;
/// <summary>
/// The vertical texture coordinate for the vertex.
/// </summary>
public float Tv;
/// <summary>
/// The color for the vertex.
/// </summary>
public int color;
/// <summary>
/// The clipping left value.
/// </summary>
public float Cl;
/// <summary>
/// The clipping right value.
/// </summary>
public float Cr;
/// <summary>
/// The clipping top value.
/// </summary>
public float Ct;
/// <summary>
/// The clipping bottom value.
/// </summary>
public float Cb;
[source lang = "c#"]
/// <summary>
/// Gets the clipped vertex format.
/// </summary>
public static VertexFormats Format
{
get
{
return
VertexFormats.Position |
VertexFormats.Texture1 |
VertexFormats.Diffuse |
VertexFormats.Normal;
}
}
[source lang = "c#"]
private void InitializeVertexFormats()
{
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float3,
DeclarationMethod.Default,
DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Float2,
DeclarationMethod.Default,
DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 20, DeclarationType.Color,
DeclarationMethod.Default,
DeclarationUsage.Color, 0),
new VertexElement(0, 24, DeclarationType.Float4,
DeclarationMethod.Default,
DeclarationUsage.Normal, 0),
VertexElement.VertexDeclarationEnd
};
ClippedVertex.vdec = new VertexDeclaration(device, elements);
}