3d engine design example

Started by
8 comments, last by GameDev.net 18 years, 8 months ago
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?
Advertisement
Try This
Perhaps view the docs for popular engines like OGRE or Irrlicht. Both are Open Source too so you can browse as much of it as you want.

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?

I'd also recommend the Wild Magic engine. The accompanying book, 3D Game Engine Architecture, is also worth a look.
MumbleFuzz
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]
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
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
http://www.8ung.at/basiror/theironcross.html
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.hclass 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?

have you taken a look at the quaker 2 source?

This topic is closed to new replies.

Advertisement