CustomVertex.PositionNormalTextured Structure

Language:

How Do I...?

Describes a custom vertex format structure that contains position, normal data, and one set of texture coordinates.

Definition

Visual Basic Public Structure PositionNormalTextured
C# public struct PositionNormalTextured 
C++ public value class PositionNormalTextured sealed 
JScript In JScript, you can use structures, but you cannot define your own.

Members Table

Field Description
static (Shared in Visual Basic) Format Retrieves the VertexFormats for the current custom vertex.
Nx Retrieves or sets the nx component of the vertex normal.
Ny Retrieves or sets the ny component of the vertex normal.
Nz Retrieves or sets the nz component of the vertex normal.
Tu Retrieves or sets the u component of the texture coordinate.
Tv Retrieves or sets the v component of the texture coordinate.
X Retrieves or sets the x component of the position.
Y Retrieves or sets the y component of the position.
Z Retrieves or sets the z component of the position.
Method Description
PositionNormalTextured Initializes a new instance of the CustomVertex.PositionNormalTextured class.
ToString Obtains a string representation of the current instance.
Property Description
Normal Retrieves or sets the vertex normal data.
Position Retrieves or sets the vertex position.
static (Shared in Visual Basic) StrideSize Retrieves the size of the CustomVertex.PositionNormalTextured structure.

How Do I...?

Create a Mesh Object

This example shows how to create a Mesh object.

In the following C# code example, device is assumed to be the rendering Device.

              [C#]
              
int numberVerts = 8; short[] indices = { 0,1,2, // Front Face 1,3,2, // Front Face 4,5,6, // Back Face 6,5,7, // Back Face 0,5,4, // Top Face 0,2,5, // Top Face 1,6,7, // Bottom Face 1,7,3, // Bottom Face 0,6,1, // Left Face 4,6,0, // Left Face 2,3,7, // Right Face 5,2,7 // Right Face }; Mesh mesh = new Mesh(numberVerts * 3, numberVerts, MeshFlags.Managed, CustomVertex.PositionColored.Format, device); using(VertexBuffer vb = mesh.VertexBuffer) { GraphicsStream data = vb.Lock(0, 0, LockFlags.None); data.Write(new CustomVertex.PositionColored(-1.0f, 1.0f, 1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(-1.0f, -1.0f, 1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(1.0f, 1.0f, 1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(1.0f, -1.0f, 1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(-1.0f, 1.0f, -1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(1.0f, 1.0f, -1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(-1.0f, -1.0f, -1.0f, 0x00ff00ff)); data.Write(new CustomVertex.PositionColored(1.0f, -1.0f, -1.0f, 0x00ff00ff)); vb.Unlock(); } using (IndexBuffer ib = mesh.IndexBuffer) { ib.SetData(indices, 0, LockFlags.None); }

Structure Information

Namespace Microsoft.DirectX.Direct3D
Assembly Microsoft.DirectX.Direct3D (microsoft.directx.direct3d.dll)
Strong Name Microsoft.DirectX.Direct3D,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

See Also


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center