[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11451] branches/soc-2007-mosani/source/ blender: This is the first of two commits which install the new

Aaron Moore two.a.ron at gmail.com
Wed Aug 1 05:06:37 CEST 2007


Revision: 11451
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11451
Author:   mosani
Date:     2007-08-01 05:06:29 +0200 (Wed, 01 Aug 2007)

Log Message:
-----------
This is the first of two commits which install the new
version of Peter Schlaile's new plugin api WIP, with a
few additions of my own.

Changes:
 1. added render api container structures
 2. registered these structures with the plugin api
 3. added import macros for importing these structures
 4. added extern macros for accessing them outside the
    main source file of a plugin

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/radiosity/SConscript
    branches/soc-2007-mosani/source/blender/render/intern/source/RND_converblender.c
    branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c
    branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis.c
    branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis_helpers.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_camera.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_context.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_geometry.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_light.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_mesh.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_object.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_pass.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_settings.c
    branches/soc-2007-mosani/source/blender/src/SConscript

Removed Paths:
-------------
    branches/soc-2007-mosani/source/blender/blenpluginapi/

Modified: branches/soc-2007-mosani/source/blender/radiosity/SConscript
===================================================================
--- branches/soc-2007-mosani/source/blender/radiosity/SConscript	2007-07-31 19:28:52 UTC (rev 11450)
+++ branches/soc-2007-mosani/source/blender/radiosity/SConscript	2007-08-01 03:06:29 UTC (rev 11451)
@@ -6,7 +6,6 @@
 incs = 'extern/include ../blenlib ../blenkernel ../makesdna ../include'
 incs += ' #/intern/guardedalloc ../render/extern/include'
 incs += ' ../render/intern/include ../render/render_api/include'
-incs += ' ../blenpluginapi'
 
 incs += ' ' + env['BF_OPENGL_INC']
 

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/RND_converblender.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/RND_converblender.c	2007-07-31 19:28:52 UTC (rev 11450)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/RND_converblender.c	2007-08-01 03:06:29 UTC (rev 11451)
@@ -148,6 +148,10 @@
 	db->lights.first = db->lights.last = NULL;        due to memset call all 
 	db->lampren.first = db->lampren.last = NULL;      of this does nothing */
 	
+	/* called here for the moment so that the linker will be
+	   able to find all the functions in RND_camera.c */
+	RND_is_perspective( scene );
+	
 	/* loop through all objects */
 	object = RND_get_objects( scene, RND_ALL );
 	for( ; RND_object_exists( object ); RND_object_next( object ) )
@@ -176,6 +180,9 @@
 	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 );
+	
 	/* initialize parts */
 	render_database_initialize_parts( db, scene );
 }

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c	2007-07-31 19:28:52 UTC (rev 11450)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c	2007-08-01 03:06:29 UTC (rev 11451)
@@ -97,6 +97,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "PIL_time.h"
+
 /* internal */
 #include "render_types.h"
 #include "renderdatabase.h"
@@ -112,6 +114,8 @@
 static void threaded_tile_processor( RenderDatabase *db, RNDScene scene, 
 	RNDResult result );
 static RenderPart *render_database_find_next_part( RenderDatabase *db, int minx );
+static int render_display_draw_enabled( RenderDatabase *db );
+static void send_image_results( RNDResult result, RenderPart *part );
 
 void blender_internal_setup( RNDScene scene )
 {
@@ -123,7 +127,7 @@
 	RenderDatabase db;
 	
 	render_database_from_scene( &db, scene );
-	threaded_tile_processor( &db, scene, result );
+	//threaded_tile_processor( &db, scene, result );
 	render_database_free( &db );
 }
 
