mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 19:50:23 -04:00
parent
d179868243
commit
fffb94046d
@ -9,6 +9,7 @@ const GuiComponent = gui.GuiComponent;
|
||||
const GuiWindow = gui.GuiWindow;
|
||||
const Button = @import("../components/Button.zig");
|
||||
const CheckBox = @import("../components/CheckBox.zig");
|
||||
const ContinuousSlider = @import("../components/ContinuousSlider.zig");
|
||||
const DiscreteSlider = @import("../components/DiscreteSlider.zig");
|
||||
const VerticalList = @import("../components/VerticalList.zig");
|
||||
|
||||
@ -27,6 +28,15 @@ fn renderDistanceCallback(newValue: u16) void {
|
||||
settings.renderDistance = newValue + renderDistances[0];
|
||||
}
|
||||
|
||||
fn fovCallback(newValue: f32) void {
|
||||
settings.fov = newValue;
|
||||
main.Window.GLFWCallbacks.framebufferSize(undefined, main.Window.width, main.Window.height);
|
||||
}
|
||||
|
||||
fn fovFormatter(allocator: main.utils.NeverFailingAllocator, value: f32) []const u8 {
|
||||
return std.fmt.allocPrint(allocator.allocator, "#ffffffField Of View: {d:.0}°", .{value}) catch unreachable;
|
||||
}
|
||||
|
||||
fn LODFactorCallback(newValue: u16) void {
|
||||
settings.LODFactor = @as(f32, @floatFromInt(newValue + 1))/2;
|
||||
}
|
||||
@ -53,6 +63,7 @@ fn resolutionScaleCallback(newValue: u16) void {
|
||||
pub fn onOpen() void {
|
||||
const list = VerticalList.init(.{padding, 16 + padding}, 300, 16);
|
||||
list.add(DiscreteSlider.init(.{0, 0}, 128, "#ffffffRender Distance: ", "{}", &renderDistances, settings.renderDistance - renderDistances[0], &renderDistanceCallback));
|
||||
list.add(ContinuousSlider.init(.{0, 0}, 128, 40.0, 120.0, settings.fov, &fovCallback, &fovFormatter));
|
||||
list.add(CheckBox.init(.{0, 0}, 128, "Bloom", settings.bloom, &bloomCallback));
|
||||
list.add(CheckBox.init(.{0, 0}, 128, "Vertical Synchronization", settings.vsync, &vsyncCallback));
|
||||
list.add(DiscreteSlider.init(.{0, 0}, 128, "#ffffffAnisotropic Filtering: ", "{}x", &anisotropy, switch(settings.anisotropicFiltering) {1 => 0, 2 => 1, 4 => 2, 8 => 3, 16 => 4, else => 2}, &anisotropicFilteringCallback));
|
||||
|
@ -512,6 +512,7 @@ pub const MenuBackGround = struct {
|
||||
lastTime = newTime;
|
||||
const viewMatrix = Mat4f.rotationZ(angle);
|
||||
shader.bind();
|
||||
updateViewport(lastWidth, lastHeight, 70.0);
|
||||
|
||||
c.glUniformMatrix4fv(uniforms.viewMatrix, 1, c.GL_TRUE, @ptrCast(&viewMatrix));
|
||||
c.glUniformMatrix4fv(uniforms.projectionMatrix, 1, c.GL_TRUE, @ptrCast(&game.projectionMatrix));
|
||||
|
Loading…
x
Reference in New Issue
Block a user