1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
// This file may be redistributed and modified only under the terms of
// the GNU General Public License (See COPYING for details).
// Copyright (C) 2001 - 2004 Simon Goodall, University of Southampton
#ifndef RENDERSYSTEM_H
#define RENDERSYSTEM_H 1
#include <string>
namespace Sear {
typedef int TextureID;
typedef int StateID;
class TextureManager;
class StateManager;
class Console;
class Render;
class RenderSystem {
public:
typedef enum {
RENDER_UNKNOWN = 0,
RENDER_LIGHTING,
RENDER_TEXTURES,
RENDER_SHADOWS,
RENDER_STENCIL,
RENDER_LAST_STATE
} RenderState;
static RenderSystem &getInstance() { return m_instance; }
RenderSystem() :
m_initialised(false),
m_stateManager(NULL),
m_textureManager(NULL),
m_renderer(NULL)
{ }
virtual ~RenderSystem() {}
void init();
void initContext();
void shutdown();
// Texture Manager Functions
TextureID requestTexture(const std::string &textureName, bool mask = false);
void switchTexture(TextureID to);
void switchTexture(unsigned int texUnit, TextureID to);
// State Manager functions
StateID requestState(const std::string &state);
void switchState(StateID state);
StateID getCurrentState();
void invalidate();
TextureManager *getTextureManager() const { return m_textureManager; }
StateManager *getStateManager() const { return m_stateManager; }
Render *getRenderer() const { return m_renderer; }
// Renderer Functions
bool createWindow(unsigned int width, unsigned int height, bool fullscreen);
void destroyWindow();
void toggleFullscreen();
void registerCommands(Console *console);
void runCommand(const std::string &command) {}
void readConfig();
void writeConfig();
void setState(RenderState state, bool value) {
m_renderState[state] = value;
}
bool getState(RenderState state) const {
return m_renderState[state];
}
void resize(int width, int height);
private:
static RenderSystem m_instance;
bool m_initialised;
StateManager *m_stateManager;
TextureManager *m_textureManager;
Render *m_renderer;
bool m_renderState[RENDER_LAST_STATE];
};
} // namespace Sear
#endif
|