diff options
Diffstat (limited to 'intern/cycles/blender/blender_session.h')
-rw-r--r-- | intern/cycles/blender/blender_session.h | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index 708776dc8ca..66a6945cbc1 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -33,11 +33,18 @@ class RenderTile; class BlenderSession { public: - BlenderSession(BL::RenderEngine b_engine, BL::UserPreferences b_userpref, - BL::BlendData b_data, BL::Scene b_scene); - BlenderSession(BL::RenderEngine b_engine, BL::UserPreferences b_userpref, - BL::BlendData b_data, BL::Scene b_scene, - BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height); + BlenderSession(BL::RenderEngine& b_engine, + BL::UserPreferences& b_userpref, + BL::BlendData& b_data, + BL::Scene& b_scene); + + BlenderSession(BL::RenderEngine& b_engine, + BL::UserPreferences& b_userpref, + BL::BlendData& b_data, + BL::Scene& b_scene, + BL::SpaceView3D& b_v3d, + BL::RegionView3D& b_rv3d, + int width, int height); ~BlenderSession(); @@ -47,19 +54,31 @@ public: void create_session(); void free_session(); - void reset_session(BL::BlendData b_data, BL::Scene b_scene); + void reset_session(BL::BlendData& b_data, + BL::Scene& b_scene); /* offline render */ void render(); - void bake(BL::Object b_object, const string& pass_type, const int object_id, BL::BakePixel pixel_array, const size_t num_pixels, const int depth, float pixels[]); - - void write_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile); + void bake(BL::Object& b_object, + const string& pass_type, + const int custom_flag, + const int object_id, + BL::BakePixel& pixel_array, + const size_t num_pixels, + const int depth, + float pixels[]); + + void write_render_result(BL::RenderResult& b_rr, + BL::RenderLayer& b_rlay, + RenderTile& rtile); void write_render_tile(RenderTile& rtile); /* update functions are used to update display buffer only after sample was rendered * only needed for better visual feedback */ - void update_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile); + void update_render_result(BL::RenderResult& b_rr, + BL::RenderLayer& b_rlay, + RenderTile& rtile); void update_render_tile(RenderTile& rtile); /* interactive updates */ @@ -76,7 +95,6 @@ public: void update_bake_progress(); bool background; - static bool headless; Session *session; Scene *scene; BlenderSync *sync; @@ -101,14 +119,38 @@ public: void *python_thread_state; + /* Global state which is common for all render sessions created from Blender. + * Usually denotes command line arguments. + */ + + /* Blender is running from the command line, no windows are shown and some + * extra render optimization is possible (possible to free draw-only data and + * so on. + */ + static bool headless; + + /* ** Resumable render ** */ + + /* Overall number of chunks in which the sample range is to be devided. */ + static int num_resumable_chunks; + + /* Current resumable chunk index to render. */ + static int current_resumable_chunk; + protected: - void do_write_update_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile, bool do_update_only); + void do_write_update_render_result(BL::RenderResult& b_rr, + BL::RenderLayer& b_rlay, + RenderTile& rtile, + bool do_update_only); void do_write_update_render_tile(RenderTile& rtile, bool do_update_only); int builtin_image_frame(const string &builtin_name); void builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &depth, int &channels); bool builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels); bool builtin_image_float_pixels(const string &builtin_name, void *builtin_data, float *pixels); + + /* Update tile manager to reflect resumable render settings. */ + void update_resumable_tile_manager(int num_samples); }; CCL_NAMESPACE_END |