Original Post
how does your engine interface look like?
in my winmain(...) I have it like this:
is there anything else that could be usefull? the World class gives you access to an object manager, Light manager and a camera manager.
frame listener example, Init() function will be called when the frame listener is attach to the world. The Update() function will be called every frame.
cEngine3D *Engine;
cWorld *World;
cMyFrameListener *MyFrameListener;
winmain(...)
{
Engine = cEngine3D::Create(); // create the singleton class.
Engine->SetRenderer(USE_GL); // choose a renderer to use
// Creates a standard world (WT_STANDARD) using objects
// Will create different world types later, using BSP
// or something else.
World = Engine->CreateWorld(WT_STANDARD);
// This is a class that will be called from the render loop
// every frame to update the object position and other stuff.
World->AttachFrameListener( MyFrameListener );
Engine->InitRenderSystem(); // enable rendersystem
Engine->Start(); // Starts the renderloop
// Windows message loop
...
Engine->ShutDown();
}
cMyFrameListener::Init(void)
{
cCamera *Camera = new cCamera;
Camera->SetPosition(...);
Camera->SetLookat(...);
World->AddCamera( Camera );
cObject *Cube = new cObject;
cObject *SpaceShip = new cObject;
Cube->CreateCube(10.0f, 10.0f, 10.0f); // use buildt in function to create a cube.
SpaceShip->Load("spaceship.mob"); // load my own object file type.
// loads material to current object
Cube->LoadMaterial("logo.mat");
SpaceShip->LoadMaterial("ShinyRed.mat");
}
cMyFrameListener::Update(void)
{
// Updates the object.
Cube->m_Rotation.x += 1.9f;
}