enemies_placement #16

Closed
s473577 wants to merge 4 commits from enemies_placement into master
Showing only changes of commit 95988104a1 - Show all commits

View File

@ -103,15 +103,24 @@ void updateDeltaTime(float time) {
if (deltaTime > 0.1) deltaTime = 0.1;
lastTime = time;
}
void renderHUD() {
void renderHUD(GLFWwindow* window) {
glm::mat4 modelMatrixHUD = spaceship->calculateModelMatrixForHUDBar();
glm::mat4 healthBarPosition;
glm::vec3 healthBarScale;
if (glfwGetWindowAttrib(window, GLFW_MAXIMIZED)) {
healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -11.0f, 0.0f));
healthBarScale = glm::vec3(22.0f, 2.f, 1.0f);
}
else {
healthBarScale = glm::vec3(22.0f, 4.f, 1.0f);
healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -30.0f, 0.0f));
}
glUseProgram(programSpriteBar);
glDisable(GL_DEPTH_TEST);
glm::mat4 modelMatrixHUD = spaceship->calculateModelMatrixForHUDBar();
glm::mat4 healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -35.0f, 0.0f));
spriteRenderer->DrawHUDBar(
glm::vec3(0.0f, 1.0f, 0.0f),
glm::scale(healthBarPosition, glm::vec3(22.0f, 4.f, 1.0f)),
glm::scale(healthBarPosition, healthBarScale),
spaceship->currentHP / spaceship->maxHP,
programSpriteBar);
glEnable(GL_DEPTH_TEST);
@ -238,7 +247,7 @@ void renderScene(GLFWwindow* window)
spaceship->renderParticles(programParticle, viewMatrix, Core::createPerspectiveMatrix(), time);
renderHUD();
renderHUD(window);
renderEnemies();
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);