store ogre handle in ref data

actorid
Marc Zinnschlag 15 years ago
parent def0a773bd
commit 5c91ba74b8

@ -5,7 +5,7 @@
using namespace MWRender;
template<typename T>
void insertObj(CellRenderImp& cellRender, const T& liveRef)
void insertObj(CellRenderImp& cellRender, T& liveRef)
{
assert (liveRef.base != NULL);
const std::string &model = liveRef.base->model;
@ -13,12 +13,12 @@ void insertObj(CellRenderImp& cellRender, const T& liveRef)
{
cellRender.insertBegin (liveRef.ref);
cellRender.insertMesh ("meshes\\" + model);
cellRender.insertEnd();
liveRef.mData.mHandle = cellRender.insertEnd();
}
}
template<>
void insertObj(CellRenderImp& cellRender, const ESMS::LiveCellRef<ESM::Light, OMW::RefData>& liveRef)
void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, OMW::RefData>& liveRef)
{
assert (liveRef.base != NULL);
const std::string &model = liveRef.base->model;
@ -36,21 +36,21 @@ void insertObj(CellRenderImp& cellRender, const ESMS::LiveCellRef<ESM::Light, OM
const float radius = float(liveRef.base->data.radius);
cellRender.insertLight(r, g, b, radius);
cellRender.insertEnd();
liveRef.mData.mHandle = cellRender.insertEnd();
}
}
template<typename T>
void insertCellRefList (CellRenderImp& cellRender, const T& cellRefList)
void insertCellRefList (CellRenderImp& cellRender, T& cellRefList)
{
for(typename T::List::const_iterator it = cellRefList.list.begin();
for(typename T::List::iterator it = cellRefList.list.begin();
it != cellRefList.list.end(); it++)
{
insertObj (cellRender, *it);
}
}
void CellRenderImp::insertCell(const ESMS::CellStore<OMW::RefData> &cell)
void CellRenderImp::insertCell(ESMS::CellStore<OMW::RefData> &cell)
{
// Loop through all references in the cell
insertCellRefList (*this, cell.activators);

@ -24,7 +24,7 @@ namespace MWRender
virtual ~CellRenderImp() {}
/// start inserting a new reference.
virtual void insertBegin (const ESM::CellRef &ref) = 0;
virtual void insertBegin (ESM::CellRef &ref) = 0;
/// insert a mesh related to the most recent insertBegin call.
virtual void insertMesh(const std::string &mesh) = 0;
@ -35,7 +35,7 @@ namespace MWRender
/// finish inserting a new reference and return a handle to it.
virtual std::string insertEnd() = 0;
void insertCell(const ESMS::CellStore<OMW::RefData> &cell);
void insertCell(ESMS::CellStore<OMW::RefData> &cell);
};
}

@ -27,7 +27,7 @@ bool InteriorCellRender::lightOutQuadInLin = false;
// start inserting a new reference.
void InteriorCellRender::insertBegin (const ESM::CellRef &ref)
void InteriorCellRender::insertBegin (ESM::CellRef &ref)
{
assert (!insert);

@ -42,7 +42,7 @@ namespace MWRender
static bool lightOutQuadInLin;
const ESMS::CellStore<OMW::RefData> &cell;
ESMS::CellStore<OMW::RefData> &cell;
MWScene &scene;
/// The scene node that contains all objects belonging to this
@ -57,7 +57,7 @@ namespace MWRender
Ogre::ColourValue ambientColor;
/// start inserting a new reference.
virtual void insertBegin (const ESM::CellRef &ref);
virtual void insertBegin (ESM::CellRef &ref);
/// insert a mesh related to the most recent insertBegin call.
virtual void insertMesh(const std::string &mesh);
@ -78,7 +78,7 @@ namespace MWRender
public:
InteriorCellRender(const ESMS::CellStore<OMW::RefData> &_cell, MWScene &_scene)
InteriorCellRender(ESMS::CellStore<OMW::RefData> &_cell, MWScene &_scene)
: cell(_cell), scene(_scene), base(NULL), insert(NULL), ambientMode (0) {}
virtual ~InteriorCellRender() { destroy(); }

@ -1,10 +1,13 @@
#ifndef REFDATA_H
#define REFDATA_H
#include <string>
namespace OMW
{
class RefData
struct RefData
{
std::string mHandle;
};

Loading…
Cancel
Save