mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:06:43 +00:00
extended CellRender::show to show all types instead of only statics
This commit is contained in:
parent
f3d7f2e25a
commit
abbdffa0a1
2 changed files with 46 additions and 31 deletions
|
@ -9,10 +9,8 @@ using namespace Ogre;
|
||||||
using namespace ESMS;
|
using namespace ESMS;
|
||||||
|
|
||||||
// Inserts one mesh into the scene
|
// Inserts one mesh into the scene
|
||||||
static void insertObj(SceneNode *base, // Parent scene node
|
void CellRender::insertMesh(const std::string mesh, // NIF file
|
||||||
SceneManager *mgr, // Scene manager
|
const CellRef &ref) // Reference information
|
||||||
const std::string mesh, // NIF file
|
|
||||||
const CellRef &ref) // Reference information
|
|
||||||
{
|
{
|
||||||
// Create and place scene node for this object
|
// Create and place scene node for this object
|
||||||
SceneNode *node = base->createChildSceneNode();
|
SceneNode *node = base->createChildSceneNode();
|
||||||
|
@ -38,7 +36,7 @@ static void insertObj(SceneNode *base, // Parent scene node
|
||||||
|
|
||||||
// Finally, load the NIF mesh and attach it to the node
|
// Finally, load the NIF mesh and attach it to the node
|
||||||
NIFLoader::load(mesh);
|
NIFLoader::load(mesh);
|
||||||
MovableObject *ent = mgr->createEntity(mesh);
|
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||||
node->attachObject(ent);
|
node->attachObject(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,32 +51,27 @@ void CellRender::show()
|
||||||
|
|
||||||
base = scene.getRoot()->createChildSceneNode();
|
base = scene.getRoot()->createChildSceneNode();
|
||||||
|
|
||||||
// Loop through all statics in the cell
|
// Loop through all references in the cell
|
||||||
CellRefList<Static>::List::const_iterator it;
|
insertCellRefList (cell.activators);
|
||||||
for(it = cell.statics.list.begin();
|
insertCellRefList (cell.potions);
|
||||||
it != cell.statics.list.end();
|
insertCellRefList (cell.appas);
|
||||||
it++)
|
insertCellRefList (cell.armors);
|
||||||
{
|
insertCellRefList (cell.books);
|
||||||
assert(it->base != NULL);
|
insertCellRefList (cell.clothes);
|
||||||
insertObj(base, scene.getMgr(),
|
insertCellRefList (cell.containers);
|
||||||
"meshes\\" + it->base->model,
|
insertCellRefList (cell.creatures);
|
||||||
it->ref);
|
insertCellRefList (cell.doors);
|
||||||
}
|
insertCellRefList (cell.ingreds);
|
||||||
|
// insertCellRefList (cell.creatureLists);
|
||||||
/*
|
// insertCellRefList (cell.itemLists);
|
||||||
// Containers
|
insertCellRefList (cell.lights);
|
||||||
CellRefList<Container>::List::const_iterator it;
|
insertCellRefList (cell.lockpicks);
|
||||||
|
insertCellRefList (cell.miscItems);
|
||||||
for(it = cell.containers.list.begin();
|
insertCellRefList (cell.npcs);
|
||||||
it != cell.containers.list.end();
|
insertCellRefList (cell.probes);
|
||||||
it++)
|
insertCellRefList (cell.repairs);
|
||||||
{
|
insertCellRefList (cell.statics);
|
||||||
assert(it->base != NULL);
|
insertCellRefList (cell.weapons);
|
||||||
|
|
||||||
cout << "refID = " << it->ref.refID << " x" << it->ref.scale << endl;
|
|
||||||
cout << "flags = " << it->base->flags << endl;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellRender::hide()
|
void CellRender::hide()
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _GAME_RENDER_CELL_H
|
#ifndef _GAME_RENDER_CELL_H
|
||||||
#define _GAME_RENDER_CELL_H
|
#define _GAME_RENDER_CELL_H
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include "esm_store/cell_store.hpp"
|
#include "esm_store/cell_store.hpp"
|
||||||
#include "mwscene.hpp"
|
#include "mwscene.hpp"
|
||||||
|
|
||||||
|
@ -22,6 +24,26 @@ namespace MWRender
|
||||||
/// cell.
|
/// cell.
|
||||||
Ogre::SceneNode *base;
|
Ogre::SceneNode *base;
|
||||||
|
|
||||||
|
void insertMesh(const std::string mesh, // NIF file
|
||||||
|
const ESMS::CellRef &ref); // Reference information
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void insertObj(const T& liveRef)
|
||||||
|
{
|
||||||
|
assert (liveRef.base != NULL);
|
||||||
|
insertMesh ("meshes\\" + liveRef.base->model, liveRef.ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void insertCellRefList (const T& cellRefList)
|
||||||
|
{
|
||||||
|
for(typename T::List::const_iterator it = cellRefList.list.begin();
|
||||||
|
it != cellRefList.list.end(); it++)
|
||||||
|
{
|
||||||
|
insertObj (*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CellRender(const ESMS::CellStore &_cell,
|
CellRender(const ESMS::CellStore &_cell,
|
||||||
MWScene &_scene)
|
MWScene &_scene)
|
||||||
|
|
Loading…
Reference in a new issue