Jump to content
  • Advertisement
Sign in to follow this  
Say

[c#] mesh object why this declaration?

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i've followed msdn example to understand how to use .x file. in these example the mesh object is declared in this way: Mesh mesh = null; then i just use it: mesh = Mesh.FromFile("tiger.x", MeshFlags.SystemMemory, device, out materials); before this last line i know i should make call the costructor: mesh = new Mesh(); but it is not so! Why?

Share this post


Link to post
Share on other sites
Advertisement
Mesh.FromFile is creating the new mesh for you, so you don't need to create it yourself. Its almost as if Mesh.FromFile just returns "new Mesh()", except it is filled with all of the meshes data.

Share this post


Link to post
Share on other sites
The Mesh.FromFile () Function is creating the Mesh object for you (the constructor is called inside the FromFile Method).

If you were to create a Mesh first, then FromFile would overwrite it when it returned.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!