done barely anything smh

This commit is contained in:
Ben
2020-05-20 01:12:18 +01:00
parent 24d95d1ad4
commit e4dbfa672c
8 changed files with 142 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
#ifndef MINECRAFT_RENDERER_CAMERA_H_
#define MINECRAFT_RENDERER_CAMERA_H_
#ifndef MINECRAFT_RENDERING_CAMERA_H_
#define MINECRAFT_RENDERING_CAMERA_H_
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

127
src/Rendering/face.hpp Normal file
View File

@@ -0,0 +1,127 @@
#ifndef MINECRAFT_RENDERING_FACE_H_
#define MINECRAFT_RENDERING_FACE_H_
#include "../../common.hpp"
namespace EFaceType {
enum Face : uint8_t {
Top,
Bottom,
Left,
Right,
Front,
Back,
};
}
static std::vector<glm::vec3> CubeTopFace = {
{ -0.5f, 0.5f, -0.5f },
{ 0.5f, 0.5f, -0.5f },
{ 0.5f, 0.5f, 0.5f },
{ 0.5f, 0.5f, 0.5f },
{ -0.5f, 0.5f, 0.5f },
{ -0.5f, 0.5f, -0.5f }
};
static std::vector<glm::vec2> CubeTopFaceUVs = {
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
{ 1.0f, 1.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f }
};
static std::vector<glm::vec3> CubeBottomFace = {
{ -0.5f, -0.5f, -0.5f },
{ 0.5f, -0.5f, -0.5f },
{ 0.5f, -0.5f, 0.5f },
{ 0.5f, -0.5f, 0.5f },
{ -0.5f, -0.5f, 0.5f },
{ -0.5f, -0.5f, -0.5f }
};
static std::vector<glm::vec2> CubeBottomFaceUVs = {
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
{ 1.0f, 1.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f }
};
static std::vector<glm::vec3> CubeLeftFace = {
{ -0.5f, 0.5f, 0.5f },
{ -0.5f, 0.5f, -0.5f },
{ -0.5f, -0.5f, -0.5f },
{ -0.5f, -0.5f, -0.5f },
{ -0.5f, -0.5f, 0.5f },
{ -0.5f, 0.5f, 0.5f }
};
static std::vector<glm::vec2> CubeLeftFaceUVs = {
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
{ 1.0f, 1.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f }
};
static std::vector<glm::vec3> CubeRightFace = {
{ 0.5f, 0.5f, 0.5f },
{ 0.5f, 0.5f, -0.5f },
{ 0.5f, -0.5f, -0.5f },
{ 0.5f, -0.5f, -0.5f },
{ 0.5f, -0.5f, 0.5f },
{ 0.5f, 0.5f, 0.5f },
};
static std::vector<glm::vec2> CubeRightFaceUVs = {
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
{ 1.0f, 1.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f }
};
static std::vector<glm::vec3> CubeFrontFace = {
{ -0.5f, -0.5f, 0.5f },
{ 0.5f, -0.5f, 0.5f },
{ 0.5f, 0.5f, 0.5f },
{ 0.5f, 0.5f, 0.5f },
{ -0.5f, 0.5f, 0.5f },
{ -0.5f, -0.5f, 0.5f }
};
static std::vector<glm::vec2> CubeFrontFaceUVs = {
{ 1.0f, 1.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f }
};
static std::vector<glm::vec3> CubeBackFace = {
{ -0.5f, -0.5f, -0.5f },
{ 0.5f, -0.5f, -0.5f },
{ 0.5f, 0.5f, -0.5f },
{ 0.5f, 0.5f, -0.5f },
{ -0.5f, 0.5f, -0.5f },
{ -0.5f, -0.5f, -0.5f }
};
static std::vector<glm::vec2> CubeBackFaceUVs = {
{ 1.0f, 1.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f }
};
#endif

View File

@@ -1,5 +1,5 @@
#ifndef MINECRAFT_RENDERER_FRUSTRUM_H_
#define MINECRAFT_RENDERER_FRUSTRUM_H_
#ifndef MINECRAFT_RENDERING_FRUSTRUM_H_
#define MINECRAFT_RENDERING_FRUSTRUM_H_
namespace EFrustrumPlanes
{

View File

@@ -1,5 +1,5 @@
#ifndef MINECRAFT_RENDERER_SHADER_H_
#define MINECRAFT_RENDERER_SHADER_H_
#ifndef MINECRAFT_RENDERING_SHADER_H_
#define MINECRAFT_RENDERING_SHADER_H_
#include <logger.h>

View File

@@ -1,5 +1,5 @@
#ifndef MINECRAFT_RENDERER_TEXTURE_H_
#define MINECRAFT_RENDERER_TEXTURE_H_
#ifndef MINECRAFT_RENDERING_TEXTURE_H_
#define MINECRAFT_RENDERING_TEXTURE_H_
#include <vector>
#include <string>

View File

@@ -82,8 +82,9 @@ void Display::Input( SDL_Event* e )
{
if ( e->window.event == SDL_WINDOWEVENT_RESIZED )
{
// CameraUpdateProjection( e->window.data1, e->window.data2 );
glViewport( 0, 0, e->window.data1, e->window.data2 );
mW = e->window.data1; mH = e->window.data2;
// CameraUpdateProjection( mW, mH );
glViewport( 0, 0, mW, mH );
}
break;

View File

@@ -13,6 +13,7 @@
#include "display.hpp"
#include "settings.hpp"
#include "Rendering/texture.hpp"
#define __DEBUG
@@ -45,7 +46,6 @@ void Loop( Display* display )
// make framerate agnostic
display->Input( &e );
// rendering here
display->NextFrame();
@@ -73,6 +73,8 @@ int main( int argc, char** argv )
Display display { WindowWidth, WindowHeight, version.str() };
Loop( &display );
}

1
src/threadpool.hpp Normal file
View File

@@ -0,0 +1 @@
// Threadpool for asset management and other such tasks