diff --git a/OpenGL.sln b/OpenGL.sln
index 1eb8125..7f171e8 100644
--- a/OpenGL.sln
+++ b/OpenGL.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL", "OpenGL.vcxproj", "{F94A0F9C-C9E4-470F-B52D-FA1A45DC2485}"
EndProject
+Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "HykoSetup", "..\HykoSetup\HykoSetup.vdproj", "{B443B8C5-0397-44EF-9587-0A8333AB550B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -21,6 +23,10 @@ Global
{F94A0F9C-C9E4-470F-B52D-FA1A45DC2485}.Release|x64.Build.0 = Release|x64
{F94A0F9C-C9E4-470F-B52D-FA1A45DC2485}.Release|x86.ActiveCfg = Release|Win32
{F94A0F9C-C9E4-470F-B52D-FA1A45DC2485}.Release|x86.Build.0 = Release|Win32
+ {B443B8C5-0397-44EF-9587-0A8333AB550B}.Debug|x64.ActiveCfg = Debug
+ {B443B8C5-0397-44EF-9587-0A8333AB550B}.Debug|x86.ActiveCfg = Debug
+ {B443B8C5-0397-44EF-9587-0A8333AB550B}.Release|x64.ActiveCfg = Release
+ {B443B8C5-0397-44EF-9587-0A8333AB550B}.Release|x86.ActiveCfg = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/OpenGL.vcxproj b/OpenGL.vcxproj
index 5253c42..90c82c2 100644
--- a/OpenGL.vcxproj
+++ b/OpenGL.vcxproj
@@ -70,6 +70,14 @@
+
+ $(SolutionDir)bin\$(Configuration)-$(Platform)\$(ProjectName)
+ $(SolutionDir)bin-int\$(Configuration)-$(Platform)\$(ProjectName)
+
+
+ $(SolutionDir)bin\$(Configuration)-$(Platform)\$(ProjectName)
+ $(SolutionDir)bin-int\$(Configuration)-$(Platform)\$(ProjectName)
+
Level3
@@ -104,13 +112,13 @@
true
_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- C:\C++\OpenGL\src\libSource;C:\C++\OpenGL\libs;C:\C++\OpenGL\libs\GLFW\include;C:\C++\OpenGL\libs\GLAD\include;%(AdditionalIncludeDirectories)
+ D:\C++\Hyko_Engine\libs\vld\include;D:\C++\Hyko_Engine\libs;D:\C++\Hyko_Engine\libs\GLFW\include;D:\C++\Hyko_Engine\src\libSource;D:\C++\Hyko_Engine\libs\GLAD\include;%(AdditionalIncludeDirectories)
stdcpp17
Console
true
- C:\C++\OpenGL\libs\GLFW\lib;%(AdditionalLibraryDirectories)
+ D:\C++\Hyko_Engine\libs\GLFW\lib;D:\C++\Hyko_Engine\libs\vld\lib;%(AdditionalLibraryDirectories)
opengl32.lib;glfw3.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)
@@ -122,22 +130,25 @@
true
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ D:\C++\Hyko_Engine\libs\vld\include;D:\C++\Hyko_Engine\libs;D:\C++\Hyko_Engine\libs\GLFW\include;D:\C++\Hyko_Engine\src\libSource;D:\C++\Hyko_Engine\libs\GLAD\include;%(AdditionalIncludeDirectories)
Console
true
true
true
+ D:\C++\Hyko_Engine\libs\GLFW\lib;D:\C++\Hyko_Engine\libs\vld\lib;%(AdditionalLibraryDirectories)
+ opengl32.lib;glfw3.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)
-
+
+
-
-
+
@@ -149,11 +160,14 @@
-
+
+
+
+
@@ -436,11 +450,11 @@
-
+
+
-
-
+
@@ -452,11 +466,13 @@
-
+
+
+
@@ -593,8 +609,16 @@
-
-
+
+ Document
+ false
+ true
+
+
+ Document
+ false
+ true
+
diff --git a/OpenGL.vcxproj.filters b/OpenGL.vcxproj.filters
index 2ed292e..c3f5c92 100644
--- a/OpenGL.vcxproj.filters
+++ b/OpenGL.vcxproj.filters
@@ -21,9 +21,6 @@
Исходные файлы
-
- Исходные файлы
-
Исходные файлы
@@ -33,7 +30,7 @@
Исходные файлы
-
+
Исходные файлы
@@ -48,9 +45,6 @@
Исходные файлы
-
- Исходные файлы
-
Исходные файлы
@@ -75,7 +69,10 @@
Исходные файлы
-
+
+ Исходные файлы
+
+
Исходные файлы
@@ -83,13 +80,10 @@
Файлы заголовков
-
- Файлы заголовков
-
Файлы заголовков
-
+
Файлы заголовков
@@ -947,9 +941,6 @@
Файлы заголовков
-
- Файлы заголовков
-
Файлы заголовков
@@ -980,13 +971,26 @@
Файлы заголовков
-
+
+ Файлы заголовков
+
+
+ Файлы заголовков
+
+
+ Файлы заголовков
+
+
+ Файлы заголовков
+
+
+ Файлы заголовков
+
+
Файлы заголовков
-
-
Файлы заголовков
@@ -1395,5 +1399,12 @@
Файлы заголовков
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.exe.recipe b/bin-int/Debug-x64/OpenGL/OpenGL.exe.recipe
new file mode 100644
index 0000000..e37d162
--- /dev/null
+++ b/bin-int/Debug-x64/OpenGL/OpenGL.exe.recipe
@@ -0,0 +1,11 @@
+
+
+
+
+ D:\C++\Hyko_Engine\bin\Debug-x64\OpenGL\OpenGL.exe
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.command.1.tlog b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.command.1.tlog
new file mode 100644
index 0000000..99d7a73
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.command.1.tlog differ
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.read.1.tlog b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.read.1.tlog
new file mode 100644
index 0000000..0af6c14
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.read.1.tlog differ
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.write.1.tlog b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.write.1.tlog
new file mode 100644
index 0000000..40b75f1
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/CL.write.1.tlog differ
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/OpenGL.lastbuildstate b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/OpenGL.lastbuildstate
new file mode 100644
index 0000000..4bd8aa4
--- /dev/null
+++ b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/OpenGL.lastbuildstate
@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
+Debug|x64|D:\C++\Hyko_Engine\|
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.command.1.tlog b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.command.1.tlog
new file mode 100644
index 0000000..7c4d4e4
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.command.1.tlog differ
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.read.1.tlog b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.read.1.tlog
new file mode 100644
index 0000000..284e891
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.read.1.tlog differ
diff --git a/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.write.1.tlog b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.write.1.tlog
new file mode 100644
index 0000000..030bcb7
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/OpenGL.tlog/link.write.1.tlog differ
diff --git a/bin-int/Debug-x64/OpenGL/vc143.idb b/bin-int/Debug-x64/OpenGL/vc143.idb
new file mode 100644
index 0000000..706e0fe
Binary files /dev/null and b/bin-int/Debug-x64/OpenGL/vc143.idb differ
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.exe.recipe b/bin-int/Release-x64/OpenGL/OpenGL.exe.recipe
new file mode 100644
index 0000000..9262b05
--- /dev/null
+++ b/bin-int/Release-x64/OpenGL/OpenGL.exe.recipe
@@ -0,0 +1,18 @@
+
+
+
+
+ D:\C++\Hyko_Engine\bin\Release-x64\OpenGL\OpenGL.exe
+
+
+
+
+ D:\C++\Hyko_Engine\res\fragmentShader.glsl
+
+
+ D:\C++\Hyko_Engine\res\vertexShader.glsl
+
+
+
+
+
\ No newline at end of file
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.command.1.tlog b/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.command.1.tlog
new file mode 100644
index 0000000..298d281
Binary files /dev/null and b/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.command.1.tlog differ
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.read.1.tlog b/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.read.1.tlog
new file mode 100644
index 0000000..5483b28
Binary files /dev/null and b/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.read.1.tlog differ
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.write.1.tlog b/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.write.1.tlog
new file mode 100644
index 0000000..41f1304
Binary files /dev/null and b/bin-int/Release-x64/OpenGL/OpenGL.tlog/CL.write.1.tlog differ
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/OpenGL.lastbuildstate b/bin-int/Release-x64/OpenGL/OpenGL.tlog/OpenGL.lastbuildstate
new file mode 100644
index 0000000..2b4d264
--- /dev/null
+++ b/bin-int/Release-x64/OpenGL/OpenGL.tlog/OpenGL.lastbuildstate
@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
+Release|x64|D:\C++\Hyko_Engine\|
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.command.1.tlog b/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.command.1.tlog
new file mode 100644
index 0000000..7173127
Binary files /dev/null and b/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.command.1.tlog differ
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.read.1.tlog b/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.read.1.tlog
new file mode 100644
index 0000000..d107f1c
Binary files /dev/null and b/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.read.1.tlog differ
diff --git a/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.write.1.tlog b/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.write.1.tlog
new file mode 100644
index 0000000..620265d
Binary files /dev/null and b/bin-int/Release-x64/OpenGL/OpenGL.tlog/link.write.1.tlog differ
diff --git a/bin-int/Release-x64/OpenGL/_IsIncrementalBuild b/bin-int/Release-x64/OpenGL/_IsIncrementalBuild
new file mode 100644
index 0000000..c482def
--- /dev/null
+++ b/bin-int/Release-x64/OpenGL/_IsIncrementalBuild
@@ -0,0 +1 @@
+D:\C++\Hyko_Engine\bin-int\Release-x64\OpenGL\\_IsIncrementalBuild
diff --git a/imgui.ini b/imgui.ini
index f24c38c..c6e3d48 100644
--- a/imgui.ini
+++ b/imgui.ini
@@ -4,7 +4,47 @@ Size=400,400
Collapsed=0
[Window][Test]
-Pos=289,29
-Size=1359,209
+Pos=5,12
+Size=201,127
+Collapsed=0
+
+[Window][Debug]
+Pos=10,154
+Size=201,85
+Collapsed=0
+
+[Window][Dispaly settings]
+Pos=1079,194
+Size=159,95
+Collapsed=0
+
+[Window][Scene components]
+Pos=967,61
+Size=213,159
+Collapsed=0
+
+[Window][Primitive meshes]
+Pos=47,269
+Size=216,131
+Collapsed=0
+
+[Window][Mesh edit]
+Pos=978,257
+Size=233,188
+Collapsed=0
+
+[Window][Main window]
+Pos=60,60
+Size=199,130
+Collapsed=0
+
+[Window][Dear ImGui Demo]
+Pos=256,14
+Size=550,680
+Collapsed=1
+
+[Window][Scene settings]
+Pos=31,474
+Size=360,80
Collapsed=0
diff --git a/libs/vld/include/vld.h b/libs/vld/include/vld.h
new file mode 100644
index 0000000..b591ff3
--- /dev/null
+++ b/libs/vld/include/vld.h
@@ -0,0 +1,350 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Visual Leak Detector - Import Library Header
+// Copyright (c) 2005-2014 VLD Team
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// See COPYING.txt for the full terms of the GNU Lesser General Public License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "vld_def.h"
+
+typedef int VLD_BOOL;
+typedef unsigned int VLD_UINT;
+typedef size_t VLD_SIZET;
+typedef void* VLD_HMODULE;
+
+#if defined _DEBUG || defined VLD_FORCE_ENABLE
+
+#ifdef __AFXWIN_H__
+#error[VLD COMPILE ERROR] '#include ' should appear before '#include ' in file stdafx.h
+#endif
+
+#pragma comment(lib, "vld.lib")
+
+// Force a symbolic reference to the global VisualLeakDetector class object from
+// the DLL. This ensures that the DLL is loaded and linked with the program,
+// even if no code otherwise imports any of the DLL's exports.
+#pragma comment(linker, "/include:__imp_?g_vld@@3VVisualLeakDetector@@A")
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Visual Leak Detector APIs
+//
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// VLDDisable - Disables Visual Leak Detector's memory leak detection at
+// runtime. If memory leak detection is already disabled, then calling this
+// function has no effect.
+//
+// Note: In multithreaded programs, this function operates on a per-thread
+// basis. In other words, if you call this function from one thread, then
+// memory leak detection is only disabled for that thread. If memory leak
+// detection is enabled for other threads, then it will remain enabled for
+// those other threads. It was designed to work this way to insulate you,
+// the programmer, from having to ensure thread synchronization when calling
+// VLDEnable() and VLDDisable(). Without this, calling these two functions
+// unsynchronized could result in unpredictable and unintended behavior.
+// But this also means that if you want to disable memory leak detection
+// process-wide, then you need to call this function from every thread in
+// the process.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDDisable ();
+
+// VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime.
+// If memory leak detection is already enabled, which it is by default, then
+// calling this function has no effect.
+//
+// Note: In multithreaded programs, this function operates on a per-thread
+// basis. In other words, if you call this function from one thread, then
+// memory leak detection is only enabled for that thread. If memory leak
+// detection is disabled for other threads, then it will remain disabled for
+// those other threads. It was designed to work this way to insulate you,
+// the programmer, from having to ensure thread synchronization when calling
+// VLDEnable() and VLDDisable(). Without this, calling these two functions
+// unsynchronized could result in unpredictable and unintended behavior.
+// But this also means that if you want to enable memory leak detection
+// process-wide, then you need to call this function from every thread in
+// the process.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDEnable ();
+
+// VLDRestore - Restore Visual Leak Detector's previous state.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDRestore ();
+
+// VLDGlobalDisable - Disables Visual Leak Detector's memory leak detection at
+// runtime in all threads. If memory leak detection is already disabled,
+// then calling this function has no effect.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDGlobalDisable ();
+
+// VLDGlobalEnable - Enables Visual Leak Detector's memory leak detection
+// at runtime in all threads. If memory leak detection is already enabled,
+// which it is by default, then calling this function has no effect.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDGlobalEnable ();
+
+// VLDReportLeaks - Report leaks up to the execution point.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) VLD_UINT VLDReportLeaks ();
+
+// VLDReportThreadLeaks - Report thread leaks up to the execution point.
+//
+// threadId: thread Id.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) VLD_UINT VLDReportThreadLeaks (VLD_UINT threadId);
+
+// VLDGetLeaksCount - Return memory leaks count to the execution point.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) VLD_UINT VLDGetLeaksCount ();
+
+// VLDGetThreadLeaksCount - Return thread memory leaks count to the execution point.
+//
+// threadId: thread Id.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) VLD_UINT VLDGetThreadLeaksCount (VLD_UINT threadId);
+
+// VLDMarkAllLeaksAsReported - Mark all leaks as reported.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDMarkAllLeaksAsReported ();
+
+// VLDMarkThreadLeaksAsReported - Mark thread leaks as reported.
+//
+// threadId: thread Id.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDMarkThreadLeaksAsReported (VLD_UINT threadId);
+
+
+// VLDRefreshModules - Look for recently loaded DLLs and patch them if necessary.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDRefreshModules();
+
+
+// VLDEnableModule - Enable Memory leak checking on the specified module.
+//
+// module: module handle.
+//
+// Return Value:
+//
+// None.
+//
+
+__declspec(dllimport) void VLDEnableModule(VLD_HMODULE module);
+
+
+// VLDDisableModule - Disable Memory leak checking on the specified module.
+//
+// module: module handle.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDDisableModule(VLD_HMODULE module);
+
+// VLDGetOptions - Return all current options.
+//
+// Return Value:
+//
+// Mask of current options.
+//
+__declspec(dllimport) VLD_UINT VLDGetOptions();
+
+// VLDGetReportFilename - Return current report filename.
+//
+// filename: current report filename (max characters - MAX_PATH).
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDGetReportFilename(wchar_t *filename);
+
+// VLDSetOptions - Update the report options via function call rather than INI file.
+//
+// option_mask: Only the following flags are checked
+// VLD_OPT_AGGREGATE_DUPLICATES
+// VLD_OPT_MODULE_LIST_INCLUDE
+// VLD_OPT_SAFE_STACK_WALK
+// VLD_OPT_SLOW_DEBUGGER_DUMP
+// VLD_OPT_TRACE_INTERNAL_FRAMES
+// VLD_OPT_START_DISABLED
+// VLD_OPT_SKIP_HEAPFREE_LEAKS
+// VLD_OPT_VALIDATE_HEAPFREE
+//
+// maxDataDump: maximum number of user-data bytes to dump for each leaked block.
+//
+// maxTraceFrames: maximum number of frames per stack trace for each leaked block.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDSetOptions(VLD_UINT option_mask, VLD_SIZET maxDataDump, VLD_UINT maxTraceFrames);
+
+// VLDSetModulesList - Set list of modules included/excluded in leak detection
+// depending on parameter "includeModules".
+//
+// modules: list of modules to be forcefully included/excluded in leak detection.
+//
+// includeModules: include or exclude that modules.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDSetModulesList(const wchar_t *modules, VLD_BOOL includeModules);
+
+// VLDGetModulesList - Return current list of included/excluded modules
+// depending on flag VLD_OPT_TRACE_INTERNAL_FRAMES.
+//
+// modules: destination string for list of included/excluded modules (maximum length 512 characters).
+//
+// size: maximum string size.
+//
+// Return Value:
+//
+// VLD_BOOL: TRUE if include modules, otherwise FALSE.
+//
+__declspec(dllimport) VLD_BOOL VLDGetModulesList(wchar_t *modules, VLD_UINT size);
+
+// VLDSetReportOptions - Update the report options via function call rather than INI file.
+//
+// Only the following flags are checked
+// VLD_OPT_REPORT_TO_DEBUGGER
+// VLD_OPT_REPORT_TO_FILE
+// VLD_OPT_REPORT_TO_STDOUT
+// VLD_OPT_UNICODE_REPORT
+//
+// filename is optional and can be NULL.
+//
+// Return Value:
+//
+// None.
+//
+__declspec(dllimport) void VLDSetReportOptions(VLD_UINT option_mask, const wchar_t *filename);
+
+// VLDSetReportHook - Installs or uninstalls a client-defined reporting function by hooking it
+// into the C run-time debug reporting process (debug version only).
+//
+// mode: The action to take: VLD_RPTHOOK_INSTALL or VLD_RPTHOOK_REMOVE.
+//
+// pfnNewHook: Report hook to install or remove.
+//
+// Return Value:
+//
+// int: 0 if success.
+//
+__declspec(dllimport) int VLDSetReportHook(int mode, VLD_REPORT_HOOK pfnNewHook);
+
+// VLDResolveCallstacks - Performs symbol resolution for all saved extent CallStack's that have
+// been tracked by Visual Leak Detector. This function is necessary for applications that
+// dynamically load and unload modules, and through which memory leaks might be included.
+// If this is NOT called, stack traces may have stack frames with no symbol information. This
+// happens because the symbol API's cannot look up symbols for a binary / module that has been unloaded
+// from the process.
+//
+// Return Value:
+//
+// int: 0 if successfully resolved all callstacks.
+//
+__declspec(dllexport) int VLDResolveCallstacks();
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#else // !_DEBUG
+
+#define VLDEnable()
+#define VLDDisable()
+#define VLDRestore()
+#define VLDGlobalDisable()
+#define VLDGlobalEnable()
+#define VLDReportLeaks() (0)
+#define VLDReportThreadLeaks() (0)
+#define VLDGetLeaksCount() (0)
+#define VLDGetThreadLeaksCount() (0)
+#define VLDMarkAllLeaksAsReported()
+#define VLDMarkThreadLeaksAsReported(a)
+#define VLDRefreshModules()
+#define VLDEnableModule(a)
+#define VLDDisableModule(b)
+#define VLDGetOptions() (0)
+#define VLDGetReportFilename(a)
+#define VLDSetOptions(a, b, c)
+#define VLDSetReportHook(a, b)
+#define VLDSetModulesList(a)
+#define VLDGetModulesList(a, b) (FALSE)
+#define VLDSetReportOptions(a, b)
+#define VLDResolveCallstacks() (0)
+
+#endif // _DEBUG
diff --git a/libs/vld/include/vld_def.h b/libs/vld/include/vld_def.h
new file mode 100644
index 0000000..265de49
--- /dev/null
+++ b/libs/vld/include/vld_def.h
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Visual Leak Detector - Import Library Header
+// Copyright (c) 2005-2014 VLD Team
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// See COPYING.txt for the full terms of the GNU Lesser General Public License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#ifndef _WCHAR_T_DEFINED
+# include
+#endif
+
+#define VLD_OPT_AGGREGATE_DUPLICATES 0x0001 // If set, aggregate duplicate leaks in the leak report.
+#define VLD_OPT_MODULE_LIST_INCLUDE 0x0002 // If set, modules in the module list are included, all others are excluded.
+#define VLD_OPT_REPORT_TO_DEBUGGER 0x0004 // If set, the memory leak report is sent to the debugger.
+#define VLD_OPT_REPORT_TO_FILE 0x0008 // If set, the memory leak report is sent to a file.
+#define VLD_OPT_SAFE_STACK_WALK 0x0010 // If set, the stack is walked using the "safe" method (StackWalk64).
+#define VLD_OPT_SELF_TEST 0x0020 // If set, perform a self-test to verify memory leak self-checking.
+#define VLD_OPT_SLOW_DEBUGGER_DUMP 0x0040 // If set, inserts a slight delay between sending output to the debugger.
+#define VLD_OPT_START_DISABLED 0x0080 // If set, memory leak detection will initially disabled.
+#define VLD_OPT_TRACE_INTERNAL_FRAMES 0x0100 // If set, include useless frames (e.g. internal to VLD) in call stacks.
+#define VLD_OPT_UNICODE_REPORT 0x0200 // If set, the leak report will be encoded UTF-16 instead of ASCII.
+#define VLD_OPT_VLDOFF 0x0400 // If set, VLD will be completely deactivated. It will not attach to any modules.
+#define VLD_OPT_REPORT_TO_STDOUT 0x0800 // If set, the memory leak report is sent to stdout.
+#define VLD_OPT_SKIP_HEAPFREE_LEAKS 0x1000 // If set, VLD skip HeapFree memory leaks.
+#define VLD_OPT_VALIDATE_HEAPFREE 0x2000 // If set, VLD verifies and reports heap consistency for HeapFree calls.
+#define VLD_OPT_SKIP_CRTSTARTUP_LEAKS 0x4000 // If set, VLD skip crt srtartup memory leaks.
+
+#define VLD_RPTHOOK_INSTALL 0
+#define VLD_RPTHOOK_REMOVE 1
+
+typedef int (__cdecl * VLD_REPORT_HOOK)(int reportType, wchar_t *message, int *returnValue);
diff --git a/libs/vld/lib/vld.lib b/libs/vld/lib/vld.lib
new file mode 100644
index 0000000..878dde2
Binary files /dev/null and b/libs/vld/lib/vld.lib differ
diff --git a/res/fragmentShader.glsl b/res/fragmentShader.glsl
index dbf1bd8..a205d31 100644
--- a/res/fragmentShader.glsl
+++ b/res/fragmentShader.glsl
@@ -1,6 +1,8 @@
#version 330 core
-layout(location = 0) out vec4 color;
+
+uniform vec4 inColor;
+layout(location = 0) out vec4 outColor;
void main(){
- color = vec4(1.0f, 0.0f, 0.4f, 1.0f);
+ outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
}
\ No newline at end of file
diff --git a/res/vertexShader.glsl b/res/vertexShader.glsl
index 2960ff3..d00939b 100644
--- a/res/vertexShader.glsl
+++ b/res/vertexShader.glsl
@@ -2,8 +2,10 @@
layout (location = 0) in vec3 aPos;
uniform mat4 transform;
+uniform mat4 projection;
+uniform mat4 view;
void main()
{
- gl_Position = transform * vec4(aPos, 1.0);
+ gl_Position = projection * view * transform * vec4(aPos, 1.0);
}
\ No newline at end of file
diff --git a/src/Engine/Debug.cpp b/src/Engine/Debug.cpp
deleted file mode 100644
index 9d34ee0..0000000
--- a/src/Engine/Debug.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "Debug.h"
-#include "glfw3.h"
-
-void Debug::edgeRenderingOnly(bool state)
-{
- switch (state) {
- case true:
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- break;
- case false:
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- }
-}
diff --git a/src/Engine/Debug.h b/src/Engine/Debug.h
deleted file mode 100644
index e1f9a9e..0000000
--- a/src/Engine/Debug.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-class Debug {
-public:
- void edgeRenderingOnly(bool state);
-};
diff --git a/src/Engine/Events/EditorInput.cpp b/src/Engine/Events/EditorInput.cpp
new file mode 100644
index 0000000..2d664cd
--- /dev/null
+++ b/src/Engine/Events/EditorInput.cpp
@@ -0,0 +1,29 @@
+#include "EditorInput.h"
+#include "../Engine/Projection/EditorProjection.h"
+#include
+
+EProjection eProj;
+
+glm::vec3 EInput::EditorCameraControl(char key)
+{
+ glm::vec3 newCamPos = glm::vec3(0.0f, 0.0f, 0.0f);
+
+ switch (key) {
+ case 'w':
+ newCamPos.y = eProj.viewProjPos.y + 0.1f;
+ break;
+ case 's':
+ newCamPos.y = eProj.viewProjPos.y - 0.1f;
+ break;
+ case 'd':
+ newCamPos.x = eProj.viewProjPos.y + 0.1f;
+ break;
+ case 'a':
+ newCamPos.x = eProj.viewProjPos.y - 0.1f;
+ break;
+ }
+
+ eProj.viewProjPos = newCamPos;
+
+ return newCamPos;
+}
diff --git a/src/Engine/Events/EditorInput.h b/src/Engine/Events/EditorInput.h
new file mode 100644
index 0000000..30c9312
--- /dev/null
+++ b/src/Engine/Events/EditorInput.h
@@ -0,0 +1,8 @@
+#pragma once
+#include
+#include
+
+class EInput {
+public:
+ glm::vec3 EditorCameraControl(char key);
+};
\ No newline at end of file
diff --git a/src/Engine/ImGui/ImGuiWindows.cpp b/src/Engine/ImGui/ImGuiWindows.cpp
index 05b18cb..a06e8a1 100644
--- a/src/Engine/ImGui/ImGuiWindows.cpp
+++ b/src/Engine/ImGui/ImGuiWindows.cpp
@@ -1,4 +1,5 @@
#include "ImGuiWindows.h"
+#include "../Engine/Debug/Debug.h"
#include
#include
#include
@@ -21,44 +22,94 @@ void ImGuiWin::createImGuiNewFrame()
ImGui::NewFrame();
}
-void ImGuiWin::ImGuiWindowDraw()
+void ImGuiWin::ImGui_MainWindowDraw()
{
- ImGui::Begin("Test");
+ ImGui::Begin("Main window");
- ImGui::SliderFloat("PosX", &triangleNewPos.x, -1.0f, 1.0f);
- ImGui::SliderFloat("PosY", &triangleNewPos.y, -1.0f, 1.0f);
+ ImGui::Checkbox("Debug", &DebugWindowShow);
+ ImGui::Checkbox("Display settings", &DisplaySettingsShow);
+ ImGui::Checkbox("Scene settings", &SceneSettingsShow);
- ImGui::SliderFloat("ScaleX", &triangleNewScale.x, 0.0f, 5.0f);
- ImGui::SliderFloat("ScaleY", &triangleNewScale.y, 0.0f, 5.0f);
+ ImGui::End();
+}
- ImGui::Text("Click on some Rot to make a triangle appear (the Rot function is experimental)");
+void ImGuiWin::ImGui_DebugWindowDraw(int fps, double ms)
+{
+ FPSTitle = "Editor window FPS: " + std::to_string(fps);
+ msTitle = "Editor window ms: " + std::to_string(ms);
- ImGui::Checkbox("RotX", &RotX);
- ImGui::Checkbox("RotY", &RotY);
- ImGui::Checkbox("RotZ", &RotZ);
+ ImGui::Begin("Debug");
- if (RotX) {
- axis += glm::vec3(1, 0, 0);
- if (!RotX) {
- axis -= glm::vec3(1, 0, 0);
- }
- }
+ ImGui::Text(FPSTitle.c_str());
+ ImGui::Text(msTitle.c_str());
+
+ ImGui::End();
+}
+
+void ImGuiWin::ImGui_DisplaySettingsWindowDraw()
+{
+ ImGui::Begin("Dispaly settings");
- if (RotY) {
- axis += glm::vec3(0, 1, 0);
- if (!RotY) {
- axis -= glm::vec3(0, 1, 0);
+ ImGui::Checkbox("VSync", &vsync);
+
+ ImGui::End();
+}
+
+void ImGuiWin::ImGui_SceneComponentsWindowDraw()
+{
+ static const ImGuiTreeNodeFlags treeFlags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth;
+
+ ImGui::Begin("Scene components");
+
+ if (ComponentSettings_TreeShow) {
+ if (ImGui::TreeNodeEx(componentTreeName.c_str(), treeFlags)) {
+ ImGui::TreePop();
}
}
- if (RotZ) {
- axis += glm::vec3(0, 0, 1);
- if (!RotZ) {
- axis -= glm::vec3(0, 0, 1);
- }
+ ImGui::End();
+}
+
+void ImGuiWin::ImGui_SceneSettingsWindowDraw()
+{
+ ImGui::Begin("Scene settings");
+
+ ImGui::ColorEdit4("Sky box color", skySphereColor);
+
+ ImGui::End();
+}
+
+void ImGuiWin::ImGui_HykoPrimitiveMeshes()
+{
+ //ImGui::ShowDemoWindow();
+
+ ImGui::Begin("Primitive meshes");
+
+ if (ImGui::Button("Triangle", ImVec2(70.0f, 25.0f))) {
+ triangleCount++;
+ componentTreeName = "Triangle." + std::to_string(triangleCount);
+ ComponentSettings_TreeShow = true;
+ createTriangle = true;
}
- ImGui::SliderFloat("Rotate(experimental)", &triangleNewRotate, 0.0f, 360.0f);
+ ImGui::End();
+}
+
+void ImGuiWin::ImGui_HykoPrimitiveMeshesEdit()
+{
+ static ImGuiSliderFlags Sliderflags = ImGuiSliderFlags_None;
+
+ ImGui::Begin("Mesh edit");
+
+ if (createTriangle) {
+ ImGui::DragFloat("Pos X", &triangleNewPos.x, 0.01f, -FLT_MAX, FLT_MAX, NULL, Sliderflags);
+ ImGui::DragFloat("Pos Y", &triangleNewPos.y, 0.01f, -FLT_MAX, FLT_MAX, NULL, Sliderflags);
+
+ ImGui::DragFloat("Scale X", &triangleNewScale.x, 0.01f, -FLT_MAX, FLT_MAX, NULL, Sliderflags);
+ ImGui::DragFloat("Scale Y", &triangleNewScale.y, 0.01f, -FLT_MAX, FLT_MAX, NULL, Sliderflags);
+
+ //ImGui::ColorEdit4("Triangle color", triangleColor);
+ }
ImGui::End();
}
diff --git a/src/Engine/ImGui/ImGuiWindows.h b/src/Engine/ImGui/ImGuiWindows.h
index 0aed4ac..3018757 100644
--- a/src/Engine/ImGui/ImGuiWindows.h
+++ b/src/Engine/ImGui/ImGuiWindows.h
@@ -1,23 +1,76 @@
#pragma once
#include
#include
-#include <../Engine/Meshes/Triangle.h>
+#include
class ImGuiWin {
+ std::string FPSTitle;
+ std::string msTitle;
+
+ std::string componentTreeName;
+
+ int triangleCount = 0;
+
public:
+ ////Mesh settings variables//////////////////////////////////
+
glm::vec3 triangleNewPos;
glm::vec3 triangleNewScale = glm::vec3(0.5f, 0.5f, 0.5f);
- glm::vec3 axis;
- float triangleNewRotate;
+ float triangleColor[4];
+
+ //////////////////////////////////////////////////////////////
+
+ ////Scene variables///////////////////////////////////////////
+
+ float skySphereColor[4]{1.0f, 1.0f, 1.0f, 1.0f};
+
+ //////////////////////////////////////////////////////////////
+
+ ////Window show bool///////////////////////
+
+ bool DebugWindowShow = false;
+ bool DisplaySettingsShow = false;
+ bool SceneSettingsShow = false;
+
+ ////Trees widgets//////////////////////////
+
+ bool ComponentSettings_TreeShow = false;
+
+ ///////////////////////////////////////////
- bool RotX;
- bool RotY;
- bool RotZ;
+ ///////////////////////////////////////////
+
+
+ ////Functions//////////////////////////////
+
+ bool vsync = false;
+ bool createTriangle = false;
+
+ ///////////////////////////////////////////
+
+
+ ////ImGui window create/////////////////////////
void createImGuiWindow(GLFWwindow* glfwWindow);
void createImGuiNewFrame();
- void ImGuiWindowDraw();
+
+ ////////////////////////////////////////////////
+
+
+ ////ImGui. Engine window draw///////////////////
+
+ void ImGui_MainWindowDraw();
+ void ImGui_DebugWindowDraw(int fps, double ms);
+ void ImGui_DisplaySettingsWindowDraw();
+ void ImGui_SceneComponentsWindowDraw();
+ void ImGui_SceneSettingsWindowDraw();
+ void ImGui_HykoPrimitiveMeshes();
+ void ImGui_HykoPrimitiveMeshesEdit();
+
+ ////////////////////////////////////////////////
+
+
void ImGuiRender();
void ImGuiWindowShutDown();
};
diff --git a/src/Engine/Meshes/Triangle.cpp b/src/Engine/Meshes/Triangle.cpp
index c3485c6..fed8cda 100644
--- a/src/Engine/Meshes/Triangle.cpp
+++ b/src/Engine/Meshes/Triangle.cpp
@@ -8,15 +8,14 @@
#include
#include
-ImGuiWin GuiWin;
-
unsigned int Triangle::createShader(std::string vFilePath, std::string fFilePath)
{
Shader shader;
shader.loadVTextFile(vFilePath);
shader.loadFTextFile(fFilePath);
- shader.createShader(vFilePath, fFilePath);
+ shader.createVShader(vFilePath);
+ shader.createFShader(fFilePath);
shader.isCompileShader(vFilePath, fFilePath);
shader.createShaderProgram(vFilePath, fFilePath);
@@ -30,8 +29,6 @@ unsigned int Triangle::createVBO()
{
VBO VBO;
- unsigned int vbo;
-
vbo = VBO.createVBO(vertices);
return vbo;
@@ -41,8 +38,6 @@ unsigned int Triangle::createVAO()
{
VAO VAO;
- unsigned int vao;
-
vao = VAO.createVAO(vertices, createVBO());
return vao;
@@ -77,18 +72,28 @@ glm::mat4 Triangle::createTransformMatrix()
glm::mat4 Transform;
Transform = scale;
- Transform *= rotate;
Transform *= translation;
return Transform;
}
-Triangle::~Triangle()
+glm::vec4 Triangle::getColorFromGUI()
{
- unsigned int VAO = createVAO();
- unsigned int VBO = createVBO();
+ ImGuiWin GuiWindow;
+
+ glm::vec4 outColor;
+
+ outColor.x = GuiWindow.triangleColor[0];
+ outColor.y = GuiWindow.triangleColor[1];
+ outColor.z = GuiWindow.triangleColor[2];
+ outColor.w = GuiWindow.triangleColor[3];
+ return outColor;
+}
+
+Triangle::~Triangle()
+{
glDisableVertexAttribArray(0);
- glDeleteVertexArrays(1, &VAO);
- glDeleteBuffers(1, &VBO);
+ glDeleteBuffers(1, &vbo);
+ glDeleteVertexArrays(1, &vao);
}
diff --git a/src/Engine/Meshes/Triangle.h b/src/Engine/Meshes/Triangle.h
index faf7180..1d94604 100644
--- a/src/Engine/Meshes/Triangle.h
+++ b/src/Engine/Meshes/Triangle.h
@@ -15,6 +15,9 @@ class Triangle {
glm::mat4 rotate;
glm::mat4 scale;
+ unsigned int vbo;
+ unsigned int vao;
+
unsigned int createShader(std::string vFilePath, std::string fFilePath);
unsigned int createVBO();
@@ -25,5 +28,7 @@ class Triangle {
glm::mat4 setScale(unsigned int shaderProgram, glm::vec3 newScale);
glm::mat4 createTransformMatrix();
+ glm::vec4 getColorFromGUI();
+
~Triangle();
};
diff --git a/src/Engine/Projection/EditorProjection.cpp b/src/Engine/Projection/EditorProjection.cpp
new file mode 100644
index 0000000..29bac5f
--- /dev/null
+++ b/src/Engine/Projection/EditorProjection.cpp
@@ -0,0 +1,29 @@
+#include "EditorProjection.h"
+#include
+
+glm::mat4 EProjection::createViewMatrix(glm::vec3 camPos)
+{
+ glm::mat4 viewMatrix = glm::mat4(1.0f);
+ viewMatrix = glm::translate(viewMatrix, camPos);
+
+ return viewMatrix;
+}
+
+glm::mat4 EProjection::createOrthoProjection(float l, float r, float b, float t)
+{
+ glm::mat4 proj = glm::mat4(1.0f);
+
+ proj = glm::ortho(l, r, b, t, -1.0f, 1.0f);
+
+ return proj;
+}
+
+glm::mat4 EProjection::resizeOrthoProjection(float width, float height)
+{
+ glm::mat4 newProj = glm::mat4(1.0f);
+
+ if (width > height) newProj = createOrthoProjection(-1.0f * (width / height), 1.0f * (width / height), -1.0f, 1.0f);
+ else newProj = createOrthoProjection(-1.0f, 1.0f, -1.0f * (height / width), 1.0f * (height / width));
+
+ return newProj;
+}
diff --git a/src/Engine/Projection/EditorProjection.h b/src/Engine/Projection/EditorProjection.h
new file mode 100644
index 0000000..5b3db7d
--- /dev/null
+++ b/src/Engine/Projection/EditorProjection.h
@@ -0,0 +1,11 @@
+#pragma once
+#include
+
+class EProjection {
+public:
+ glm::vec3 viewProjPos;
+
+ glm::mat4 createViewMatrix(glm::vec3 camPos);
+ glm::mat4 createOrthoProjection(float l, float r, float b, float t);
+ glm::mat4 resizeOrthoProjection(float width, float height);
+};
\ No newline at end of file
diff --git a/src/Engine/System/System.cpp b/src/Engine/System/System.cpp
deleted file mode 100644
index c41b4d3..0000000
--- a/src/Engine/System/System.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "System.h"
-
diff --git a/src/Engine/System/System.h b/src/Engine/System/System.h
deleted file mode 100644
index a4dfeae..0000000
--- a/src/Engine/System/System.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-class System {
-public:
-
-};
\ No newline at end of file
diff --git a/src/Engine/System/WindowSystem.cpp b/src/Engine/System/WindowSystem.cpp
deleted file mode 100644
index addbc70..0000000
--- a/src/Engine/System/WindowSystem.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "WindowSystem.h"
-#include
-
-bool WindowSys::WindowIsResizable(GLFWwindow* window, const int width, const int height)
-{
- int newWidth;
- int newHeight;
-
- glfwGetWindowSize(window, &newWidth, &newHeight);
- if (width > newWidth || width < newWidth || height > newHeight || height < newHeight) {
- std::cout << "Window resized" << std::endl;
- return true;
- }
- else {
- return false;
- }
-}
-
-glm::vec2 WindowSys::resizeGlViewport(GLFWwindow* glfwWindow, int width, int height)
-{
- int winWidth;
- int winHeight;
-
- glm::vec2 windowSize;
-
- glfwGetWindowSize(glfwWindow, &winWidth, &winHeight);
- glViewport(0, 0, winWidth, winHeight);
-
- windowSize.x = winWidth;
- windowSize.y = winHeight;
-
- return windowSize;
-}
diff --git a/src/Engine/System/WindowSystem.h b/src/Engine/System/WindowSystem.h
deleted file mode 100644
index 5508280..0000000
--- a/src/Engine/System/WindowSystem.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-#include
-#include "glm/glm.hpp"
-
-class WindowSys {
-public:
- bool WindowIsResizable(GLFWwindow* window, const int width, const int height);
- glm::vec2 resizeGlViewport(GLFWwindow* glfwWindow, int width, int height);
-};
diff --git a/src/GL/VAO.cpp b/src/GL/VAO.cpp
index 99a562c..ec73392 100644
--- a/src/GL/VAO.cpp
+++ b/src/GL/VAO.cpp
@@ -1,24 +1,20 @@
#include "VAO.h"
#include "glad/glad.h"
#include "glfw3.h"
+#include
unsigned int VAO::createVAO(std::vector vertices, unsigned int VBO)
{
- unsigned int VAO;
+ vbo = VBO;
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices.front(), GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
return VAO;
-}
-
-void VAO::bind(unsigned int VAO)
-{
- glBindVertexArray(VAO);
}
\ No newline at end of file
diff --git a/src/GL/VAO.h b/src/GL/VAO.h
index 54b07ee..b3e497b 100644
--- a/src/GL/VAO.h
+++ b/src/GL/VAO.h
@@ -2,8 +2,8 @@
#include
class VAO {
+ unsigned int VAO;
+ unsigned int vbo;
public:
unsigned int createVAO(std::vector vertices, unsigned int VBO);
-
- void bind(unsigned int VAO);
};
diff --git a/src/GL/VBO.cpp b/src/GL/VBO.cpp
index eae8e2f..72a905f 100644
--- a/src/GL/VBO.cpp
+++ b/src/GL/VBO.cpp
@@ -4,8 +4,6 @@
unsigned int VBO::createVBO(std::vector vertices)
{
- unsigned int VBO;
-
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
@@ -15,4 +13,4 @@ unsigned int VBO::createVBO(std::vector vertices)
glEnableVertexAttribArray(0);
return VBO;
-}
\ No newline at end of file
+}
diff --git a/src/GL/VBO.h b/src/GL/VBO.h
index ba7b92a..fce4b85 100644
--- a/src/GL/VBO.h
+++ b/src/GL/VBO.h
@@ -2,6 +2,7 @@
#include
class VBO {
+ unsigned int VBO;
public:
unsigned int createVBO(std::vector vertices);
};
\ No newline at end of file
diff --git a/src/Render.cpp b/src/Render.cpp
deleted file mode 100644
index 46260e0..0000000
--- a/src/Render.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "glad/glad.h"
-#include "Render.h"
-#include "Engine/Meshes/Triangle.h"
-#include "glfw3.h"
-#include
-
-GLuint Render::createVBO()
-{
- glGenBuffers(1, &VBO);
-
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
-
- glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
- glEnableVertexAttribArray(0);
-
- return VBO;
-}
-
-GLuint Render::createVAO()
-{
- glGenVertexArrays(1, &VAO);
-
- glBindVertexArray(VAO);
-
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
-
- glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
- glEnableVertexAttribArray(0);
-
- return VAO;
- }
-
-GLuint Render::createEBO()
-{
- glGenBuffers(1, &EBO);
-
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indexs), indexs, GL_STATIC_DRAW);
-
- return EBO;
-}
-
-Render::~Render()
-{
- glDisableVertexAttribArray(0);
- glDeleteVertexArrays(1, &VAO);
-}
diff --git a/src/Render.h b/src/Render.h
deleted file mode 100644
index 01e66c9..0000000
--- a/src/Render.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-class Render {
-public:
- unsigned int VBO;
- unsigned int VAO;
- unsigned int EBO;
-
- float vertices[12] = {
- 0.5f, 0.5f, 0.0f,
- 0.5f, -0.5f, 0.0f,
- -0.5f, -0.5f, 0.0f,
- -0.5f, 0.5f, 0.0f
- };
-
- unsigned int indexs[6] = {
- 0, 1, 3,
- 1, 2, 3
- };
-
- GLuint createVBO();
- GLuint createVAO();
- GLuint createEBO();
-
- ~Render();
-};
diff --git a/src/main.cpp b/src/main.cpp
index 0391f1e..91dbcc1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,10 @@
-#include "window.h"
+//#define MEMORYLEAKS_SHOW
+
+#ifdef MEMORYLEAKS_SHOW
+#include
+#endif // MEMORYLEAKS_SHOW
+#include "window.h"
Window windowClass;
diff --git a/src/shader.cpp b/src/shader.cpp
index f368468..891a4d4 100644
--- a/src/shader.cpp
+++ b/src/shader.cpp
@@ -8,6 +8,8 @@ const char* Shader::loadVTextFile(std::string vFilePath)
{
std::ifstream vs;
+ VShaderFilePath = vFilePath;
+
vs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try {
vs.open(vFilePath);
@@ -43,6 +45,8 @@ const char* Shader::loadFTextFile(std::string fFilePath)
{
std::ifstream fs;
+ FShaderFilePath = fFilePath;
+
fs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try {
@@ -79,18 +83,29 @@ const char* Shader::loadFTextFile(std::string fFilePath)
return fShaderCode;
}
-unsigned int Shader::createShader(std::string vFilePath, std::string fFilePath)
+unsigned int Shader::createVShader(std::string vFilePath)
{
vertexShader = glCreateShader(GL_VERTEX_SHADER);
- fragShader = glCreateShader(GL_FRAGMENT_SHADER);
+
glShaderSource(vertexShader, 1, &vShaderCode, NULL);
- glShaderSource(fragShader, 1, &fShaderCode, NULL);
+
glCompileShader(vertexShader);
+
+
+ return vertexShader;
+}
+
+unsigned int Shader::createFShader(std::string fFilePath)
+{
+ fragShader = glCreateShader(GL_FRAGMENT_SHADER);
+
+ glShaderSource(fragShader, 1, &fShaderCode, NULL);
+
glCompileShader(fragShader);
- return 0;
+ return fragShader;
}
int Shader::isCompileShader(std::string vFilePath, std::string fFilePath)
@@ -125,6 +140,14 @@ int Shader::isCompileShader(std::string vFilePath, std::string fFilePath)
return 0;
}
+void Shader::updateFragShader()
+{
+ loadFTextFile(FShaderFilePath);
+ createFShader(FShaderFilePath);
+ isCompileShader(VShaderFilePath, FShaderFilePath);
+ createShaderProgram(VShaderFilePath, FShaderFilePath);
+}
+
unsigned int Shader::createShaderProgram(std::string vFilePath, std::string fFilePath)
{
int success;
@@ -149,3 +172,8 @@ unsigned int Shader::createShaderProgram(std::string vFilePath, std::string fFil
return shaderProgram;
}
+
+Shader::~Shader()
+{
+
+}
diff --git a/src/shader.h b/src/shader.h
index 3228c80..678d82e 100644
--- a/src/shader.h
+++ b/src/shader.h
@@ -4,6 +4,8 @@
#include
class Shader {
+ std::string VShaderFilePath;
+ std::string FShaderFilePath;
public:
std::string vShader;
std::string fShader;
@@ -18,10 +20,15 @@ class Shader {
const char *loadVTextFile(std::string vFilePath);
const char *loadFTextFile(std::string fFilePath);
- unsigned int createShader(std::string vFilePath, std::string fFilePath);
+ unsigned int createVShader(std::string vFilePath);
+ unsigned int createFShader(std::string fFilePath);
+
+ unsigned int createShaderProgram(std::string vFilePath, std::string fFilePath);
int isCompileShader(std::string vFilePath, std::string fFilePath);
- unsigned int createShaderProgram(std::string vFilePath, std::string fFilePath);
+ void updateFragShader();
+
+ ~Shader();
};
\ No newline at end of file
diff --git a/src/window.cpp b/src/window.cpp
index 961bfc1..e191ee6 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1,20 +1,22 @@
#include
#include "window.h"
-#include "Engine/Debug.h"
+#include "shader.h"
+#include "Engine/Debug/Debug.h"
#include "Engine/Meshes/Triangle.h"
#include "Engine/ImGui/ImGuiWindows.h"
-#include "Engine/System/WindowSystem.h"
+#include "Engine/Projection/EditorProjection.h"
+//#include "Engine/Events/EditorInput.h"
#include
#include
#include
-Debug debug;
-Triangle triangle;
ImGuiWin GuiWindow;
-WindowSys WSys;
int Window::WindowDraw(int width, int height)
{
+ Debug debug;
+ EProjection EProj;
+
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@@ -24,8 +26,9 @@ int Window::WindowDraw(int width, int height)
Cwidth = width;
Cheight = height;
- window = glfwCreateWindow(Cwidth, Cheight, "test", NULL, NULL);
+ window = glfwCreateWindow(Cwidth, Cheight, "Hyko", NULL, NULL);
glfwMakeContextCurrent(window);
+ glfwSetFramebufferSizeCallback(window, windowResizeCallback);
if (!window) {
std::cout << "Window not initialized" << std::endl;
@@ -40,6 +43,9 @@ int Window::WindowDraw(int width, int height)
GuiWindow.createImGuiWindow(window);
+ projection = EProj.createOrthoProjection(-1.0f, 1.0f, -1.0f, 1.0f);
+ view = EProj.createViewMatrix(glm::vec3(0.0f, 0.0f, 0.0f));
+
debug.edgeRenderingOnly(false);
return 0;
@@ -47,34 +53,58 @@ int Window::WindowDraw(int width, int height)
void Window::WindowUpdate()
{
+ Triangle triangle;
+ Debug debug;
+ Shader shader;
+
unsigned int shaderProgram = triangle.createShader("res//vertexShader.glsl", "res//fragmentShader.glsl");
+ glBindVertexArray(triangle.createVAO());
while (!glfwWindowShouldClose(window)) {
- if (WSys.WindowIsResizable(window, Cwidth, Cheight) == true) {
- windowSize = WSys.resizeGlViewport(window, Cwidth, Cheight);
-
- Cwidth = windowSize.x;
- Cheight = windowSize.y;
- }
+ FPS = debug.getFPS();
+ ms = debug.getDeltaTime();
+
+ if (GuiWindow.vsync) glfwSwapInterval(1);
+ else glfwSwapInterval(0);
- glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ glClearColor(GuiWindow.skySphereColor[0], GuiWindow.skySphereColor[1], GuiWindow.skySphereColor[2], GuiWindow.skySphereColor[3]);
glClear(GL_COLOR_BUFFER_BIT);
GuiWindow.createImGuiNewFrame();
- glUseProgram(shaderProgram);
+ if (GuiWindow.createTriangle) {
+ glUseProgram(shaderProgram);
+
+ triangle.setScale(shaderProgram, GuiWindow.triangleNewScale);
+ triangle.translate(shaderProgram, GuiWindow.triangleNewPos);
+
+ transUniformLocation = glGetUniformLocation(shaderProgram, "transform");
+ glUniformMatrix4fv(transUniformLocation, 1, GL_FALSE, glm::value_ptr(triangle.createTransformMatrix()));
+ }
+
+ viewUniformLocation = glGetUniformLocation(shaderProgram, "view");
+ glUniformMatrix4fv(viewUniformLocation, 1, GL_FALSE, glm::value_ptr(view));
+
+ projUniformLocation = glGetUniformLocation(shaderProgram, "projection");
+ glUniformMatrix4fv(projUniformLocation, 1, GL_FALSE, glm::value_ptr(projection));
- triangle.setScale(shaderProgram, GuiWindow.triangleNewScale);
- triangle.setRotate(shaderProgram, GuiWindow.triangleNewRotate, GuiWindow.axis);
- triangle.translate(shaderProgram, GuiWindow.triangleNewPos);
+ colorUniformLocation = glGetUniformLocation(shaderProgram, "inColor");
+ glUniformMatrix4fv(colorUniformLocation, 1, GL_FALSE, glm::value_ptr(triangle.getColorFromGUI()));
- unsigned int transUniformLocation = glGetUniformLocation(shaderProgram, "transform");
- glUniformMatrix4fv(transUniformLocation, 1, GL_FALSE, glm::value_ptr(triangle.createTransformMatrix()));
+ if(GuiWindow.createTriangle) glDrawArrays(GL_TRIANGLES, 0, 3);
- glBindVertexArray(triangle.createVAO());
- glDrawArrays(GL_TRIANGLES, 0, 3);
+ ////ImGui. Hyko GUI windows////////////////////////////////////////////////////////////////
- GuiWindow.ImGuiWindowDraw();
+ GuiWindow.ImGui_MainWindowDraw();
+ GuiWindow.ImGui_SceneComponentsWindowDraw();
+ GuiWindow.ImGui_HykoPrimitiveMeshes();
+
+ if (GuiWindow.DebugWindowShow) GuiWindow.ImGui_DebugWindowDraw(FPS, ms);
+ if (GuiWindow.DisplaySettingsShow) GuiWindow.ImGui_DisplaySettingsWindowDraw();
+ if (GuiWindow.createTriangle /*|| GuiWindow.createRectangle || GuiWindow.createCircle || GuiWindow.createStaticMesh*/) GuiWindow.ImGui_HykoPrimitiveMeshesEdit();
+ if (GuiWindow.SceneSettingsShow) GuiWindow.ImGui_SceneSettingsWindowDraw();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
GuiWindow.ImGuiRender();
@@ -88,4 +118,28 @@ void Window::WindowShutDown()
GuiWindow.ImGuiWindowShutDown();
glfwDestroyWindow(window);
glfwTerminate();
-}
\ No newline at end of file
+}
+
+void windowResizeCallback(GLFWwindow* window, int width, int height)
+{
+ EProjection EProj;
+ Window windowC;
+
+ glViewport(0, 0, width, height);
+
+ windowC.projection = EProj.resizeOrthoProjection(width, height);
+}
+
+//void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
+//{
+// EInput eIn;
+// EProjection EProj;
+// Window windowC;
+//
+// //if (key == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS) {
+// if (key == GLFW_KEY_W && action == GLFW_PRESS) {
+// windowC.view = EProj.createViewMatrix(eIn.EditorCameraControl('w'));
+// }
+// //}
+//
+//}
\ No newline at end of file
diff --git a/src/window.h b/src/window.h
index a577c7e..eb6bb14 100644
--- a/src/window.h
+++ b/src/window.h
@@ -3,15 +3,30 @@
#include
class Window {
-public:
GLFWwindow* window;
+ int FPS;
+
+ double ms;
+
int Cwidth = 0;
int Cheight = 0;
+ unsigned int projUniformLocation;
+ unsigned int transUniformLocation;
+ unsigned int viewUniformLocation;
+ unsigned int colorUniformLocation;
+
glm::vec2 windowSize;
+public:
+ glm::mat4 projection;
+ glm::mat4 view;
+
int WindowDraw(int width, int height);
void WindowUpdate();
void WindowShutDown();
-};
\ No newline at end of file
+};
+
+void windowResizeCallback(GLFWwindow* window, int width, int height);
+//void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
\ No newline at end of file