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:
authorDalai Felinto <dfelinto@gmail.com>2016-10-24 21:58:12 +0300
committerDalai Felinto <dfelinto@gmail.com>2016-10-24 22:05:49 +0300
commit1458f0136d5e34307563a72144ddee88304fc318 (patch)
tree5476d92512f16807f389899573398da12a1f7eaa /source/blender/editors/space_view3d/view3d_draw_legacy.c
parent744718f6356ece21bf90c54550b39d56cf0a356e (diff)
Viewport: move the background to the "modern" viewport
This also leaves room for the gradient background Mike Erwin wants to implement.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw_legacy.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c103
1 files changed, 2 insertions, 101 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index c260ab22d1b..80428906c0a 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -2246,109 +2246,10 @@ void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d)
static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar)
{
if (scene->world && (v3d->flag3 & V3D_SHOW_WORLD)) {
- RegionView3D *rv3d = ar->regiondata;
- GPUMaterial *gpumat = GPU_material_world(scene, scene->world);
-
- /* calculate full shader for background */
- GPU_material_bind(gpumat, 1, 1, 1.0, false, rv3d->viewmat, rv3d->viewinv, rv3d->viewcamtexcofac, (v3d->scenelock != 0));
-
- bool material_not_bound = !GPU_material_bound(gpumat);
-
- /* Draw world */
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_ALWAYS);
-
- if (material_not_bound) {
- GPU_material_unbind(gpumat);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- immUniformColor4ub(0.0f, 0.0f, 0.0f, 1.0f);
-
- immBegin(GL_TRIANGLE_STRIP, 4);
- immVertex3f(pos, -1.0f, -1.0f, 1.0f);
- immVertex3f(pos, 1.0f, -1.0f, 1.0f);
- immVertex3f(pos, -1.0f, 1.0f, 1.0f);
- immVertex3f(pos, 1.0f, 1.0f, 1.0f);
- immEnd();
-
- immUnbindProgram();
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- }
- else {
- /* TODO viewport (dfelinto): GPU_material_bind relies on immediate mode,
- * we can't get rid of the following code without a bigger refactor
- * or we dropping this functionality. */
- glBegin(GL_TRIANGLE_STRIP);
- glVertex3f(-1.0f, -1.0f, 1.0f);
- glVertex3f(1.0f, -1.0f, 1.0f);
- glVertex3f(-1.0f, 1.0f, 1.0f);
- glVertex3f(1.0f, 1.0f, 1.0f);
- glEnd();
- GPU_material_unbind(gpumat);
- }
-
- glDepthFunc(GL_LEQUAL);
- glDisable(GL_DEPTH_TEST);
+ VP_view3d_draw_background_world(scene, v3d, ar->regiondata);
}
else {
- if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) {
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_ALWAYS);
-
- VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
- unsigned char col_hi[3], col_lo[3];
-
- immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
-
- UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo);
- UI_GetThemeColor3ubv(TH_LOW_GRAD, col_hi);
-
- immBegin(GL_QUADS, 4);
- immAttrib3ubv(color, col_lo);
- immVertex3f(pos, -1.0f, -1.0f, 1.0f);
- immVertex3f(pos, 1.0f, -1.0f, 1.0f);
-
- immAttrib3ubv(color, col_hi);
- immVertex3f(pos, 1.0f, 1.0f, 1.0f);
- immVertex3f(pos, -1.0f, 1.0f, 1.0f);
- immEnd();
-
- immUnbindProgram();
-
- glDepthFunc(GL_LEQUAL);
- glDisable(GL_DEPTH_TEST);
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- }
- else {
- UI_ThemeClearColorAlpha(TH_HIGH_GRAD, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
+ VP_view3d_draw_background_none();
}
}