QCamera Class

class Qt3DRender::QCamera

QCameraクラスは、シーンがレンダリングされるビューポイントを定義します。詳細...

ヘッダー #include <Qt3DRender/QCamera>
CMake.QCameraクラス find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake QT += 3drender
QML で Camera
を継承しています: Qt3DCore::QEntity
ステータス非推奨

パブリックな型

enum CameraTranslationOption { TranslateViewCenter, DontTranslateViewCenter }

プロパティ

パブリック機能

QCamera(Qt3DCore::QNode *parent = nullptr)
float aspectRatio() const
float bottom() const
float exposure() const
float farPlane() const
float fieldOfView() const
float left() const
Qt3DRender::QCameraLens *lens() const
float nearPlane() const
void pan(float angle)
void pan(float angle, const QVector3D &axis)
void panAboutViewCenter(float angle)
void panAboutViewCenter(float angle, const QVector3D &axis)
QQuaternion panRotation(float angle) const
QVector3D position() const
QMatrix4x4 projectionMatrix() const
Qt3DRender::QCameraLens::ProjectionType projectionType() const
float right() const
void roll(float angle)
void rollAboutViewCenter(float angle)
QQuaternion rollRotation(float angle) const
void rotate(const QQuaternion &q)
void rotateAboutViewCenter(const QQuaternion &q)
QQuaternion rotation(float angle, const QVector3D &axis) const
void tilt(float angle)
void tiltAboutViewCenter(float angle)
QQuaternion tiltRotation(float angle) const
float top() const
Qt3DCore::QTransform *transform() const
void translate(const QVector3D &vLocal, Qt3DRender::QCamera::CameraTranslationOption option = TranslateViewCenter)
void translateWorld(const QVector3D &vWorld, Qt3DRender::QCamera::CameraTranslationOption option = TranslateViewCenter)
QVector3D upVector() const
QVector3D viewCenter() const
QVector3D viewVector() const

パブリックスロット

void setAspectRatio(float aspectRatio)
void setBottom(float bottom)
void setExposure(float exposure)
void setFarPlane(float farPlane)
void setFieldOfView(float fieldOfView)
void setLeft(float left)
void setNearPlane(float nearPlane)
void setPosition(const QVector3D &position)
void setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
void setProjectionType(Qt3DRender::QCameraLens::ProjectionType type)
void setRight(float right)
void setTop(float top)
void setUpVector(const QVector3D &upVector)
void setViewCenter(const QVector3D &viewCenter)
void viewAll()
void viewEntity(Qt3DCore::QEntity *entity)
void viewSphere(const QVector3D &center, float radius)

シグナル

void aspectRatioChanged(float aspectRatio)
void bottomChanged(float bottom)
void exposureChanged(float exposure)
void farPlaneChanged(float farPlane)
void fieldOfViewChanged(float fieldOfView)
void leftChanged(float left)
void nearPlaneChanged(float nearPlane)
void positionChanged(const QVector3D &position)
void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix)
void projectionTypeChanged(Qt3DRender::QCameraLens::ProjectionType projectionType)
void rightChanged(float right)
void topChanged(float top)
void upVectorChanged(const QVector3D &upVector)
void viewCenterChanged(const QVector3D &viewCenter)
void viewVectorChanged(const QVector3D &viewVector)

詳細説明

メンバー型ドキュメント

enum QCamera::CameraTranslationOption

この列挙型は、カメラビューの中心がどのように変換されるかを指定します。

定数説明
Qt3DRender::QCamera::TranslateViewCenter0ビューセンターを平行移動し、ビューの方向が変わらないようにします。
Qt3DRender::QCamera::DontTranslateViewCenter1ビューの方向を変更するビューの中心を変換しない

プロパティの説明

aspectRatio : float

現在のアスペクト比を保持します。

アクセス機能

float aspectRatio() const
void setAspectRatio(float aspectRatio)

通知信号:

void aspectRatioChanged(float aspectRatio)

