/** * Factory constructor. * * Initializes the different components so they are accessible when * the setup method is executed. */ GameFactory::GameFactory() { // Create a frame and viewport. this->frame = new SDLFrame(WINDOW_WIDTH, WINDOW_HEIGHT, 32); // Main viewport Viewport* viewport = new Viewport(*frame); camera = new Camera(*(new ViewingVolume())); camera->SetPosition(Vector<3,float>(-100,0,-10)); camera->LookAt(Vector<3,float>(0,0,0)); // Bind the camera to the viewport Frustum* frustum = new Frustum(*camera); frustum->SetFar(1000); viewport->SetViewingVolume(frustum); // Create a renderer. this->renderer = new Renderer(); this->renderer->SetFarPlane(50000.0); this->renderer->initialize.Attach(*(new TextureLoader())); // space leak // Add a rendering view to the renderer this->renderer->process.Attach(*(new MyRenderingView(*viewport))); }