diff options
Diffstat (limited to 'source/blender')
34 files changed, 127 insertions, 137 deletions
diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc index 5ca0c36eefe..b1ba3f92fc7 100644 --- a/source/blender/alembic/intern/abc_camera.cc +++ b/source/blender/alembic/intern/abc_camera.cc @@ -73,8 +73,8 @@ void AbcCameraWriter::do_write() m_camera_sample.setVerticalAperture(apperture_y); m_camera_sample.setHorizontalFilmOffset(apperture_x * cam->shiftx); m_camera_sample.setVerticalFilmOffset(apperture_y * cam->shifty * film_aspect); - m_camera_sample.setNearClippingPlane(cam->clipsta); - m_camera_sample.setFarClippingPlane(cam->clipend); + m_camera_sample.setNearClippingPlane(cam->clip_start); + m_camera_sample.setFarClippingPlane(cam->clip_end); if (cam->dof_ob) { Imath::V3f v(m_object->loc[0] - cam->dof_ob->loc[0], @@ -159,8 +159,8 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_ bcam->sensor_y = apperture_y * 10; bcam->shiftx = h_film_offset / apperture_x; bcam->shifty = v_film_offset / apperture_y / film_aspect; - bcam->clipsta = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane())); - bcam->clipend = static_cast<float>(cam_sample.getFarClippingPlane()); + bcam->clip_start = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane())); + bcam->clip_end = static_cast<float>(cam_sample.getFarClippingPlane()); bcam->gpu_dof.focus_distance = static_cast<float>(cam_sample.getFocusDistance()); bcam->gpu_dof.fstop = static_cast<float>(cam_sample.getFStop()); diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 40a81625ecf..29d7b5ae6e2 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -80,8 +80,8 @@ typedef struct CameraParams { int sensor_fit; /* clipping */ - float clipsta; - float clipend; + float clip_start; + float clip_end; /* computed viewplane */ float ycor; diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index e11a0b327ba..81ec6e7ba95 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -58,8 +58,8 @@ void BKE_camera_init(Camera *cam) cam->lens = 50.0f; cam->sensor_x = DEFAULT_SENSOR_WIDTH; cam->sensor_y = DEFAULT_SENSOR_HEIGHT; - cam->clipsta = 0.1f; - cam->clipend = 1000.0f; + cam->clip_start = 0.1f; + cam->clip_end = 1000.0f; cam->drawsize = 1.0f; cam->ortho_scale = 6.0; cam->flag |= CAM_SHOWPASSEPARTOUT; @@ -171,8 +171,8 @@ void BKE_camera_params_init(CameraParams *params) params->zoom = 1.0f; /* fallback for non camera objects */ - params->clipsta = 0.1f; - params->clipend = 100.0f; + params->clip_start = 0.1f; + params->clip_end = 100.0f; } void BKE_camera_params_from_object(CameraParams *params, const Object *ob) @@ -196,8 +196,8 @@ void BKE_camera_params_from_object(CameraParams *params, const Object *ob) params->sensor_y = cam->sensor_y; params->sensor_fit = cam->sensor_fit; - params->clipsta = cam->clipsta; - params->clipend = cam->clipend; + params->clip_start = cam->clip_start; + params->clip_end = cam->clip_end; } else if (ob->type == OB_LAMP) { /* lamp object */ @@ -206,8 +206,8 @@ void BKE_camera_params_from_object(CameraParams *params, const Object *ob) if (params->lens == 0.0f) params->lens = 35.0f; - params->clipsta = la->clipsta; - params->clipend = la->clipend; + params->clip_start = la->clipsta; + params->clip_end = la->clipend; } else { params->lens = 35.0f; @@ -218,8 +218,8 @@ void BKE_camera_params_from_view3d(CameraParams *params, Depsgraph *depsgraph, c { /* common */ params->lens = v3d->lens; - params->clipsta = v3d->near; - params->clipend = v3d->far; + params->clip_start = v3d->clip_start; + params->clip_end = v3d->clip_end; if (rv3d->persp == RV3D_CAMOB) { /* camera view */ @@ -239,8 +239,8 @@ void BKE_camera_params_from_view3d(CameraParams *params, Depsgraph *depsgraph, c else if (rv3d->persp == RV3D_ORTHO) { /* orthographic view */ float sensor_size = BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y); - params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality - params->clipsta = -params->clipend; + params->clip_end *= 0.5f; // otherwise too extreme low zbuffer quality + params->clip_start = -params->clip_start; params->is_ortho = true; /* make sure any changes to this match ED_view3d_radius_to_dist_ortho() */ @@ -269,7 +269,7 @@ void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int win else { /* perspective camera */ sensor_size = BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y); - pixsize = (sensor_size * params->clipsta) / params->lens; + pixsize = (sensor_size * params->clip_start) / params->lens; } /* determine sensor fit */ @@ -323,10 +323,10 @@ void BKE_camera_params_compute_matrix(CameraParams *params) /* compute projection matrix */ if (params->is_ortho) orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax, - viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); + viewplane.ymin, viewplane.ymax, params->clip_start, params->clip_end); else perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax, - viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); + viewplane.ymin, viewplane.ymax, params->clip_start, params->clip_end); } /***************************** Camera View Frame *****************************/ @@ -364,12 +364,12 @@ void BKE_camera_view_frame_ex( facy = 0.5f * camera->ortho_scale * r_asp[1] * scale[1]; r_shift[0] = camera->shiftx * camera->ortho_scale * scale[0]; r_shift[1] = camera->shifty * camera->ortho_scale * scale[1]; - depth = do_clip ? -((camera->clipsta * scale[2]) + 0.1f) : -drawsize * scale[2]; + depth = do_clip ? -((camera->clip_start * scale[2]) + 0.1f) : -drawsize * scale[2]; *r_drawsize = 0.5f * camera->ortho_scale; } else { - /* that way it's always visible - clipsta+0.1 */ + /* that way it's always visible - clip_start+0.1 */ float fac, scale_x, scale_y; float half_sensor = 0.5f * ((camera->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (camera->sensor_y) : (camera->sensor_x)); @@ -379,7 +379,7 @@ void BKE_camera_view_frame_ex( /* fixed depth, variable size (avoids exceeding clipping range) */ /* r_drawsize shouldn't be used in this case, set to dummy value */ *r_drawsize = 1.0f; - depth = -(camera->clipsta + 0.1f) * scale[2]; + depth = -(camera->clip_start + 0.1f) * scale[2]; fac = depth / (camera->lens / (-half_sensor)); scale_x = scale[0] / scale[2]; scale_y = scale[1] / scale[2]; @@ -536,7 +536,7 @@ static bool camera_frame_fit_calc_from_data( zero_v3(r_co); madd_v3_v3fl(r_co, cam_axis_x, (dists[2] - dists[0]) * 0.5f + params->shiftx * scale_diff); madd_v3_v3fl(r_co, cam_axis_y, (dists[1] - dists[3]) * 0.5f + params->shifty * scale_diff); - madd_v3_v3fl(r_co, cam_axis_z, -(data->dist_to_cam - 1.0f - params->clipsta)); + madd_v3_v3fl(r_co, cam_axis_z, -(data->dist_to_cam - 1.0f - params->clip_start)); return true; } diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index ebb49919ce6..314aaaf4fdc 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -50,9 +50,6 @@ #undef rct1 #undef rct2 -#define near clipsta -#define far clipend - #undef small // These definitions are also in BLI_math for simplicity diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index 8a327e01651..b83f6a456ba 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -66,8 +66,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) COLLADASW::PerspectiveOptic persp(mSW); persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov"); persp.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio"); - persp.setZFar(cam->clipend, false, "zfar"); - persp.setZNear(cam->clipsta, false, "znear"); + persp.setZFar(cam->clip_end, false, "zfar"); + persp.setZNear(cam->clip_start, false, "znear"); COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name); exportBlenderProfile(ccam, cam); addCamera(ccam); @@ -80,8 +80,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) COLLADASW::OrthographicOptic ortho(mSW); ortho.setXMag(cam->ortho_scale / 2, "xmag"); ortho.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio"); - ortho.setZFar(cam->clipend, false, "zfar"); - ortho.setZNear(cam->clipsta, false, "znear"); + ortho.setZFar(cam->clip_end, false, "zfar"); + ortho.setZNear(cam->clip_start, false, "znear"); COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); exportBlenderProfile(ccam, cam); addCamera(ccam); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a6a87cb7f32..057a321f03d 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -838,8 +838,8 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) et->setData("shifty",&(cam->shifty)); et->setData("dof_distance",&(cam->dof_distance)); } - cam->clipsta = camera->getNearClippingPlane().getValue(); - cam->clipend = camera->getFarClippingPlane().getValue(); + cam->clip_start = camera->getNearClippingPlane().getValue(); + cam->clip_end = camera->getFarClippingPlane().getValue(); COLLADAFW::Camera::CameraType type = camera->getCameraType(); switch (type) { diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 880885a1efb..d693e9cbd08 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -89,8 +89,8 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v Camera *cam = (Camera *)camera->data; /* Retrieve Near and Far distance */ - effects->dof_near_far[0] = -cam->clipsta; - effects->dof_near_far[1] = -cam->clipend; + effects->dof_near_far[0] = -cam->clip_start; + effects->dof_near_far[1] = -cam->clip_end; int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2}; diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 4d62d1bceb9..7d35b931786 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -187,8 +187,8 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata) params.offsety = 0.0f; params.shiftx = 0.0f; params.shifty = 0.0f; - params.clipsta = 0.001f; - params.clipend = 20.0f; + params.clip_start = 0.001f; + params.clip_end = 20.0f; BKE_camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, aspect[0], aspect[1]); BKE_camera_params_compute_matrix(¶ms); diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index d5e9348e29a..25677a523e6 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -256,8 +256,8 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) wpd->dof_distance = -focus_dist; wpd->dof_invsensorsize = full_size[0] / sensor_scaled; - wpd->dof_near_far[0] = -cam->clipsta; - wpd->dof_near_far[1] = -cam->clipend; + wpd->dof_near_far[0] = -cam->clip_start; + wpd->dof_near_far[1] = -cam->clip_end; float blades = cam->gpu_dof.num_blades; float rotation = cam->gpu_dof.rotation; diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index cf3c3267ac4..7e9dde4f210 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -616,10 +616,10 @@ static void OBJECT_engine_init(void *vedata) float dist; if (rv3d->persp == RV3D_CAMOB && v3d->camera && v3d->camera->type == OB_CAMERA) { Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); - dist = ((Camera *)(camera_object->data))->clipend; + dist = ((Camera *)(camera_object->data))->clip_end; } else { - dist = v3d->far; + dist = v3d->clip_end; } e_data.grid_settings[0] = dist / 2.0f; /* gridDistance */ @@ -1915,10 +1915,10 @@ static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLay DRW_shgroup_call_dynamic_add( sgl->camera_clip, color, - &cam->clipsta, &cam->clipend, cam->runtime.drw_normalmat); + &cam->clip_start, &cam->clip_end, cam->runtime.drw_normalmat); DRW_shgroup_call_dynamic_add( sgl->camera_clip_points, (is_active ? col_hi : col), - &cam->clipsta, &cam->clipend, cam->runtime.drw_normalmat); + &cam->clip_start, &cam->clip_end, cam->runtime.drw_normalmat); } if (cam->flag & CAM_SHOWMIST) { diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 4069a6a9fcf..649b4c7f911 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -315,14 +315,16 @@ static void gp_render_offscreen(tGPDfill *tgpf) ImBuf *ibuf = IMB_allocImBuf(tgpf->sizex, tgpf->sizey, 32, flag); rctf viewplane; - float clipsta, clipend; + float clip_start, clip_end; - is_ortho = ED_view3d_viewplane_get(tgpf->depsgraph, tgpf->v3d, tgpf->rv3d, tgpf->sizex, tgpf->sizey, &viewplane, &clipsta, &clipend, NULL); + is_ortho = ED_view3d_viewplane_get( + tgpf->depsgraph, tgpf->v3d, tgpf->rv3d, tgpf->sizex, tgpf->sizey, + &viewplane, &clip_start, &clip_end, NULL); if (is_ortho) { - orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend); + orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clip_end, clip_end); } else { - perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); + perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clip_start, clip_end); } /* set temporary new size */ diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 814c1581f77..3f2ad33ed8c 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1448,7 +1448,7 @@ static bool point_is_visible( /* avoid projecting behind the viewpoint */ if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) { - dist = kcd->vc.v3d->far * 2.0f; + dist = kcd->vc.v3d->clip_end * 2.0f; } if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) { diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index d87b6c860ba..cd0023eaced 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -166,7 +166,7 @@ BLI_INLINE unsigned char f_to_char(const float val) #define PROJ_SRC_VIEW_FILL 4 #define PROJ_VIEW_DATA_ID "view_data" -/* viewmat + winmat + clipsta + clipend + is_ortho */ +/* viewmat + winmat + clip_start + clip_end + is_ortho */ #define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3) #define PROJ_BUCKET_NULL 0 @@ -337,7 +337,7 @@ typedef struct ProjPaintState { float viewDir[3]; /** View location in object relative 3D space, so can compare to verts. */ float viewPos[3]; - float clipsta, clipend; + float clip_start, clip_end; /* reproject vars */ Image *reproject_image; @@ -3254,7 +3254,7 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet ED_view3d_ob_project_mat_get_from_obmat(ps->rv3d, ps->obmat, ps->projectMat); - ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend, true); + ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clip_start, &ps->clip_end, true); } else { /* re-projection */ @@ -3274,8 +3274,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet /* use image array, written when creating image */ memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat) / sizeof(float); memcpy(viewmat, array, sizeof(viewmat)); array += sizeof(viewmat) / sizeof(float); - ps->clipsta = array[0]; - ps->clipend = array[1]; + ps->clip_start = array[0]; + ps->clip_end = array[1]; ps->is_ortho = array[2] ? 1 : 0; invert_m4_m4(viewinv, viewmat); @@ -3296,8 +3296,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet BKE_camera_params_compute_matrix(¶ms); copy_m4_m4(winmat, params.winmat); - ps->clipsta = params.clipsta; - ps->clipend = params.clipend; + ps->clip_start = params.clip_start; + ps->clip_end = params.clip_end; ps->is_ortho = params.is_ortho; } else { @@ -3358,7 +3358,7 @@ static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int di mul_m4_v4(ps->projectMat, projScreenCo); - if (projScreenCo[3] > ps->clipsta) { + if (projScreenCo[3] > ps->clip_start) { /* screen space, not clamped */ projScreenCo[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0] / projScreenCo[3]; projScreenCo[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1] / projScreenCo[3]; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 9ddd5c2d2aa..51715fae20e 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -436,24 +436,24 @@ static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rectx, int recty, float *rect_float, float zoomx, float zoomy) { - float bias, scale, *rectf, clipend; + float bias, scale, *rectf, clip_end; int a; float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; if (scene->camera && scene->camera->type == OB_CAMERA) { - bias = ((Camera *)scene->camera->data)->clipsta; - clipend = ((Camera *)scene->camera->data)->clipend; - scale = 1.0f / (clipend - bias); + bias = ((Camera *)scene->camera->data)->clip_start; + clip_end = ((Camera *)scene->camera->data)->clip_end; + scale = 1.0f / (clip_end - bias); } else { bias = 0.1f; scale = 0.01f; - clipend = 100.0f; + clip_end = 100.0f; } rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp"); for (a = rectx * recty - 1; a >= 0; a--) { - if (rect_float[a] > clipend) + if (rect_float[a] > clip_end) rectf[a] = 0.0f; else if (rect_float[a] < bias) rectf[a] = 1.0f; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 7648a67da8b..f0f80cf2bee 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -338,8 +338,8 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene) v3d->flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION; v3d->lens = 50.0f; - v3d->near = 0.01f; - v3d->far = 1000.0f; + v3d->clip_start = 0.01f; + v3d->clip_end = 1000.0f; v3d->overlay.gpencil_paper_opacity = 0.5f; v3d->overlay.gpencil_grid_opacity = 0.9f; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a8a6187a347..428e7e7a76e 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -312,8 +312,8 @@ static void view3d_camera_border( /* get camera viewplane */ BKE_camera_params_init(¶ms); /* fallback for non camera objects */ - params.clipsta = v3d->near; - params.clipend = v3d->far; + params.clip_start = v3d->clip_start; + params.clip_end = v3d->clip_end; BKE_camera_params_from_object(¶ms, camera_eval); if (no_shift) { params.shiftx = 0.0f; @@ -1517,8 +1517,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( BKE_camera_params_init(¶ms); /* fallback for non camera objects */ - params.clipsta = v3d->near; - params.clipend = v3d->far; + params.clip_start = v3d->clip_start; + params.clip_end = v3d->clip_end; BKE_camera_params_from_object(¶ms, camera_eval); BKE_camera_multiview_params(&scene->r, ¶ms, camera_eval, viewname); BKE_camera_params_compute_viewplane(¶ms, sizex, sizey, scene->r.xasp, scene->r.yasp); @@ -1531,14 +1531,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( } else { rctf viewplane; - float clipsta, clipend; + float clip_start, clipend; - is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); + is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clip_start, &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); + perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clip_start, clipend); } } @@ -1705,8 +1705,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( BKE_camera_params_compute_matrix(¶ms); copy_m4_m4(rv3d.winmat, params.winmat); - v3d.near = params.clipsta; - v3d.far = params.clipend; + v3d.clip_start = params.clip_start; + v3d.clip_end = params.clip_end; v3d.lens = params.lens; } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 4e04de36dfd..6994b048698 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2639,7 +2639,7 @@ static void view3d_from_minmax( new_dist = ED_view3d_radius_to_dist(v3d, ar, CTX_data_depsgraph(C), persp, true, (size / 2) * VIEW3D_MARGIN); if (rv3d->is_persp) { /* don't zoom closer than the near clipping plane */ - new_dist = max_ff(new_dist, v3d->near * 1.5f); + new_dist = max_ff(new_dist, v3d->clip_start * 1.5f); } } } @@ -3438,7 +3438,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) new_dist = len_v3(dvec); /* ignore dist_range min */ - dist_range[0] = v3d->near * 1.5f; + dist_range[0] = v3d->clip_start * 1.5f; } else { /* othographic */ /* find the current window width and height */ diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index baee99663bd..b22f4edcba5 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -321,7 +321,7 @@ static void view3d_win_to_ray_segment( ED_view3d_win_to_vector(ar, mval, r_ray_dir); if ((rv3d->is_persp == false) && (rv3d->persp != RV3D_CAMOB)) { - end_offset = v3d->far / 2.0f; + end_offset = v3d->clip_end / 2.0f; start_offset = -end_offset; } else { diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index 08eceb8ebc3..7c49ea061cc 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -114,7 +114,7 @@ void ED_view3d_dist_range_get( float r_dist_range[2]) { r_dist_range[0] = v3d->grid * 0.001f; - r_dist_range[1] = v3d->far * 10.0f; + r_dist_range[1] = v3d->clip_end * 10.0f; } /** @@ -132,13 +132,13 @@ bool ED_view3d_clip_range_get( BKE_camera_params_from_view3d(¶ms, depsgraph, v3d, rv3d); if (use_ortho_factor && params.is_ortho) { - const float fac = 2.0f / (params.clipend - params.clipsta); - params.clipsta *= fac; - params.clipend *= fac; + const float fac = 2.0f / (params.clip_end - params.clip_start); + params.clip_start *= fac; + params.clip_end *= fac; } - if (r_clipsta) *r_clipsta = params.clipsta; - if (r_clipend) *r_clipend = params.clipend; + if (r_clipsta) *r_clipsta = params.clip_start; + if (r_clipend) *r_clipend = params.clip_end; return params.is_ortho; } @@ -146,7 +146,7 @@ bool ED_view3d_clip_range_get( bool ED_view3d_viewplane_get( Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, int winx, int winy, - rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize) + rctf *r_viewplane, float *r_clip_start, float *r_clip_end, float *r_pixsize) { CameraParams params; @@ -155,8 +155,8 @@ bool ED_view3d_viewplane_get( BKE_camera_params_compute_viewplane(¶ms, winx, winy, 1.0f, 1.0f); if (r_viewplane) *r_viewplane = params.viewplane; - if (r_clipsta) *r_clipsta = params.clipsta; - if (r_clipend) *r_clipend = params.clipend; + if (r_clip_start) *r_clip_start = params.clip_start; + if (r_clip_end) *r_clip_end = params.clip_end; if (r_pixsize) *r_pixsize = params.viewdx; return params.is_ortho; @@ -1090,8 +1090,8 @@ float ED_view3d_radius_to_dist( if (persp == RV3D_CAMOB) { CameraParams params; BKE_camera_params_init(¶ms); - params.clipsta = v3d->near; - params.clipend = v3d->far; + params.clip_start = v3d->clip_start; + params.clip_end = v3d->clip_end; Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera); BKE_camera_params_from_object(¶ms, camera_eval); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index da12c6357d6..aa2867390ba 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1233,7 +1233,7 @@ static bool view3d_localview_init( if (rv3d->persp == RV3D_PERSP) { /* Don't zoom closer than the near clipping plane. */ - dist_new = max_ff(dist_new, v3d->near * 1.5f); + dist_new = max_ff(dist_new, v3d->clip_start * 1.5f); } } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index bcd6ae8426e..7e479217997 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1261,7 +1261,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) float fac = 1.0f + 0.005f *(event->y - event->prevy); t->prop_size *= fac; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) { - t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->far), T_PROP_SIZE_MIN); + t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->clip_end), T_PROP_SIZE_MIN); } else { t->prop_size = max_ff(min_ff(t->prop_size, T_PROP_SIZE_MAX), T_PROP_SIZE_MIN); @@ -1275,7 +1275,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) if (t->flag & T_PROP_EDIT) { t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) { - t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far); + t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end); } else { t->prop_size = min_ff(t->prop_size, T_PROP_SIZE_MAX); @@ -1465,7 +1465,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f; if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far); + t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end); calculatePropRatio(t); t->redraw = TREDRAW_HARD; handled = true; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index b0ce411ca23..239b18cba2b 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -167,7 +167,7 @@ static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3]) { if (t->spacetype == SPACE_VIEW3D) { // View3D *v3d = t->sa->spacedata.first; - const float min_dist = 1.0f; /* v3d->near; */ + const float min_dist = 1.0f; /* v3d->clip_start; */ float dir[3]; float l; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 20d3245779e..6e6bd4e13dd 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1142,7 +1142,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis GPU_matrix_push(); copy_v3_v3(v3, dir); - mul_v3_fl(v3, v3d->far); + mul_v3_fl(v3, v3d->clip_end); sub_v3_v3v3(v2, center, v3); add_v3_v3v3(v1, center, v3); diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index a409810373e..95743c80e68 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -59,18 +59,18 @@ NodeGroup *BlenderFileLoader::Load() _viewplane_bottom = _re->viewplane.ymin; _viewplane_top = _re->viewplane.ymax; - if (_re->clipsta < 0.f) { + if (_re->clip_start < 0.f) { // Adjust clipping start/end and set up a Z offset when the viewport preview - // is used with the orthographic view. In this case, _re->clipsta is negative, + // is used with the orthographic view. In this case, _re->clip_start is negative, // while Freestyle assumes that imported mesh data are in the camera coordinate // system with the view point located at origin [bug #36009]. _z_near = -0.001f; - _z_offset = _re->clipsta + _z_near; - _z_far = -_re->clipend + _z_offset; + _z_offset = _re->clip_start + _z_near; + _z_far = -_re->clip_end + _z_offset; } else { - _z_near = -_re->clipsta; - _z_far = -_re->clipend; + _z_near = -_re->clip_start; + _z_far = -_re->clip_end; _z_offset = 0.f; } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 8a7cbd097be..d1d154e9abe 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -147,11 +147,11 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str Camera *camera = (Camera *)object_camera->data; camera->type = CAM_ORTHO; camera->ortho_scale = max(re->rectx, re->recty); - camera->clipsta = 0.1f; - camera->clipend = 100.0f; + camera->clip_start = 0.1f; + camera->clip_end = 100.0f; _z_delta = 0.00001f; - _z = camera->clipsta + _z_delta; + _z = camera->clip_start + _z_delta; object_camera->loc[0] = re->disprect.xmin + 0.5f * re->rectx; object_camera->loc[1] = re->disprect.ymin + 0.5f * re->recty; @@ -872,11 +872,11 @@ Object *BlenderStrokeRenderer::NewMesh() const Render *BlenderStrokeRenderer::RenderScene(Render * /*re*/, bool render) { Camera *camera = (Camera *)freestyle_scene->camera->data; - if (camera->clipend < _z) - camera->clipend = _z + _z_delta * 100.0f; + if (camera->clip_end < _z) + camera->clip_end = _z + _z_delta * 100.0f; #if 0 if (G.debug & G_DEBUG_FREESTYLE) { - cout << "clipsta " << camera->clipsta << ", clipend " << camera->clipend << endl; + cout << "clip_start " << camera->clip_start << ", clip_end " << camera->clip_end << endl; } #endif diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index f73f3dc8def..f88cb4cce3f 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -86,7 +86,7 @@ typedef struct Camera { char dtx; short flag; float passepartalpha; - float clipsta, clipend; + float clip_start, clip_end; float lens, ortho_scale, drawsize; float sensor_x, sensor_y; float shiftx, shifty; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 633a9dd07b5..106328aa31f 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -44,15 +44,6 @@ struct wmTimer; #include "DNA_movieclip_types.h" #include "DNA_gpu_types.h" -/* ******************************** */ - -/* The near/far thing is a Win EXCEPTION, caused by indirect includes from <windows.h>. - * Thus, leave near/far in the code, and undef for windows. */ -#ifdef _WIN32 -# undef near -# undef far -#endif - typedef struct RegionView3D { /** GL_PROJECTION matrix. */ @@ -275,7 +266,7 @@ typedef struct View3D { int flag2; float lens, grid; - float near, far; + float clip_start, clip_end; float ofs[3] DNA_DEPRECATED; char _pad[4]; diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index 6ae1d17a64f..62752d6693a 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -44,6 +44,10 @@ DNA_STRUCT_RENAME(SpaceButs, SpaceProperties) DNA_STRUCT_RENAME(SpaceIpo, SpaceGraph) DNA_STRUCT_RENAME(SpaceOops, SpaceOutliner) DNA_STRUCT_RENAME_ELEM(Camera, YF_dofdist, dof_distance) +DNA_STRUCT_RENAME_ELEM(Camera, clipend, clip_end) +DNA_STRUCT_RENAME_ELEM(Camera, clipsta, clip_start) +DNA_STRUCT_RENAME_ELEM(View3D, far, clip_end) +DNA_STRUCT_RENAME_ELEM(View3D, near, clip_start) #if 0 DNA_STRUCT_RENAME(Lamp, Light) diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index aaae5c35c20..0f285d56571 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -447,7 +447,6 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "clipsta"); RNA_def_property_float_default(prop, 0.1f); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); @@ -455,7 +454,6 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "clipend"); RNA_def_property_float_default(prop, 1000.0f); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 3b012581f23..9a38cff54f7 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3133,7 +3133,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "near"); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); RNA_def_property_float_default(prop, 0.1f); @@ -3141,7 +3140,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "far"); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); RNA_def_property_float_default(prop, 1000.0f); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index e4289bd48c5..5fe5c557855 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -241,8 +241,8 @@ void RE_ChangeModeFlag(struct Render *re, int flag, bool clear); struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */ void RE_SetOverrideCamera(struct Render *re, struct Object *camera); void RE_SetCamera(struct Render *re, struct Object *camera); -void RE_SetWindow(struct Render *re, const rctf *viewplane, float clipsta, float clipend); -void RE_SetOrtho(struct Render *re, const rctf *viewplane, float clipsta, float clipend); +void RE_SetWindow(struct Render *re, const rctf *viewplane, float clip_start, float clip_end); +void RE_SetOrtho(struct Render *re, const rctf *viewplane, float clip_start, float clip_end); /* option to set viewmatrix before making dbase */ void RE_SetView(struct Render *re, float mat[4][4]); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 17a1e486307..35ae4534d85 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -99,8 +99,8 @@ struct Render { float winmat[4][4]; /* clippping */ - float clipsta; - float clipend; + float clip_start; + float clip_end; /* main, scene, and its full copy of renderdata and world */ struct Main *main; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index fde77d7fa19..ba1d796dbbd 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -146,8 +146,8 @@ static void re_camera_params_get(Render *re, CameraParams *params) { copy_m4_m4(re->winmat, params->winmat); - re->clipsta = params->clipsta; - re->clipend = params->clipend; + re->clip_start = params->clip_start; + re->clip_end = params->clip_end; re->viewplane = params->viewplane; } @@ -193,8 +193,8 @@ void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float ov { CameraParams params; params.is_ortho = re->winmat[3][3] != 0.0f; - params.clipsta = re->clipsta; - params.clipend = re->clipend; + params.clip_start = re->clip_start; + params.clip_end = re->clip_end; params.viewplane = re->viewplane; overscan *= max_ff(BLI_rctf_size_x(¶ms.viewplane), BLI_rctf_size_y(¶ms.viewplane)); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 75e31b6d3a9..a1635e9ec6c 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -928,31 +928,31 @@ void render_update_anim_renderdata(Render *re, RenderData *rd, ListBase *render_ BLI_duplicatelist(&re->r.views, &rd->views); } -void RE_SetWindow(Render *re, const rctf *viewplane, float clipsta, float clipend) +void RE_SetWindow(Render *re, const rctf *viewplane, float clip_start, float clip_end) { /* re->ok flag? */ re->viewplane = *viewplane; - re->clipsta = clipsta; - re->clipend = clipend; + re->clip_start = clip_start; + re->clip_end = clip_end; perspective_m4(re->winmat, re->viewplane.xmin, re->viewplane.xmax, - re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend); + re->viewplane.ymin, re->viewplane.ymax, re->clip_start, re->clip_end); } -void RE_SetOrtho(Render *re, const rctf *viewplane, float clipsta, float clipend) +void RE_SetOrtho(Render *re, const rctf *viewplane, float clip_start, float clip_end) { /* re->ok flag? */ re->viewplane = *viewplane; - re->clipsta = clipsta; - re->clipend = clipend; + re->clip_start = clip_start; + re->clip_end = clip_end; orthographic_m4(re->winmat, re->viewplane.xmin, re->viewplane.xmax, - re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend); + re->viewplane.ymin, re->viewplane.ymax, re->clip_start, re->clip_end); } void RE_GetViewPlane(Render *re, rctf *r_viewplane, rcti *r_disprect) |