Dealing with scenenodes

actorid
Jason Hooks 13 years ago
parent 5822221ae1
commit c2181d2091

@ -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";
}
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…
Cancel
Save