restructured ogre nif code (struct -> class with singleton), formated code

actorid
Armin Preiml 15 years ago
parent fa077ccdc4
commit 181b538e4a

File diff suppressed because it is too large Load Diff

@ -27,6 +27,26 @@
#include <OgreResource.h>
#include <OgreMesh.h>
#include <assert.h>
#include <string>
class BoundsFinder;
namespace Nif
{
class Node;
class Transformation;
class NiTriShape;
class Vector;
}
namespace Mangle
{
namespace VFS
{
class OgreVFS;
}
}
/** Manual resource loader for NIF meshes. This is the main class
responsible for translating the internal NIF mesh structure into
@ -43,12 +63,52 @@
very resource intensive, and can safely be done for a large number
of meshes at load time.
*/
struct NIFLoader : Ogre::ManualResourceLoader
class NIFLoader : Ogre::ManualResourceLoader
{
void loadResource(Ogre::Resource *resource);
public:
static NIFLoader& getSingleton();
static NIFLoader* getSingletonPtr();
virtual void loadResource(Ogre::Resource *resource);
static Ogre::MeshPtr load(const std::string &name,
const std::string &group="General");
private:
NIFLoader() : resourceGroup("General") {}
NIFLoader(NIFLoader& n) {}
void warn(std::string msg);
void fail(std::string msg);
void handleNode(Ogre::Mesh* mesh, Nif::Node *node, int flags,
const Nif::Transformation *trafo, BoundsFinder &bounds);
void handleNiTriShape(Ogre::Mesh *mesh, Nif::NiTriShape *shape, int flags, BoundsFinder &bounds);
void createOgreMesh(Ogre::Mesh *mesh, Nif::NiTriShape *shape, const Ogre::String &material);
void createMaterial(const Ogre::String &name,
const Nif::Vector &ambient,
const Nif::Vector &diffuse,
const Nif::Vector &specular,
const Nif::Vector &emissive,
float glossiness, float alpha,
float alphaFlags, float alphaTest,
const Ogre::String &texName);
void findRealTexture(Ogre::String &texName);
Ogre::String getUniqueName(const Ogre::String &input);
// 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
// check for the existence of texture files, so we can exchange the
// extension from .tga to .dds if the texture is missing.
Mangle::VFS::OgreVFS *vfs;
static Ogre::MeshPtr load(const std::string &name,
const std::string &group="General");
std::string resourceGroup;
};
#endif

Loading…
Cancel
Save