Merged smooth lighting config options.
This commit is contained in:
parent
466c0cff67
commit
abbf55fd21
config
source/client
@ -14,8 +14,7 @@ isCrosshairVisible = true
|
||||
|
||||
-- Graphics
|
||||
renderDistance = 8
|
||||
isTorchSmoothLightingEnabled = true
|
||||
isSunSmoothLightingEnabled = true
|
||||
isSmoothLightingEnabled = true
|
||||
isAmbientOcclusionEnabled = false
|
||||
isWireframeModeEnabled = false
|
||||
isFullscreenModeEnabled = false
|
||||
|
@ -45,8 +45,7 @@ bool Config::isCrosshairVisible = true;
|
||||
|
||||
// Graphics
|
||||
u16 Config::renderDistance = 8;
|
||||
bool Config::isTorchSmoothLightingEnabled = true;
|
||||
bool Config::isSunSmoothLightingEnabled = true;
|
||||
bool Config::isSmoothLightingEnabled = true;
|
||||
bool Config::isAmbientOcclusionEnabled = false;
|
||||
bool Config::isWireframeModeEnabled = false;
|
||||
bool Config::isFullscreenModeEnabled = false;
|
||||
@ -81,8 +80,7 @@ void Config::loadConfigFromFile(const char *filename) {
|
||||
isCrosshairVisible = lua["isCrosshairVisible"].get_or(isCrosshairVisible);
|
||||
|
||||
renderDistance = lua["renderDistance"].get_or(renderDistance);
|
||||
isTorchSmoothLightingEnabled = lua["isTorchSmoothLightingEnabled"].get_or(isTorchSmoothLightingEnabled);
|
||||
isSunSmoothLightingEnabled = lua["isSunSmoothLightingEnabled"].get_or(isSunSmoothLightingEnabled);
|
||||
isSmoothLightingEnabled = lua["isSmoothLightingEnabled"].get_or(isSmoothLightingEnabled);
|
||||
isAmbientOcclusionEnabled = lua["isAmbientOcclusionEnabled"].get_or(isAmbientOcclusionEnabled);
|
||||
isWireframeModeEnabled = lua["isWireframeModeEnabled"].get_or(isWireframeModeEnabled);
|
||||
isFullscreenModeEnabled = lua["isFullscreenModeEnabled"].get_or(isFullscreenModeEnabled);
|
||||
@ -118,8 +116,7 @@ void Config::saveConfigToFile(const char *filename) {
|
||||
file << "isCrosshairVisible = " << (isCrosshairVisible ? "true" : "false") << std::endl;
|
||||
file << std::endl;
|
||||
file << "renderDistance = " << renderDistance << std::endl;
|
||||
file << "isTorchSmoothLightingEnabled = " << (isTorchSmoothLightingEnabled ? "true" : "false") << std::endl;
|
||||
file << "isSunSmoothLightingEnabled = " << (isSunSmoothLightingEnabled ? "true" : "false") << 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;
|
||||
|
@ -44,8 +44,7 @@ namespace Config {
|
||||
|
||||
// Graphics
|
||||
extern u16 renderDistance;
|
||||
extern bool isTorchSmoothLightingEnabled;
|
||||
extern bool isSunSmoothLightingEnabled;
|
||||
extern bool isSmoothLightingEnabled;
|
||||
extern bool isAmbientOcclusionEnabled;
|
||||
extern bool isWireframeModeEnabled;
|
||||
extern bool isFullscreenModeEnabled;
|
||||
|
@ -201,9 +201,17 @@ void SettingsMenuState::addGraphicsButtons() {
|
||||
|
||||
addToggleButton("Wireframe Mode", Config::isWireframeModeEnabled, false);
|
||||
|
||||
addToggleButton("Torch Smooth Lighting", Config::isTorchSmoothLightingEnabled, true);
|
||||
addToggleButton("Sun Smooth Lighting", Config::isSunSmoothLightingEnabled, true);
|
||||
addToggleButton("Ambient Occlusion", Config::isAmbientOcclusionEnabled, true);
|
||||
m_menuWidget.addButton(std::string("Smooth Lighting: ") + (Config::isSmoothLightingEnabled ? "ON" : "OFF"), [&] (TextButton &button) {
|
||||
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);
|
||||
|
||||
m_menuWidget.addButton("GUI Scale: " + std::to_string(Config::guiScale), [this] (TextButton &button) {
|
||||
Config::guiScale = 1 + (Config::guiScale + 1) % 3;
|
||||
|
@ -82,6 +82,8 @@ class SettingsMenuState : public InterfaceState {
|
||||
};
|
||||
|
||||
MenuState m_state = MenuState::Main;
|
||||
|
||||
TextButton *m_aoButton = nullptr;
|
||||
};
|
||||
|
||||
#endif // SETTINGSMENUSTATE_HPP_
|
||||
|
@ -238,13 +238,13 @@ inline void ChunkBuilder::addFace(s8f x, s8f y, s8f z, s8f f, const ClientChunk
|
||||
vertices[v].texCoord[0] = gk::qlerp(blockTexCoords.x, blockTexCoords.x + blockTexCoords.sizeX, U);
|
||||
vertices[v].texCoord[1] = gk::qlerp(blockTexCoords.y, blockTexCoords.y + blockTexCoords.sizeY, V);
|
||||
|
||||
if (Config::isSunSmoothLightingEnabled && block.drawType() != BlockDrawType::Liquid)
|
||||
if (Config::isSmoothLightingEnabled && block.drawType() != BlockDrawType::Liquid)
|
||||
vertices[v].lightValue[0] = getLightForVertex(Light::Sun, x, y, z, *neighbourOfs[v], normal, chunk);
|
||||
else
|
||||
vertices[v].lightValue[0] = chunk.lightmap().getSunlight(x + normal.x, y + normal.y, z + normal.z);
|
||||
|
||||
int torchlight = chunk.lightmap().getTorchlight(x, y, z);
|
||||
if (Config::isTorchSmoothLightingEnabled && torchlight == 0 && block.drawType() != BlockDrawType::Liquid)
|
||||
if (Config::isSmoothLightingEnabled && torchlight == 0 && block.drawType() != BlockDrawType::Liquid)
|
||||
vertices[v].lightValue[1] = getLightForVertex(Light::Torch, x, y, z, *neighbourOfs[v], normal, chunk);
|
||||
else
|
||||
vertices[v].lightValue[1] = chunk.lightmap().getTorchlight(x + normal.x, y + normal.y, z + normal.z);
|
||||
|
Loading…
x
Reference in New Issue
Block a user