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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
public float X;
public float Y;
public float Z;
public float Nx;
public float Ny;
public float Nz;
public float Tu1;
public float Tv1;
public float Tu2;
public float Tv2;
public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Normal | VertexFormats.Texture2;
public static readonly VertexElement[] Declarator = new VertexElement[]
{
new VertexElement( 0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0 ),
new VertexElement( 0, 12, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0 ),
new VertexElement( 0, 24, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0 ),
new VertexElement( 0, 32, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0 ),
VertexElement.VertexDeclarationEnd
};
public static readonly int StrideSize =
VertexInformation.GetDeclarationVertexSize( Declarator, 0 );
/// <summary>Creates a vertex with a position and two texture coordinates.</summary>
/// <param name=x>X position</param>
/// <param name=y>Y position</param>
/// <param name=z>Z position</param>
/// <param name=u1″>First texture coordinate U</param>
/// <param name=v1″>First texture coordinate V</param>
/// <param name=u2″>Second texture coordinate U</param>
/// <param name=v2″>Second texture coordinate V</param>
public PositionNormal2Textured( float x, float y, float z, float nx, float ny, float nz, float u1, float v1, float u2, float v2 )
{
X = x;
Y = y;
Z = z;
Nx = nx;
Ny = ny;
Nz = nz;
Tu1 = u1;
Tv1 = v1;
Tu2 = u2;
Tv2 = v2;
}
/// <summary>Creates a vertex with a position and two texture coordinates.</summary>
/// <param name=position>Position</param>
/// <param name=u1″>First texture coordinate U</param>
/// <param name=v1″>First texture coordinate V</param>
/// <param name=u2″>Second texture coordinate U</param>
/// <param name=v2″>Second texture coordinate V</param>
public PositionNormal2Textured( Vector3 position, Vector3 normal, float u1, float v1, float u2, float v2 )
{
X = position.X;
Y = position.Y;
Z = position.Z;
Nx = normal.X;
Ny = normal.Y;
Nz = normal.Z;
Tu1 = u1;
Tv1 = v1;
Tu2 = u2;
Tv2 = v2;
}
/// <summary>Gets and sets the position</summary>
public Vector3 Position
{
get
{
return new Vector3(X, Y, Z);
}
set
{
X = value.X;
Y = value.Y;
Z = value.Z;
}
}
public Vector3 Normal
{
get
{
return new Vector3(X, Y, Z);
}
set
{
X = value.X;
Y = value.Y;
Z = value.Z;
}
}
} |
Partager