From 821276062b0786ebffae0da48afa2206f305ee6c Mon Sep 17 00:00:00 2001 From: SuperAo Date: Tue, 2 Apr 2024 15:52:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20issue=20=E5=9D=90=E6=A0=87=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=B0=8F=E8=8A=82=20=E7=BF=BB=E8=AF=91=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=20#286=20,=20DOOM=E7=BF=BB=E8=AF=91=E4=B8=BA=E6=AF=81?= =?UTF-8?q?=E7=81=AD=E6=88=98=E5=A3=AB=E5=B9=B6=E5=A2=9E=E5=8A=A0=E5=B0=8F?= =?UTF-8?q?=E6=8B=AC=E5=8F=B7=E8=A7=A3=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/01 Getting started/08 Coordinate Systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/01 Getting started/08 Coordinate Systems.md b/docs/01 Getting started/08 Coordinate Systems.md index 27e19c7..aa3b458 100644 --- a/docs/01 Getting started/08 Coordinate Systems.md +++ b/docs/01 Getting started/08 Coordinate Systems.md @@ -4,7 +4,7 @@ ---|--- 作者 | JoeyDeVries 翻译 | linkoln, Geequlim, Krasjet, [BLumia](https://github.com/blumia/) -校对 | 暂未校对 +校对 | AoZhang 在上一个教程中,我们学习了如何有效地利用矩阵的变换来对所有顶点进行变换。OpenGL希望在每次顶点着色器运行后,我们可见的所有顶点都为标准化设备坐标(Normalized Device Coordinate, NDC)。也就是说,每个顶点的**x**,**y**,**z**坐标都应该在**-1.0**到**1.0**之间,超出这个坐标范围的顶点都将不可见。我们通常会自己设定一个坐标的范围,之后再在顶点着色器中将这些坐标变换为标准化设备坐标。然后将这些标准化设备坐标传入光栅器(Rasterizer),将它们变换为屏幕上的二维坐标或像素。 @@ -115,7 +115,7 @@ glm::mat4 proj = glm::perspective(glm::radians(45.0f), (float)width/(float)heigh ![ perspective_frustum](../img/01/08/perspective_frustum.png) -它的第一个参数定义了fov的值,它表示的是视野(Field of View),并且设置了观察空间的大小。如果想要一个真实的观察效果,它的值通常设置为45.0f,但想要一个末日风格的结果你可以将其设置一个更大的值。第二个参数设置了宽高比,由视口的宽除以高所得。第三和第四个参数设置了平截头体的**近**和**远**平面。我们通常设置近距离为0.1f,而远距离设为100.0f。所有在近平面和远平面内且处于平截头体内的顶点都会被渲染。 +它的第一个参数定义了fov的值,它表示的是视野(Field of View),并且设置了观察空间的大小。如果想要一个真实的观察效果,它的值通常设置为45.0f,但想要一个毁灭战士(DOOM,经典的系列第一人称射击游戏)风格的结果你可以将其设置一个更大的值。第二个参数设置了宽高比,由视口的宽除以高所得。第三和第四个参数设置了平截头体的**近**和**远**平面。我们通常设置近距离为0.1f,而远距离设为100.0f。所有在近平面和远平面内且处于平截头体内的顶点都会被渲染。 !!! important From aadcb18b2e53b53572db273abacf158d7d888ec2 Mon Sep 17 00:00:00 2001 From: SuperAo Date: Tue, 2 Apr 2024 15:56:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20=E5=85=A5=E9=97=A8-=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=20=E8=BF=99=E4=B8=80=E6=AE=B5=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=A4=9A=E4=BA=86=E4=B8=80=E4=B8=AA=E6=8B=AC=E5=8F=B7?= =?UTF-8?q?=20#289?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/01 Getting started/08 Coordinate Systems.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/01 Getting started/08 Coordinate Systems.md b/docs/01 Getting started/08 Coordinate Systems.md index aa3b458..f704186 100644 --- a/docs/01 Getting started/08 Coordinate Systems.md +++ b/docs/01 Getting started/08 Coordinate Systems.md @@ -217,7 +217,7 @@ void main() 我们还应该将矩阵传入着色器(这通常在每次的渲染迭代中进行,因为变换矩阵会经常变动): ```c++ -int modelLoc = glGetUniformLocation(ourShader.ID, "model")); +int modelLoc = glGetUniformLocation(ourShader.ID, "model"); glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model)); ... // 观察矩阵和投影矩阵与之类似 ```