mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 11:56:39 +00:00 
			
		
		
		
	Merge remote branch 'jhooks/directories' into directories
This commit is contained in:
		
						commit
						18a9dfd2b6
					
				
					 3 changed files with 33 additions and 180 deletions
				
			
		| 
						 | 
					@ -118,7 +118,7 @@ namespace MWClass
 | 
				
			||||||
        Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
 | 
					        Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (groin){
 | 
					        if (groin){
 | 
				
			||||||
			cellRender.insertMesh("MeSHes\\1\\red_MJ_hat_org.NIf");        //w/W_6th_Hammer.NIF
 | 
								cellRender.insertMesh("Meshes\\2\\red_MJ_hat_org.nif");        //w/W_6th_Hammer.NIF
 | 
				
			||||||
			//bald_MJ_hat.NIF
 | 
								//bald_MJ_hat.NIF
 | 
				
			||||||
            cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, kOgrePi, npcName + "groin", addresses, numbers);
 | 
					            cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, kOgrePi, npcName + "groin", addresses, numbers);
 | 
				
			||||||
            addresses2[numbers] = npcName + "groin";
 | 
					            addresses2[numbers] = npcName + "groin";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,7 +107,7 @@ class DirArchive: public Ogre::FileSystemArchive
 | 
				
			||||||
        small = original.substr(cutoff - 1, original.size() - cutoff);
 | 
					        small = original.substr(cutoff - 1, original.size() - cutoff);
 | 
				
			||||||
    //boost::filesystem::path smallp = small;
 | 
					    //boost::filesystem::path smallp = small;
 | 
				
			||||||
    m[small] = filesind;
 | 
					    m[small] = filesind;
 | 
				
			||||||
    //std::cout << "Directory: " << smallp.string() << " " << filesind.size() << "\n";
 | 
					    //std::cout << "Directory: " << small << " " << filesind.size() << "\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,8 +126,7 @@ class DirArchive: public Ogre::FileSystemArchive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::string copy = filename;
 | 
					        std::string copy = filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if(OGRE_PLATFORM != OGRE_PLATFORM_WIN32)
 | 
					  
 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for (int i = 0; i < filename.size(); i++)
 | 
					      for (int i = 0; i < filename.size(); i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
| 
						 | 
					@ -135,7 +134,7 @@ class DirArchive: public Ogre::FileSystemArchive
 | 
				
			||||||
                copy.replace(i, 1, "/");
 | 
					                copy.replace(i, 1, "/");
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      }
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if(copy.at(0) == '\\' || copy.at(0) == '/')
 | 
					      if(copy.at(0) == '\\' || copy.at(0) == '/')
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -189,8 +188,7 @@ class DirArchive: public Ogre::FileSystemArchive
 | 
				
			||||||
       //std::cout << "Open\n";
 | 
					       //std::cout << "Open\n";
 | 
				
			||||||
        std::string copy = filename;
 | 
					        std::string copy = filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if(OGRE_PLATFORM != OGRE_PLATFORM_WIN32)
 | 
					    
 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for (int i = 0; i < filename.size(); i++)
 | 
					      for (int i = 0; i < filename.size(); i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
| 
						 | 
					@ -198,7 +196,7 @@ class DirArchive: public Ogre::FileSystemArchive
 | 
				
			||||||
                copy.replace(i, 1, "/");
 | 
					                copy.replace(i, 1, "/");
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      }
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if(copy.at(0) == '\\' || copy.at(0) == '/')
 | 
					      if(copy.at(0) == '\\' || copy.at(0) == '/')
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1080,155 +1080,10 @@ void NIFLoader::loadResource(Resource *resource)
 | 
				
			||||||
                                        bounds.maxX(), bounds.maxY(), bounds.maxZ()));
 | 
					                                        bounds.maxX(), bounds.maxY(), bounds.maxZ()));
 | 
				
			||||||
        mesh->_setBoundingSphereRadius(bounds.getRadius());
 | 
					        mesh->_setBoundingSphereRadius(bounds.getRadius());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
	for(int i = 0; i < nif.numRecords(); i++)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	Nif::NiKeyframeController *f = dynamic_cast<Nif::NiKeyframeController*>(nif.getRecord(i));
 | 
					 | 
				
			||||||
	Nif::Node *n = dynamic_cast<Nif::Node*>(nif.getRecord(i));
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(f != NULL)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		Nif::NiKeyframeDataPtr data = f->data;
 | 
					 | 
				
			||||||
		std::cout << "Controller's Rtype:" <<  data->getRtype() << "Stype: " << data->getStype() << "Ttype:" << data->getTtype() << "\n";
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if(first){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			float end = f->timeStop;
 | 
					 | 
				
			||||||
			//std::cout <<"Creating WholeThing" << end << "\n";
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			//TRANSLATION
 | 
					 | 
				
			||||||
			if(!mSkel.isNull()){
 | 
					 | 
				
			||||||
			std::cout <<"Creating WholeThing" << end << "\n";
 | 
					 | 
				
			||||||
			animcore = mSkel->createAnimation("WholeThing", end);
 | 
					 | 
				
			||||||
			//animcore->setInterpolationMode(Ogre::Animation::IM_SPLINE);
 | 
					 | 
				
			||||||
			//animcore->setRotationInterpolationMode(Ogre::Animation::RIM_SPHERICAL);
 | 
					 | 
				
			||||||
			//animcore2->setRotationInterpolationMode(Ogre::Animation::RIM_LINEAR);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			//ROTATION
 | 
					 | 
				
			||||||
			animcore2 = mSkel->createAnimation("WholeThing2", end);
 | 
					 | 
				
			||||||
			//animcore2->setInterpolationMode(Ogre::Animation::IM_SPLINE);
 | 
					 | 
				
			||||||
			//animcore2->setRotationInterpolationMode(Ogre::Animation::RIM_SPHERICAL);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			std::cout <<"AFTER";
 | 
					 | 
				
			||||||
			first = false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		 if(animcore && animcore2){
 | 
					 | 
				
			||||||
		Nif::Named *node = dynamic_cast<Nif::Named*> ( f->target.getPtr());
 | 
					 | 
				
			||||||
			std::cout << "The target rec: " << node->name.toString() << "\n";
 | 
					 | 
				
			||||||
			Ogre::NodeAnimationTrack* mTrack = animcore->createNodeTrack(handle, mSkel->getBone(node->name.toString()));
 | 
					 | 
				
			||||||
		Ogre::NodeAnimationTrack* mTrack2 = animcore2->createNodeTrack(handle++, mSkel->getBone(node->name.toString()));
 | 
					 | 
				
			||||||
			/* if (node->recType == RC_NiNode)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
        NodeList &list = ((NiNode*)node)->children;
 | 
					 | 
				
			||||||
        int n = list.length();
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
        for (int i = n; i<=n; i++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
			if(skel->hasBone((list[i]).name.toString()))
 | 
					 | 
				
			||||||
				mTrack3 = animcore2->createNodeTrack(handle++, skel->getBone((list[i]).name.toString()));
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }*/
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		std::vector<Ogre::Quaternion> quats = data->getQuat();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Quaternion>::iterator quatIter = quats.begin();
 | 
					 | 
				
			||||||
		std::vector<float> rtime = data->getrTime();
 | 
					 | 
				
			||||||
		std::vector<float>::iterator rtimeiter = rtime.begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		std::vector<float> ttime = data->gettTime();
 | 
					 | 
				
			||||||
		std::vector<float>::iterator ttimeiter = ttime.begin();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Vector3> translist1  = data->getTranslist1();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Vector3>::iterator transiter = translist1.begin();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Vector3> translist2  = data->getTranslist2();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Vector3>::iterator transiter2 = translist2.begin();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Vector3> translist3  = data->getTranslist3();
 | 
					 | 
				
			||||||
		std::vector<Ogre::Vector3>::iterator transiter3 = translist3.begin();
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		float tleft = 0;
 | 
					 | 
				
			||||||
		float rleft = 0.0;
 | 
					 | 
				
			||||||
		float ttotal = 0.0;
 | 
					 | 
				
			||||||
		float rtotal = 0;
 | 
					 | 
				
			||||||
		Ogre::TransformKeyFrame* mKey;
 | 
					 | 
				
			||||||
		Ogre::TransformKeyFrame* mKey2;
 | 
					 | 
				
			||||||
		float tused = 0.0;
 | 
					 | 
				
			||||||
		float rused = 0.0;
 | 
					 | 
				
			||||||
		Ogre::Quaternion lastquat;
 | 
					 | 
				
			||||||
		Ogre::Vector3 lasttrans;
 | 
					 | 
				
			||||||
		bool rend = false;
 | 
					 | 
				
			||||||
		bool tend = false;
 | 
					 | 
				
			||||||
		Ogre::Quaternion test;// = (skel->getBone(node->name.toString()))->getOrientation();
 | 
					 | 
				
			||||||
		for (int j = 0 ; j < ttime.size(); j++)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			if(data->getTtype() >= 1 && data->getTtype() <= 5)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				
 | 
					 | 
				
			||||||
			    Ogre::TransformKeyFrame* mKey = mTrack->createNodeKeyFrame(*ttimeiter);
 | 
					 | 
				
			||||||
				Ogre::Vector3 standard = *transiter;
 | 
					 | 
				
			||||||
				if(data->getTtype() == 2)
 | 
					 | 
				
			||||||
					standard = *transiter *  *transiter2  *  *transiter3;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				mKey->setTranslate(standard);/*
 | 
					 | 
				
			||||||
				if(mTrack3)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
					 Ogre::TransformKeyFrame* mKey3 = mTrack->createNodeKeyFrame(*ttimeiter);
 | 
					 | 
				
			||||||
					mKey3->setTranslate(standard);
 | 
					 | 
				
			||||||
				}*/
 | 
					 | 
				
			||||||
				//mKey->setRotation(Quaternion::ZERO);
 | 
					 | 
				
			||||||
				//mKey->setScale(Ogre::Vector3(1,1,1));
 | 
					 | 
				
			||||||
				transiter++;               //START
 | 
					 | 
				
			||||||
				transiter2++;
 | 
					 | 
				
			||||||
				transiter3++;
 | 
					 | 
				
			||||||
			    ttimeiter++;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		for (int j = 0 ; j < rtime.size(); j++)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			if(data->getRtype() >= 1 && data->getRtype() <= 5)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			    Ogre::TransformKeyFrame* mKey2 = mTrack2->createNodeKeyFrame(*rtimeiter);
 | 
					 | 
				
			||||||
				test = *quatIter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				mKey2->setRotation(test);
 | 
					 | 
				
			||||||
				//mKey2->setTranslate(Ogre::Vector3(0,0,0));
 | 
					 | 
				
			||||||
				//mKey2->setScale(Ogre::Vector3(1,1,1));
 | 
					 | 
				
			||||||
				quatIter++;
 | 
					 | 
				
			||||||
			    rtimeiter++;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		 }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
					 | 
				
			||||||
		//mTrack = animcore->createNodeTrack(handle++, skel->getBone(node->name.toString()));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		std::vector<float> stime = data->getsTime();
 | 
					 | 
				
			||||||
		std::vector<float>::iterator stimeiter = stime.begin();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		std::vector<float> sfactor = data->getScalefactor();
 | 
					 | 
				
			||||||
		std::vector<float>::iterator sfactoriter = sfactor.begin();
 | 
					 | 
				
			||||||
		for (int i = 0 ; i < stime.size(); i++)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			if(data->getStype() >= 1 && data->getStype() <= 5)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			    Ogre::TransformKeyFrame* mKey = mTrack->createNodeKeyFrame(*stimeiter);
 | 
					 | 
				
			||||||
			    mKey->setScale(Ogre::Vector3(*sfactoriter, *sfactoriter, *sfactoriter));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			    sfactoriter++;
 | 
					 | 
				
			||||||
			    stimeiter++;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	//std::cout <"BE\n";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
    // set skeleton
 | 
					    // set skeleton
 | 
				
			||||||
  if (!mSkel.isNull() && mesh->isLoaded())
 | 
					  if (!mSkel.isNull() && mesh->isLoaded())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue