diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-08-18 20:17:59 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-08-18 20:17:59 -0600 |
commit | e1a7c44bf102b5871a74fba8f168427f5fc118b5 (patch) | |
tree | 1ea2a51970c61c6d70861efcaaf414cfa686bd39 | |
parent | 9c9fb9d59c2e90fc2bc9066dac514285c9479277 (diff) | |
download | dimension-e1a7c44bf102b5871a74fba8f168427f5fc118b5.tar.xz |
Handle reflection correctly in the client.
-rw-r--r-- | dimension/tests/complex.dmnsn | 2 | ||||
-rw-r--r-- | dimension/tests/demo.dmnsn | 4 | ||||
-rw-r--r-- | libdimension-python/dimension.pyx | 7 | ||||
-rw-r--r-- | libdimension/tests/render.c | 6 |
4 files changed, 10 insertions, 9 deletions
diff --git a/dimension/tests/complex.dmnsn b/dimension/tests/complex.dmnsn index a6d7889..b081d14 100644 --- a/dimension/tests/complex.dmnsn +++ b/dimension/tests/complex.dmnsn @@ -54,7 +54,7 @@ def make_sphere(x, y, z, size): texture = Texture( pigment = Color(x/size, y/size, z/size), - finish = Ambient(0.25) + Diffuse(0.8) + Reflection(0.5) + finish = Ambient(0.25) + Diffuse(0.8) + Reflection(0.0, 0.25) ) ) diff --git a/dimension/tests/demo.dmnsn b/dimension/tests/demo.dmnsn index f20be39..04783a0 100644 --- a/dimension/tests/demo.dmnsn +++ b/dimension/tests/demo.dmnsn @@ -19,7 +19,7 @@ # Camera camera = PerspectiveCamera(location = (0, 0.25, -4), - look_at = 0) + look_at = 0) camera.transform(rotate(53*Y)) # Background @@ -52,7 +52,7 @@ hollow_cube = Difference( texture = Texture( pigment = Color(0, 0, 1, trans = 0.75, filter = 1/3), - finish = Reflection(0.5), + finish = Reflection(min = 0, max = 0.5), ), interior = Interior( ior = 1.1, diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx index c219f74..673dc50 100644 --- a/libdimension-python/dimension.pyx +++ b/libdimension-python/dimension.pyx @@ -764,8 +764,11 @@ cdef class Reflection(Finish): """ if max is None: max = min - self._finish.reflection = dmnsn_new_basic_reflection(Color(min)._c, - Color(max)._c, + + # Use sRGB value because Reflection(0.5) should really mean "reflect half + # the light" + self._finish.reflection = dmnsn_new_basic_reflection(Color(min)._sRGB, + Color(max)._sRGB, falloff) ############ diff --git a/libdimension/tests/render.c b/libdimension/tests/render.c index e9dff2a..577fa6a 100644 --- a/libdimension/tests/render.c +++ b/libdimension/tests/render.c @@ -115,11 +115,9 @@ dmnsn_test_scene_add_hollow_cube(dmnsn_scene *scene) cube->texture = dmnsn_new_texture(); cube->texture->pigment = dmnsn_new_solid_pigment(cube_color); - dmnsn_color reflect = dmnsn_color_from_sRGB( - dmnsn_color_mul(0.5, dmnsn_white) - ); + dmnsn_color reflect = dmnsn_color_mul(0.5, dmnsn_white); cube->texture->finish.reflection - = dmnsn_new_basic_reflection(reflect, reflect, 1.0); + = dmnsn_new_basic_reflection(dmnsn_black, reflect, 1.0); cube->interior = dmnsn_new_interior(); cube->interior->ior = 1.1; |