[SlimDX] CustomVertex ??

Started by
1 comment, last by Mike.Popoloski 15 years, 5 months ago
I've got some problems to convert the customVertex from MDX to slimDX. Is there no CustomVertex Class in slimDX ?

        _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()

Thanks for help
Advertisement
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:
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.)
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.
Mike Popoloski | Journal | SlimDX

This topic is closed to new replies.

Advertisement