質問編集履歴
2
文章を編集しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -13,6 +13,70 @@
|
|
13
13
|
|
14
14
|
|
15
15
|
参考サイト: https://www.glfw.org/docs/3.3/window_guide.html#window_size
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
```cpp
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
//3D空間をシュミレートするための行列を計算
|
26
|
+
|
27
|
+
void Game::CreateDrawMatrix()
|
28
|
+
|
29
|
+
{
|
30
|
+
|
31
|
+
//ワールド行列
|
32
|
+
|
33
|
+
glm::mat4x4 t = glm::make_mat4(move) * glm::make_mat4(scale) * glm::make_mat4(rotate);
|
34
|
+
|
35
|
+
memcpy(wordlMatrix, glm::value_ptr(t), sizeof(float) * 16);
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
//透視射形行列
|
42
|
+
|
43
|
+
glm::mat4 pers = glm::perspective(glm::radians(90.f), (640.0f / 400.0f), 0.1f, 100.0f);
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
//カメラ
|
48
|
+
|
49
|
+
glm::mat4 view = glm::lookAt(camera_pos, glm::vec3(0, 0, -1), glm::vec3(0, 1, 0)) * pers;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
memcpy(viewMatrix, &view, sizeof(float) * 16);
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
//Uniformリソースをプログラムに設定 シェーダプログラム
|
64
|
+
|
65
|
+
glUniformMatrix4fv(glGetUniformLocation(ShaderProgram, "worldMatrix"), 1, GL_FALSE, wordlMatrix);
|
66
|
+
|
67
|
+
glUniformMatrix4fv(glGetUniformLocation(ShaderProgram, "viewMatrix"), 1, GL_FALSE, viewMatrix);
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
|
16
80
|
|
17
81
|
```cpp
|
18
82
|
|
1
参考サイトを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
|
15
|
+
参考サイト: https://www.glfw.org/docs/3.3/window_guide.html#window_size
|
16
16
|
|
17
17
|
```cpp
|
18
18
|
|