From f16c897522b6418c399b5699f8378a25c2e5de4f Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 21 Nov 2021 14:57:57 +0500 Subject: Added normals to faces --- src/RendererSectionData.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/RendererSectionData.hpp') diff --git a/src/RendererSectionData.hpp b/src/RendererSectionData.hpp index edd2992..0a80560 100644 --- a/src/RendererSectionData.hpp +++ b/src/RendererSectionData.hpp @@ -31,20 +31,21 @@ struct SectionsData { }; struct VertexData { - glm::vec3 positions[4]; - glm::vec2 uvs[4]; - float uvLayers; - float animations; - glm::vec3 colors; - glm::vec2 lights; - uint8_t padding[20]; + glm::vec3 positions[4]; + glm::vec3 normal; + glm::vec2 uvs[4]; + float uvLayers; + float animations; + glm::vec3 colors; + glm::vec2 lights; + uint8_t padding[8]; }; struct RendererSectionData { - std::vector vertices; + std::vector vertices; size_t hash = 0; Vector sectionPos; - bool forced = false; + bool forced = false; }; RendererSectionData ParseSection(const SectionsData §ions); \ No newline at end of file -- cgit v1.2.3 From 3dc7e8aba4a07cc3c0d897b82af5a5951bde9991 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 18 Dec 2021 10:59:06 +0500 Subject: Added AO mask --- src/RendererSectionData.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/RendererSectionData.hpp') diff --git a/src/RendererSectionData.hpp b/src/RendererSectionData.hpp index 0a80560..390200c 100644 --- a/src/RendererSectionData.hpp +++ b/src/RendererSectionData.hpp @@ -38,7 +38,8 @@ struct VertexData { float animations; glm::vec3 colors; glm::vec2 lights; - uint8_t padding[8]; + float ambientOcclusion; + uint8_t padding[4]; }; struct RendererSectionData { -- cgit v1.2.3 From bac80e3514f93055daa4e743fa4f8ba177f77311 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 19 Dec 2021 17:00:13 +0500 Subject: Added per vertex lighting --- src/RendererSectionData.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/RendererSectionData.hpp') diff --git a/src/RendererSectionData.hpp b/src/RendererSectionData.hpp index 390200c..efc6cad 100644 --- a/src/RendererSectionData.hpp +++ b/src/RendererSectionData.hpp @@ -32,14 +32,11 @@ struct SectionsData { struct VertexData { glm::vec3 positions[4]; - glm::vec3 normal; glm::vec2 uvs[4]; - float uvLayers; - float animations; + glm::vec2 lights[4]; + glm::vec3 normal; glm::vec3 colors; - glm::vec2 lights; - float ambientOcclusion; - uint8_t padding[4]; + glm::vec3 layerAnimationAo; //R - uvLayer, G - animation, B - ambientOcclusion }; struct RendererSectionData { -- cgit v1.2.3 From 749e24c0ca1ea5d1d3166ce52ca98601135e0bcc Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 25 Dec 2021 11:20:36 +0500 Subject: Added smooth lighting --- src/RendererSectionData.hpp | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'src/RendererSectionData.hpp') diff --git a/src/RendererSectionData.hpp b/src/RendererSectionData.hpp index efc6cad..9eb99ad 100644 --- a/src/RendererSectionData.hpp +++ b/src/RendererSectionData.hpp @@ -11,17 +11,45 @@ class World; struct BlockLightness { - unsigned char face[FaceDirection::none] = { 0,0,0,0,0,0 }; + uint8_t face[FaceDirection::none + 1] = { 0,0,0,0,0,0 }; + uint8_t self = 0; }; struct SectionsData { - Section section; - Section west; - Section east; - Section top; - Section bottom; - Section north; - Section south; + Section data[3][3][3]; + + const Section& GetSection(Vector& pos) const { + size_t x = 1, y = 1, z = 1; + while (true) { + if (pos.x < 0) { + x--; + pos.x += 16; + } + else if (pos.x > 15) { + x++; + pos.x -= 16; + } + else if (pos.y < 0) { + y--; + pos.y += 16; + } + else if (pos.y > 15) { + y++; + pos.y -= 16; + } + else if (pos.z < 0) { + z--; + pos.z += 16; + } + else if (pos.z > 15) { + z++; + pos.z -= 16; + } + else + break; + } + return data[x][y][z]; + } BlockId GetBlockId(const Vector &pos) const; -- cgit v1.2.3 From 9feb51764077093a95a7b98af4b936a242096087 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 25 Dec 2021 11:37:53 +0500 Subject: Added smooth lighting settings parameter --- src/RendererSectionData.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/RendererSectionData.hpp') diff --git a/src/RendererSectionData.hpp b/src/RendererSectionData.hpp index 9eb99ad..0f9ade6 100644 --- a/src/RendererSectionData.hpp +++ b/src/RendererSectionData.hpp @@ -74,4 +74,4 @@ struct RendererSectionData { bool forced = false; }; -RendererSectionData ParseSection(const SectionsData §ions); \ No newline at end of file +RendererSectionData ParseSection(const SectionsData §ions, bool smoothLighting); -- cgit v1.2.3