Commit d49d0bb5 authored by Dario Seyb's avatar Dario Seyb

improved noise a bit

parent 9de041b5
{ {
"resolution": [1280, 720], "resolution": [1280, 720],
"target_fps": 60, "target_fps": 60,
"vsync": false,
"fullscreen": false, "fullscreen": false,
"quality": "high", "quality": "high",
"ssao": false, "ssao": false,
......
...@@ -121,7 +121,7 @@ float hash_noise( in vec3 x ) ...@@ -121,7 +121,7 @@ float hash_noise( in vec3 x )
return mix(mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), return mix(mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),
mix( hash(n+157.0), hash(n+158.0),f.x),f.y), mix( hash(n+157.0), hash(n+158.0),f.x),f.y),
mix(mix( hash(n+113.0), hash(n+114.0),f.x), mix(mix( hash(n+113.0), hash(n+114.0),f.x),
mix( hash(n+270.0), hash(n+271.0),f.x),f.y),f.z) * 2.0 - 1.0; mix( hash(n+270.0), hash(n+271.0),f.x),f.y),f.z) * 4.0 - 2.0;
} }
......
...@@ -34,7 +34,8 @@ private: ...@@ -34,7 +34,8 @@ private:
QualitySetting m_qualitySetting; QualitySetting m_qualitySetting;
bool m_fullscreen; bool m_fullscreen;
bool m_ssaoEnabled; bool m_ssaoEnabled;
uint64_t m_targetFps; bool m_vsyncEnabled;
uint64_t m_targetFps;
std::string m_defaultScene; std::string m_defaultScene;
std::string m_defaultPlanetType; std::string m_defaultPlanetType;
...@@ -57,6 +58,7 @@ public: ...@@ -57,6 +58,7 @@ public:
inline glm::ivec2 getResolution() const { return m_resolution; } inline glm::ivec2 getResolution() const { return m_resolution; }
inline bool getFullscreen() const { return m_fullscreen; } inline bool getFullscreen() const { return m_fullscreen; }
inline bool ssaoEnabled() const { return m_ssaoEnabled; } inline bool ssaoEnabled() const { return m_ssaoEnabled; }
inline bool vsyncEnabled() const { return m_vsyncEnabled; }
inline uint64_t getTargetFps() const { return m_targetFps; } inline uint64_t getTargetFps() const { return m_targetFps; }
inline QualitySetting getQualitySetting() const { return m_qualitySetting; } inline QualitySetting getQualitySetting() const { return m_qualitySetting; }
inline std::string getDefaultScene() const { return m_defaultScene; } inline std::string getDefaultScene() const { return m_defaultScene; }
......
...@@ -44,6 +44,7 @@ bool SettingsSystem::startup() { ...@@ -44,6 +44,7 @@ bool SettingsSystem::startup() {
m_resolution = { 1280, 720 }; m_resolution = { 1280, 720 };
m_qualitySetting = QualitySetting::High; m_qualitySetting = QualitySetting::High;
m_fullscreen = false; m_fullscreen = false;
m_vsyncEnabled = true;
m_targetFps = 60; m_targetFps = 60;
m_defaultScene = "AtmosphereTest"; m_defaultScene = "AtmosphereTest";
m_defaultPlanetType = "earth"; m_defaultPlanetType = "earth";
...@@ -108,6 +109,9 @@ bool SettingsSystem::startup() { ...@@ -108,6 +109,9 @@ bool SettingsSystem::startup() {
} else if (i.first == "ssao") { } else if (i.first == "ssao") {
VALIDATE_TYPE(i, bool); VALIDATE_TYPE(i, bool);
m_ssaoEnabled = i.second.get<bool>(); m_ssaoEnabled = i.second.get<bool>();
} else if (i.first == "vsync") {
VALIDATE_TYPE(i, bool);
m_vsyncEnabled = i.second.get<bool>();
} else if (i.first == "target_fps") { } else if (i.first == "target_fps") {
VALIDATE_TYPE(i, int64_t); VALIDATE_TYPE(i, int64_t);
m_targetFps = i.second.get<int64_t>(); m_targetFps = i.second.get<int64_t>();
......
...@@ -114,7 +114,7 @@ bool WindowSystem::createWindow() { ...@@ -114,7 +114,7 @@ bool WindowSystem::createWindow() {
} }
// Use Vsync // Use Vsync
if (SDL_GL_SetSwapInterval(1) < 0) { if (SDL_GL_SetSwapInterval(m_settings->vsyncEnabled() ? 1 : 0) < 0) {
printf("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError()); printf("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError());
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment