soc-2008-mxcurioni: now supports current scene drawing (instead of fixed scene object), still with fixed style and fixed camera. Initialization is properly handled, which limits memory problems and speed-ups subsequent rendering. The viewing ratio should be correct now too. I also removed linking references to former lib3ds library path (caused some linking problems).

This commit is contained in:
Maxime Curioni
2008-06-08 19:35:20 +00:00
parent be2b832db7
commit 062fb01614
16 changed files with 8874 additions and 8909 deletions

View File

@@ -11,10 +11,11 @@ extern "C" {
#endif
#include "render_types.h"
//#include "renderdatabase.h"
/* display_draw() needs render layer info */
#include "renderpipeline.h"
#include "BLI_blenlib.h"
#include "BPY_extern.h"
#ifdef __cplusplus
}
#endif
@@ -25,26 +26,50 @@ using namespace std;
extern "C" {
#endif
void FRS_execute(Render* re) {
cout << "Freestyle start" << endl;
static Controller *controller = NULL;
static AppGLWidget *view = NULL;
void FRS_initialize(){
Config::Path pathconfig;
Controller *c = new Controller;
AppGLWidget *view = new AppGLWidget;
c->SetView(view);
if( controller == NULL )
controller = new Controller;
if( view == NULL )
view = new AppGLWidget;
}
void FRS_execute(Render* re) {
FRS_initialize();
controller->SetView(view);
unsigned int width = re->winx;
unsigned int height = re->winy;
view->setWidth(width);
view->setHeight(height);
view->_camera->setScreenWidthAndHeight(width, height);
//view->setCameraState(const float* position, const float* orientation)
c->Load3DSFile( TEST_3DS_FILE );
BPY_run_python_script( TEST_3DS_EXPORT );
c->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE );
c->toggleLayer(0, true);
c->ComputeViewMap();
char btempdir[255];
BLI_where_is_temp(btempdir,1);
string exported_3ds_file = btempdir;
exported_3ds_file += "/tmp_scene_freestyle.3ds";
if( BLI_exists( const_cast<char *>(exported_3ds_file.c_str()) ) ) {
controller->Load3DSFile( exported_3ds_file.c_str() );
}
else {
cout << "Cannot find" << exported_3ds_file << endl;
return;
}
c->DrawStrokes(); // build strokes
controller->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE );
controller->toggleLayer(0, true);
controller->ComputeViewMap();
controller->DrawStrokes(); // build strokes
view->draw(); // render final result
RenderResult rres;
@@ -52,8 +77,6 @@ extern "C" {
view->readPixels(0,0,width,height,AppGLWidget::RGBA, rres.rectf );
re->result->renlay = render_get_active_layer(re, re->result);
re->display_draw(re->result, NULL);
cout << "Freestyle end" << endl;
}