Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

Commit

Permalink
Made OgreCameraWrapper virtual and delegated Ogre::Camera handling to…
Browse files Browse the repository at this point in the history
… implementing class.
  • Loading branch information
advancingu committed Oct 5, 2013
1 parent cc71bf7 commit cad4d3a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions example/cameranodeobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static const Ogre::Vector3 initialPosition(0, 0, 300);
CameraNodeObject::CameraNodeObject(QObject *parent) :
QObject(parent),
OgreCameraWrapper(),
m_camera(0),
m_yaw(0),
m_pitch(0),
m_zoom(1)
Expand Down
2 changes: 2 additions & 0 deletions example/cameranodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CameraNodeObject : public QObject, public OgreCameraWrapper

Ogre::SceneNode *sceneNode() const
{ return m_node; }
Ogre::Camera* camera() const { return m_camera; }

qreal yaw() const
{ return m_yaw; }
Expand All @@ -47,6 +48,7 @@ class CameraNodeObject : public QObject, public OgreCameraWrapper
void updateRotation();

Ogre::SceneNode *m_node;
Ogre::Camera *m_camera;

qreal m_yaw;
qreal m_pitch;
Expand Down
1 change: 0 additions & 1 deletion lib/ogrecamerawrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
#include "ogrecamerawrapper.h"

OgreCameraWrapper::OgreCameraWrapper()
: m_camera(0)
{
}
5 changes: 1 addition & 4 deletions lib/ogrecamerawrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ class OgreCameraWrapper
public:
OgreCameraWrapper();
virtual ~OgreCameraWrapper() {}
Ogre::Camera* camera() { return m_camera; }

protected:
Ogre::Camera *m_camera;
virtual Ogre::Camera* camera() const = 0;
};

#endif // OGRECAMERAWRAPPER_H
2 changes: 1 addition & 1 deletion lib/ogreitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OgreItem::OgreItem(QQuickItem *parent)

QSGNode *OgreItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
if (width() <= 0 || height() <= 0 || !m_camera || !m_ogreEngineItem) {
if (width() <= 0 || height() <= 0 || !m_camera || !m_camera->camera() || !m_ogreEngineItem) {
delete oldNode;
return 0;
}
Expand Down

0 comments on commit cad4d3a

Please sign in to comment.