bottom : float

カメラの現在の底面を保持する。

このプロパティは、projectionTypeQCameraLens::OrthographicProjection の場合にのみ関連します。

アクセス関数:

float bottom() const
void setBottom(float bottom)

通知シグナル:

void bottomChanged(float bottom)

exposure : float

カメラの現在の露出を保持します。

デフォルト値は 0.0。

Qt 3D Extras のMetalRoughMaterial は、現在のところ、カメラの露出を使用する唯一のマテリアルです。負の値を設定するとマテリアルは暗くなり、正の値を設定すると明るくなります。

カスタムマテリアルでは、この値を異なるように解釈することもできます。

アクセス機能

float exposure() const
void setExposure(float exposure)

通知シグナル

void exposureChanged(float exposure)

farPlane : float

現在のカメラの遠い平面を保持します。farPlaneよりカメラから遠いオブジェクトはレンダリングされません。

アクセス関数:

float farPlane() const
void setFarPlane(float farPlane)

通知シグナル:

void farPlaneChanged(float farPlane)

fieldOfView : float

現在の垂直視野を度単位で保持する。

このプロパティは、aspectRatio とともに、カメラに見えるシーンの範囲を決定します。この点で、このプロパティは、シーンのどの部分を撮影したいかによって、広角(水平方向の視野が広い)または望遠(水平方向の視野が狭い)レンズを選択することに似ていると考えることができます。

fieldOfViewが関係するのは、projectionTypeQCameraLens::PerspectiveProjection のときだけである。

アクセス機能:

float fieldOfView() const
void setFieldOfView(float fieldOfView)

通知信号:

void fieldOfViewChanged(float fieldOfView)

left : float

カメラの現在の左を保持する。

このプロパティは、projectionTypeQCameraLens::OrthographicProjection の場合にのみ関連します。

アクセス関数:

float left() const
void setLeft(float left)

通知シグナル:

void leftChanged(float left)

[read-only] lens : Qt3DRender::QCameraLens* const

カメラのQt3DRender::QCameraLens コンポーネントを保持します。

機能にアクセスします:

Qt3DRender::QCameraLens *lens() const

nearPlane : float

現在のカメラのニアプレーンを保持します。nearPlane よりもカメラに近いオブジェクトはレンダリングされません。

アクセス関数:

float nearPlane() const
void setNearPlane(float nearPlane)

通知シグナル:

void nearPlaneChanged(float nearPlane)

position : QVector3D

親エンティティからの相対座標でカメラの位置を保持します。

アクセス関数:

QVector3D position() const
void setPosition(const QVector3D &position)

通知シグナル:

void positionChanged(const QVector3D &position)

projectionMatrix : QMatrix4x4

カメラの現在の投影行列を保持します。

アクセス関数:

QMatrix4x4 projectionMatrix() const
void setProjectionMatrix(const QMatrix4x4 &projectionMatrix)

通知信号:

void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix)

projectionType : Qt3DRender::QCameraLens::ProjectionType

カメラの投影タイプを保持します。デフォルト値はQCameraLens::PerspectiveProjection です。

アクセス機能

Qt3DRender::QCameraLens::ProjectionType projectionType() const
void setProjectionType(Qt3DRender::QCameraLens::ProjectionType type)

通知信号:

void projectionTypeChanged(Qt3DRender::QCameraLens::ProjectionType projectionType)

Qt3DRender::QCameraLens::ProjectionTypeも参照

right : float

カメラの現在の右を保持する。

このプロパティは、projectionTypeQCameraLens::OrthographicProjection の場合にのみ関連します。

アクセス関数:

float right() const
void setRight(float right)

通知シグナル:

void rightChanged(float right)

top : float

カメラの現在の上端を保持する。

このプロパティは、projectionTypeQCameraLens::OrthographicProjection の場合にのみ関連します。

アクセス関数:

float top() const
void setTop(float top)

通知シグナル:

void topChanged(float top)

