Jump to content
  • Advertisement
Sign in to follow this  
snoddas14

Parameters for Meshes! need help.

This topic is 4093 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

Hey i got this Ide of doing my own Class when loading Meshes but the thing is when i want to decide what my Mesh will be calld like
void Load(std::string filename, LPD3DXMESH MeshName)
{
    D3DXLoadMeshFromX(filename.c_str(), D3DXMESH_SYSTEMMEM, pd3dDevice,  NULL, &BuffMat, NULL, &NumMaterial,/*i want to use the Decided mesh name here*/ MeshName);

    MeshName->/*and be able to acces it here*/DrawSubset(10);
}

/* and now doing it in my Code */

//my class
Load Load;

//doing the load function

Load.Load("palm.x", Palmtree1);


Pleas Tell me if i explaind it bad or good, and i realy want an easy answer! THX!

Share this post


Link to post
Share on other sites
Advertisement
Not sure if its what you mean but this is how I would deal with it.



CMyMeshClass* PalmTree;

PalmTree = new CMyMeshClass(..);
PalmTree->Load("palmtree.x");
PalmTree->Draw(..);


Inside the class itself I would do something like this:


class CMyMeshClass
{
ID3DXMesh* pMesh;
CMyMeshClass(..);
Load(std::string filename);
Draw(..);
};

CMyMeshClass::Load(std::string filename)
{
..
D3DXLoadMeshFromX(filename.c_str(), D3DXMESH_SYSTEMMEM, pd3dDevice, NULL, &BuffMat, NULL, &NumMaterial,&pMesh);
..
}


Basically the main program would know the mesh as PalmTree whereas the mesh class doesn't need to know as it would most likely be used for many mesh objects and hence is not unique.

Hope that helps somewhat.

Share this post


Link to post
Share on other sites
well it was kind of what i meant.

i want an esier way but im starting thinking that it aint a smarter way.
any way my class dident work out like yours.
i only get the same error and so on.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!