forked from teamnwah/openmw-tes3coop
Changes to insertObjectRendering; Proposed insertObject
This commit is contained in:
parent
1faa07b279
commit
042bceb547
6 changed files with 39 additions and 1 deletions
|
@ -21,13 +21,29 @@ namespace MWClass
|
|||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
MWRender::Objects objects = renderingInterface.getObjects();
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
MWRender::Objects objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, true, false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
}
|
||||
}
|
||||
|
||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
std::string handle = ptr.getRefData().getHandle();
|
||||
if(!handle.empty()){
|
||||
physics.insertObjectPhysics(handle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace MWClass
|
|||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
|
|
|
@ -24,6 +24,9 @@ namespace MWWorld
|
|||
void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
|
||||
}
|
||||
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const{
|
||||
|
||||
}
|
||||
|
||||
void Class::enable (const Ptr& ptr, MWWorld::Environment& environment) const
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "containerstore.hpp"
|
||||
#include "refdata.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "physicssystem.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
|
@ -63,6 +64,7 @@ namespace MWWorld
|
|||
|
||||
|
||||
virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||
|
||||
virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const;
|
||||
|
|
|
@ -183,4 +183,15 @@ namespace MWWorld
|
|||
throw std::logic_error ("can't find player");
|
||||
}
|
||||
|
||||
void PhysicsSystem::insertObjectPhysics(const std::string& handle){
|
||||
Ogre::SceneNode* node = mRender.getScene()->getSceneNode(handle);
|
||||
addObject (handle, handle, node->getOrientation(),
|
||||
node->getScale().x, node->getPosition());
|
||||
}
|
||||
|
||||
void PhysicsSystem::insertActorPhysics(const std::string& handle){
|
||||
Ogre::SceneNode* node = mRender.getScene()->getSceneNode(handle);
|
||||
addActor (handle, handle, node->getPosition());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,10 @@ namespace MWWorld
|
|||
bool toggleCollisionMode();
|
||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||
|
||||
void insertObjectPhysics(const std::string& handle);
|
||||
|
||||
void insertActorPhysics(const std::string& handle);
|
||||
|
||||
private:
|
||||
OEngine::Render::OgreRenderer &mRender;
|
||||
OEngine::Physic::PhysicEngine* mEngine;
|
||||
|
|
Loading…
Reference in a new issue