summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-08-21 13:24:13 -0600
committerTavian Barnes <tavianator@gmail.com>2011-08-21 13:24:13 -0600
commit942fd9ff8e267b361de580a95fa247e486120891 (patch)
tree683835731d05db901d98d10ba0023bb1ef3fb285 /libdimension-python
parent6b1fcde7af64ca81079dffe1d62096228693b5d6 (diff)
downloaddimension-942fd9ff8e267b361de580a95fa247e486120891.tar.xz
Replace sky_spheres with a single background pigment.
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pxd14
-rw-r--r--libdimension-python/dimension.pyx53
-rwxr-xr-xlibdimension-python/tests/demo.py3
3 files changed, 12 insertions, 58 deletions
diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd
index 7b3ba6e..4590e89 100644
--- a/libdimension-python/dimension.pxd
+++ b/libdimension-python/dimension.pxd
@@ -346,17 +346,6 @@ cdef extern from "../libdimension/dimension.h":
dmnsn_camera *dmnsn_new_perspective_camera()
- ###############
- # Sky Spheres #
- ###############
-
- ctypedef struct dmnsn_sky_sphere:
- dmnsn_array *pigments
- dmnsn_matrix trans
-
- dmnsn_sky_sphere *dmnsn_new_sky_sphere()
- void dmnsn_delete_sky_sphere(dmnsn_sky_sphere *sky_sphere)
-
##########
# Scenes #
##########
@@ -371,8 +360,7 @@ cdef extern from "../libdimension/dimension.h":
DMNSN_RENDER_FULL
ctypedef struct dmnsn_scene:
- dmnsn_color background
- dmnsn_sky_sphere *sky_sphere
+ dmnsn_pigment *background
dmnsn_texture *default_texture
dmnsn_interior *default_interior
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index d0bd4e7..a9ca3ac 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -1283,38 +1283,6 @@ cdef class PerspectiveCamera(Camera):
# Move the camera into position
self.transform(translate(Vector(location)))
-###############
-# Sky Spheres #
-###############
-
-cdef class SkySphere:
- """A scene background."""
- cdef dmnsn_sky_sphere *_sky_sphere
-
- def __init__(self, pigments):
- """
- Create a SkySphere.
-
- Keyword arguments:
- pigments -- the list of pigments that make up the background, in back-to-
- front order
- """
- self._sky_sphere = dmnsn_new_sky_sphere()
-
- cdef Pigment real_pigment
- for pigment in pigments:
- real_pigment = Pigment(pigment)
- DMNSN_INCREF(real_pigment._pigment)
- dmnsn_array_push(self._sky_sphere.pigments, &real_pigment._pigment)
-
- def __dealloc__(self):
- dmnsn_delete_sky_sphere(self._sky_sphere)
-
- def transform(self, Matrix trans not None):
- """Transform a sky sphere."""
- self._sky_sphere.trans = dmnsn_matrix_mul(trans._m, self._sky_sphere.trans)
- return self
-
##########
# Scenes #
##########
@@ -1400,18 +1368,17 @@ cdef class Scene:
DMNSN_INCREF(self._scene.default_interior)
property background:
- """The solid background color of the scene (default: Black)."""
+ """The background pigment of the scene (default: Black)."""
def __get__(self):
- return _Color(self._scene.background)
- def __set__(self, color):
- self._scene.background = Color(color)._c
-
- property sky_sphere:
- """The background sky pattern of the scene."""
- def __set__(self, SkySphere sky_sphere not None):
- dmnsn_delete_sky_sphere(self._scene.sky_sphere)
- self._scene.sky_sphere = sky_sphere._sky_sphere
- DMNSN_INCREF(self._scene.sky_sphere)
+ if self._scene.background == NULL:
+ return None
+ else:
+ return _Pigment(self._scene.background)
+ def __set__(self, pigment):
+ dmnsn_delete_pigment(self._scene.background)
+ cdef Pigment real_pigment = Pigment(pigment)
+ self._scene.background = real_pigment._pigment
+ DMNSN_INCREF(self._scene.background)
property adc_bailout:
"""The adaptive depth control bailout (default: 1/255)."""
diff --git a/libdimension-python/tests/demo.py b/libdimension-python/tests/demo.py
index 307aafc..fe3518c 100755
--- a/libdimension-python/tests/demo.py
+++ b/libdimension-python/tests/demo.py
@@ -49,8 +49,7 @@ scene = Scene(canvas = canvas,
lights = lights,
camera = camera)
scene.default_texture = Texture(finish = Ambient(0.1) + Diffuse(0.7))
-scene.background = Clear
-scene.sky_sphere = sky_sphere
+scene.background = background
scene.adc_bailout = 1/255
scene.recursion_limit = 5
scene.raytrace()