[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42699] branches/ge_harmony: Adding a UI option to change the frustum size for the Sun shadows.
Daniel Stokes
kupomail at gmail.com
Sun Dec 18 01:12:26 CET 2011
Revision: 42699
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42699
Author: kupoman
Date: 2011-12-18 00:12:20 +0000 (Sun, 18 Dec 2011)
Log Message:
-----------
Adding a UI option to change the frustum size for the Sun shadows. This essentially changes the orthographic scale value and affects the size of the shadowed area.
Modified Paths:
--------------
branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py
branches/ge_harmony/source/blender/blenkernel/intern/lamp.c
branches/ge_harmony/source/blender/blenloader/intern/readfile.c
branches/ge_harmony/source/blender/gpu/intern/gpu_material.c
branches/ge_harmony/source/blender/makesdna/DNA_lamp_types.h
branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c
Modified: branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py
===================================================================
--- branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py 2011-12-17 22:40:51 UTC (rev 42698)
+++ branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py 2011-12-18 00:12:20 UTC (rev 42699)
@@ -231,7 +231,11 @@
row.label("Clipping:")
row = layout.row(align=True)
row.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
- row.prop(lamp, "shadow_buffer_clip_end", text=" Clip End")
+ row.prop(lamp, "shadow_buffer_clip_end", text="Clip End")
+
+ if lamp.type == 'SUN':
+ row = layout.row()
+ row.prop(lamp, "frustum_size", text="Frustum Size")
layout.active = lamp.use_shadow
Modified: branches/ge_harmony/source/blender/blenkernel/intern/lamp.c
===================================================================
--- branches/ge_harmony/source/blender/blenkernel/intern/lamp.c 2011-12-17 22:40:51 UTC (rev 42698)
+++ branches/ge_harmony/source/blender/blenkernel/intern/lamp.c 2011-12-18 00:12:20 UTC (rev 42699)
@@ -96,6 +96,7 @@
la->skyblendfac= 1.0f;
la->sky_colorspace= BLI_XYZ_CIE;
la->sky_exposure= 1.0f;
+ la->sun_shadow_frustum= 10.0f;
curvemapping_initialize(la->curfalloff);
return la;
Modified: branches/ge_harmony/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/ge_harmony/source/blender/blenloader/intern/readfile.c 2011-12-17 22:40:51 UTC (rev 42698)
+++ branches/ge_harmony/source/blender/blenloader/intern/readfile.c 2011-12-18 00:12:20 UTC (rev 42699)
@@ -12667,7 +12667,11 @@
/* put compatibility code here until next subversion bump */
{
- /* nothing! */
+ Lamp *la;
+ for (la= main->lamp.first; la; la= la->id.next) {
+ if (la->type == LA_SUN)
+ la->sun_shadow_frustum= 10.0f;
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
Modified: branches/ge_harmony/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/ge_harmony/source/blender/gpu/intern/gpu_material.c 2011-12-17 22:40:51 UTC (rev 42698)
+++ branches/ge_harmony/source/blender/gpu/intern/gpu_material.c 2011-12-18 00:12:20 UTC (rev 42699)
@@ -1589,7 +1589,7 @@
/* makeshadowbuf */
if (lamp->type == LA_SUN) {
- wsize = 10;
+ wsize = la->sun_shadow_frustum;
orthographic_m4( lamp->winmat,-wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend);
}
else {
Modified: branches/ge_harmony/source/blender/makesdna/DNA_lamp_types.h
===================================================================
--- branches/ge_harmony/source/blender/makesdna/DNA_lamp_types.h 2011-12-17 22:40:51 UTC (rev 42698)
+++ branches/ge_harmony/source/blender/makesdna/DNA_lamp_types.h 2011-12-18 00:12:20 UTC (rev 42699)
@@ -95,8 +95,9 @@
float atm_distance_factor;
float skyblendfac;
float sky_exposure;
+ float sun_shadow_frustum;
short sky_colorspace;
- char pad4[6];
+ char pad4[2];
struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
struct MTex *mtex[18]; /* MAX_MTEX */
Modified: branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c
===================================================================
--- branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c 2011-12-17 22:40:51 UTC (rev 42698)
+++ branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c 2011-12-18 00:12:20 UTC (rev 42699)
@@ -853,6 +853,12 @@
rna_def_lamp_shadow(srna, 0, 0);
+ prop= RNA_def_property(srna, "frustum_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sun_shadow_frustum");
+ RNA_def_property_float_default(prop, 10.0);
+ RNA_def_property_ui_text(prop, "Frustum Size", "Size of the frustum used for creating the shadow map");
+ RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
+
/* sky */
prop= RNA_def_property(srna, "sky", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
More information about the Bf-blender-cvs
mailing list