_vbuffer = New VertexBuffer(GetType(CustomVertex.PositionNormalTextured), _
6, _dxdevice, 0, CustomVertex.PositionNormalTextured.Format, _
Pool.Managed)
Dim _verts As CustomVertex.PositionNormalTextured() = CType(_vbuffer.Lock(0, LockFlags.None), CustomVertex.PositionNormalTextured())
For x = 0 To 5
_verts(x) = New CustomVertex.PositionNormalTextured(_vec(x), n, _tex(x).X, _tex(x).Y)
xt += 1
Next
_vbuffer.Unlock()
[SlimDX] CustomVertex ??
I've got some problems to convert the customVertex from MDX to slimDX. Is there no CustomVertex Class in slimDX ?
Thanks for help
Nope, SlimDX has none built in. I think the SampleFramework has that support, but I'll let Mike chime in on that. Building vertex structs is fairly easy though, they typically work like this:
(Written completely off memory so be prepared for minor errors.)
using System.Runtime.InteropServices;using SlimDX;[StructLayout(LayoutKind.Sequential)]struct PositionNormalTextured{ public Vector3 Position; public Vector3 Normal; public Vector2 TexCoords; public property int Size { get { return 32; } } public property VertexFormat VertexFormat { return VertexFormat.Position | VertexFormat.Normal | VertexFormat.TexCoord1; }};
(Written completely off memory so be prepared for minor errors.)
The Sample Framework right now has two vertex types if you want to use them: TransformedColoredVertex and TransformedColoredTexturedVertex. The CustomVertex class from MDX is not included because it has no direct Direct3D counterpart. It's simply a collection of vertex types that are easy to declare on your own.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement