Jump to content
  • Advertisement
Sign in to follow this  
mdx

[SlimDX] CustomVertex ??

This topic is 3679 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


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

Share this post


Link to post
Share on other sites
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!