diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-01-05 06:44:19 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-01-05 06:44:19 +0300 |
commit | 55f450379e80d893f87c362fb3b420828c049301 (patch) | |
tree | cf901296aa958db0cc6230c5aca1869a8b471bef /source/blender/makesrna/intern/rna_world.c | |
parent | 91be2ba9b556a88877c4fa2f3c6ecd339f7e626a (diff) |
Added RNA for ambient occlusion
Diffstat (limited to 'source/blender/makesrna/intern/rna_world.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index ef6905ad19f..e37b93881ef 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -33,8 +33,129 @@ #ifdef RNA_RUNTIME +static void *rna_World_ambient_occlusion_get(PointerRNA *ptr) +{ + return ptr->id.data; +} + #else +void rna_def_ambient_occlusion(BlenderRNA *brna, StructRNA *parent) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_mode_items[] = { + {WO_AOADD, "ADD", "Add", "Add light and shadow."}, + {WO_AOSUB, "SUBTRACT", "Subtract", "Subtract light and shadow (needs a normal light to make anything visible.)"}, + {WO_AOADDSUB, "BOTH", "Both", "Both lighten and darken."}, + {0, NULL, NULL, NULL}}; + + static EnumPropertyItem prop_color_items[] = { + {WO_AOPLAIN, "PLAIN", "White", "Plain diffuse energy (white.)"}, + {WO_AOSKYCOL, "SKY_COLOR", "Sky Color", "Use horizon and zenith color for diffuse energy."}, + {WO_AOSKYTEX, "SKY_TEXTURE", "Sky Texture", "Does full Sky texture render for diffuse energy."}, + {0, NULL, NULL, NULL}}; + + static EnumPropertyItem prop_sample_method_items[] = { + {WO_AOSAMP_CONSTANT, "CONSTANT_JITTERED", "Constant Jittered", ""}, + {WO_AOSAMP_HALTON, "ADAPTIVE_QMC", "Adaptive QMC", "Fast in high-contrast areas."}, + {WO_AOSAMP_HAMMERSLEY, "ADAPTIVE_QMC", "Constant QMC", "Best quality."}, + {0, NULL, NULL, NULL}}; + + static EnumPropertyItem prop_gather_method_items[] = { + {WO_AOGATHER_RAYTRACE, "RAYTRACE", "Raytrace", "Accurate, but slow when noise-free results are required."}, + {WO_AOGATHER_APPROX, "APPROXIMATE", "Approximate", "Inaccurate, but faster and without noise."}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "WorldAmbientOcclusion", NULL); + RNA_def_struct_sdna(srna, "World"); + RNA_def_struct_ui_text(srna, "Ambient Occlusion", "DOC_BROKEN"); + + prop= RNA_def_property(parent, "ambient_occlusion", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "WorldAmbientOcclusion"); + RNA_def_property_pointer_funcs(prop, "rna_World_ambient_occlusion_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Ambient Occlusion", ""); + + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "aodist"); + RNA_def_property_range(prop, 0.001, 5000); + RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect."); + + prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "aodistfac"); + RNA_def_property_range(prop, 0.00001, 10); + RNA_def_property_ui_text(prop, "Strength", "Distance attenuation factor, the higher, the 'shorter' the shadows."); + + prop= RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "aoenergy"); + RNA_def_property_range(prop, 0.01, 3); + RNA_def_property_ui_text(prop, "Energy", "Global energy scale for ambient occlusion."); + + prop= RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "aobias"); + RNA_def_property_range(prop, 0, 0.5); + RNA_def_property_ui_text(prop, "Bias", "Bias (in radians) to prevent smoothed faces from showing banding."); + + prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ao_adapt_thresh"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Threshold", "Samples below this threshold will be considered fully shadowed/unshadowed and skipped."); + + prop= RNA_def_property(srna, "adapt_to_speed", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ao_adapt_speed_fac"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Adapt To Speed", "Use the speed vector pass to reduce AO samples in fast moving pixels. Higher values result in more aggressive sample reduction. Requires Vec pass enabled."); + + prop= RNA_def_property(srna, "error_tolerance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ao_approx_error"); + RNA_def_property_range(prop, 0.0001, 1); + RNA_def_property_ui_text(prop, "Error Tolerance", "Low values are slower and higher quality."); + + prop= RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ao_approx_correction"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Correction", "Ad-hoc correction for over-occlusion due to the approximation."); + + prop= RNA_def_property(srna, "falloff", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AODIST); + RNA_def_property_ui_text(prop, "Falloff", ""); + + prop= RNA_def_property(srna, "pixel_cache", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AOCACHE); + RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighbouring pixels for speedup."); + + prop= RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "aosamp"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Samples", ""); + + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "aomix"); + RNA_def_property_enum_items(prop, prop_mode_items); + RNA_def_property_ui_text(prop, "Mode", ""); + + prop= RNA_def_property(srna, "color", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "aocolor"); + RNA_def_property_enum_items(prop, prop_color_items); + RNA_def_property_ui_text(prop, "Color", ""); + + prop= RNA_def_property(srna, "sample_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ao_samp_method"); + RNA_def_property_enum_items(prop, prop_sample_method_items); + RNA_def_property_ui_text(prop, "Sample Method", "Method for generating shadow samples."); + + prop= RNA_def_property(srna, "gather_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ao_gather_method"); + RNA_def_property_enum_items(prop, prop_gather_method_items); + RNA_def_property_ui_text(prop, "Gather Method", ""); + + prop= RNA_def_property(srna, "passes", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "ao_approx_passes"); + RNA_def_property_range(prop, 0, 10); + RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion."); +} + void RNA_def_world(BlenderRNA *brna) { StructRNA *srna; @@ -57,6 +178,8 @@ void RNA_def_world(BlenderRNA *brna) rna_def_ipo_common(srna); + rna_def_ambient_occlusion(brna, srna); + /* prop= RNA_def_property(srna, "mtex", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "MTex"); |