[Chunk] Working on it.
This commit is contained in:
parent
0b806a93c6
commit
56d3ddb14a
@ -37,7 +37,6 @@ void main() {
|
||||
}
|
||||
|
||||
vec4 surfaceColor = texture2D(u_tex, v_texCoord);
|
||||
|
||||
gl_FragColor = surfaceColor * (ambientColor + diffuseColor);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,8 @@ void Application::initGL() {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
|
||||
glClearColor(0.196078, 0.6, 0.8, 1.0); // Skyblue
|
||||
}
|
||||
|
||||
|
@ -26,16 +26,8 @@ GameState::GameState() {
|
||||
Shader::bind(&m_shader);
|
||||
|
||||
m_projectionMatrix = glm::perspective(45.0f, 640.0f / 480.0f, 0.1f, 3000.0f);
|
||||
/*glm::mat4 modelviewMatrix = glm::lookAt(glm::vec3(-20.0f, 40.0f, -20.0f),
|
||||
glm::vec3(16.0f, 16.0f, 16.0f),
|
||||
glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
*/
|
||||
m_viewMatrix = m_camera.update();
|
||||
|
||||
//glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
|
||||
m_shader.setUniform("u_tex", 0);
|
||||
|
||||
Shader::bind(nullptr);
|
||||
|
@ -174,6 +174,7 @@ void Chunk::update() {
|
||||
|| (x == width - 1 && m_surroundingChunks[1] && m_surroundingChunks[1]->getBlock(0, y, z) && i == 1)
|
||||
|| (z == 0 && m_surroundingChunks[2] && m_surroundingChunks[2]->getBlock(x, y, depth - 1) && i == 5)
|
||||
|| (z == depth - 1 && m_surroundingChunks[3] && m_surroundingChunks[3]->getBlock(x, y, 0) && i == 4)
|
||||
|| y < 18
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
@ -183,6 +184,8 @@ void Chunk::update() {
|
||||
glm::vec3 normal = glm::normalize(glm::cross(u, v));
|
||||
|
||||
for(u8 j = 0 ; j < 4 ; j++) {
|
||||
DEBUG("(", (int)x, (int)y, (int)z, "): [", (int)i, (int)j, "] >= (", x + cubeCoords[i * 12 + j * 3], y + cubeCoords[i * 12 + j * 3 + 1], z + cubeCoords[i * 12 + j * 3 + 2], ")");
|
||||
|
||||
m_vertices.push_back(x + cubeCoords[i * 12 + j * 3]);
|
||||
m_vertices.push_back(y + cubeCoords[i * 12 + j * 3 + 1]);
|
||||
m_vertices.push_back(z + cubeCoords[i * 12 + j * 3 + 2]);
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "World.hpp"
|
||||
|
||||
World::World() {
|
||||
m_width = 4;
|
||||
m_depth = 4;
|
||||
m_width = 1;
|
||||
m_depth = 1;
|
||||
|
||||
//for(s32 z = -m_depth / 2 ; z < m_depth / 2 ; z++) {
|
||||
// for(s32 x = -m_width / 2 ; x < m_width / 2 ; x++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user