root/OpenSceneGraph/trunk/src/osgPlugins/fbx/fbxRCamera.cpp @ 13466

Revision 13466, 1.4 kB (checked in by robert, 29 hours ago)

From Alberto Luaces,"the current code uses the preprocessor for generating the plugin path in
a way that when CMAKE_INSTALL_PREFIX contains something along the lines
of

/usr/x86_64-linux-gnu/

it gets substituted as

/usr/x86_64-1-gnu/

that is, the string is preprocessed again, thereby making changes to
anything that matches any defined symbol, as "linux" in this example
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763816).

Quoting that path directly in CMake scripts solves that problem.
"

  • Property svn:eol-style set to native
Line 
1#include <osg/CameraView>
2#include <osg/Notify>
3
4#include <osgDB/ReadFile>
5
6#if defined(_MSC_VER)
7#pragma warning( disable : 4505 )
8#pragma warning( default : 4996 )
9#endif
10#include <fbxsdk.h>
11
12#include "fbxReader.h"
13
14osgDB::ReaderWriter::ReadResult OsgFbxReader::readFbxCamera(FbxNode* pNode)
15{
16    const FbxCamera* fbxCamera = FbxCast<FbxCamera>(pNode->GetNodeAttribute());
17
18    if (!fbxCamera)
19    {
20        return osgDB::ReaderWriter::ReadResult::ERROR_IN_READING_FILE;
21    }
22
23    osg::CameraView* osgCameraView = new osg::CameraView;
24
25    if (fbxCamera->FieldOfView.IsValid())
26    {
27        osgCameraView->setFieldOfView(fbxCamera->FieldOfView.Get());
28    }
29
30    if (fbxCamera->FocalLength.IsValid())
31    {
32        osgCameraView->setFocalLength(fbxCamera->FocalLength.Get());
33    }
34
35    if (fbxCamera->ApertureMode.IsValid())
36    {
37        switch (fbxCamera->ApertureMode.Get())
38        {
39        case FbxCamera::eHorizontal:
40            osgCameraView->setFieldOfViewMode(osg::CameraView::HORIZONTAL);
41            break;
42        case FbxCamera::eVertical:
43            osgCameraView->setFieldOfViewMode(osg::CameraView::VERTICAL);
44            break;
45        case FbxCamera::eHorizAndVert:
46        case FbxCamera::eFocalLength:
47        default:
48            OSG_WARN << "readFbxCamera: Unsupported Camera aperture mode." << std::endl;
49            break;
50        }
51    }
52
53    return osgDB::ReaderWriter::ReadResult(osgCameraView);
54}
Note: See TracBrowser for help on using the browser.