[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11544] branches/soc-2007-mosani/source/ blender/render: The saving and drawing of the combined pass is working now.

Aaron Moore two.a.ron at gmail.com
Sat Aug 11 04:09:50 CEST 2007


Revision: 11544
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11544
Author:   mosani
Date:     2007-08-11 04:08:34 +0200 (Sat, 11 Aug 2007)

Log Message:
-----------
The saving and drawing of the combined pass is working now.

It is now possible to render a cube with the render api
 and blender internal renderer. Currently osa, and multiple
 parts and multiple passes aren't working, but these should
 come quickly given that a correct, albiet basic, render is
 happening.

Modified Paths:
--------------
    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/RND_types.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_internal.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_pass.c

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-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-08-11 02:08:34 UTC (rev 11544)
@@ -1469,14 +1469,6 @@
 				
 				if(pa->result) {
 					if(render_display_draw_enabled(re)){
-						/*
-						bounds[0] = pa->disprect.xmin;
-						bounds[1] = pa->disprect.xmax;
-						bounds[2] = pa->disprect.ymin;
-						bounds[3] = pa->disprect.ymax;
-						pass->result->pushedresult = pa->result;
-						pass->result->scene->render = re;
-						RND_pass_send_data( pass, bounds, pa->result->renlay );*/
 						re->display_draw(pa->result, NULL);
 					}
 					print_part_stats(re, pa);
@@ -1491,14 +1483,6 @@
 				rendering= 1;
 				if(pa->nr && pa->result && drawtimer>20) {
 					if(render_display_draw_enabled(re)){
-						/*
-						bounds[0] = pa->result->renrect.xmin;
-						bounds[1] = pa->result->renrect.xmax;
-						bounds[2] = pa->result->renrect.ymin;
-						bounds[3] = pa->result->renrect.ymax;
-						pass->result->destination = pa->result;
-						pass->result->scene->render = re;
-						RND_pass_send_data( pass, bounds, pa->result->renlay );*/
 						re->display_draw(pa->result, &pa->result->renrect);
 					}
 					hasdrawn= 1;

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c	2007-08-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c	2007-08-11 02:08:34 UTC (rev 11544)
@@ -403,8 +403,7 @@
 			bounds[1] = part->disprect.xmax;
 			bounds[2] = part->disprect.ymin;
 			bounds[3] = part->disprect.ymax;
-			//result->scene->render->display_draw(result->destination, NULL);
-			//RND_pass_send_data( pass, bounds, part->result->renlay->rectf );
+			RND_pass_send_data( pass, bounds, part->result->renlay->rectf );
 		}
 }
 

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-08-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-08-11 02:08:34 UTC (rev 11544)
@@ -210,8 +210,8 @@
 	struct RenderAPIPassHolder *next, *prev;
 	struct RenderAPIResult *result;
 	
+	unsigned int type;
 	float *buffer;
-	struct RenderPass *destination;
 }RenderAPIPassHolder;
 
 #endif

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h	2007-08-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h	2007-08-11 02:08:34 UTC (rev 11544)
@@ -81,11 +81,14 @@
 
 void RenderAPI_empty_list( ListBase *list );
 
-/* scan scene->source, fill object holder lists with all objects that will
+/* scan scene->render->scene, fill object holder lists with all objects that will
  * participate in this render job. Simultaneously, index by type and instance
  * status */
 void RenderAPI_create_object_indexes( RNDScene scene );
 
+/* examines the passes on each render layer and creates the result->pass list */
+void RenderAPI_create_passes( RNDResult result );
+
 /* return true if base is a rendered object */
 int RenderAPI_is_rendered( Base *base );
 

Modified: branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c	2007-08-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c	2007-08-11 02:08:34 UTC (rev 11544)
@@ -108,6 +108,17 @@
 		&scene->geometry_particle_system );
 }
 
+void RenderAPI_create_passes( RNDResult result )
+{
+	RenderAPIPassHolder *holder = MEM_mallocN( sizeof(RenderAPIPassHolder), 
+		"renderAPI pass holder" );
+	
+	holder->result = result;
+	holder->type = RND_PASS_RGBA;
+	holder->buffer = ((RenderLayer*)result->render->result->layers.first)->rectf;
+	BLI_addtail( &result->passes, holder );
+}
+
 int RenderAPI_is_rendered( Base *base )
 {
 	return 1;

Modified: branches/soc-2007-mosani/source/blender/render/render_api/source/RND_internal.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/source/RND_internal.c	2007-08-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_internal.c	2007-08-11 02:08:34 UTC (rev 11544)
@@ -48,10 +48,7 @@
 
 /* helper prototypes */
 static RenderResult *new_render_result( Render *re, rcti *partrct, 
-		int crop, int savebuffers );
-static void RND_render_layer_add_pass( RNDResult result, struct RenderLayer *rl, 
-                                       int channels, int passtype );
-static char *get_pass_name( int passtype, int channel );
+		int crop, int savebuffers );
 
 void RenderAPI_load_plugins( char renderer_menu[], char force_refresh ){
 	static char done = 0;
@@ -180,14 +177,18 @@
 	result->render = render;
 	RenderAPI_empty_list( &result->passes );
 	RenderAPI_empty_list( &result->pass_handlers );
+	
 	render->result = new_render_result( render, &render->disprect, 0, 
 		render->r.scemode & R_EXR_TILE_FILE );
 	
+	RenderAPI_create_passes( result );
+	
 	return result;
 }
 
 void RenderAPI_free_result( RNDResult result )
 {
+	BLI_freelistN( &result->passes );
 	RE_FreeRenderResult( result->render->result );
 	MEM_freeN( result );
 }
@@ -335,135 +336,3 @@
 	return rr;
 }
 
