Turning off hardware skinning

actorid
Jason Hooks 13 years ago
parent 762727308e
commit 1d2e77d947

@ -16,6 +16,7 @@
#include "../mwworld/environment.hpp" #include "../mwworld/environment.hpp"
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "creatureanimation.hpp" #include "creatureanimation.hpp"
#include <openengine/bullet/physic.hpp>
namespace MWRender{ namespace MWRender{
class Actors{ class Actors{

@ -410,6 +410,11 @@ namespace MWRender{
bone->setPosition(t); bone->setPosition(t);
if(bQuats) if(bQuats)
bone->setOrientation(r); bone->setOrientation(r);
if(iter == transformations->begin()){
trans = bone->_getDerivedPosition();
rotate = bone->_getDerivedOrientation();
}
skel->getManualBonesDirty(); skel->getManualBonesDirty();
skel->_updateTransforms(); skel->_updateTransforms();
skel->_notifyManualBonesDirty(); skel->_notifyManualBonesDirty();

@ -8,6 +8,7 @@
#include "../mwworld/environment.hpp" #include "../mwworld/environment.hpp"
#include <components/nif/node.hpp> #include <components/nif/node.hpp>
#include <map> #include <map>
#include <openengine/bullet/physic.hpp>
namespace MWRender{ namespace MWRender{
@ -15,9 +16,12 @@ class Animation{
protected: protected:
OEngine::Physic::PhysicEngine* engine;
OEngine::Render::OgreRenderer &mRend; OEngine::Render::OgreRenderer &mRend;
MWWorld::Environment& mEnvironment; MWWorld::Environment& mEnvironment;
static std::map<std::string, int> mUniqueIDs; static std::map<std::string, int> mUniqueIDs;
Ogre::Quaternion rotate;
Ogre::Vector3 trans;
std::vector<std::vector<Nif::NiTriShapeCopy>* > shapeparts; //All the NiTriShape data that we need for animating an npc std::vector<std::vector<Nif::NiTriShapeCopy>* > shapeparts; //All the NiTriShape data that we need for animating an npc
float time; float time;
@ -38,8 +42,6 @@ class Animation{
std::vector<Nif::NiTriShapeCopy>* shapes; //All the NiTriShapeData for this creature std::vector<Nif::NiTriShapeCopy>* shapes; //All the NiTriShapeData for this creature
std::vector<Ogre::Entity*> entityparts; std::vector<Ogre::Entity*> entityparts;
std::vector<Nif::NiKeyframeData>* transformations; std::vector<Nif::NiKeyframeData>* transformations;
std::map<std::string,float> textmappings; std::map<std::string,float> textmappings;

@ -259,6 +259,16 @@ void NpcAnimation::runAnimation(float timepassed){
} }
handleAnimationTransforms(); handleAnimationTransforms();
//mEnvironment.mWorld->
/*if(base->hasSkeleton())
{
Ogre::Quaternion boneQuat = rotate;
Ogre::Vector3 boneTrans = trans;
mEnvironment.mWorld->setObjectPhysicsPosition(insert->getName(), boneTrans + insert->getPosition());
mEnvironment.mWorld->setObjectPhysicsRotation(insert->getName(), boneQuat * insert->getOrientation());
}*/
// handleAnimationTransforms(base); // handleAnimationTransforms(base);
//handleAnimationTransforms(hand); //handleAnimationTransforms(hand);
// //

@ -145,6 +145,12 @@ namespace MWWorld
void PhysicsSystem::rotateObject (const std::string& handle, const Ogre::Quaternion& rotation) void PhysicsSystem::rotateObject (const std::string& handle, const Ogre::Quaternion& rotation)
{ {
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
{
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
// start positions others than 0, 0, 0
act->setRotation(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w));
}
} }
void PhysicsSystem::scaleObject (const std::string& handle, float scale) void PhysicsSystem::scaleObject (const std::string& handle, float scale)

@ -685,4 +685,10 @@ namespace MWWorld
{ {
mRendering.skipAnimation (ptr); mRendering.skipAnimation (ptr);
} }
void World::setObjectPhysicsRotation(const std::string& handle, Ogre::Quaternion quat){
mPhysics->rotateObject(handle, quat);
}
void World::setObjectPhysicsPosition(const std::string& handle, Ogre::Vector3 vec){
mPhysics->moveObject(handle, vec);
}
} }

@ -218,6 +218,8 @@ namespace MWWorld
void skipAnimation (const MWWorld::Ptr& ptr); void skipAnimation (const MWWorld::Ptr& ptr);
///< Skip the animation for the given MW-reference for one frame. Calls to this function for ///< Skip the animation for the given MW-reference for one frame. Calls to this function for
/// references that are currently not in the rendered scene should be ignored. /// references that are currently not in the rendered scene should be ignored.
void setObjectPhysicsRotation(const std::string& handle,Ogre::Quaternion quat);
void setObjectPhysicsPosition(const std::string& handle,Ogre::Vector3 vector);
}; };
} }

Loading…
Cancel
Save