[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11501] branches/soc-2007-mosani/source/ blender: I've begun working through the pipeline from the beginning

Aaron Moore two.a.ron at gmail.com
Mon Aug 6 10:14:01 CEST 2007


Revision: 11501
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11501
Author:   mosani
Date:     2007-08-06 10:13:59 +0200 (Mon, 06 Aug 2007)

Log Message:
-----------
I've begun working through the pipeline from the beginning
 verifying and fixing each component that I've been working on.

Changes:
 1. re-arranged the database initialization: filled the blender
  internal setup function. To some degree.
 2. fixed a few flaws in the setup and take-down of the database:
   a. allowed access to the context name, and brought context
    specific storage into affect in the internal renderer.
   b. fixed the freeing

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_renderapi.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
    branches/soc-2007-mosani/source/blender/render/intern/include/render_types.h
    branches/soc-2007-mosani/source/blender/render/intern/include/renderdatabase.h
    branches/soc-2007-mosani/source/blender/render/intern/source/RND_convertblender.c
    branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
    branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_context.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_settings.c

Added Paths:
-----------
    branches/soc-2007-mosani/source/blender/render/intern/source/RND_initrender.c

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_renderapi.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_renderapi.h	2007-08-06 07:13:34 UTC (rev 11500)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_renderapi.h	2007-08-06 08:13:59 UTC (rev 11501)
@@ -55,6 +55,7 @@
  */
 
 typedef struct plugin_api_rnd_core_v_1 {
+	char (*get_context_name)( RNDScene scene );
 	float (*get_current_frame)( RNDScene scene );
 	void (*set_current_frame)( RNDScene scene, float new_frame );
 	void (*set_frame_offset)( RNDScene scene, float offset );

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c	2007-08-06 07:13:34 UTC (rev 11500)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c	2007-08-06 08:13:59 UTC (rev 11501)
@@ -2202,6 +2202,7 @@
  */
 
 static struct plugin_api_rnd_core_v_1 api_rnd_core_v_1 = {
+	RND_get_context_name,
 	RND_get_current_frame,
 	RND_set_current_frame,
 	RND_set_frame_offset,

Modified: branches/soc-2007-mosani/source/blender/render/intern/include/render_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/include/render_types.h	2007-08-06 07:13:34 UTC (rev 11500)
+++ branches/soc-2007-mosani/source/blender/render/intern/include/render_types.h	2007-08-06 08:13:59 UTC (rev 11501)
@@ -208,7 +208,7 @@
 	RNDResult api_result;
 	void (*setup)( RNDScene scene );
 	void (*render_frame)( RNDScene scene, RNDResult result );
-	void (*finish)();
+	void (*finish)( RNDScene scene );
 	char axis[3];
 };
 

Modified: branches/soc-2007-mosani/source/blender/render/intern/include/renderdatabase.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/include/renderdatabase.h	2007-08-06 07:13:34 UTC (rev 11500)
+++ branches/soc-2007-mosani/source/blender/render/intern/include/renderdatabase.h	2007-08-06 08:13:59 UTC (rev 11501)
@@ -71,6 +71,7 @@
 
 typedef struct RenderDatabase{
 	struct RenderDatabase *next, *prev;
+	char name[RE_MAXNAME];
 	
 	/* state settings */
 	short flag, osa, ok, do_gamma;
@@ -202,12 +203,22 @@
  *    from a Scene structure
  */
 
+
+/**** Defined in RND_initrender.c, (mostly render job setup) ****/
+
+/* Stores the database on the global list for later retrieval */
+RenderDatabase *render_database_initialize( RNDScene scene );
+void render_database_destroy( RenderDatabase *db );
+
+/* Finds the database on the global list */
+RenderDatabase *render_database_find( char *name );
+
+/**** Defined in RND_convertblender.c (render frame setup) ****/
+
 void render_database_from_scene( RenderDatabase *db, RNDScene scene );
 void render_database_free( RenderDatabase *database );
 void render_database_add_lamp( RenderDatabase *database, RNDObject object );
 void render_database_insert_polygon_mesh( RenderDatabase *database, RNDObject object );
 
-void render_database_test_print( Render *render, RenderDatabase *database );
-
 #endif /* RENDERDATABASE_H */
 

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/RND_convertblender.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/RND_convertblender.c	2007-08-06 07:13:34 UTC (rev 11500)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/RND_convertblender.c	2007-08-06 08:13:59 UTC (rev 11501)
@@ -142,8 +142,10 @@
 	RNDObject object;
 	
 	/* empty database */
-	memset( db, 0, sizeof(RenderDatabase) );
 	db->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+	db->totvlak = db->totvert = db->totlamp = db->tothalo = 0;
+	db->lights.first = db->lights.last = NULL;
+	db->lampren.first = db->lampren.last = NULL;
 	
 	/* loop through all objects */
 	object = RND_get_objects( scene, RND_ALL );
@@ -161,22 +163,6 @@
 		}
 	}
 	
-	/* set render settings */
-	db->winx = RND_get_image_width( scene );
-	db->winy = RND_get_image_height( scene );
-	
-	db->disprect.xmin = 0;
-	db->disprect.ymin = 0;
-	db->disprect.xmax = RND_get_image_width( scene );
-	db->disprect.ymax = RND_get_image_height( scene );
-	
-	db->rectx = RND_get_image_width( scene );
-	db->recty = RND_get_image_height( scene );
-	
-	/* fill RenderData */
-	db->r.osa = RND_get_pixel_filter_sample_number( scene );
-	db->osa = db->r.osa;
-	
 	/* initialize parts */
 	render_database_initialize_parts( db, scene );
 }

Added: branches/soc-2007-mosani/source/blender/render/intern/source/RND_initrender.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/RND_initrender.c	                        (rev 0)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/RND_initrender.c	2007-08-06 08:13:59 UTC (rev 11501)
@@ -0,0 +1,185 @@
+/*
+ * RND_initrender.c
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation
+ *
+ * Contributor(s): Aaron Moore (mosani)
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/* Global includes */
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "PIL_time.h"
+
+#include "BLI_arithb.h"
+#include "BLI_blenlib.h"
+#include "BLI_jitter.h"
+
+#include "MTC_matrixops.h"
+
+#include "DNA_camera_types.h"
+#include "DNA_group_types.h"
+#include "DNA_image_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_utildefines.h"
+#include "BKE_global.h"
+#include "BKE_material.h"
+#include "BKE_object.h"
+#include "BKE_image.h"
+#include "BKE_ipo.h"
+#include "BKE_key.h"
+#include "BKE_action.h"
+#include "BKE_writeavi.h"
+#include "BKE_scene.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#ifdef WITH_QUICKTIME
+#include "quicktime_export.h"
+#endif
+
+/* this module */
+#include "renderpipeline.h"
+#include "render_types.h"
+
+#include "rendercore.h"
+#include "pixelshading.h"
+#include "zbuf.h"
+
+/* Own includes */
+#include "renderdatabase.h"
+
+/**
+ * @file RND_initrender.c
+ *
+ * Initializing the render database at the beginning of a render job, 
+ * and destroying the render database at the end of a render job.
+ */
+
+/* helper prototypes */
+static void render_database_initialize_jitter( RenderDatabase *db );
+static void render_database_make_sample_tables( RenderDatabase *db );
+static void render_database_free_sample_tables( RenderDatabase *db );
+
+/* here we store all render databases */
+static struct ListBase RDB_LIST = {NULL, NULL};
+
+RenderDatabase *render_database_initialize( RNDScene scene )
+{
+	RenderDatabase *db = NULL;
+	
+	/**** new RenderDatabase ****/
+	
+	db = MEM_callocN( sizeof(RenderDatabase), "new render database" );
+	BLI_addtail( &RDB_LIST, db );
+	strncpy( db->name, RND_get_context_name(scene), RE_MAXNAME );
+	
+	db->ok= TRUE;	/* maybe flag */
+	
+	/**** initialize rasterization properties ****/
+		
+	/* always call, checks for gamma, gamma tables and jitter too */
+	render_database_make_sample_tables( db );
+	
+	/* set render settings */
+	db->winx = RND_get_image_width( scene );
+	db->winy = RND_get_image_height( scene );
+	
+	db->disprect.xmin = 0;
+	db->disprect.ymin = 0;
+	db->disprect.xmax = RND_get_image_width( scene );
+	db->disprect.ymax = RND_get_image_height( scene );
+	
+	db->rectx = RND_get_image_width( scene );
+	db->recty = RND_get_image_height( scene );
+	
+	/* we clip faces with a minimum of 2 pixel boundary 
+	 * outside of image border. see zbuf.c */
+	db->clipcrop = 
+		1.0f + 2.0f/(float)( db->winx > db->winy ? db->winy : db->winx );
+	
+	/* fill RenderData */
+	db->osa = db->r.osa = RND_get_pixel_filter_sample_number( scene );
+	db->osa = db->r.osa;
+	
+	return db;
+}
+
+RenderDatabase *render_database_find( char *name )
+{
+	RenderDatabase *database;
+	
+	/* search for existing render databases */
+	for( database = RDB_LIST.first; database; database = database->next ) {
+		if( strncmp( database->name, name, RE_MAXNAME ) == 0 )
+			break;
+	}
+	return database;
+}
+
+void render_database_destroy( RenderDatabase *db )
+{
+	MEM_freeN( db );
+}
+
+/**** Helper Functions ****/
+
+static void render_database_initialize_jitter( RenderDatabase *db )
+{
+	
+}
+
+static void render_database_make_sample_tables( RenderDatabase *db )
+{
+	static int firsttime= 1;
+	SampleTables *st;
+	float flweight[32], fmask[256];
+	float weight[32], totw, val, *fpx1, *fpx2, *fpy1, *fpy2, *m3, *m4;
+	int i, j, a;
+
+	/* optimization tables, only once */
+	if(firsttime) {
+		firsttime= 0;
+	}
+	
+	render_database_free_sample_tables( db );
+	
+	render_database_initialize_jitter( db );	/* needed for mblur too */
+}
+
+static void render_database_free_sample_tables( RenderDatabase *db )
+{
+	
+}
+

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-08-06 07:13:34 UTC (rev 11500)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-08-06 08:13:59 UTC (rev 11501)
@@ -2188,7 +2188,7 @@
 		/**** Initialize Render Context ****/
 		
 		/* r.xsch and r.ysch has the actual view window size
-		r.border is the clipping rect */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list