mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:23:51 +00:00
Dealing with scenenodes
This commit is contained in:
parent
5822221ae1
commit
c2181d2091
6 changed files with 35 additions and 19 deletions
|
@ -1,3 +1,5 @@
|
|||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
namespace MWRender{
|
||||
class Creatures{
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <openengine/ogre/renderer.hpp>
|
||||
namespace MWRender{
|
||||
class Npcs{
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
#include "objects.hpp"
|
||||
#include <OgreSceneNode.h>
|
||||
|
||||
using namespace MWRender;
|
||||
|
||||
void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
||||
ptr.getRefData().setBaseNode(mBase);
|
||||
assert (!mInsert);
|
||||
isStatic = static_;
|
||||
|
||||
// Create and place scene node for this object
|
||||
mInsert = mBase->createChildSceneNode();
|
||||
}
|
||||
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh){
|
||||
|
||||
|
@ -11,3 +17,4 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh){
|
|||
void Objects::insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, float radius){
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
namespace MWRender{
|
||||
class Objects{
|
||||
private:
|
||||
OEngine::Render::OgreRenderer &rend;
|
||||
Ogre::SceneNode *mBase;
|
||||
Ogre::SceneNode *mInsert;
|
||||
bool isStatic;
|
||||
public:
|
||||
Objects(OEngine::Render::OgreRenderer& _rend): rend(_rend){}
|
||||
Objects(OEngine::Render::OgreRenderer& _rend): rend(_rend){mBase = rend.getScene()->getRootSceneNode(); }
|
||||
~Objects(){}
|
||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "renderingmanager.hpp"
|
||||
#include "objects.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -23,7 +24,7 @@ namespace MWRender {
|
|||
|
||||
|
||||
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine) :rend(_rend), mDebugging(engine)
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine) :rend(_rend), mDebugging(engine), objects(rend)
|
||||
{
|
||||
|
||||
|
||||
|
@ -58,8 +59,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
cameraPitchNode->attachObject(rend.getCamera());
|
||||
|
||||
mPlayer = new MWRender::Player (rend.getCamera(), playerNode->getName());
|
||||
//std::cout << "Three";
|
||||
|
||||
//std::cout << "Three";
|
||||
}
|
||||
|
||||
RenderingManager::~RenderingManager ()
|
||||
|
|
|
@ -48,22 +48,7 @@ namespace MWRender
|
|||
|
||||
class RenderingManager: private RenderingInterface {
|
||||
|
||||
OEngine::Render::OgreRenderer &rend;
|
||||
Ogre::Camera* camera;
|
||||
MWRender::Npcs npcs;
|
||||
MWRender::Creatures creatures;
|
||||
MWRender::Objects objects;
|
||||
|
||||
/// Root node for all objects added to the scene. This is rotated so
|
||||
/// that the OGRE coordinate system matches that used internally in
|
||||
/// Morrowind.
|
||||
Ogre::SceneNode *mwRoot;
|
||||
Ogre::RaySceneQuery *mRaySceneQuery;
|
||||
|
||||
OEngine::Physic::PhysicEngine* eng;
|
||||
|
||||
MWRender::Player *mPlayer;
|
||||
MWRender::Debugging mDebugging;
|
||||
|
||||
public:
|
||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine);
|
||||
|
@ -103,6 +88,22 @@ class RenderingManager: private RenderingInterface {
|
|||
private:
|
||||
|
||||
SkyManager* mSkyManager;
|
||||
OEngine::Render::OgreRenderer &rend;
|
||||
Ogre::Camera* camera;
|
||||
MWRender::Npcs npcs;
|
||||
MWRender::Creatures creatures;
|
||||
MWRender::Objects objects;
|
||||
|
||||
/// Root node for all objects added to the scene. This is rotated so
|
||||
/// that the OGRE coordinate system matches that used internally in
|
||||
/// Morrowind.
|
||||
Ogre::SceneNode *mwRoot;
|
||||
Ogre::RaySceneQuery *mRaySceneQuery;
|
||||
|
||||
OEngine::Physic::PhysicEngine* eng;
|
||||
|
||||
MWRender::Player *mPlayer;
|
||||
MWRender::Debugging mDebugging;
|
||||
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue