@@ -5,7 +5,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CMakeModules/)
|
|||||||
cmake_policy(SET CMP0037 OLD)
|
cmake_policy(SET CMP0037 OLD)
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
# set(CMAKE_CXX_FLAGS "-Ofast")
|
set(CMAKE_CXX_FLAGS "-Ofast")
|
||||||
|
|
||||||
set(executable output)
|
set(executable output)
|
||||||
set(SrcDIR ./src)
|
set(SrcDIR ./src)
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -6,19 +6,11 @@ A Minecraft clone written in C++ with OpenGL
|
|||||||
|
|
||||||
### Development Checklist
|
### Development Checklist
|
||||||
|
|
||||||
### Trello coming soon
|
#### Trello:
|
||||||
|
|
||||||
- [X] Block atlas
|
All of the projects progress will be tracked here
|
||||||
- [X] Texturing faces
|
|
||||||
- [X] Mesh chunks
|
https://trello.com/b/jpGIDFKm/minecraft
|
||||||
- [X] Fog
|
|
||||||
- [ ] Fustrum culling
|
|
||||||
- [ ] Chunk generation around the player
|
|
||||||
- [X] Threaded chunk generation
|
|
||||||
- [ ] Player collision
|
|
||||||
- [ ] Player cursor
|
|
||||||
- [ ] Procedural world generation
|
|
||||||
- [ ] . . .
|
|
||||||
|
|
||||||
Even after this initial short checklist there will be a lot to implement to have a playable minecraft clone, its really there so you can see the development stage of the renderer.
|
Even after this initial short checklist there will be a lot to implement to have a playable minecraft clone, its really there so you can see the development stage of the renderer.
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ void main() {
|
|||||||
if (outColour.w == .0)
|
if (outColour.w == .0)
|
||||||
discard;
|
discard;
|
||||||
|
|
||||||
float fogMax = 60000;
|
float fogMax = 200000;
|
||||||
|
|
||||||
vec3 colour = mix(outColour.xyz, SkyColour, min(1.0f, Distance / fogMax));
|
vec3 colour = mix(outColour.xyz, SkyColour, min(1.0f, Distance / fogMax));
|
||||||
|
|
||||||
|
|||||||
35
src/physics/collider.cpp
Normal file
35
src/physics/collider.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#include "collider.hpp"
|
||||||
|
|
||||||
|
EntityCollider::EntityCollider() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 EntityCollider::TerrainCollide(std::vector<uint8_t> terrain) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EntityCollider::m_aabb(ColliderBox a, ColliderBox b) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
(a.Min.x <= b.Min.x + b.Max.x && a.Min.x + a.Max.x >= b.Min.x) &&
|
||||||
|
(a.Min.y <= b.Min.y + b.Max.y && a.Min.y + a.Max.y >= b.Min.y) &&
|
||||||
|
(a.Min.z <= b.Min.z + b.Max.z && a.Min.z + a.Max.z >= b.Min.z)
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float EntityCollider::m_xDepth(ColliderBox a, ColliderBox b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float EntityCollider::m_yDepth(ColliderBox a, ColliderBox b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float EntityCollider::m_zDepth(ColliderBox a, ColliderBox b) {
|
||||||
|
|
||||||
|
}
|
||||||
34
src/physics/collider.hpp
Normal file
34
src/physics/collider.hpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef MINECRAFT_PHYSICS_COLLIDER_H_
|
||||||
|
#define MINECRAFT_PHYSICS_COLLIDER_H_
|
||||||
|
|
||||||
|
#include "../common.hpp"
|
||||||
|
|
||||||
|
class ColliderBox {
|
||||||
|
public:
|
||||||
|
glm::vec3 Min;
|
||||||
|
glm::vec3 Max;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EntityCollider {
|
||||||
|
public:
|
||||||
|
|
||||||
|
EntityCollider();
|
||||||
|
|
||||||
|
// Surrounding blocks indexed XYZ
|
||||||
|
// Returns point of collision
|
||||||
|
glm::vec3 TerrainCollide(std::vector<uint8_t> surroundingBlocks);
|
||||||
|
|
||||||
|
ColliderBox Bounds;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool m_aabb(ColliderBox a, ColliderBox b);
|
||||||
|
|
||||||
|
float m_xDepth(ColliderBox a, ColliderBox b);
|
||||||
|
float m_yDepth(ColliderBox a, ColliderBox b);
|
||||||
|
float m_zDepth(ColliderBox a, ColliderBox b);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
void MouseMoved(glm::vec2 mouseDelta);
|
void MouseMoved(glm::vec2 mouseDelta);
|
||||||
|
|
||||||
float MouseSensitivity = 0.1f;
|
float MouseSensitivity = 0.1f;
|
||||||
float CameraSpeed = 0.2f;
|
float CameraSpeed = 2.0f;
|
||||||
|
|
||||||
glm::vec3 Position = {};
|
glm::vec3 Position = {};
|
||||||
glm::vec3 LookDirection = {};
|
glm::vec3 LookDirection = {};
|
||||||
|
|||||||
@@ -1,5 +1,29 @@
|
|||||||
#ifndef MINECRAFT_WORLD_ENTITY_H_
|
#ifndef MINECRAFT_WORLD_ENTITY_H_
|
||||||
#define MINECRAFT_WORLD_ENTITY_H_
|
#define MINECRAFT_WORLD_ENTITY_H_
|
||||||
|
|
||||||
|
#include "../common.hpp"
|
||||||
|
|
||||||
|
class Entity {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Entity();
|
||||||
|
|
||||||
|
// World position
|
||||||
|
glm::vec3 Position;
|
||||||
|
// Look direction
|
||||||
|
glm::vec3 Direction;
|
||||||
|
|
||||||
|
// Velocity in direction
|
||||||
|
// of movement
|
||||||
|
glm::vec3 Velocity;
|
||||||
|
|
||||||
|
// Collider
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh (or reference to)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ void World::LoadWorld() {
|
|||||||
|
|
||||||
m_noiseGenerator->SetFractalOctaves(5);
|
m_noiseGenerator->SetFractalOctaves(5);
|
||||||
|
|
||||||
for (int x = -4; x < 10; x++)
|
for (int x = -4; x < 50; x++)
|
||||||
for (int y = -4; y < 4; y++) {
|
for (int y = -50; y < 4; y++) {
|
||||||
|
|
||||||
m_chunkLoaderQueue.push({ x, y });
|
m_chunkLoaderQueue.push({ x, y });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn generator threads
|
// Spawn generator threads
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
|
|
||||||
m_generatorThreads.push_back(std::thread([&]() {
|
m_generatorThreads.push_back(std::thread([&]() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user