Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-05-29 04:27:09 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-05-29 04:27:09 +0400
commit9a6302e10994e45a2ec8a419bda5e1735c8e0799 (patch)
treec674c4917926e60f99968ca746aa2719ccc8c359 /source/blender/freestyle/intern
parent9986b5cd736a493026c9580a49bbf030cd1fa4be (diff)
soc-2008-mxcurioni: First render ! It should render the teapot upside down on a black background. The correction was made by following Yafray's rendering and display implementation, which is very clear.
Diffstat (limited to 'source/blender/freestyle/intern')
-rw-r--r--source/blender/freestyle/intern/app_blender/api.cpp44
-rwxr-xr-xsource/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp1
2 files changed, 40 insertions, 5 deletions
diff --git a/source/blender/freestyle/intern/app_blender/api.cpp b/source/blender/freestyle/intern/app_blender/api.cpp
index eb29580f891..d842e59d31b 100644
--- a/source/blender/freestyle/intern/app_blender/api.cpp
+++ b/source/blender/freestyle/intern/app_blender/api.cpp
@@ -6,13 +6,26 @@
#include <iostream>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "render_types.h"
+//#include "renderdatabase.h"
+/* display_draw() needs render layer info */
+#include "renderpipeline.h"
+
+#ifdef __cplusplus
+}
+#endif
+
using namespace std;
#ifdef __cplusplus
extern "C" {
#endif
- void FRS_execute() {
+ void FRS_execute(Render* re) {
cout << "Freestyle start" << endl;
Config::Path pathconfig;
@@ -20,16 +33,39 @@ extern "C" {
AppGLWidget *view = new AppGLWidget;
c->SetView(view);
- view->setWidth(640);
- view->setHeight(640);
+ unsigned int width = re->winx;
+ unsigned int height = re->winy;
+ view->setWidth(width);
+ view->setHeight(height);
c->Load3DSFile( TEST_3DS_FILE );
c->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE );
c->toggleLayer(0, true);
c->ComputeViewMap();
-
+
c->DrawStrokes();
+
+ RenderResult rres;
+ RE_GetResultImage(re, &rres);
+ float *rgb = new float[3*width*height];
+ view->readPixels(0,0,width,height,AppGLWidget::RGB, rgb);
+
+ for (unsigned short y=0; y<height; y++) {
+ float* bpt = (float*)rres.rectf + ((y*width) << 2);
+ for (unsigned short x=0; x<width; x++) {
+ float *pos = rgb + 3 * ( y*width + x );
+
+ bpt[0] = pos[0]; // r
+ bpt[1] = pos[1]; // g
+ bpt[2] = pos[2]; // b
+ bpt[3] = 1.0; // a
+ bpt += 4;
+ }
+ }
+
+ re->result->renlay = render_get_active_layer(re, re->result);
+ re->display_draw(re->result, NULL);
cout << "Freestyle end" << endl;
diff --git a/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp b/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
index 94518cee58f..5033cc5d895 100755
--- a/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
@@ -513,7 +513,6 @@ GLTextureManager::preparePaper (const char *name, GLuint itexname)
ImBuf *qim = IMB_loadiffname(name, 0);
char filename[FILE_MAXFILE];
BLI_splitdirstring((char *)name, filename);
- qim->depth = 32;
if (!qim) //soc
{