2009-02-10 00:30:59 -05:00
|
|
|
// $Id: irr_driver.hpp 694 2006-08-29 07:42:36Z hiker $
|
2009-02-03 19:31:40 -05:00
|
|
|
//
|
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
// Copyright (C) 2009 Joerg Henrichs
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 3
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program 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 General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
#ifndef HEADER_IRR_DRIVER_HPP
|
|
|
|
#define HEADER_IRR_DRIVER_HPP
|
|
|
|
|
2009-02-10 00:30:59 -05:00
|
|
|
#include <string>
|
2009-03-23 19:50:50 -04:00
|
|
|
#include <vector>
|
2009-02-10 00:30:59 -05:00
|
|
|
|
2009-06-25 21:19:57 -04:00
|
|
|
#include "utils/ptr_vector.hpp"
|
|
|
|
#include "utils/vec3.hpp"
|
|
|
|
|
2009-02-03 19:31:40 -05:00
|
|
|
#include "irrlicht.h"
|
|
|
|
using namespace irr;
|
|
|
|
|
2009-05-09 16:20:16 -04:00
|
|
|
struct VideoMode
|
|
|
|
{
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
|
2009-02-03 19:31:40 -05:00
|
|
|
class IrrDriver : public IEventReceiver
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/** The irrlicht device. */
|
2009-02-28 19:46:47 -05:00
|
|
|
IrrlichtDevice *m_device;
|
2009-03-11 01:10:56 -04:00
|
|
|
/** Irrlicht scene manager. */
|
2009-02-28 19:46:47 -05:00
|
|
|
scene::ISceneManager *m_scene_manager;
|
2009-03-11 01:10:56 -04:00
|
|
|
/** Irrlicht gui environment. */
|
|
|
|
gui::IGUIEnvironment *m_gui_env;
|
|
|
|
/** Irrlicht race font. */
|
|
|
|
irr::gui::IGUIFont *m_race_font;
|
2009-02-03 19:31:40 -05:00
|
|
|
|
2009-03-26 19:31:00 -04:00
|
|
|
void setAllMaterialFlags(scene::IAnimatedMesh *mesh) const;
|
2009-05-09 16:20:16 -04:00
|
|
|
std::vector<VideoMode> m_modes;
|
2009-03-26 19:31:00 -04:00
|
|
|
|
2009-07-12 07:54:21 -04:00
|
|
|
void renderBulletDebugView();
|
|
|
|
void displayFPS();
|
2009-02-03 19:31:40 -05:00
|
|
|
public:
|
2009-02-10 00:30:59 -05:00
|
|
|
IrrDriver();
|
|
|
|
~IrrDriver();
|
2009-04-23 19:27:06 -04:00
|
|
|
void initDevice();
|
|
|
|
|
2009-05-09 16:20:16 -04:00
|
|
|
const std::vector<VideoMode>& getVideoModes() const { return m_modes; }
|
2009-07-11 11:20:18 -04:00
|
|
|
const core::dimension2d<s32> getFrameSize() const { return m_device->getVideoDriver()->getCurrentRenderTargetSize(); }
|
2009-05-09 16:20:16 -04:00
|
|
|
|
2009-02-10 00:30:59 -05:00
|
|
|
IrrlichtDevice *getDevice() const { return m_device; }
|
|
|
|
scene::ISceneManager *getSceneManager() const { return m_scene_manager; }
|
|
|
|
scene::IAnimatedMesh *getAnimatedMesh(const std::string &name);
|
2009-02-10 06:11:39 -05:00
|
|
|
scene::IMesh *getMesh(const std::string &name);
|
2009-03-11 01:10:56 -04:00
|
|
|
/** Returns the gui environment, used to add widgets to a screen. */
|
|
|
|
gui::IGUIEnvironment *getGUI() const { return m_gui_env; }
|
|
|
|
irr::gui::IGUIFont *getRaceFont() const { return m_race_font; }
|
2009-02-10 00:30:59 -05:00
|
|
|
bool OnEvent(const irr::SEvent &event);
|
2009-03-15 21:45:49 -04:00
|
|
|
void setAmbientLight(const video::SColor &light);
|
2009-03-11 01:10:56 -04:00
|
|
|
video::ITexture *getTexture(const std::string &filename);
|
2009-05-18 23:24:56 -04:00
|
|
|
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL);
|
2009-03-23 19:50:50 -04:00
|
|
|
scene::ISceneNode *addWaterNode(scene::IMesh *mesh, float wave_height,
|
|
|
|
float wave_speed, float wave_length);
|
2009-02-10 00:30:59 -05:00
|
|
|
scene::ISceneNode *addOctTree(scene::IMesh *mesh);
|
|
|
|
scene::ISceneNode *addMesh(scene::IMesh *mesh);
|
2009-03-16 22:52:58 -04:00
|
|
|
scene::IParticleSystemSceneNode
|
|
|
|
*addParticleNode(bool default_emitter=true);
|
|
|
|
scene::ISceneNode *addSkyDome(const std::string &texture, int hori_res,
|
|
|
|
int vert_res, float texture_percent,
|
|
|
|
float sphere_percent);
|
2009-03-23 19:50:50 -04:00
|
|
|
scene::ISceneNode *addSkyBox(const std::vector<std::string> &texture_names);
|
2009-03-11 01:10:56 -04:00
|
|
|
void removeNode(scene::ISceneNode *node);
|
|
|
|
void removeMesh(scene::IMesh *mesh);
|
2009-04-05 08:53:17 -04:00
|
|
|
scene::IAnimatedMeshSceneNode
|
|
|
|
*addAnimatedMesh(scene::IAnimatedMesh *mesh);
|
2009-02-10 00:30:59 -05:00
|
|
|
scene::ICameraSceneNode
|
|
|
|
*addCamera();
|
2009-02-19 20:42:34 -05:00
|
|
|
void update(float dt);
|
2009-04-23 19:27:06 -04:00
|
|
|
|
|
|
|
void changeResolution();
|
2009-05-02 20:50:09 -04:00
|
|
|
void showPointer();
|
|
|
|
void hidePointer();
|
2009-06-24 19:01:45 -04:00
|
|
|
|
2009-07-12 07:54:21 -04:00
|
|
|
void renderToTexture(ptr_vector<scene::IMesh, REF>& mesh,
|
|
|
|
std::vector<Vec3>& mesh_location,
|
|
|
|
video::ITexture* target, float angle);
|
2009-02-03 19:31:40 -05:00
|
|
|
}; // IrrDriver
|
|
|
|
|
|
|
|
extern IrrDriver *irr_driver;
|
|
|
|
|
|
|
|
#endif // HEADER_IRR_DRIVER_HPP
|
|
|
|
|