pull/21/head
Marc Zinnschlag 13 years ago
parent e35aee0f89
commit 9b910dda94

@ -43,7 +43,6 @@ namespace MWClass
ptr.get<ESM::NPC>(); ptr.get<ESM::NPC>();
const std::string &model = ref->base->model;
assert (ref->base != NULL); assert (ref->base != NULL);
std::string headID = ref->base->head; std::string headID = ref->base->head;
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4); std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);

@ -112,14 +112,11 @@ namespace MWRender{
Nif::NiTriShapeCopy& copy = *allshapesiter; Nif::NiTriShapeCopy& copy = *allshapesiter;
std::vector<Ogre::Vector3>* allvertices = &copy.vertices; std::vector<Ogre::Vector3>* allvertices = &copy.vertices;
std::vector<Ogre::Vector3>* allnormals = &copy.normals;
//std::set<unsigned int> vertices; //std::set<unsigned int> vertices;
//std::set<unsigned int> normals; //std::set<unsigned int> normals;
//std::vector<Nif::NiSkinData::BoneInfoCopy> boneinfovector = copy.boneinfo; //std::vector<Nif::NiSkinData::BoneInfoCopy> boneinfovector = copy.boneinfo;
std::map<int, std::vector<Nif::NiSkinData::IndividualWeight>>* verticesToChange = &copy.vertsToWeights; std::map<int, std::vector<Nif::NiSkinData::IndividualWeight> >* verticesToChange = &copy.vertsToWeights;
//std::cout << "Name " << copy.sname << "\n"; //std::cout << "Name " << copy.sname << "\n";
Ogre::HardwareVertexBufferSharedPtr vbuf = creaturemodel->getMesh()->getSubMesh(copy.sname)->vertexData->vertexBufferBinding->getBuffer(0); Ogre::HardwareVertexBufferSharedPtr vbuf = creaturemodel->getMesh()->getSubMesh(copy.sname)->vertexData->vertexBufferBinding->getBuffer(0);
@ -135,7 +132,7 @@ namespace MWRender{
if(copy.vertices.size() == initialVertices.size()) if(copy.vertices.size() == initialVertices.size())
{ {
//Create if it doesn't already exist //Create if it doesn't already exist
if(shapeIndexI.size() == shapeNumber) if(shapeIndexI.size() == static_cast<std::size_t> (shapeNumber))
{ {
std::vector<int> vec; std::vector<int> vec;
shapeIndexI.push_back(vec); shapeIndexI.push_back(vec);
@ -178,7 +175,7 @@ namespace MWRender{
if(verticesToChange->size() > 0){ if(verticesToChange->size() > 0){
for(std::map<int, std::vector<Nif::NiSkinData::IndividualWeight>>::iterator iter = verticesToChange->begin(); for(std::map<int, std::vector<Nif::NiSkinData::IndividualWeight> >::iterator iter = verticesToChange->begin();
iter != verticesToChange->end(); iter++) iter != verticesToChange->end(); iter++)
{ {
std::vector<Nif::NiSkinData::IndividualWeight> inds = iter->second; std::vector<Nif::NiSkinData::IndividualWeight> inds = iter->second;
@ -217,7 +214,7 @@ namespace MWRender{
Ogre::Vector3 absVertPos = (vecPos + vecRot * currentVertex) * inds[0].weight; Ogre::Vector3 absVertPos = (vecPos + vecRot * currentVertex) * inds[0].weight;
for(int i = 1; i < inds.size(); i++){ for(std::size_t i = 1; i < inds.size(); i++){
boneinfocopy = &(allshapesiter->boneinfo[inds[i].boneinfocopyindex]); boneinfocopy = &(allshapesiter->boneinfo[inds[i].boneinfocopyindex]);
if(useHandles) if(useHandles)
bonePtr = skel->getBone(boneinfocopy->bonehandle); bonePtr = skel->getBone(boneinfocopy->bonehandle);
@ -253,7 +250,8 @@ namespace MWRender{
*(addr+2) = absVertPos.z; *(addr+2) = absVertPos.z;
} }
/*for (unsigned int i = 0; i < boneinfovector.size(); i++) #if 0
for (unsigned int i = 0; i < boneinfovector.size(); i++)
{ {
Nif::NiSkinData::BoneInfoCopy boneinfo = boneinfovector[i]; Nif::NiSkinData::BoneInfoCopy boneinfo = boneinfovector[i];
if(skel->hasBone(boneinfo.bonename)){ if(skel->hasBone(boneinfo.bonename)){
@ -292,7 +290,7 @@ namespace MWRender{
} }
/*if(normals.find(verIndex) == normals.end()) if(normals.find(verIndex) == normals.end())
{ {
Ogre::Vector3 absNormalsPos = vecRot * allnormals[verIndex]; Ogre::Vector3 absNormalsPos = vecRot * allnormals[verIndex];
absNormalsPos = absNormalsPos * boneinfo.weights[j].weight; absNormalsPos = absNormalsPos * boneinfo.weights[j].weight;
@ -314,8 +312,8 @@ namespace MWRender{
*(addr+1) = absNormalsPos.y; *(addr+1) = absNormalsPos.y;
*(addr+2) = absNormalsPos.z; *(addr+2) = absNormalsPos.z;
}*/ }
#endif
//} //}
//} //}
@ -546,7 +544,7 @@ namespace MWRender{
//base->_updateAnimation(); //base->_updateAnimation();
base->_notifyMoved(); base->_notifyMoved();
} }
for(int i = 0; i < entityparts.size(); i++){ for(std::size_t i = 0; i < entityparts.size(); i++){
skel = entityparts[i]->getSkeleton(); skel = entityparts[i]->getSkeleton();
if(skel->hasBone(iter->getBonename())){ if(skel->hasBone(iter->getBonename())){
Ogre::Bone* bone = skel->getBone(iter->getBonename()); Ogre::Bone* bone = skel->getBone(iter->getBonename());

@ -22,9 +22,9 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, MWWorld::Environme
base = mRend.getScene()->createEntity(meshNumbered); base = mRend.getScene()->createEntity(meshNumbered);
std::string meshZero = mesh + "0000>|"; std::string meshZero = mesh + "0000>|";
if(transformations = (NIFLoader::getSingletonPtr())->getAnim(meshZero)){ if((transformations = (NIFLoader::getSingletonPtr())->getAnim(meshZero))){
for(int init = 0; init < transformations->size(); init++){ for(std::size_t init = 0; init < transformations->size(); init++){
rindexI.push_back(0); rindexI.push_back(0);
tindexI.push_back(0); tindexI.push_back(0);
} }

@ -67,7 +67,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
//stay in the same place when we skipanim, or open a gui window //stay in the same place when we skipanim, or open a gui window
if(transformations = (NIFLoader::getSingletonPtr())->getAnim(smodel)){ if((transformations = (NIFLoader::getSingletonPtr())->getAnim(smodel))){
for(unsigned int init = 0; init < transformations->size(); init++){ for(unsigned int init = 0; init < transformations->size(); init++){
rindexI.push_back(0); rindexI.push_back(0);

@ -22,7 +22,7 @@ namespace MWRender {
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment) RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment)
:mRendering(_rend), mObjects(mRendering), mDebugging(engine), mActors(mRendering, environment) :mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mDebugging(engine)
{ {
mRendering.createScene("PlayerCam", 55, 5); mRendering.createScene("PlayerCam", 55, 5);
mSkyManager = MWRender::SkyManager::create(mRendering.getWindow(), mRendering.getCamera(), resDir); mSkyManager = MWRender::SkyManager::create(mRendering.getWindow(), mRendering.getCamera(), resDir);

@ -103,7 +103,7 @@ struct NiTriShapeCopy
std::vector<Ogre::Vector3> vertices; std::vector<Ogre::Vector3> vertices;
std::vector<Ogre::Vector3> normals; std::vector<Ogre::Vector3> normals;
std::vector<Nif::NiSkinData::BoneInfoCopy> boneinfo; std::vector<Nif::NiSkinData::BoneInfoCopy> boneinfo;
std::map<int, std::vector<Nif::NiSkinData::IndividualWeight>> vertsToWeights; std::map<int, std::vector<Nif::NiSkinData::IndividualWeight> > vertsToWeights;
Nif::NiMorphData morph; Nif::NiMorphData morph;
}; };

@ -1024,18 +1024,17 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
for(std::vector<Nif::NiTextKeyExtraData::TextKey>::iterator textiter = extra->list.begin(); textiter != extra->list.end(); textiter++) for(std::vector<Nif::NiTextKeyExtraData::TextKey>::iterator textiter = extra->list.begin(); textiter != extra->list.end(); textiter++)
{ {
std::string text = textiter->text.toString(); std::string text = textiter->text.toString();
replace(text.begin(), text.end(), '\n', '/'); replace(text.begin(), text.end(), '\n', '/');
text.erase(std::remove(text.begin(), text.end(), '\r'), text.end()); text.erase(std::remove(text.begin(), text.end(), '\r'), text.end());
int i = 0; std::size_t i = 0;
while(i < text.length()){ while(i < text.length()){
while(i < text.length() && text.at(i) == '/' ){ while(i < text.length() && text.at(i) == '/' ){
i++; i++;
} }
int first = i; std::size_t first = i;
int length = 0; int length = 0;
while(i < text.length() && text.at(i) != '/' ){ while(i < text.length() && text.at(i) != '/' ){
i++; i++;
@ -1263,7 +1262,6 @@ void NIFLoader::loadResource(Resource *resource)
{ {
Nif::NiKeyframeController *f = dynamic_cast<Nif::NiKeyframeController*>(nif.getRecord(i)); Nif::NiKeyframeController *f = dynamic_cast<Nif::NiKeyframeController*>(nif.getRecord(i));
Nif::Node *n = dynamic_cast<Nif::Node*>(nif.getRecord(i));
if(f != NULL) if(f != NULL)
{ {
hasAnim = true; hasAnim = true;
@ -1277,8 +1275,6 @@ void NIFLoader::loadResource(Resource *resource)
data->setStopTime(f->timeStop); data->setStopTime(f->timeStop);
allanim.push_back(data.get()); allanim.push_back(data.get());
} }
} }
} }

@ -121,7 +121,7 @@ class NIFLoader : Ogre::ManualResourceLoader
void setVerbosePath(std::string path); void setVerbosePath(std::string path);
private: private:
NIFLoader() : mNormaliseNormals(false), resourceGroup("General"), resourceName(""), flip(false), NIFLoader() : resourceName(""), resourceGroup("General"), flip(false), mNormaliseNormals(false),
mFlipVertexWinding(false), mOutputAnimFiles(false) {} mFlipVertexWinding(false), mOutputAnimFiles(false) {}
NIFLoader(NIFLoader& n) {} NIFLoader(NIFLoader& n) {}

Loading…
Cancel
Save