mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
restructured ogre nif code (struct -> class with singleton), formated code
This commit is contained in:
parent
fa077ccdc4
commit
181b538e4a
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,26 @@
|
|||||||
#include <OgreResource.h>
|
#include <OgreResource.h>
|
||||||
#include <OgreMesh.h>
|
#include <OgreMesh.h>
|
||||||
#include <assert.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
|
/** Manual resource loader for NIF meshes. This is the main class
|
||||||
responsible for translating the internal NIF mesh structure into
|
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
|
very resource intensive, and can safely be done for a large number
|
||||||
of meshes at load time.
|
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();
|
||||||
|
|
||||||
static Ogre::MeshPtr load(const std::string &name,
|
virtual void loadResource(Ogre::Resource *resource);
|
||||||
const std::string &group="General");
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
std::string resourceGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user