2010-04-21 07:48:36 -07:00
|
|
|
#ifndef ENGINE_H
|
|
|
|
#define ENGINE_H
|
|
|
|
|
|
|
|
// Forward declaration of class UserInterface
|
|
|
|
class UserInterface;
|
|
|
|
class View;
|
|
|
|
|
|
|
|
#include <iostream>
|
2019-04-11 01:31:04 -07:00
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
2019-03-09 05:56:23 -08:00
|
|
|
#include <vector>
|
|
|
|
|
2010-04-21 07:48:36 -07:00
|
|
|
#include "EventHandler.h"
|
2010-04-23 01:13:44 -07:00
|
|
|
#include "extlib/CGUITTFont.h"
|
2019-04-11 01:31:04 -07:00
|
|
|
#include <irrlicht/irrlicht.h>
|
2010-04-23 01:13:44 -07:00
|
|
|
|
2019-04-11 01:31:04 -07:00
|
|
|
enum SceneItemID {
|
|
|
|
SIID_LIGHT = 1,
|
|
|
|
SIID_CAMERA = 2,
|
|
|
|
SIID_MODEL = 3
|
2010-04-21 07:48:36 -07:00
|
|
|
};
|
|
|
|
|
2019-04-11 01:31:04 -07:00
|
|
|
class Engine {
|
2010-04-21 07:48:36 -07:00
|
|
|
friend class UserInterface;
|
|
|
|
friend class View;
|
|
|
|
|
|
|
|
private:
|
2019-03-07 21:52:29 -08:00
|
|
|
std::wstring m_NextPath;
|
2019-04-11 01:31:04 -07: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-04-11 01:31:04 -07:00
|
|
|
irr::core::dimension2d<irr::u32> m_WindowSize;
|
2010-04-21 07:48:36 -07:00
|
|
|
|
|
|
|
bool m_RunEngine;
|
|
|
|
|
2019-04-11 01:31:04 -07:00
|
|
|
EventHandler* m_EventHandler;
|
|
|
|
UserInterface* m_UserInterface;
|
|
|
|
View* m_View;
|
2010-04-21 07:48:36 -07:00
|
|
|
|
|
|
|
void setupScene();
|
|
|
|
void drawAxisLines();
|
|
|
|
void drawBackground();
|
|
|
|
void checkResize();
|
2019-04-11 01:31:04 -07:00
|
|
|
irr::gui::IGUIEnvironment* getGUIEnvironment() const;
|
2019-03-07 19:18:07 -08:00
|
|
|
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
|
2019-04-11 01:31:04 -07:00
|
|
|
// `m_Driver->setMaterial(*lineX);` in
|
2019-03-09 12:42:40 -08:00
|
|
|
// `Engine::drawAxisLines` for unknown reason:
|
2019-04-11 01:31:04 -07:00
|
|
|
// 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;
|
2019-04-11 01:31:04 -07:00
|
|
|
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];
|
2019-04-11 01:31:04 -07:00
|
|
|
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();
|
2019-04-11 01:31:04 -07:00
|
|
|
~Engine();
|
2010-04-21 07:48:36 -07:00
|
|
|
|
2019-03-07 14:17:42 -08:00
|
|
|
void run();
|
2019-04-11 01:31:04 -07:00
|
|
|
void loadMesh(const std::wstring& fileName);
|
2019-03-07 19:18:07 -08:00
|
|
|
void reloadMesh();
|
2019-03-09 04:43:36 -08:00
|
|
|
void reloadTexture();
|
2019-04-11 01:31:04 -07: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
|