2010-01-12 14:46:44 +01:00
|
|
|
/*
|
|
|
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
|
|
|
Copyright (C) 2008-2010 Nicolay Korslund
|
|
|
|
Email: < korslund@gmail.com >
|
|
|
|
WWW: http://openmw.sourceforge.net/
|
|
|
|
|
|
|
|
This file (ogre_nif_loader.h) is part of the OpenMW package.
|
|
|
|
|
|
|
|
OpenMW is distributed as free software: you can redistribute it
|
|
|
|
and/or modify it under the terms of the GNU General Public License
|
|
|
|
version 3, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
version 3 along with this program. If not, see
|
|
|
|
http://www.gnu.org/licenses/ .
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-02-24 13:52:23 -08:00
|
|
|
#ifndef OPENMW_COMPONENTS_NIFOGRE_OGRENIFLOADER_HPP
|
|
|
|
#define OPENMW_COMPONENTS_NIFOGRE_OGRENIFLOADER_HPP
|
2010-01-12 14:46:44 +01:00
|
|
|
|
|
|
|
#include <OgreResource.h>
|
2013-04-10 19:58:17 -07:00
|
|
|
#include <OgreController.h>
|
2012-07-03 15:32:38 +02:00
|
|
|
|
2012-07-17 10:57:15 -07:00
|
|
|
#include <vector>
|
2010-08-08 17:20:55 +02:00
|
|
|
#include <string>
|
2013-04-10 19:58:17 -07:00
|
|
|
#include <map>
|
2011-11-23 18:18:51 -05:00
|
|
|
|
2010-08-08 17:20:55 +02:00
|
|
|
|
2013-01-09 09:10:59 -08:00
|
|
|
// FIXME: This namespace really doesn't do anything Nif-specific. Any supportable
|
|
|
|
// model format should go through this.
|
2011-06-19 19:14:14 +02:00
|
|
|
namespace NifOgre
|
|
|
|
{
|
2012-07-13 18:25:35 -07:00
|
|
|
|
2012-09-28 21:57:26 -07:00
|
|
|
typedef std::multimap<float,std::string> TextKeyMap;
|
2013-01-05 04:01:11 -08:00
|
|
|
static const char sTextKeyExtraDataID[] = "TextKeyExtraData";
|
2013-04-07 01:52:35 -07:00
|
|
|
struct ObjectList {
|
2012-07-17 13:40:03 -07:00
|
|
|
Ogre::Entity *mSkelBase;
|
2013-04-04 01:31:05 -07:00
|
|
|
std::vector<Ogre::Entity*> mEntities;
|
|
|
|
std::vector<Ogre::ParticleSystem*> mParticles;
|
2012-07-17 13:40:03 -07:00
|
|
|
|
2013-04-07 02:28:15 -07:00
|
|
|
// We could actually have Ogre::Camera objects, but that means more
|
|
|
|
// maintenance when switching cameras. The information in the NiCamera node
|
|
|
|
// is pretty much useless too anyway. So instead, this is just a list of
|
|
|
|
// bones in the mSkelBase which are NiCamera nodes.
|
|
|
|
std::vector<Ogre::Bone*> mCameras;
|
|
|
|
|
2013-04-05 10:13:54 -07:00
|
|
|
std::vector<Ogre::Controller<Ogre::Real> > mControllers;
|
|
|
|
|
2013-04-07 01:52:35 -07:00
|
|
|
ObjectList() : mSkelBase(0)
|
2012-07-17 13:40:03 -07:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2012-07-23 17:20:47 -07:00
|
|
|
|
2013-01-09 09:10:59 -08:00
|
|
|
class Loader
|
2010-01-12 14:46:44 +01:00
|
|
|
{
|
2012-07-17 20:23:09 -07:00
|
|
|
public:
|
2013-04-07 01:52:35 -07:00
|
|
|
static ObjectList createObjects(Ogre::Entity *parent, const std::string &bonename,
|
|
|
|
Ogre::SceneNode *parentNode,
|
|
|
|
std::string name,
|
|
|
|
const std::string &group="General");
|
|
|
|
|
|
|
|
static ObjectList createObjects(Ogre::SceneNode *parentNode,
|
|
|
|
std::string name,
|
|
|
|
const std::string &group="General");
|
2013-02-05 17:55:12 -08:00
|
|
|
|
2013-04-15 18:55:28 -07:00
|
|
|
static ObjectList createObjectBase(Ogre::SceneNode *parentNode,
|
2013-04-07 12:41:27 -07:00
|
|
|
std::string name,
|
|
|
|
const std::string &group="General");
|
2010-01-12 14:46:44 +01:00
|
|
|
};
|
|
|
|
|
2013-04-07 13:46:29 -07:00
|
|
|
// FIXME: Should be with other general Ogre extensions.
|
|
|
|
template<typename T>
|
|
|
|
class NodeTargetValue : public Ogre::ControllerValue<T>
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
Ogre::Node *mNode;
|
|
|
|
|
|
|
|
public:
|
|
|
|
NodeTargetValue(Ogre::Node *target) : mNode(target)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
void setNode(Ogre::Node *target)
|
|
|
|
{ mNode = target; }
|
|
|
|
Ogre::Node *getNode() const
|
|
|
|
{ return mNode; }
|
|
|
|
};
|
|
|
|
typedef Ogre::SharedPtr<NodeTargetValue<Ogre::Real> > NodeTargetValueRealPtr;
|
|
|
|
|
2011-06-19 19:14:14 +02:00
|
|
|
}
|
|
|
|
|
2013-02-04 09:19:59 -08:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
|
|
|
|
// These operators allow extra data types to be stored in an Ogre::Any
|
|
|
|
// object, which can then be stored in user object bindings on the nodes
|
|
|
|
|
|
|
|
ostream& operator<<(ostream &o, const NifOgre::TextKeyMap&);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-01-12 14:46:44 +01:00
|
|
|
#endif
|