Thread: Mesh Class Design problem

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    64

    Mesh Class Design problem

    I want adding 3d format would be easy. Lets say, I want to support md2 now then later md3 then 3ds then so on.

    I have a mesh manager
    ResourceManager< Mesh > *m_meshManager; // Mesh manager.

    Can anyone here help me on designing my Mesh class?

    So far here's the code

    Code:
    class Mesh : public BoundingVolume
    {
    };
    
    class AnimatedMesh : public Mesh
    {
    };
    class AnimatedMeshMD2 : public AnimatedMesh, public Resource< AnimatedMeshMD2 >
    {
    };
    class AnimatedMeshMD3 : public AnimatedMesh, public Resource< AnimatedMeshMD3 >
    {
    };
    class AnimatedMesh3DS : public AnimatedMesh, public Resource< AnimatedMesh3DS >
    {
    };
    Is there any cleaner way? I want to organize all of my mesh in one manager. I really suck in designing. So I hope this makes sense.

    Sarah

    EDIT: BTW, I found this kind of design in Multiplayer FPS in DirectX but in only supports .X files which uses bones.
    Last edited by sarah22; 05-19-2009 at 01:04 PM.

  2. #2
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Try writing some tests or mock code with your idea of how the interface should be used, then work from there.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    64
    Code:
    Mesh *m_mesh;
    ResourceManager< Mesh > *m_meshManager;     //Mesh Manager
    Script *script = new Script( name, path );              //Script
    m_mesh = GetMeshManager()->Add( script->GetStringData( "mesh" ), script->GetStringData( "mesh_path" ) ); //Load the Mesh
    I'm thinking I'll have only one constructor then check what format is it in the Mesh constructor then run the function(loadMD2 or loadMD3). But I'm just wondering how Irrlicht do the one I want. AnimatedMeshMD2

    Btw, the SceneManager is the one who will handle the Frustum, Occlusion and etc. The MeshManager is just part of the SceneManager. The same with the ScriptManager and MaterialManager.

    Does anyone here has a Mesh class that supports many 3d file? Can you tell me how you did it and give me some tips?

    Here's my class diagram.
    Last edited by sarah22; 05-20-2009 at 05:03 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-21-2006, 04:23 AM
  2. singleton class problem
    By ... in forum C++ Programming
    Replies: 6
    Last Post: 12-22-2003, 06:16 PM
  3. Quaternion class problem
    By Lurker in forum C++ Programming
    Replies: 14
    Last Post: 11-18-2003, 06:01 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM
  5. static class problem.
    By Sebastiani in forum C++ Programming
    Replies: 3
    Last Post: 10-16-2002, 03:27 PM

Tags for this Thread