mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-30 05:47:57 +03:00
Imported Upstream version 0.26.0
This commit is contained in:
commit
9a2b6c69b6
1398 changed files with 212217 additions and 0 deletions
55
components/nifogre/mesh.hpp
Normal file
55
components/nifogre/mesh.hpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef COMPONENTS_NIFOGRE_MESH_HPP
|
||||
#define COMPONENTS_NIFOGRE_MESH_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
#include <OgreResource.h>
|
||||
|
||||
namespace Nif
|
||||
{
|
||||
class 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
|
Loading…
Add table
Add a link
Reference in a new issue