![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
computer graphics
doushaaaaa
图形学初探ing//已离开算法//努力成长的oier
展开
-
GAMES101 作业4 贝塞尔曲线 (Bézier Curve)
具体代码:#include <chrono>#include <iostream>#include <opencv2/opencv.hpp>std::vector<cv::Point2f> control_points;void mouse_handler(int event, int x, int y, int flags, void *userdata) { if (event == cv::EVENT_LBUTTONDOWN &a原创 2021-09-29 11:13:05 · 354 阅读 · 0 评论 -
GAMES 101 现代计算机图形学 作业3 双线性插值
其他的都没什么好说的,这里记录一下 双线性插值的应用过程代码是学习这位大佬的 :https://blog.csdn.net/qq_36242312/article/details/105888669在Texture.hpp中 添加一个函数Eigen::Vector3f getColorBilinear(float u,float v) { if(u<0) u=0; if(u>1) u=1; if(v<0) v=0;原创 2021-09-24 19:01:06 · 621 阅读 · 0 评论 -
如何在使用stb_image.h得到data后取出每个像素的RBGA值?
最近在写自己的渲染器,想使用学习opengl的时候使用的这个stb_image.h首先。int width, height, nrChannels;unsigned char *data = stbi_load("container2.png", &width, &height, &nrChannels, 0);这个函数首先接受一个图像文件的位置作为输入。接下来它需要三个int作为它的第二、第三和第四个参数,stb_image.h将会用图像的宽度、高度和颜色通道的个数填充这原创 2021-08-30 20:41:21 · 1210 阅读 · 0 评论 -
GAMES101 作业2 给三角形上色和MSAA的实现
主要代码思路来自大佬:https://blog.csdn.net/qq_36242312/article/details/105758619然后有个插值计算,好像下节课才讲。转发的文章的代码不能直接改true来实现MSAA,因为insideTriangle的参数他写的是int,改成float就可以了。color那里写成t.getColor() * count / 4.0f + (4 - count) * frame_buf[get_index(x,y)] / 4.0f貌似还可以减黑.转载 2021-03-01 20:22:17 · 1065 阅读 · 3 评论 -
实现三角形的MVP (GAMES101 homework1)
/* * eye_fov 视野的大小 * aspect_ratio 长宽比? 猜测是视野的长宽比率 * zNear 最近处的坐标 * zFar 最远处的坐标 */Eigen::Matrix4f get_projection_matrix(float eye_fov, float aspect_ratio, float zNear, float zFar){ // Students will imple...原创 2021-02-04 20:50:08 · 360 阅读 · 0 评论 -
把一个点逆时针旋转45°,再平移(1,2)(GAME101——homework0)
目录目标:实现过程首先理解 齐次坐标的含义:然后 绕原点旋转45°的矩阵推导过程:然后就是平移(1,2)。代码:目标:实现一个小目标:给定一个点P=(2,1), 将该点绕原点先逆时针旋转45◦,再平移(1,2), 计算出变换后点的坐标(要求用齐次坐标进行计算)实现过程首先理解 齐次坐标的含义:https://blog.csdn.net/janestar/article/details/44244849笛卡尔坐标的(2,1) 转化为齐次坐标为:(2,1,1)原创 2021-01-23 12:54:49 · 2154 阅读 · 0 评论