2011-11-12 15:58:22 -05:00
|
|
|
#ifndef _GAME_RENDER_OBJECTS_H
|
|
|
|
#define _GAME_RENDER_OBJECTS_H
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
#include <OgreColourValue.h>
|
2013-02-06 21:47:09 -08:00
|
|
|
#include <OgreAxisAlignedBox.h>
|
2012-07-03 13:55:53 +02:00
|
|
|
|
2012-02-06 10:29:18 +01:00
|
|
|
#include <openengine/ogre/renderer.hpp>
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
class CellStore;
|
|
|
|
}
|
2011-10-31 23:59:16 -04:00
|
|
|
|
|
|
|
namespace MWRender{
|
2011-11-07 23:35:39 -05:00
|
|
|
|
2012-04-19 20:59:57 +02:00
|
|
|
/// information about light needed for rendering
|
2012-04-28 20:42:53 +02:00
|
|
|
enum LightType
|
|
|
|
{
|
|
|
|
// These are all mutually exclusive
|
|
|
|
LT_Normal=0,
|
|
|
|
LT_Flicker=1,
|
|
|
|
LT_FlickerSlow=2,
|
|
|
|
LT_Pulse=3,
|
|
|
|
LT_PulseSlow=4
|
|
|
|
};
|
|
|
|
|
2012-04-19 20:59:57 +02:00
|
|
|
struct LightInfo
|
|
|
|
{
|
2012-04-28 20:42:53 +02:00
|
|
|
// Constants
|
2012-04-19 20:59:57 +02:00
|
|
|
std::string name; // ogre handle
|
|
|
|
Ogre::ColourValue colour;
|
|
|
|
float radius;
|
2012-04-28 20:42:53 +02:00
|
|
|
bool interior; // Does this light belong to an interior or exterior cell
|
|
|
|
LightType type;
|
|
|
|
|
|
|
|
// Runtime variables
|
2013-01-06 10:45:54 -08:00
|
|
|
float dir; // direction time is running...
|
|
|
|
float time; // current time
|
|
|
|
float phase; // current phase
|
2012-04-28 20:42:53 +02:00
|
|
|
|
|
|
|
LightInfo() :
|
2013-01-06 10:45:54 -08:00
|
|
|
dir(1.0f), time(0.0f), phase (0.0f),
|
|
|
|
interior(true), type(LT_Normal), radius(1.0)
|
2012-04-28 20:42:53 +02:00
|
|
|
{
|
|
|
|
}
|
2012-04-19 20:59:57 +02:00
|
|
|
};
|
|
|
|
|
2011-10-31 23:59:16 -04:00
|
|
|
class Objects{
|
2012-02-06 10:41:13 +01:00
|
|
|
OEngine::Render::OgreRenderer &mRenderer;
|
2012-07-03 13:55:53 +02:00
|
|
|
std::map<MWWorld::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
|
|
|
|
std::map<MWWorld::CellStore *, Ogre::StaticGeometry*> mStaticGeometry;
|
|
|
|
std::map<MWWorld::CellStore *, Ogre::StaticGeometry*> mStaticGeometrySmall;
|
|
|
|
std::map<MWWorld::CellStore *, Ogre::AxisAlignedBox> mBounds;
|
2012-04-19 20:59:57 +02:00
|
|
|
std::vector<LightInfo> mLights;
|
2011-11-22 02:39:28 -05:00
|
|
|
Ogre::SceneNode* mMwRoot;
|
2012-02-06 10:41:13 +01:00
|
|
|
bool mIsStatic;
|
2011-11-04 21:57:39 -04:00
|
|
|
static int uniqueID;
|
2011-11-03 19:40:37 -04:00
|
|
|
|
|
|
|
static float lightLinearValue;
|
|
|
|
static float lightLinearRadiusMult;
|
|
|
|
|
|
|
|
static bool lightQuadratic;
|
|
|
|
static float lightQuadraticValue;
|
|
|
|
static float lightQuadraticRadiusMult;
|
|
|
|
|
|
|
|
static bool lightOutQuadInLin;
|
2012-02-06 10:29:18 +01:00
|
|
|
|
|
|
|
void clearSceneNode (Ogre::SceneNode *node);
|
|
|
|
///< Remove all movable objects from \a node.
|
|
|
|
|
2011-10-31 23:59:16 -04:00
|
|
|
public:
|
2012-06-06 20:29:30 +02:00
|
|
|
Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer), mIsStatic(false) {}
|
2011-10-31 23:59:16 -04:00
|
|
|
~Objects(){}
|
2011-11-04 21:57:39 -04:00
|
|
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
2011-11-01 13:46:57 -04:00
|
|
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
2011-11-04 21:57:39 -04:00
|
|
|
void insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, float radius);
|
2011-11-21 12:52:28 +01:00
|
|
|
|
2012-04-02 19:37:24 +02:00
|
|
|
void enableLights();
|
|
|
|
void disableLights();
|
|
|
|
|
2012-04-19 20:59:57 +02:00
|
|
|
void update (const float dt);
|
|
|
|
///< per-frame update
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
Ogre::AxisAlignedBox getDimensions(MWWorld::CellStore*);
|
2012-03-10 15:28:18 +01:00
|
|
|
///< get a bounding box that encloses all objects in the specified cell
|
|
|
|
|
2011-11-21 12:52:28 +01:00
|
|
|
bool deleteObject (const MWWorld::Ptr& ptr);
|
|
|
|
///< \return found?
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
void removeCell(MWWorld::CellStore* store);
|
|
|
|
void buildStaticGeometry(MWWorld::CellStore &cell);
|
2011-11-17 17:10:27 -05:00
|
|
|
void setMwRoot(Ogre::SceneNode* root);
|
2012-07-11 02:31:03 +02:00
|
|
|
|
|
|
|
void rebuildStaticGeometry();
|
2012-07-30 23:28:14 +04:00
|
|
|
|
2012-07-31 16:52:21 +04:00
|
|
|
/// Updates containing cell for object rendering data
|
2012-07-30 23:28:14 +04:00
|
|
|
void updateObjectCell(const MWWorld::Ptr &ptr);
|
2011-10-31 23:59:16 -04:00
|
|
|
};
|
2011-11-12 15:58:22 -05:00
|
|
|
}
|
2011-11-21 12:52:28 +01:00
|
|
|
#endif
|