[Bf-blender-cvs] [b4311c9] framebuffer: From review: leave ED related functions away from gpu_extensions.c

Dalai Felinto noreply at git.blender.org
Mon Oct 19 15:38:17 CEST 2015


Commit: b4311c97d84b7e11b61bb81210832f74c519fc26
Author: Dalai Felinto
Date:   Mon Oct 19 11:02:53 2015 -0200
Branches: framebuffer
https://developer.blender.org/rBb4311c97d84b7e11b61bb81210832f74c519fc26

>From review: leave ED related functions away from gpu_extensions.c

===================================================================

M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/GPU_extensions.h
M	source/blender/gpu/SConscript
M	source/blender/gpu/intern/gpu_extensions.c
M	source/blender/python/intern/gpu_offscreen.c

===================================================================

diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 3cde0db..328623f 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -28,7 +28,6 @@ set(INC
 	../blenkernel
 	../blenlib
 	../bmesh
-	../editors/include
 	../imbuf
 	../makesdna
 	../makesrna
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index ded9669..5e80f45 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -36,7 +36,6 @@
 extern "C" {
 #endif
 
-struct bContext;
 struct Image;
 struct ImageUser;
 struct PreviewImage;
@@ -185,7 +184,6 @@ void GPU_framebuffer_blur(GPUFrameBuffer *fb, GPUTexture *tex, GPUFrameBuffer *b
 GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, char err_out[256]);
 void GPU_offscreen_free(GPUOffScreen *ofs);
 void GPU_offscreen_bind(GPUOffScreen *ofs, bool save);
-void GPU_offscreen_draw_view3d(GPUOffScreen *ofs, struct bContext *C, float projection_matrix[4][4], float modelview_matrix[4][4]);
 void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore);
 void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels);
 int GPU_offscreen_width(const GPUOffScreen *ofs);
diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript
index c529c57..d27d5b0 100644
--- a/source/blender/gpu/SConscript
+++ b/source/blender/gpu/SConscript
@@ -42,7 +42,6 @@ incs = [
     '../blenkernel',
     '../blenlib',
     '../bmesh',
-    '../editors/include',
     '../imbuf',
     '../include',
     '../makesdna',
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 970cad0..86f4a2d 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -42,7 +42,6 @@
 #include "BLI_math_base.h"
 #include "BLI_math_vector.h"
 
-#include "BKE_context.h"
 #include "BKE_global.h"
 
 #include "GPU_glew.h"
@@ -54,12 +53,6 @@
 
 #include "intern/gpu_private.h"
 
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-
-#include "ED_view3d.h"
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -1630,67 +1623,6 @@ int GPU_offscreen_color_object(const GPUOffScreen *ofs)
 	return ofs->color->bindcode;
 }
 
-
-/* GPUOffScreen Draw*/
-
-static void gpu_offscreen_draw_setup(GPUOffScreen *ofs)
-{
-	GPU_offscreen_bind(ofs, true);
-}
-
-static void gpu_offscreen_draw_reset(GPUOffScreen *ofs)
-{
-	GPU_offscreen_unbind(ofs, true);
-}
-
-static void gpu_offscreen_draw_doit(
-        GPUOffScreen *ofs,
-        bContext *C,
-        float modelviewmat[4][4],
-		float projmat[4][4])
-{
-	View3D *v3d = CTX_wm_view3d(C);
-	Scene *scene = CTX_data_scene(C);
-	ARegion *ar = CTX_wm_region(C);
-
-	int width = GPU_offscreen_width(ofs);
-	int height = GPU_offscreen_height(ofs);
-	GPUFX *fx = GPU_fx_compositor_create();
-
-	/* full copy */
-	GPUFXSettings fx_settings = v3d->fx_settings;
-
-	ED_view3d_draw_offscreen_init(scene, v3d);
-
-	GPU_offscreen_bind(ofs, true); /* bind */
-
-	ED_view3d_draw_offscreen(
-	            scene,
-	            v3d,
-	            ar,
-	            width,
-	            height,
-	            projmat,
-	            modelviewmat,
-	            false,
-	            true,
-	            true,
-	            "",
-	            fx,
-	            &fx_settings,
-	            ofs);
-
-	GPU_fx_compositor_destroy(fx);
-	GPU_offscreen_unbind(ofs, true); /* unbind */
-}
-
-void GPU_offscreen_draw_view3d(GPUOffScreen *ofs, struct bContext *C, float projection_matrix[4][4], float modelview_matrix[4][4])
-{
-	gpu_offscreen_draw_setup(ofs);
-	gpu_offscreen_draw_doit(ofs, C, projection_matrix, modelview_matrix);
-	gpu_offscreen_draw_reset(ofs);
-}
-
 /* GPUShader */
 
 struct GPUShader {
diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c
index a92ac42..3da7f72 100644
--- a/source/blender/python/intern/gpu_offscreen.c
+++ b/source/blender/python/intern/gpu_offscreen.c
@@ -60,6 +60,8 @@
 
 #include "gpu.h"
 
+#include "ED_view3d.h"
+
 /* -------------------------------------------------------------------- */
 /* GPU Offscreen PyObject */
 
@@ -215,8 +217,10 @@ static PyObject *pygpu_offscreen_draw_view3d(PyGPUOffScreen *self, PyObject *arg
 	MatrixObject *PyModelViewMatrix;
 	MatrixObject *PyProjectionMatrix;
 	bContext *C;
+	Scene *scene;
 	View3D *v3d;
 	ARegion *ar;
+	GPUFX *fx;
 
 	static const char *kwlist[] = {"projection_matrix", "modelview_matrix", NULL};
 
@@ -231,6 +235,7 @@ static PyObject *pygpu_offscreen_draw_view3d(PyGPUOffScreen *self, PyObject *arg
 
 	C = BPy_GetContext();
 	v3d = CTX_wm_view3d(C);
+	scene = CTX_data_scene(C);
 	ar = CTX_wm_region(C);
 
 	if ((v3d == NULL) || (ar == NULL)) {
@@ -238,8 +243,36 @@ static PyObject *pygpu_offscreen_draw_view3d(PyGPUOffScreen *self, PyObject *arg
 		return NULL;
 	}
 
+	fx = GPU_fx_compositor_create();
+
+	/* full copy */
+	GPUFXSettings fx_settings = v3d->fx_settings;
+
 	GPU_offscreen_draw_view3d(self->ofs, C, (float(*)[4])PyProjectionMatrix->matrix, (float(*)[4])PyModelViewMatrix->matrix);
 
+	ED_view3d_draw_offscreen_init(scene, v3d);
+
+	GPU_offscreen_bind(self->ofs, true); /* bind */
+
+	ED_view3d_draw_offscreen(
+	            scene,
+	            v3d,
+	            ar,
+	            GPU_offscreen_width(self->ofs),
+	            GPU_offscreen_height(self->ofs),
+	            (float(*)[4])PyProjectionMatrix->matrix,
+	            (float(*)[4])PyModelViewMatrix->matrix,
+	            false,
+	            true,
+	            true,
+	            "",
+	            fx,
+	            &fx_settings,
+	            self->ofs);
+
+	GPU_fx_compositor_destroy(fx);
+	GPU_offscreen_unbind(self->ofs, true); /* unbind */
+
 	Py_RETURN_NONE;
 }




More information about the Bf-blender-cvs mailing list