Skip to content

Commit

Permalink
Alpha release v0.6 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
RooTender authored Oct 3, 2022
2 parents 0c9d3e0 + b4dcdd6 commit b53fc08
Show file tree
Hide file tree
Showing 98 changed files with 1,707 additions and 1,294 deletions.
138 changes: 74 additions & 64 deletions Block Forge.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,27 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\Application\Layer\Sandbox\Model\Mesh\DynamicMesh.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\Structure\ChunkMesh.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\ChunkBuilder.cpp" />
<ClCompile Include="src\Application\Application.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Blocks\BlockProvider.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\BlockFaceModel.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Mesh\Mesh.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Surface\Texture.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\CubeView.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\DiamondView.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Chunks\Rendring\ChunkRenderer.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Biomes\BiomePlacer.cpp" />
<ClCompile Include="src\Application\Sandbox\Noise\Noise2D.cpp" />
<ClCompile Include="src\Application\Sandbox\Noise\Noise3D.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Biomes\BiomeProvider.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Biomes\Biome.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Chunks\Rendring\ChunkPlacer.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Chunks\Structure\Chunk.cpp" />
<ClCompile Include="src\Application\Sandbox\Events\HumanInterfaceDevice.cpp" />
<ClCompile Include="src\Application\Sandbox\Camera.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Mesh\Geometry\ElementBuffer.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Blocks\BlockProvider.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\BlockFaceModel.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Mesh\StaticMesh.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Surface\Texture.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\CubeOrder.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\DiamondOrder.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\ChunkRenderer.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Biomes\BiomePlacer.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Noise\Noise2D.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Noise\Noise3D.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Biomes\BiomeProvider.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Biomes\Biome.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\ChunkPlacer.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\Structure\Chunk.cpp" />
<ClCompile Include="src\Application\HID\HumanInterfaceDevice.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Camera.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\ElementBuffer.cpp" />
<ClCompile Include="src\Core\FileUtils.cpp" />
<ClCompile Include="lib\imgui\backends\imgui_impl_glfw.cpp" />
<ClCompile Include="lib\imgui\backends\imgui_impl_opengl3.cpp" />
Expand All @@ -176,58 +179,66 @@
<ClCompile Include="lib\imgui\imgui_draw.cpp" />
<ClCompile Include="lib\imgui\imgui_tables.cpp" />
<ClCompile Include="lib\imgui\imgui_widgets.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Mesh\Geometry\Shader.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\Shader.cpp" />
<ClCompile Include="src\Application\MainMenu.cpp" />
<ClCompile Include="src\Core\Log.cpp" />
<ClCompile Include="src\Core\Metadata.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\Application\Sandbox\Sandbox.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Mesh\Geometry\VertexBuffer.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Mesh\Geometry\VertexArray.cpp" />
<ClCompile Include="src\Application\Sandbox\World\WorldGenerator.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\TiltedCube.cpp" />
<ClCompile Include="src\Application\Sandbox\World\Blocks\BlockBuilder.cpp" />
<ClCompile Include="src\Application\Sandbox\World\WorldGeneratorUtils.cpp" />
<ClCompile Include="src\Application\Sandbox\Model\Surface\TextureAtlas.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\VertexBuffer.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\VertexArray.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\WorldGenerator.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\TiltedCubeOrder.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\Blocks\BlockBuilder.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\World\WorldGeneratorUtils.cpp" />
<ClCompile Include="src\Application\Layer\Sandbox\Model\Surface\TextureAtlas.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Application\HID\KeyCodes.h" />
<ClInclude Include="src\Application\LayerStack\Stack\SandboxStack.h" />
<ClInclude Include="src\Application\Layer\Layer.h" />
<ClInclude Include="src\Application\Layer\PauseMenu\PauseMenuLayer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\SandboxLayer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\DynamicMesh.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\Mesh.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\Structure\ChunkMesh.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\ChunkBuilder.h" />
<ClInclude Include="src\Application\Application.h" />
<ClInclude Include="src\Application\Window.h" />
<ClInclude Include="src\Core\OpenGLHeaders.h" />
<ClInclude Include="src\Application\Sandbox\World\Blocks\BlockProvider.h" />
<ClInclude Include="src\Application\Sandbox\Model\BlockModel.h" />
<ClInclude Include="src\Application\Sandbox\Model\BlockFaceModel.h" />
<ClInclude Include="src\Application\Sandbox\Model\Mesh\Geometry\Structures.h" />
<ClInclude Include="src\Application\Sandbox\Model\Mesh\Mesh.h" />
<ClInclude Include="src\Application\Sandbox\Model\Surface\Texture.h" />
<ClInclude Include="src\Application\Sandbox\World\Blocks\BlockMap.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\CubeView.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\DiamondView.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Blocks\BlockProvider.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\BlockModel.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\BlockFaceModel.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\Structures.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\StaticMesh.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Surface\Texture.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Blocks\BlockMap.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\CubeOrder.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\DiamondOrder.h" />
<ClInclude Include="src\Core\EngineExceptions.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\ChunkRenderer.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Structure\ChunkFrame.h" />
<ClInclude Include="src\Application\Sandbox\World\Biomes\BiomePlacer.h" />
<ClInclude Include="src\Application\Sandbox\Noise\Noise2D.h" />
<ClInclude Include="src\Application\Sandbox\Noise\Noise3D.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\ChunkRenderer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\Structure\ChunkFrame.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Biomes\BiomePlacer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Noise\Noise2D.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Noise\Noise3D.h" />
<ClInclude Include="src\Sandbox\Utils\EngineExceptions.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Structure\ChunkBlocks.h" />
<ClInclude Include="src\Application\Sandbox\World\Biomes\BiomeProvider.h" />
<ClInclude Include="src\Application\Sandbox\Noise\Noise.h" />
<ClInclude Include="src\Application\Sandbox\World\Biomes\Biome.h" />
<ClCompile Include="src\Application\Sandbox\Utils\FPSCounter.cpp" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\TiltedCube.h" />
<ClInclude Include="src\Application\Sandbox\World\Blocks\BlockBuilder.h" />
<ClInclude Include="src\Application\Sandbox\World\WorldGeneratorUtils.h" />
<ClInclude Include="src\Application\Sandbox\Model\Surface\TextureAtlas.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\Structure\ChunkBlocks.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Biomes\BiomeProvider.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Noise\Noise.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Biomes\Biome.h" />
<ClCompile Include="src\Application\Layer\Sandbox\Utils\FPSCounter.cpp" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\TiltedCubeOrder.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Blocks\BlockBuilder.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\WorldGeneratorUtils.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Surface\TextureAtlas.h" />
<ClInclude Include="src\Application\LayerStack\LayerStack.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Application\Sandbox\Utils\FPSCounter.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\ChunkPlacer.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Structure\Chunk.h" />
<ClInclude Include="src\Application\Sandbox\Events\HumanInterfaceDevice.h" />
<ClInclude Include="src\Application\Sandbox\Camera.h" />
<ClInclude Include="src\Application\Sandbox\Events\KeyCodes.h" />
<ClInclude Include="src\Application\Sandbox\Model\Mesh\Geometry\ElementBuffer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Utils\FPSCounter.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\ChunkPlacer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\Structure\Chunk.h" />
<ClInclude Include="src\Application\HID\HumanInterfaceDevice.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Camera.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\ElementBuffer.h" />
<ClInclude Include="src\Core\FileUtils.h" />
<ClInclude Include="lib\imgui\backends\imgui_impl_glfw.h" />
<ClInclude Include="lib\imgui\backends\imgui_impl_opengl3.h" />
Expand All @@ -238,17 +249,16 @@
<ClInclude Include="lib\imgui\imstb_rectpack.h" />
<ClInclude Include="lib\imgui\imstb_textedit.h" />
<ClInclude Include="lib\imgui\imstb_truetype.h" />
<ClInclude Include="src\Application\Sandbox\Model\Mesh\Geometry\Shader.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\Shader.h" />
<ClInclude Include="src\Application\MainMenu.h" />
<ClInclude Include="src\Core\Log.h" />
<ClInclude Include="src\Core\Metadata.h" />
<ClInclude Include="src\Application\Sandbox\Sandbox.h" />
<ClInclude Include="src\Application\Sandbox\World.h" />
<ClInclude Include="src\Application\Sandbox\Model\Mesh\Geometry\VertexBuffer.h" />
<ClInclude Include="src\Application\Sandbox\Model\Mesh\Geometry\VertexArray.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\RenderView.h" />
<ClInclude Include="src\Application\Sandbox\World\Chunks\Rendring\RenderViews\RenderViewTypes.h" />
<ClInclude Include="src\Application\Sandbox\World\WorldGenerator.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\VertexBuffer.h" />
<ClInclude Include="src\Application\Layer\Sandbox\Model\Mesh\Geometry\VertexArray.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\Order.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\Chunks\OrderType\OrderTypes.h" />
<ClInclude Include="src\Application\Layer\Sandbox\World\WorldGenerator.h" />
</ItemGroup>
<ItemGroup>
<None Include="src\Data\Biomes.json" />
Expand Down
4 changes: 2 additions & 2 deletions Block Forge.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>--trace</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>--debug</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>--trace</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>--debug</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PROJECT_NAME = "Block Forge"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v0.5
PROJECT_NUMBER = v0.6

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
28 changes: 24 additions & 4 deletions src/Application/Application.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Application.h"

#include "Core/EngineExceptions.h"
#include "Sandbox/Sandbox.h"
#include "LayerStack/Stack/SandboxStack.h"

// As a static member of class this variable
// must be here initialized
Expand All @@ -15,6 +15,7 @@ void Application::WindowResizeEvent(GLFWwindow* const, const int width, const in
_window.SetHeight(static_cast<size_t>(height));
}


void Application::CentralizeWindow() const
{
const auto& x = _fullscreenWidth / 2 - _window.GetWidth() / 2;
Expand Down Expand Up @@ -67,13 +68,18 @@ void Application::Initialize()
);
}

glfwSetFramebufferSizeCallback(_window.GetHandle(), WindowResizeEvent);
SetCallbacks();

CentralizeWindow();

_log.Info("Block Forge initialized!");
}

void Application::SetCallbacks()
{
glfwSetFramebufferSizeCallback(_window.GetHandle(), WindowResizeEvent);
}

Application::Application(const std::string& filenameWithSettings)
{
_settings.Load(filenameWithSettings);
Expand All @@ -87,8 +93,22 @@ void Application::Run()
{
Initialize();

const auto sandbox = std::make_unique<Sandbox>(_window);
sandbox->Run();
const auto sandbox = SandboxStack(_window);
_hid.DisableCursor();

while(!glfwWindowShouldClose(_window.GetHandle()))
{
if (_window.GetWidth() <= 0 || _window.GetHeight() <= 0) continue;

glClearColor(0.07f, 0.13f, 0.17f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

sandbox.Update();
sandbox.ProcessEvents(_hid);

glfwSwapBuffers(_window.GetHandle());
glfwPollEvents();
}

_log.Info("Quitting...");

Expand Down
5 changes: 5 additions & 0 deletions src/Application/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "Core/Log.h"
#include "Core/Metadata.h"
#include "Window.h"
#include "HID/HumanInterfaceDevice.h"

/// @class Application
/// @brief Represents the application context.
Expand All @@ -12,16 +13,20 @@
class Application
{
static Window _window;
HumanInterfaceDevice _hid{_window};

Log& _log = Log::Get();

Metadata _settings;

size_t _fullscreenWidth{};
size_t _fullscreenHeight{};

static void WindowResizeEvent(GLFWwindow*, int width, int height);

void CentralizeWindow() const;
void Initialize();
static void SetCallbacks();

public:

Expand Down
91 changes: 91 additions & 0 deletions src/Application/HID/HumanInterfaceDevice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#include "HumanInterfaceDevice.h"

int HumanInterfaceDevice::GetState(const KeyboardKey& key) const
{
return glfwGetKey(_window.GetHandle(), static_cast<int>(key));
}

int HumanInterfaceDevice::GetState(const MouseButton& button) const
{
return glfwGetMouseButton(_window.GetHandle(), static_cast<int>(button));
}

HumanInterfaceDevice::HumanInterfaceDevice(Window& window) : _window(window)
{
}

bool HumanInterfaceDevice::IsPressed(const KeyboardKey& key) const
{
if (GetState(key) == GLFW_PRESS)
{
return true;
}

return false;
}

bool HumanInterfaceDevice::IsPressedOnce(const KeyboardKey& key)
{
if (GetState(key) == GLFW_PRESS && _onceHandledKeyboardKeys.find(key) == _onceHandledKeyboardKeys.end())
{
_onceHandledKeyboardKeys.insert(key);
return IsPressed(key);
}

if (GetState(key) == GLFW_RELEASE)
{
_onceHandledKeyboardKeys.erase(key);
}

return false;
}

bool HumanInterfaceDevice::IsPressed(const MouseButton& button) const
{
if (GetState(button) == GLFW_PRESS)
{
return true;
}

return false;
}

bool HumanInterfaceDevice::IsPressedOnce(const MouseButton& button)
{
if (GetState(button) == GLFW_PRESS && _onceHandledMouseButtons.find(button) == _onceHandledMouseButtons.end())
{
_onceHandledMouseButtons.insert(button);
return IsPressed(button);
}

if (GetState(button) == GLFW_RELEASE)
{
_onceHandledMouseButtons.erase(button);
}

return false;
}

std::pair<double, double> HumanInterfaceDevice::GetCursorPosition() const
{
double x;
double y;
glfwGetCursorPos(_window.GetHandle(), &x, &y);

return {x, y};
}

void HumanInterfaceDevice::SetCursorPosition(const double x, const double y) const
{
glfwSetCursorPos(_window.GetHandle(), x, y);
}

void HumanInterfaceDevice::EnableCursor() const
{
glfwSetInputMode(_window.GetHandle(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}

void HumanInterfaceDevice::DisableCursor() const
{
glfwSetInputMode(_window.GetHandle(), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
}
Loading

0 comments on commit b53fc08

Please sign in to comment.