Make insertBegin internal

This commit is contained in:
Chris Robinson 2013-08-07 03:51:57 -07:00
parent 2b2101958d
commit 076e7d8e16
18 changed files with 28 additions and 62 deletions

View file

@ -25,9 +25,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -30,9 +30,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -23,9 +23,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -27,9 +27,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -61,9 +61,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -29,9 +29,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -36,9 +36,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -26,18 +26,10 @@ namespace MWClass
{ {
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{ {
MWWorld::LiveCellRef<ESM::Light> *ref = const std::string model = getModel(ptr);
ptr.get<ESM::Light>(); if(!model.empty()) {
assert (ref->mBase != NULL); renderingInterface.getObjects().insertModel(ptr, model);
}
const std::string &model = ref->mBase->mModel;
MWRender::Objects& objects = renderingInterface.getObjects();
objects.insertBegin(ptr);
if(!model.empty())
objects.insertMesh(ptr, "meshes\\" + model);
else
objects.insertMesh(ptr, "");
} }
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const

View file

@ -26,9 +26,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -42,9 +42,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -28,9 +28,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -26,9 +26,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -25,9 +25,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -15,9 +15,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -33,9 +33,7 @@ namespace MWClass
{ {
const std::string model = getModel(ptr); const std::string model = getModel(ptr);
if (!model.empty()) { if (!model.empty()) {
MWRender::Objects& objects = renderingInterface.getObjects(); renderingInterface.getObjects().insertModel(ptr, model);
objects.insertBegin(ptr);
objects.insertMesh(ptr, model);
} }
} }

View file

@ -27,6 +27,8 @@ namespace MWRender
CellSceneNodeMap mCellSceneNodes; CellSceneNodeMap mCellSceneNodes;
PtrAnimationMap mAllActors; PtrAnimationMap mAllActors;
void insertBegin(const MWWorld::Ptr &ptr);
public: public:
Actors(OEngine::Render::OgreRenderer& _rend, MWRender::RenderingManager* rendering) Actors(OEngine::Render::OgreRenderer& _rend, MWRender::RenderingManager* rendering)
: mRend(_rend) : mRend(_rend)
@ -36,7 +38,7 @@ namespace MWRender
~Actors(); ~Actors();
void setRootNode(Ogre::SceneNode* root); void setRootNode(Ogre::SceneNode* root);
void insertBegin (const MWWorld::Ptr& ptr);
void insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv); void insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv);
void insertCreature (const MWWorld::Ptr& ptr); void insertCreature (const MWWorld::Ptr& ptr);
void insertActivator (const MWWorld::Ptr& ptr); void insertActivator (const MWWorld::Ptr& ptr);

View file

@ -69,16 +69,15 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr)
ptr.getRefData().setBaseNode(insert); ptr.getRefData().setBaseNode(insert);
} }
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh)
{ {
Ogre::SceneNode* insert = ptr.getRefData().getBaseNode(); insertBegin(ptr);
assert(insert);
std::auto_ptr<ObjectAnimation> anim(new ObjectAnimation(ptr, mesh)); std::auto_ptr<ObjectAnimation> anim(new ObjectAnimation(ptr, mesh));
Ogre::AxisAlignedBox bounds = anim->getWorldBounds(); Ogre::AxisAlignedBox bounds = anim->getWorldBounds();
Ogre::Vector3 extents = bounds.getSize(); Ogre::Vector3 extents = bounds.getSize();
extents *= insert->getScale(); extents *= ptr.getRefData().getBaseNode()->getScale();
float size = std::max(std::max(extents.x, extents.y), extents.z); float size = std::max(std::max(extents.x, extents.y), extents.z);
bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) &&

View file

@ -31,14 +31,15 @@ class Objects{
static int uniqueID; static int uniqueID;
void insertBegin(const MWWorld::Ptr& ptr);
public: public:
Objects(OEngine::Render::OgreRenderer &renderer) Objects(OEngine::Render::OgreRenderer &renderer)
: mRenderer(renderer) : mRenderer(renderer)
, mRootNode(NULL) , mRootNode(NULL)
{} {}
~Objects(){} ~Objects(){}
void insertBegin (const MWWorld::Ptr& ptr); void insertModel(const MWWorld::Ptr& ptr, const std::string &model);
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
void enableLights(); void enableLights();
void disableLights(); void disableLights();