• Advertisement

Archived

This topic is now archived and is closed to further replies.

3dengine design-please help if u can!

This topic is 5728 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 all, I''m kinda designing my own 3d engine just so I can get a taste of what is involoved. So, a couple of basic question follow: 1. First, I''m not sure whether I sould use this kind of function format: void SetCurrentCamera(int CameraID); void SetCameraPosition(Engine_Vertex* CameraPosition); void SetCameraTarget(Engine_Vertex* CameraTarget); or this: *Engine_Camera GetCamera(int CameraID); The second method returns a pointer to the internal engine''s definition of a camera. Any ideas/experience/guidance that can be offered here? Can anyone suggest a reason I should do it one way or another. 2. Second, right now I''m planning to place the entirety of my engine into a engine class that will encapsulate all engine functionallity. Is this a good idea or should just export a ton of functions?

Share this post


Link to post
Share on other sites
Advertisement
Or am I going about this the completely wrong way? should I wrap up the engine in namespaces, or go with the class?

Share this post


Link to post
Share on other sites
All i can tell you is to be prepared to start over a few times. Choose any of those methods, and sooner or later you will probably realize some way that it could be done better. Then go back and rewrite it. I''m currently working on an engine that I''ve had to rewrite about 4 times so far, but i''ve learned tons from it.

Share this post


Link to post
Share on other sites
quote:
Original post by Mulligan
All i can tell you is to be prepared to start over a few times.

Hehe. Ya, I''m kinda expecting that to happen. I just wanna get off on the right foot, ya know.

Still, anyone have any new ideas on the subject. I don''t really want to do the pointer to internal structure method because, although I''m the only one that will be using it, I still think that exposing internal stuff easy very good design (I would be exposing my linked-list pointers, etc.)

Do most other engines do it either of these ways?

Thanks to all who''ve helped.
Kevin.

Share this post


Link to post
Share on other sites
good, im not the only one who had to rewrite their engine. Im on my 4th time now. but its fun.

Share this post


Link to post
Share on other sites
I reccomend trying out a few different open source engines to see what it takes. No offense but they would get it right before you. I''m just saying this because I wish I had (it would have saved loads of stupid mistakes).

I personally use the GetCamera() format. Well, in a sense. There is a Camera Manager that takes care of the Camera for me, but my Renderer contains the Camera Manager Interface, so really I get a pointer from the Renderer to the Manager then use that to get a camera, which has it''s own SetPos(), SetTarget(), etc..

Namespaces or Classes? What the heck is wrong with using both???
I use a namespace for every class I use. So my Camera class is:

namespace AURELIO_REIS
{
class CCamera
{
// Tor, DTor, functions, etc...
SetPos( VECTOR3 &vPos ) { m_vPos = vPos };
}
}


So the scope for the SetPos function would be AURELIO_REIS::CCamera::SetPos(), UNLESS you use the using namespace key words which allow you to just limit your scope to the class (so now it''s just CCamera::SetPos()).

using namespace AURELIO_REIS;

BTW, I use my last name to denote which area''s I worked on. If Bob or Joe Smith did something, you could have had it be BOB_SMITH, but even better you should be descriptive, ex: MICROSOFT_GRAPHICS_COMPONENT. It doesn''t hurt.

Good luck!

"Love all, trust a few. Do wrong to none." - Shakespeare

Dirge - Aurelio Reis
www.CodeFortress.com
Current Causes:
Nissan sues Nissan

Share this post


Link to post
Share on other sites
quote:
Original post by Dirge
I reccomend trying out a few different open source engines to see what it takes. No offense but they would get it right before you.


No offence taken. :o)

quote:
Original post by Dirge
I personally use the GetCamera() format. Well, in a sense. There is a Camera Manager that takes care of the Camera for me, but my Renderer contains the Camera Manager Interface, so really I get a pointer from the Renderer to the Manager then use that to get a camera, which has it''s own SetPos(), SetTarget(), etc..



Could you explain this in a bit more detail? I''m a little confused on the camera ''manager'' part. Thanks.

quote:
Original post by alfmga
u''ll find what ur looking for here



Good article, but I was looking more for info on game engine API design. Thanks anyway, it was a good read.

Also, I''m still wondering if it''s a good idea to wrap the entire engine in a single class that the calling application must instance.? Any ideas?

Thanks all,
Kevin

Share this post


Link to post
Share on other sites

  • Advertisement