Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

D3DX.GetVectors Function

4: Adsense

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   

120
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





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.