[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11372] branches/soc-2007-mosani/source/ blender: I don't know if this works on windows yet, but it follows the hacky convention

Aaron Moore two.a.ron at gmail.com
Thu Jul 26 09:23:58 CEST 2007


Revision: 11372
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11372
Author:   mosani
Date:     2007-07-26 09:23:58 +0200 (Thu, 26 Jul 2007)

Log Message:
-----------
I don't know if this works on windows yet, but it follows the hacky convention
 of blenders old plugin API and, most importantly, it works.

Changes:
 1. Got rid of huge structure with all api calls in it.
 2. Created a hierarchy of force_ref function calls,
  - one for the whole render API, RenderAPI_force_ref, that is 
      called in pluginapi_force_ref
  - one for each source file, called in the RenderAPI_force_ref

When these are called on startup, along with all of the other plugin-accessible
functions, the plugin can call the functions.

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
    branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
    branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/SConstruct
    branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis.c
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_internal.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_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_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_settings.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/test.c

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h	2007-07-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h	2007-07-26 07:23:58 UTC (rev 11372)
@@ -123,7 +123,7 @@
 	plugin_instance_t* (*load)(plugin_control_t * c),
 	void (*free)(plugin_instance_t* This),
 	
-	plugin_interface_render_output_t registration
+	RendererRegistration registration
 	){
 	
 	plugin_descriptor_t * rv = plugin_register_private(

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h	2007-07-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h	2007-07-26 07:23:58 UTC (rev 11372)
@@ -406,21 +406,21 @@
 /* External Renderer Plugins: */
 
 typedef struct plugin_interface_render_output_t {
-	void (*setup)( RenderAPI *api );
-	void (*render_frame)( RenderAPI *api );
+	void (*setup)( RNDScene scene );
+	void (*render_frame)( RNDScene scene, RNDResult );
 	void (*finish)();
 	void (*abort)();
 	
 	char axis[3]; /* 0 = right, 1 = forward, 2 = up
-	                 ex. axis[0] = 1, makes right
+	                 ex. axis[0] = 'x', makes right
 	                 positive x */
 }plugin_interface_render_output_t;
 
+typedef plugin_interface_render_output_t RendererRegistration;
 
 
 
 
-
 /*
   plugin descriptor: read from a seperate plugin registry and / or by file
   scan. Describes the plugin and offers the interface to create an instance.

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c	2007-07-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c	2007-07-26 07:23:58 UTC (rev 11372)
@@ -60,6 +60,8 @@
 #include "plugin.h"
 #include "PLU_private.h"
 
+#include "RenderAPI_internal.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"  /* util and noise functions */
@@ -1745,6 +1747,8 @@
 	 */
 int pluginapi_force_ref(void); 
 
+#include "RenderAPI_helpers.h"
+
 int pluginapi_force_ref(void) 
 {
 	return (int) mallocN +
@@ -1784,5 +1788,6 @@
 		(int) turbulence1 +
 		(int) de_interlace +
 		(int) interlace +
-		(int) gamwarp;
+		(int) gamwarp +
+		RenderAPI_force_ref();
 }

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-07-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-07-26 07:23:58 UTC (rev 11372)
@@ -82,7 +82,6 @@
 
 /* render API */
 #include "RenderAPI.h"
-#include "RenderAPI_internal.h"
 
 /* render flow
 

Modified: branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/SConstruct
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/SConstruct	2007-07-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/SConstruct	2007-07-26 07:23:58 UTC (rev 11372)
@@ -6,7 +6,7 @@
 library_name = "aqsis"
 library_sources = ["aqsis.c"]
 
-include_paths = [".", "../../../blenpluginapi", "../include"]
+include_paths = [".", "../../../blenpluginapi", "../include", "../../../makesdna"]
 compiler_flags = '-g'
 linker_flags = '-g'
 

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-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/render/render_api/aqsis_plugin/aqsis.c	2007-07-26 07:23:58 UTC (rev 11372)
@@ -3,75 +3,17 @@
 
 #include <stdio.h>
 #include "plugin.h"
-#include "RenderAPI.h"
-#include "aqsis_helpers.h"
 
-static void setup( RenderAPI *api )
+static void setup( RNDScene scene ){}
+static void render_frame( RNDScene scene, RNDResult result )
 {
-	FILE *aqsis_rib = fopen( "aqsis.rib", "w" );
-	fprintf( aqsis_rib, "# Generated by Aqsis Plugin - Aaron Moore\n\n" );
-	fprintf( aqsis_rib, "Display \"aqsis.jpg\" \"framebuffer\" \"rgb\"\n\n" );
-	fprintf( aqsis_rib, "Format 400 300 1\n" );
-	fprintf( aqsis_rib, "Projection \"perspective\" \"fov\" 35\n" );
-	fclose( aqsis_rib );
+	/* Aqsis RIB Export */
+	/* FILE *aqsis_rib = fopen( "aqsis.rib", "w" ); */
+	RNDObject object = RND_get_objects( scene, RND_LIGHT );
+	fprintf( stderr, "%s\n", object->current->holder->name );
+	/* fclose( aqsis_rib ); */
 }
-static void render_frame( RenderAPI *api )
-{
-	float light_coord[3];
-	RNDLight light;
-	
-	FILE *aqsis_rib = fopen( "aqsis.rib", "a" );
-	fprintf( aqsis_rib, "FrameBegin 1\n" );
-	fprintf( aqsis_rib, "WorldBegin\n\n" );
-	
-	/*
-	fprintf( aqsis_rib, "\t# translate world origin away from camera\n\n" );
-	
-	fprintf( aqsis_rib, "\tRotate -30 .3 0 0\n" );
-	fprintf( aqsis_rib, "\tRotate -45 0 1 0\n" );
-	fprintf( aqsis_rib, "\tTranslate 6 -5 6\n" );
-	*/
-	
-	/* Export Lights */
-	RNDObject object = api->get_objects( api->scene, RND_LIGHT );
-	for( ; api->object_exists( object ); api->object_next( object ) )
-	{
-		if( api->object_get_type( object ) == RND_LIGHT_POINT ){
-			fprintf( aqsis_rib, "\tLightSource \"pointlight\" 1 " );
-			api->object_get_translation( object, light_coord );
-			fprintf( aqsis_rib, "\"from\" [%f %f %f] ",
-				light_coord[0],
-				light_coord[1],
-				light_coord[2] );
-			light = api->object_get_light( object );
-			fprintf( aqsis_rib, "\"intensity\" %f\n", 
-				api->light_get_intensity( light ) );
-		}
-	}
-	
-	/* Export Meshes */
-	object = api->get_objects( api->scene, RND_GEOMETRY );
-	for( ; api->object_exists( object ); api->object_next( object ) )
-	{
-		if( api->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" );
-			transform_object( api, object, aqsis_rib );
-			export_polygons( api, object, aqsis_rib );
-			fprintf( aqsis_rib, "\tAttributeEnd\n" );
-		}
-	}
-	
-	fprintf( aqsis_rib, "WorldEnd\n" );
-	fprintf( aqsis_rib, "FrameEnd\n" );
-	fclose( aqsis_rib );
-}
-static void finish()
-{
-	/* FILE *aqsis_rib = fopen( "aqsis.rib", "a" );
-	fclose( aqsis_rib ); */
-}
+static void finish(){}
 static void abort_callback(){}
 
 plugin_instance_t* init( plugin_control_t *c ){ return NULL; }
@@ -79,16 +21,14 @@
 
 void plugin_query()
 {
-	plugin_interface_render_output_t registration;
-	/* callbacks */
+	RendererRegistration registration;
 	registration.setup = setup;
 	registration.render_frame = render_frame;
 	registration.finish = finish;
-	registration.abort_callback;
-	/* axis */
-	registration.right = 'x';
-	registration.front = 'y';
-	registration.up = 'z';
+	registration.abort = abort_callback;
+	registration.axis[0] = 'x';
+	registration.axis[1] = 'z';
+	registration.axis[2] = 'y';
 	
 	plugin_register_render_output(
 		"Aqsis Plugin",

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-07-26 06:11:58 UTC (rev 11371)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-07-26 07:23:58 UTC (rev 11372)
@@ -34,6 +34,10 @@
 
 #ifndef RENDER_API_H
 #define RENDER_API_H
+
+#include "externdef.h"
+#include "RND_types.h"
+
 /****************************************************************************/
 /********************************   Types   *********************************/
 /****************************************************************************/
@@ -67,12 +71,12 @@
 
 /** Get or set the current frame. This is for motion blur calculations. */
 
-float RND_get_current_frame( RNDScene scene );
-void RND_set_current_frame( RNDScene scene, float new_frame );
+LIBEXPORT float RND_get_current_frame( RNDScene scene );
+LIBEXPORT void RND_set_current_frame( RNDScene scene, float new_frame );
 
 /** Offsets the current frame by offset. */
 
-void RND_set_frame_offset( RNDScene scene, float offset );
+LIBEXPORT void RND_set_frame_offset( RNDScene scene, float offset );
 
 /** 
     Functions for dealing with the render layers. Render layers
@@ -80,9 +84,9 @@
     with ints.
 */
 
-int RND_get_render_layer_count( RNDScene scene );
-int RND_get_render_layer( RNDScene scene );
-void RND_set_render_layer( RNDScene scene, int new_layer );
+LIBEXPORT int RND_get_render_layer_count( RNDScene scene );
+LIBEXPORT int RND_get_render_layer( RNDScene scene );
+LIBEXPORT void RND_set_render_layer( RNDScene scene, int new_layer );
 
 /* ------------------------------------------------------------------------ */
 /* ----------------------------  settings  -------------------------------- */
@@ -98,7 +102,7 @@
 RND_SAMPLE_BOX
 } RND_SAMPLE_TYPE;
 
-int RND_is_animation( RNDScene scene );
+LIBEXPORT int RND_is_animation( RNDScene scene );
 int RND_has_motion_blur( RNDScene scene );
 
 int RND_get_image_width( RNDScene scene );
@@ -114,13 +118,13 @@
 /* ------------------------------------------------------------------------ */
 
 /** Returns true if perspective, false if orthagonal. */
-int RND_is_perspective( RNDScene scene );
+LIBEXPORT int RND_is_perspective( RNDScene scene );
 
-float RND_get_lens( RNDScene scene );
-float RND_get_scale( RNDScene scene );
-float RND_get_clipping_start( RNDScene scene );
-float RND_get_clipping_end( RNDScene scene );
-float RND_get_depth_of_field( RNDScene scene );
+LIBEXPORT float RND_get_lens( RNDScene scene );
+LIBEXPORT float RND_get_scale( RNDScene scene );
+LIBEXPORT float RND_get_clipping_start( RNDScene scene );
+LIBEXPORT float RND_get_clipping_end( RNDScene scene );
+LIBEXPORT float RND_get_depth_of_field( RNDScene scene );
 
 /* ------------------------------------------------------------------------ */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list