Sign in to follow this  

D3DX.GetVectors Function

Recommended Posts

porters    120

I'm trying to extract position and normal vectors from a standard cube mesh. I can extract the position vectors okay, as they form the first 3 floats in the sequence, but im having trouble trying to retrieve the normal vectors. Can anyone tell me how to do this?

I would appreciate a VB.Net example if possible. Cheers.

Here's some example code:

Private Sub ExtractVectors()

'local variables
Dim cube As Mesh = Mesh.CreateBox(gf.Graphics.Device, 100, 100, 100)
Dim stream As DataStream = Nothing
Dim positions() As Vector3 = Nothing
Dim normals() As Vector3 = Nothing

stream = cube.VertexBuffer.Lock(0, 0, LockFlags.None)

'retrieve position vectors
positions = SlimDX.Direct3D9.D3DX.GetVectors(stream, cube.VertexCount, cube.BytesPerVertex)

'retrieve normal vectors

'close datastream

'dispose unmanaged resources
End Sub

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