Skip to content

Commit

Permalink
Starting move project to modules
Browse files Browse the repository at this point in the history
  • Loading branch information
krupitskas committed Nov 28, 2024
1 parent 5e0256e commit 0efa2fa
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 92 deletions.
3 changes: 2 additions & 1 deletion Yasno/Graphics/Techniques/RaytracingPass.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "RaytracingPass.hpp"

import Camera;

#include <cstdint>

#include <Renderer/nv_helpers_dx12/RaytracingPipelineGenerator.h>
Expand All @@ -9,7 +11,6 @@
#include <Renderer/DXRHelper.h>
#include <Renderer/DescriptorHeap.hpp>
#include <Renderer/RayTracingContext.hpp>
#include <Yasno/Camera.hpp>

namespace ysn
{
Expand Down
2 changes: 2 additions & 0 deletions Yasno/Main.cpp → Yasno/Main.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <System/Application.hpp>
#include <Yasno/Yasno.hpp>

import YasnoSettings;

int WINAPI wWinMain(_In_ HINSTANCE hinstance, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int)
{
ysn::Application::Create(hinstance);
Expand Down
37 changes: 28 additions & 9 deletions Yasno/Yasno.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,17 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Build\Intermediate\$(Platform)\$(Configuration)\</IntDir>
<AllProjectBMIsArePublic>true</AllProjectBMIsArePublic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Build\Intermediate\$(Platform)\$(Configuration)\</IntDir>
<AllProjectBMIsArePublic>true</AllProjectBMIsArePublic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">
<OutDir>$(SolutionDir)\Build\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Build\Intermediate\$(Platform)\$(Configuration)\</IntDir>
<AllProjectBMIsArePublic>true</AllProjectBMIsArePublic>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
Expand Down Expand Up @@ -187,10 +190,15 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ForcedIncludeFiles>$(ProjectDir)System\stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<PrecompiledHeaderFile>$(ProjectDir)System\stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdclatest</LanguageStandard_C>
<EnableModules>true</EnableModules>
<BuildStlModules>true</BuildStlModules>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<ScanSourceForModuleDependencies>true</ScanSourceForModuleDependencies>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -209,12 +217,16 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard_C>Default</LanguageStandard_C>
<PrecompiledHeader>Use</PrecompiledHeader>
<LanguageStandard_C>stdclatest</LanguageStandard_C>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ForcedIncludeFiles>$(ProjectDir)System\stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<PrecompiledHeaderFile>$(ProjectDir)System\stdafx.h</PrecompiledHeaderFile>
<TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableModules>true</EnableModules>
<BuildStlModules>true</BuildStlModules>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<ScanSourceForModuleDependencies>true</ScanSourceForModuleDependencies>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -235,10 +247,15 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ForcedIncludeFiles>$(ProjectDir)System\stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<PrecompiledHeaderFile>$(ProjectDir)System\stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdclatest</LanguageStandard_C>
<EnableModules>true</EnableModules>
<BuildStlModules>true</BuildStlModules>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<ScanSourceForModuleDependencies>true</ScanSourceForModuleDependencies>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -262,7 +279,7 @@
<ClCompile Include="Graphics\Techniques\RaytracingPass.cpp" />
<ClCompile Include="Graphics\Techniques\SkyboxPass.cpp" />
<ClCompile Include="Graphics\Techniques\TonemapPostprocess.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="Main.cxx" />
<ClCompile Include="Renderer\CommandQueue.cpp" />
<ClCompile Include="Renderer\CommandSignature.cpp" />
<ClCompile Include="Renderer\DxRenderer.cpp" />
Expand Down Expand Up @@ -302,11 +319,9 @@
</ClCompile>
<ClCompile Include="System\String.cpp" />
<ClCompile Include="System\Window.cpp" />
<ClCompile Include="Yasno\Camera.cpp" />
<ClCompile Include="Yasno\CameraController.cpp" />
<ClCompile Include="Yasno\CubemapGenerator.cpp" />
<ClCompile Include="Yasno\Yasno.cpp" />
<ClCompile Include="Yasno\YasnoSettings.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Graphics\AABB.hpp" />
Expand Down Expand Up @@ -368,11 +383,15 @@
<ClInclude Include="System\stdafx.h" />
<ClInclude Include="System\String.hpp" />
<ClInclude Include="System\Window.hpp" />
<ClInclude Include="Yasno\Camera.hpp" />
<ClCompile Include="Yasno\Camera.ixx">
<FileType>Document</FileType>
</ClCompile>
<ClInclude Include="Yasno\CameraController.hpp" />
<ClInclude Include="Yasno\CubemapGenerator.hpp" />
<ClInclude Include="Yasno\Yasno.hpp" />
<ClInclude Include="Yasno\YasnoSettings.hpp" />
<ClCompile Include="Yasno\YasnoSettings.ixx">
<FileType>Document</FileType>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\.gitattributes" />
Expand Down
20 changes: 7 additions & 13 deletions Yasno/Yasno.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Yasno\Camera.cpp">
<Filter>Source\Yasno</Filter>
</ClCompile>
<ClCompile Include="Yasno\CameraController.cpp">
<Filter>Source\Yasno</Filter>
</ClCompile>
Expand Down Expand Up @@ -124,7 +121,7 @@
<ClCompile Include="Yasno\Yasno.cpp">
<Filter>Source\Yasno</Filter>
</ClCompile>
<ClCompile Include="Main.cpp" />
<ClCompile Include="Main.cxx" />
<ClCompile Include="System\stdafx.cpp">
<Filter>Source\System</Filter>
</ClCompile>
Expand All @@ -134,9 +131,6 @@
<ClCompile Include="System\Math.cpp">
<Filter>Source\System</Filter>
</ClCompile>
<ClCompile Include="Yasno\YasnoSettings.cpp">
<Filter>Source\Yasno</Filter>
</ClCompile>
<ClCompile Include="Graphics\Primitive.cpp">
<Filter>Source\Graphics</Filter>
</ClCompile>
Expand Down Expand Up @@ -188,11 +182,14 @@
<ClCompile Include="Renderer\GpuBuffer.cpp">
<Filter>Source\Renderer</Filter>
</ClCompile>
<ClCompile Include="Yasno\YasnoSettings.ixx">
<Filter>Source\Yasno</Filter>
</ClCompile>
<ClCompile Include="Yasno\Camera.ixx">
<Filter>Source\Yasno</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Yasno\Camera.hpp">
<Filter>Source\Yasno</Filter>
</ClInclude>
<ClInclude Include="Yasno\CameraController.hpp">
<Filter>Source\Yasno</Filter>
</ClInclude>
Expand Down Expand Up @@ -313,9 +310,6 @@
<ClInclude Include="System\Math.hpp">
<Filter>Source\System</Filter>
</ClInclude>
<ClInclude Include="Yasno\YasnoSettings.hpp">
<Filter>Source\Yasno</Filter>
</ClInclude>
<ClInclude Include="Graphics\Primitive.hpp">
<Filter>Source\Graphics</Filter>
</ClInclude>
Expand Down
56 changes: 0 additions & 56 deletions Yasno/Yasno/Camera.hpp

This file was deleted.

58 changes: 55 additions & 3 deletions Yasno/Yasno/Camera.cpp → Yasno/Yasno/Camera.ixx
Original file line number Diff line number Diff line change
@@ -1,14 +1,66 @@
#include "Camera.hpp"
module;

#include <DirectXMath.h>
#include <d3d12.h>

#include <SimpleMath.h>

namespace ysn
export module Camera;

export namespace ysn
{
using namespace DirectX;
using namespace DirectX::SimpleMath;

struct Camera
{
Camera();

DirectX::XMMATRIX GetViewMatrix() const;
DirectX::XMMATRIX GetProjectionMatrix() const;

void Update();
void SetAspectRatio(float AspectRatio);

float GetFov() const;
void SetFov(float Fov);

DirectX::XMFLOAT3 GetPosition() const;
void SetPosition(DirectX::XMFLOAT3 Position);
void Move(DirectX::XMFLOAT3 Position);

// Right handed coodrinate space
DirectX::XMFLOAT3 GetForwardVector() const; // Z forward
DirectX::XMFLOAT3 GetRightVector() const; // -X left
DirectX::XMFLOAT3 GetUpVector() const; // Y up

void SetYaw(float Yaw);
void SetPitch(float Pitch);

// NOTE: Turns falls after Update() called!
bool IsMoved();

float fov = 45.0f;
private:
float m_AspectRatio = 1.0f;
float m_NearPlane = 0.1f;
float m_FarPlane = 10000.f;

float m_Pitch = 0.0f; // Vertical rotation
float m_Yaw = 0.0f; // Horizontal rotation

DirectX::XMFLOAT3 m_Position;

DirectX::XMFLOAT3 m_ForwardVector;
DirectX::XMFLOAT3 m_RightVector;

DirectX::XMMATRIX m_ViewMatrix;
DirectX::XMMATRIX m_ProjectionMatrix;

float m_MouseSensitivity = 1.0f;

bool m_is_moved = false;
};

Camera::Camera()
{
m_ProjectionMatrix = XMMatrixIdentity();
Expand Down
4 changes: 2 additions & 2 deletions Yasno/Yasno/CameraController.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "Camera.hpp"
import Camera;

#include <memory>
import <memory>;

namespace ysn
{
Expand Down
5 changes: 0 additions & 5 deletions Yasno/Yasno/YasnoSettings.cpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#pragma once
export module YasnoSettings;

namespace ysn
{
struct GraphicsSettings
export struct GraphicsSettings
{
bool is_vsync_enabled = false;
bool is_full_screen = false;
bool is_raster_mode = true;
};

class YasnoSettings
export class YasnoSettings
{
GraphicsSettings graphics;
public:
Expand Down

0 comments on commit 0efa2fa

Please sign in to comment.