summaryrefslogtreecommitdiffstats
path: root/dimension/common.rules
diff options
context:
space:
mode:
Diffstat (limited to 'dimension/common.rules')
-rw-r--r--dimension/common.rules51
1 files changed, 51 insertions, 0 deletions
diff --git a/dimension/common.rules b/dimension/common.rules
index d5e8994..e477df5 100644
--- a/dimension/common.rules
+++ b/dimension/common.rules
@@ -114,6 +114,7 @@ CAMERA_MODIFIER: "angle" FLOAT {
/* Objects */
OBJECT: FINITE_SOLID_OBJECT
+ | CSG_OBJECT
| LIGHT_SOURCE
| "object" "{"
IDENTIFIER
@@ -196,6 +197,56 @@ SPHERE: "sphere" "{"
}
;
+CSG_OBJECT: UNION
+ | INTERSECTION
+ | DIFFERENCE
+ | MERGE
+;
+
+UNION: "union" "{"
+ OBJECTS
+ OBJECT_MODIFIERS
+ "}"
+ {
+ $$ = dmnsn_new_astnode2(DMNSN_AST_UNION, @$, $3, $4);
+ }
+;
+
+INTERSECTION: "intersection" "{"
+ OBJECTS
+ OBJECT_MODIFIERS
+ "}"
+ {
+ $$ = dmnsn_new_astnode2(DMNSN_AST_INTERSECTION, @$, $3, $4);
+ }
+;
+
+DIFFERENCE: "difference" "{"
+ OBJECTS
+ OBJECT_MODIFIERS
+ "}"
+ {
+ $$ = dmnsn_new_astnode2(DMNSN_AST_DIFFERENCE, @$, $3, $4);
+ }
+;
+
+MERGE: "merge" "{"
+ OBJECTS
+ OBJECT_MODIFIERS
+ "}"
+ {
+ $$ = dmnsn_new_astnode2(DMNSN_AST_MERGE, @$, $3, $4);
+ }
+;
+
+OBJECTS: OBJECT OBJECT {
+ $$ = dmnsn_new_astnode2(DMNSN_AST_ARRAY, @$, $1, $2);
+ }
+ | OBJECTS OBJECT {
+ $$ = $1;
+ dmnsn_array_push($$.children, &$2);
+ }
+
LIGHT_SOURCE: "light_source" "{"
VECTOR "," COLOR
"}"