mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
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);
|
assert (ref->base != NULL);
|
||||||
const std::string &model = ref->base->model;
|
const std::string &model = ref->base->model;
|
||||||
MWRender::Objects objects = renderingInterface.getObjects();
|
|
||||||
if (!model.empty())
|
if (!model.empty())
|
||||||
{
|
{
|
||||||
|
MWRender::Objects objects = renderingInterface.getObjects();
|
||||||
|
objects.insertBegin(ptr, true, false);
|
||||||
objects.insertMesh(ptr, "meshes\\" + model);
|
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
|
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace MWClass
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
///< Add reference into a cell for rendering
|
///< 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;
|
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);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -24,6 +24,9 @@ namespace MWWorld
|
||||||
void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
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
|
void Class::enable (const Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "containerstore.hpp"
|
#include "containerstore.hpp"
|
||||||
#include "refdata.hpp"
|
#include "refdata.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
#include "physicssystem.hpp"
|
||||||
|
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
{
|
{
|
||||||
|
@ -63,6 +64,7 @@ namespace MWWorld
|
||||||
|
|
||||||
|
|
||||||
virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
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).
|
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||||
|
|
||||||
virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const;
|
virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
|
|
@ -183,4 +183,15 @@ namespace MWWorld
|
||||||
throw std::logic_error ("can't find player");
|
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();
|
bool toggleCollisionMode();
|
||||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||||
|
|
||||||
|
void insertObjectPhysics(const std::string& handle);
|
||||||
|
|
||||||
|
void insertActorPhysics(const std::string& handle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer &mRender;
|
OEngine::Render::OgreRenderer &mRender;
|
||||||
OEngine::Physic::PhysicEngine* mEngine;
|
OEngine::Physic::PhysicEngine* mEngine;
|
||||||
|
|
Loading…
Reference in a new issue