[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20794] branches/soc-2009-yukishiro/source /blender: write and load light env

Jingyuan Huang jingyuan.huang at gmail.com
Wed Jun 10 22:07:21 CEST 2009


Revision: 20794
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20794
Author:   yukishiro
Date:     2009-06-10 22:07:21 +0200 (Wed, 10 Jun 2009)

Log Message:
-----------
write and load light env

Modified Paths:
--------------
    branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c
    branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c
    branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2009-yukishiro/source/blender/makesdna/intern/makesdna.c
    branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/intern/lightenv.c	2009-06-10 20:07:21 UTC (rev 20794)
@@ -49,9 +49,7 @@
 
 #include "SH_api.h"
 
-//LightEnv deflightenv;
 
-
 // TODO: simple function to return value for 3 channels. needs improvement
 void def_synthetic(float theta, float phi, float val[3], void *data)
 {
@@ -78,7 +76,7 @@
 {
         env->probe_image = BKE_add_image_file(image_name, 0);
         env->type = LE_PROBE;
-        env->func = probe_value;
+        env->light_func = probe_value;
         SH_ComputeLightCoefficients(env);
 }
 
@@ -90,13 +88,6 @@
         IMB_freeImBuf(ibuf);
 }
 
-///* called on startup, in SH_init() */
-//void init_def_lightenv(void)
-//{
-//        deflightenv.type = LE_DEFAULT;
-//        deflightenv.func = def_synthetic;
-//        SH_ComputeLightCoefficients(&deflightenv);
-//}
 
 void free_lightenv(LightEnv *env)
 {
@@ -109,7 +100,7 @@
 
 	env= alloc_libblock(&G.main->lightenv, ID_LE, name);
         env->type = LE_DEFAULT;
-        env->func = def_synthetic;
+        env->light_func = def_synthetic;
         SH_ComputeLightCoefficients(env);
 
         return env;

Modified: branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c	2009-06-10 20:07:21 UTC (rev 20794)
@@ -3952,6 +3952,12 @@
 
 		if(sce->toolsettings->sculpt)
 			sce->toolsettings->sculpt->session= MEM_callocN(sizeof(SculptSession), "reload sculpt session");
+
+                // TODO: lpaint_data shouldn't be written to file
+		if(sce->toolsettings->lpaint) {
+                        sce->toolsettings->lpaint->lpaint_data.first= NULL;
+                        sce->toolsettings->lpaint->lpaint_data.last= NULL;
+                }
 	}
 
 	if(sce->ed) {
@@ -10017,6 +10023,7 @@
 	}
 	expand_doit(fd, mainvar, sce->camera);
 	expand_doit(fd, mainvar, sce->world);
+        expand_doit(fd, mainvar, sce->lightenv);
 	
 	if(sce->adt)
 		expand_animdata(fd, mainvar, sce->adt);

Modified: branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c	2009-06-10 20:07:21 UTC (rev 20794)
@@ -2228,6 +2228,7 @@
 	write_scripts  (wd, &mainvar->script);
 	write_gpencils (wd, &mainvar->gpencil);
         write_lightenvs(wd, &mainvar->lightenv);
+
 	if(current==NULL)	
 		write_libraries(wd,  mainvar->next); /* no library save in undo */
 

Modified: branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h	2009-06-10 20:07:21 UTC (rev 20794)
@@ -36,7 +36,7 @@
 #include "DNA_image_types.h"
 #include "DNA_scriptlink_types.h"
 
-typedef void (*light_func)(float i1, float i2, float val[3], void *data);
+//typedef void (*light_func)(float i1, float i2, float val[3], void *data);
 
 typedef struct LightEnv {
         ID id;
@@ -44,7 +44,8 @@
         short flag, type;
         float shcoeffs[25][3];
 
-        light_func func;
+        //light_func func;
+        void (*light_func)(float i1, float i2, float val[3], void *data);
         struct Image *probe_image; // image has preview
         struct PreviewImage *preview;
 	ScriptLink scriptlink;

Modified: branches/soc-2009-yukishiro/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesdna/DNA_scene_types.h	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/makesdna/DNA_scene_types.h	2009-06-10 20:07:21 UTC (rev 20794)
@@ -420,7 +420,7 @@
 	struct MDeformVert *wpaint_prev;	/* previous vertex weights */
 	
 	void *paintcursor;					/* wm handle */
-        ListBase lpaint_data;                   /* paint strokes used for light paint */
+        ListBase lpaint_data;                   /* paint strokes used for light paint */ // TODO: shouldn't be written to file. change to pointer type?
 } VPaint;
 
 typedef struct PaintStroke {
@@ -446,7 +446,7 @@
 typedef struct ToolSettings {
 	VPaint *vpaint;		/* vertex paint */
 	VPaint *wpaint;		/* weight paint */
-        VPaint *lpaint;
+        VPaint *lpaint;         /* light paint */
 	Sculpt *sculpt;
 	
 	/* Subdivide Settings */

Modified: branches/soc-2009-yukishiro/source/blender/makesdna/intern/makesdna.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesdna/intern/makesdna.c	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/makesdna/intern/makesdna.c	2009-06-10 20:07:21 UTC (rev 20794)
@@ -1156,4 +1156,5 @@
 #include "DNA_gpencil_types.h"
 #include "DNA_windowmanager_types.h"
 #include "DNA_anim_types.h"
+#include "DNA_lightenv_types.h"
 /* end of list */

Modified: branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-06-10 19:57:06 UTC (rev 20793)
+++ branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-06-10 20:07:21 UTC (rev 20794)
@@ -310,7 +310,7 @@
                 for (k = 0; k < NUM_SAMPLES; k++) {
                         phi = sample_angles[k][0];
                         theta = sample_angles[k][1];
-                        env->func(phi, theta, l_val, NULL);
+                        env->light_func(phi, theta, l_val, NULL);
 
                         y_val = *(samples_Y[k]);
                         for (m = 0; m < num_sh; m++) {
@@ -342,7 +342,7 @@
 
                                 compute_Y(pnt, Y);
                                 d_omega = dA * sinc(theta);
-                                env->func(i, j, l_val, ibuf);
+                                env->light_func(i, j, l_val, ibuf);
 
                                 y_val = *Y;
                                 for (m = 0; m < num_sh; m++) {





More information about the Bf-blender-cvs mailing list