@@ -142,8 +146,7 @@
 	
 	/* need to return nicely all parts on esc */
 	if( !RND_stop_render() ) {
-		pa->result= RND_new_render_result( &RDB.r, 
-			&global_image_bounds, &pa->disprect, pa->crop, RR_USEMEM );
+		//pa->result= 
 		
 		/*new_render_result(&R, &pa->disprect, pa->crop, RR_USEMEM);*/
 
@@ -229,27 +232,29 @@
 				BLI_remove_thread(&threads, pa);
 				
 				if(pa->result) {
-					/*
-					if(render_display_draw_enabled(re))
-						re->display_draw(pa->result, NULL);
-					print_part_stats(re, pa);
 					
+					if( render_display_draw_enabled( &RDB ) )
+						send_image_results( result, pa );
+					/*	re->display_draw(pa->result, NULL);
+						
+					print_part_stats(re, pa); stats: current API hole
+					re->i.partsdone++;
+					*/
 					RE_FreeRenderResult(pa->result);
 					pa->result= NULL;
-					re->i.partsdone++;
 					hasdrawn= 1;
-					*/
 				}
 			}
 			else {
-				/*
 				rendering= 1;
 				if(pa->nr && pa->result && drawtimer>20) {
-					if(render_display_draw_enabled(re))
-						re->display_draw(pa->result, &pa->result->renrect);
+				
+					if( render_display_draw_enabled( &RDB ) )
+						send_image_results( result, pa );
+					/* re->display_draw(pa->result, &pa->result->renrect);
+				*/
 					hasdrawn= 1;
 				}
-				*/
 			}
 		}
 		if(hasdrawn)
@@ -305,4 +310,22 @@
 	return best;
 }
 
+static int render_display_draw_enabled( RenderDatabase *db )
+{
+	/* don't show preprocess for previewrender sss */
+	if(db->sss_points)
+		return !(db->r.scemode & R_PREVIEWBUTS);
+	else
+		return 1;
+}
 
+static void send_image_results( RNDResult result, RenderPart *part )
+{
+	RNDPass pass;
+	pass = RND_get_passes( result );
+	for( ; RND_pass_exists( pass ); RND_pass_next( pass ) )
+		if( RND_pass_get_type( pass ) == RND_PASS_RGBA );
+}
+
+/* re->display_draw(pa->result, &pa->result->renrect); */
+

Modified: branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis.c	2007-07-31 19:28:52 UTC (rev 11450)
+++ branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis.c	2007-08-01 03:06:29 UTC (rev 11451)
@@ -1,11 +1,26 @@
-
 /* A test renderer plugin */
 
 #include <stdio.h>
-#include "plugin.h"
+#include "PLU_api.h"
 #include "RenderAPI.h"
 #include "aqsis_helpers.h"
 
