summaryrefslogtreecommitdiffstats
path: root/libdimensionxx
diff options
context:
space:
mode:
Diffstat (limited to 'libdimensionxx')
-rw-r--r--libdimensionxx/dimensionxx/scene.hpp26
-rw-r--r--libdimensionxx/scene.cpp23
2 files changed, 41 insertions, 8 deletions
diff --git a/libdimensionxx/dimensionxx/scene.hpp b/libdimensionxx/dimensionxx/scene.hpp
index 8b5270c..c79152f 100644
--- a/libdimensionxx/dimensionxx/scene.hpp
+++ b/libdimensionxx/dimensionxx/scene.hpp
@@ -25,12 +25,19 @@
namespace Dimension
{
+ // Wrapper for dmnsn_quality
+ enum Quality {
+ RENDER_NONE = DMNSN_RENDER_NONE,
+ RENDER_OBJECTS = DMNSN_RENDER_OBJECTS,
+ RENDER_FULL = DMNSN_RENDER_FULL
+ };
+
// Base scene class. Wraps a dmnsn_scene*.
class Scene
{
public:
// Allocate a dmnsn_scene*
- Scene(const Color& background, Camera& camera, Canvas& canvas);
+ Scene(Camera& camera, Canvas& canvas);
// Scene(const Scene& scene);
@@ -38,14 +45,21 @@ namespace Dimension
~Scene();
// Element access
- Color background() const;
- Camera& camera();
- const Camera& camera() const;
- Canvas& canvas();
- const Canvas& canvas() const;
+ Color background() const;
+ void background(const Color& color);
+
+ Camera& camera();
+ const Camera& camera() const;
+
+ Canvas& canvas();
+ const Canvas& canvas() const;
+
Array<Object>& objects();
const Array<Object>& objects() const;
+ Quality quality() const;
+ void quality(Quality quality);
+
// Access the wrapped C object.
dmnsn_scene* dmnsn();
const dmnsn_scene* dmnsn() const;
diff --git a/libdimensionxx/scene.cpp b/libdimensionxx/scene.cpp
index f41f3b5..5695c1b 100644
--- a/libdimensionxx/scene.cpp
+++ b/libdimensionxx/scene.cpp
@@ -23,7 +23,7 @@
namespace Dimension
{
// Allocate a dmnsn_scene
- Scene::Scene(const Color& background, Camera& camera, Canvas& canvas)
+ Scene::Scene(Camera& camera, Canvas& canvas)
: m_scene(new dmnsn_scene*(dmnsn_new_scene())), m_camera(camera.copy()),
m_canvas(new Canvas(canvas)), m_objects(dmnsn()->objects)
{
@@ -31,9 +31,10 @@ namespace Dimension
throw Dimension_Error("Couldn't allocate scene.");
}
- dmnsn()->background = background.dmnsn();
+ dmnsn()->background = Color(sRGB(0.0, 0.0, 0.0)).dmnsn();
dmnsn()->camera = this->camera().dmnsn();
dmnsn()->canvas = this->canvas().dmnsn();
+ dmnsn()->quality = static_cast<dmnsn_quality>(RENDER_FULL);
}
// Delete the scene
@@ -53,6 +54,12 @@ namespace Dimension
return Color(dmnsn()->background);
}
+ void
+ Scene::background(const Color& color)
+ {
+ dmnsn()->background = color.dmnsn();
+ }
+
Camera&
Scene::camera()
{
@@ -89,6 +96,18 @@ namespace Dimension
return m_objects;
}
+ Quality
+ Scene::quality() const
+ {
+ return static_cast<Quality>(dmnsn()->quality);
+ }
+
+ void
+ Scene::quality(Quality quality)
+ {
+ dmnsn()->quality = static_cast<dmnsn_quality>(quality);
+ }
+
// Access the wrapped C object.
dmnsn_scene*