forked from mirror/openmw-tes3mp
split CellRender into CellRender and CellRenderImp
This commit is contained in:
parent
ce37666dbc
commit
ea6d342a24
5 changed files with 69 additions and 47 deletions
|
@ -20,11 +20,12 @@ source_group(game FILES ${GAME} ${GAME_HEADER})
|
||||||
|
|
||||||
set(GAMEREND
|
set(GAMEREND
|
||||||
apps/openmw/mwrender/mwscene.cpp
|
apps/openmw/mwrender/mwscene.cpp
|
||||||
apps/openmw/mwrender/cell.cpp
|
apps/openmw/mwrender/cellimp.cpp
|
||||||
apps/openmw/mwrender/interior.cpp
|
apps/openmw/mwrender/interior.cpp
|
||||||
apps/openmw/mwrender/sky.cpp)
|
apps/openmw/mwrender/sky.cpp)
|
||||||
set(GAMEREND_HEADER
|
set(GAMEREND_HEADER
|
||||||
apps/openmw/mwrender/cell.hpp
|
apps/openmw/mwrender/cell.hpp
|
||||||
|
apps/openmw/mwrender/cellimp.hpp
|
||||||
apps/openmw/mwrender/mwscene.hpp
|
apps/openmw/mwrender/mwscene.hpp
|
||||||
apps/openmw/mwrender/interior.hpp
|
apps/openmw/mwrender/interior.hpp
|
||||||
apps/openmw/mwrender/playerpos.hpp
|
apps/openmw/mwrender/playerpos.hpp
|
||||||
|
|
|
@ -1,46 +1,22 @@
|
||||||
#ifndef _GAME_RENDER_CELL_H
|
#ifndef GAME_RENDER_CELL_H
|
||||||
#define _GAME_RENDER_CELL_H
|
#define GAME_RENDER_CELL_H
|
||||||
|
|
||||||
#include <string>
|
namespace MWRender
|
||||||
|
|
||||||
namespace ESM
|
|
||||||
{
|
{
|
||||||
class CellRef;
|
class CellRender
|
||||||
}
|
{
|
||||||
|
public:
|
||||||
namespace ESMS
|
|
||||||
{
|
|
||||||
class CellStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWRender
|
|
||||||
{
|
|
||||||
/// Base class for cell render, that implements inserting references into a cell in a
|
|
||||||
/// cell type- and render-engine-independent way.
|
|
||||||
|
|
||||||
class CellRender
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CellRender() {}
|
|
||||||
virtual ~CellRender() {}
|
|
||||||
|
|
||||||
/// start inserting a new reference.
|
|
||||||
virtual void insertBegin (const ESM::CellRef &ref) = 0;
|
|
||||||
|
|
||||||
/// insert a mesh related to the most recent insertBegin call.
|
|
||||||
virtual void insertMesh(const std::string &mesh) = 0;
|
|
||||||
|
|
||||||
/// insert a light related to the most recent insertBegin call.
|
virtual ~CellRender() {};
|
||||||
virtual void insertLight(float r, float g, float b, float radius) = 0;
|
|
||||||
|
|
||||||
/// finish inserting a new reference and return a handle to it.
|
/// Make the cell visible. Load the cell if necessary.
|
||||||
virtual std::string insertEnd() = 0;
|
virtual void show() = 0;
|
||||||
|
|
||||||
void insertCell(const ESMS::CellStore &cell);
|
/// Remove the cell from rendering, but don't remove it from
|
||||||
|
/// memory.
|
||||||
/// placeholder function -> need to do some heavy refactoring on the whole cell stuff
|
virtual void hide() = 0;
|
||||||
virtual void show() = 0;
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "cell.hpp"
|
#include "cellimp.hpp"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void insertObj(CellRender& cellRender, const T& liveRef)
|
void insertObj(CellRenderImp& cellRender, const T& liveRef)
|
||||||
{
|
{
|
||||||
assert (liveRef.base != NULL);
|
assert (liveRef.base != NULL);
|
||||||
const std::string &model = liveRef.base->model;
|
const std::string &model = liveRef.base->model;
|
||||||
|
@ -20,7 +20,7 @@ void insertObj(CellRender& cellRender, const T& liveRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void insertObj(CellRender& cellRender, const ESMS::LiveCellRef<ESM::Light>& liveRef)
|
void insertObj(CellRenderImp& cellRender, const ESMS::LiveCellRef<ESM::Light>& liveRef)
|
||||||
{
|
{
|
||||||
assert (liveRef.base != NULL);
|
assert (liveRef.base != NULL);
|
||||||
const std::string &model = liveRef.base->model;
|
const std::string &model = liveRef.base->model;
|
||||||
|
@ -43,7 +43,7 @@ void insertObj(CellRender& cellRender, const ESMS::LiveCellRef<ESM::Light>& live
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void insertCellRefList (CellRender& cellRender, const T& cellRefList)
|
void insertCellRefList (CellRenderImp& cellRender, const T& cellRefList)
|
||||||
{
|
{
|
||||||
for(typename T::List::const_iterator it = cellRefList.list.begin();
|
for(typename T::List::const_iterator it = cellRefList.list.begin();
|
||||||
it != cellRefList.list.end(); it++)
|
it != cellRefList.list.end(); it++)
|
||||||
|
@ -52,7 +52,7 @@ void insertCellRefList (CellRender& cellRender, const T& cellRefList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellRender::insertCell(const ESMS::CellStore &cell)
|
void CellRenderImp::insertCell(const ESMS::CellStore &cell)
|
||||||
{
|
{
|
||||||
// Loop through all references in the cell
|
// Loop through all references in the cell
|
||||||
insertCellRefList (*this, cell.activators);
|
insertCellRefList (*this, cell.activators);
|
44
apps/openmw/mwrender/cellimp.hpp
Normal file
44
apps/openmw/mwrender/cellimp.hpp
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#ifndef _GAME_RENDER_CELLIMP_H
|
||||||
|
#define _GAME_RENDER_CELLIMP_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
class CellRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ESMS
|
||||||
|
{
|
||||||
|
class CellStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWRender
|
||||||
|
{
|
||||||
|
/// Base class for cell render, that implements inserting references into a cell in a
|
||||||
|
/// cell type- and render-engine-independent way.
|
||||||
|
|
||||||
|
class CellRenderImp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CellRenderImp() {}
|
||||||
|
virtual ~CellRenderImp() {}
|
||||||
|
|
||||||
|
/// start inserting a new reference.
|
||||||
|
virtual void insertBegin (const ESM::CellRef &ref) = 0;
|
||||||
|
|
||||||
|
/// insert a mesh related to the most recent insertBegin call.
|
||||||
|
virtual void insertMesh(const std::string &mesh) = 0;
|
||||||
|
|
||||||
|
/// insert a light related to the most recent insertBegin call.
|
||||||
|
virtual void insertLight(float r, float g, float b, float radius) = 0;
|
||||||
|
|
||||||
|
/// finish inserting a new reference and return a handle to it.
|
||||||
|
virtual std::string insertEnd() = 0;
|
||||||
|
|
||||||
|
void insertCell(const ESMS::CellStore &cell);
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,6 +2,7 @@
|
||||||
#define _GAME_RENDER_INTERIOR_H
|
#define _GAME_RENDER_INTERIOR_H
|
||||||
|
|
||||||
#include "cell.hpp"
|
#include "cell.hpp"
|
||||||
|
#include "cellimp.hpp"
|
||||||
#include "components/esm_store/cell_store.hpp"
|
#include "components/esm_store/cell_store.hpp"
|
||||||
|
|
||||||
#include "OgreColourValue.h"
|
#include "OgreColourValue.h"
|
||||||
|
@ -23,7 +24,7 @@ namespace MWRender
|
||||||
TODO FIXME: Doesn't do full cleanup yet.
|
TODO FIXME: Doesn't do full cleanup yet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class InteriorCellRender : public CellRender
|
class InteriorCellRender : public CellRender, private CellRenderImp
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool lightConst;
|
static bool lightConst;
|
||||||
|
@ -90,7 +91,7 @@ namespace MWRender
|
||||||
void hide();
|
void hide();
|
||||||
|
|
||||||
/// Destroy all rendering objects connected with this cell.
|
/// Destroy all rendering objects connected with this cell.
|
||||||
void destroy();
|
void destroy(); // comment by Zini: shouldn't this go into the destructor?
|
||||||
|
|
||||||
/// Switch through lighting modes.
|
/// Switch through lighting modes.
|
||||||
void toggleLight();
|
void toggleLight();
|
||||||
|
|
Loading…
Reference in a new issue