Jump to content

  • Log In with Google      Sign In   
  • Create Account

D3DX.GetVectors Function


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 porters   Members   -  Reputation: 119

Like
0Likes
Like

Posted 04 March 2012 - 11:51 PM

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


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS