• 大小: 5.85M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-15
  • 语言: 其他
  • 标签: 其他  

资源简介

objModelLoading.rar

资源截图

代码片段和文件信息

#include “camera.h“

QMatrix4x4 Camera::getViewMatrix()
{
  QMatrix4x4 view;
  view.lookAt(this->position this->position + this->front this->up);
  return view;
}

void Camera::processKeyboard(Camera_Movement direction GLfloat deltaTime)
{
  GLfloat velocity = this->movementSpeed * deltaTime;
  if (direction == FORWARD)
    this->position += this->front * velocity;
  if (direction == BACKWARD)
    this->position -= this->front * velocity;
  if (direction == LEFT)
    this->position -= this->right * velocity;
  if (direction == RIGHT)
    this->position += this->right * velocity;
  if (direction == UP)
    this->position += this->worldUp * velocity;
  if (direction == DOWN)
    this->position -= this->worldUp * velocity;
}

void Camera::processMouseMovement(GLfloat xoffset GLfloat yoffset GLboolean constraintPitch)
{
  xoffset *= this->mouseSensitivity;
  yoffset *= this->mouseSensitivity;

  this->yaw += xoffset;
  this->picth += yoffset;

  if (constraintPitch) {
    if (this->picth > 89.0f)
      this->picth = 89.0f;
    if (this->picth < -89.0f)
      this->picth = -89.0f;
  }

  this->updateCameraVectors();
}

void Camera::processMouseScroll(GLfloat yoffset)
{
  if (this->zoom >= 1.0f && this->zoom <= 45.0f)
    this->zoom -= yoffset;
  if (this->zoom > 45.0f)
    this->zoom = 45.0f;
  if (this->zoom < 1.0f)
      this->zoom = 1.0f;
}

void Camera::updateCameraVectors()
{
  GLfloat yawR = qDegreesToRadians(this->yaw);
  GLfloat picthR = qDegreesToRadians(this->picth);//转换为弧度制Radians

  QVector3D front3(cos(yawR) * cos(picthR) sin(picthR) sin(yawR) * cos(picthR));
  this->front = front3.normalized();
  this->right = QVector3D::crossProduct(this->front this->worldUp).normalized();
  this->up = QVector3D::crossProduct(this->right this->front).normalized();
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1880  2018-05-05 17:23  objModelLoading\camera.cpp

     文件       1750  2018-05-09 13:09  objModelLoading\camera.h

     文件       1785  2018-08-08 14:28  objModelLoading\light.cpp

     文件        255  2018-08-08 14:22  objModelLoading\light.h

     文件        384  2018-07-31 23:38  objModelLoading\main.cpp

     文件       1611  2018-08-01 16:09  objModelLoading\mainwindow.cpp

     文件        769  2018-08-01 16:06  objModelLoading\mainwindow.h

     文件       3512  2018-08-01 16:25  objModelLoading\mainwindow.ui

     文件      11060  2018-08-01 20:48  objModelLoading\model.cpp

     文件       1161  2018-08-01 15:49  objModelLoading\model.h

     文件       1327  2018-08-08 14:11  objModelLoading\objModelLoading.pro

     文件      24118  2018-08-17 14:14  objModelLoading\objModelLoading.pro.user

     文件       6339  2018-08-08 14:28  objModelLoading\oglmanager.cpp

     文件       1419  2018-08-01 16:06  objModelLoading\oglmanager.h

     文件        365  2017-01-06 22:23  objModelLoading\res\models\biwutai\biwutai.mtl

     文件     154948  2017-01-06 22:38  objModelLoading\res\models\biwutai\biwutai.obj

     文件     895774  2017-01-26 16:12  objModelLoading\res\models\biwutai\yanse.png

     文件     393031  2012-01-20 15:40  objModelLoading\res\models\huapen\Arch41_039_bark.jpg

     文件        613  2017-03-01 19:26  objModelLoading\res\models\huapen\penzi.mtl

     文件     518099  2017-03-01 19:24  objModelLoading\res\models\huapen\penzi.obj

     文件     859708  2018-06-06 10:20  objModelLoading\res\models\huapen\pen_new.obj

     文件     151979  2018-06-06 10:21  objModelLoading\res\models\huapen\solid_new.obj

     文件      13407  2017-03-01 19:20  objModelLoading\res\models\huapen\white.jpg

     文件        374  2016-11-06 21:21  objModelLoading\res\models\jidi\1.mtl

     文件     233150  2016-09-30 16:04  objModelLoading\res\models\jidi\1.obj

     文件        244  2014-09-15 09:26  objModelLoading\res\models\jidi\3D学院.url

     文件    1048630  2016-09-30 15:57  objModelLoading\res\models\jidi\Nexus_Destroyed_diff.bmp

     文件     349680  2016-09-30 15:56  objModelLoading\res\models\jidi\Nexus_Destroyed_diff.dds

     文件        444  2014-09-11 15:35  objModelLoading\res\models\jidi\说明read me_3DXY.txt

     文件        312  2009-10-17 00:27  objModelLoading\res\models\su_27\1792ae92.dds

............此处省略222个文件信息

评论

共有 条评论