BIG REFACTOR Part 2

This commit is contained in:
2022-02-16 18:34:49 +01:00
parent bdebabb79e
commit 97a33e5517
11 changed files with 98 additions and 106 deletions

View File

@@ -56,7 +56,7 @@ bool Renderer::init() {
void Renderer::renderVAO(const GL::VertexArray& vao) {
m_WorldShader->start();
vao.bind();
glDrawArrays(GL_TRIANGLES, 0, vao.getVertexCount());
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(vao.getVertexCount()));
vao.unbind();
}
@@ -64,14 +64,14 @@ void Renderer::renderModel(const Model& model) {
m_EntityShader->start();
m_EntityShader->setModelPos(model.positon);
model.vao->bind();
glDrawArrays(GL_TRIANGLES, 0, model.vao->getVertexCount());
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(model.vao->getVertexCount()));
model.vao->unbind();
}
void Renderer::updateIsometricFade() {
static std::uint64_t lastTime = utils::getTime();
if (m_IsometricShade != (float)m_IsometricView) {
float step = (float)(utils::getTime() - lastTime) / 1000.0f * m_AnimationSpeed;
if (m_IsometricShade != static_cast<float>(m_IsometricView)) {
float step = static_cast<float>(utils::getTime() - lastTime) / 1000.0f * m_AnimationSpeed;
if (m_IsometricShade < m_IsometricView) {
m_IsometricShade += step;
} else {
@@ -92,9 +92,9 @@ void Renderer::prepare() {
void Renderer::resize(int width, int height) {
m_WorldShader->start();
m_WorldShader->setAspectRatio((float)width / height);
m_WorldShader->setAspectRatio(static_cast<float>(width) / height);
m_EntityShader->start();
m_EntityShader->setAspectRatio((float)width / height);
m_EntityShader->setAspectRatio(static_cast<float>(width) / height);
glViewport(0, 0, width, height);
}