diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-11-19 14:30:41 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-11-19 14:30:41 -0500 |
commit | 6137aed0179476eaa626660885f01ea3f04f988a (patch) | |
tree | e23b07cac6c9b8df58d9700e8a2fa2c719cf965b /dimension | |
parent | 30cb9cb572cf8fa942faff7384580e5e2a06a7b3 (diff) | |
download | dimension-6137aed0179476eaa626660885f01ea3f04f988a.tar.xz |
Support global ambient_light.
Diffstat (limited to 'dimension')
-rw-r--r-- | dimension/common.terminals | 2 | ||||
-rw-r--r-- | dimension/grammar.declarations | 2 | ||||
-rw-r--r-- | dimension/grammar.rules | 5 | ||||
-rw-r--r-- | dimension/lexer.l | 1 | ||||
-rw-r--r-- | dimension/realize.c | 7 |
5 files changed, 14 insertions, 3 deletions
diff --git a/dimension/common.terminals b/dimension/common.terminals index 079aede..5a0d778 100644 --- a/dimension/common.terminals +++ b/dimension/common.terminals @@ -80,7 +80,7 @@ %token DMNSN_T_ALTITUDE %token DMNSN_T_ALWAYS_SAMPLE %token DMNSN_T_AMBIENT "ambient" -%token DMNSN_T_AMBIENT_LIGHT +%token DMNSN_T_AMBIENT_LIGHT "ambient_light" %token DMNSN_T_ANGLE "angle" %token DMNSN_T_APERTURE %token DMNSN_T_APPEND diff --git a/dimension/grammar.declarations b/dimension/grammar.declarations index 58b995f..ef3f7a2 100644 --- a/dimension/grammar.declarations +++ b/dimension/grammar.declarations @@ -23,7 +23,7 @@ %name-prefix "dmnsn_yy" -%expect 12 +%expect 13 %parse-param {const char *filename} %parse-param {void *yyscanner} diff --git a/dimension/grammar.rules b/dimension/grammar.rules index 1ce3e1f..0e9d6f1 100644 --- a/dimension/grammar.rules +++ b/dimension/grammar.rules @@ -55,7 +55,10 @@ GLOBAL_SETTINGS_ITEMS: /* empty */ { } ; -GLOBAL_SETTINGS_ITEM: "assumed_gamma" FLOAT { +GLOBAL_SETTINGS_ITEM: "ambient_light" COLOR { + $$ = dmnsn_new_astnode1(DMNSN_AST_AMBIENT, @$, $2); + } + | "assumed_gamma" FLOAT { dmnsn_diagnostic(@1, "WARNING: assumed_gamma not supported"); $$ = dmnsn_new_astnode1(DMNSN_AST_ASSUMED_GAMMA, @$, $2); diff --git a/dimension/lexer.l b/dimension/lexer.l index 8216091..5e1afa2 100644 --- a/dimension/lexer.l +++ b/dimension/lexer.l @@ -169,6 +169,7 @@ unsigned long wchar; "acos" RETURN_TOKEN(DMNSN_T_ACOS); "acosh" RETURN_TOKEN(DMNSN_T_ACOSH); "ambient" RETURN_TOKEN(DMNSN_T_AMBIENT); +"ambient_light" RETURN_TOKEN(DMNSN_T_AMBIENT_LIGHT); "angle" RETURN_TOKEN(DMNSN_T_ANGLE); "asc" RETURN_TOKEN(DMNSN_T_ASC); "ascii" RETURN_TOKEN(DMNSN_T_ASCII); diff --git a/dimension/realize.c b/dimension/realize.c index 15d4104..d4b45cb 100644 --- a/dimension/realize.c +++ b/dimension/realize.c @@ -239,6 +239,13 @@ dmnsn_realize_global_settings(dmnsn_astnode astnode, dmnsn_scene *scene) dmnsn_astnode child; switch (item->type) { + case DMNSN_AST_AMBIENT: + dmnsn_array_get(item->children, 0, &child); + scene->ambient = dmnsn_realize_color(child); + scene->ambient.filter = 0.0; + scene->ambient.trans = 0.0; + break; + case DMNSN_AST_MAX_TRACE_LEVEL: dmnsn_array_get(item->children, 0, &child); scene->reclimit = dmnsn_realize_integer(child); |