![](smile.gif)
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
CD3DFile?
Does anyone know how to Get the Vertices and Indices without knowing the name of the object in a .x file?
Thanxs ALOT
![](smile.gif)
Hi,
By the title of your post I am assuming you are using the file object provided in the sample DirectX sample code. Using that you can simply call CD3DFile::EnumObjects passing your own callback function to get all the data in the file. Then your callback will be called with a CD3DFileObject* parameter, call the GetMeshGeometry method then if there are vertices do what ever you want with them![](smile.gif)
If you are creating your own file object you need to use the IDirectXFileEnumObject and IDirectXFileObject interfaces to enumerate the data. The IDirectXFileEnumObject has a method GetNextDataObject, this will iterate every object in the file for you.
This can be a little complicated so I’m not going to attempt to explain it here.
I would just use the CD3DFile object provided possibly with a few modifications, no need to reinvent the wheel
Hope this helps
By the title of your post I am assuming you are using the file object provided in the sample DirectX sample code. Using that you can simply call CD3DFile::EnumObjects passing your own callback function to get all the data in the file. Then your callback will be called with a CD3DFileObject* parameter, call the GetMeshGeometry method then if there are vertices do what ever you want with them
![](smile.gif)
If you are creating your own file object you need to use the IDirectXFileEnumObject and IDirectXFileObject interfaces to enumerate the data. The IDirectXFileEnumObject has a method GetNextDataObject, this will iterate every object in the file for you.
This can be a little complicated so I’m not going to attempt to explain it here.
I would just use the CD3DFile object provided possibly with a few modifications, no need to reinvent the wheel
![](smile.gif)
Hope this helps
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement