Skip to content

Commit

Permalink
fix:[thumbnail]添加viewUp 视角矩阵
Browse files Browse the repository at this point in the history
Change-Id: I9f4f6ccb460c7b0717463190dfc3213a3955c1fd
  • Loading branch information
wangjiang committed Mar 22, 2023
1 parent 7b66373 commit 4abe326
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion thumbnail/raster_backend/raster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ bool Raster::rasterTriMesh(Picture* picture, trimesh::TriMesh* mesh, RasterConfi
float nearPlane = d - len;
float farPlane = d + len;

glm::highp_mat4 projectionMatrix = glm::perspective(fovy, (float)width / (float)height, nearPlane, farPlane);
glm::highp_mat4 projectionMatrix = glm::perspective(fovy, 1.0f, nearPlane, farPlane);
//glm::highp_mat4 projectionMatrix = glm::perspective(fovy, (float)width / (float)height, nearPlane, farPlane);

glm::vec3 viewDir = vec3ToGLM(rasterConfig->viewDir);
glm::vec3 viewUp = vec3ToGLM(rasterConfig->viewUp);
Expand Down
2 changes: 2 additions & 0 deletions thumbnail/thumbnail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ void thumbnail_trimesh_convert(trimesh::TriMesh* mesh, int width, int height, un

raster_config.viewDir = Vec3(viewDir.x, viewDir.y, viewDir.z);
raster_config.viewRight = Vec3(viewRight.x, viewRight.y, viewRight.z);
trimesh::vec3 up = trimesh::cross(viewDir, viewRight);
raster_config.viewUp = Vec3(up.x, up.y, up.z);

if (!mesh)
{
Expand Down

0 comments on commit 4abe326

Please sign in to comment.