This file is indexed.

/usr/share/openscenegraph/examples/osgframerenderer/CameraPathProperty.cpp is in openscenegraph-examples 3.2.1-7ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "CameraPathProperty.h"

using namespace gsc;

void CameraPathProperty::update(osgViewer::View* view)
{
    osg::Camera* camera = view->getCamera();
    osg::FrameStamp* fs = view->getFrameStamp();

    if (_animationPath.valid())
    {
        osg::AnimationPath::ControlPoint cp;
        _animationPath->getInterpolatedControlPoint( fs->getSimulationTime(), cp );

        OSG_NOTICE<<"CameraPathProperty "<<fs->getFrameNumber()<<" "<<fs->getSimulationTime()<<std::endl;

        osg::Matrixd matrix;
        cp.getMatrix( matrix );
        camera->setViewMatrix( osg::Matrix::inverse(matrix) );
    }
}

void CameraPathProperty::loadAnimationPath()
{
    _animationPath = new osg::AnimationPath;;
    //_animationPath->setLoopMode(osg::AnimationPath::LOOP);

    osgDB::ifstream in(_filename.c_str());
    if (!in)
    {
        OSG_WARN << "CameraPathProperty: Cannot open animation path file \"" << _filename << "\".\n";
        return;
    }

    _animationPath->read(in);
}

bool CameraPathProperty::getTimeRange(double& startTime, double& endTime) const
{
    if (!_animationPath) return false;
    
    const osg::AnimationPath::TimeControlPointMap& tcpm = _animationPath->getTimeControlPointMap();
    if (tcpm.empty()) return false;

    startTime = tcpm.begin()->first;
    endTime = tcpm.rbegin()->first;
    
    return true;
}

void CameraPathProperty::resetTimeRange(double startTime, double endTime)
{
    if (!_animationPath) return;

    osg::AnimationPath::TimeControlPointMap& tcpm = _animationPath->getTimeControlPointMap();
    if (tcpm.empty()) return;

    osg::AnimationPath::TimeControlPointMap copy_tcpm = tcpm;

    double offset = tcpm.begin()->first;
    double originalLength = tcpm.rbegin()->first - tcpm.begin()->first ;
    double scale = originalLength>0.0 ? (endTime-startTime)/originalLength : 1.0;

    tcpm.clear();

    for(osg::AnimationPath::TimeControlPointMap::iterator itr = copy_tcpm.begin();
        itr != copy_tcpm.end();
        ++itr)
    {
        tcpm[startTime + (itr->first-offset)*scale] = itr->second;
    }
}

/////////////////////////////////////////////////////////////////////////////////////////
//
// Serialization support
//
REGISTER_OBJECT_WRAPPER( gsc_CameraPathProperty,
                         new gsc::CameraPathProperty,
                         gsc::CameraPathProperty,
                         "osg::Object gsc::CameraPathProperty" )
{
    ADD_STRING_SERIALIZER( AnimationPathFileName, "" );
}