summaryrefslogtreecommitdiffstats
path: root/libdimensionxx/dimensionxx
diff options
context:
space:
mode:
Diffstat (limited to 'libdimensionxx/dimensionxx')
-rw-r--r--libdimensionxx/dimensionxx/array.hpp351
-rw-r--r--libdimensionxx/dimensionxx/camera.hpp96
-rw-r--r--libdimensionxx/dimensionxx/cameras.hpp49
-rw-r--r--libdimensionxx/dimensionxx/canvas.hpp84
-rw-r--r--libdimensionxx/dimensionxx/color.hpp258
-rw-r--r--libdimensionxx/dimensionxx/cookie.hpp102
-rw-r--r--libdimensionxx/dimensionxx/cube.hpp30
-rw-r--r--libdimensionxx/dimensionxx/error.hpp54
-rw-r--r--libdimensionxx/dimensionxx/geometry.hpp322
-rw-r--r--libdimensionxx/dimensionxx/gl.hpp64
-rw-r--r--libdimensionxx/dimensionxx/object.hpp133
-rw-r--r--libdimensionxx/dimensionxx/objects.hpp61
-rw-r--r--libdimensionxx/dimensionxx/png.hpp71
-rw-r--r--libdimensionxx/dimensionxx/progress.hpp135
-rw-r--r--libdimensionxx/dimensionxx/raytrace.hpp51
-rw-r--r--libdimensionxx/dimensionxx/scene.hpp78
-rw-r--r--libdimensionxx/dimensionxx/texture.hpp115
-rw-r--r--libdimensionxx/dimensionxx/utility.hpp47
18 files changed, 0 insertions, 2101 deletions
diff --git a/libdimensionxx/dimensionxx/array.hpp b/libdimensionxx/dimensionxx/array.hpp
deleted file mode 100644
index b3b0496..0000000
--- a/libdimensionxx/dimensionxx/array.hpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_array* wrapper.
-
-#ifndef DIMENSIONXX_ARRAY_HPP
-#define DIMENSIONXX_ARRAY_HPP
-
-#include <tr1/memory> // For tr1::shared_ptr
-#include <cstdlib> // For size_t
-#include <vector>
-
-namespace Dimension
-{
- // Class to store POD types, and wrapped dmnsn_* types, including polymorphic
- // types. The non-specialized version will only handle POD types; specialize
- // it to allow storage of classes in Array's.
- template <typename T>
- class Array_Element
- {
- public:
- typedef T C_Type;
-
- inline Array_Element();
- inline Array_Element(T t);
-
- // Specializations should implement this constructor if C_Type differs from
- // T - but it should throw if T is a polymorphic type
- // Array_Element(C_Type c);
-
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
-
- C_Type dmnsn() const { return m_t; }
- T& object(C_Type& c) const { return c; }
-
- // Must the dmnsn_array* be rebuilt on every access?
- static const bool must_rebuild = false;
-
- private:
- T m_t;
- };
-
- // Array template class, wraps a dmnsn_array*. Copying is possible, but
- // copies refer to the same object, which is reference counted. T must be
- // a POD type.
- template <typename T>
- class Array
- {
- public:
- inline Array();
- explicit inline Array(dmnsn_array* array);
- // Array(const Array& a);
- ~Array()
- { if (m_array && m_array.unique()) { dmnsn_delete_array(dmnsn()); } }
-
- // Array& operator=(const Array& a);
-
- inline T& operator[](std::size_t i);
- inline const T& operator[](std::size_t i) const;
-
- std::size_t size() const { return dmnsn_array_size(dmnsn()); }
- inline void resize(std::size_t size);
-
- inline void push(T& object);
- inline void push(const T& object); // Not valid for polymorphic types
- inline void pop();
-
- // Access the wrapped C object.
- inline dmnsn_array* dmnsn();
- inline const dmnsn_array* dmnsn() const;
-
- // Release ownership of the dmnsn_array*, needed for returning a
- // dmnsn_array* from a function.
- inline dmnsn_array* release();
-
- private:
- typedef typename Array_Element<T>::C_Type C_Type;
-
- std::tr1::shared_ptr<dmnsn_array*> m_array;
- std::vector<Array_Element<T> > m_elements;
-
- inline void rebuild() const;
- };
-
- // Base class for non-polymorphic wrappers
- template <typename T, typename C>
- class By_Value_Array_Element
- {
- public:
- typedef C C_Type;
-
- By_Value_Array_Element() : m_object(new T()) { }
- By_Value_Array_Element(const T& object) : m_object(new T(object)) { }
- By_Value_Array_Element(C_Type c) : m_object(new T(c)) { }
- // By_Value_Array_Element(const By_Value_Array_Element& ae);
- // ~By_Value_Array_Element();
-
- // By_Value_Array_Element& operator=(const By_Value_Array_Element& ae);
-
- C_Type dmnsn() const { return m_object->dmnsn(); }
- T& object(C_Type& c) const { *m_object = T(c); return *m_object; }
-
- static const bool must_rebuild = true;
-
- private:
- std::tr1::shared_ptr<T> m_object;
- };
-
- // Base class for non-polymorphic wrappers
- template <typename T, typename C>
- class DMNSN_Array_Element
- {
- public:
- typedef C C_Type;
-
- DMNSN_Array_Element() {
- throw Dimension_Error("Couldn't default-construct an array element.");
- }
-
- DMNSN_Array_Element(const T& object) : m_object(new T(object)) { }
- DMNSN_Array_Element(C_Type c) : m_object(new T(c)) { }
- // DMNSN_Array_Element(const DMNSN_Array_Element& ae);
- // ~DMNSN_Array_Element();
-
- // DMNSN_Array_Element& operator=(const DMNSN_Array_Element& ae);
-
- C_Type dmnsn() const { return m_object->dmnsn(); }
- T& object(C_Type& c) const { return *m_object; }
-
- static const bool must_rebuild = false;
-
- private:
- std::tr1::shared_ptr<T> m_object;
- };
-
- // Base class for polymorphic wrappers
- template <typename T, typename C>
- class Polymorphic_Array_Element
- {
- public:
- typedef C C_Type;
-
- Polymorphic_Array_Element()
- {
- throw Dimension_Error("Cannot default-construct a polymorphic array"
- " object.");
- }
-
- Polymorphic_Array_Element(T& object) : m_object(object.copy()) { }
-
- Polymorphic_Array_Element(C_Type c)
- {
- throw Dimension_Error("Cannot wrap existing dmnsn_array* elements in"
- " polymorphic class.");
- }
-
- // Polymorphic_Array_Element(const Polymorphic_Array_Element& ae);
- // ~Polymorphic_Array_Element();
-
- // Polymorphic_Array_Element& operator=(const Polymorphic_Array_Element& e);
-
- C_Type dmnsn() const { return m_object->dmnsn(); }
- T& object(C_Type& c) const { return *m_object; }
-
- static const bool must_rebuild = false;
-
- private:
- std::tr1::shared_ptr<T> m_object;
- };
-
- // Array_Element
-
- template <typename T>
- inline
- Array_Element<T>::Array_Element()
- {
- void (*constraint)() = &POD_constraint<T>;
- static_cast<void>(constraint); // Silence unused variable warning
- }
-
- template <typename T>
- inline
- Array_Element<T>::Array_Element(T t)
- : m_t(t)
- {
- void (*constraint)() = &POD_constraint<T>;
- static_cast<void>(constraint); // Silence unused variable warning
- }
-
- // Array constructors
-
- template <typename T>
- inline
- Array<T>::Array()
- : m_array(new dmnsn_array*(dmnsn_new_array(sizeof(T)))) { }
-
- template <typename T>
- inline
- Array<T>::Array(dmnsn_array* array)
- : m_array(new dmnsn_array*(array))
- {
- m_elements.reserve(dmnsn_array_size(dmnsn()));
- for (std::size_t i = 0; i < dmnsn_array_size(dmnsn()); ++i) {
- C_Type* c = reinterpret_cast<C_Type*>(dmnsn_array_at(dmnsn(), i));
- m_elements.push_back(Array_Element<T>(*c));
- }
- }
-
- // Array element access
-
- template <typename T>
- inline T&
- Array<T>::operator[](std::size_t i)
- {
- if (i >= m_elements.size()) {
- m_elements.resize(i + 1);
- }
- C_Type* c = reinterpret_cast<C_Type*>(dmnsn_array_at(dmnsn(), i));
- return m_elements[i].object(c);
- }
-
- template <typename T>
- inline const T&
- Array<T>::operator[](std::size_t i) const
- {
- if (i >= m_elements.size()) {
- m_elements.resize(i + 1);
- }
- C_Type* c = reinterpret_cast<C_Type*>(dmnsn_array_at(dmnsn(), i));
- return m_elements[i].object(c);
- }
-
- template <typename T>
- inline void
- Array<T>::resize(std::size_t size)
- {
- m_elements.resize(size);
- dmnsn_array_resize(dmnsn(), size);
- }
-
- template <typename T>
- inline void
- Array<T>::push(T& object)
- {
- Array_Element<T> ae(object);
- m_elements.push_back(ae);
-
- C_Type c = ae.dmnsn();
- dmnsn_array_push(dmnsn(), &c);
- }
-
- template <typename T>
- inline void
- Array<T>::push(const T& object)
- {
- Array_Element<T> ae(object);
- m_elements.push_back(ae);
-
- C_Type c = ae.dmnsn();
- dmnsn_array_push(dmnsn(), &c);
- }
-
- template <typename T>
- inline void
- Array<T>::pop()
- {
- m_elements.pop();
- dmnsn_array_resize(dmnsn_array_size(dmnsn()) - 1);
- }
-
- // Access the underlying dmnsn_array*
-
- template <typename T>
- inline dmnsn_array*
- Array<T>::dmnsn()
- {
- if (!m_array) {
- throw Dimension_Error("Attempting to access released array.");
- }
-
- if (Array_Element<T>::must_rebuild) {
- rebuild();
- }
-
- return *m_array;
- }
-
- template <typename T>
- inline const dmnsn_array*
- Array<T>::dmnsn() const
- {
- if (!m_array) {
- throw Dimension_Error("Attempting to access released array.");
- }
-
- if (Array_Element<T>::must_rebuild) {
- rebuild();
- }
-
- return *m_array;
- }
-
- // Release the dmnsn_array*, if we are the only Array holding it
- template <typename T>
- inline dmnsn_array*
- Array<T>::release()
- {
- dmnsn_array* array = dmnsn();
-
- if (!m_array.unique()) {
- throw Dimension_Error("Attempting to release non-unique array.");
- } else {
- m_array.reset();
- return array;
- }
- }
-
- // Rebuild the dmnsn_array* from the C++ elements, needed if the C++ objects
- // wrap their C objects by value, not reference
- template <typename T>
- inline void
- Array<T>::rebuild() const
- {
- for (std::size_t i = 0; i < size(); ++i) {
- C_Type c = m_elements[i].dmnsn();
- dmnsn_array_set(*m_array, i, &c);
- }
- }
-}
-
-#endif /* DIMENSIONXX_ARRAY_HPP */
diff --git a/libdimensionxx/dimensionxx/camera.hpp b/libdimensionxx/dimensionxx/camera.hpp
deleted file mode 100644
index 81952d1..0000000
--- a/libdimensionxx/dimensionxx/camera.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_camera* wrapper.
-
-#ifndef DIMENSIONXX_CAMERA_HPP
-#define DIMENSIONXX_CAMERA_HPP
-
-namespace Dimension
-{
- // Abstract base camera class. Wraps a dmnsn_camera*.
- class Camera
- {
- public:
- // Delete the camera
- virtual ~Camera();
-
- // Camera callback
- virtual Line ray(double x, double y);
-
- // Shallow-copy a derived camera
- virtual Camera* copy() const = 0;
-
- // Access the wrapped C camera.
- dmnsn_camera* dmnsn();
- const dmnsn_camera* dmnsn() const;
-
- protected:
- // No-op
- Camera();
- // Shallow-copy
- Camera(const Camera& camera);
- // Wrap an existing camera
- explicit Camera(dmnsn_camera* camera);
-
- // Is m_camera unique?
- bool unique() const;
-
- // Set the wrapped C camera
- void dmnsn(dmnsn_camera* camera);
-
- private:
- // 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
- class Custom_Camera : public Camera
- {
- public:
- Custom_Camera();
- virtual ~Custom_Camera();
-
- virtual Line ray(double x, double y) = 0;
- };
-
- // Array_Element specialization
- template <>
- class Array_Element<Camera>
- : public Polymorphic_Array_Element<Camera, dmnsn_camera*>
- {
- public:
- typedef dmnsn_camera* C_Type;
-
- Array_Element() { }
- Array_Element(Camera& camera)
- : Polymorphic_Array_Element<Camera, dmnsn_camera*>(camera) { }
- Array_Element(C_Type c)
- : Polymorphic_Array_Element<Camera, dmnsn_camera*>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-}
-
-#endif /* DIMENSIONXX_CAMERA_HPP */
diff --git a/libdimensionxx/dimensionxx/cameras.hpp b/libdimensionxx/dimensionxx/cameras.hpp
deleted file mode 100644
index 648c3da..0000000
--- a/libdimensionxx/dimensionxx/cameras.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Camera wrappers.
-
-#ifndef DIMENSIONXX_CAMERAS_HPP
-#define DIMENSIONXX_CAMERAS_HPP
-
-namespace Dimension
-{
- // Perspective camera
- class Perspective_Camera : public Camera
- {
- public:
- Perspective_Camera();
- // ~Perspective_Camera();
-
- // Get/set the transformation matrix
- Matrix trans();
- void trans(const Matrix& trans);
-
- // Shallow-copy the camera
- Camera* copy() const;
-
- private:
- // Copying prohibited, but used internally
- Perspective_Camera(const Perspective_Camera& camera);
- Perspective_Camera& operator=(const Perspective_Camera&);
- };
-}
-
-#endif /* DIMENSIONXX_CAMERAS_HPP */
diff --git a/libdimensionxx/dimensionxx/canvas.hpp b/libdimensionxx/dimensionxx/canvas.hpp
deleted file mode 100644
index 321e1c7..0000000
--- a/libdimensionxx/dimensionxx/canvas.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_canvas* wrapper.
-
-#ifndef DIMENSIONXX_CANVAS_HPP
-#define DIMENSIONXX_CANVAS_HPP
-
-#include <tr1/memory>
-
-namespace Dimension
-{
- // Base canvas class. Wraps a dmnsn_canvas*.
- class Canvas
- {
- public:
- // Allocate a dmnsn_canvas of specified width and height
- Canvas(unsigned int width, unsigned int height);
-
- // Wrap an existing canvas
- explicit Canvas(dmnsn_canvas* canvas);
-
- // Canvas(const Canvas& canvas);
-
- // Delete the canvas
- ~Canvas();
-
- // Get the width and height
- unsigned int width() const;
- unsigned int height() const;
-
- // Get and set a pixel
- Color pixel(unsigned int x, unsigned int y) const;
- void pixel(unsigned int x, unsigned int y, const Color& c);
-
- // Access the wrapped C object.
- dmnsn_canvas* dmnsn();
- const dmnsn_canvas* dmnsn() const;
-
- private:
- // Copy-assignment prohibited
- Canvas& operator=(const Canvas&);
-
- std::tr1::shared_ptr<dmnsn_canvas*> m_canvas;
- };
-
- // Array_Element specialization
- template <>
- class Array_Element<Canvas>
- : public DMNSN_Array_Element<Canvas, dmnsn_canvas*>
- {
- public:
- typedef dmnsn_canvas* C_Type;
-
- Array_Element() { }
- Array_Element(Canvas& canvas)
- : DMNSN_Array_Element<Canvas, dmnsn_canvas*>(canvas) { }
- Array_Element(C_Type c)
- : DMNSN_Array_Element<Canvas, dmnsn_canvas*>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-}
-
-#endif /* DIMENSIONXX_CANVAS_HPP */
diff --git a/libdimensionxx/dimensionxx/color.hpp b/libdimensionxx/dimensionxx/color.hpp
deleted file mode 100644
index ad28c4d..0000000
--- a/libdimensionxx/dimensionxx/color.hpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Wrappers for libdimension colors.
-
-#ifndef DIMENSIONXX_COLOR_HPP
-#define DIMENSIONXX_COLOR_HPP
-
-namespace Dimension
-{
- // Forward declarations
- class CIE_XYZ;
- class CIE_xyY;
- class CIE_Lab;
- class CIE_Luv;
- class sRGB;
-
- // Default whitepoint (D50)
- extern const CIE_XYZ whitepoint;
-
- // Wrapper for dmnsn_color
- class Color
- {
- public:
- Color() { }
- inline Color(const CIE_XYZ& XYZ);
- inline Color(const CIE_xyY& xyY);
- inline Color(const CIE_Lab& Lab, const CIE_XYZ& white = whitepoint);
- inline Color(const CIE_Luv& Luv, const CIE_XYZ& white = whitepoint);
- inline Color(const sRGB& RGB);
- explicit Color(dmnsn_color c) : m_color(c) { }
- // Color(const Color& c);
- // ~Color();
-
- // Get and set filtered and unfiltered transparancy
- double filter() const { return m_color.filter; }
- double trans() const { return m_color.trans; }
-
- void filter(double f) { m_color.filter = f; }
- void trans(double t) { m_color.trans = t; }
-
- // Color& operator=(const Color& c);
-
- // Add a color to this one in a perceptually correct manner
- Color& operator+=(const Color& c)
- { m_color = dmnsn_color_add(m_color, c.m_color); return *this; }
-
- // Access the wrapped color
- dmnsn_color dmnsn() const { return m_color; }
-
- private:
- dmnsn_color m_color;
- };
-
- // Wrappers for all libdimension color types
-
- class CIE_XYZ
- {
- public:
- CIE_XYZ() { }
- CIE_XYZ(double X, double Y, double Z)
- { m_XYZ.X = X; m_XYZ.Y = Y; m_XYZ.Z = Z; }
- CIE_XYZ(const Color& c) : m_XYZ(dmnsn_XYZ_from_color(c.dmnsn())) { }
- explicit CIE_XYZ(dmnsn_CIE_XYZ XYZ) : m_XYZ(XYZ) { }
- // CIE_XYZ(const CIE_XYZ& XYZ);
- // ~CIE_XYZ();
-
- double X() const { return m_XYZ.X; }
- double Y() const { return m_XYZ.Y; }
- double Z() const { return m_XYZ.Z; }
-
- // CIE_XYZ& operator=(const CIE_XYZ& XYZ);
- CIE_XYZ& operator=(const Color& c)
- { m_XYZ = dmnsn_XYZ_from_color(c.dmnsn()); return *this; }
-
- dmnsn_CIE_XYZ dmnsn() const { return m_XYZ; }
-
- private:
- dmnsn_CIE_XYZ m_XYZ;
- };
-
- class CIE_xyY
- {
- public:
- CIE_xyY() { }
- CIE_xyY(double x, double y, double Y)
- { m_xyY.x = x; m_xyY.y = y; m_xyY.Y = Y; }
- CIE_xyY(const Color& c) : m_xyY(dmnsn_xyY_from_color(c.dmnsn())) { }
- explicit CIE_xyY(dmnsn_CIE_xyY xyY) : m_xyY(xyY) { }
- // CIE_xyY(const CIE_xyY& xyY);
- // ~CIE_xyY();
-
- double x() const { return m_xyY.x; }
- double y() const { return m_xyY.y; }
- double Y() const { return m_xyY.Y; }
-
- // CIE_xyY& operator=(const CIE_xyY& xyY);
- CIE_xyY& operator=(const Color& c)
- { m_xyY = dmnsn_xyY_from_color(c.dmnsn()); return *this; }
-
- dmnsn_CIE_xyY dmnsn() const { return m_xyY; }
-
- private:
- dmnsn_CIE_xyY m_xyY;
- };
-
- class CIE_Lab
- {
- public:
- CIE_Lab() { }
- CIE_Lab(double L, double a, double b)
- { m_Lab.L = L; m_Lab.a = a; m_Lab.b = b; }
- CIE_Lab(const Color& c, const CIE_XYZ& white = whitepoint)
- : m_Lab(dmnsn_Lab_from_color(c.dmnsn(), white.dmnsn())) { }
- explicit CIE_Lab(dmnsn_CIE_Lab Lab) : m_Lab(Lab) { }
- // CIE_Lab(const CIE_Lab& Lab);
- // ~CIE_Lab();
-
- double L() const { return m_Lab.L; }
- double a() const { return m_Lab.a; }
- double b() const { return m_Lab.b; }
-
- // CIE_Lab& operator=(const CIE_Lab& Lab);
- CIE_Lab& operator=(const Color& c)
- { m_Lab = dmnsn_Lab_from_color(c.dmnsn(), whitepoint.dmnsn());
- return *this; }
-
- dmnsn_CIE_Lab dmnsn() const { return m_Lab; }
-
- private:
- dmnsn_CIE_Lab m_Lab;
- };
-
- class CIE_Luv
- {
- public:
- CIE_Luv() { }
- CIE_Luv(double L, double u, double v)
- { m_Luv.L = L; m_Luv.u = u; m_Luv.v = v; }
- CIE_Luv(const Color& c, const CIE_XYZ& white = whitepoint)
- : m_Luv(dmnsn_Luv_from_color(c.dmnsn(), white.dmnsn())) { }
- explicit CIE_Luv(dmnsn_CIE_Luv Luv) : m_Luv(Luv) { }
- // CIE_Luv(const CIE_Luv& Luv);
- // ~CIE_Luv();
-
- double L() const { return m_Luv.L; }
- double u() const { return m_Luv.u; }
- double v() const { return m_Luv.v; }
-
- // CIE_Luv& operator=(const CIE_Luv& Luv);
- CIE_Luv& operator=(const Color& c)
- { m_Luv = dmnsn_Luv_from_color(c.dmnsn(), whitepoint.dmnsn());
- return *this; }
-
- dmnsn_CIE_Luv dmnsn() const { return m_Luv; }
-
- private:
- dmnsn_CIE_Luv m_Luv;
- };
-
- class sRGB
- {
- public:
- sRGB() { }
- sRGB(double R, double G, double B)
- { m_RGB.R = R; m_RGB.G = G; m_RGB.B = B; }
- sRGB(const Color& c) : m_RGB(dmnsn_sRGB_from_color(c.dmnsn())) { }
- explicit sRGB(dmnsn_sRGB RGB) : m_RGB(RGB) { }
- // sRGB(const sRGB& RGB);
- // ~sRGB();
-
- double R() const { return m_RGB.R; }
- double G() const { return m_RGB.G; }
- double B() const { return m_RGB.B; }
-
- // sRGB& operator=(const sRGB& RGB);
- sRGB& operator=(const Color& c)
- { m_RGB = dmnsn_sRGB_from_color(c.dmnsn()); return *this; }
-
- dmnsn_sRGB dmnsn() const { return m_RGB; }
-
- private:
- dmnsn_sRGB m_RGB;
- };
-
- // Array_Element specialization
- template <>
- class Array_Element<Color>
- : public By_Value_Array_Element<Color, dmnsn_color>
- {
- public:
- typedef dmnsn_color C_Type;
-
- Array_Element() { }
- Array_Element(Color& color)
- : By_Value_Array_Element<Color, dmnsn_color>(color) { }
- Array_Element(C_Type c)
- : By_Value_Array_Element<Color, dmnsn_color>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-
- // Color inline constructors
-
- inline Color::Color(const CIE_XYZ& XYZ)
- : m_color(dmnsn_color_from_XYZ(XYZ.dmnsn())) { }
-
- inline Color::Color(const CIE_xyY& xyY)
- : m_color(dmnsn_color_from_xyY(xyY.dmnsn())) { }
-
- inline Color::Color(const CIE_Lab& Lab, const CIE_XYZ& white)
- : m_color(dmnsn_color_from_Lab(Lab.dmnsn(), white.dmnsn())) { }
-
- inline Color::Color(const CIE_Luv& Luv, const CIE_XYZ& white)
- : m_color(dmnsn_color_from_Luv(Luv.dmnsn(), white.dmnsn())) { }
-
- inline Color::Color(const sRGB& RGB)
- : m_color(dmnsn_color_from_sRGB(RGB.dmnsn())) { }
-
- // Color operators
-
- // Perceptually correct color combination
- inline Color
- operator+(const Color& lhs, const Color& rhs)
- {
- Color temp = lhs;
- temp += rhs;
- return temp;
- }
-
- // Perceptual color difference
- inline double
- operator-(const Color& lhs, const Color& rhs)
- {
- return dmnsn_color_difference(lhs.dmnsn(), rhs.dmnsn());
- }
-}
-
-#endif /* DIMENSIONXX_COLOR_HPP */
diff --git a/libdimensionxx/dimensionxx/cookie.hpp b/libdimensionxx/dimensionxx/cookie.hpp
deleted file mode 100644
index 7df88c8..0000000
--- a/libdimensionxx/dimensionxx/cookie.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Some internal magic to use C FILE* I/O with C++ streams.
-
-#ifndef DIMENSIONXX_COOKIE_HPP
-#define DIMENSIONXX_COOKIE_HPP
-
-#include <istream>
-#include <ostream>
-#include <cstdio>
-
-namespace Dimension
-{
- // Simple RAII classes for FILE*'s which interface with a C++ stream.
-
- class FILE_Cookie
- {
- public:
- // Destructor made pure virtual
- virtual ~FILE_Cookie() = 0;
-
- // Get the magic FILE*
- FILE* file() { return m_file; }
- const FILE* file() const { return m_file; }
-
- protected:
- FILE_Cookie() { }
-
- // Set the underlying FILE*
- void file(FILE* file) { m_file = file; }
-
- private:
- std::FILE* m_file;
-
- // Copying prohibited
- FILE_Cookie(const FILE_Cookie& cookie);
- FILE_Cookie& operator=(const FILE_Cookie& cookie);
- };
-
- class iFILE_Cookie : public virtual FILE_Cookie
- {
- public:
- iFILE_Cookie(std::istream& istr);
- virtual ~iFILE_Cookie();
-
- // Get the C++ streams
- std::istream& istr() { return *m_istr; }
- const std::istream& istr() const { return *m_istr; }
-
- protected:
- // Just set the istream without initializing the FILE*
- iFILE_Cookie(std::istream& istr, int) : m_istr(&istr) { }
-
- private:
- std::istream* m_istr;
- };
-
- class oFILE_Cookie : public virtual FILE_Cookie
- {
- public:
- oFILE_Cookie(std::ostream& ostr);
- virtual ~oFILE_Cookie();
-
- // Get the C++ streams
- std::ostream& ostr() { return *m_ostr; }
- const std::ostream& ostr() const { return *m_ostr; }
-
- protected:
- // Just set the istream without initializing the FILE*
- oFILE_Cookie(std::ostream& ostr, int) : m_ostr(&ostr) { }
-
- private:
- std::ostream* m_ostr;
- };
-
- class ioFILE_Cookie : public iFILE_Cookie, public oFILE_Cookie
- {
- public:
- ioFILE_Cookie(std::iostream& iostr);
- virtual ~ioFILE_Cookie();
- };
-}
-
-#endif /* DIMENSIONXX_COOKIE_HPP */
diff --git a/libdimensionxx/dimensionxx/cube.hpp b/libdimensionxx/dimensionxx/cube.hpp
deleted file mode 100644
index 6ec95f0..0000000
--- a/libdimensionxx/dimensionxx/cube.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Cube wrapper
-
-#ifndef DIMENSIONXX_CUBE_HPP
-#define DIMENSIONXX_CUBE_HPP
-
-namespace Dimension
-{
-}
-
-#endif /* DIMENSIONXX_CUBE_HPP */
diff --git a/libdimensionxx/dimensionxx/error.hpp b/libdimensionxx/dimensionxx/error.hpp
deleted file mode 100644
index 17c2af4..0000000
--- a/libdimensionxx/dimensionxx/error.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Wrappers for libdimension error handling, and an exception class.
-// dmnsn_error is still used by libdimensionxx whenever an exception shouldn't
-// be thrown, like in destructors, and whenever libdimension uses it internally.
-// Exceptions are thrown otherwise to report errors.
-
-#ifndef DIMENSIONXX_ERROR_HPP
-#define DIMENSIONXX_ERROR_HPP
-
-#include <dimension.h>
-#include <stdexcept>
-#include <string>
-
-namespace Dimension
-{
- // Wrapper for dmnsn_severity
- enum Severity {
- SEVERITY_LOW = DMNSN_SEVERITY_LOW,
- SEVERITY_MEDIUM = DMNSN_SEVERITY_MEDIUM,
- SEVERITY_HIGH = DMNSN_SEVERITY_HIGH
- };
-
- // Get or set the resilience, thread-safely
- Severity resilience();
- void resilience(Severity resilience);
-
- // Generic exception class, derives from std::runtime_error
- class Dimension_Error : public std::runtime_error
- {
- public:
- Dimension_Error(const std::string& str);
- };
-}
-
-#endif /* DIMENSIONXX_ERROR_HPP */
diff --git a/libdimensionxx/dimensionxx/geometry.hpp b/libdimensionxx/dimensionxx/geometry.hpp
deleted file mode 100644
index 10cf452..0000000
--- a/libdimensionxx/dimensionxx/geometry.hpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Wrappers for geometric types (Vectors, Matricies, Lines (rays)).
-
-#ifndef DIMENSIONXX_GEOMETRY_HPP
-#define DIMENSIONXX_GEOMETRY_HPP
-
-#include <dimension.h>
-
-namespace Dimension
-{
- class Vector;
-
- // Wrapper for dmnsn_matrix
- class Matrix
- {
- public:
- Matrix() { }
- Matrix(double a0, double a1, double a2, double a3,
- double b0, double b1, double b2, double b3,
- double c0, double c1, double c2, double c3,
- double d0, double d1, double d2, double d3)
- : m_matrix(dmnsn_matrix_construct(a0, a1, a2, a3,
- b0, b1, b2, b3,
- c0, c1, c2, c3,
- d0, d1, d2, d3)) { }
- explicit Matrix(dmnsn_matrix m) : m_matrix(m) { }
- // Matrix(const Matrix& m);
- // ~Matrix();
-
- // Element access
- double* operator[](unsigned int i) { return m_matrix.n[i]; }
-
- // Matrix arithmetic
-
- // Matrix& operator=(const Matrix& rhs);
- Matrix& operator*=(const Matrix& rhs)
- { m_matrix = dmnsn_matrix_mul(rhs.m_matrix, m_matrix); return *this; }
-
- // Get the wrapped matrix
- dmnsn_matrix dmnsn() const { return m_matrix; }
-
- // Special constructors
- static inline Matrix identity();
- static inline Matrix scale(const Vector& factor);
- static inline Matrix translation(const Vector& d);
- static inline Matrix rotation(const Vector& theta);
-
- private:
- dmnsn_matrix m_matrix;
- };
-
- // Wrapper for dmnsn_vector
- class Vector
- {
- public:
- Vector() { }
- Vector(double x, double y, double z)
- : m_vector(dmnsn_vector_construct(x, y, z)) { }
- explicit Vector(dmnsn_vector v) : m_vector(v) { }
- // Vector(const Vector& v);
- // ~Vector();
-
- // Get the x, y, and z components.
- double x() const { return m_vector.x; }
- double y() const { return m_vector.y; }
- double z() const { return m_vector.z; }
-
- // Vector arithmetic
-
- // Vector& operator=(const Vector& rhs);
- Vector& operator+=(const Vector& rhs)
- { m_vector = dmnsn_vector_add(m_vector, rhs.m_vector); return *this; }
- Vector& operator-=(const Vector& rhs)
- { m_vector = dmnsn_vector_sub(m_vector, rhs.m_vector); return *this; }
- Vector& operator*=(double rhs)
- { m_vector = dmnsn_vector_mul(rhs, m_vector); return *this; }
- Vector& operator*=(const Matrix& m)
- { m_vector = dmnsn_matrix_vector_mul(m.dmnsn(), m_vector); return *this; }
- Vector& operator/=(double rhs)
- { m_vector = dmnsn_vector_div(m_vector, rhs); return *this; }
-
- // Get the wrapped vector
- dmnsn_vector dmnsn() const { return m_vector; }
-
- private:
- dmnsn_vector m_vector;
- };
-
- // Wrapper for dmnsn_line
- class Line
- {
- public:
- Line() { }
- Line(const Vector& x0, const Vector& n)
- { m_line.x0 = x0.dmnsn(); m_line.n = n.dmnsn(); }
- explicit Line(dmnsn_line l) : m_line(l) { }
- // Line(const Line& l);
- // ~Line();
-
- Vector x0() const { return Vector(m_line.x0); }
- Vector n() const { return Vector(m_line.n); }
- double t(const Vector& v) { return dmnsn_line_index(m_line, v.dmnsn()); }
-
- // Line& operator=(const Line& l);
- Line& operator*=(const Matrix& m)
- { m_line = dmnsn_matrix_line_mul(m.dmnsn(), m_line); return *this; }
-
- // Get the point `t' on the line (x0 + t*n)
- Vector operator()(double t) { return Vector(dmnsn_line_point(m_line, t)); }
-
- // Get the wrapped line
- dmnsn_line dmnsn() const { return m_line; }
-
- private:
- dmnsn_line m_line;
- };
-
- // Array_Element specializations
-
- template <>
- class Array_Element<Matrix>
- : public By_Value_Array_Element<Matrix, dmnsn_matrix>
- {
- public:
- typedef dmnsn_matrix C_Type;
-
- Array_Element() { }
- Array_Element(Matrix& matrix)
- : By_Value_Array_Element<Matrix, dmnsn_matrix>(matrix) { }
- Array_Element(C_Type c)
- : By_Value_Array_Element<Matrix, dmnsn_matrix>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-
- template <>
- class Array_Element<Vector>
- : public By_Value_Array_Element<Vector, dmnsn_vector>
- {
- public:
- typedef dmnsn_vector C_Type;
-
- Array_Element() { }
- Array_Element(Vector& vector)
- : By_Value_Array_Element<Vector, dmnsn_vector>(vector) { }
- Array_Element(C_Type c)
- : By_Value_Array_Element<Vector, dmnsn_vector>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-
- template <>
- class Array_Element<Line>
- : public By_Value_Array_Element<Line, dmnsn_line>
- {
- public:
- typedef dmnsn_line C_Type;
-
- Array_Element() { }
- Array_Element(Line& line)
- : By_Value_Array_Element<Line, dmnsn_line>(line) { }
- Array_Element(C_Type c)
- : By_Value_Array_Element<Line, dmnsn_line>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-
- // Matrix operators
-
- inline Matrix
- operator*(const Matrix& lhs, const Matrix& rhs)
- {
- // This order is important!
- Matrix r = rhs;
- r *= lhs;
- return r;
- }
-
- inline Matrix
- inverse(const Matrix& M)
- {
- return Matrix(dmnsn_matrix_inverse(M.dmnsn()));
- }
-
- // Special Matrix constructors
-
- inline Matrix
- Matrix::identity()
- {
- return Matrix(dmnsn_identity_matrix());
- }
-
- inline Matrix
- Matrix::scale(const Vector& factor)
- {
- return Matrix(dmnsn_scale_matrix(factor.dmnsn()));
- }
-
- inline Matrix
- Matrix::translation(const Vector& d)
- {
- return Matrix(dmnsn_translation_matrix(d.dmnsn()));
- }
-
- inline Matrix
- Matrix::rotation(const Vector& theta)
- {
- return Matrix(dmnsn_rotation_matrix(theta.dmnsn()));
- }
-
- // Vector operators
-
- inline Vector
- operator+(const Vector& lhs, const Vector& rhs)
- {
- Vector r = lhs;
- r += rhs;
- return r;
- }
-
- inline Vector
- operator-(const Vector& lhs, const Vector& rhs)
- {
- Vector r = lhs;
- r -= rhs;
- return r;
- }
-
- inline Vector
- operator*(const Vector& lhs, double rhs)
- {
- Vector r = lhs;
- r *= rhs;
- return r;
- }
-
- inline Vector
- operator*(double lhs, const Vector& rhs)
- {
- Vector r = rhs;
- r *= lhs;
- return r;
- }
-
- inline Vector
- operator*(const Matrix& lhs, const Vector& rhs)
- {
- Vector r = rhs;
- r *= lhs;
- return r;
- }
-
- inline Vector
- operator/(const Vector& lhs, double rhs)
- {
- Vector r = lhs;
- r /= rhs;
- return r;
- }
-
- inline double
- norm(const Vector& v)
- {
- return dmnsn_vector_norm(v.dmnsn());
- }
-
- inline Vector
- normalize(const Vector& v)
- {
- return Vector(dmnsn_vector_normalize(v.dmnsn()));
- }
-
- // Dot product
- inline double
- dot(const Vector& lhs, const Vector& rhs)
- {
- return dmnsn_vector_dot(lhs.dmnsn(), rhs.dmnsn());
- }
-
- // Cross product
- inline Vector
- cross(const Vector& lhs, const Vector& rhs)
- {
- return Vector(dmnsn_vector_cross(lhs.dmnsn(), rhs.dmnsn()));
- }
-
- // Line transformation
- inline Line
- operator*(const Matrix& lhs, const Line& rhs)
- {
- Line r = rhs;
- r *= lhs;
- return r;
- }
-}
-
-#endif /* DIMENSIONXX_GEOMETRY_HPP */
diff --git a/libdimensionxx/dimensionxx/gl.hpp b/libdimensionxx/dimensionxx/gl.hpp
deleted file mode 100644
index dcf02f2..0000000
--- a/libdimensionxx/dimensionxx/gl.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// C++ wrapper for libdimension GL support
-
-#ifndef DIMENSIONXX_GL_HPP
-#define DIMENSIONXX_GL_HPP
-
-#include <istream>
-#include <ostream>
-
-namespace Dimension
-{
- class GL_Writer
- {
- public:
- GL_Writer(Canvas& canvas);
- ~GL_Writer();
-
- void write();
-
- private:
- // Copying prohibited
- GL_Writer(const GL_Writer&);
- GL_Writer& operator=(const GL_Writer&);
-
- Canvas* m_canvas;
- bool m_written;
- };
-
- class GL_Reader
- {
- public:
- GL_Reader();
- // ~GL_Reader();
-
- Canvas read(unsigned int x0, unsigned int y0,
- unsigned int width, unsigned int height);
-
- private:
- // Copying prohibited
- GL_Reader(const GL_Reader&);
- GL_Reader& operator=(const GL_Reader&);
- };
-}
-
-#endif /* DIMENSIONXX_GL_HPP */
diff --git a/libdimensionxx/dimensionxx/object.hpp b/libdimensionxx/dimensionxx/object.hpp
deleted file mode 100644
index 4c9dbff..0000000
--- a/libdimensionxx/dimensionxx/object.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_object* wrapper.
-
-#ifndef DIMENSIONXX_OBJECT_HPP
-#define DIMENSIONXX_OBJECT_HPP
-
-namespace Dimension
-{
- // Type to represent a ray-object intersection
- class Intersection
- {
- public:
- Intersection(const Line& ray, double t, const Texture& texture);
- explicit Intersection(dmnsn_intersection *intersection);
- // Intersection(const Intersection& intersection);
- ~Intersection();
-
- Line& ray() { return m_ray; }
- const Line& ray() const { return m_ray; }
-
- double t() const { return dmnsn()->t; }
- void t(double t) { dmnsn()->t = t; }
-
- const Texture& texture() const { return m_texture; }
-
- dmnsn_intersection* dmnsn();
- const dmnsn_intersection* dmnsn() const;
-
- dmnsn_intersection* release();
-
- private:
- // Copy-assignment prohibited
- Intersection& operator=(const Intersection& intersection);
-
- std::tr1::shared_ptr<dmnsn_intersection*> m_intersection;
- Line m_ray;
- const Texture m_texture;
- };
-
- // Base object class. Wraps a dmnsn_object*.
- class Object
- {
- public:
- // Wrap an existing object.
- explicit Object(dmnsn_object* object);
- // Delete the object
- virtual ~Object();
-
- // Get/set the transformation matrix
- Matrix trans();
- void trans(const Matrix& trans);
-
- // Object callbacks
- virtual Intersection intersection(const Line& l);
- virtual bool inside(const Vector& point);
-
- // Shallow-copy a derived object
- virtual Object* copy() const;
-
- // Access the wrapped C object
- dmnsn_object* dmnsn();
- const dmnsn_object* dmnsn() const;
-
- protected:
- // No-op
- Object();
- // Shallow copy
- Object(const Object& object);
-
- // Is m_object unique?
- bool unique() const;
-
- // Set the wrapped object
- void dmnsn(dmnsn_object* object);
-
- private:
- // Copy-assignment prohibited
- Object& operator=(const Object&);
-
- std::tr1::shared_ptr<dmnsn_object*> m_object;
- };
-
- // A custom object abstract base class, for creating your own object types
- class Custom_Object : public Object
- {
- public:
- Custom_Object();
- virtual ~Custom_Object();
-
- virtual Intersection intersection(const Line& l) = 0;
- virtual bool inside(const Vector& point) = 0;
- };
-
- // Array_Element specialization
- template <>
- class Array_Element<Object>
- : public Polymorphic_Array_Element<Object, dmnsn_object*>
- {
- public:
- typedef dmnsn_object* C_Type;
-
- Array_Element() { }
- Array_Element(Object& object)
- : Polymorphic_Array_Element<Object, dmnsn_object*>(object) { }
- Array_Element(C_Type c)
- : Polymorphic_Array_Element<Object, dmnsn_object*>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-}
-
-#endif /* DIMENSIONXX_OBJECT_HPP */
diff --git a/libdimensionxx/dimensionxx/objects.hpp b/libdimensionxx/dimensionxx/objects.hpp
deleted file mode 100644
index 6f7cce0..0000000
--- a/libdimensionxx/dimensionxx/objects.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Object wrappers.
-
-#ifndef DIMENSIONXX_OBJECTS_HPP
-#define DIMENSIONXX_OBJECTS_HPP
-
-namespace Dimension
-{
- // Sphere object
- class Sphere : public Object
- {
- public:
- Sphere();
- // ~Sphere();
-
- // Shallow-copy the sphere
- Object* copy() const;
-
- private:
- // Copying prohibited, but used internally
- Sphere(const Sphere& sphere);
- Sphere& operator=(const Sphere&);
- };
-
- // A cube
- class Cube : public Object
- {
- public:
- Cube();
- // ~Cube();
-
- // Shallow-copy the cube
- Object* copy() const;
-
- private:
- // Copying prohibited, but used internally
- Cube(const Cube& cube);
- Cube& operator=(const Cube&);
- };
-}
-
-#endif /* DIMENSIONXX_OBJECTS_HPP */
diff --git a/libdimensionxx/dimensionxx/png.hpp b/libdimensionxx/dimensionxx/png.hpp
deleted file mode 100644
index 28a5504..0000000
--- a/libdimensionxx/dimensionxx/png.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// C++ wrapper for libdimension PNG support
-
-#ifndef DIMENSIONXX_PNG_HPP
-#define DIMENSIONXX_PNG_HPP
-
-#include <istream>
-#include <ostream>
-
-namespace Dimension
-{
- class PNG_Writer
- {
- public:
- PNG_Writer(Canvas& canvas, std::ostream& ostr);
- ~PNG_Writer();
-
- void write();
- Progress write_async();
-
- private:
- // Copying prohibited
- PNG_Writer(const PNG_Writer&);
- PNG_Writer& operator=(const PNG_Writer&);
-
- Canvas* m_canvas;
- std::ostream* m_ostr;
- bool m_written;
- };
-
- class PNG_Reader
- {
- public:
- PNG_Reader(std::istream& istr);
- // ~PNG_Reader();
-
- Canvas read();
-
- Progress read_async();
- static Canvas finish(Progress& progress);
-
- private:
- // Copying prohibited
- PNG_Reader(const PNG_Reader&);
- PNG_Reader& operator=(const PNG_Reader&);
-
- std::istream* m_istr;
- bool m_read;
- };
-}
-
-#endif /* DIMENSIONXX_PNG_HPP */
diff --git a/libdimensionxx/dimensionxx/progress.hpp b/libdimensionxx/dimensionxx/progress.hpp
deleted file mode 100644
index 555c8c5..0000000
--- a/libdimensionxx/dimensionxx/progress.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_progress* wrapper.
-
-#ifndef DIMENSIONXX_PROGRESS_HPP
-#define DIMENSIONXX_PROGRESS_HPP
-
-#include <tr1/memory> // For tr1::shared_ptr
-#include <list>
-
-namespace Dimension
-{
- // Base class for persisting objects
- class Persist_Base
- {
- public:
- virtual ~Persist_Base() = 0;
-
- protected:
- Persist_Base() { }
-
- private:
- // Copying prohibited
- Persist_Base(const Persist_Base&);
- Persist_Base& operator=(const Persist_Base&);
- };
-
- // Class for persisting objects
- template <typename T>
- class Persist : public Persist_Base
- {
- public:
- Persist(T* t) : m_t(t) { }
- virtual ~Persist() { delete m_t; }
-
- T* persisted() const { return m_t; }
-
- private:
- T* m_t;
- };
-
- // Class for persisting many objects
- class Persister
- {
- public:
- // Persister();
- // Persister(const Persister& persister);
- // ~Persister();
-
- // Persister& operator=(const Persister& persister);
-
- template <typename T>
- void persist(T* t);
-
- // Access the first persisted element
- template <typename T>
- Persist<T>& first();
-
- private:
- // Copy-assignment prohibited
- Persister& operator=(const Persister&);
-
- std::list<std::tr1::shared_ptr<Persist_Base> > m_persists;
- };
-
- // dmnsn_progress* wrapper class to represent an asynchronous worker thread
- class Progress
- {
- public:
- explicit Progress(dmnsn_progress* progress);
- Progress(dmnsn_progress* progress, const Persister& persister);
- // Progress(const Progress& progress);
-
- // Finishes the job without throwing
- ~Progress();
-
- double progress() const;
- void wait(double progress) const;
-
- void new_element(unsigned int total);
- void increment();
- void done();
-
- // Wait for job to finish, throwing if the job failed
- void finish();
-
- // Access the set of persisted objects
- Persister& persister();
-
- // Access the wrapped C object.
- dmnsn_progress* dmnsn();
- const dmnsn_progress* dmnsn() const;
-
- private:
- // Copy assignment prohibited
- Progress& operator=(const Progress&);
-
- std::tr1::shared_ptr<dmnsn_progress*> m_progress;
- Persister m_persister;
- };
-
- template <typename T>
- void
- Persister::persist(T* t)
- {
- m_persists.push_back(std::tr1::shared_ptr<Persist_Base>(new Persist<T>(t)));
- }
-
- template <typename T>
- Persist<T>&
- Persister::first()
- {
- return dynamic_cast<Persist<T>&>(*m_persists.front());
- }
-}
-
-#endif /* DIMENSIONXX_PROGRESS_HPP */
diff --git a/libdimensionxx/dimensionxx/raytrace.hpp b/libdimensionxx/dimensionxx/raytrace.hpp
deleted file mode 100644
index 7f69008..0000000
--- a/libdimensionxx/dimensionxx/raytrace.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// C++ wrapper for libdimension raytracing
-
-#ifndef DIMENSIONXX_RAYTRACE_HPP
-#define DIMENSIONXX_RAYTRACE_HPP
-
-#include <istream>
-#include <ostream>
-
-namespace Dimension
-{
- class Raytracer
- {
- public:
- Raytracer(Scene& scene);
- ~Raytracer();
-
- // Render the scene
- void render();
- Progress render_async();
-
- private:
- // Copying prohibited
- Raytracer(const Raytracer&);
- Raytracer& operator=(const Raytracer&);
-
- Scene* m_scene;
- bool m_rendered;
- };
-}
-
-#endif /* DIMENSIONXX_RAYTRACE_HPP */
diff --git a/libdimensionxx/dimensionxx/scene.hpp b/libdimensionxx/dimensionxx/scene.hpp
deleted file mode 100644
index c79152f..0000000
--- a/libdimensionxx/dimensionxx/scene.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_scene* wrapper.
-
-#ifndef DIMENSIONXX_SCENE_HPP
-#define DIMENSIONXX_SCENE_HPP
-
-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(Camera& camera, Canvas& canvas);
-
- // Scene(const Scene& scene);
-
- // Delete the scene
- ~Scene();
-
- // Element access
- 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;
-
- private:
- // Copy-assignment prohibited
- Scene& operator=(const Scene&);
-
- std::tr1::shared_ptr<dmnsn_scene*> m_scene;
- std::tr1::shared_ptr<Camera> m_camera;
- std::tr1::shared_ptr<Canvas> m_canvas;
- Array<Object> m_objects;
- };
-}
-
-#endif /* DIMENSIONXX_SCENE_HPP */
diff --git a/libdimensionxx/dimensionxx/texture.hpp b/libdimensionxx/dimensionxx/texture.hpp
deleted file mode 100644
index 7f42206..0000000
--- a/libdimensionxx/dimensionxx/texture.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// dmnsn_texture* wrapper.
-
-#ifndef DIMENSIONXX_TEXTURE_HPP
-#define DIMENSIONXX_TEXTURE_HPP
-
-namespace Dimension
-{
- // Pigment base class. Wraps a dmnsn_pigment*.
- class Pigment
- {
- public:
- explicit Pigment(dmnsn_pigment* pigment);
- ~Pigment();
-
- Pigment* copy() const;
-
- dmnsn_pigment* dmnsn();
- const dmnsn_pigment* dmnsn() const;
-
- protected:
- // No-op
- Pigment();
- // Shallow copy
- Pigment(const Pigment& pigment);
-
- // Is m_pigment unique?
- bool unique() const;
-
- private:
- // Copy-assignment prohibited
- Pigment& operator=(const Pigment&);
-
- std::tr1::shared_ptr<dmnsn_pigment*> m_pigment;
- };
-
- // Texture class. Wraps a dmnsn_texture*.
- class Texture
- {
- public:
- Texture(const Pigment& pigment);
- explicit Texture(dmnsn_texture* texture);
- // Texture(const Texture& texture);
- ~Texture();
-
- dmnsn_texture* dmnsn();
- const dmnsn_texture* dmnsn() const;
-
- private:
- // Copy-assignment prohibited
- Texture& operator=(const Texture&);
-
- std::tr1::shared_ptr<dmnsn_texture*> m_texture;
- std::tr1::shared_ptr<Pigment> m_pigment;
- };
-
- // Array_Element specializations
-
- template <>
- class Array_Element<Pigment>
- : public Polymorphic_Array_Element<Pigment, dmnsn_pigment*>
- {
- public:
- typedef dmnsn_pigment* C_Type;
-
- Array_Element() { }
- Array_Element(Pigment& pigment)
- : Polymorphic_Array_Element<Pigment, dmnsn_pigment*>(pigment) { }
- Array_Element(C_Type c)
- : Polymorphic_Array_Element<Pigment, dmnsn_pigment*>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-
- template <>
- class Array_Element<Texture>
- : public DMNSN_Array_Element<Texture, dmnsn_texture*>
- {
- public:
- typedef dmnsn_texture* C_Type;
-
- Array_Element() { }
- Array_Element(Texture& texture)
- : DMNSN_Array_Element<Texture, dmnsn_texture*>(texture) { }
- Array_Element(C_Type c)
- : DMNSN_Array_Element<Texture, dmnsn_texture*>(c) { }
- // Array_Element(const Array_Element& ae);
- // ~Array_Element();
-
- // Array_Element& operator=(const Array_Element& ae);
- };
-}
-
-#endif /* DIMENSIONXX_TEXTURE_HPP */
diff --git a/libdimensionxx/dimensionxx/utility.hpp b/libdimensionxx/dimensionxx/utility.hpp
deleted file mode 100644
index 50c5e67..0000000
--- a/libdimensionxx/dimensionxx/utility.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************************************
- * Copyright (C) 2009 Tavian Barnes <tavianator@gmail.com> *
- * *
- * This file is part of The Dimension Library. *
- * *
- * The Dimension Library is free software; you can redistribute it and/ *
- * or modify it under the terms of the GNU Lesser General Public License *
- * as published by the Free Software Foundation; either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * The Dimension Library is distributed in the hope that it will be *
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this program. If not, see *
- * <http://www.gnu.org/licenses/>. *
- *************************************************************************/
-
-// Template utilities
-
-#ifndef DIMENSIONXX_UTILITY_HPP
-#define DIMENSIONXX_UTILITY_HPP
-
-namespace Dimension
-{
- // A constraint enforcing that T is a POD type by making it part of a union.
- // Taking the address of this function will cause a compile-time failure if
- // T is not a POD type.
- template <typename T>
- void POD_constraint();
-
- // POD constraint implementation
- template <typename T>
- void
- POD_constraint()
- {
- union
- {
- T t;
- } constraint;
- static_cast<void>(constraint); // Silence unused variable warning
- }
-}
-
-#endif // DIMENSIONXX_UTILITY_HPP