[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11380] branches/soc-2007-mosani/source/ blender: The pipeline now has render callbacks embedded in it.
Aaron Moore
two.a.ron at gmail.com
Thu Jul 26 18:27:02 CEST 2007
Revision: 11380
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11380
Author: mosani
Date: 2007-07-26 18:27:02 +0200 (Thu, 26 Jul 2007)
Log Message:
-----------
The pipeline now has render callbacks embedded in it.
Changes:
1. new files with empty blender internal callbacks
2. setup, render_frame, finish are in the right place and
have wrappers which setup the render API and call them.
3. I've added render API stuff to the Render structure
Modified Paths:
--------------
branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
branches/soc-2007-mosani/source/blender/radiosity/SConscript
branches/soc-2007-mosani/source/blender/render/extern/include/RE_pipeline.h
branches/soc-2007-mosani/source/blender/render/intern/include/render_types.h
branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.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_helpers.c
branches/soc-2007-mosani/source/blender/render/render_api/source/RND_internal.c
branches/soc-2007-mosani/source/blender/src/SConscript
branches/soc-2007-mosani/source/blender/yafray/SConscript
Added Paths:
-----------
branches/soc-2007-mosani/source/blender/render/intern/include/rendercallbacks.h
branches/soc-2007-mosani/source/blender/render/intern/source/rendercallbacks.c
Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c 2007-07-26 15:02:07 UTC (rev 11379)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c 2007-07-26 16:27:02 UTC (rev 11380)
@@ -60,8 +60,6 @@
#include "plugin.h"
#include "PLU_private.h"
-#include "RenderAPI_internal.h"
-
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h" /* util and noise functions */
@@ -1747,8 +1745,6 @@
*/
int pluginapi_force_ref(void);
-#include "RenderAPI_helpers.h"
-
int pluginapi_force_ref(void)
{
return (int) mallocN +
Modified: branches/soc-2007-mosani/source/blender/radiosity/SConscript
===================================================================
--- branches/soc-2007-mosani/source/blender/radiosity/SConscript 2007-07-26 15:02:07 UTC (rev 11379)
+++ branches/soc-2007-mosani/source/blender/radiosity/SConscript 2007-07-26 16:27:02 UTC (rev 11380)
@@ -5,7 +5,8 @@
incs = 'extern/include ../blenlib ../blenkernel ../makesdna ../include'
incs += ' #/intern/guardedalloc ../render/extern/include'
-incs += ' ../render/intern/include'
+incs += ' ../render/intern/include ../render/render_api/include'
+incs += ' ../blenpluginapi'
incs += ' ' + env['BF_OPENGL_INC']
Modified: branches/soc-2007-mosani/source/blender/render/extern/include/RE_pipeline.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/extern/include/RE_pipeline.h 2007-07-26 15:02:07 UTC (rev 11379)
+++ branches/soc-2007-mosani/source/blender/render/extern/include/RE_pipeline.h 2007-07-26 16:27:02 UTC (rev 11380)
@@ -180,6 +180,13 @@
void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame);
void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra);
+/* Wrappers for the render control callbacks (these callbacks are overwritten
+ if an external renderer is being used) */
+void RE_Setup( struct Render *re, struct Scene *scene );
+void RE_RenderFrame( struct Render *re );
+void RE_Finish( struct Render *re );
+void RE_Abort( struct Render *re );
+
void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress);
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty);
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-07-26 15:02:07 UTC (rev 11379)
+++ branches/soc-2007-mosani/source/blender/render/intern/include/render_types.h 2007-07-26 16:27:02 UTC (rev 11380)
@@ -42,6 +42,8 @@
#include "RE_pipeline.h"
#include "RE_shader_ext.h" /* TexResult, ShadeResult, ShadeInput */
+#include "RenderAPI.h"
+
struct Object;
struct MemArena;
struct VertTableNode;
@@ -196,6 +198,14 @@
void (*error)(char *str);
RenderStats i;
+
+ RNDScene api_scene;
+ RNDResult api_result;
+ void (*setup)( RNDScene scene );
+ void (*render_frame)( RNDScene scene, RNDResult result );
+ void (*finish)();
+ void (*abort)();
+ char axis[3];
};
/* ------------------------------------------------------------------------- */
Added: branches/soc-2007-mosani/source/blender/render/intern/include/rendercallbacks.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/include/rendercallbacks.h (rev 0)
+++ branches/soc-2007-mosani/source/blender/render/intern/include/rendercallbacks.h 2007-07-26 16:27:02 UTC (rev 11380)
@@ -0,0 +1,49 @@
+/*
+ * rendercallbacks.h
+ *
+ * ***** 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 *****
+ */
+
+/**
+ * @file rendercallbacks.h
+ *
+ * The prototypes of the render callbacks used in the
+ * pipeline for the Blender Internal renderer.
+ */
+
+#ifndef RENDERCALLBACKS_H
+#define RENDERCALLBACKS_H
+
+#include "RenderAPI.h"
+
+void blender_internal_setup( RNDScene scene );
+void blender_internal_render_frame( RNDScene, RNDResult );
+void blender_internal_finish();
+void blender_internal_abort();
+
+#endif /* RENDERCALLBACKS_H */
+
+
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 15:02:07 UTC (rev 11379)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c 2007-07-26 16:27:02 UTC (rev 11380)
@@ -73,6 +73,7 @@
/* internal */
#include "render_types.h"
#include "renderpipeline.h"
+#include "rendercallbacks.h"
#include "renderdatabase.h"
#include "rendercore.h"
#include "envmap.h"
@@ -82,6 +83,7 @@
/* render API */
#include "RenderAPI.h"
+#include "RenderAPI_internal.h"
/* render flow
@@ -1506,55 +1508,32 @@
re->stats_draw(&re->i);
}
-
-
-
-
-
-
-/*************** Start Render API Refactor ****************/
-
-
-static void do_render_3d_with_RenderAPI(Render *re)
-{
- RenderAPI_test();
-}
-
-
-/*************** End Render API Refactor ****************/
-
-
-
-
-
-
-
/* ************ This part uses API, for rendering Blender scenes ********** */
static void do_render_3d(Render *re)
{
- if(G.renderAPI_toggle & 1)
- do_render_3d_with_RenderAPI(re);
- else{
- /* re->cfra= cfra; <- unused! */
-
- /* make render verts/faces/halos/lamps */
- if(render_scene_needs_vector(re))
- RE_Database_FromScene_Vectors(re, re->scene);
- else
- RE_Database_FromScene(re, re->scene, 1);
-
- threaded_tile_processor(re);
-
- /* do left-over 3d post effects (flares) */
- if(re->flag & R_HALO)
- if(!re->test_break())
- add_halo_flare(re);
+ if(G.renderAPI_toggle & 1){ /* if we're using the render api */
+ RE_RenderFrame( re );
+ return;
+ }
+ /* re->cfra= cfra; <- unused! */
-
- /* free all render verts etc */
- RE_Database_Free(re);
- }
+ /* make render verts/faces/halos/lamps */
+ if(render_scene_needs_vector(re))
+ RE_Database_FromScene_Vectors(re, re->scene);
+ else
+ RE_Database_FromScene(re, re->scene, 1);
+
+ threaded_tile_processor(re);
+
+ /* do left-over 3d post effects (flares) */
+ if(re->flag & R_HALO)
+ if(!re->test_break())
+ add_halo_flare(re);
+
+
+ /* free all render verts etc */
+ RE_Database_Free(re);
}
/* called by blur loop, accumulate renderlayers */
@@ -2169,6 +2148,76 @@
int winx, winy;
rcti disprect;
+
+
+ /********************* if we're using the render api *********************/
+
+ if(G.renderAPI_toggle & 1)
+ {
+ /**** Initialize Render Context ****/
+
+ /* r.xsch and r.ysch has the actual view window size
+ r.border is the clipping rect */
+
+ /* calculate actual render result and display size */
+ winx= (scene->r.size*scene->r.xsch)/100;
+ winy= (scene->r.size*scene->r.ysch)/100;
+
+ /* we always render smaller part, inserting it in larger image is compositor bizz, it uses disprect for it */
+ if(scene->r.mode & R_BORDER) {
+ disprect.xmin= scene->r.border.xmin*winx;
+ disprect.xmax= scene->r.border.xmax*winx;
+
+ disprect.ymin= scene->r.border.ymin*winy;
+ disprect.ymax= scene->r.border.ymax*winy;
+ }
+ else {
+ disprect.xmin= disprect.ymin= 0;
+ disprect.xmax= winx;
+ disprect.ymax= winy;
+ }
+
+ if(scene->r.scemode & R_EXR_TILE_FILE) {
+ int partx= winx/scene->r.xparts, party= winy/scene->r.yparts;
+
+ /* stupid exr tiles dont like different sizes */
+ if(winx != partx*scene->r.xparts || winy != party*scene->r.yparts) {
+ re->error("Sorry... exr tile saving only allowed with equally sized parts");
+ return 0;
+ }
+ if((scene->r.mode & R_FIELDS) && (party & 1)) {
+ re->error("Sorry... exr tile saving only allowed with equally sized parts");
+ return 0;
+ }
+ }
+
+ if(scene->r.scemode & R_SINGLE_LAYER)
+ push_render_result(re);
+
+ RE_InitState(re, &scene->r, winx, winy, &disprect);
+
+ /* initstate makes new result, have to send changed tags around */
+ ntreeCompositTagRender(re->scene);
+
+ re->scene= scene;
+ if(!is_rendering_allowed(re))
+ return 0;
+
+ re->display_init(re->result);
+ re->display_clear(re->result);
+
+ /**** Initialize Renderer ****/
+ RE_Setup( re, scene );
+
+ return 1;
+ }
+
+ /****************** end if we're using the render api ******************/
+
+
+
+
+
/* r.xsch and r.ysch has the actual view window size
r.border is the clipping rect */
@@ -2235,6 +2284,8 @@
do_render_all_options(re);
}
+ RE_Finish( re );
+
/* UGLY WARNING */
G.rendering= 0;
}
@@ -2363,10 +2414,53 @@
scene->r.cfra= cfrao;
+ RE_Finish( re );
+
/* UGLY WARNING */
G.rendering= 0;
}
+/* ------------------------------------------------------------------------- *
+ * ------------------------ Render Control Calls ------------------------- *
+ * ------------------------------------------------------------------------- */
+
+void RE_Setup( struct Render *re, struct Scene *scene )
+{
+ /* do generic setup tasks */
+ re->api_scene = RenderAPI_create_scene( scene );
+
+ /* get render control callbacks */
+ if( G.scene->r.renderer >= 2 ) /* renderer is a plugin */
+ {
+ RenderAPI_assign_plugin_callbacks( re );
+ }
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list