[read-only] transform : Qt3DCore::QTransform* const

カメラのQt3DCore::QTransform コンポーネントを保持します。

機能にアクセスします:

Qt3DCore::QTransform *transform() const

upVector : QVector3D

カメラの上方向ベクトルを、親エンティティからの相対座標で保持します。

アップベクトルは、カメラの上部がどの方向を向いているかを示します。写真を撮ることを想像してみてください。自分の位置を決めてカメラをターゲットに向けた後、カメラを左右に回転させ、ポートレートやランドスケープ(またはアングル!)のショットを撮るかもしれません。

アクセス機能

QVector3D upVector() const
void setUpVector(const QVector3D &upVector)

通知シグナル

void upVectorChanged(const QVector3D &upVector)

viewCenter : QVector3D

カメラのビューセンターを、親エンティティからの相対座標で保持します。

直感的には、viewCenterはカメラが向いている位置です。

アクセス関数:

QVector3D viewCenter() const
void setViewCenter(const QVector3D &viewCenter)

通知シグナル:

void viewCenterChanged(const QVector3D &viewCenter)

[read-only] viewVector : const QVector3D

カメラのビューベクトルを、親エンティティからの相対座標で保持します。

このベクトルは、カメラ (position) からターゲット (viewCenter) への変位を表します。

アクセス関数:

QVector3D viewVector() const

通知シグナル:

void viewVectorChanged(const QVector3D &viewVector)

メンバ関数ドキュメント

[explicit] QCamera::QCamera(Qt3DCore::QNode *parent = nullptr)

指定されたparent で新しい QCamera インスタンスを作成します。

Qt3DRender::QCameraLens *QCamera::lens() const

現在のレンズを返す。

注: プロパティ lens のゲッター関数です。

[invokable] void QCamera::pan(float angle)

カメラのパン角度をangle (°)単位で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::pan(float angle, const QVector3D &axis)

angle カメラのパン角度をaxis で指定された度数で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::panAboutViewCenter(float angle)

ビューセンターを中心としたカメラのパンをangle 度単位で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::panAboutViewCenter(float angle, const QVector3D &axis)

ビューセンターを中心としたカメラのパンを、axis で度単位angle で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QQuaternion QCamera::panRotation(float angle) const

カメラのパンまたは Y 軸の左右回転を調整するために計算された、angle に対するパン回転を度単位で返します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::roll(float angle)

カメラロールをangle 度単位で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::rollAboutViewCenter(float angle)

ビューセンターを中心としたカメラロールをangle 度単位で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QQuaternion QCamera::rollRotation(float angle) const

カメラの Z 軸のロールまたは左右の傾きを調整するために、angle に対して計算されたロール回転を度単位で返します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::rotate(const QQuaternion &q)

q でクォータニオンを使ってカメラを回転させます。

注意: この関数はメタオブジェクトシステムや QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::rotateAboutViewCenter(const QQuaternion &q)

q のクオータニオンを使って、ビューセンターを中心にカメラを回転させます。

注意: この関数はメタオブジェクトシステムや QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const

計算された回転を度単位でangle と選択されたaxis から返します。

注意: この関数はメタオブジェクトシステムやQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[slot] void QCamera::setAspectRatio(float aspectRatio)

カメラのアスペクト比をaspectRatio に設定する。

注: プロパティ用セッター関数aspectRatio

aspectRatio()も参照

[slot] void QCamera::setBottom(float bottom)

カメラの下部をbottom に設定する。

注: プロパティbottom に対するセッター関数。

bottom()も参照

[slot] void QCamera::setExposure(float exposure)

カメラの露出をexposure に設定する。

注: プロパティのセッター関数exposure

exposure()も参照

[slot] void QCamera::setFarPlane(float farPlane)

カメラのファー平面をfarPlane

注: farPlane プロパティのセッター関数。

farPlane()も参照

[slot] void QCamera::setFieldOfView(float fieldOfView)

カメラの視野をfieldOfView に度単位で設定します。

