forked from mirror/openmw-tes3mp
Restructuring things
This commit is contained in:
parent
ca4de0606e
commit
ebab98a8a0
8 changed files with 121 additions and 113 deletions
|
@ -114,10 +114,7 @@ set(OENGINE_BULLET
|
||||||
${LIBDIR}/openengine/bullet/physic.hpp
|
${LIBDIR}/openengine/bullet/physic.hpp
|
||||||
${LIBDIR}/openengine/bullet/BulletShapeLoader.cpp
|
${LIBDIR}/openengine/bullet/BulletShapeLoader.cpp
|
||||||
${LIBDIR}/openengine/bullet/BulletShapeLoader.h
|
${LIBDIR}/openengine/bullet/BulletShapeLoader.h
|
||||||
${LIBDIR}/openengine/bullet/pmove.h
|
|
||||||
${LIBDIR}/openengine/bullet/pmove.cpp
|
|
||||||
${LIBDIR}/openengine/bullet/trace.h
|
|
||||||
${LIBDIR}/openengine/bullet/trace.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
|
set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
|
||||||
|
|
|
@ -93,8 +93,9 @@ namespace MWClass
|
||||||
|
|
||||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
{
|
{
|
||||||
std::cout << "Inserting NPC\n";
|
|
||||||
renderingInterface.getActors().insertNPC(ptr);
|
|
||||||
|
renderingInterface.getActors().insertNPC(ptr, getInventoryStore(ptr));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ Actors::~Actors(){
|
||||||
void Actors::setMwRoot(Ogre::SceneNode* root){
|
void Actors::setMwRoot(Ogre::SceneNode* root){
|
||||||
mMwRoot = root;
|
mMwRoot = root;
|
||||||
}
|
}
|
||||||
void Actors::insertNPC(const MWWorld::Ptr& ptr){
|
void Actors::insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv){
|
||||||
|
|
||||||
insertBegin(ptr, true, true);
|
insertBegin(ptr, true, true);
|
||||||
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend);
|
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend, inv);
|
||||||
|
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MWRender{
|
||||||
void setMwRoot(Ogre::SceneNode* root);
|
void setMwRoot(Ogre::SceneNode* root);
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
void insertCreature (const MWWorld::Ptr& ptr);
|
void insertCreature (const MWWorld::Ptr& ptr);
|
||||||
void insertNPC(const MWWorld::Ptr& ptr);
|
void insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv);
|
||||||
bool deleteObject (const MWWorld::Ptr& ptr);
|
bool deleteObject (const MWWorld::Ptr& ptr);
|
||||||
///< \return found?
|
///< \return found?
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ namespace MWRender{
|
||||||
, mRend(_rend)
|
, mRend(_rend)
|
||||||
, mEnvironment(_env)
|
, mEnvironment(_env)
|
||||||
, vecRotPos()
|
, vecRotPos()
|
||||||
, shapeparts()
|
|
||||||
, time(0.0f)
|
, time(0.0f)
|
||||||
, startTime(0.0f)
|
, startTime(0.0f)
|
||||||
, stopTime(0.0f)
|
, stopTime(0.0f)
|
||||||
|
@ -19,7 +18,6 @@ namespace MWRender{
|
||||||
, shapeNumber(0)
|
, shapeNumber(0)
|
||||||
, shapeIndexI()
|
, shapeIndexI()
|
||||||
, shapes(NULL)
|
, shapes(NULL)
|
||||||
, entityparts()
|
|
||||||
, transformations(NULL)
|
, transformations(NULL)
|
||||||
, textmappings(NULL)
|
, textmappings(NULL)
|
||||||
, base(NULL)
|
, base(NULL)
|
||||||
|
@ -430,14 +428,7 @@ namespace MWRender{
|
||||||
//base->_updateAnimation();
|
//base->_updateAnimation();
|
||||||
//base->_notifyMoved();
|
//base->_notifyMoved();
|
||||||
|
|
||||||
for(unsigned int i = 0; i < entityparts.size(); i++){
|
|
||||||
//Ogre::SkeletonInstance* skel = entityparts[i]->getSkeleton();
|
|
||||||
|
|
||||||
//Ogre::Bone* b = skel->getRootBone();
|
|
||||||
//b->setOrientation(Ogre::Real(.3),Ogre::Real(.3),Ogre::Real(.3), Ogre::Real(.3));//This is a trick
|
|
||||||
|
|
||||||
//entityparts[i]->getAllAnimationStates()->_notifyDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<Nif::NiKeyframeData>::iterator iter;
|
std::vector<Nif::NiKeyframeData>::iterator iter;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Animation{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::vector<Nif::NiTriShapeCopy>* > shapeparts; //All the NiTriShape data that we need for animating an npc
|
|
||||||
|
|
||||||
float time;
|
float time;
|
||||||
float startTime;
|
float startTime;
|
||||||
|
@ -48,7 +48,7 @@ class Animation{
|
||||||
|
|
||||||
//Ogre::SkeletonInstance* skel;
|
//Ogre::SkeletonInstance* skel;
|
||||||
std::vector<Nif::NiTriShapeCopy>* shapes; //All the NiTriShapeData for a creature
|
std::vector<Nif::NiTriShapeCopy>* shapes; //All the NiTriShapeData for a creature
|
||||||
std::vector<Ogre::Entity*> entityparts;
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<Nif::NiKeyframeData>* transformations;
|
std::vector<Nif::NiKeyframeData>* transformations;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Ogre;
|
using namespace Ogre;
|
||||||
using namespace NifOgre;
|
using namespace NifOgre;
|
||||||
namespace MWRender{
|
namespace MWRender{
|
||||||
|
@ -10,11 +11,12 @@ NpcAnimation::~NpcAnimation(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,OEngine::Render::OgreRenderer& _rend): Animation(_env,_rend){
|
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv): Animation(_env,_rend), mStateID(-1), inv(_inv){
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::NPC>();
|
ptr.get<ESM::NPC>();
|
||||||
|
Ogre::Entity* blank = 0;
|
||||||
|
std::vector<Nif::NiTriShapeCopy>* blankshape = 0;
|
||||||
|
chest = std::make_pair(blank, blankshape);
|
||||||
//Part selection on last character of the file string
|
//Part selection on last character of the file string
|
||||||
// " Tri Chest
|
// " Tri Chest
|
||||||
// * Tri Tail
|
// * Tri Tail
|
||||||
|
@ -95,85 +97,85 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
|
|
||||||
std::string hairModel = "meshes\\" +
|
std::string hairModel = "meshes\\" +
|
||||||
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
||||||
const ESM::BodyPart *chest = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "chest");
|
const ESM::BodyPart *chestPart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "chest");
|
||||||
const ESM::BodyPart *upperleg = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
const ESM::BodyPart *upperleg = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
||||||
const ESM::BodyPart *groin = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "groin");
|
const ESM::BodyPart *groinpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "groin");
|
||||||
const ESM::BodyPart *arml = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper arm"); //We need two
|
const ESM::BodyPart *arml = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper arm"); //We need two
|
||||||
const ESM::BodyPart *neck = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "neck");
|
const ESM::BodyPart *neckpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "neck");
|
||||||
const ESM::BodyPart *knee = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
|
const ESM::BodyPart *knee = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
|
||||||
const ESM::BodyPart *ankle = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
|
const ESM::BodyPart *ankle = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
|
||||||
const ESM::BodyPart *foot = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
|
const ESM::BodyPart *foot = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
|
||||||
const ESM::BodyPart *feet = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
|
const ESM::BodyPart *feetpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
|
||||||
const ESM::BodyPart *tail = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "tail");
|
const ESM::BodyPart *tailpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "tail");
|
||||||
const ESM::BodyPart *wristl = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist"); //We need two
|
const ESM::BodyPart *wristlpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist"); //We need two
|
||||||
const ESM::BodyPart *forearml = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm"); //We need two
|
const ESM::BodyPart *forearmlpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm"); //We need two
|
||||||
const ESM::BodyPart *handl = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand"); //We need two
|
const ESM::BodyPart *handlpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand"); //We need two
|
||||||
const ESM::BodyPart *hair = mEnvironment.mWorld->getStore().bodyParts.search(hairID);
|
const ESM::BodyPart *hairpart = mEnvironment.mWorld->getStore().bodyParts.search(hairID);
|
||||||
const ESM::BodyPart *head = mEnvironment.mWorld->getStore().bodyParts.search(headID);
|
const ESM::BodyPart *headpart = mEnvironment.mWorld->getStore().bodyParts.search(headID);
|
||||||
if(bodyRaceID == "b_n_argonian_f_")
|
if(bodyRaceID == "b_n_argonian_f_")
|
||||||
forearml = mEnvironment.mWorld->getStore().bodyParts.search ("b_n_argonian_m_forearm"); //We need two
|
forearmlpart = mEnvironment.mWorld->getStore().bodyParts.search ("b_n_argonian_m_forearm"); //We need two
|
||||||
if(!handl)
|
if(!handlpart)
|
||||||
handl = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands");
|
handlpart = mEnvironment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands");
|
||||||
//const ESM::BodyPart* claviclel = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "clavicle");
|
//const ESM::BodyPart* claviclel = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "clavicle");
|
||||||
//const ESM::BodyPart* clavicler = claviclel;
|
//const ESM::BodyPart* clavicler = claviclel;
|
||||||
const ESM::BodyPart* handr = handl;
|
const ESM::BodyPart* handrpart = handlpart;
|
||||||
const ESM::BodyPart* forearmr = forearml;
|
const ESM::BodyPart* forearmr = forearmlpart;
|
||||||
const ESM::BodyPart* wristr = wristl;
|
const ESM::BodyPart* wristrpart = wristlpart;
|
||||||
const ESM::BodyPart* armr = arml;
|
const ESM::BodyPart* armr = arml;
|
||||||
|
|
||||||
|
|
||||||
if(upperleg){
|
if(upperleg){
|
||||||
insertBoundedPart("meshes\\" + upperleg->model + "*|", "Left Upper Leg");
|
lUpperLeg = insertBoundedPart("meshes\\" + upperleg->model + "*|", "Left Upper Leg");
|
||||||
insertBoundedPart("meshes\\" + upperleg->model, "Right Upper Leg");
|
rUpperLeg = insertBoundedPart("meshes\\" + upperleg->model, "Right Upper Leg");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(foot){
|
if(foot){
|
||||||
if(bodyRaceID.compare("b_n_khajiit_m_") == 0)
|
if(bodyRaceID.compare("b_n_khajiit_m_") == 0)
|
||||||
{
|
{
|
||||||
feet = foot;
|
feetpart = foot;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
insertBoundedPart("meshes\\" + foot->model, "Right Foot");
|
rfoot = insertBoundedPart("meshes\\" + foot->model, "Right Foot");
|
||||||
insertBoundedPart("meshes\\" + foot->model + "*|", "Left Foot");
|
lfoot = insertBoundedPart("meshes\\" + foot->model + "*|", "Left Foot");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(groin){
|
if(groinpart){
|
||||||
insertBoundedPart("meshes\\" + groin->model, "Groin");
|
groin = insertBoundedPart("meshes\\" + groinpart->model, "Groin");
|
||||||
}
|
}
|
||||||
if(knee)
|
if(knee)
|
||||||
{
|
{
|
||||||
insertBoundedPart("meshes\\" + knee->model + "*|", "Left Knee"); //e
|
lKnee = insertBoundedPart("meshes\\" + knee->model + "*|", "Left Knee"); //e
|
||||||
insertBoundedPart("meshes\\" + knee->model, "Right Knee"); //e
|
rKnee = insertBoundedPart("meshes\\" + knee->model, "Right Knee"); //e
|
||||||
|
|
||||||
}
|
}
|
||||||
if(ankle){
|
if(ankle){
|
||||||
|
|
||||||
insertBoundedPart("meshes\\" + ankle->model + "*|", "Left Ankle"); //Ogre::Quaternion(Ogre::Radian(3.14 / 4), Ogre::Vector3(1, 0, 0)),blank); //1,0,0, blank);
|
lAnkle = insertBoundedPart("meshes\\" + ankle->model + "*|", "Left Ankle"); //Ogre::Quaternion(Ogre::Radian(3.14 / 4), Ogre::Vector3(1, 0, 0)),blank); //1,0,0, blank);
|
||||||
insertBoundedPart("meshes\\" + ankle->model, "Right Ankle");
|
rAnkle = insertBoundedPart("meshes\\" + ankle->model, "Right Ankle");
|
||||||
}
|
}
|
||||||
if (armr){
|
if (armr){
|
||||||
insertBoundedPart("meshes\\" + armr->model, "Right Upper Arm");
|
rupperArm = insertBoundedPart("meshes\\" + armr->model, "Right Upper Arm");
|
||||||
}
|
}
|
||||||
if(arml){
|
if(arml){
|
||||||
insertBoundedPart("meshes\\" + arml->model + "*|", "Left Upper Arm");
|
lupperArm = insertBoundedPart("meshes\\" + arml->model + "*|", "Left Upper Arm");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forearmr)
|
if (forearmr)
|
||||||
{
|
{
|
||||||
insertBoundedPart("meshes\\" + forearmr->model, "Right Forearm");
|
rForearm = insertBoundedPart("meshes\\" + forearmr->model, "Right Forearm");
|
||||||
}
|
}
|
||||||
if(forearml)
|
if(forearmlpart)
|
||||||
insertBoundedPart("meshes\\" + forearml->model + "*|", "Left Forearm");
|
lForearm = insertBoundedPart("meshes\\" + forearmlpart->model + "*|", "Left Forearm");
|
||||||
|
|
||||||
if (wristr)
|
if (wristrpart)
|
||||||
{
|
{
|
||||||
insertBoundedPart("meshes\\" + wristr->model, "Right Wrist");
|
rWrist = insertBoundedPart("meshes\\" + wristrpart->model, "Right Wrist");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wristl)
|
if(wristlpart)
|
||||||
insertBoundedPart("meshes\\" + wristl->model + "*|", "Left Wrist");
|
lWrist = insertBoundedPart("meshes\\" + wristlpart->model + "*|", "Left Wrist");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,35 +186,35 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
if(clavicler)
|
if(clavicler)
|
||||||
insertBoundedPart("meshes\\" + clavicler->model , "Right Clavicle", base);*/
|
insertBoundedPart("meshes\\" + clavicler->model , "Right Clavicle", base);*/
|
||||||
|
|
||||||
if(neck)
|
if(neckpart)
|
||||||
{
|
{
|
||||||
insertBoundedPart("meshes\\" + neck->model, "Neck");
|
neck = insertBoundedPart("meshes\\" + neckpart->model, "Neck");
|
||||||
}
|
}
|
||||||
if(head)
|
if(headpart)
|
||||||
insertBoundedPart("meshes\\" + head->model, "Head");
|
head = insertBoundedPart("meshes\\" + headpart->model, "Head");
|
||||||
if(hair)
|
if(hairpart)
|
||||||
insertBoundedPart("meshes\\" + hair->model, "Head");
|
hair = insertBoundedPart("meshes\\" + hairpart->model, "Head");
|
||||||
|
|
||||||
if (chest){
|
if (chestPart){
|
||||||
insertFreePart("meshes\\" + chest->model, ":\"", insert);
|
chest = insertFreePart("meshes\\" + chestPart->model, ":\"");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (handr){
|
if (handrpart){
|
||||||
insertFreePart("meshes\\" + handr->model , ":?", insert);
|
rhand = insertFreePart("meshes\\" + handrpart->model , ":?");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (handl){
|
if (handlpart){
|
||||||
insertFreePart("meshes\\" + handl->model, ":>", insert);
|
lhand = insertFreePart("meshes\\" + handlpart->model, ":>");
|
||||||
|
|
||||||
}
|
}
|
||||||
if(tail){
|
if(tailpart){
|
||||||
insertFreePart("meshes\\" + tail->model, ":*", insert);
|
tail = insertFreePart("meshes\\" + tailpart->model, ":*");
|
||||||
}
|
}
|
||||||
if(feet){
|
if(feetpart){
|
||||||
std::string num = getUniqueID(feet->model);
|
|
||||||
insertFreePart("meshes\\" + feet->model,":<", insert);
|
lBeastFoot = insertFreePart("meshes\\" + feetpart->model,"::");
|
||||||
insertFreePart("meshes\\" + feet->model,"::", insert);
|
rBeastFoot = insertFreePart("meshes\\" + feetpart->model,":<");
|
||||||
}
|
}
|
||||||
//originalpos = insert->_getWorldAABB().getCenter();
|
//originalpos = insert->_getWorldAABB().getCenter();
|
||||||
//originalscenenode = insert->getPosition();
|
//originalscenenode = insert->getPosition();
|
||||||
|
@ -222,34 +224,38 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
Ogre::Entity* NpcAnimation::insertBoundedPart(const std::string &mesh, std::string bonename){
|
Ogre::Entity* NpcAnimation::insertBoundedPart(const std::string &mesh, std::string bonename){
|
||||||
|
|
||||||
NIFLoader::load(mesh);
|
NIFLoader::load(mesh);
|
||||||
Entity* ent = mRend.getScene()->createEntity(mesh);
|
Ogre::Entity* part = mRend.getScene()->createEntity(mesh);
|
||||||
|
|
||||||
base->attachObjectToBone(bonename, ent);
|
base->attachObjectToBone(bonename, part);
|
||||||
return ent;
|
return part;
|
||||||
}
|
}
|
||||||
void NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix, Ogre::SceneNode* insert){
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix){
|
||||||
|
|
||||||
std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix;
|
std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix;
|
||||||
NIFLoader::load(meshNumbered);
|
NIFLoader::load(meshNumbered);
|
||||||
|
|
||||||
Ogre::Entity* ent = mRend.getScene()->createEntity(meshNumbered);
|
Ogre::Entity* part = mRend.getScene()->createEntity(meshNumbered);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert->attachObject(ent);
|
insert->attachObject(part);
|
||||||
entityparts.push_back(ent);
|
|
||||||
shapes = ((NIFLoader::getSingletonPtr())->getShapes(mesh + "0000" + suffix));
|
std::vector<Nif::NiTriShapeCopy>* shape = ((NIFLoader::getSingletonPtr())->getShapes(mesh + "0000" + suffix));
|
||||||
if(shapes){
|
if(shape){
|
||||||
shapeparts.push_back(shapes);
|
|
||||||
handleShapes(shapes, ent, base->getSkeleton());
|
handleShapes(shape, part, base->getSkeleton());
|
||||||
}
|
}
|
||||||
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> pair = std::make_pair(part, shape);
|
||||||
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NpcAnimation::runAnimation(float timepassed){
|
void NpcAnimation::runAnimation(float timepassed){
|
||||||
|
|
||||||
|
mStateID = inv.getStateId();
|
||||||
|
|
||||||
|
|
||||||
//1. Add the amount of time passed to time
|
//1. Add the amount of time passed to time
|
||||||
|
|
||||||
//2. Handle the animation transforms dependent on time
|
//2. Handle the animation transforms dependent on time
|
||||||
|
@ -269,21 +275,25 @@ void NpcAnimation::runAnimation(float timepassed){
|
||||||
|
|
||||||
handleAnimationTransforms();
|
handleAnimationTransforms();
|
||||||
|
|
||||||
std::vector<std::vector<Nif::NiTriShapeCopy>*>::iterator shapepartsiter = shapeparts.begin();
|
|
||||||
std::vector<Ogre::Entity*>::iterator entitypartsiter = entityparts.begin();
|
|
||||||
while(shapepartsiter != shapeparts.end())
|
|
||||||
{
|
|
||||||
vecRotPos.clear();
|
vecRotPos.clear();
|
||||||
std::vector<Nif::NiTriShapeCopy>* shapes = *shapepartsiter;
|
|
||||||
Ogre::Entity* theentity = *entitypartsiter;
|
|
||||||
|
|
||||||
|
|
||||||
handleShapes(shapes, theentity, base->getSkeleton());
|
|
||||||
shapepartsiter++;
|
|
||||||
entitypartsiter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(lBeastFoot)
|
||||||
|
handleShapes(lBeastFootShapes, lBeastFoot, base->getSkeleton());
|
||||||
|
if(rBeastFoot)
|
||||||
|
handleShapes(rBeastFootShapes, rBeastFoot, base->getSkeleton());
|
||||||
|
if(chest)
|
||||||
|
handleShapes(chestShapes, chest, base->getSkeleton());
|
||||||
|
if(tail)
|
||||||
|
handleShapes(tailShapes, tail, base->getSkeleton());
|
||||||
|
if(skirt)
|
||||||
|
handleShapes(skirtShapes, skirt, base->getSkeleton());
|
||||||
|
if(lhand)
|
||||||
|
handleShapes(lhandShapes, lhand, base->getSkeleton());
|
||||||
|
if(rhand)
|
||||||
|
handleShapes(rhandShapes, rhand, base->getSkeleton());
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,26 +6,34 @@
|
||||||
#include <components/nif/property.hpp>
|
#include <components/nif/property.hpp>
|
||||||
#include <components/nif/controller.hpp>
|
#include <components/nif/controller.hpp>
|
||||||
#include <components/nif/extra.hpp>
|
#include <components/nif/extra.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwworld/environment.hpp"
|
||||||
#include "components/nifogre/ogre_nif_loader.hpp"
|
#include "components/nifogre/ogre_nif_loader.hpp"
|
||||||
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
namespace MWRender{
|
namespace MWRender{
|
||||||
|
|
||||||
class NpcAnimation: public Animation{
|
class NpcAnimation: public Animation{
|
||||||
private:
|
private:
|
||||||
|
MWWorld::InventoryStore& inv;
|
||||||
int mStateID;
|
int mStateID;
|
||||||
//Free Parts
|
//Free Parts
|
||||||
Ogre::Entity* chest; std::vector<Nif::NiTriShapeCopy>* chestShapes;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> chest;
|
||||||
Ogre::Entity* skirt; std::vector<Nif::NiTriShapeCopy>* skirtShapes;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> skirt;
|
||||||
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> lhand;
|
||||||
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> rhand;
|
||||||
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> tail;
|
||||||
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> lBeastFoot;
|
||||||
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> rBeastFoot;
|
||||||
|
/*Ogre::Entity* skirt; std::vector<Nif::NiTriShapeCopy>* skirtShapes;
|
||||||
Ogre::Entity* rhand; std::vector<Nif::NiTriShapeCopy>* rhandShapes;
|
Ogre::Entity* rhand; std::vector<Nif::NiTriShapeCopy>* rhandShapes;
|
||||||
Ogre::Entity* lhand; std::vector<Nif::NiTriShapeCopy>* lhandShapes;
|
Ogre::Entity* lhand; std::vector<Nif::NiTriShapeCopy>* lhandShapes;
|
||||||
Ogre::Entity* tail; std::vector<Nif::NiTriShapeCopy>* tailShapes;
|
Ogre::Entity* tail; std::vector<Nif::NiTriShapeCopy>* tailShapes;
|
||||||
Ogre::Entity* lBeastFoot; std::vector<Nif::NiTriShapeCopy>* lBeastFootShapes;
|
Ogre::Entity* lBeastFoot; std::vector<Nif::NiTriShapeCopy>* lBeastFootShapes;
|
||||||
Ogre::Entity* rBeastFoot; std::vector<Nif::NiTriShapeCopy>* rBeastFootShapes;
|
Ogre::Entity* rBeastFoot; std::vector<Nif::NiTriShapeCopy>* rBeastFootShapes;*/
|
||||||
|
|
||||||
//Bounded Parts
|
//Bounded Parts
|
||||||
Ogre::Entity* lclavicle;
|
Ogre::Entity* lclavicle;
|
||||||
|
@ -48,13 +56,14 @@ private:
|
||||||
Ogre::Entity* rfoot;
|
Ogre::Entity* rfoot;
|
||||||
Ogre::Entity* hair;
|
Ogre::Entity* hair;
|
||||||
Ogre::Entity* head;
|
Ogre::Entity* head;
|
||||||
|
Ogre::SceneNode* insert;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
||||||
virtual ~NpcAnimation();
|
virtual ~NpcAnimation();
|
||||||
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
||||||
void insertFreePart(const std::string &mesh, const std::string suffix, Ogre::SceneNode* insert);
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix);
|
||||||
virtual void runAnimation(float timepassed);
|
virtual void runAnimation(float timepassed);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue