diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-03-06 18:19:35 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-03-06 18:19:45 +0300 |
commit | eb522af4fec58876ac1b0a73ad9bcdae2d82d33f (patch) | |
tree | 485c6a1fb23b5be256757375e2157378d3a5c61b /source/blender/collada/CameraExporter.cpp | |
parent | ff60dd8b18ed00902e5bdfd36882072db7af8735 (diff) |
Cleanup: move Alembic, AVI, Collada, and USD to `source/blender/io`
This moves the `alembic`, `avi`, `collada`, and `usd` modules into a common
`io` directory.
This also cleans up some `#include "../../{somedir}/{somefile}.h"` by
adding `../../io/{somedir}` to `CMakeLists.txt` and then just using
`#include "{somefile}.h"`.
No functional changes.
Diffstat (limited to 'source/blender/collada/CameraExporter.cpp')
-rw-r--r-- | source/blender/collada/CameraExporter.cpp | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp deleted file mode 100644 index 74862c44270..00000000000 --- a/source/blender/collada/CameraExporter.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/** \file - * \ingroup collada - */ - -#include <string> - -#include "COLLADASWCamera.h" - -extern "C" { -#include "DNA_camera_types.h" -} -#include "CameraExporter.h" - -#include "collada_internal.h" - -CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, BCExportSettings &export_settings) - : COLLADASW::LibraryCameras(sw), export_settings(export_settings) -{ -} - -template<class Functor> -void forEachCameraObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set) -{ - LinkNode *node; - for (node = export_set; node; node = node->next) { - Object *ob = (Object *)node->link; - - if (ob->type == OB_CAMERA && ob->data) { - f(ob, sce); - } - } -} - -void CamerasExporter::exportCameras(Scene *sce) -{ - openLibrary(); - - forEachCameraObjectInExportSet(sce, *this, this->export_settings.get_export_set()); - - closeLibrary(); -} -void CamerasExporter::operator()(Object *ob, Scene *sce) -{ - Camera *cam = (Camera *)ob->data; - std::string cam_id(get_camera_id(ob)); - std::string cam_name(id_name(cam)); - - switch (cam->type) { - case CAM_PANO: - case CAM_PERSP: { - 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->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); - - break; - } - case CAM_ORTHO: - default: { - 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->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); - break; - } - } -} -bool CamerasExporter::exportBlenderProfile(COLLADASW::Camera &cm, Camera *cam) -{ - cm.addExtraTechniqueParameter("blender", "shiftx", cam->shiftx); - cm.addExtraTechniqueParameter("blender", "shifty", cam->shifty); - cm.addExtraTechniqueParameter("blender", "dof_distance", cam->dof.focus_distance); - return true; -} |