diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2008-11-28 19:00:50 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2008-11-28 19:00:50 +0300 |
commit | 001f9558a310ed05671ce7324ac02de410279259 (patch) | |
tree | b88a1f165c169b0b09c1a2878b28a11d475412f9 | |
parent | c8098f953d5f6fa18a00d49d0577a72706b43b89 (diff) |
* add diffuse shader properties for material
-rw-r--r-- | source/blender/makesdna/DNA_material_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 40 |
2 files changed, 41 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 706ee748585..d2bb93162d0 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -96,7 +96,9 @@ typedef struct Material { /* shaders */ short diff_shader, spec_shader; float roughness, refrac; - float param[4]; /* size, smooth, size, smooth, for toonshader */ + /* XXX param[4] needs review and improvement (shader system as whole anyway) + This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */ + float param[4]; /* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */ float rms; float darkness; short texco, mapto; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 947ffc1d8ba..aa1030fef31 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -42,14 +42,22 @@ void RNA_def_material(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {MA_RGB, "RGB", "RGB", ""}, - {MA_CMYK, "CMYK", "CMYK", ""}, - {MA_YUV, "YUV", "YUV", ""}, + /*{MA_CMYK, "CMYK", "CMYK", ""}, + {MA_YUV, "YUV", "YUV", ""}, XXX: blender code doesn't support this yet. Commented out */ {MA_HSV, "HSV", "HSV", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem prop_fadeto_mir_items[] = { {MA_RAYMIR_FADETOSKY, "RAYMIR_FADETOSKY", "Fade to sky color", ""}, {MA_RAYMIR_FADETOMAT, "RAYMIR_FADETOMAT", "Fade to material color", ""}, {0, NULL, NULL, NULL}}; + static EnumPropertyItem prop_diff_shader_items[] = { + {MA_DIFF_LAMBERT, "DIFF_LAMBERT", "Lambert", ""}, + {MA_DIFF_ORENNAYAR, "DIFF_ORENNAYAR", "Orennayar", ""}, + {MA_DIFF_TOON, "DIFF_TOON", "Toon", ""}, + {MA_DIFF_MINNAERT, "DIFF_MINNAERT", "Minnaert", ""}, + {MA_DIFF_FRESNEL, "DIFF_FRESNEL", "Fresnel", ""}, + {0, NULL, NULL, NULL}}; + srna= RNA_def_struct(brna, "Material", "ID", "Material"); @@ -82,6 +90,34 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Ambient Color", "Ambient color."); RNA_def_property_ui_range(prop, 0.0f , 1.0f, 10.0f, 3.0f); + prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Alpha", "Alpha"); + + /* diffuse shaders */ + + prop= RNA_def_property(srna, "diff_shader", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_diff_shader_items); + RNA_def_property_ui_text(prop, "Diffuse Shader Model", "Diffuse shader model."); + + prop= RNA_def_property(srna, "ref", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Reflection", "Sets the amount of reflection."); + + prop= RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 3.14f); + RNA_def_property_ui_text(prop, "Roughness", "Sets Oren Nayar Roughness"); + + prop= RNA_def_property(srna, "params1_4", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "param"); + RNA_def_property_array(prop, 4); + RNA_def_property_range(prop, 0.0f, 5.0f); + RNA_def_property_ui_text(prop, "Params 1-4", "Parameters used for diffuse and specular Toon, and diffuse Fresnel shaders. Check documentation for details."); + + prop= RNA_def_property(srna, "darkness", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 2.0f); + RNA_def_property_ui_text(prop, "Darkness", "Sets Minnaert darkness."); + /* raytrace mirror */ prop= RNA_def_property(srna, "mode_ray_mirror", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYMIRROR); /* use bitflags */ |