forked from teamnwah/openmw-tes3coop
Renamed all .h to .hpp. Started porting rendering code.
This commit is contained in:
parent
2d2804b30c
commit
dc2c9f06d0
42 changed files with 191 additions and 128 deletions
|
@ -11,7 +11,7 @@ set(BSA bsa/bsa_archive.cpp bsa/bsa_file.cpp)
|
|||
set(NIF nif/nif_file.cpp nifogre/ogre_nif_loader.cpp)
|
||||
set(TOOLS tools/stringops.cpp)
|
||||
set(MANGLE_VFS mangle/vfs/servers/ogre_vfs.cpp)
|
||||
set(GAME game/main.cpp game/esm_store/store.cpp game/cell_store.cpp game/setup.cpp)
|
||||
set(GAME game/main.cpp game/esm_store/store.cpp game/cell_store.cpp)
|
||||
|
||||
# Platform specific
|
||||
if (WIN32)
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "bsa_archive.h"
|
||||
#include "bsa_archive.hpp"
|
||||
|
||||
#include <OgreArchive.h>
|
||||
#include <OgreArchiveFactory.h>
|
||||
#include <OgreArchiveManager.h>
|
||||
#include "bsa_file.h"
|
||||
#include "../mangle/stream/clients/ogre_datastream.h"
|
||||
#include "bsa_file.hpp"
|
||||
#include "../mangle/stream/clients/ogre_datastream.hpp"
|
||||
|
||||
using namespace Ogre;
|
||||
using namespace Mangle::Stream;
|
||||
|
@ -152,10 +152,7 @@ public:
|
|||
};
|
||||
|
||||
static bool init = false;
|
||||
|
||||
// The functions below are the only publicly exposed part of this file
|
||||
|
||||
void insertBSAFactory()
|
||||
static void insertBSAFactory()
|
||||
{
|
||||
if(!init)
|
||||
{
|
||||
|
@ -164,6 +161,8 @@ void insertBSAFactory()
|
|||
}
|
||||
}
|
||||
|
||||
// The function below is the only publicly exposed part of this file
|
||||
|
||||
void addBSA(const char* name, const char* group)
|
||||
{
|
||||
insertBSAFactory();
|
||||
|
|
|
@ -24,21 +24,8 @@
|
|||
#ifndef _BSA_ARCHIVE_H_
|
||||
#define _BSA_ARCHIVE_H_
|
||||
|
||||
/** Insert the archive manager for .bsa files into the OGRE resource
|
||||
loading system. You only need to call this function once.
|
||||
|
||||
After calling it, you can do:
|
||||
|
||||
ResourceGroupManager::getSingleton().
|
||||
addResourceLocation("Morrowind.bsa", "BSA", "General");
|
||||
|
||||
or add BSA files to resources.cfg, etc. You can also use the
|
||||
shortcut addBSA() below, which will call insertBSAFactory() for
|
||||
you.
|
||||
*/
|
||||
void insertBSAFactory();
|
||||
|
||||
/// Add the given BSA file to the Ogre resource system.
|
||||
/// Add the given BSA file as an input archive in the Ogre resource
|
||||
/// system.
|
||||
void addBSA(const char* file, const char* group="General");
|
||||
|
||||
#endif
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "bsa_file.h"
|
||||
#include "bsa_file.hpp"
|
||||
|
||||
#include "../mangle/stream/servers/file_stream.h"
|
||||
#include "../mangle/stream/filters/slice_stream.h"
|
||||
#include "../mangle/tools/str_exception.h"
|
||||
#include "../mangle/stream/servers/file_stream.hpp"
|
||||
#include "../mangle/stream/filters/slice_stream.hpp"
|
||||
#include "../mangle/tools/str_exception.hpp"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _BSA_FILE_H_
|
||||
#define _BSA_FILE_H_
|
||||
|
||||
#include "../mangle/stream/stream.h"
|
||||
#include "../mangle/stream/stream.hpp"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <strings.h>
|
|
@ -1,4 +1,4 @@
|
|||
#include "../bsa_file.h"
|
||||
#include "../bsa_file.hpp"
|
||||
|
||||
/*
|
||||
Test of the BSAFile class
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "../bsa_file.h"
|
||||
#include "../bsa_file.hpp"
|
||||
|
||||
#include "bsatool_cmd.h"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
|||
#include <fstream>
|
||||
#include <exception>
|
||||
|
||||
#include "../../mangle/stream/filters/buffer_stream.h"
|
||||
#include "../../mangle/stream/filters/buffer_stream.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace Mangle::Stream;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// This is a test of the BSA archive handler for OGRE.
|
||||
|
||||
#include "../bsa_archive.h"
|
||||
#include "../bsa_archive.hpp"
|
||||
|
||||
using namespace Ogre;
|
||||
using namespace std;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "../mangle/stream/stream.h"
|
||||
#include "../mangle/stream/servers/file_stream.h"
|
||||
#include "../mangle/tools/str_exception.h"
|
||||
#include "../tools/stringops.h"
|
||||
#include "../mangle/stream/stream.hpp"
|
||||
#include "../mangle/stream/servers/file_stream.hpp"
|
||||
#include "../mangle/tools/str_exception.hpp"
|
||||
#include "../tools/stringops.hpp"
|
||||
|
||||
namespace ESM {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "cell_store.hpp"
|
||||
#include <iostream>
|
||||
#include "mangle/tools/str_exception.h"
|
||||
#include "mangle/tools/str_exception.hpp"
|
||||
|
||||
using namespace ESMS;
|
||||
using namespace std;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "esm_store/store.hpp"
|
||||
#include "esm/records.hpp"
|
||||
#include "mangle/tools/str_exception.h"
|
||||
#include "mangle/tools/str_exception.hpp"
|
||||
#include <list>
|
||||
|
||||
namespace ESMS
|
||||
|
|
|
@ -1,11 +1,36 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "cell_store.hpp"
|
||||
#include "render/cell.hpp"
|
||||
#include "bsa/bsa_archive.hpp"
|
||||
#include <Ogre.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// See setup.cpp
|
||||
void main_setup(const char* bsaFile);
|
||||
// Absolute minimal OGRE setup
|
||||
void ogre_setup()
|
||||
{
|
||||
using namespace Ogre;
|
||||
|
||||
// Disable Ogre logging
|
||||
new LogManager;
|
||||
Log *log = LogManager::getSingleton().createLog("");
|
||||
log->setDebugOutputEnabled(false);
|
||||
|
||||
// Set up Root.
|
||||
new Root();
|
||||
}
|
||||
|
||||
void main_setup(const char* bsaFile)
|
||||
{
|
||||
cout << "Hello, fellow traveler!\n";
|
||||
|
||||
cout << "Initializing OGRE\n";
|
||||
ogre_setup();
|
||||
|
||||
cout << "Adding " << bsaFile << endl;
|
||||
addBSA(bsaFile);
|
||||
}
|
||||
|
||||
void maintest()
|
||||
{
|
||||
|
@ -18,6 +43,7 @@ void maintest()
|
|||
ESM::ESMReader esm;
|
||||
ESMS::ESMStore store;
|
||||
ESMS::CellStore cell;
|
||||
Render::CellRender rend(cell);
|
||||
|
||||
esm.open(esmFile);
|
||||
store.load(esm);
|
||||
|
|
18
game/render/cell.hpp
Normal file
18
game/render/cell.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef _GAME_RENDER_CELL_H
|
||||
#define _GAME_RENDER_CELL_H
|
||||
|
||||
#include "../cell_store.hpp"
|
||||
|
||||
namespace Render
|
||||
{
|
||||
class CellRender
|
||||
{
|
||||
const ESMS::CellStore *cell;
|
||||
|
||||
public:
|
||||
CellRender(const ESMS::CellStore &_cell)
|
||||
: cell(&_cell) {}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,36 +0,0 @@
|
|||
/* Split off into a separate file just to increase compile
|
||||
speed. Parsing Ogre.h takes a long time, and the Ogre-dependent
|
||||
part doesn't change much. This entire layout will change later.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "bsa/bsa_archive.h"
|
||||
#include "Ogre.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Absolute minimal OGRE setup
|
||||
void ogre_setup()
|
||||
{
|
||||
using namespace Ogre;
|
||||
|
||||
// Disable Ogre logging
|
||||
new LogManager;
|
||||
Log *log = LogManager::getSingleton().createLog("");
|
||||
log->setDebugOutputEnabled(false);
|
||||
|
||||
// Set up Root.
|
||||
new Root();
|
||||
}
|
||||
|
||||
void main_setup(const char* bsaFile)
|
||||
{
|
||||
cout << "Hello, fellow traveler!\n";
|
||||
|
||||
cout << "Initializing OGRE\n";
|
||||
ogre_setup();
|
||||
|
||||
cout << "Adding " << bsaFile << endl;
|
||||
addBSA(bsaFile);
|
||||
}
|
||||
|
2
mangle
2
mangle
|
@ -1 +1 @@
|
|||
Subproject commit 52e7570b4fddd868cc0483e0fa2e49c50d5a1334
|
||||
Subproject commit 6b0b7c95f8a40a53b4c26d551d4fb5118deb7e12
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _NIF_CONTROLLED_H_
|
||||
#define _NIF_CONTROLLED_H_
|
||||
|
||||
#include "extra.h"
|
||||
#include "extra.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -24,9 +24,9 @@
|
|||
#ifndef _NIF_CONTROLLER_H_
|
||||
#define _NIF_CONTROLLER_H_
|
||||
|
||||
#include "record.h"
|
||||
#include "nif_file.h"
|
||||
#include "record_ptr.h"
|
||||
#include "record.hpp"
|
||||
#include "nif_file.hpp"
|
||||
#include "record_ptr.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _NIF_DATA_H_
|
||||
#define _NIF_DATA_H_
|
||||
|
||||
#include "controlled.h"
|
||||
#include "controlled.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _NIF_EFFECT_H_
|
||||
#define _NIF_EFFECT_H_
|
||||
|
||||
#include "node.h"
|
||||
#include "node.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -24,9 +24,9 @@
|
|||
#ifndef _NIF_EXTRA_H_
|
||||
#define _NIF_EXTRA_H_
|
||||
|
||||
#include "record.h"
|
||||
#include "nif_file.h"
|
||||
#include "record_ptr.h"
|
||||
#include "record.hpp"
|
||||
#include "nif_file.hpp"
|
||||
#include "record_ptr.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -21,17 +21,17 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "nif_file.h"
|
||||
#include "record.h"
|
||||
#include "../tools/stringops.h"
|
||||
#include "nif_file.hpp"
|
||||
#include "record.hpp"
|
||||
#include "../tools/stringops.hpp"
|
||||
|
||||
#include "extra.h"
|
||||
#include "controlled.h"
|
||||
#include "node.h"
|
||||
#include "property.h"
|
||||
#include "data.h"
|
||||
#include "effect.h"
|
||||
#include "controller.h"
|
||||
#include "extra.hpp"
|
||||
#include "controlled.hpp"
|
||||
#include "node.hpp"
|
||||
#include "property.hpp"
|
||||
#include "data.hpp"
|
||||
#include "effect.hpp"
|
||||
#include "controller.hpp"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
|
|
@ -24,18 +24,18 @@
|
|||
#ifndef _NIF_FILE_H_
|
||||
#define _NIF_FILE_H_
|
||||
|
||||
#include "../mangle/stream/stream.h"
|
||||
#include "../mangle/stream/filters/buffer_stream.h"
|
||||
#include "../mangle/tools/str_exception.h"
|
||||
#include "../mangle/stream/stream.hpp"
|
||||
#include "../mangle/stream/filters/buffer_stream.hpp"
|
||||
#include "../mangle/tools/str_exception.hpp"
|
||||
|
||||
#include "../tools/slice_array.h"
|
||||
#include "../tools/slice_array.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
#include "record.h"
|
||||
#include "nif_types.h"
|
||||
#include "record.hpp"
|
||||
#include "nif_types.hpp"
|
||||
|
||||
using namespace Mangle::Stream;
|
||||
|
|
@ -24,8 +24,8 @@
|
|||
#ifndef _NIF_NODE_H_
|
||||
#define _NIF_NODE_H_
|
||||
|
||||
#include "controlled.h"
|
||||
#include "data.h"
|
||||
#include "controlled.hpp"
|
||||
#include "data.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _NIF_PROPERTY_H_
|
||||
#define _NIF_PROPERTY_H_
|
||||
|
||||
#include "controlled.h"
|
||||
#include "controlled.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _NIF_RECORD_PTR_H_
|
||||
#define _NIF_RECORD_PTR_H_
|
||||
|
||||
#include "nif_file.h"
|
||||
#include "nif_file.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace Nif
|
|
@ -2,7 +2,7 @@ GCC=g++
|
|||
|
||||
all: niftool nif_bsa_test
|
||||
|
||||
niftool: niftool.cpp ../nif_file.h ../nif_file.cpp ../record.h
|
||||
niftool: niftool.cpp ../nif_file.hpp ../nif_file.cpp ../record.hpp
|
||||
$(GCC) $< ../nif_file.cpp ../../tools/stringops.cpp -o $@
|
||||
|
||||
nif_bsa_test: nif_bsa_test.cpp ../nif_file.cpp ../../bsa/bsa_file.cpp ../../tools/stringops.cpp
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
Runs NIFFile through all the NIFs in Morrowind.bsa.
|
||||
*/
|
||||
|
||||
#include "../nif_file.h"
|
||||
#include "../../bsa/bsa_file.h"
|
||||
#include "../../tools/stringops.h"
|
||||
#include "../nif_file.hpp"
|
||||
#include "../../bsa/bsa_file.hpp"
|
||||
#include "../../tools/stringops.hpp"
|
||||
#include <iostream>
|
||||
|
||||
using namespace Mangle::Stream;
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
Test of the NIFFile class
|
||||
*/
|
||||
|
||||
#include "../nif_file.h"
|
||||
#include "../nif_file.hpp"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "../../mangle/stream/servers/file_stream.h"
|
||||
#include "../node.h"
|
||||
#include "../controller.h"
|
||||
#include "../data.h"
|
||||
#include "../../mangle/stream/servers/file_stream.hpp"
|
||||
#include "../node.hpp"
|
||||
#include "../controller.hpp"
|
||||
#include "../data.hpp"
|
||||
|
||||
using namespace Mangle::Stream;
|
||||
using namespace std;
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "ogre_nif_loader.h"
|
||||
#include "ogre_nif_loader.hpp"
|
||||
#include <Ogre.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../mangle/vfs/servers/ogre_vfs.h"
|
||||
#include "../nif/nif_file.h"
|
||||
#include "../nif/node.h"
|
||||
#include "../nif/data.h"
|
||||
#include "../nif/property.h"
|
||||
#include "../mangle/vfs/servers/ogre_vfs.hpp"
|
||||
#include "../nif/nif_file.hpp"
|
||||
#include "../nif/node.hpp"
|
||||
#include "../nif/data.hpp"
|
||||
#include "../nif/property.hpp"
|
||||
|
||||
// For warning messages
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "../ogre_nif_loader.h"
|
||||
#include "../../bsa/bsa_archive.h"
|
||||
#include "../ogre_nif_loader.hpp"
|
||||
#include "../../bsa/bsa_archive.hpp"
|
||||
|
||||
//#define SCREENSHOT
|
||||
|
||||
|
|
1
ogre/.gitignore
vendored
Normal file
1
ogre/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
old
|
34
ogre/renderer.cpp
Normal file
34
ogre/renderer.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "render.hpp"
|
||||
|
||||
using namespace Ogre;
|
||||
|
||||
bool OgreRenderer::configure(bool showConfig,
|
||||
const std::string &pluginCfg,
|
||||
bool _logging);
|
||||
{
|
||||
// Set up logging first
|
||||
new LogManager;
|
||||
Log *log = LogManager::getSingleton().createLog("Ogre.log");
|
||||
logging = _logging;
|
||||
|
||||
if(logging)
|
||||
// Full log detail
|
||||
log->setLogDetail(LL_BOREME);
|
||||
else
|
||||
// Disable logging
|
||||
log->setDebugOutputEnabled(false);
|
||||
|
||||
mRoot = new Root(plugincfg, "ogre.cfg", "");
|
||||
|
||||
// Show the configuration dialog and initialise the system, if the
|
||||
// showConfig parameter is specified. The settings are stored in
|
||||
// ogre.cfg. If showConfig is false, the settings are assumed to
|
||||
// already exist in ogre.cfg.
|
||||
int result;
|
||||
if(showConfig)
|
||||
result = mRoot->showConfigDialog();
|
||||
else
|
||||
result = mRoot->restoreConfig();
|
||||
|
||||
return !result;
|
||||
}
|
34
ogre/renderer.hpp
Normal file
34
ogre/renderer.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef _OGRE_RENDERER_H
|
||||
#define _OGRE_RENDERER_H
|
||||
|
||||
/*
|
||||
Ogre renderer class
|
||||
*/
|
||||
|
||||
#include <Ogre.h>
|
||||
#include <string>
|
||||
|
||||
namespace Render
|
||||
{
|
||||
class OgreRenderer
|
||||
{
|
||||
Ogre::Root *mRoot;
|
||||
bool logging;
|
||||
|
||||
public:
|
||||
OgreRenderer()
|
||||
: mRoot(NULL) {}
|
||||
|
||||
/** Configure the renderer. This will load configuration files and
|
||||
set up the Root and logging classes. */
|
||||
|
||||
bool configure(bool showConfig, // Show config dialog box?
|
||||
const std::string &pluginCfg, // plugin.cfg file
|
||||
bool _logging); // Enable or disable logging
|
||||
|
||||
/// Kill the renderer.
|
||||
void cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#include "stringops.h"
|
||||
#include "stringops.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
|
|
@ -2,10 +2,10 @@ GCC=g++
|
|||
|
||||
all: strops_test slice_test
|
||||
|
||||
slice_test: slice_test.cpp ../slice_array.h
|
||||
slice_test: slice_test.cpp ../slice_array.hpp
|
||||
$(GCC) $< -o $@
|
||||
|
||||
strops_test: strops_test.cpp ../stringops.h ../stringops.cpp
|
||||
strops_test: strops_test.cpp ../stringops.hpp ../stringops.cpp
|
||||
$(GCC) $< -o $@ ../stringops.cpp
|
||||
|
||||
clean:
|
||||
|
|
|
@ -4,7 +4,7 @@ using namespace std;
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include "../slice_array.h"
|
||||
#include "../slice_array.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "../stringops.h"
|
||||
#include "../stringops.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue