mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Rewrite animated collision shape support (Fixes #2123)
This commit is contained in:
parent
4ed3e7bbb7
commit
41b3a9dba9
60 changed files with 287 additions and 230 deletions
|
@ -31,20 +31,18 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Activator>()->mBase->mId;
|
return ptr.get<ESM::Activator>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
MWRender::Actors& actors = renderingInterface.getActors();
|
||||||
actors.insertActivator(ptr);
|
actors.insertActivator(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Activator::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -26,19 +26,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Apparatus>()->mBase->mId;
|
return ptr.get<ESM::Apparatus>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Apparatus::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -18,10 +18,10 @@ namespace MWClass
|
||||||
|
|
||||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -31,19 +31,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Armor>()->mBase->mId;
|
return ptr.get<ESM::Armor>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Armor::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -17,10 +17,10 @@ namespace MWClass
|
||||||
|
|
||||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -28,19 +28,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Book>()->mBase->mId;
|
return ptr.get<ESM::Book>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Book::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -28,19 +28,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Clothing>()->mBase->mId;
|
return ptr.get<ESM::Clothing>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Clothing::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -85,20 +85,18 @@ namespace MWClass
|
||||||
store.restock(list, ptr, ptr.getCellRef().getOwner(), ptr.getCellRef().getFaction(), ptr.getCellRef().getFactionRank());
|
store.restock(list, ptr, ptr.getCellRef().getOwner(), ptr.getCellRef().getFaction(), ptr.getCellRef().getFactionRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
MWRender::Actors& actors = renderingInterface.getActors();
|
||||||
actors.insertActivator(ptr);
|
actors.insertActivator(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Container::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -160,20 +160,19 @@ namespace MWClass
|
||||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
MWRender::Actors& actors = renderingInterface.getActors();
|
||||||
actors.insertCreature(ptr, ref->mBase->mFlags & ESM::Creature::Weapon);
|
actors.insertCreature(ptr, model, ref->mBase->mFlags & ESM::Creature::Weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Creature::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
physics.addActor(ptr);
|
physics.addActor(ptr, model);
|
||||||
if (getCreatureStats(ptr).isDead())
|
if (getCreatureStats(ptr).isDead())
|
||||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,10 @@ namespace MWClass
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< Return ID of \a ptr
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
///< Adjust position to stand on ground. Must be called post model load
|
///< Adjust position to stand on ground. Must be called post model load
|
||||||
|
|
|
@ -49,20 +49,18 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Door>()->mBase->mId;
|
return ptr.get<ESM::Door>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
MWRender::Actors& actors = renderingInterface.getActors();
|
||||||
actors.insertActivator(ptr);
|
actors.insertActivator(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Door::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
|
|
||||||
// Resume the door's opening/closing animation if it wasn't finished
|
// Resume the door's opening/closing animation if it wasn't finished
|
||||||
if (ptr.getRefData().getCustomData())
|
if (ptr.getRefData().getCustomData())
|
||||||
|
|
|
@ -19,10 +19,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -32,19 +32,17 @@ namespace MWClass
|
||||||
return ref->mBase->mId;
|
return ref->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Ingredient::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< Return ID of \a ptr
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -54,26 +54,24 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Light>()->mBase->mId;
|
return ptr.get<ESM::Light>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
// Insert even if model is empty, so that the light is added
|
// Insert even if model is empty, so that the light is added
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
MWRender::Actors& actors = renderingInterface.getActors();
|
||||||
actors.insertActivator(ptr, !(ref->mBase->mData.mFlags & ESM::Light::OffDefault));
|
actors.insertActivator(ptr, model, !(ref->mBase->mData.mFlags & ESM::Light::OffDefault));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Light::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
assert (ref->mBase != NULL);
|
assert (ref->mBase != NULL);
|
||||||
|
|
||||||
const std::string &model = ref->mBase->mModel;
|
|
||||||
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,ref->mBase->mData.mFlags & ESM::Light::Carry);
|
physics.addObject(ptr, model, ref->mBase->mData.mFlags & ESM::Light::Carry);
|
||||||
|
|
||||||
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
|
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
||||||
|
|
|
@ -17,10 +17,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -27,19 +27,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Lockpick>()->mBase->mId;
|
return ptr.get<ESM::Lockpick>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Lockpick::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -43,19 +43,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Miscellaneous>()->mBase->mId;
|
return ptr.get<ESM::Miscellaneous>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -428,14 +428,14 @@ namespace MWClass
|
||||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
renderingInterface.getActors().insertNPC(ptr);
|
renderingInterface.getActors().insertNPC(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Npc::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
physics.addActor(ptr);
|
physics.addActor(ptr, model);
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
if (getCreatureStats(ptr).isDead())
|
if (getCreatureStats(ptr).isDead())
|
||||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||||
|
|
|
@ -50,10 +50,10 @@ namespace MWClass
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< Return ID of \a ptr
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
///< Adjust position to stand on ground. Must be called post model load
|
///< Adjust position to stand on ground. Must be called post model load
|
||||||
|
|
|
@ -30,19 +30,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Potion>()->mBase->mId;
|
return ptr.get<ESM::Potion>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Potion::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -27,19 +27,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Probe>()->mBase->mId;
|
return ptr.get<ESM::Probe>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Probe::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -26,19 +26,17 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Repair>()->mBase->mId;
|
return ptr.get<ESM::Repair>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Repair::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -17,22 +17,20 @@ namespace MWClass
|
||||||
return ptr.get<ESM::Static>()->mBase->mId;
|
return ptr.get<ESM::Static>()->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||||
ptr.get<ESM::Static>();
|
ptr.get<ESM::Static>();
|
||||||
|
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model, !ref->mBase->mPersistent);
|
renderingInterface.getObjects().insertModel(ptr, model, !ref->mBase->mPersistent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -30,19 +30,17 @@ namespace MWClass
|
||||||
return ref->mBase->mId;
|
return ref->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
renderingInterface.getObjects().insertModel(ptr, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Weapon::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< Return ID of \a ptr
|
||||||
|
|
||||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, 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, const std::string& model, 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);
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
|
|
||||||
#include <components/esm/loadacti.hpp>
|
#include <components/esm/loadacti.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
|
||||||
|
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
|
@ -18,11 +14,9 @@ ActivatorAnimation::~ActivatorAnimation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||||
{
|
{
|
||||||
const std::string& model = mPtr.getClass().getModel(mPtr);
|
|
||||||
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
setObjectRoot(model, false);
|
setObjectRoot(model, false);
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace MWRender
|
||||||
class ActivatorAnimation : public Animation
|
class ActivatorAnimation : public Animation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActivatorAnimation(const MWWorld::Ptr& ptr);
|
ActivatorAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
virtual ~ActivatorAnimation();
|
virtual ~ActivatorAnimation();
|
||||||
|
|
||||||
void addLight(const ESM::Light *light);
|
void addLight(const ESM::Light *light);
|
||||||
|
|
|
@ -71,22 +71,22 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr)
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
mRendering->addWaterRippleEmitter (ptr);
|
mRendering->addWaterRippleEmitter (ptr);
|
||||||
}
|
}
|
||||||
void Actors::insertCreature (const MWWorld::Ptr& ptr, bool weaponsShields)
|
void Actors::insertCreature (const MWWorld::Ptr& ptr, const std::string &model, bool weaponsShields)
|
||||||
{
|
{
|
||||||
insertBegin(ptr);
|
insertBegin(ptr);
|
||||||
Animation* anim = NULL;
|
Animation* anim = NULL;
|
||||||
if (weaponsShields)
|
if (weaponsShields)
|
||||||
anim = new CreatureWeaponAnimation(ptr);
|
anim = new CreatureWeaponAnimation(ptr, model);
|
||||||
else
|
else
|
||||||
anim = new CreatureAnimation(ptr);
|
anim = new CreatureAnimation(ptr, model);
|
||||||
delete mAllActors[ptr];
|
delete mAllActors[ptr];
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
mRendering->addWaterRippleEmitter (ptr);
|
mRendering->addWaterRippleEmitter (ptr);
|
||||||
}
|
}
|
||||||
void Actors::insertActivator (const MWWorld::Ptr& ptr, bool addLight)
|
void Actors::insertActivator (const MWWorld::Ptr& ptr, const std::string &model, bool addLight)
|
||||||
{
|
{
|
||||||
insertBegin(ptr);
|
insertBegin(ptr);
|
||||||
ActivatorAnimation* anim = new ActivatorAnimation(ptr);
|
ActivatorAnimation* anim = new ActivatorAnimation(ptr, model);
|
||||||
|
|
||||||
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace MWRender
|
||||||
void setRootNode(Ogre::SceneNode* root);
|
void setRootNode(Ogre::SceneNode* root);
|
||||||
|
|
||||||
void insertNPC(const MWWorld::Ptr& ptr);
|
void insertNPC(const MWWorld::Ptr& ptr);
|
||||||
void insertCreature (const MWWorld::Ptr& ptr, bool weaponsShields);
|
void insertCreature (const MWWorld::Ptr& ptr, const std::string& model, bool weaponsShields);
|
||||||
void insertActivator (const MWWorld::Ptr& ptr, bool addLight=false);
|
void insertActivator (const MWWorld::Ptr& ptr, const std::string& model, bool addLight=false);
|
||||||
bool deleteObject (const MWWorld::Ptr& ptr);
|
bool deleteObject (const MWWorld::Ptr& ptr);
|
||||||
///< \return found?
|
///< \return found?
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,12 @@ Animation::~Animation()
|
||||||
mAnimSources.clear();
|
mAnimSources.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Animation::getObjectRootName() const
|
||||||
|
{
|
||||||
|
if (mSkelBase)
|
||||||
|
return mSkelBase->getMesh()->getName();
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
void Animation::setObjectRoot(const std::string &model, bool baseonly)
|
void Animation::setObjectRoot(const std::string &model, bool baseonly)
|
||||||
{
|
{
|
||||||
|
@ -97,22 +103,8 @@ void Animation::setObjectRoot(const std::string &model, bool baseonly)
|
||||||
if(model.empty())
|
if(model.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string mdlname = Misc::StringUtils::lowerCase(model);
|
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, model) :
|
||||||
std::string::size_type p = mdlname.rfind('\\');
|
NifOgre::Loader::createObjectBase(mInsert, model));
|
||||||
if(p == std::string::npos)
|
|
||||||
p = mdlname.rfind('/');
|
|
||||||
if(p != std::string::npos)
|
|
||||||
mdlname.insert(mdlname.begin()+p+1, 'x');
|
|
||||||
else
|
|
||||||
mdlname.insert(mdlname.begin(), 'x');
|
|
||||||
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(mdlname))
|
|
||||||
{
|
|
||||||
mdlname = model;
|
|
||||||
Misc::StringUtils::toLower(mdlname);
|
|
||||||
}
|
|
||||||
|
|
||||||
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, mdlname) :
|
|
||||||
NifOgre::Loader::createObjectBase(mInsert, mdlname));
|
|
||||||
|
|
||||||
if(mObjectRoot->mSkelBase)
|
if(mObjectRoot->mSkelBase)
|
||||||
{
|
{
|
||||||
|
@ -255,14 +247,8 @@ void Animation::addAnimSource(const std::string &model)
|
||||||
if(!mSkelBase)
|
if(!mSkelBase)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string kfname = Misc::StringUtils::lowerCase(model);
|
std::string kfname = model;
|
||||||
std::string::size_type p = kfname.rfind('\\');
|
Misc::StringUtils::toLower(kfname);
|
||||||
if(p == std::string::npos)
|
|
||||||
p = kfname.rfind('/');
|
|
||||||
if(p != std::string::npos)
|
|
||||||
kfname.insert(kfname.begin()+p+1, 'x');
|
|
||||||
else
|
|
||||||
kfname.insert(kfname.begin(), 'x');
|
|
||||||
|
|
||||||
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
||||||
kfname.replace(kfname.size()-4, 4, ".kf");
|
kfname.replace(kfname.size()-4, 4, ".kf");
|
||||||
|
@ -417,7 +403,7 @@ void Animation::addExtraLight(Ogre::SceneManager *sceneMgr, NifOgre::ObjectScene
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ogre::Node *Animation::getNode(const std::string &name)
|
Ogre::Node* Animation::getNode(const std::string &name)
|
||||||
{
|
{
|
||||||
if(mSkelBase)
|
if(mSkelBase)
|
||||||
{
|
{
|
||||||
|
@ -428,6 +414,16 @@ Ogre::Node *Animation::getNode(const std::string &name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ogre::Node* Animation::getNode(int handle)
|
||||||
|
{
|
||||||
|
if (mSkelBase)
|
||||||
|
{
|
||||||
|
Ogre::SkeletonInstance *skel = mSkelBase->getSkeleton();
|
||||||
|
return skel->getBone(handle);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
||||||
{
|
{
|
||||||
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
||||||
|
|
|
@ -206,6 +206,9 @@ public:
|
||||||
Ogre::uint8 transqueue, Ogre::Real dist=0.0f,
|
Ogre::uint8 transqueue, Ogre::Real dist=0.0f,
|
||||||
bool enchantedGlow=false, Ogre::Vector3* glowColor=NULL);
|
bool enchantedGlow=false, Ogre::Vector3* glowColor=NULL);
|
||||||
|
|
||||||
|
/// Returns the name of the .nif file that makes up this animation's base skeleton.
|
||||||
|
/// If there is no skeleton, returns "".
|
||||||
|
std::string getObjectRootName() const;
|
||||||
|
|
||||||
Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node);
|
Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node);
|
||||||
virtual ~Animation();
|
virtual ~Animation();
|
||||||
|
@ -334,6 +337,7 @@ public:
|
||||||
Ogre::AxisAlignedBox getWorldBounds();
|
Ogre::AxisAlignedBox getWorldBounds();
|
||||||
|
|
||||||
Ogre::Node *getNode(const std::string &name);
|
Ogre::Node *getNode(const std::string &name);
|
||||||
|
Ogre::Node *getNode(int handle);
|
||||||
|
|
||||||
// Attaches the given object to a bone on this object's base skeleton. If the bone doesn't
|
// Attaches the given object to a bone on this object's base skeleton. If the bone doesn't
|
||||||
// exist, the object isn't attached and NULL is returned. The returned TagPoint is only
|
// exist, the object isn't attached and NULL is returned. The returned TagPoint is only
|
||||||
|
|
|
@ -16,39 +16,37 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||||
|
|
||||||
std::string model = ptr.getClass().getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
setObjectRoot(model, false);
|
setObjectRoot(model, false);
|
||||||
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
||||||
|
|
||||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||||
addAnimSource("meshes\\base_anim.nif");
|
addAnimSource("meshes\\xbase_anim.nif");
|
||||||
addAnimSource(model);
|
addAnimSource(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr)
|
CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||||
, mShowWeapons(false)
|
, mShowWeapons(false)
|
||||||
, mShowCarriedLeft(false)
|
, mShowCarriedLeft(false)
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||||
|
|
||||||
std::string model = ptr.getClass().getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
setObjectRoot(model, false);
|
setObjectRoot(model, false);
|
||||||
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
||||||
|
|
||||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||||
addAnimSource("meshes\\base_anim.nif");
|
addAnimSource("meshes\\xbase_anim.nif");
|
||||||
addAnimSource(model);
|
addAnimSource(model);
|
||||||
|
|
||||||
mPtr.getClass().getInventoryStore(mPtr).setListener(this, mPtr);
|
mPtr.getClass().getInventoryStore(mPtr).setListener(this, mPtr);
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace MWRender
|
||||||
class CreatureAnimation : public Animation
|
class CreatureAnimation : public Animation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreatureAnimation(const MWWorld::Ptr& ptr);
|
CreatureAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
virtual ~CreatureAnimation() {}
|
virtual ~CreatureAnimation() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace MWRender
|
||||||
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
|
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreatureWeaponAnimation(const MWWorld::Ptr& ptr);
|
CreatureWeaponAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
virtual ~CreatureWeaponAnimation() {}
|
virtual ~CreatureWeaponAnimation() {}
|
||||||
|
|
||||||
virtual void equipmentChanged() { updateParts(); }
|
virtual void equipmentChanged() { updateParts(); }
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include <extern/shiny/Main/Factory.hpp>
|
#include <extern/shiny/Main/Factory.hpp>
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
@ -282,6 +284,7 @@ void NpcAnimation::updateNpcBase()
|
||||||
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
||||||
: "meshes\\base_animkna.1st.nif"
|
: "meshes\\base_animkna.1st.nif"
|
||||||
: "meshes\\wolf\\skin.1st.nif");
|
: "meshes\\wolf\\skin.1st.nif");
|
||||||
|
smodel = Misc::ResourceHelpers::correctActorModelPath(smodel);
|
||||||
setObjectRoot(smodel, true);
|
setObjectRoot(smodel, true);
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
if(mViewMode != VM_FirstPerson)
|
||||||
|
@ -290,11 +293,11 @@ void NpcAnimation::updateNpcBase()
|
||||||
if(!isWerewolf)
|
if(!isWerewolf)
|
||||||
{
|
{
|
||||||
if(Misc::StringUtils::lowerCase(mNpc->mRace).find("argonian") != std::string::npos)
|
if(Misc::StringUtils::lowerCase(mNpc->mRace).find("argonian") != std::string::npos)
|
||||||
addAnimSource("meshes\\argonian_swimkna.nif");
|
addAnimSource("meshes\\xargonian_swimkna.nif");
|
||||||
else if(!mNpc->isMale() && !isBeast)
|
else if(!mNpc->isMale() && !isBeast)
|
||||||
addAnimSource("meshes\\base_anim_female.nif");
|
addAnimSource("meshes\\xbase_anim_female.nif");
|
||||||
if(mNpc->mModel.length() > 0)
|
if(mNpc->mModel.length() > 0)
|
||||||
addAnimSource("meshes\\"+mNpc->mModel);
|
addAnimSource("meshes\\x"+mNpc->mModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -306,11 +309,11 @@ void NpcAnimation::updateNpcBase()
|
||||||
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
||||||
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
||||||
*/
|
*/
|
||||||
addAnimSource("meshes\\base_anim.1st.nif");
|
addAnimSource("meshes\\xbase_anim.1st.nif");
|
||||||
if(isBeast)
|
if(isBeast)
|
||||||
addAnimSource("meshes\\base_animkna.1st.nif");
|
addAnimSource("meshes\\xbase_animkna.1st.nif");
|
||||||
if(!mNpc->isMale() && !isBeast)
|
if(!mNpc->isMale() && !isBeast)
|
||||||
addAnimSource("meshes\\base_anim_female.1st.nif");
|
addAnimSource("meshes\\xbase_anim_female.1st.nif");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,10 +256,10 @@ void RenderingManager::cellAdded (MWWorld::CellStore *store)
|
||||||
mDebugging->cellAdded(store);
|
mDebugging->cellAdded(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::addObject (const MWWorld::Ptr& ptr){
|
void RenderingManager::addObject (const MWWorld::Ptr& ptr, const std::string& model){
|
||||||
const MWWorld::Class& class_ =
|
const MWWorld::Class& class_ =
|
||||||
ptr.getClass();
|
ptr.getClass();
|
||||||
class_.insertObjectRendering(ptr, *this);
|
class_.insertObjectRendering(ptr, model, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::removeObject (const MWWorld::Ptr& ptr)
|
void RenderingManager::removeObject (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
/// Write current fog of war for this cell to the CellStore
|
/// Write current fog of war for this cell to the CellStore
|
||||||
void writeFog (MWWorld::CellStore* store);
|
void writeFog (MWWorld::CellStore* store);
|
||||||
|
|
||||||
void addObject (const MWWorld::Ptr& ptr);
|
void addObject (const MWWorld::Ptr& ptr, const std::string& model);
|
||||||
void removeObject (const MWWorld::Ptr& ptr);
|
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);
|
||||||
|
|
|
@ -38,12 +38,12 @@ namespace MWWorld
|
||||||
throw std::runtime_error ("class does not support ID retrieval");
|
throw std::runtime_error ("class does not support ID retrieval");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Class::insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
void Class::insertObject(const Ptr& ptr, const std::string& mesh, MWWorld::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ namespace MWWorld
|
||||||
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
|
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||||
/// (default implementation: throw an exception)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
virtual void insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
virtual void insertObject(const Ptr& ptr, const std::string& mesh, 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 std::string getName (const Ptr& ptr) const = 0;
|
virtual std::string getName (const Ptr& ptr) const = 0;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <openengine/bullet/BulletShapeLoader.h>
|
#include <openengine/bullet/BulletShapeLoader.h>
|
||||||
|
|
||||||
#include <components/nifbullet/bulletnifloader.hpp>
|
#include <components/nifbullet/bulletnifloader.hpp>
|
||||||
|
#include <components/nifogre/skeleton.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadgmst.hpp>
|
#include <components/esm/loadgmst.hpp>
|
||||||
|
|
||||||
|
@ -51,25 +53,22 @@ void animateCollisionShapes (std::map<OEngine::Physic::RigidBody*, OEngine::Phys
|
||||||
throw std::runtime_error("can't find Ptr");
|
throw std::runtime_error("can't find Ptr");
|
||||||
|
|
||||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
|
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
|
||||||
if (!animation) // Shouldn't happen either, since keyframe-controlled objects are not batched in StaticGeometry
|
if (!animation)
|
||||||
throw std::runtime_error("can't find Animation for " + ptr.getCellRef().getRefId());
|
continue;
|
||||||
|
|
||||||
OEngine::Physic::AnimatedShapeInstance& instance = it->second;
|
OEngine::Physic::AnimatedShapeInstance& instance = it->second;
|
||||||
|
|
||||||
std::map<std::string, int>& shapes = instance.mAnimatedShapes;
|
std::map<int, int>& shapes = instance.mAnimatedShapes;
|
||||||
for (std::map<std::string, int>::iterator shapeIt = shapes.begin();
|
for (std::map<int, int>::iterator shapeIt = shapes.begin();
|
||||||
shapeIt != shapes.end(); ++shapeIt)
|
shapeIt != shapes.end(); ++shapeIt)
|
||||||
{
|
{
|
||||||
|
|
||||||
Ogre::Node* bone;
|
const std::string& mesh = animation->getObjectRootName();
|
||||||
if (shapeIt->first.empty())
|
int boneHandle = NifOgre::NIFSkeletonLoader::lookupOgreBoneHandle(mesh, shapeIt->first);
|
||||||
// HACK: see NifSkeletonLoader::buildBones
|
Ogre::Node* bone = animation->getNode(boneHandle);
|
||||||
bone = animation->getNode(" ");
|
|
||||||
else
|
|
||||||
bone = animation->getNode(shapeIt->first);
|
|
||||||
|
|
||||||
if (bone == NULL)
|
if (bone == NULL)
|
||||||
throw std::runtime_error("can't find bone");
|
continue;
|
||||||
|
|
||||||
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
||||||
|
|
||||||
|
@ -689,9 +688,8 @@ namespace MWWorld
|
||||||
mEngine->removeHeightField(x, y);
|
mEngine->removeHeightField(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSystem::addObject (const Ptr& ptr, bool placeable)
|
void PhysicsSystem::addObject (const Ptr& ptr, const std::string& mesh, bool placeable)
|
||||||
{
|
{
|
||||||
std::string mesh = ptr.getClass().getModel(ptr);
|
|
||||||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
handleToMesh[node->getName()] = mesh;
|
handleToMesh[node->getName()] = mesh;
|
||||||
mEngine->createAndAdjustRigidBody(
|
mEngine->createAndAdjustRigidBody(
|
||||||
|
@ -700,9 +698,8 @@ namespace MWWorld
|
||||||
mesh, node->getName(), ptr.getCellRef().getScale(), node->getPosition(), node->getOrientation(), 0, 0, true, placeable);
|
mesh, node->getName(), ptr.getCellRef().getScale(), node->getPosition(), node->getOrientation(), 0, 0, true, placeable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSystem::addActor (const Ptr& ptr)
|
void PhysicsSystem::addActor (const Ptr& ptr, const std::string& mesh)
|
||||||
{
|
{
|
||||||
std::string mesh = ptr.getClass().getModel(ptr);
|
|
||||||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
//TODO:optimize this. Searching the std::map isn't very efficient i think.
|
//TODO:optimize this. Searching the std::map isn't very efficient i think.
|
||||||
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
|
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
|
||||||
|
@ -773,13 +770,16 @@ namespace MWWorld
|
||||||
const std::string &handle = node->getName();
|
const std::string &handle = node->getName();
|
||||||
if(handleToMesh.find(handle) != handleToMesh.end())
|
if(handleToMesh.find(handle) != handleToMesh.end())
|
||||||
{
|
{
|
||||||
|
std::string model = ptr.getClass().getModel(ptr);
|
||||||
|
model = Misc::ResourceHelpers::correctActorModelPath(model); // FIXME: scaling shouldn't require model
|
||||||
|
|
||||||
bool placeable = false;
|
bool placeable = false;
|
||||||
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,true))
|
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,true))
|
||||||
placeable = body->mPlaceable;
|
placeable = body->mPlaceable;
|
||||||
else if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,false))
|
else if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,false))
|
||||||
placeable = body->mPlaceable;
|
placeable = body->mPlaceable;
|
||||||
removeObject(handle);
|
removeObject(handle);
|
||||||
addObject(ptr, placeable);
|
addObject(ptr, model, placeable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
|
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
|
||||||
|
@ -820,6 +820,7 @@ namespace MWWorld
|
||||||
bool PhysicsSystem::getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max)
|
bool PhysicsSystem::getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max)
|
||||||
{
|
{
|
||||||
std::string model = ptr.getClass().getModel(ptr);
|
std::string model = ptr.getClass().getModel(ptr);
|
||||||
|
model = Misc::ResourceHelpers::correctActorModelPath(model);
|
||||||
if (model.empty()) {
|
if (model.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ namespace MWWorld
|
||||||
void setWaterHeight(float height);
|
void setWaterHeight(float height);
|
||||||
void disableWater();
|
void disableWater();
|
||||||
|
|
||||||
void addObject (const MWWorld::Ptr& ptr, bool placeable=false);
|
void addObject (const MWWorld::Ptr& ptr, const std::string& mesh, bool placeable=false);
|
||||||
|
|
||||||
void addActor (const MWWorld::Ptr& ptr);
|
void addActor (const MWWorld::Ptr& ptr, const std::string& mesh);
|
||||||
|
|
||||||
void addHeightField (float* heights,
|
void addHeightField (float* heights,
|
||||||
int x, int y, float yoffset,
|
int x, int y, float yoffset,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
|
|
||||||
#include <components/nif/niffile.hpp>
|
#include <components/nif/niffile.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -79,8 +80,9 @@ namespace
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mRendering.addObject (ptr);
|
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||||
ptr.getClass().insertObject (ptr, mPhysics);
|
mRendering.addObject(ptr, model);
|
||||||
|
ptr.getClass().insertObject (ptr, model, mPhysics);
|
||||||
|
|
||||||
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
||||||
if (ptr.getRefData().getBaseNode())
|
if (ptr.getRefData().getBaseNode())
|
||||||
|
@ -486,8 +488,7 @@ namespace MWWorld
|
||||||
// Sky system
|
// Sky system
|
||||||
MWBase::Environment::get().getWorld()->adjustSky();
|
MWBase::Environment::get().getWorld()->adjustSky();
|
||||||
|
|
||||||
mCellChanged = true;
|
mCellChanged = true; MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
||||||
|
|
||||||
|
@ -529,8 +530,9 @@ namespace MWWorld
|
||||||
|
|
||||||
void Scene::addObjectToScene (const Ptr& ptr)
|
void Scene::addObjectToScene (const Ptr& ptr)
|
||||||
{
|
{
|
||||||
mRendering.addObject(ptr);
|
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||||
ptr.getClass().insertObject(ptr, *mPhysics);
|
mRendering.addObject(ptr, model);
|
||||||
|
ptr.getClass().insertObject (ptr, model, *mPhysics);
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
||||||
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <components/files/collections.hpp>
|
#include <components/files/collections.hpp>
|
||||||
#include <components/compiler/locals.hpp>
|
#include <components/compiler/locals.hpp>
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <boost/math/special_functions/sign.hpp>
|
#include <boost/math/special_functions/sign.hpp>
|
||||||
|
|
||||||
|
@ -2092,7 +2093,9 @@ namespace MWWorld
|
||||||
// so we should make sure not to use a "stale" controller for that.
|
// so we should make sure not to use a "stale" controller for that.
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(mPlayer->getPlayer());
|
MWBase::Environment::get().getMechanicsManager()->add(mPlayer->getPlayer());
|
||||||
|
|
||||||
mPhysics->addActor(mPlayer->getPlayer());
|
std::string model = getPlayerPtr().getClass().getModel(getPlayerPtr());
|
||||||
|
model = Misc::ResourceHelpers::correctActorModelPath(model);
|
||||||
|
mPhysics->addActor(mPlayer->getPlayer(), model);
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::canRest ()
|
int World::canRest ()
|
||||||
|
|
|
@ -121,3 +121,20 @@ std::string Misc::ResourceHelpers::correctBookartPath(const std::string &resPath
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Misc::ResourceHelpers::correctActorModelPath(const std::string &resPath)
|
||||||
|
{
|
||||||
|
std::string mdlname = resPath;
|
||||||
|
std::string::size_type p = mdlname.rfind('\\');
|
||||||
|
if(p == std::string::npos)
|
||||||
|
p = mdlname.rfind('/');
|
||||||
|
if(p != std::string::npos)
|
||||||
|
mdlname.insert(mdlname.begin()+p+1, 'x');
|
||||||
|
else
|
||||||
|
mdlname.insert(mdlname.begin(), 'x');
|
||||||
|
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(mdlname))
|
||||||
|
{
|
||||||
|
return resPath;
|
||||||
|
}
|
||||||
|
return mdlname;
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace Misc
|
||||||
std::string correctIconPath(const std::string &resPath);
|
std::string correctIconPath(const std::string &resPath);
|
||||||
std::string correctBookartPath(const std::string &resPath);
|
std::string correctBookartPath(const std::string &resPath);
|
||||||
std::string correctBookartPath(const std::string &resPath, int width, int height);
|
std::string correctBookartPath(const std::string &resPath, int width, int height);
|
||||||
|
/// Uses "xfoo.nif" instead of "foo.nif" if available
|
||||||
|
std::string correctActorModelPath(const std::string &resPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,57 @@ http://www.gnu.org/licenses/ .
|
||||||
|
|
||||||
typedef unsigned char ubyte;
|
typedef unsigned char ubyte;
|
||||||
|
|
||||||
|
// Extract a list of keyframe-controlled nodes from a .kf file
|
||||||
|
// FIXME: this is a similar copy of OgreNifLoader::loadKf
|
||||||
|
void extractControlledNodes(Nif::NIFFilePtr kfFile, std::set<std::string>& controlled)
|
||||||
|
{
|
||||||
|
if(kfFile->numRoots() < 1)
|
||||||
|
{
|
||||||
|
kfFile->warn("Found no root nodes in "+kfFile->getFilename()+".");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Nif::Record *r = kfFile->getRoot(0);
|
||||||
|
assert(r != NULL);
|
||||||
|
|
||||||
|
if(r->recType != Nif::RC_NiSequenceStreamHelper)
|
||||||
|
{
|
||||||
|
kfFile->warn("First root was not a NiSequenceStreamHelper, but a "+
|
||||||
|
r->recName+".");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const Nif::NiSequenceStreamHelper *seq = static_cast<const Nif::NiSequenceStreamHelper*>(r);
|
||||||
|
|
||||||
|
Nif::ExtraPtr extra = seq->extra;
|
||||||
|
if(extra.empty() || extra->recType != Nif::RC_NiTextKeyExtraData)
|
||||||
|
{
|
||||||
|
kfFile->warn("First extra data was not a NiTextKeyExtraData, but a "+
|
||||||
|
(extra.empty() ? std::string("nil") : extra->recName)+".");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extra = extra->extra;
|
||||||
|
Nif::ControllerPtr ctrl = seq->controller;
|
||||||
|
for(;!extra.empty() && !ctrl.empty();(extra=extra->extra),(ctrl=ctrl->next))
|
||||||
|
{
|
||||||
|
if(extra->recType != Nif::RC_NiStringExtraData || ctrl->recType != Nif::RC_NiKeyframeController)
|
||||||
|
{
|
||||||
|
kfFile->warn("Unexpected extra data "+extra->recName+" with controller "+ctrl->recName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(ctrl->flags & Nif::NiNode::ControllerFlag_Active))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const Nif::NiStringExtraData *strdata = static_cast<const Nif::NiStringExtraData*>(extra.getPtr());
|
||||||
|
const Nif::NiKeyframeController *key = static_cast<const Nif::NiKeyframeController*>(ctrl.getPtr());
|
||||||
|
|
||||||
|
if(key->data.empty())
|
||||||
|
continue;
|
||||||
|
controlled.insert(strdata->string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace NifBullet
|
namespace NifBullet
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -72,10 +123,6 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
mCompoundShape = NULL;
|
mCompoundShape = NULL;
|
||||||
mStaticMesh = NULL;
|
mStaticMesh = NULL;
|
||||||
|
|
||||||
// Load the NIF. TODO: Wrap this in a try-catch block once we're out
|
|
||||||
// of the early stages of development. Right now we WANT to catch
|
|
||||||
// every error as early and intrusively as possible, as it's most
|
|
||||||
// likely a sign of incomplete code rather than faulty input.
|
|
||||||
Nif::NIFFilePtr pnif (Nif::Cache::getInstance().load(mResourceName.substr(0, mResourceName.length()-7)));
|
Nif::NIFFilePtr pnif (Nif::Cache::getInstance().load(mResourceName.substr(0, mResourceName.length()-7)));
|
||||||
Nif::NIFFile & nif = *pnif.get ();
|
Nif::NIFFile & nif = *pnif.get ();
|
||||||
if (nif.numRoots() < 1)
|
if (nif.numRoots() < 1)
|
||||||
|
@ -84,6 +131,19 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Have to load controlled nodes from the .kf
|
||||||
|
// FIXME: the .kf has to be loaded both for rendering and physics, ideally it should be opened once and then reused
|
||||||
|
mControlledNodes.clear();
|
||||||
|
std::string kfname = mResourceName.substr(0, mResourceName.length()-7);
|
||||||
|
Misc::StringUtils::toLower(kfname);
|
||||||
|
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
||||||
|
kfname.replace(kfname.size()-4, 4, ".kf");
|
||||||
|
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(kfname))
|
||||||
|
{
|
||||||
|
Nif::NIFFilePtr kf (Nif::Cache::getInstance().load(kfname));
|
||||||
|
extractControlledNodes(kf, mControlledNodes);
|
||||||
|
}
|
||||||
|
|
||||||
Nif::Record *r = nif.getRoot(0);
|
Nif::Record *r = nif.getRoot(0);
|
||||||
assert(r != NULL);
|
assert(r != NULL);
|
||||||
|
|
||||||
|
@ -182,6 +242,9 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
||||||
&& (node->controller->flags & Nif::NiNode::ControllerFlag_Active))
|
&& (node->controller->flags & Nif::NiNode::ControllerFlag_Active))
|
||||||
isAnimated = true;
|
isAnimated = true;
|
||||||
|
|
||||||
|
if (mControlledNodes.find(node->name) != mControlledNodes.end())
|
||||||
|
isAnimated = true;
|
||||||
|
|
||||||
if (!raycasting)
|
if (!raycasting)
|
||||||
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
|
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
|
||||||
else
|
else
|
||||||
|
@ -318,9 +381,9 @@ void ManualBulletShapeLoader::handleNiTriShape(const Nif::NiTriShape *shape, int
|
||||||
btTransform trans(btQuaternion(q.x, q.y, q.z, q.w), btVector3(v.x, v.y, v.z));
|
btTransform trans(btQuaternion(q.x, q.y, q.z, q.w), btVector3(v.x, v.y, v.z));
|
||||||
|
|
||||||
if (raycasting)
|
if (raycasting)
|
||||||
mShape->mAnimatedRaycastingShapes.insert(std::make_pair(shape->name, mCompoundShape->getNumChildShapes()));
|
mShape->mAnimatedRaycastingShapes.insert(std::make_pair(shape->recIndex, mCompoundShape->getNumChildShapes()));
|
||||||
else
|
else
|
||||||
mShape->mAnimatedShapes.insert(std::make_pair(shape->name, mCompoundShape->getNumChildShapes()));
|
mShape->mAnimatedShapes.insert(std::make_pair(shape->recIndex, mCompoundShape->getNumChildShapes()));
|
||||||
|
|
||||||
mCompoundShape->addChildShape(trans, childShape);
|
mCompoundShape->addChildShape(trans, childShape);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,8 @@ private:
|
||||||
btTriangleMesh* mStaticMesh;
|
btTriangleMesh* mStaticMesh;
|
||||||
|
|
||||||
btBoxShape *mBoundingBox;
|
btBoxShape *mBoundingBox;
|
||||||
|
|
||||||
|
std::set<std::string> mControlledNodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,10 @@ public:
|
||||||
// Stores animated collision shapes. If any collision nodes in the NIF are animated, then mCollisionShape
|
// Stores animated collision shapes. If any collision nodes in the NIF are animated, then mCollisionShape
|
||||||
// will be a btCompoundShape (which consists of one or more child shapes).
|
// will be a btCompoundShape (which consists of one or more child shapes).
|
||||||
// In this map, for each animated collision shape,
|
// In this map, for each animated collision shape,
|
||||||
// we store the bone name mapped to the child index of the shape in the btCompoundShape.
|
// we store the node's record index mapped to the child index of the shape in the btCompoundShape.
|
||||||
std::map<std::string, int> mAnimatedShapes;
|
std::map<int, int> mAnimatedShapes;
|
||||||
|
|
||||||
std::map<std::string, int> mAnimatedRaycastingShapes;
|
std::map<int, int> mAnimatedRaycastingShapes;
|
||||||
|
|
||||||
btCollisionShape* mCollisionShape;
|
btCollisionShape* mCollisionShape;
|
||||||
btCollisionShape* mRaycastingShape;
|
btCollisionShape* mRaycastingShape;
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
#include "physic.hpp"
|
#include "physic.hpp"
|
||||||
|
|
||||||
#include <btBulletDynamicsCommon.h>
|
#include <btBulletDynamicsCommon.h>
|
||||||
#include <btBulletCollisionCommon.h>
|
#include <btBulletCollisionCommon.h>
|
||||||
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
|
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
|
||||||
#include <components/nifbullet/bulletnifloader.hpp>
|
|
||||||
#include "OgreRoot.h"
|
|
||||||
#include "BtOgrePG.h"
|
|
||||||
#include "BtOgreGP.h"
|
|
||||||
#include "BtOgreExtras.h"
|
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
#include <OgreSceneManager.h>
|
||||||
|
|
||||||
|
#include <components/nifbullet/bulletnifloader.hpp>
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
|
#include "BtOgrePG.h"
|
||||||
|
#include "BtOgreGP.h"
|
||||||
|
#include "BtOgreExtras.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -182,8 +182,8 @@ namespace Physic
|
||||||
{
|
{
|
||||||
btCollisionShape* mCompound;
|
btCollisionShape* mCompound;
|
||||||
|
|
||||||
// Maps bone name to child index in the compound shape
|
// Maps node record index to child index in the compound shape
|
||||||
std::map<std::string, int> mAnimatedShapes;
|
std::map<int, int> mAnimatedShapes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue