Skip to content

Commit 6b0d419

Browse files
committed
add more to task7
1 parent e2b9885 commit 6b0d419

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+10874
-5
lines changed

.DS_Store

2 KB
Binary file not shown.

GAMES101_Lecture_05.pdf

30.5 KB
Binary file not shown.

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,19 @@ After you click running, you will see models copied into `~/Library/Developer/Xc
108108

109109
First argument is `output.png`. Second argument is `texture or phone or normal ..`
110110

111-
## for task5
111+
## for task5 6
112112
### No template named 'optional' in namespace 'std'
113113

114114
Set `C++ Language Dialect` to `C++ 17 [std=C++17]`
115115

116116
Set `C++ Standard Library` to `... LLVM C++ ...`
117117

118118

119+
## for task 7
120+
omp.h
121+
122+
`brew install libomp`
123+
124+
/usr/local/Cellar/libomp/10.0.0/include
125+
126+
https://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x

task2/task2/task2.xcodeproj/xcuserdata/lilin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+18
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,22 @@
33
uuid = "3D5F5D45-11BA-402E-957C-D442CF1D3186"
44
type = "1"
55
version = "2.0">
6+
<Breakpoints>
7+
<BreakpointProxy
8+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9+
<BreakpointContent
10+
uuid = "42886011-A09E-4D31-976F-83A80E494D0C"
11+
shouldBeEnabled = "No"
12+
ignoreCount = "0"
13+
continueAfterRunningActions = "No"
14+
filePath = "task2/main.cpp"
15+
startingColumnNumber = "9223372036854775807"
16+
endingColumnNumber = "9223372036854775807"
17+
startingLineNumber = "40"
18+
endingLineNumber = "40"
19+
landmarkName = "get_projection_matrix(eye_fov, aspect_ratio, zNear, zFar)"
20+
landmarkType = "9">
21+
</BreakpointContent>
22+
</BreakpointProxy>
23+
</Breakpoints>
624
</Bucket>

task2/task2/task2/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Eigen::Matrix4f get_projection_matrix(float eye_fov, float aspect_ratio, float z
3737
// Then return it.
3838
float eye_angle = eye_fov *MY_PI / 180;
3939
float t,b,l,r;
40-
t = - zNear * tan(eye_angle /2);//------
40+
t = abs(zNear) * tan(eye_angle /2);//------
4141
r = t * aspect_ratio;
4242
l = -r;
4343
b = -t;
@@ -117,7 +117,7 @@ int main(int argc, const char** argv)
117117

118118
r.set_model(get_model_matrix(angle));
119119
r.set_view(get_view_matrix(eye_pos));
120-
r.set_projection(get_projection_matrix(45, 1, 0.1, 50));
120+
r.set_projection(get_projection_matrix(45, 1, -0.1, -50));
121121

122122
r.draw(pos_id, ind_id, col_id, rst::Primitive::Triangle);
123123
cv::Mat image(700, 700, CV_32FC3, r.frame_buffer().data());
@@ -135,7 +135,7 @@ int main(int argc, const char** argv)
135135

136136
r.set_model(get_model_matrix(angle));
137137
r.set_view(get_view_matrix(eye_pos));
138-
r.set_projection(get_projection_matrix(45, 1, 0.1, 50));
138+
r.set_projection(get_projection_matrix(45, 1, -0.1, -50));
139139

140140
r.draw(pos_id, ind_id, col_id, rst::Primitive::Triangle);
141141

task5/task5/task5/Renderer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void Renderer::Render(const Scene& scene)
233233
// Also, don't forget to multiply both of them with the variable *scale*, and
234234
// x (horizontal) variable with the *imageAspectRatio*
235235
x = imageAspectRatio * (2 * float(i) / (float)scene.width - 1); // 坐标从 1280 * 800 转为 [0, 1] 再转为 [-1, 1] 再转为 [-imageAspectRatio, imageAspectRatio]
236-
y = 1 - ( 2 *float(j) / float(scene.height) ); // 做成数学坐标系 越往上 y 值越大 [1, ]
236+
y = 1 - (2 * float(j) / float(scene.height)); // 做成数学坐标系 越往上 y 值越大 [-1, 1]
237237
//std::cout << x <<"---"<<y <<'\n';
238238
Vector3f dir = Vector3f(x, y, -1); // Don't forget to normalize this direction!
239239
dir = normalize(dir);

0 commit comments

Comments
 (0)