Jump to content
  • Advertisement
Sign in to follow this  
littlekid

3d engine design example

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

is there any 3d engine class design than is availiable for reference. I am currently trying to create a 3d engine however i can't find a suitable design to link all the classes (3dengine, VertexClass, MeshClass, ParticleClass, etc) together. Or is there a standard way to go about doing such things?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by littlekid
is there any 3d engine class design than is availiable for reference.

I am currently trying to create a 3d engine however i can't find a suitable design to link all the classes (3dengine, VertexClass, MeshClass, ParticleClass, etc) together.

Or is there a standard way to go about doing such things?


How can we forget

this?

Share this post


Link to post
Share on other sites
Thanks alot people, thoes links were really helpful

Just a small question, where do i put the 'global' variables (LPDIRECT3D9 g_d3d_obj, etc)

do i wrap them like that:


class CEngine
{
protected:
static LPDIREC3D9 g_d3d_obj;
static LPDIREC3DDEVICE9 g_d3d_device;
public:
//functions...
};

class CEngineRenderer : public CEngine
{
//some functions that access g_d3d_obj, g_d3d_device
}

or just:

LPDIREC3D9 g_d3d_obj;
LPDIREC3DDEVICE9 g_d3d_device;

class CEngine
{
//...
}

class CEngineRenderer
{
//...
}






[Edited by - littlekid on August 7, 2005 2:51:53 AM]

Share this post


Link to post
Share on other sites
I typically do it like this (simplified example):


class Engine
{

private:
Renderer m_renderer;
// other modules e.g. input, sound etc.

public:
Renderer &GetRenderer();

};

class Renderer
{

private:
IDirect3DDevice9 *m_device;

public:
IDirect3DDevice9 *GetDevice();

};



But it's up to you really.

-Mezz

Share this post


Link to post
Share on other sites
hm

I wouldn t put all the modules as members into engine base class

i would keep them seperated as singletons

CShaderManager
CSceneGraph
CRenderer
CNetwork

and i would use these single tons as a interface and implement the functionality into a derived class to keep it modular

but thats more or less a personal choice

Share this post


Link to post
Share on other sites
Quote:
Original post by Basiror
hm

I wouldn t put all the modules as members into engine base class

i would keep them seperated as singletons

CShaderManager
CSceneGraph
CRenderer
CNetwork

and i would use these single tons as a interface and implement the functionality into a derived class to keep it modular

but thats more or less a personal choice


Just curious, why does everyone always put C in front of their classes?
eg CRender instead of Render?

Also are singletons such a good idea? They do seem kinda messy, right now im just using extern for my classes, eg

render.h
class Render {
public:
Render();
};

extern Render render;

render.cpp
#include "render.h"

Render::Render() {
}

Render render;



Then you can just use render. from anywhere, when using c++.


Quote:
Just a small question, where do i put the 'global' variables (LPDIRECT3D9 g_d3d_obj, etc)


Why isn't that just hidden in your render class, and have functions on the render class eg addVertices,

and sort all the vertices etc inside the render class to be drawn, and have like your entity or monster classes add their own vertices to the render class by themselves?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
have you taken a look at the quaker 2 source?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!