Blender V2.61 - r43446

blender_session.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2011, Blender Foundation.
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 
00019 #ifndef __BLENDER_SESSION_H__
00020 #define __BLENDER_SESSION_H__
00021 
00022 #include "device.h"
00023 #include "scene.h"
00024 #include "session.h"
00025 
00026 #include "util_vector.h"
00027 
00028 CCL_NAMESPACE_BEGIN
00029 
00030 class Scene;
00031 class Session;
00032 
00033 class BlenderSession {
00034 public:
00035     BlenderSession(BL::RenderEngine b_engine, BL::UserPreferences b_userpref,
00036         BL::BlendData b_data, BL::Scene b_scene);
00037     BlenderSession(BL::RenderEngine b_engine, BL::UserPreferences b_userpref,
00038         BL::BlendData b_data, BL::Scene b_scene,
00039         BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
00040 
00041     ~BlenderSession();
00042 
00043     /* session */
00044     void create_session();
00045     void free_session();
00046 
00047     /* offline render */
00048     void render();
00049     void write_render_result();
00050 
00051     /* interactive updates */
00052     void synchronize();
00053 
00054     /* drawing */
00055     bool draw(int w, int h);
00056     void tag_redraw();
00057     void tag_update();
00058     void get_status(string& status, string& substatus);
00059     void get_progress(float& progress, double& total_time);
00060     void test_cancel();
00061     void update_status_progress();
00062 
00063     bool background;
00064     Session *session;
00065     Scene *scene;
00066     BlenderSync *sync;
00067     double last_redraw_time;
00068 
00069     BL::RenderEngine b_engine;
00070     BL::UserPreferences b_userpref;
00071     BL::BlendData b_data;
00072     BL::Scene b_scene;
00073     BL::SpaceView3D b_v3d;
00074     BL::RegionView3D b_rv3d;
00075     BL::RenderResult b_rr;
00076     BL::RenderLayer b_rlay;
00077 
00078     string last_status;
00079     float last_progress;
00080 
00081     int width, height;
00082 };
00083 
00084 CCL_NAMESPACE_END
00085 
00086 #endif /* __BLENDER_SESSION_H__ */