Blender V2.61 - r43446

RE_engine.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2006 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef RE_ENGINE_H
00033 #define RE_ENGINE_H
00034 
00035 #include "DNA_listBase.h"
00036 #include "RNA_types.h"
00037 
00038 struct Object;
00039 struct Render;
00040 struct RenderEngine;
00041 struct RenderEngineType;
00042 struct RenderLayer;
00043 struct RenderResult;
00044 struct ReportList;
00045 struct Scene;
00046 
00047 /* External Engine */
00048 
00049 /* RenderEngineType.flag */
00050 #define RE_INTERNAL             1
00051 #define RE_GAME                 2
00052 #define RE_USE_PREVIEW          4
00053 #define RE_USE_POSTPROCESS      8
00054 #define RE_USE_SHADING_NODES    16
00055 
00056 /* RenderEngine.flag */
00057 #define RE_ENGINE_ANIMATION     1
00058 #define RE_ENGINE_PREVIEW       2
00059 #define RE_ENGINE_DO_DRAW       4
00060 #define RE_ENGINE_DO_UPDATE     8
00061 
00062 extern ListBase R_engines;
00063 
00064 typedef struct RenderEngineType {
00065     struct RenderEngineType *next, *prev;
00066 
00067     /* type info */
00068     char idname[64]; // best keep the same size as BKE_ST_MAXNAME
00069     char name[64];
00070     int flag;
00071 
00072     void (*update)(struct RenderEngine *engine, struct Main *bmain, struct Scene *scene);
00073     void (*render)(struct RenderEngine *engine, struct Scene *scene);
00074 
00075     void (*view_update)(struct RenderEngine *engine, const struct bContext *context);
00076     void (*view_draw)(struct RenderEngine *engine, const struct bContext *context);
00077 
00078     /* RNA integration */
00079     ExtensionRNA ext;
00080 } RenderEngineType;
00081 
00082 typedef struct RenderEngine {
00083     RenderEngineType *type;
00084     void *py_instance;
00085 
00086     int flag;
00087 
00088     struct Render *re;
00089     ListBase fullresult;
00090     char *text;
00091 } RenderEngine;
00092 
00093 RenderEngine *RE_engine_create(RenderEngineType *type);
00094 void RE_engine_free(RenderEngine *engine);
00095 
00096 void RE_layer_load_from_file(struct RenderLayer *layer, struct ReportList *reports, const char *filename, int x, int y);
00097 void RE_result_load_from_file(struct RenderResult *result, struct ReportList *reports, const char *filename);
00098 
00099 struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h);
00100 void RE_engine_update_result(RenderEngine *engine, struct RenderResult *result);
00101 void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result);
00102 
00103 int RE_engine_test_break(RenderEngine *engine);
00104 void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info);
00105 void RE_engine_update_progress(RenderEngine *engine, float progress);
00106 void RE_engine_report(RenderEngine *engine, int type, const char *msg);
00107 
00108 int RE_engine_render(struct Render *re, int do_all);
00109 
00110 int RE_engine_is_external(struct Render *re);
00111 
00112 /* Engine Types */
00113 
00114 void RE_engines_init(void);
00115 void RE_engines_exit(void);
00116 
00117 RenderEngineType *RE_engines_find(const char *idname);
00118 
00119 #endif /* RE_ENGINE_H */
00120