注意: プロパティfieldOfView のセッター関数。

fieldOfView()も参照

[slot] void QCamera::setLeft(float left)

カメラの左をleft に設定する。

注: プロパティleft に対するセッター関数。

left()も参照

[slot] void QCamera::setNearPlane(float nearPlane)

カメラのニアプレーンをnearPlane に設定します。

注: プロパティのセッター関数nearPlane

nearPlane()も参照

[slot] void QCamera::setPosition(const QVector3D &position)

3D 空間におけるカメラの位置をposition に設定します。

注: プロパティのセッター関数position

position()も参照してください

[slot] void QCamera::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)

カメラの投影行列をprojectionMatrix に設定します。

注意: プロパティ用セッター関数projectionMatrix.

projectionMatrix()も参照

[slot] void QCamera::setProjectionType(Qt3DRender::QCameraLens::ProjectionType type)

カメラの投影タイプをtype に設定します。

注: プロパティprojectionType のセッター関数。

projectionType()も参照

[slot] void QCamera::setRight(float right)

カメラの右をright に設定する。

注: プロパティright に対するセッター関数。

right()も参照

[slot] void QCamera::setTop(float top)

カメラの上部をtop に設定します。

注: プロパティtop に対するセッター関数。

top()も参照

[slot] void QCamera::setUpVector(const QVector3D &upVector)

カメラのアップベクトルをupVector に設定します。

注意: プロパティのセッター関数upVector

upVector()も参照

[slot] void QCamera::setViewCenter(const QVector3D &viewCenter)

カメラのビューセンターをviewCenter に設定します。

注: viewCenter プロパティのセッター関数。

viewCenter()も参照

[invokable] void QCamera::tilt(float angle)

カメラのチルト角をangle (°)単位で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::tiltAboutViewCenter(float angle)

ビューセンターに対するカメラの傾きをangle 度単位で調整します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QQuaternion QCamera::tiltRotation(float angle) const

カメラの X 軸の傾きや上下方向の回転を調整するために計算された、angle に対する傾き回転を度単位で返します。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

Qt3DCore::QTransform *QCamera::transform() const

カメラの位置を transform で返します。

注意: プロパティ transform のゲッター関数です。

[invokable] void QCamera::translate(const QVector3D &vLocal, Qt3DRender::QCamera::CameraTranslationOption option = TranslateViewCenter)

カメラの位置とビューベクトルをローカル座標でvLocal だけ平行移動します。option では、ビューセンターを平行移動させるかどうかを切り替えることができます。

注意: この関数はメタオブジェクトシステムおよび QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QCamera::translateWorld(const QVector3D &vWorld, Qt3DRender::QCamera::CameraTranslationOption option = TranslateViewCenter)

カメラの位置とビューベクトルをワールド座標でvWorld だけ平行移動します。option では、ビューの中心を移動させるかどうかを切り替えることができます。

注意: この関数はメタオブジェクトシステムや QML から呼び出すことができます。Q_INVOKABLE を参照してください。

[slot] void QCamera::viewAll()

viewCenter がシーンのバウンディングボリュームの中心となり、シーン全体がビューポートに収まるように、カメラを回転・移動します。

注意: レンズが透視投影または正射投影モードの場合にのみ動作します。

Qt3D.Render::Camera::projectionTypeも参照してください

[slot] void QCamera::viewEntity(Qt3DCore::QEntity *entity)

viewCenterentity のバウンディングボリュームの中心となり、エンティティ全体がビューポートに収まるように、カメラを回転および移動します。

注意: レンズが透視投影または正投影モードの場合にのみ機能します。

Camera.projectionTypeも参照してください

[slot] void QCamera::viewSphere(const QVector3D &center, float radius)

viewCentercenter になり、radius の球がビューポートに収まるようにカメラを回転・移動します。

注意: レンズが透視投影または正射投影モードの場合にのみ動作します。

Qt3D.Render::Camera::projectionTypeも参照してください

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.