summaryrefslogtreecommitdiffstats
path: root/tests/testsxx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testsxx.cpp')
-rw-r--r--tests/testsxx.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/testsxx.cpp b/tests/testsxx.cpp
index f3dcca5..399e50f 100644
--- a/tests/testsxx.cpp
+++ b/tests/testsxx.cpp
@@ -21,6 +21,41 @@
namespace Dimension
{
+ Scene
+ default_scene()
+ {
+ // Background color
+ Color background = sRGB(0.0, 0.1, 0.25);
+ background.filter(0.1);
+
+ // Canvas
+ Canvas canvas(768, 480);
+
+ // Camera
+ Perspective_Camera camera(
+ Matrix::rotation(Vector(0.0, 1.0, 0.0))
+ * Matrix::translation(Vector(0.0, 0.0, -4.0))
+ * Matrix::scale(
+ Vector(static_cast<double>(canvas.width())/canvas.height(), 1.0, 1.0)
+ )
+ );
+
+ // Scene
+ Scene scene(background, camera, canvas);
+
+ // Objects in scene
+
+ Sphere sphere;
+ sphere.trans(inverse(Matrix::scale(Vector(1.25, 1.25, 1.25))));
+ scene.push_object(sphere);
+
+ Cube cube;
+ cube.trans(inverse(Matrix::rotation(Vector(0.75, 0.0, 0.0))));
+ scene.push_object(cube);
+
+ return scene;
+ }
+
Display::Display(const Canvas& canvas)
: m_display(dmnsn_new_display(canvas.dmnsn()))
{