D3DX.GetVectors Function

Started by
-1 comments, last by porters 12 years, 1 month ago
Hi,

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

'datastream
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
cube.VertexBuffer.Unlock()

'dispose unmanaged resources
stream.Dispose()
cube.Dispose()
End Sub

This topic is closed to new replies.

Advertisement