mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 10: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{
|
namespace MWRender{
|
||||||
class Creatures{
|
class Creatures{
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <openengine/ogre/renderer.hpp>
|
||||||
namespace MWRender{
|
namespace MWRender{
|
||||||
class Npcs{
|
class Npcs{
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
#include "objects.hpp"
|
#include "objects.hpp"
|
||||||
|
#include <OgreSceneNode.h>
|
||||||
|
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
|
||||||
void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
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){
|
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){
|
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/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include <openengine/ogre/renderer.hpp>
|
||||||
|
|
||||||
namespace MWRender{
|
namespace MWRender{
|
||||||
class Objects{
|
class Objects{
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer &rend;
|
OEngine::Render::OgreRenderer &rend;
|
||||||
|
Ogre::SceneNode *mBase;
|
||||||
|
Ogre::SceneNode *mInsert;
|
||||||
|
bool isStatic;
|
||||||
public:
|
public:
|
||||||
Objects(OEngine::Render::OgreRenderer& _rend): rend(_rend){}
|
Objects(OEngine::Render::OgreRenderer& _rend): rend(_rend){mBase = rend.getScene()->getRootSceneNode(); }
|
||||||
~Objects(){}
|
~Objects(){}
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "renderingmanager.hpp"
|
#include "renderingmanager.hpp"
|
||||||
|
#include "objects.hpp"
|
||||||
|
|
||||||
#include <assert.h>
|
#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());
|
cameraPitchNode->attachObject(rend.getCamera());
|
||||||
|
|
||||||
mPlayer = new MWRender::Player (rend.getCamera(), playerNode->getName());
|
mPlayer = new MWRender::Player (rend.getCamera(), playerNode->getName());
|
||||||
//std::cout << "Three";
|
|
||||||
|
|
||||||
|
//std::cout << "Three";
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderingManager::~RenderingManager ()
|
RenderingManager::~RenderingManager ()
|
||||||
|
|
|
@ -48,22 +48,7 @@ namespace MWRender
|
||||||
|
|
||||||
class RenderingManager: private RenderingInterface {
|
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:
|
public:
|
||||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine);
|
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine);
|
||||||
|
@ -103,6 +88,22 @@ class RenderingManager: private RenderingInterface {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SkyManager* mSkyManager;
|
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