mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 10:53:51 +00:00
Made some recommended changes
This commit is contained in:
parent
042bceb547
commit
f4e7bd6dfd
10 changed files with 24 additions and 20 deletions
|
@ -36,7 +36,7 @@ namespace MWClass
|
||||||
MWRender::Rendering rendering (cellRender, ref->ref, ref->mData);
|
MWRender::Rendering rendering (cellRender, ref->ref, ref->mData);
|
||||||
cellRender.insertMesh("meshes\\" + model);
|
cellRender.insertMesh("meshes\\" + model);
|
||||||
cellRender.insertActorPhysics();
|
cellRender.insertActorPhysics();
|
||||||
ref->mData.setHandle (rendering.end (ref->mData.isEnabled()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,14 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Tool>();
|
ptr.get<ESM::Tool>();
|
||||||
|
|
||||||
assert (ref->base != NULL);
|
assert (ref->base != NULL);
|
||||||
std::string handle = ptr.getRefData().getHandle();
|
if(ptr.getRefData().getBaseNode()){
|
||||||
if(!handle.empty()){
|
physics.insertObjectPhysics(ptr);
|
||||||
physics.insertObjectPhysics(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ 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 void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) 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);
|
||||||
|
|
|
@ -85,10 +85,10 @@ MWRender::Player& RenderingManager::getPlayer(){
|
||||||
void RenderingManager::removeCell (MWWorld::Ptr::CellStore *store){
|
void RenderingManager::removeCell (MWWorld::Ptr::CellStore *store){
|
||||||
|
|
||||||
}
|
}
|
||||||
void RenderingManager::addObject (const MWWorld::Ptr& ptr, MWWorld::Ptr::CellStore *store){
|
void RenderingManager::addObject (const MWWorld::Ptr& ptr){
|
||||||
|
|
||||||
}
|
}
|
||||||
void RenderingManager::removeObject (const MWWorld::Ptr& ptr, MWWorld::Ptr::CellStore *store){
|
void RenderingManager::removeObject (const MWWorld::Ptr& ptr){
|
||||||
|
|
||||||
}
|
}
|
||||||
void RenderingManager::moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position){
|
void RenderingManager::moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position){
|
||||||
|
|
|
@ -57,12 +57,14 @@ class RenderingManager: private RenderingInterface {
|
||||||
|
|
||||||
void removeCell (MWWorld::Ptr::CellStore *store); // TODO do we want this?
|
void removeCell (MWWorld::Ptr::CellStore *store); // TODO do we want this?
|
||||||
|
|
||||||
void addObject (const MWWorld::Ptr& ptr, MWWorld::Ptr::CellStore *store);
|
void addObject (const MWWorld::Ptr& ptr);
|
||||||
void removeObject (const MWWorld::Ptr& ptr, MWWorld::Ptr::CellStore *store);
|
void removeObject (const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
|
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
|
||||||
void scaleObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& scale);
|
void scaleObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& scale);
|
||||||
void rotateObject (const MWWorld::Ptr& ptr, const::Ogre::Quaternion& orientation);
|
void rotateObject (const MWWorld::Ptr& ptr, const::Ogre::Quaternion& orientation);
|
||||||
|
|
||||||
|
/// \param store Cell the object was in previously (\a ptr has already been updated to the new cell).
|
||||||
void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store);
|
void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store);
|
||||||
|
|
||||||
void setPhysicsDebugRendering (bool);
|
void setPhysicsDebugRendering (bool);
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const{
|
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +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;
|
virtual void insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) 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,15 +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){
|
void PhysicsSystem::insertObjectPhysics(const MWWorld::Ptr& ptr){
|
||||||
Ogre::SceneNode* node = mRender.getScene()->getSceneNode(handle);
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
addObject (handle, handle, node->getOrientation(),
|
addObject (node->getName(), node->getName(), node->getOrientation(),
|
||||||
node->getScale().x, node->getPosition());
|
node->getScale().x, node->getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSystem::insertActorPhysics(const std::string& handle){
|
void PhysicsSystem::insertActorPhysics(const MWWorld::Ptr& ptr){
|
||||||
Ogre::SceneNode* node = mRender.getScene()->getSceneNode(handle);
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
addActor (handle, handle, node->getPosition());
|
addActor (node->getName(), node->getName(), node->getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ 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 insertObjectPhysics(const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
void insertActorPhysics(const std::string& handle);
|
void insertActorPhysics(const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer &mRender;
|
OEngine::Render::OgreRenderer &mRender;
|
||||||
|
|
|
@ -55,6 +55,9 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
return mBaseNode->getName();
|
return mBaseNode->getName();
|
||||||
}
|
}
|
||||||
|
Ogre::SceneNode* getBaseNode(){
|
||||||
|
return mBaseNode;
|
||||||
|
}
|
||||||
void setBaseNode(Ogre::SceneNode* base){
|
void setBaseNode(Ogre::SceneNode* base){
|
||||||
mBaseNode = base;
|
mBaseNode = base;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue