Sign in to follow this  
snoddas14

Parameters for Meshes! need help.

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this