diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 97596301cf..483a74eef5 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -353,9 +353,6 @@ void OMW::Engine::go() mOgre.configure(!isFile(ogreCfg.c_str()), cfgUserDir, plugCfg, false); - //addResourcesDirectory (mDataDir / "Meshes"); - //addResourcesDirectory (mDataDir / "Textures"); - // This has to be added BEFORE MyGUI is initialized, as it needs // to find core.xml here. addResourcesDirectory(mResDir / "mygui"); diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 5316c8267e..0bd133f21c 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -34,7 +34,7 @@ namespace MWClass if (!model.empty()) { MWRender::Rendering rendering (cellRender, ref->ref); - cellRender.insertMesh("meshes\\" + model); + cellRender.insertMesh("meshes\\" + model); cellRender.insertActorPhysics(); ref->mData.setHandle (rendering.end (ref->mData.isEnabled())); } diff --git a/apps/openmw/mwrender/cellimp.hpp b/apps/openmw/mwrender/cellimp.hpp index 727c9d3172..272bfeeab4 100644 --- a/apps/openmw/mwrender/cellimp.hpp +++ b/apps/openmw/mwrender/cellimp.hpp @@ -7,7 +7,6 @@ #include "../mwworld/refdata.hpp" #include -#include namespace Ogre { @@ -43,7 +42,6 @@ namespace MWRender virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst) = 0; virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements) = 0; virtual void insertMesh(const std::string &mesh) = 0; - //virtual Ogre::Entity* insertAndDeliverMesh(const std::string &mesh) = 0; virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements) = 0; diff --git a/apps/openmw/mwrender/exterior.cpp b/apps/openmw/mwrender/exterior.cpp index aa712dede5..fe54af84ac 100644 --- a/apps/openmw/mwrender/exterior.cpp +++ b/apps/openmw/mwrender/exterior.cpp @@ -273,21 +273,6 @@ std::string ExteriorCellRender::insertEnd (bool enable) return handle; } -/* -Ogre::Entity* ExteriorCellRender::insertAndDeliverMesh(const std::string &mesh) -{ - assert (insert); - - NIFLoader::load(mesh); - Entity *ent = mScene.getMgr()->createEntity(mesh); - ent->setDisplaySkeleton(true); - - - mInsert->attachObject(ent); - return ent; - -}*/ - // configure lighting according to cell void ExteriorCellRender::configureAmbient() diff --git a/apps/openmw/mwrender/exterior.hpp b/apps/openmw/mwrender/exterior.hpp index 87659a2135..8458e4dd8a 100644 --- a/apps/openmw/mwrender/exterior.hpp +++ b/apps/openmw/mwrender/exterior.hpp @@ -71,7 +71,7 @@ namespace MWRender virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst); virtual void insertMesh(const std::string &mesh); - //virtual Ogre::Entity* insertAndDeliverMesh(const std::string &mesh); + virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements); virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements); diff --git a/apps/openmw/mwrender/interior.cpp b/apps/openmw/mwrender/interior.cpp index 09cce2f6d3..201eaf542c 100644 --- a/apps/openmw/mwrender/interior.cpp +++ b/apps/openmw/mwrender/interior.cpp @@ -180,32 +180,13 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, } } -/* -Ogre::Entity* InteriorCellRender::insertAndDeliverMesh(const std::string &mesh) -{ - - assert (insert); - - NIFLoader::load(mesh); - Entity *ent = scene.getMgr()->createEntity(mesh); - ent->setDisplaySkeleton(true); - - - insert->attachObject(ent); - return ent; - -}*/ - - void InteriorCellRender::insertMesh(const std::string &mesh) { - assert (insert); - //if(mesh == "\\Meshes\\bald_MJ_hat.NIF") - // NIFLoader::load(mesh, ""); - //else - NIFLoader::load(mesh); - MovableObject *ent = scene.getMgr()->createEntity(mesh); - insert->attachObject(ent); + assert (insert); + + NIFLoader::load(mesh); + MovableObject *ent = scene.getMgr()->createEntity(mesh); + insert->attachObject(ent); if (mInsertMesh.empty()) mInsertMesh = mesh; diff --git a/apps/openmw/mwrender/interior.hpp b/apps/openmw/mwrender/interior.hpp index f77d3358d4..7c4b2aaf11 100644 --- a/apps/openmw/mwrender/interior.hpp +++ b/apps/openmw/mwrender/interior.hpp @@ -6,7 +6,6 @@ #include "OgreColourValue.h" #include -#include namespace Ogre { @@ -68,7 +67,6 @@ namespace MWRender virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements); virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements); /// insert a mesh related to the most recent insertBegin call. - //virtual Ogre::Entity* insertAndDeliverMesh(const std::string &mesh); virtual void insertMesh(const std::string &mesh); virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements); virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst); diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index abff70664b..970118a13b 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -63,7 +63,7 @@ namespace MWSound */ OEManagerPtr mgr; SoundPtr music; - + /* This class calls update() on the sound manager each frame using and Ogre::FrameListener */ @@ -84,11 +84,11 @@ namespace MWSound // finding. It takes DOS paths (any case, \\ slashes or / slashes) // relative to the sound dir, and translates them into full paths // of existing files in the filesystem, if they exist. - bool FSstrict; + bool FSstrict; FileFinder::FileFinder files; - FileFinder::FileFinderStrict strict; - FileFinder::FileFinder musicpath; - FileFinder::FileFinderStrict musicpathStrict; + FileFinder::FileFinderStrict strict; + FileFinder::FileFinder musicpath; + FileFinder::FileFinderStrict musicpathStrict; SoundImpl(Ogre::Root *root, Ogre::Camera *camera, const ESMS::ESMStore &str, @@ -98,9 +98,9 @@ namespace MWSound , cameraTracker(mgr) , store(str) , files(soundDir), strict(soundDir) - ,musicpath(musicDir), musicpathStrict(musicDir) + ,musicpath(musicDir), musicpathStrict(musicDir) { - FSstrict = fsstrict; + FSstrict = fsstrict; cout << "Sound output: " << SOUND_OUT << endl; cout << "Sound decoder: " << SOUND_IN << endl; // Attach the camera to the camera tracker @@ -131,72 +131,74 @@ namespace MWSound bool hasFile(const std::string &str, bool music = false) { - if(FSstrict == false){ - if(music){ - if(musicpath.has(str)) return true; - // Not found? Try with .mp3 - return musicpath.has(toMp3(str)); - } - else - { - if(files.has(str)) return true; - return files.has(toMp3(str)); - } - } - else - { - if(music){ - if(musicpathStrict.has(str)) return true; - // Not found? Try with .mp3 - return musicpathStrict.has(toMp3(str)); - } - else - { - if(strict.has(str)) return true; - return strict.has(toMp3(str)); - } - - } - } + if(FSstrict == false) + { + if(music) + { + if(musicpath.has(str)) return true; + + // Not found? Try with .mp3 + return musicpath.has(toMp3(str)); + } + else + { + if(files.has(str)) return true; + return files.has(toMp3(str)); + } + } + else + { + if(music) + { + if(musicpathStrict.has(str)) return true; + + // Not found? Try with .mp3 + return musicpathStrict.has(toMp3(str)); + } + else + { + if(strict.has(str)) return true; + return strict.has(toMp3(str)); + } + } + } // Convert a Morrowind sound path (eg. Fx\funny.wav) to full path // with proper slash conversion (eg. datadir/Sound/Fx/funny.wav) std::string convertPath(const std::string &str, bool music = false) { - if(FSstrict == false){ - // Search and return - if(music && musicpath.has(str)) - return musicpath.lookup(str); - else if(files.has(str)) - return files.lookup(str); - - - // Try mp3 if the wav wasn't found - std::string mp3 = toMp3(str); - if(music && musicpath.has(mp3)) - return musicpath.lookup(mp3); - else if(files.has(mp3)) - return files.lookup(mp3); - } - - else - { - if(music && musicpathStrict.has(str)) - return musicpathStrict.lookup(str); - else if(strict.has(str)) - return strict.lookup(str); - - - // Try mp3 if the wav wasn't found - std::string mp3 = toMp3(str); - if(music && musicpathStrict.has(mp3)) - return musicpathStrict.lookup(mp3); - else if(strict.has(str)) - return strict.lookup(mp3); - } - - // Give up - return ""; + if(FSstrict == false) + { + // Search and return + if(music && musicpath.has(str)) + return musicpath.lookup(str); + else if(files.has(str)) + return files.lookup(str); + + // Try mp3 if the wav wasn't found + std::string mp3 = toMp3(str); + if(music && musicpath.has(mp3)) + return musicpath.lookup(mp3); + else if(files.has(mp3)) + return files.lookup(mp3); + } + else + { + if(music && musicpathStrict.has(str)) + return musicpathStrict.lookup(str); + else if(strict.has(str)) + return strict.lookup(str); + + // Try mp3 if the wav wasn't found + std::string mp3 = toMp3(str); + if(music && musicpathStrict.has(mp3)) + return musicpathStrict.lookup(mp3); + else if(strict.has(str)) + return strict.lookup(mp3); + } + + // Give up + return ""; } // Convert a soundId to file name, and modify the volume @@ -377,9 +379,8 @@ namespace MWSound const ESMS::ESMStore &store, boost::filesystem::path dataDir, bool useSound, bool fsstrict) - : mData(NULL) + : mData(NULL), fsStrict (fsstrict) { - fsStrict = fsstrict; MP3Lookup(dataDir / "Music/Explore/"); if(useSound) mData = new SoundImpl(root, camera, store, (dataDir / "Sound").string(), (dataDir / "Music").string(), fsstrict); @@ -391,13 +392,14 @@ namespace MWSound delete mData; } - void SoundManager::streamMusic(const std::string& filename){ - if(mData->hasFile(filename, true)) - { - std::string fullpath = mData->convertPath(filename, true); - streamMusicFull(fullpath); - } - } + void SoundManager::streamMusic(const std::string& filename) + { + if(mData->hasFile(filename, true)) + { + std::string fullpath = mData->convertPath(filename, true); + streamMusicFull(fullpath); + } + } void SoundManager::MP3Lookup(boost::filesystem::path dir) @@ -476,7 +478,7 @@ namespace MWSound return !mData->isPlaying(ptr, "_say_sound"); } - + void SoundManager::playSound (const std::string& soundId, float volume, float pitch) { if(!mData) return; diff --git a/apps/openmw/mwsound/soundmanager.hpp b/apps/openmw/mwsound/soundmanager.hpp index ec33f57a2a..ab9559176e 100644 --- a/apps/openmw/mwsound/soundmanager.hpp +++ b/apps/openmw/mwsound/soundmanager.hpp @@ -27,27 +27,28 @@ namespace MWSound // Hide implementation details - engine.cpp is compiling // enough as it is. struct SoundImpl; - + SoundImpl *mData; std::vector files; - bool fsStrict; - void streamMusicFull (const std::string& filename); + bool fsStrict; + + void streamMusicFull (const std::string& filename); ///< Play a soundifle /// \param absolute filename - + public: - SoundManager(Ogre::Root*, Ogre::Camera*, const ESMS::ESMStore &store, boost::filesystem::path dataDir, bool useSound, bool fsstrict); ~SoundManager(); - void streamMusic(const std::string& filename); - ///< Play a soundifle + void streamMusic(const std::string& filename); + ///< Play a soundifle /// \param filename name of a sound file in "Music/" in the data directory. + void startRandomTitle(); void MP3Lookup(boost::filesystem::path dir); - //struct SoundImpl; + bool isMusicPlaying(); SoundImpl getMData(); @@ -59,7 +60,7 @@ namespace MWSound bool sayDone (MWWorld::Ptr reference) const; ///< Is actor not speaking? - + void playSound (const std::string& soundId, float volume, float pitch); ///< Play a sound, independently of 3D-position diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index f1cf217102..f29b8b237d 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -66,14 +66,13 @@ class DirArchive: public Ogre::FileSystemArchive public: DirArchive(const String& name) - : FileSystemArchive(name, "Dir") - { - mType = "Dir"; - currentdir = name; - std::string s = name; - cutoff = s.size() + 1; - if(fsstrict == false) - populateMap(currentdir); + : FileSystemArchive(name, "Dir"), currentdir (name) + { + mType = "Dir"; + std::string s = name; + cutoff = s.size() + 1; + if(fsstrict == false) + populateMap(currentdir); } void populateMap(boost::filesystem::path d){ @@ -134,11 +133,10 @@ class DirArchive: public Ogre::FileSystemArchive copy.erase(0, 1); } if(fsstrict == true) - { - //std::cout << "fsstrict " << copy << "\n"; - return FileSystemArchive::exists(copy); - - } + { + //std::cout << "fsstrict " << copy << "\n"; + return FileSystemArchive::exists(copy); + } int last = copy.size() - 1; @@ -185,9 +183,10 @@ class DirArchive: public Ogre::FileSystemArchive copy.erase(0, 1); } - if(fsstrict == true){ - return FileSystemArchive::open(copy, readonly); - } + if(fsstrict == true) + { + return FileSystemArchive::open(copy, readonly); + } int last = copy.size() - 1; @@ -199,7 +198,7 @@ class DirArchive: public Ogre::FileSystemArchive break; } - std::string folder = copy.substr(0, i); //folder with no slash + std::string folder = copy.substr(0, i); //folder with no slash std::vector current = mlocal[folder]; for(std::vector::iterator iter = current.begin(); iter != current.end(); iter++) diff --git a/components/esm_store/cell_store.hpp b/components/esm_store/cell_store.hpp index a55bb3d0e2..43860dff38 100644 --- a/components/esm_store/cell_store.hpp +++ b/components/esm_store/cell_store.hpp @@ -14,7 +14,6 @@ #include "components/esm/records.hpp" #include "components/esm/loadcell.hpp" #include -#include #include #include @@ -30,8 +29,6 @@ namespace ESMS // The object that this instance is based on. const X* base; - Ogre::Entity *model; - /* Information about this instance, such as 3D location and rotation and individual type-dependent data. */ diff --git a/components/file_finder/file_finder.hpp b/components/file_finder/file_finder.hpp index 358563afad..0e1e072263 100644 --- a/components/file_finder/file_finder.hpp +++ b/components/file_finder/file_finder.hpp @@ -20,9 +20,9 @@ class FileFinderT void add(const boost::filesystem::path &pth) { - std::string file = pth.string(); - std::string key = file.substr(cut); - owner->table[key] = file; + std::string file = pth.string(); + std::string key = file.substr(cut); + owner->table[key] = file; } }; @@ -50,13 +50,13 @@ public: bool has(const std::string& file) const { - return table.find(file) != table.end(); + return table.find(file) != table.end(); } // Find the full path from a relative path. const std::string &lookup(const std::string& file) const { - return table.find(file)->second; + return table.find(file)->second; } }; diff --git a/components/files/multidircollection.hpp b/components/files/multidircollection.hpp index a4345fb82b..898700c06e 100644 --- a/components/files/multidircollection.hpp +++ b/components/files/multidircollection.hpp @@ -23,7 +23,7 @@ namespace Files return left -#include namespace Nif { @@ -435,266 +434,71 @@ public: class NiKeyframeData : public Record { - - //Rotations - std::vector quats; - std::vector tbc; - std::vector rottime; - int rtype; - - //Translations - std::vector translist1; - std::vector translist2; - std::vector translist3; - std::vector transtbc; - std::vector transtime; - int ttype; - - //Scalings - - std::vector scalefactor; - std::vector scaletime; - std::vector forwards; - std::vector backwards; - std::vector tbcscale; - int stype; - -public: - - void read(NIFFile *nif) - { - // Rotations first - int count = nif->getInt(); - //std::vector quat(count); - //std::vector rottime(count); - std::cout << "r"; - if(count) - { - - //TYPE1 LINEAR_KEY - //TYPE2 QUADRATIC_KEY - //TYPE3 TBC_KEY - //TYPE4 XYZ_ROTATION_KEY - //TYPE5 UNKNOWN_KEY - rtype = nif->getInt(); - //std::cout << "Count: " << count << "Type: " << type << "\n"; - - if(rtype == 1) - { - //We need to actually read in these values instead of skipping them - //nif->skip(count*4*5); // time + quaternion - for (int i = 0; i < count; i++) { - float time = nif->getFloat(); - float w = nif->getFloat(); - float x = nif->getFloat(); - float y = nif->getFloat(); - float z = nif->getFloat(); - Ogre::Quaternion quat = Ogre::Quaternion(Ogre::Real(w), Ogre::Real(x), Ogre::Real(y), Ogre::Real(z)); - quats.push_back(quat); - rottime.push_back(time); - //if(time == 0.0 || time > 355.5) - // std::cout <<"Time:" << time << "W:" << w <<"X:" << x << "Y:" << y << "Z:" << z << "\n"; - } - } - else if(rtype == 3) - { //Example - node 116 in base_anim.nif - for (int i = 0; i < count; i++) { - float time = nif->getFloat(); - float w = nif->getFloat(); - float x = nif->getFloat(); - float y = nif->getFloat(); - float z = nif->getFloat(); - - float tbcx = nif->getFloat(); - float tbcy = nif->getFloat(); - float tbcz = nif->getFloat(); - Ogre::Quaternion quat = Ogre::Quaternion(Ogre::Real(w), Ogre::Real(x), Ogre::Real(y), Ogre::Real(z)); - Ogre::Vector3 vec = Ogre::Vector3(tbcx, tbcy, tbcz); - quats.push_back(quat); - rottime.push_back(time); - tbc.push_back(vec); - //if(time == 0.0 || time > 355.5) - // std::cout <<"Time:" << time << "W:" << w <<"X:" << x << "Y:" << y << "Z:" << z << "\n"; - } - - //nif->skip(count*4*8); // rot1 + tension+bias+continuity - } - else if(rtype == 4) - { - for(int j=0;jgetFloat(); // time - for(int i=0; i<3; i++) - { - int cnt = nif->getInt(); - int type = nif->getInt(); - if(type == 1) - nif->skip(cnt*4*2); // time + unknown - else if(type == 2) - nif->skip(cnt*4*4); // time + unknown vector - else nif->fail("Unknown sub-rotation type"); - } - } - } - else nif->fail("Unknown rotation type in NiKeyframeData"); - } - //first = false; - - // Then translation - count = nif->getInt(); - - if(count) - { - ttype = nif->getInt(); - - //std::cout << "TransCount:" << count << " Type: " << type << "\n"; - if(ttype == 1) { - for (int i = 0; i < count; i++) { - float time = nif->getFloat(); - float x = nif->getFloat(); - float y = nif->getFloat(); - float z = nif->getFloat(); - Ogre::Vector3 trans = Ogre::Vector3(x, y, z); - translist1.push_back(trans); - transtime.push_back(time); - } - //nif->getFloatLen(count*4); // time + translation - } - else if(ttype == 2) - { //Example - node 116 in base_anim.nif - for (int i = 0; i < count; i++) { - float time = nif->getFloat(); - float x = nif->getFloat(); - float y = nif->getFloat(); - float z = nif->getFloat(); - float x2 = nif->getFloat(); - float y2 = nif->getFloat(); - float z2 = nif->getFloat(); - float x3 = nif->getFloat(); - float y3 = nif->getFloat(); - float z3 = nif->getFloat(); - Ogre::Vector3 trans = Ogre::Vector3(x, y, z); - Ogre::Vector3 trans2 = Ogre::Vector3(x2, y2, z2); - Ogre::Vector3 trans3 = Ogre::Vector3(x3, y3, z3); - transtime.push_back(time); - translist1.push_back(trans); - translist2.push_back(trans2); - translist3.push_back(trans3); - } - - //nif->getFloatLen(count*10); // trans1 + forward + backward - } - else if(ttype == 3){ - for (int i = 0; i < count; i++) { - float time = nif->getFloat(); - float x = nif->getFloat(); - float y = nif->getFloat(); - float z = nif->getFloat(); - float t = nif->getFloat(); - float b = nif->getFloat(); - float c = nif->getFloat(); - Ogre::Vector3 trans = Ogre::Vector3(x, y, z); - Ogre::Vector3 tbc = Ogre::Vector3(t, b, c); - translist1.push_back(trans); - transtbc.push_back(tbc); - transtime.push_back(time); - } - //nif->getFloatLen(count*7); // trans1 + tension,bias,continuity - } - else nif->fail("Unknown translation type"); - } - - // Finally, scalings - count = nif->getInt(); - if(count) - { - stype = nif->getInt(); - - - for(int i = 0; i < count; i++){ - - - //int size = 0; - if(stype >= 1 && stype < 4) - { - float time = nif->getFloat(); - float scale = nif->getFloat(); - scaletime.push_back(time); - scalefactor.push_back(scale); - //size = 2; // time+scale - } - else nif->fail("Unknown scaling type"); - if(stype == 2){ - //size = 4; // 1 + forward + backward (floats) - float forward = nif->getFloat(); - float backward = nif->getFloat(); - forwards.push_back(forward); - backwards.push_back(backward); - } - else if(stype == 3){ - float tbcx = nif->getFloat(); - float tbcy = nif->getFloat(); - float tbcz = nif->getFloat(); - Ogre::Vector3 vec = Ogre::Vector3(tbcx, tbcy, tbcz); - tbcscale.push_back(vec); - - //size = 5; // 1 + tbc - } - - } - } - else - stype = 0; - } - int getRtype(){ - return rtype; - } - int getStype(){ - return stype; - } - int getTtype(){ - return ttype; - } - std::vector getQuat(){ - return quats; - } - std::vector getrTbc(){ - return tbc; - } - std::vector getrTime(){ - return rottime; - } - - std::vector getTranslist1(){ - return translist1; - } - std::vector getTranslist2(){ - return translist2; - } - std::vector getTranslist3(){ - return translist3; - } - std::vector gettTime(){ - return transtime; - } - std::vector getScalefactor(){ - return scalefactor; - } - std::vector getForwards(){ - return forwards; - } - std::vector getBackwards(){ - return backwards; - } - std::vector getScaleTbc(){ - return tbcscale; - } - - std::vector getsTime(){ - return scaletime; - } + public: + + void read(NIFFile *nif) + { + // Rotations first + int count = nif->getInt(); + if(count) + { + int type = nif->getInt(); + + if(type == 1) + nif->skip(count*4*5); // time + quaternion + else if(type == 3) + nif->skip(count*4*8); // rot1 + tension+bias+continuity + else if(type == 4) + { + for(int j=0;jgetFloat(); // time + for(int i=0; i<3; i++) + { + int cnt = nif->getInt(); + int type = nif->getInt(); + if(type == 1) + nif->skip(cnt*4*2); // time + unknown + else if(type == 2) + nif->skip(cnt*4*4); // time + unknown vector + else nif->fail("Unknown sub-rotation type"); + } + } + } + else nif->fail("Unknown rotation type in NiKeyframeData"); + } + + // Then translation + count = nif->getInt(); + + if(count) + { + int type = nif->getInt(); + + if(type == 1) + nif->getFloatLen(count*4); // time + translation + else if(type == 2) + nif->getFloatLen(count*10); // trans1 + forward + backward + else if(type == 3) + nif->getFloatLen(count*7); // trans1 + tension,bias,continuity + else nif->fail("Unknown translation type"); + } + + // Finally, scalings + count = nif->getInt(); + if(count) + { + int type = nif->getInt(); + + int size = 0; + if(type == 1) size = 2; // time+scale + else if(type == 2) size = 4; // 1 + forward + backward (floats) + else if(type == 3) size = 5; // 1 + tbc + else nif->fail("Unknown scaling type"); + nif->getFloatLen(count*size); + } + } }; - } // Namespace #endif diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 8219a224c6..bdd9417a6a 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1068,11 +1068,6 @@ void NIFLoader::loadResource(Resource *resource) // Handle the node handleNode(node, 0, NULL, bounds, 0); - - short handle = 0; - //skel->setBlendMode(Ogre::SkeletonAnimationBlendMode::ANIMBLEND_CUMULATIVE); - bool first = true; - // set the bounding value. if (bounds.isValid()) { @@ -1081,16 +1076,6 @@ void NIFLoader::loadResource(Resource *resource) mesh->_setBoundingSphereRadius(bounds.getRadius()); } - - - - // set skeleton - if (!mSkel.isNull() && mesh->isLoaded()) - { - mesh->_notifySkeleton(mSkel); - std::cout << "Skeleton notified\n"; - } - // set skeleton // if (!skel.isNull()) // mesh->setSkeletonName(getSkeletonName()); diff --git a/components/nifogre/ogre_nif_loader.hpp b/components/nifogre/ogre_nif_loader.hpp index a619d3a3b2..736d1ab1e3 100644 --- a/components/nifogre/ogre_nif_loader.hpp +++ b/components/nifogre/ogre_nif_loader.hpp @@ -73,11 +73,11 @@ class NIFLoader : Ogre::ManualResourceLoader virtual void loadResource(Ogre::Resource *resource); - static Ogre::MeshPtr load(const std::string &name, + static Ogre::MeshPtr load(const std::string &name, const std::string &group="General"); - + Ogre::Vector3 convertVector3(const Nif::Vector& vec); Ogre::Quaternion convertRotation(const Nif::Matrix& rot); @@ -113,7 +113,7 @@ class NIFLoader : Ogre::ManualResourceLoader { return resourceName + ".skel"; } - + // This is the interface to the Ogre resource system. It allows us to // load NIFs from BSAs, in the file system and in any other place we // tell Ogre to look (eg. in zip or rar files.) It's also used to @@ -131,11 +131,7 @@ class NIFLoader : Ogre::ManualResourceLoader int counter; int numbers; int stack; - bool anim; - int handle2; - Ogre::Animation* animcore; - Ogre::Animation* animcore2; - + // pointer to the ogre mesh which is currently build Ogre::Mesh *mesh;