mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 19:28:49 -04:00
Add anisotropic filtering and make leaves transparent again.
This commit is contained in:
parent
7d23411a22
commit
91a52e6dae
@ -9,5 +9,5 @@
|
||||
"viewThrough" : true,
|
||||
"absorbedLight" : 0x0f100010,
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:oak_leaves"
|
||||
"texture" : "cubyz:oak_leaves_transparent"
|
||||
}
|
||||
|
@ -572,8 +572,15 @@ pub const meshes = struct {
|
||||
}
|
||||
|
||||
pub fn generateTextureArray() !void {
|
||||
const c = graphics.c;
|
||||
try blockTextureArray.generate(blockTextures.items, true);
|
||||
if(main.settings.anisotropicFiltering) {
|
||||
c.glTexParameterf(c.GL_TEXTURE_2D_ARRAY, c.GL_TEXTURE_MAX_ANISOTROPY, 16);
|
||||
}
|
||||
try emissionTextureArray.generate(emissionTextures.items, true);
|
||||
if(main.settings.anisotropicFiltering) {
|
||||
c.glTexParameterf(c.GL_TEXTURE_2D_ARRAY, c.GL_TEXTURE_MAX_ANISOTROPY, 16);
|
||||
}
|
||||
|
||||
// Also generate additional buffers:
|
||||
if(animationSSBO) |ssbo| {
|
||||
|
@ -37,12 +37,18 @@ fn vsyncCallback(newValue: bool) void {
|
||||
main.Window.reloadSettings();
|
||||
}
|
||||
|
||||
fn anisotropicFilteringCallback(newValue: bool) void {
|
||||
settings.anisotropicFiltering = newValue;
|
||||
// TODO: Reload the textures.
|
||||
}
|
||||
|
||||
pub fn onOpen() Allocator.Error!void {
|
||||
const list = try VerticalList.init(.{padding, 16 + padding}, 300, 16);
|
||||
const renderDistances = [_]u32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
|
||||
try list.add(try DiscreteSlider.init(.{0, 0}, 128, "#ffffffRender Distance: ", "{}", &renderDistances, settings.renderDistance - 1, &renderDistanceCallback));
|
||||
try list.add(try CheckBox.init(.{0, 0}, 128, "Bloom", settings.bloom, &bloomCallback));
|
||||
try list.add(try CheckBox.init(.{0, 0}, 128, "Vertical Synchronization", settings.vsync, &vsyncCallback));
|
||||
try list.add(try CheckBox.init(.{0, 0}, 128, "Anisotropic Filtering", settings.anisotropicFiltering, &anisotropicFilteringCallback));
|
||||
list.finish(.center);
|
||||
window.rootComponent = list.toComponent();
|
||||
window.contentSize = window.rootComponent.?.pos() + window.rootComponent.?.size() + @as(Vec2f, @splat(padding));
|
||||
|
@ -611,7 +611,7 @@ pub const Window = struct {
|
||||
c.glfwWindowHint(c.GLFW_OPENGL_DEBUG_CONTEXT, 1);
|
||||
}
|
||||
c.glfwWindowHint(c.GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||
c.glfwWindowHint(c.GLFW_CONTEXT_VERSION_MINOR, 5);
|
||||
c.glfwWindowHint(c.GLFW_CONTEXT_VERSION_MINOR, 6);
|
||||
|
||||
window = c.glfwCreateWindow(width, height, "Cubyz", null, null) orelse return error.GLFWFailed;
|
||||
|
||||
|
@ -15,6 +15,8 @@ pub const highestLOD: u5 = 5;
|
||||
|
||||
pub var entityDistance: u16 = 2;
|
||||
|
||||
pub var anisotropicFiltering: bool = true;
|
||||
|
||||
|
||||
pub var fov: f32 = 70;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user