Little improvements.

This commit is contained in:
Quentin BAZIN 2013-05-22 23:43:05 +02:00
parent 89a4b19e1c
commit 8f721db68c
19 changed files with 41 additions and 52 deletions

11
AUTHORS
View File

@ -1,6 +1,9 @@
# These persons made anything for Eplith
# These persons made anything for KubKraft
-- Original creator --
Quentin BAZIN <quent42340@gmail.com>
* Quentin Bazin <quent42340@gmail.com>
-- Other people --
smealum
Synthesis
- For help:
* smealum
* Synthesis
- For SimplexNoise implementation:
* Stefan Gustavson <stegu@itn.liu.se>

View File

@ -1,5 +1,5 @@
h1. KubKraft
h2. By Quent42340
h2. By Quentin Bazin (aka. Quent42340)
* KubKraft is a Minecraft-like game.

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -174,33 +174,19 @@ float Chunk::getTexOffsetU(int type, int i, Cube *cube) {
Cube *higherCube = NULL;
if(cube->z() < m_z + CHUNK_HEIGHT - 1) higherCube = getCube(cube->x() - m_x, cube->y() - m_y, cube->z() - m_z + 1);
else {
if(m_surroundingChunks[4] != NULL) higherCube = m_surroundingChunks[4]->getCube(cube->x() - m_x, cube->y() - m_y, 0);
}
else if(m_surroundingChunks[4] != NULL) higherCube = m_surroundingChunks[4]->getCube(cube->x() - m_x, cube->y() - m_y, 0);
if((higherCube == NULL) || (higherCube->type() == 0)) {
if((i == 0) || (i == 1) || (i == 2) || (i == 3)) {
if((i == 0) || (i == 1) || (i == 2) || (i == 3))
return type * 0.125;
}
else if(i == 4) {
return (type + 1) * 0.125;
} else {
return (type - 1) * 0.125;
}
} else {
return (type - 1) * 0.125;
}
} else {
return (type - 1) * 0.125;
}
else if(i == 4) return (type + 1) * 0.125;
else return (type - 1) * 0.125;
} else return (type - 1) * 0.125;
} else return (type - 1) * 0.125;
}
float Chunk::getTexOffsetV(int type) {
if(type > 8) {
//type <<= 3; // Here 8 ( remember x * 8 == x << 3 ) is the texture image width
return 1 - ((type >> 3) + 1) * 0.125;
}
return 0.875;
return 1 - ((type >> 3) + 1) * 0.125;
}
void Chunk::refreshVBO() {

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -84,7 +84,7 @@ Map::Map(u16 width, u16 depth, u16 height) {
if(zz < dirtHeight) m_map[_MAP_POS(xC + (xx << 3), yC + (yy << 3), zz)] = 1;
else if(zz > dirtHeight && zz < dirtHeight + 3) m_map[_MAP_POS(xC + (xx << 3), yC + (yy << 3), zz)] = rand()%2 + 1;
else m_map[_MAP_POS(xC + (xx << 3), yC + (yy << 3), zz)] = 2;
if(zz < 16 && cavePerlin > 0.01 && cavePerlin < 0.05) m_map[_MAP_POS(xC + (xx << 3), yC + (yy << 3), zz)] = 10;
if(zz < 16 && cavePerlin > 0.01 && cavePerlin < 0.02) m_map[_MAP_POS(xC + (xx << 3), yC + (yy << 3), zz)] = 10;
}
if(zz == 0) {
@ -276,15 +276,15 @@ void Map::render() {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
extractFrustum();
currentChunk = findNearestChunk(Game::player->x(), Game::player->y(), Game::player->z());
//uint32_t time = SDL_GetTicks();
extractFrustum();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
for(int i = 0 ; i < ((m_width >> 3) * (m_depth >> 3) * (m_height >> 3)); i++) {
if(cubeInFrustum(m_chunks[i]->x(), m_chunks[i]->y(), m_chunks[i]->z(), 8)) {
@ -292,15 +292,15 @@ void Map::render() {
}
}
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
//time = SDL_GetTicks() - time;
//cout << "Render time: " << time << " ms" << endl;
testCubes();
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glBindTexture(GL_TEXTURE_2D, 0);
if ((currentChunk != NULL) && (selectedCube->x() != -1) && (selectedCube->selectedFace() >= 0) && (selectedCube->selectedFace() < 6)) {

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------
KubKraft
Copyright (C) 2012 Quent42340 <quent42340@gmail.com>
Copyright (C) 2013 Quentin Bazin <quent42340@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by