📄 oasisgraphicssystem.h
字号:
/******************************************************************************
* This source file is part of Bad Camel Gaming
* Copyright (C) 2003 Zephie Greyvenstein
* See Readme.html for acknowledgements
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/******************************************************************************
* FILENAME : oasisGraphicsSystem.h
* DESCRIPTION : Graphics system
* AUTHOR : Zephie Greyvenstein
*****************************************************************************/
/// Avoid double inclusion
#ifndef __GRAPHICSSYSTEM_H__
#define __GRAPHICSSYSTEM_H__
/// Include common stuff
#include "oasisCommon.h"
/// Include the rest of the needed oasis stuff
#include "oasisSystem.h"
#include "oasisPool.h"
#include "oasisVector3.h"
#include "oasisColour.h"
#include "oasisSingleton.h"
/// Forward declare Ogre stuff
namespace Ogre {
class RenderWindow;
class Camera;
class SceneManager;
class Viewport;
};
namespace Oasis {
/// Graphics system
class _oasisExport graphicsSystem : public system,
public pool,
public singleton< graphicsSystem > {
/// The input system is our friend as it needs access to ogre window
friend class inputSystemBase;
/// The camera system is our friend as it needs aceess to things kept here
friend class cameraSystem;
/// The visible object needs access to graphics components
friend class visible;
/// The entity object needs access to graphics components
friend class entity;
public:
/// Detail levels for rendering
enum DetailLevel {
/// Render as points
DL_POINTS = 0,
/// Render as lines
DL_WIREFRAME = 1,
/// Render solid
DL_SOLID = 2
};
/// Fog modes
enum FogMode {
/// No fog
FM_NONE = 0,
/// Fog increases exponentially
FM_EXP = 1,
/// Fog increases at the square of FOG_EXP
FM_EXP2 = 2,
/// Fog increases linearly
FM_LINEAR = 3
};
/// Constructor
graphicsSystem( );
/// Destructor
virtual ~graphicsSystem( );
/// Get singleton
static graphicsSystem &get( void );
/// Get singleton pointer
static graphicsSystem *getPtr( void );
/// Reset this system
void reset( void );
/// Update this system
void update( real time );
/// Set the sky box
void setSkyBox( bool active,
const string &material,
real distance = 7000,
bool drawFirst = true );
/// Set the fog in the scene
void setFog( FogMode fogMode,
const colour &fogColour = colour::WHITE,
real expDensity = 0.001,
real linearStart = 0,
real linearEnd = 1 );
/// Set background colour
void setBackgroundColour( real r, real g, real b );
/// Set background colour
void setBackgroundColour( const colour &newColour );
/// Set the ambient light colour
void setAmbientLight( real r, real g, real b );
/// Set the ambient light colour
void setAmbientLight( const colour &newColour );
/// Get the height of the window
const uint16 getWindowHeight( void ) const;
/// Get the width of the window
const uint16 getWindowWidth( void ) const;
/// Take screenshot
void takeShot( const string &filename );
/// Take screenshot(auto name creation)
void takeShot( void );
/// Set the detail level for rendering
void setDetailLevel( const DetailLevel newLevel );
/// Get the detail level
const DetailLevel getDetailLevel( void ) const;
/// Create a new entity
entity *createEntity( const string &entityName,
const string &meshName );
/// Remove an entity from the system
void removeEntity( entity *oldEntity );
/// Remove an entity from the system
void removeEntity( const string &entityName );
/// Get an entity by name
entity *getEntity( const string &entityName );
private:
/// Handle to window
Ogre::RenderWindow *window;
/// Handle to camera
Ogre::Camera *camera;
/// Handle to scenemanager
Ogre::SceneManager *scene;
/// Handle to viewport
Ogre::Viewport *viewport;
/// Detail level for rendering
DetailLevel detailLevel;
/// Screenshot counter
uint16 shotCounter;
/// Get the window handle
Ogre::RenderWindow *getWindow( void ) const;
/// Get the scenemanager handle
Ogre::SceneManager *getSceneManager( void ) const;
/// Get the camera handle
Ogre::Camera *getCamera( void ) const;
/// Creates a new entity as a poolable
poolable *_createPoolable( void );
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -