[Config] It's now possible to use fallback AO only while using smooth lighting.
This commit is contained in:
parent
c319f865a1
commit
74bc521d11
@ -50,8 +50,8 @@ bool Config::isCrosshairVisible = true;
|
||||
|
||||
// Graphics
|
||||
u16 Config::renderDistance = 8;
|
||||
u8 Config::ambientOcclusion = 2;
|
||||
bool Config::isSmoothLightingEnabled = true;
|
||||
bool Config::isAmbientOcclusionEnabled = false;
|
||||
bool Config::isWireframeModeEnabled = false;
|
||||
bool Config::isFullscreenModeEnabled = false;
|
||||
bool Config::isVerticalSyncEnabled = true;
|
||||
@ -90,16 +90,16 @@ void Config::loadConfigFromFile(const char *filename) {
|
||||
isCrosshairVisible = lua["isCrosshairVisible"].get_or(isCrosshairVisible);
|
||||
|
||||
renderDistance = lua["renderDistance"].get_or(renderDistance);
|
||||
ambientOcclusion = std::clamp<u8>(lua["ambientOcclusion"].get_or(ambientOcclusion), 0, 2);
|
||||
isSmoothLightingEnabled = lua["isSmoothLightingEnabled"].get_or(isSmoothLightingEnabled);
|
||||
isAmbientOcclusionEnabled = lua["isAmbientOcclusionEnabled"].get_or(isAmbientOcclusionEnabled);
|
||||
isWireframeModeEnabled = lua["isWireframeModeEnabled"].get_or(isWireframeModeEnabled);
|
||||
isFullscreenModeEnabled = lua["isFullscreenModeEnabled"].get_or(isFullscreenModeEnabled);
|
||||
isVerticalSyncEnabled = lua["isVerticalSyncEnabled"].get_or(isVerticalSyncEnabled);
|
||||
cameraFOV = lua["cameraFOV"].get_or(cameraFOV);
|
||||
screenWidth = lua["screenWidth"].get_or(screenWidth);
|
||||
screenHeight = lua["screenHeight"].get_or(screenHeight);
|
||||
guiScale = lua["guiScale"].get_or(guiScale);
|
||||
mipmapLevels = lua["mipmapLevels"].get_or(mipmapLevels);
|
||||
guiScale = std::clamp<u8>(lua["guiScale"].get_or(guiScale), 1, 3);
|
||||
mipmapLevels = std::clamp<u8>(lua["mipmapLevels"].get_or(mipmapLevels), 0, 4);
|
||||
|
||||
mouseSensitivity = lua["mouseSensitivity"].get_or(mouseSensitivity);
|
||||
|
||||
@ -126,8 +126,8 @@ void Config::saveConfigToFile(const char *filename) {
|
||||
file << "isCrosshairVisible = " << (isCrosshairVisible ? "true" : "false") << std::endl;
|
||||
file << std::endl;
|
||||
file << "renderDistance = " << renderDistance << std::endl;
|
||||
file << "ambientOcclusion = " << (u16)ambientOcclusion << std::endl;
|
||||
file << "isSmoothLightingEnabled = " << (isSmoothLightingEnabled ? "true" : "false") << std::endl;
|
||||
file << "isAmbientOcclusionEnabled = " << (isAmbientOcclusionEnabled ? "true" : "false") << std::endl;
|
||||
file << "isWireframeModeEnabled = " << (isWireframeModeEnabled ? "true" : "false") << std::endl;
|
||||
file << "isFullscreenModeEnabled = " << (isFullscreenModeEnabled ? "true" : "false") << std::endl;
|
||||
file << "isVerticalSyncEnabled = " << (isVerticalSyncEnabled ? "true" : "false") << std::endl;
|
||||
|
@ -45,8 +45,8 @@ namespace Config {
|
||||
|
||||
// Graphics
|
||||
extern u16 renderDistance;
|
||||
extern u8 ambientOcclusion;
|
||||
extern bool isSmoothLightingEnabled;
|
||||
extern bool isAmbientOcclusionEnabled;
|
||||
extern bool isWireframeModeEnabled;
|
||||
extern bool isFullscreenModeEnabled;
|
||||
extern bool isVerticalSyncEnabled;
|
||||
|
@ -215,13 +215,21 @@ void SettingsMenuState::addGraphicsButtons() {
|
||||
Config::isSmoothLightingEnabled = !Config::isSmoothLightingEnabled;
|
||||
button.setText(std::string("Smooth Lighting: ") + (Config::isSmoothLightingEnabled ? "ON" : "OFF"));
|
||||
|
||||
m_aoButton->setEnabled(!Config::isSmoothLightingEnabled);
|
||||
|
||||
World::isReloadRequested = true;
|
||||
});
|
||||
|
||||
m_aoButton = &addToggleButton("Ambient Occlusion", Config::isAmbientOcclusionEnabled, true);
|
||||
m_aoButton->setEnabled(!Config::isSmoothLightingEnabled);
|
||||
const std::string aoValueNames[3] = {
|
||||
"OFF",
|
||||
"Normal",
|
||||
"Smooth Lighting"
|
||||
};
|
||||
|
||||
m_menuWidget.addButton(std::string("Ambient Occlusion: ") + aoValueNames[Config::ambientOcclusion], [&, aoValueNames] (TextButton &button) {
|
||||
Config::ambientOcclusion = (Config::ambientOcclusion + 1) % (Config::isSmoothLightingEnabled ? 3 : 2);
|
||||
button.setText(std::string("Ambient Occlusion: ") + aoValueNames[Config::ambientOcclusion]);
|
||||
|
||||
World::isReloadRequested = true;
|
||||
});
|
||||
|
||||
m_menuWidget.addSlider("GUI Scale: " + std::to_string(Config::guiScale), [this] (SliderWidget &slider, u32 eventType) {
|
||||
slider.setText("GUI Scale: " + std::to_string(slider.getCurrentValue()));
|
||||
|
@ -260,7 +260,7 @@ inline void ChunkBuilder::addFace(s8f x, s8f y, s8f z, s8f f, const ClientChunk
|
||||
}
|
||||
|
||||
auto addVertex = [&](u8 v) {
|
||||
if (!Config::isAmbientOcclusionEnabled || Config::isSmoothLightingEnabled)
|
||||
if (Config::ambientOcclusion != 1)
|
||||
vertices[v].ambientOcclusion = 5;
|
||||
|
||||
if (blockState.drawType() == BlockDrawType::Liquid)
|
||||
@ -411,10 +411,8 @@ inline u8 ChunkBuilder::getLightForVertex(Light light, s8f x, s8f y, s8f z, cons
|
||||
// continue;
|
||||
|
||||
// If the chunk is initialized, add the light value to the total
|
||||
if (lightValues[i] != -1) {
|
||||
// float strength = ((surroundingBlocks[i] - normal == gk::Vector3i{x, y, z}) ? 1 : Config::aoStrength);
|
||||
// total += lightValues[i] * strength;
|
||||
// count += strength;
|
||||
// But only add dark blocks if AO is set on Smooth Lighting
|
||||
if (lightValues[i] != -1 && (Config::ambientOcclusion == 2 || lightValues[i] != 0)) {
|
||||
total += lightValues[i];
|
||||
++count;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user