2010-04-21 07:48:36 -07:00
|
|
|
#ifndef ENGINE_H
|
|
|
|
#define ENGINE_H
|
|
|
|
|
|
|
|
// Forward declaration of class UserInterface
|
|
|
|
class UserInterface;
|
|
|
|
class View;
|
|
|
|
|
|
|
|
#include <string>
|
2010-04-22 01:44:10 -07:00
|
|
|
#include <sstream>
|
2010-04-21 07:48:36 -07:00
|
|
|
#include <iostream>
|
2019-03-09 05:56:23 -08:00
|
|
|
#include <vector>
|
|
|
|
|
2019-03-07 08:12:09 -08:00
|
|
|
#include <irrlicht/irrlicht.h>
|
2010-04-21 07:48:36 -07:00
|
|
|
#include "EventHandler.h"
|
2010-04-23 01:13:44 -07:00
|
|
|
#include "extlib/CGUITTFont.h"
|
|
|
|
|
2010-04-21 07:48:36 -07:00
|
|
|
enum SceneItemID
|
|
|
|
{
|
|
|
|
SIID_LIGHT = 1,
|
|
|
|
SIID_CAMERA = 2,
|
|
|
|
SIID_MODEL = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
class Engine
|
|
|
|
{
|
|
|
|
friend class UserInterface;
|
|
|
|
friend class View;
|
|
|
|
|
|
|
|
private:
|
2019-03-07 21:52:29 -08:00
|
|
|
std::wstring m_NextPath;
|
2019-03-07 19:18:07 -08:00
|
|
|
irr::IrrlichtDevice *m_Device;
|
|
|
|
irr::video::IVideoDriver *m_Driver;
|
|
|
|
irr::scene::ISceneManager *m_Scene;
|
|
|
|
irr::scene::IAnimatedMeshSceneNode *m_LoadedMesh;
|
|
|
|
irr::scene::ILightSceneNode *m_SceneLight;
|
|
|
|
irr::gui::CGUITTFont *m_AxisFont;
|
|
|
|
irr::gui::CGUITTFace *m_AxisFontFace;
|
2010-04-23 01:13:44 -07:00
|
|
|
|
2019-03-07 19:18:07 -08:00
|
|
|
irr::core::dimension2d<irr::u32> *m_WindowSize;
|
2010-04-21 07:48:36 -07:00
|
|
|
|
|
|
|
bool m_RunEngine;
|
|
|
|
|
|
|
|
EventHandler *m_EventHandler;
|
|
|
|
UserInterface *m_UserInterface;
|
|
|
|
View *m_View;
|
|
|
|
|
|
|
|
void setupScene();
|
|
|
|
void drawAxisLines();
|
|
|
|
void drawBackground();
|
|
|
|
void checkResize();
|
2019-03-07 19:18:07 -08:00
|
|
|
irr::gui::IGUIEnvironment *getGUIEnvironment() const;
|
|
|
|
irr::s32 getNumberOfVertices();
|
2019-03-07 21:52:29 -08:00
|
|
|
bool isPlaying;
|
|
|
|
irr::u32 worldFPS;
|
|
|
|
irr::u32 prevFPS;
|
2019-03-09 05:56:23 -08:00
|
|
|
std::vector<std::wstring> textureExtensions;
|
2019-03-09 12:42:40 -08:00
|
|
|
// Making materials in contructor or setupScene causes segfault at
|
|
|
|
// `m_Driver->setMaterial( *lineX );` in
|
|
|
|
// `Engine::drawAxisLines` for unknown reason:
|
|
|
|
// irr::video::SMaterial *lineX;
|
|
|
|
// irr::video::SMaterial *lineY;
|
|
|
|
// irr::video::SMaterial *lineZ;
|
2019-03-09 13:41:56 -08:00
|
|
|
irr::core::vector3df m_CamPos;
|
|
|
|
irr::core::vector3df m_CamTarget;
|
|
|
|
std::wstring m_FontPath = L"ClearSansRegular.ttf"; // core::stringc has implicit conversion to io::path
|
2019-03-10 06:55:31 -07:00
|
|
|
bool KeyIsDown[irr::KEY_KEY_CODES_COUNT];
|
|
|
|
irr::s32 keyState[irr::KEY_KEY_CODES_COUNT];
|
|
|
|
irr::s32 LMouseState,RMouseState;
|
2010-04-21 07:48:36 -07:00
|
|
|
|
|
|
|
public:
|
2019-03-07 21:52:29 -08:00
|
|
|
std::wstring m_PreviousPath;
|
2019-03-07 23:30:06 -08:00
|
|
|
std::wstring m_PrevTexturePath;
|
2019-03-07 21:52:29 -08:00
|
|
|
|
|
|
|
|
2010-04-21 07:48:36 -07:00
|
|
|
Engine();
|
|
|
|
~Engine();
|
|
|
|
|
2019-03-07 14:17:42 -08:00
|
|
|
void run();
|
2019-03-07 19:18:07 -08:00
|
|
|
void loadMesh( const std::wstring &fileName );
|
|
|
|
void reloadMesh();
|
2019-03-09 04:43:36 -08:00
|
|
|
void reloadTexture();
|
2019-03-07 23:30:06 -08:00
|
|
|
bool loadTexture( const std::wstring &fileName );
|
2019-04-08 19:52:18 -07:00
|
|
|
void setMeshDisplayMode(bool wireframe = false, bool lighting = true, bool textureInterpolation = true);
|
2019-03-07 21:52:29 -08:00
|
|
|
bool isAnimating();
|
|
|
|
void playAnimation();
|
|
|
|
void pauseAnimation();
|
|
|
|
void toggleAnimation();
|
|
|
|
void setAnimationFPS(irr::u32 animationFPS);
|
2019-03-10 06:55:31 -07:00
|
|
|
void setZUp(bool zUp);
|
2019-03-07 21:52:29 -08:00
|
|
|
irr::u32 animationFPS();
|
2010-04-21 07:48:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENGINE_H
|