diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-06 22:46:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-06 22:46:21 +0300 |
commit | b1a05da291d941f8c6597b9a78b52ce802ec1f79 (patch) | |
tree | cd6e3e98a9da6cea1f97b0b6cae66d0accd52942 /source/blender/editors/space_view3d/view3d_view.c | |
parent | c0f56503bf6fcd92a65a8b05466c5093e083c96a (diff) |
re-project: operators for projecting from a view screenshot rather then a camera.
- new mode for projecting an image with the view matrix saved in the image id-properties rather then using the camera matrix.
- operator to screenshot the view and create a new image with the view matrix stored in the image.
these will be used for better re-project integration and are not immediately very useful.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index bcdb0513c4a..be974cf0050 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -920,6 +920,41 @@ int get_view3d_ortho(View3D *v3d, RegionView3D *rv3d) return 0; } +/* copies logic of get_view3d_viewplane(), keep in sync */ +int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) +{ + int orth= 0; + + *clipsta= v3d->near; + *clipend= v3d->far; + + if(rv3d->persp==RV3D_CAMOB) { + if(v3d->camera) { + if(v3d->camera->type==OB_LAMP ) { + Lamp *la= v3d->camera->data; + *clipsta= la->clipsta; + *clipend= la->clipend; + } + else if(v3d->camera->type==OB_CAMERA) { + Camera *cam= v3d->camera->data; + *clipsta= cam->clipsta; + *clipend= cam->clipend; + + if(cam->type==CAM_ORTHO) + orth= 1; + } + } + } + + if(rv3d->persp==RV3D_ORTHO) { + *clipend *= 0.5; // otherwise too extreme low zbuffer quality + *clipsta= - *clipend; + orth= 1; + } + + return orth; +} + /* also exposed in previewrender.c */ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) { |