Workspace code for CurrentCamera

This commit is contained in:
sorket 2023-07-15 21:05:04 -04:00
parent 05788e557c
commit bddfe3aba8
2 changed files with 24 additions and 0 deletions

View File

@ -2,7 +2,10 @@
#include <App/V8/Tree/Instance.hpp> #include <App/V8/Tree/Instance.hpp>
#include <App/V8/Tree/Model.hpp> #include <App/V8/Tree/Model.hpp>
#include <OGRE/Ogre.h> #include <OGRE/Ogre.h>
#include <boost/shared_ptr.hpp>
#include <vector> #include <vector>
namespace RNR namespace RNR
@ -14,9 +17,14 @@ namespace RNR
virtual void onChildAdded(RNR::Instance* childAdded); virtual void onChildAdded(RNR::Instance* childAdded);
virtual void onChildRemoved(RNR::Instance* childRemoved); virtual void onChildRemoved(RNR::Instance* childRemoved);
Camera* getCurrentCamera() const;
void setCurrentCamera(Camera *value);
private: private:
std::vector<Ogre::InstancedEntity*> m_objects; std::vector<Ogre::InstancedEntity*> m_objects;
Ogre::InstanceManager* m_instMan; Ogre::InstanceManager* m_instMan;
Ogre::SceneNode* m_worldspawn; Ogre::SceneNode* m_worldspawn;
boost::shared_ptr<Camera> currentCamera;
}; };
} }

View File

@ -1,6 +1,7 @@
#include <App/V8/DataModel/Workspace.hpp> #include <App/V8/DataModel/Workspace.hpp>
#include <App/V8/World/World.hpp> #include <App/V8/World/World.hpp>
#include <App/V8/DataModel/BasePart.hpp> #include <App/V8/DataModel/BasePart.hpp>
#include <App/V8/DataModel/Camera.hpp>
namespace RNR namespace RNR
{ {
@ -55,4 +56,19 @@ namespace RNR
delete child_ent; delete child_ent;
} }
} }
Camera* Workspace::getCurrentCamera() const
{
return currentCamera.get();
}
void Workspace::setCurrentCamera(Camera *newCamera)
{
if (newCamera != currentCamera.get())
{
currentCamera = boost::shared_ptr<Camera>(newCamera);
// TODO: raise propertyChanged and currentCameraChangedSignal
}
}
} }