+PLU_IMPORT_API(register)
+RND_IMPORT_FULL_API
+
+/* after you added the renderapi interface PLU_renderapi.h, you will need:
+
+
+   and also change every call of RND_something to PLU_renderapi->something
+
+or
+
+PLU_IMPORT_API(rnd_object)
+PLU_IMPORT_API(rnd_...)
+
+*/
+
+
 static void setup( RNDScene scene )
 {
 	FILE *aqsis_rib = fopen( "aqsis.rib", "w" );
@@ -18,6 +33,7 @@
 }
 static void render_frame( RNDScene scene, RNDResult result )
 {
+	
 	float light_coord[3];
 	RNDLight light;
 	
@@ -34,27 +50,28 @@
 	*/
 	
 	/* Export Lights */
-	RNDObject object = RND_get_objects( scene, RND_LIGHT );
-	for( ; RND_object_exists( object ); RND_object_next( object ) )
+	RNDObject object = RND->get_objects( scene, RND_LIGHT );
+	for( ; RND_object->exists( object ); RND_object->next( object ) )
 	{
-		if( RND_object_get_type( object ) == RND_LIGHT_POINT ){
+		if( RND_object->get_type( object ) == RND_LIGHT_POINT ){
 			fprintf( aqsis_rib, "\tLightSource \"pointlight\" 1 " );
-			RND_object_get_translation( object, light_coord );
+			RND_object->get_translation( object, light_coord );
 			fprintf( aqsis_rib, "\"from\" [%f %f %f] ",
 				light_coord[0],
 				light_coord[1],
 				light_coord[2] );
-			light = RND_object_get_light( object );
+			light = RND_object->get_light( object );
 			fprintf( aqsis_rib, "\"intensity\" %f\n", 
-				RND_light_get_intensity( light ) );
+				RND_light->get_intensity( light ) );
 		}
 	}
+
 	
 	/* Export Meshes */
-	object = RND_get_objects( scene, RND_GEOMETRY );
-	for( ; RND_object_exists( object ); RND_object_next( object ) )
+	object = RND->get_objects( scene, RND_GEOMETRY );
+	for( ; RND_object->exists( object ); RND_object->next( object ) )
 	{
-		if( RND_object_get_type( object ) == RND_GEOMETRY_POLYGON_MESH ){
+		if( RND_object->get_type( object ) == RND_GEOMETRY_POLYGON_MESH ){
 			fprintf( aqsis_rib, "\tAttributeBegin\n" );
 			fprintf( aqsis_rib, "\t\tSurface \"plastic\"\n" );
 			fprintf( aqsis_rib, "\t\tSides 2\n" );
@@ -68,10 +85,10 @@
 	fprintf( aqsis_rib, "FrameEnd\n" );
 	fclose( aqsis_rib );
 }
-static void finish()
+static void finish( RNDScene scene )
 {
-	/* FILE *aqsis_rib = fopen( "aqsis.rib", "a" );
-	fclose( aqsis_rib ); */
+	FILE *aqsis_rib = fopen( "aqsis.rib", "a" );
+	fclose( aqsis_rib );
 }
 
 plugin_instance_t* init( plugin_control_t *c ){ return NULL; }
@@ -79,17 +96,7 @@
 
 void plugin_query()
 {
-	plugin_interface_render_output_t registration;
-	/* callbacks */
-	registration.setup = setup;
-	registration.render_frame = render_frame;
-	registration.finish = finish;
-	/* axis */
-	registration.axis[0] = 'x';
-	registration.axis[1] = 'y';
-	registration.axis[2] = 'z';
-	
-	plugin_register_render_output(
+	PLU_register->render_output(
 		"Aqsis Plugin",
 		"Aqsis",
 		"mosani, and others?",
@@ -98,6 +105,6 @@
 		"14 July 2007",
 		0,
 		init, init, free_renderer,
-		registration );
+		setup, render_frame, finish );
 }
 

Modified: branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis_helpers.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis_helpers.h	2007-07-31 19:28:52 UTC (rev 11450)
+++ branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis_helpers.h	2007-08-01 03:06:29 UTC (rev 11451)
@@ -1,9 +1,11 @@
 
+RND_EXTERN_FULL_API
+
 void transform_object( RNDObject object, FILE *aqsis_rib )
 {
 	float transformation[4][4];
 	int i, j;
-	RND_object_get_transformation( object, transformation );
+	RND_object->get_transformation( object, transformation );
 	fprintf( aqsis_rib, "\t\tTransform [" );
 	
 	for( i = 0; i < 4; i++ ){
@@ -18,9 +20,9 @@
 void export_polygons( RNDObject object, FILE *aqsis_rib )
 {
 	/* handlers */
-	RNDGeometry geometry = RND_object_get_geometry( object );
-	RNDVertex vertex = RND_geometry_get_vertices( geometry );
-	RNDFace face = RND_geometry_get_faces( geometry );
+	RNDGeometry geometry = RND_object->get_geometry( object );
+	RNDVertex vertex = RND_geometry->get_vertices( geometry );
+	RNDFace face = RND_geometry->get_faces( geometry );
 	RNDIndex index;
 
 	/* counts */
@@ -29,28 +31,28 @@
 	fprintf( aqsis_rib, "\t\tPointsPolygons [" );
 	
 	/* export face counts */
-	for( ; RND_face_exists( face ); RND_face_next( face ) )
+	for( ; RND_face->exists( face ); RND_face->next( face ) )
 	{
-		fprintf( aqsis_rib, " %d", RND_face_get_index_count( face ) );
+		fprintf( aqsis_rib, " %d", RND_face->get_index_count( face ) );
 	}
 	fprintf( aqsis_rib, " ]\n" );
 	
 	/* export faces */
 	fprintf( aqsis_rib, "\t\t[" );
-	for( RND_face_first( face ); RND_face_exists( face ); RND_face_next( face ) )
+	for( RND_face->first( face ); RND_face->exists( face ); RND_face->next( face ) )
 	{
-		index = RND_face_get_indices( face );
+		index = RND_face->get_indices( face );
 		fprintf( aqsis_rib, "\n\t\t" );
-		for( ; RND_index_exists( index ); RND_index_next( index ) )
-			fprintf( aqsis_rib, " %d", RND_index_get_value( index ) );
+		for( ; RND_index->exists( index ); RND_index->next( index ) )
+			fprintf( aqsis_rib, " %d", RND_index->get_value( index ) );
 	}
 	fprintf( aqsis_rib, " ]\n" );
 	
 	/* export vertices */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list