Giter Club home page Giter Club logo

3d-racing-games-demo's Introduction

3D Racing Games Demo with OpenGL

使用 C++ 和 OpenGL 实现简单的 3D 赛车游戏


简介 Introduction

计算机图形学课程的大作业,参考 LearnOpenGL 中文教程 完成该 Demo。

引用的 LearnOpenGL 库代码以及自己编写的代码均做有中文注释。


使用方式 Usage

可运行程序下载地址:

  1. 站内下载:Github Releases

    没有科学上网的同学可能不仅下面的 gif 图加载不出来,这个链接估计也下载不动,可以使用下面的百度云链接

  2. 百度云:

    链接:https://pan.baidu.com/s/1DrRJSp5qA_zkWEbwiwS3IQ

    提取码:nlv9

选择 Release 或 Debug 版本其中一个下载解压后点击 RacingGames.exe 运行程序。

项目源码 需要在 Windows 平台下使用 VS 2015 编译运行(无兼容性优化)。

如尝试自行编译,请选择 x86 选项(因为所使用的库为 x86 版本)


效果演示 Demonstrate

自由视角

驾驶跑车

控制 Control

键盘控制

全局按键:

按键 效果
汽车向前行驶
倒车
左转弯(需要汽车处于移动中才会生效)
右转弯(需要汽车处于移动中才会生效)
Esc 退出游戏
C 切换相机视角为固定视角/自由视角
X 切换渲染方式为线框图模式/正常模式

自由视角下:

按键 效果
W 镜头向前移动
S 镜头向后移动
A 镜头向左移动
D 镜头向右移动
Space 镜头竖直向上移动
左Ctrl 镜头竖直向下移动

固定视角下:

按键 效果
A 镜头绕车身向左旋转
D 镜头绕车身向右旋转

鼠标控制

按键 效果
鼠标移动 视角方向移动(仅自由视角下)
鼠标滚轮 镜头变焦



项目介绍 Project Introduction

项目结构 Project Structure

  • asset 存放工程相关资源
    • textures 存放天空盒的原图
    • models 存放模型
  • include 存放引用的头文件
  • lib 存放引用的 lib 文件
  • shader 存放着色器文件

实现功能 Implement

  1. obj 模型的读取与渲染(assimp 库)
  2. 纹理贴图
  3. Blinn-Phong 光照模型
  4. 阴影效果实现(阴影贴图方式)
  5. 阴影边缘优化(PCF)
  6. 天空盒
  7. 相机固定视角与自由视角的实现与切换
  8. 汽车移动与转弯实现
  9. 转弯视角偏移延迟
  10. 汽车的缓动、缓停与漂移效果
  11. 行驶加速视觉效果
  12. 赛车-相机的层级建模结构

运行环境 Environment

√ 64位电脑 Win10 系统下 Visual Studio 2015 使用 x86 Debug/Release 版本编译测试通过


引用库 Reference Library

  • assimp
  • glad
  • glfw
  • glm
  • khr
  • stb_image
  • learnopengl

3d-racing-games-demo's People

Contributors

ceynri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.