I am making a voxel game with OpenGl, I've got the major parts working, except the camera seems small compared to the the blocks.
How do I make the camera bigger?
Do I do a scaling on the model matrix for each chunk? Or do I do something with the view matrix of the camera? When i tried these things, it messed up the coordinate system of my game, the blocks were not where they really were. I just want the player to be visually 2x bigger.
// the view matrix
glm::mat4 Camera::GetViewMatrix()
{
glm::mat4 view = glm::lookAt(position, position + target, up);
return view;
}
// Where i do the chunk rendering
void WorldRenderer::RenderChunck(Chunk *c)
{
glActiveTexture(GL_TEXTURE0);
worldTexture->BindTexture();
worldShader->Bind();
worldVertexBuffer->BindVertexArrayBuffer();
worldVertexBuffer->PutVertexData(c->meshData.verts, c->meshData.indices, c->meshData.textureCoords);
glm::mat4 model = glm::mat4(1.0f); // model = local space to world space
model = glm::translate(model, vec3(c->pos.x * Chunk::CHUNCK_SIZE, c->pos.y * Chunk::CHUNCK_SIZE, c->pos.z * Chunk::CHUNCK_SIZE));
worldShader->setMat4f("model", model);
glDrawElements(GL_TRIANGLES, c->meshData.indices.size(), GL_UNSIGNED_INT, 0);
}
void WorldRenderer::Render(glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
{
worldShader->setMat4f("view", viewMatrix);
worldShader->setMat4f("projection", projectionMatrix);
for (Chunk *c : renderedChunks)
{
this->RenderChunck(c);
}
}