summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-28 13:23:38 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-28 13:23:38 -0500
commit0e6d09432d7c22c8c0f3acedefc1afac67624a8d (patch)
treee888b15d4dd155c2c7dc46065509e124d873f4a9
parent5f4baeb85dbdb26ea56b214280eeb0f6233c1861 (diff)
downloaddimension-0e6d09432d7c22c8c0f3acedefc1afac67624a8d.tar.xz
Allow bare finishes in object modifiers.
-rw-r--r--dimension/common.rules5
-rw-r--r--dimension/realize.c12
-rwxr-xr-xtests/dimension/directives.sh10
3 files changed, 18 insertions, 9 deletions
diff --git a/dimension/common.rules b/dimension/common.rules
index 7b4c609..cc7411f 100644
--- a/dimension/common.rules
+++ b/dimension/common.rules
@@ -150,9 +150,8 @@ OBJECT_MODIFIERS: /* empty */ {
OBJECT_MODIFIER: TRANSFORMATION
| TEXTURE
- | PIGMENT {
- $$ = dmnsn_new_astnode1(DMNSN_AST_TEXTURE, @$, $1);
- }
+ | PIGMENT
+ | FINISH
| INTERIOR
;
diff --git a/dimension/realize.c b/dimension/realize.c
index b20ec9f..e5dfcb4 100644
--- a/dimension/realize.c
+++ b/dimension/realize.c
@@ -590,6 +590,18 @@ dmnsn_realize_object_modifiers(dmnsn_astnode astnode, dmnsn_object *object)
dmnsn_delete_texture(object->texture);
object->texture = dmnsn_realize_texture(modifier);
break;
+ case DMNSN_AST_PIGMENT:
+ if (!object->texture)
+ object->texture = dmnsn_new_texture();
+ dmnsn_delete_pigment(object->texture->pigment);
+ object->texture->pigment = dmnsn_realize_pigment(modifier);
+ break;
+ case DMNSN_AST_FINISH:
+ if (!object->texture)
+ object->texture = dmnsn_new_texture();
+ dmnsn_delete_finish(object->texture->finish);
+ object->texture->finish = dmnsn_realize_finish(modifier);
+ break;
case DMNSN_AST_INTERIOR:
dmnsn_delete_interior(object->interior);
diff --git a/tests/dimension/directives.sh b/tests/dimension/directives.sh
index cf21d8b..5ecf574 100755
--- a/tests/dimension/directives.sh
+++ b/tests/dimension/directives.sh
@@ -55,16 +55,14 @@ $(echo -n \
(vector (integer 0) (integer 0) (integer 0) (integer 0) (integer 0))
(integer 1)
(object-modifiers
- (texture
- (pigment (color (integer 1) (integer 1) (integer 1)
- (integer 0) (integer 0))))))
+ (pigment (color (integer 1) (integer 1) (integer 1)
+ (integer 0) (integer 0)))))
(sphere
(vector (integer 0) (integer 1) (integer 0) (integer 0) (integer 0))
(integer 1)
(object-modifiers
- (texture
- (pigment (color (integer 1) (integer 1) (integer 1)
- (integer 0) (integer 0)))))))' \
+ (pigment (color (integer 1) (integer 1) (integer 1)
+ (integer 0) (integer 0))))))' \
| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')"
if [ "$directives" != "$directives_exp" ]; then