summaryrefslogtreecommitdiffstats
path: root/libdimensionxx/dimensionxx/camera.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libdimensionxx/dimensionxx/camera.hpp')
-rw-r--r--libdimensionxx/dimensionxx/camera.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/libdimensionxx/dimensionxx/camera.hpp b/libdimensionxx/dimensionxx/camera.hpp
index 950e16d..a883969 100644
--- a/libdimensionxx/dimensionxx/camera.hpp
+++ b/libdimensionxx/dimensionxx/camera.hpp
@@ -29,12 +29,15 @@ namespace Dimension
class Camera
{
public:
- // No-op, made pure virtual
- virtual ~Camera() = 0;
+ // No-op
+ virtual ~Camera();
// Camera callback
virtual Line ray(const Canvas& canvas, unsigned int x, unsigned int y);
+ // Shallow-copy a derived camera
+ virtual Camera* copy() const = 0;
+
// Access the wrapped C camera.
dmnsn_camera* dmnsn();
const dmnsn_camera* dmnsn() const;
@@ -42,15 +45,22 @@ namespace Dimension
protected:
// No-op
Camera();
+ // Shallow-copy
+ Camera(const Camera& camera);
// Wrap an existing camera
explicit Camera(dmnsn_camera* camera);
- dmnsn_camera* m_camera;
+ // Is m_camera unique?
+ bool unique() const;
+
+ // Set the wrapped C camera
+ void dmnsn(dmnsn_camera* camera);
private:
- // Copying prohibited
- Camera(const Camera&);
+ // Copy-assignment prohibited
Camera& operator=(const Camera&);
+
+ std::tr1::shared_ptr<dmnsn_camera*> m_camera;
};
// A custom camera abstract base class, for creating your own camera types