more cleanup

pull/21/head
Marc Zinnschlag 14 years ago
parent bdd995ec91
commit 0f2df4e2b8

@ -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");

@ -7,7 +7,6 @@
#include "../mwworld/refdata.hpp"
#include <OgreMath.h>
#include <Ogre.h>
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;

@ -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()

@ -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);

@ -180,29 +180,10 @@ 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);

@ -6,7 +6,6 @@
#include "OgreColourValue.h"
#include <OgreSceneNode.h>
#include <Ogre.h>
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);

@ -131,9 +131,12 @@ namespace MWSound
bool hasFile(const std::string &str, bool music = false)
{
if(FSstrict == false){
if(music){
if(FSstrict == false)
{
if(music)
{
if(musicpath.has(str)) return true;
// Not found? Try with .mp3
return musicpath.has(toMp3(str));
}
@ -145,8 +148,10 @@ namespace MWSound
}
else
{
if(music){
if(music)
{
if(musicpathStrict.has(str)) return true;
// Not found? Try with .mp3
return musicpathStrict.has(toMp3(str));
}
@ -155,7 +160,6 @@ namespace MWSound
if(strict.has(str)) return true;
return strict.has(toMp3(str));
}
}
}
@ -163,14 +167,14 @@ namespace MWSound
// with proper slash conversion (eg. datadir/Sound/Fx/funny.wav)
std::string convertPath(const std::string &str, bool music = false)
{
if(FSstrict == 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))
@ -178,7 +182,6 @@ namespace MWSound
else if(files.has(mp3))
return files.lookup(mp3);
}
else
{
if(music && musicpathStrict.has(str))
@ -186,7 +189,6 @@ namespace MWSound
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))
@ -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,7 +392,8 @@ namespace MWSound
delete mData;
}
void SoundManager::streamMusic(const std::string& filename){
void SoundManager::streamMusic(const std::string& filename)
{
if(mData->hasFile(filename, true))
{
std::string fullpath = mData->convertPath(filename, true);

@ -31,13 +31,13 @@ namespace MWSound
SoundImpl *mData;
std::vector<boost::filesystem::path> files;
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();
@ -45,9 +45,10 @@ namespace MWSound
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();

@ -66,10 +66,9 @@ class DirArchive: public Ogre::FileSystemArchive
public:
DirArchive(const String& name)
: FileSystemArchive(name, "Dir")
: FileSystemArchive(name, "Dir"), currentdir (name)
{
mType = "Dir";
currentdir = name;
std::string s = name;
cutoff = s.size() + 1;
if(fsstrict == false)
@ -137,7 +136,6 @@ class DirArchive: public Ogre::FileSystemArchive
{
//std::cout << "fsstrict " << copy << "\n";
return FileSystemArchive::exists(copy);
}
@ -185,7 +183,8 @@ class DirArchive: public Ogre::FileSystemArchive
copy.erase(0, 1);
}
if(fsstrict == true){
if(fsstrict == true)
{
return FileSystemArchive::open(copy, readonly);
}

@ -14,7 +14,6 @@
#include "components/esm/records.hpp"
#include "components/esm/loadcell.hpp"
#include <list>
#include <Ogre.h>
#include <iostream>
#include <stdexcept>
@ -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.
*/

@ -26,7 +26,6 @@
#include "controlled.hpp"
#include <iostream>
#include <Ogre.h>
namespace Nif
{
@ -435,91 +434,21 @@ public:
class NiKeyframeData : public Record
{
//Rotations
std::vector<Ogre::Quaternion> quats;
std::vector<Ogre::Vector3> tbc;
std::vector<float> rottime;
int rtype;
//Translations
std::vector<Ogre::Vector3> translist1;
std::vector<Ogre::Vector3> translist2;
std::vector<Ogre::Vector3> translist3;
std::vector<Ogre::Vector3> transtbc;
std::vector<float> transtime;
int ttype;
//Scalings
std::vector<float> scalefactor;
std::vector<float> scaletime;
std::vector<float> forwards;
std::vector<float> backwards;
std::vector<Ogre::Vector3> tbcscale;
int stype;
public:
void read(NIFFile *nif)
{
// Rotations first
int count = nif->getInt();
//std::vector<Ogre::Quaternion> quat(count);
//std::vector<float> rottime(count);
std::cout << "r";
if(count)
{
int type = nif->getInt();
//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)
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;j<count;j++)
{
@ -538,69 +467,20 @@ public:
}
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
}
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");
}
@ -608,93 +488,17 @@ public:
count = nif->getInt();
if(count)
{
stype = nif->getInt();
for(int i = 0; i < count; i++){
int type = nif->getInt();
//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
}
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");
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;
nif->getFloatLen(count*size);
}
int getTtype(){
return ttype;
}
std::vector<Ogre::Quaternion> getQuat(){
return quats;
}
std::vector<Ogre::Vector3> getrTbc(){
return tbc;
}
std::vector<float> getrTime(){
return rottime;
}
std::vector<Ogre::Vector3> getTranslist1(){
return translist1;
}
std::vector<Ogre::Vector3> getTranslist2(){
return translist2;
}
std::vector<Ogre::Vector3> getTranslist3(){
return translist3;
}
std::vector<float> gettTime(){
return transtime;
}
std::vector<float> getScalefactor(){
return scalefactor;
}
std::vector<float> getForwards(){
return forwards;
}
std::vector<float> getBackwards(){
return backwards;
}
std::vector<Ogre::Vector3> getScaleTbc(){
return tbcscale;
}
std::vector<float> getsTime(){
return scaletime;
}
};
} // Namespace
#endif

@ -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());

@ -131,10 +131,6 @@ 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

Loading…
Cancel
Save