forked from teamnwah/openmw-tes3coop
Rename NIFLoader to Loader, and update some comments
This commit is contained in:
parent
be74859f05
commit
c4c8295e0b
6 changed files with 25 additions and 36 deletions
|
@ -43,7 +43,7 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model
|
|||
mInsert = node;
|
||||
assert(mInsert);
|
||||
|
||||
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, model);
|
||||
mEntityList = NifOgre::Loader::createEntities(mInsert, model);
|
||||
if(mEntityList.mSkelBase)
|
||||
{
|
||||
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include "renderconst.hpp"
|
||||
|
||||
using namespace Ogre;
|
||||
using namespace NifOgre;
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
@ -299,8 +297,8 @@ void NpcAnimation::updateParts()
|
|||
|
||||
NifOgre::EntityList NpcAnimation::insertBoundedPart(const std::string &mesh, int group, const std::string &bonename)
|
||||
{
|
||||
NifOgre::EntityList entities = NIFLoader::createEntities(mEntityList.mSkelBase, bonename,
|
||||
mInsert, mesh);
|
||||
NifOgre::EntityList entities = NifOgre::Loader::createEntities(mEntityList.mSkelBase, bonename,
|
||||
mInsert, mesh);
|
||||
std::vector<Ogre::Entity*> &parts = entities.mEntities;
|
||||
for(size_t i = 0;i < parts.size();i++)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
|
|||
assert(insert);
|
||||
|
||||
Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL;
|
||||
NifOgre::EntityList entities = NifOgre::NIFLoader::createEntities(insert, mesh);
|
||||
NifOgre::EntityList entities = NifOgre::Loader::createEntities(insert, mesh);
|
||||
for(size_t i = 0;i < entities.mEntities.size();i++)
|
||||
{
|
||||
const Ogre::AxisAlignedBox &tmp = entities.mEntities[i]->getBoundingBox();
|
||||
|
|
|
@ -324,7 +324,7 @@ void SkyManager::create()
|
|||
|
||||
// Stars
|
||||
mAtmosphereNight = mRootNode->createChildSceneNode();
|
||||
NifOgre::EntityList entities = NifOgre::NIFLoader::createEntities(mAtmosphereNight, "meshes\\sky_night_01.nif");
|
||||
NifOgre::EntityList entities = NifOgre::Loader::createEntities(mAtmosphereNight, "meshes\\sky_night_01.nif");
|
||||
for(size_t i = 0, matidx = 0;i < entities.mEntities.size();i++)
|
||||
{
|
||||
Entity* night1_ent = entities.mEntities[i];
|
||||
|
@ -349,7 +349,7 @@ void SkyManager::create()
|
|||
|
||||
// Atmosphere (day)
|
||||
mAtmosphereDay = mRootNode->createChildSceneNode();
|
||||
entities = NifOgre::NIFLoader::createEntities(mAtmosphereDay, "meshes\\sky_atmosphere.nif");
|
||||
entities = NifOgre::Loader::createEntities(mAtmosphereDay, "meshes\\sky_atmosphere.nif");
|
||||
for(size_t i = 0;i < entities.mEntities.size();i++)
|
||||
{
|
||||
Entity* atmosphere_ent = entities.mEntities[i];
|
||||
|
@ -363,7 +363,7 @@ void SkyManager::create()
|
|||
|
||||
// Clouds
|
||||
SceneNode* clouds_node = mRootNode->createChildSceneNode();
|
||||
entities = NifOgre::NIFLoader::createEntities(clouds_node, "meshes\\sky_clouds_01.nif");
|
||||
entities = NifOgre::Loader::createEntities(clouds_node, "meshes\\sky_clouds_01.nif");
|
||||
for(size_t i = 0;i < entities.mEntities.size();i++)
|
||||
{
|
||||
Entity* clouds_ent = entities.mEntities[i];
|
||||
|
|
|
@ -148,8 +148,12 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class NIFSkeletonLoader : public Ogre::ManualResourceLoader {
|
||||
|
||||
/** Manual resource loader for NIF skeletons. This is the main class
|
||||
responsible for translating the internal NIF skeleton structure into
|
||||
something Ogre can use (includes animations and node TextKeyData).
|
||||
*/
|
||||
class NIFSkeletonLoader : public Ogre::ManualResourceLoader
|
||||
{
|
||||
static void warn(const std::string &msg)
|
||||
{
|
||||
std::cerr << "NIFSkeletonLoader: Warn: " << msg << std::endl;
|
||||
|
@ -754,6 +758,10 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String
|
|||
std::map<size_t,std::string> NIFMaterialLoader::MaterialMap;
|
||||
|
||||
|
||||
/** Manual resource loader for NIF meshes. This is the main class
|
||||
responsible for translating the internal NIF mesh structure into
|
||||
something Ogre can use.
|
||||
*/
|
||||
class NIFMeshLoader : Ogre::ManualResourceLoader
|
||||
{
|
||||
std::string mName;
|
||||
|
@ -1106,7 +1114,7 @@ NIFMeshLoader::LoaderMap NIFMeshLoader::sLoaders;
|
|||
typedef std::map<std::string,MeshInfoList> MeshInfoMap;
|
||||
static MeshInfoMap sMeshInfoMap;
|
||||
|
||||
MeshInfoList NIFLoader::load(const std::string &name, const std::string &skelName, const std::string &group)
|
||||
MeshInfoList Loader::load(const std::string &name, const std::string &skelName, const std::string &group)
|
||||
{
|
||||
MeshInfoMap::const_iterator meshiter = sMeshInfoMap.find(name+"@skel="+skelName);
|
||||
if(meshiter != sMeshInfoMap.end())
|
||||
|
@ -1145,7 +1153,7 @@ MeshInfoList NIFLoader::load(const std::string &name, const std::string &skelNam
|
|||
return meshes;
|
||||
}
|
||||
|
||||
EntityList NIFLoader::createEntities(Ogre::SceneNode *parentNode, std::string name, const std::string &group)
|
||||
EntityList Loader::createEntities(Ogre::SceneNode *parentNode, std::string name, const std::string &group)
|
||||
{
|
||||
EntityList entitylist;
|
||||
|
||||
|
@ -1192,9 +1200,9 @@ EntityList NIFLoader::createEntities(Ogre::SceneNode *parentNode, std::string na
|
|||
return entitylist;
|
||||
}
|
||||
|
||||
EntityList NIFLoader::createEntities(Ogre::Entity *parent, const std::string &bonename,
|
||||
Ogre::SceneNode *parentNode,
|
||||
std::string name, const std::string &group)
|
||||
EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonename,
|
||||
Ogre::SceneNode *parentNode,
|
||||
std::string name, const std::string &group)
|
||||
{
|
||||
EntityList entitylist;
|
||||
|
||||
|
|
|
@ -31,17 +31,12 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Nif
|
||||
{
|
||||
class Node;
|
||||
class Transformation;
|
||||
class NiTriShape;
|
||||
}
|
||||
|
||||
// FIXME: This namespace really doesn't do anything Nif-specific. Any supportable
|
||||
// model format should go through this.
|
||||
namespace NifOgre
|
||||
{
|
||||
|
||||
// FIXME: These should not be in NifOgre, it works agnostic of what model format is used
|
||||
typedef std::multimap<float,std::string> TextKeyMap;
|
||||
static const char sTextKeyExtraDataID[] = "TextKeyExtraData";
|
||||
struct EntityList {
|
||||
|
@ -69,19 +64,7 @@ struct MeshInfo {
|
|||
};
|
||||
typedef std::vector<MeshInfo> MeshInfoList;
|
||||
|
||||
/** Manual resource loader for NIF meshes. This is the main class
|
||||
responsible for translating the internal NIF mesh structure into
|
||||
something Ogre can use.
|
||||
|
||||
You have to insert meshes manually into Ogre like this:
|
||||
|
||||
NIFLoader::load("somemesh.nif");
|
||||
|
||||
This returns a list of meshes used by the model, as well as the names of
|
||||
their parent nodes (as they pertain to the skeleton, which is optionally
|
||||
returned in the second argument if it exists).
|
||||
*/
|
||||
class NIFLoader
|
||||
class Loader
|
||||
{
|
||||
static MeshInfoList load(const std::string &name, const std::string &skelName, const std::string &group);
|
||||
|
||||
|
|
Loading…
Reference in a new issue