Skip to content

Commit

Permalink
Tweak camera znear and zfar, make scene floor same as grid
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkewley committed Jan 16, 2025
1 parent ebf2dd5 commit d1d7e23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions liboscar/Graphics/Scene/SceneRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ namespace
Transform calc_floor_transform(Vec3 floor_origin, float fixup_scale_factor)
{
return {
.scale = {10000.0f * fixup_scale_factor, 10000.0f * fixup_scale_factor, 1.0f},
// note: this should be the same as draw_grid
.scale = {50.0f * fixup_scale_factor, 50.0f * fixup_scale_factor, 1.0f},
.rotation = angle_axis(-90_deg, Vec3{1.0f, 0.0f, 0.0f}),
.position = floor_origin,
};
Expand Down Expand Up @@ -278,7 +279,7 @@ namespace
Material{Shader{c_vertex_shader_src, c_fragment_shader_src}}
{
set<Texture2D>("uDiffuseTexture", ChequeredTexture{});
set("uTextureScale", Vec2{20000.0f});
set("uTextureScale", Vec2{100.0f});
set_transparent(true);
}

Expand Down
2 changes: 1 addition & 1 deletion liboscar/Maths/MathsImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void osc::PolarPerspectiveCamera::rescale_znear_and_zfar_based_on_radius()
// the radius is effectively the distance from the camera's focal point

znear = 0.1f * radius;
zfar = 100.0f * radius;
zfar = 10.0f * radius;
}

Mat4 osc::PolarPerspectiveCamera::view_matrix() const
Expand Down

0 comments on commit d1d7e23

Please sign in to comment.