Sign in to follow this  

[SlimDX] CustomVertex ??

Recommended Posts

mdx    182
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, _

        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

Thanks for help

Share this post

Link to post
Share on other sites
Promit    13246
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;

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.)

Share this post

Link to post
Share on other sites
Mike.Popoloski    3258
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this