2010-02-28 13:51:17 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2010-06-08 11:53:34 +00:00
|
|
|
#include "esm_store/cell_store.hpp"
|
2010-06-03 18:44:55 +00:00
|
|
|
#include "bsa/bsa_archive.hpp"
|
2010-06-03 19:51:59 +00:00
|
|
|
#include "ogre/renderer.hpp"
|
|
|
|
#include "tools/fileops.hpp"
|
2010-06-08 11:53:34 +00:00
|
|
|
|
|
|
|
#include "mwrender/cell.hpp"
|
|
|
|
#include "mwrender/mwscene.hpp"
|
|
|
|
#include "mwinput/inputmanager.hpp"
|
2010-02-28 13:51:17 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2010-06-03 19:51:59 +00:00
|
|
|
void maintest()
|
2010-06-03 18:44:55 +00:00
|
|
|
{
|
2010-06-03 19:51:59 +00:00
|
|
|
const char* esmFile = "data/Morrowind.esm";
|
|
|
|
const char* bsaFile = "data/Morrowind.bsa";
|
2010-06-03 18:44:55 +00:00
|
|
|
|
2010-06-06 10:56:46 +00:00
|
|
|
const char* plugCfg = "plugins.cfg";
|
2010-06-03 18:44:55 +00:00
|
|
|
|
|
|
|
cout << "Hello, fellow traveler!\n";
|
|
|
|
|
|
|
|
cout << "Initializing OGRE\n";
|
2010-06-03 19:51:59 +00:00
|
|
|
Render::OgreRenderer ogre;
|
|
|
|
ogre.configure(!isFile("ogre.cfg"), plugCfg, false);
|
2010-06-03 18:44:55 +00:00
|
|
|
|
|
|
|
cout << "Adding " << bsaFile << endl;
|
|
|
|
addBSA(bsaFile);
|
2010-02-28 13:51:17 +00:00
|
|
|
|
2010-05-17 15:35:42 +00:00
|
|
|
cout << "Loading ESM " << esmFile << "\n";
|
2010-02-28 13:51:17 +00:00
|
|
|
ESM::ESMReader esm;
|
2010-05-17 18:59:15 +00:00
|
|
|
ESMS::ESMStore store;
|
2010-05-20 16:59:36 +00:00
|
|
|
ESMS::CellStore cell;
|
|
|
|
|
2010-06-06 10:52:21 +00:00
|
|
|
// This parses the ESM file and loads a sample cell
|
2010-05-20 16:59:36 +00:00
|
|
|
esm.open(esmFile);
|
2010-05-17 18:59:15 +00:00
|
|
|
store.load(esm);
|
2010-06-06 22:33:45 +00:00
|
|
|
|
2010-05-20 16:59:36 +00:00
|
|
|
cell.loadInt("Beshara", store, esm);
|
2010-02-28 13:51:17 +00:00
|
|
|
|
2010-06-06 10:52:21 +00:00
|
|
|
// Create the window
|
2010-06-03 19:51:59 +00:00
|
|
|
ogre.createWindow("OpenMW");
|
|
|
|
|
2010-06-06 22:33:45 +00:00
|
|
|
cout << "\nSetting up cell rendering\n";
|
2010-06-06 11:48:20 +00:00
|
|
|
|
|
|
|
// Sets up camera, scene manager etc
|
2010-06-08 11:53:34 +00:00
|
|
|
MWRender::MWScene scene(ogre);
|
2010-06-05 18:37:01 +00:00
|
|
|
|
2010-06-06 22:33:45 +00:00
|
|
|
// This connects the cell data with the rendering scene.
|
2010-06-08 11:53:34 +00:00
|
|
|
MWRender::CellRender rend(cell, scene);
|
2010-06-06 22:33:45 +00:00
|
|
|
|
|
|
|
// Load the cell and insert it into the renderer
|
|
|
|
rend.show();
|
2010-06-06 10:52:21 +00:00
|
|
|
|
2010-06-06 11:48:20 +00:00
|
|
|
cout << "Setting up input system\n";
|
|
|
|
|
|
|
|
// Sets up the input system
|
2010-06-08 11:53:34 +00:00
|
|
|
MWInput::MWInputManager input(ogre);
|
2010-06-06 11:48:20 +00:00
|
|
|
|
|
|
|
cout << "\nStart! Press Q/ESC or close window to exit.\n";
|
2010-06-05 18:37:01 +00:00
|
|
|
|
2010-06-06 11:48:20 +00:00
|
|
|
// Start the main rendering loop
|
|
|
|
ogre.start();
|
2010-06-05 18:37:01 +00:00
|
|
|
|
2010-02-28 13:51:17 +00:00
|
|
|
cout << "\nThat's all for now!\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(/*int argc, char**argv*/)
|
|
|
|
{
|
|
|
|
try { maintest(); }
|
|
|
|
catch(exception &e)
|
|
|
|
{
|
|
|
|
cout << "\nERROR: " << e.what() << endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|