Qt3D 输入类处理鼠标键盘动作

Qt3D模块中的输入类用于处理用户输入,比如鼠标、键盘等输入事件。

```cpp

#include <Qt3DExtras>
#include <Qt3DInput>
#include <Qt3DCore>
#include <Qt3DRender>
#include <Qt3DLogic>
#include <Qt3DExtras>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    // 创建Qt3D窗
    Qt3DExtras::Qt3DWindow view;

    // 创建3D场景根实体
    Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();

    // 创建摄机
    Qt3DRender::QCamera *cameraEntity = view.camera();
    cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
    cameraEntity->setPosition(QVector3D(0, 0, 10));
    cameraEntity->setViewCenter(QVector3D(0, 0, 0));

    // 创建3D格
    Qt3DExtras::QCuboidMesh *cubeMesh = new Qt3DExtras::QCuboidMesh();
    cubeMesh->setXExtent(2);
    cubeMesh->setYExten

相关推荐

  1. Qt3D 输入处理鼠标键动作

    2024-01-06 23:28:02       39 阅读
  2. Qt3D使用说明

    2024-01-06 23:28:02       33 阅读
  3. Qt3D QGeometryRenderer几何体渲染使用说明

    2024-01-06 23:28:02       35 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-06 23:28:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-06 23:28:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-06 23:28:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-06 23:28:02       18 阅读

热门阅读

  1. Hive表加工为知识图谱实体关系表标准化流程

    2024-01-06 23:28:02       27 阅读
  2. 【多线程】

    2024-01-06 23:28:02       41 阅读
  3. C++第五天

    2024-01-06 23:28:02       31 阅读
  4. Binius:助力ZK行业发展

    2024-01-06 23:28:02       36 阅读
  5. nodejs01

    nodejs01

    2024-01-06 23:28:02      36 阅读
  6. vue 异步加载组件

    2024-01-06 23:28:02       38 阅读
  7. Copilot在IDEA中的应用:提升编码效率的得力助手

    2024-01-06 23:28:02       42 阅读
  8. Vivado link synplify edf 和 xilinx ip或者原语

    2024-01-06 23:28:02       41 阅读