From 092d9c31a14d44ea440fcab657e61827ace14875 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 25 May 2013 11:52:52 +0000 Subject: Bug fix, irc submitted: 3D Viewport render (internal) didn't render bump maps (it was black even). --- source/blender/editors/include/ED_view3d.h | 2 +- source/blender/editors/render/render_internal.c | 12 +++++++----- source/blender/editors/render/render_opengl.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 2 +- source/blender/editors/space_view3d/view3d_view.c | 5 +++-- 5 files changed, 13 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index d6d82696422..ef50a21c900 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -215,7 +215,7 @@ void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, cons bool ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *r_clipsta, float *r_clipend, const bool use_ortho_factor); bool ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, - struct rctf *r_viewplane, float *r_clipsta, float *r_clipend); + struct rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize); void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *r_viewborder, const bool no_shift); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 541512a7cbb..be1a52242c3 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -760,12 +760,12 @@ static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, Region /* returns true if OK */ static bool render_view3d_get_rects(ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewplane, RenderEngine *engine, - float *r_clipsta, float *r_clipend, bool *r_ortho) + float *r_clipsta, float *r_clipend, float *r_pixsize, bool *r_ortho) { if (ar->winx < 4 || ar->winy < 4) return false; - *r_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, viewplane, r_clipsta, r_clipend); + *r_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, viewplane, r_clipsta, r_clipend, r_pixsize); engine->resolution_x = ar->winx; engine->resolution_y = ar->winy; @@ -819,13 +819,13 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda RenderData rdata; rctf viewplane; rcti cliprct; - float clipsta, clipend; + float clipsta, clipend, pixsize; bool orth, restore = 0; char name[32]; G.is_break = FALSE; - if (false == render_view3d_get_rects(rp->ar, rp->v3d, rp->rv3d, &viewplane, rp->engine, &clipsta, &clipend, &orth)) + if (false == render_view3d_get_rects(rp->ar, rp->v3d, rp->rv3d, &viewplane, rp->engine, &clipsta, &clipend, &pixsize, &orth)) return; rp->stop = stop; @@ -875,6 +875,8 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda else RE_SetWindow(re, &viewplane, clipsta, clipend); + RE_SetPixelSize(re, pixsize); + /* database free can crash on a empty Render... */ if (rp->keep_data == 0 && rstats->convertdone) RE_Database_Free(re); @@ -1002,7 +1004,7 @@ static int render_view3d_changed(RenderEngine *engine, const bContext *C) update |= PR_UPDATE_VIEW; } - render_view3d_get_rects(ar, v3d, rv3d, &viewplane, engine, &clipsta, &clipend, &orth); + render_view3d_get_rects(ar, v3d, rv3d, &viewplane, engine, &clipsta, &clipend, NULL, &orth); RE_GetViewPlane(re, &viewplane1, &disprect1); if (BLI_rctf_compare(&viewplane, &viewplane1, 0.00001f) == 0) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 231f5bc8eb4..e4fe8cb5d34 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -191,7 +191,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) rctf viewplane; float clipsta, clipend; - int is_ortho = ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend); + int is_ortho = ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); if (is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend); else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ee10adbf7db..13049aa5536 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4935,7 +4935,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT); - paint_cursor_start(C, sculpt_poll); + paint_cursor_start(C, sculpt_mode_poll_view3d); } WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index ef29f291a1e..0728e3a4d93 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -688,7 +688,7 @@ bool ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *r_clipsta, /* also exposed in previewrender.c */ bool ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, - rctf *r_viewplane, float *r_clipsta, float *r_clipend) + rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize) { CameraParams params; @@ -699,6 +699,7 @@ bool ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy if (r_viewplane) *r_viewplane = params.viewplane; if (r_clipsta) *r_clipsta = params.clipsta; if (r_clipend) *r_clipend = params.clipend; + if (r_pixsize) *r_pixsize = params.viewdx; return params.is_ortho; } @@ -713,7 +714,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) float clipsta, clipend, x1, y1, x2, y2; int orth; - orth = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend); + orth = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); rv3d->is_persp = !orth; #if 0 -- cgit v1.2.3