18 #include <Qt3DRender/QCamera>
20 #include <QDomDocument>
24 QDomElement elemCamera = doc.createElement( QStringLiteral(
"camera-pose" ) );
25 elemCamera.setAttribute( QStringLiteral(
"x" ), mCenterPoint.
x() );
26 elemCamera.setAttribute( QStringLiteral(
"y" ), mCenterPoint.
y() );
27 elemCamera.setAttribute( QStringLiteral(
"z" ), mCenterPoint.
z() );
28 elemCamera.setAttribute( QStringLiteral(
"dist" ), mDistanceFromCenterPoint );
29 elemCamera.setAttribute( QStringLiteral(
"pitch" ), mPitchAngle );
30 elemCamera.setAttribute( QStringLiteral(
"heading" ), mHeadingAngle );
36 double x = elem.attribute( QStringLiteral(
"x" ) ).toDouble();
37 double y = elem.attribute( QStringLiteral(
"y" ) ).toDouble();
38 double z = elem.attribute( QStringLiteral(
"z" ) ).toDouble();
41 mDistanceFromCenterPoint = elem.attribute( QStringLiteral(
"dist" ) ).toFloat();
42 mPitchAngle = elem.attribute( QStringLiteral(
"pitch" ) ).toFloat();
43 mHeadingAngle = elem.attribute( QStringLiteral(
"heading" ) ).toFloat();
53 camera->setUpVector( QVector3D( 0, 0, -1 ) );
54 camera->setPosition( QVector3D( mCenterPoint.
x(), mDistanceFromCenterPoint + mCenterPoint.
y(), mCenterPoint.
z() ) );
55 camera->setViewCenter( QVector3D( mCenterPoint.
x(), mCenterPoint.
y(), mCenterPoint.
z() ) );
56 camera->rotateAboutViewCenter( QQuaternion::fromEulerAngles( mPitchAngle, mHeadingAngle, 0 ) );