Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/graphics_engine.h @ 6978

Last change on this file since 6978 was 6815, checked in by bensch, 18 years ago

orxonox/trunk: merged branches/network back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r6774:HEAD

no conflicts…
thats what i call orthogonal work

File size: 5.3 KB
RevLine 
[4619]1/*!
[5039]2 * @file graphics_engine.h
[4619]3
[4836]4  *  defines a Interface between orxonox and graphical input
[3329]5
[3610]6    handles graphical SDL-initialisation, textures, resolutions, and so on
[4817]7 */
[1853]8
[3610]9#ifndef _GRAPHICS_ENGINE_H
10#define _GRAPHICS_ENGINE_H
[1853]11
[4817]12#include "event_listener.h"
[1853]13
[4381]14#include "sdlincl.h"
15#include "glincl.h"
[3543]16
[6142]17#include <list>
18
[4381]19// Forward Declaration
[4245]20class Text;
[4770]21class IniParser;
[5260]22class SubString;
[6142]23class WorldEntity;
[6753]24class GraphicsEffect;
[6815]25class TiXmlElement;
[3543]26
[4458]27//! class to handle graphics
28/**
29   handles graphical SDL-initialisation, textures, resolutions, and so on
[4619]30 */
[4817]31class GraphicsEngine : public EventListener
[3610]32{
[4619]33  public:
34    virtual ~GraphicsEngine();
[4836]35    /** @returns a Pointer to the only object of this Class */
[5216]36    inline static GraphicsEngine* getInstance() { if (!GraphicsEngine::singletonRef) GraphicsEngine::singletonRef = new GraphicsEngine();  return GraphicsEngine::singletonRef; };
[1853]37
[6815]38    virtual void loadParams(const TiXmlElement* root);
39
[4784]40    int init();
41    int initFromIniFile(IniParser* iniParser);
[4374]42
[4619]43    void setWindowName(const char* windowName, const char* icon);
[4831]44
[4619]45    int setResolution(int width, int height, int bpp);
46    void setFullscreen(bool fullscreen = false);
47    static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
[3611]48
[4831]49
[4836]50    /** @returns the x resolution */
[4746]51    inline int getResolutionX() const { return this->resolutionX; };
[4836]52    /** @returns the y resolution */
[4746]53    inline int getResolutionY() const { return this->resolutionY; };
[4836]54    /** @returns the Bits Per Pixel */
[4746]55    inline int getbbp() const { return this->bitsPerPixel; };
[3611]56
[4782]57    int resolutionChanged(const SDL_ResizeEvent& resizeInfo);
[3790]58
[4833]59    static void showMouse(bool show);
60    static bool isMouseVisible();
61    static void stealWMEvents(bool steal);
62    static bool isStealingEvents();
[4831]63
[4746]64    static void enter2DMode();
65    static void leave2DMode();
[3844]66
[6522]67    void wireframe();
68
[4746]69    static void storeMatrices();
[4619]70    static GLdouble modMat[16];
71    static GLdouble projMat[16];
72    static GLint viewPort[4];
[3844]73
[5084]74    void update(float dt);
[4619]75    void tick(float dt);
[4849]76    void draw() const;
[6142]77    void draw(const std::list<WorldEntity*>& drawList) const;
[4619]78    void displayFPS(bool display);
[3245]79
[4746]80    void listModes();
[5261]81    bool hwSupportsEXT(const char* extension);
[3617]82
[5366]83    /** @brief swaps the GL_BUFFERS */
[4834]84    inline static void swapBuffers() { SDL_GL_SwapBuffers(); };
[4681]85
[4817]86    void process(const Event  &event);
[4619]87
[6815]88    void loadGraphicsEffectXML(const TiXmlElement* root);
[6753]89    bool loadGraphicsEffect(GraphicsEffect* effect);
90    bool unloadGraphicsEffect(GraphicsEffect* effect);
91
92
93
[4619]94  private:
95    GraphicsEngine();
[4784]96    int initVideo(unsigned int resX, unsigned int resY, unsigned int bbp);
[4831]97    int setGLattribs();
[5260]98    void grabHardwareSettings();
[4619]99
[4784]100  public:
101
[4619]102  private:
[6753]103    static GraphicsEngine*     singletonRef;       //!< Pointer to the only instance of this Class
104    bool                       isInit;             //!< if the GraphicsEngine is initialized.
[4619]105
[5346]106    // state.
[6753]107    SDL_Surface*               screen;             //!< the screen we draw to
108    int                        resolutionX;        //!< the X-resoultion of the screen
109    int                        resolutionY;        //!< the Y-resolution of the screen
110    int                        bitsPerPixel;       //!< the bits per pixels of the screen
111    Uint32                     fullscreenFlag;     //!< if we are in fullscreen mode
112    Uint32                     videoFlags;         //!< flags for video
113    SDL_Rect**                 videoModes;         //!< list of resolutions
[4619]114
[6753]115    bool                       fogEnabled;         //!< If Fog should be enabled.
116    bool                       shadowsEnabled;     //!< If Shadows should be enabled.
117    bool                       particlesEnabled;   //!< If particles should be enabled.
118    int                        particlesValue;     //!< How many particles
119    int                        textureQuality;     //!< the quality of Textures
120    int                        filteringMethod;    //!< The filtering Method of textures.
121    int                        modelQuality;       //!< The quality of the Models loaded.
122    int                        antialiasingDepth;  //!< the Depth of the AntiAlias-Filter.
[4619]123
[5260]124    // HARDWARE-Settings:
[6753]125    char*                      hwRenderer;         //!< HW-renderer-string
126    char*                      hwVendor;           //!< HW-vendor-string
127    char*                      hwVersion;          //!< HW-version-string
128    SubString*                 hwExtensions;       //!< All suported Extensions.
[4619]129
[5346]130    // FPS-related
[6753]131    bool                       bDisplayFPS;        //!< is true if the fps should be displayed
132    float                      currentFPS;         //!< the current frame rate: frames per seconds
133    float                      maxFPS;             //!< maximal frame rate we ever got since start of the game
134    float                      minFPS;             //!< minimal frame rate we ever got since start.
[5346]135
[6753]136    std::list<GraphicsEffect*> graphicsEffects;    //!< list of graphics effects
137
138
[4536]139#ifndef NO_TEXT
[5346]140  Text*          geTextCFPS;                    //!< Text for the current FPS
141  Text*          geTextMaxFPS;                  //!< Text for the max FPS
142  Text*          geTextMinFPS;                  //!< Text for the min FPS
[4536]143#endif /* NO_TEXT */
[1853]144};
145
[3610]146#endif /* _GRAPHICS_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.