-void RND_render_layer_add_pass( RNDResult result, struct RenderLayer *rl, 
-                            int channels, int passtype )
-{
-	char *typestr= get_pass_name(passtype, 0);
-	RenderPass *rpass= MEM_callocN(sizeof(RenderPass), typestr);
-	RenderAPIPassHolder *pass = MEM_callocN(sizeof(RenderAPIPassHolder), 
-		"render api pass holder");
-	pass->buffer = rpass->rect;
-	pass->result = result;
-	pass->destination = rpass;
-	
-	int rectsize= result->render->result->rectx * 
-	              result->render->result->recty * channels;
-	
-	rpass->passtype= passtype;
-	rpass->channels= channels;
-	
-	if(result->render->result->exrhandle) {
-		int a;
-		for(a=0; a<channels; a++)
-			IMB_exr_add_channel(result->render->result->exrhandle, 
-				rl->name, get_pass_name(passtype, a), 0, 0, NULL);
-	}
-	else {
-		if(passtype==SCE_PASS_VECTOR) {
-			float *rect;
-			int x;
-			
-			/* initialize to max speed */
-			rect= rpass->rect= MEM_mapallocN(sizeof(float)*rectsize, typestr);
-			for(x= rectsize-1; x>=0; x--)
-				rect[x]= PASS_VECTOR_MAX;
-		}
-		else
-			rpass->rect= MEM_mapallocN(sizeof(float)*rectsize, typestr);
-	}
-	
-	/* add pass */
-	BLI_addtail(&rl->passes, rpass);
-	BLI_addtail(&result->passes, pass);
-}
-
-/* NOTE: OpenEXR only supports 32 chars for layer+pass names
-   In blender we now use max 10 chars for pass, max 20 for layer */
-static char *get_pass_name(int passtype, int channel)
-{
-	if(passtype == SCE_PASS_COMBINED) {
-		if(channel==-1) return "Combined";
-		if(channel==0) return "Combined.R";
-		if(channel==1) return "Combined.G";
-		if(channel==2) return "Combined.B";
-		return "Combined.A";
-	}
-	if(passtype == SCE_PASS_Z) {
-		if(channel==-1) return "Depth";
-		return "Depth.Z";
-	}
-	if(passtype == SCE_PASS_VECTOR) {
-		if(channel==-1) return "Vector";
-		if(channel==0) return "Vector.X";
-		if(channel==1) return "Vector.Y";
-		if(channel==2) return "Vector.Z";
-		return "Vector.W";
-	}
-	if(passtype == SCE_PASS_NORMAL) {
-		if(channel==-1) return "Normal";
-		if(channel==0) return "Normal.X";
-		if(channel==1) return "Normal.Y";
-		return "Normal.Z";
-	}
-	if(passtype == SCE_PASS_UV) {
-		if(channel==-1) return "UV";
-		if(channel==0) return "UV.U";
-		if(channel==1) return "UV.V";
-		return "UV.A";
-	}
-	if(passtype == SCE_PASS_RGBA) {
-		if(channel==-1) return "Color";
-		if(channel==0) return "Color.R";
-		if(channel==1) return "Color.G";
-		if(channel==2) return "Color.B";
-		return "Color.A";
-	}
-	if(passtype == SCE_PASS_DIFFUSE) {
-		if(channel==-1) return "Diffuse";
-		if(channel==0) return "Diffuse.R";
-		if(channel==1) return "Diffuse.G";
-		return "Diffuse.B";
-	}
-	if(passtype == SCE_PASS_SPEC) {
-		if(channel==-1) return "Spec";
-		if(channel==0) return "Spec.R";
-		if(channel==1) return "Spec.G";
-		return "Spec.B";
-	}
-	if(passtype == SCE_PASS_SHADOW) {
-		if(channel==-1) return "Shadow";
-		if(channel==0) return "Shadow.R";
-		if(channel==1) return "Shadow.G";
-		return "Shadow.B";
-	}
-	if(passtype == SCE_PASS_AO) {
-		if(channel==-1) return "AO";
-		if(channel==0) return "AO.R";
-		if(channel==1) return "AO.G";
-		return "AO.B";
-	}
-	if(passtype == SCE_PASS_REFLECT) {
-		if(channel==-1) return "Reflect";
-		if(channel==0) return "Reflect.R";
-		if(channel==1) return "Reflect.G";
-		return "Reflect.B";
-	}
-	if(passtype == SCE_PASS_REFRACT) {
-		if(channel==-1) return "Refract";
-		if(channel==0) return "Refract.R";
-		if(channel==1) return "Refract.G";
-		return "Refract.B";
-	}
-	if(passtype == SCE_PASS_RADIO) {
-		if(channel==-1) return "Radio";
-		if(channel==0) return "Radio.R";
-		if(channel==1) return "Radio.G";
-		return "Radio.B";
-	}
-	if(passtype == SCE_PASS_INDEXOB) {
-		if(channel==-1) return "IndexOB";
-		return "IndexOB.X";
-	}
-	return "Unknown";
-}
-

Modified: branches/soc-2007-mosani/source/blender/render/render_api/source/RND_pass.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/source/RND_pass.c	2007-08-10 23:33:13 UTC (rev 11543)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_pass.c	2007-08-11 02:08:34 UTC (rev 11544)
@@ -40,6 +40,8 @@
  */
 
 /* helper prototypes */
+static void do_merge_tile( RenderResult *rr, RenderResult *rrpart, 
+	float *target, float *tile, int pixsize );
 
 RNDPass RND_get_passes( RNDResult result )
 {
@@ -54,26 +56,7 @@
 
 RND_PASS_TYPE  RND_pass_get_type( RNDPass pass )
 {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list