[README] Updated.

This commit is contained in:
Quentin Bazin 2014-12-21 17:02:09 +01:00
parent 89e7cd1414
commit 318c7ad77f
4 changed files with 34 additions and 6 deletions

View File

@ -3,3 +3,23 @@ h1. KubKraft
h2. By Quentin Bazin (aka. Quent42340)
* KubKraft is a Minecraft-like game.
h2. Keys
* View: mouse controlled
* Movement: @Z@, @Q@, @S@ and @D@
* Land: @Shift@
* Fly: @Space@
* Exit: @Escape@
h2. How to compile (Linux and Mac OS-X only)
* Required: @SDL@ (>= 2.0), @OpenGL@ (=> 2.1), @glm@
* Run @make@ at the root of the game folder
* Run @make run@, and enjoy!
h2. Note for Windows users
* Windows requires @glew@ to compile
* The @Makefile@ is not yet compatible with Windows

View File

@ -22,8 +22,11 @@
#include <glm/glm.hpp>
#define RADIANS_PER_DEGREES 0.0174532925199
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define RADIANS_PER_DEGREES 0.0174532925199
class Camera {
public:

View File

@ -37,7 +37,8 @@ class Chunk {
u8 getBlock(s8 x, s8 y, s8 z);
s32 getVertexID(u8 x, u8 y, u8 z, u8 i, u8 j, u8 coordinate, u8 nbCoordinates = 3);
s32 getVertexID(u8 x, u8 y, u8 z, u8 i, u8 j, u8 coordinate);
s32 getTexCoordID(u8 x, u8 y, u8 z, u8 i, u8 j, u8 coordinate);
static float noise2d(float x, float y, int seed, int octaves, float persistence);
static float noise3d_abs(float x, float y, float z, int seed, int octaves, float persistence);

View File

@ -180,8 +180,8 @@ void Chunk::update() {
m_vertices[m_verticesID[getVertexID(x - 1, y, z, 5, 0, 0)]] += 1;
m_vertices[m_verticesID[getVertexID(x - 1, y, z, 5, 1, 0)]] += 1;
m_texCoords[m_verticesID[getVertexID(x - 1, y, z, 5, 0, 0, 2)]] += 1;
m_texCoords[m_verticesID[getVertexID(x - 1, y, z, 5, 1, 0, 2)]] += 1;
m_texCoords[getTexCoordID(x - 1, y, z, 5, 0, 0)] += 1;
m_texCoords[getTexCoordID(x - 1, y, z, 5, 1, 0)] += 1;
//m_texCoords[getTexCoordID(x - 1, y, z, 5, 0, 1, skipped)] += 1;
//m_texCoords[getTexCoordID(x - 1, y, z, 5, 1, 1)] += 1;
@ -283,8 +283,12 @@ u8 Chunk::getBlock(s8 x, s8 y, s8 z) {
}
}
s32 Chunk::getVertexID(u8 x, u8 y, u8 z, u8 i, u8 j, u8 coordinate, u8 nbCoordinates) {
return (j + i * 4 + x * 4 * 6 + y * 4 * 6 * Chunk::width + z * 4 * 6 * Chunk::width * Chunk::height) * nbCoordinates + coordinate;
s32 Chunk::getVertexID(u8 x, u8 y, u8 z, u8 i, u8 j, u8 coordinate) {
return (j + i * 4 + x * 4 * 6 + y * 4 * 6 * Chunk::width + z * 4 * 6 * Chunk::width * Chunk::height) * 3 + coordinate;
}
s32 Chunk::getTexCoordID(u8 x, u8 y, u8 z, u8 i, u8 j, u8 coordinate) {
return m_verticesID[getVertexID(x, y, z, i, j, coordinate)] - m_vertices.size() / 3;
}
float Chunk::noise2d(float x, float y, int seed, int octaves, float persistence) {