forked from mirror/openmw-tes3mp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#ifndef COMPONENTS_NIFOGRE_MESH_HPP
|
|
#define COMPONENTS_NIFOGRE_MESH_HPP
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <map>
|
|
#include <cassert>
|
|
|
|
#include <OgreResource.h>
|
|
|
|
namespace Nif
|
|
{
|
|
struct NiTriShape;
|
|
}
|
|
|
|
namespace NifOgre
|
|
{
|
|
|
|
/** Manual resource loader for NiTriShapes. This is the main class responsible
|
|
* for translating the internal NIF meshes into something Ogre can use.
|
|
*/
|
|
class NIFMeshLoader : Ogre::ManualResourceLoader
|
|
{
|
|
static void warn(const std::string &msg)
|
|
{
|
|
std::cerr << "NIFMeshLoader: Warn: " << msg << std::endl;
|
|
}
|
|
|
|
static void fail(const std::string &msg)
|
|
{
|
|
std::cerr << "NIFMeshLoader: Fail: "<< msg << std::endl;
|
|
abort();
|
|
}
|
|
|
|
std::string mName;
|
|
std::string mGroup;
|
|
size_t mShapeIndex;
|
|
|
|
// Convert NiTriShape to Ogre::SubMesh
|
|
void createSubMesh(Ogre::Mesh *mesh, const Nif::NiTriShape *shape);
|
|
|
|
typedef std::map<std::string,NIFMeshLoader> LoaderMap;
|
|
static LoaderMap sLoaders;
|
|
|
|
NIFMeshLoader(const std::string &name, const std::string &group, size_t idx);
|
|
|
|
virtual void loadResource(Ogre::Resource *resource);
|
|
|
|
public:
|
|
static void createMesh(const std::string &name, const std::string &fullname, const std::string &group, size_t idx);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|