Skip to content

Commit

Permalink
校对 docs/03 Model Loading/02 Mesh.md,将"constructor"由"构造器"翻译为"构造函数"
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperAoao authored and BLumia committed Sep 17, 2024
1 parent 5bfc447 commit a6ae1ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/03 Model Loading/02 Mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
---|---
作者 | JoeyDeVries
翻译 | Krasjet
校对 | 暂未校对
校对 | [AoZhang](https://github.com/SuperAoao)

通过使用Assimp,我们可以加载不同的模型到程序中,但是载入后它们都被储存为Assimp的数据结构。我们最终仍要将这些数据转换为OpenGL能够理解的格式,这样才能渲染这个物体。我们从上一节中学到,网格(Mesh)代表的是单个的可绘制实体,我们现在先来定义一个我们自己的网格类。

Expand Down Expand Up @@ -51,9 +51,9 @@ class Mesh {
};
```
你可以看到这个类并不复杂。在构造器中,我们将所有必须的数据赋予了网格,我们在<fun>setupMesh</fun>函数中初始化缓冲,并最终使用<fun>Draw</fun>函数来绘制网格。注意我们将一个着色器传入了<fun>Draw</fun>函数中,将着色器传入网格类中可以让我们在绘制之前设置一些uniform(像是链接采样器到纹理单元)。
你可以看到这个类并不复杂。在构造函数中,我们将所有必须的数据赋予了网格,我们在<fun>setupMesh</fun>函数中初始化缓冲,并最终使用<fun>Draw</fun>函数来绘制网格。注意我们将一个着色器传入了<fun>Draw</fun>函数中,将着色器传入网格类中可以让我们在绘制之前设置一些uniform(像是链接采样器到纹理单元)。
构造器的内容非常易于理解。我们只需要使用构造器的参数设置类的公有变量就可以了。我们在构造器中还调用了<fun>setupMesh</fun>函数:
构造函数的内容非常易于理解。我们只需要使用构造函数的参数设置类的公有变量就可以了。我们在构造函数中还调用了<fun>setupMesh</fun>函数:
```c++
Mesh(vector<Vertex> vertices, vector<unsigned int> indices, vector<Texture> textures)
Expand All @@ -70,7 +70,7 @@ Mesh(vector<Vertex> vertices, vector<unsigned int> indices, vector<Texture> text

## 初始化

由于有了构造器,我们现在有一大列的网格数据用于渲染。在此之前我们还必须配置正确的缓冲,并通过顶点属性指针定义顶点着色器的布局。现在你应该对这些概念都很熟悉了,但我们这次会稍微有一点变动使用结构体中的顶点数据:
多亏了构造函数,我们现在有一大列的网格数据可以用于渲染。在此之前我们还必须配置正确的缓冲,并通过顶点属性指针定义顶点着色器的布局。现在你应该对这些概念都很熟悉了,但我们这次会稍微有一点变动:使用结构体中的顶点数据:

```c++
void setupMesh()
Expand Down

0 comments on commit a6ae1ba

Please sign in to comment.