Minor refactor and fixes

This commit is contained in:
MihailRis
2023-11-16 10:53:34 +03:00
parent 1b935aa081
commit 5175c9be92
4 changed files with 12 additions and 10 deletions
+3 -7
View File
@@ -72,7 +72,6 @@ MenuScreen::MenuScreen(Engine* engine_) : Screen(engine_) {
}); });
panel->add(shared_ptr<UINode>(button)); panel->add(shared_ptr<UINode>(button));
} }
this->panel = shared_ptr<UINode>(panel); this->panel = shared_ptr<UINode>(panel);
engine->getGUI()->add(this->panel); engine->getGUI()->add(this->panel);
} }
@@ -100,15 +99,12 @@ LevelScreen::~LevelScreen() {
delete hud; delete hud;
delete worldRenderer; delete worldRenderer;
std::cout << "-- writing world" << std::endl;
World* world = level->world; World* world = level->world;
std::cout << "-- saving world" << std::endl;
world->write(level, !engine->getSettings().debug.generatorTestMode); world->write(level, !engine->getSettings().debug.generatorTestMode);
delete world;
delete level; delete level;
delete world;
} }
void LevelScreen::updateHotkeys() { void LevelScreen::updateHotkeys() {
@@ -151,4 +147,4 @@ void LevelScreen::draw(float delta) {
if (level->player->debug) { if (level->player->debug) {
hud->drawDebug( 1 / delta, occlusion); hud->drawDebug( 1 / delta, occlusion);
} }
} }
+4 -3
View File
@@ -94,10 +94,11 @@ void WorldRenderer::draw(Camera* camera, bool occlusion, float fogFactor, float
shader->uniform3f("u_cameraPos", camera->position.x,camera->position.y,camera->position.z); shader->uniform3f("u_cameraPos", camera->position.x,camera->position.y,camera->position.z);
Block* cblock = Block::blocks[level->player->choosenBlock]; Block* cblock = Block::blocks[level->player->choosenBlock];
float multiplier = 0.2f;
shader->uniform3f("u_torchlightColor", shader->uniform3f("u_torchlightColor",
cblock->emission[0] / 15.0f, cblock->emission[0] / 15.0f * multiplier,
cblock->emission[1] / 15.0f, cblock->emission[1] / 15.0f * multiplier,
cblock->emission[2] / 15.0f); cblock->emission[2] / 15.0f * multiplier);
shader->uniform1f("u_torchlightDistance", 6.0f); shader->uniform1f("u_torchlightDistance", 6.0f);
texture->bind(); texture->bind();
+4
View File
@@ -48,3 +48,7 @@ mat4 Camera::getView(){
else else
return glm::translate(glm::mat4(1.0f), position); return glm::translate(glm::mat4(1.0f), position);
} }
mat4 Camera::getProjView(){
return getProjection()*getView();
}
+1
View File
@@ -25,6 +25,7 @@ public:
mat4 getProjection(); mat4 getProjection();
mat4 getView(); mat4 getView();
mat4 getProjView();
}; };
#endif /* WINDOW_CAMERA_H_ */ #endif /* WINDOW_CAMERA_H_ */