mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +00:00
Minor refactor and fixes
This commit is contained in:
parent
1b935aa081
commit
5175c9be92
4 changed files with 12 additions and 10 deletions
|
|
@ -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() {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ public:
|
||||||
|
|
||||||
mat4 getProjection();
|
mat4 getProjection();
|
||||||
mat4 getView();
|
mat4 getView();
|
||||||
|
mat4 getProjView();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WINDOW_CAMERA_H_ */
|
#endif /* WINDOW_CAMERA_H_ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue