From 3c37bf39733bb53267b046c5f0aafbffeb738990 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 25 Apr 2011 22:28:15 -0600 Subject: Implement adaptive depth control. --- dimension/common.terminals | 2 +- dimension/grammar.epilogue | 1 + dimension/grammar.rules | 5 ++++- dimension/lexer.l | 1 + dimension/parse.h | 1 + dimension/realize.c | 5 +++++ 6 files changed, 13 insertions(+), 2 deletions(-) (limited to 'dimension') diff --git a/dimension/common.terminals b/dimension/common.terminals index f96a1f6..567267b 100644 --- a/dimension/common.terminals +++ b/dimension/common.terminals @@ -71,7 +71,7 @@ %token DMNSN_T_ACOS "acos" %token DMNSN_T_ACOSH "acosh" %token DMNSN_T_ADAPTIVE -%token DMNSN_T_ADC_BAILOUT +%token DMNSN_T_ADC_BAILOUT "adc_bailout" %token DMNSN_T_AGATE %token DMNSN_T_AGATE_TURB %token DMNSN_T_ALL diff --git a/dimension/grammar.epilogue b/dimension/grammar.epilogue index ffa93bf..9b2fa29 100644 --- a/dimension/grammar.epilogue +++ b/dimension/grammar.epilogue @@ -117,6 +117,7 @@ dmnsn_astnode_string(dmnsn_astnode_type astnode_type) dmnsn_astnode_map(DMNSN_AST_NONE, "none"); dmnsn_astnode_map(DMNSN_AST_GLOBAL_SETTINGS, "global_settings"); + dmnsn_astnode_map(DMNSN_AST_ADC_BAILOUT, "adc_bailout"); dmnsn_astnode_map(DMNSN_AST_ASSUMED_GAMMA, "assumed_gamma"); dmnsn_astnode_map(DMNSN_AST_CHARSET, "charset"); dmnsn_astnode_map(DMNSN_AST_ASCII, "ascii"); diff --git a/dimension/grammar.rules b/dimension/grammar.rules index 5f08e20..148e082 100644 --- a/dimension/grammar.rules +++ b/dimension/grammar.rules @@ -55,7 +55,10 @@ GLOBAL_SETTINGS_ITEMS: /* empty */ { } ; -GLOBAL_SETTINGS_ITEM: "ambient_light" COLOR { +GLOBAL_SETTINGS_ITEM: "adc_bailout" FLOAT { + $$ = dmnsn_new_astnode1(DMNSN_AST_ADC_BAILOUT, @$, $2); + } + | "ambient_light" COLOR { $$ = dmnsn_new_astnode1(DMNSN_AST_AMBIENT, @$, $2); } | "assumed_gamma" FLOAT { diff --git a/dimension/lexer.l b/dimension/lexer.l index dbafec2..89cc0a7 100644 --- a/dimension/lexer.l +++ b/dimension/lexer.l @@ -168,6 +168,7 @@ unsigned int wchar; "abs" RETURN_TOKEN(DMNSN_T_ABS); "acos" RETURN_TOKEN(DMNSN_T_ACOS); "acosh" RETURN_TOKEN(DMNSN_T_ACOSH); +"adc_bailout" RETURN_TOKEN(DMNSN_T_ADC_BAILOUT); "ambient" RETURN_TOKEN(DMNSN_T_AMBIENT); "ambient_light" RETURN_TOKEN(DMNSN_T_AMBIENT_LIGHT); "angle" RETURN_TOKEN(DMNSN_T_ANGLE); diff --git a/dimension/parse.h b/dimension/parse.h index 4471edf..a357324 100644 --- a/dimension/parse.h +++ b/dimension/parse.h @@ -31,6 +31,7 @@ typedef enum { DMNSN_AST_NONE, DMNSN_AST_GLOBAL_SETTINGS, + DMNSN_AST_ADC_BAILOUT, DMNSN_AST_ASSUMED_GAMMA, DMNSN_AST_CHARSET, DMNSN_AST_ASCII, diff --git a/dimension/realize.c b/dimension/realize.c index 2603ba1..c9a507d 100644 --- a/dimension/realize.c +++ b/dimension/realize.c @@ -232,6 +232,11 @@ dmnsn_realize_global_settings(dmnsn_astnode astnode, dmnsn_scene *scene) dmnsn_astnode child; switch (item->type) { + case DMNSN_AST_ADC_BAILOUT: + dmnsn_array_get(item->children, 0, &child); + scene->adc_bailout = dmnsn_realize_float(child); + break; + case DMNSN_AST_AMBIENT: dmnsn_array_get(item->children, 0, &child); scene->ambient = dmnsn_realize_color(child); -- cgit v1.2.3