Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-11 18:43:31 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-11 18:43:31 +0300
commitd98603129ca30aabe29f17f28f4ac72dbc0ca4ac (patch)
tree0216329ae9aaba7706eedc1f8aa25a35107aa16e /source
parent4746fbd8ce9edf4c898fb690ffff0c664636d769 (diff)
Added an option "Cast Approximate" to control if a material should cast
shadow when using approximate AO, separate from "Traceable".
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/makesdna/DNA_material_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_material.c5
-rw-r--r--source/blender/render/intern/source/occlusion.c9
6 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 666ecf7d65d..c101b887017 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -43,7 +43,7 @@ struct bContext;
struct ReportList;
#define BLENDER_VERSION 250
-#define BLENDER_SUBVERSION 16
+#define BLENDER_SUBVERSION 17
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 038ce6c5d25..9c56699fa1d 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -188,7 +188,7 @@ void init_material(Material *ma)
ma->vol.ms_diff = 1.f;
ma->vol.ms_intensity = 1.f;
- ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RAYBIAS|MA_TANGENT_STR|MA_ZTRANSP;
+ ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RAYBIAS|MA_TANGENT_STR|MA_ZTRANSP|MA_APPROX_OCCLUSION;
ma->preview = NULL;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index af9df4b00ba..175851266ed 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10563,10 +10563,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- /* put 2.50 compatibility code here until next subversion bump */
- {
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 17)) {
Scene *sce;
Sequence *seq;
+ Material *ma;
/* initialize to sane default so toggling on border shows something */
for(sce = main->scene.first; sce; sce = sce->id.next) {
@@ -10587,6 +10587,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
SEQ_END
}
+ for(ma = main->mat.first; ma; ma=ma->id.next)
+ if(ma->mode & MA_TRACEBLE)
+ ma->shade_flag |= MA_APPROX_OCCLUSION;
+
/* sequencer changes */
{
bScreen *screen;
@@ -10621,6 +10625,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} /* sequencer changes */
}
+ /* put 2.50 compatibility code here until next subversion bump */
+ {
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 7a19262b0cd..d41c286a93f 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -234,6 +234,7 @@ typedef struct Material {
/* shade_flag */
#define MA_CUBIC 1
#define MA_OBCOLOR 2
+#define MA_APPROX_OCCLUSION 4
/* diff_shader */
#define MA_DIFF_LAMBERT 0
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 0cfe44c1be6..089f9416753 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1648,6 +1648,11 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADBUF);
RNA_def_property_ui_text(prop, "Cast Buffer Shadows", "Allow this material to cast shadows from shadow buffer lamps");
RNA_def_property_update(prop, 0, "rna_Material_update");
+
+ prop= RNA_def_property(srna, "cast_approximate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_APPROX_OCCLUSION);
+ RNA_def_property_ui_text(prop, "Cast Approximate", "Allow this material to cast shadows when using approximate ambient occlusion.");
+ RNA_def_property_update(prop, 0, "rna_Material_update");
prop= RNA_def_property(srna, "tangent_shading", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_V);
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index d06339f75cc..3f825613d12 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -629,6 +629,7 @@ static OcclusionTree *occ_tree_build(Render *re)
OcclusionTree *tree;
ObjectInstanceRen *obi;
ObjectRen *obr;
+ Material *ma;
VlakRen *vlr= NULL;
int a, b, c, totface;
@@ -640,7 +641,9 @@ static OcclusionTree *occ_tree_build(Render *re)
if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
- if((vlr->mat->mode & MA_TRACEBLE) && (vlr->mat->material_type == MA_TYPE_SURFACE))
+ ma= vlr->mat;
+
+ if((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE))
totface++;
}
}
@@ -677,7 +680,9 @@ static OcclusionTree *occ_tree_build(Render *re)
if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
else vlr++;
- if((vlr->mat->mode & MA_TRACEBLE) && (vlr->mat->material_type == MA_TYPE_SURFACE)) {
+ ma= vlr->mat;
+
+ if((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE)) {
tree->face[b].obi= c;
tree->face[b].facenr= a;
tree->occlusion[b]= 1.0f;