diff --git a/.gitignore b/.gitignore index cf469312..c004e4dc 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,15 @@ *.suo Intermediates/ -ipch/ \ No newline at end of file +ipch/ + +.vs/ + +# Intermediates +obj/ + +# Binaries +bin/* +!Web/* +!*.js +*.filters diff --git a/Dependencies/Box2D/Box2D.vcxproj b/Dependencies/Box2D/Box2D.vcxproj index 2de6f6bd..716d73d9 100644 --- a/Dependencies/Box2D/Box2D.vcxproj +++ b/Dependencies/Box2D/Box2D.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -13,19 +13,19 @@ {BCE9869C-CDE3-4935-99AB-4522493CE0B3} Box2D - 8.1 + 10.0.17763.0 StaticLibrary true - v140 + v141 MultiByte StaticLibrary false - v140 + v141 true MultiByte diff --git a/Dependencies/Box2D/Box2D.vcxproj.filters b/Dependencies/Box2D/Box2D.vcxproj.filters deleted file mode 100644 index 6609e599..00000000 --- a/Dependencies/Box2D/Box2D.vcxproj.filters +++ /dev/null @@ -1,300 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Dependencies/FreeImage/FreeImage.vcxproj b/Dependencies/FreeImage/FreeImage.vcxproj index a88413d6..2d615cd9 100644 --- a/Dependencies/FreeImage/FreeImage.vcxproj +++ b/Dependencies/FreeImage/FreeImage.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,32 +21,32 @@ {6F2FF135-E343-4138-A6FB-2D1F2540A3F8} FreeImage - 8.1 + 10.0.17763.0 StaticLibrary true - v140 + v141 MultiByte StaticLibrary false - v140 + v141 true MultiByte Application true - v140 + v141 MultiByte Application false - v140 + v141 true MultiByte diff --git a/Dependencies/FreeImage/FreeImage.vcxproj.filters b/Dependencies/FreeImage/FreeImage.vcxproj.filters deleted file mode 100644 index ce979c4a..00000000 --- a/Dependencies/FreeImage/FreeImage.vcxproj.filters +++ /dev/null @@ -1,861 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Dependencies/FreeType/FreeType.vcxproj b/Dependencies/FreeType/FreeType.vcxproj index 0c2e2704..c13bc028 100644 --- a/Dependencies/FreeType/FreeType.vcxproj +++ b/Dependencies/FreeType/FreeType.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,32 +21,32 @@ {1B0BC2C5-1A09-4017-BDF5-9F9C1718BFE7} FreeType - 8.1 + 10.0.17763.0 DynamicLibrary true - v140 + v141 MultiByte DynamicLibrary false - v140 + v141 true MultiByte Application true - v140 + v141 MultiByte Application false - v140 + v141 true MultiByte diff --git a/Dependencies/FreeType/FreeType.vcxproj.filters b/Dependencies/FreeType/FreeType.vcxproj.filters deleted file mode 100644 index 80d8c25a..00000000 --- a/Dependencies/FreeType/FreeType.vcxproj.filters +++ /dev/null @@ -1,192 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Dependencies/gorilla-audio/gorilla-audio.vcxproj b/Dependencies/gorilla-audio/gorilla-audio.vcxproj index cbf98cee..692806ab 100644 --- a/Dependencies/gorilla-audio/gorilla-audio.vcxproj +++ b/Dependencies/gorilla-audio/gorilla-audio.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,32 +21,32 @@ {E9A0F826-3688-4461-8E49-7CCC543F9E40} gorillaaudio - 8.1 + 10.0.17763.0 DynamicLibrary true - v140 + v141 MultiByte DynamicLibrary false - v140 + v141 true MultiByte Application true - v140 + v141 MultiByte Application false - v140 + v141 true MultiByte diff --git a/Dependencies/gorilla-audio/gorilla-audio.vcxproj.filters b/Dependencies/gorilla-audio/gorilla-audio.vcxproj.filters deleted file mode 100644 index e0c91d61..00000000 --- a/Dependencies/gorilla-audio/gorilla-audio.vcxproj.filters +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/Dependencies/libogg/libogg.vcxproj b/Dependencies/libogg/libogg.vcxproj index c7d5fad8..ec85cbcd 100644 --- a/Dependencies/libogg/libogg.vcxproj +++ b/Dependencies/libogg/libogg.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -22,19 +22,19 @@ {54CE06E0-6313-4F5E-8BDA-4E7815C8743C} libogg - 8.1 + 10.0.17763.0 StaticLibrary true - v140 + v141 MultiByte StaticLibrary false - v140 + v141 true MultiByte diff --git a/Dependencies/libogg/libogg.vcxproj.filters b/Dependencies/libogg/libogg.vcxproj.filters deleted file mode 100644 index 4d11db0f..00000000 --- a/Dependencies/libogg/libogg.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/Dependencies/libvorbis/libvorbis.vcxproj b/Dependencies/libvorbis/libvorbis.vcxproj index 7f7f4b99..3a15be26 100644 --- a/Dependencies/libvorbis/libvorbis.vcxproj +++ b/Dependencies/libvorbis/libvorbis.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -80,19 +80,19 @@ {8ED62764-0D19-40AC-BC88-E82AADF1189B} libvorbis - 8.1 + 10.0.17763.0 StaticLibrary true - v140 + v141 MultiByte StaticLibrary false - v140 + v141 true MultiByte diff --git a/Dependencies/libvorbis/libvorbis.vcxproj.filters b/Dependencies/libvorbis/libvorbis.vcxproj.filters deleted file mode 100644 index 8b786cea..00000000 --- a/Dependencies/libvorbis/libvorbis.vcxproj.filters +++ /dev/null @@ -1,210 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Sandbox/Sandbox.vcxproj b/Sandbox/Sandbox.vcxproj index 1cddb977..8b352308 100644 --- a/Sandbox/Sandbox.vcxproj +++ b/Sandbox/Sandbox.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -13,19 +13,19 @@ {3A87EAB9-F0FF-4C31-905F-E3D07BF021FF} Sandbox - 8.1 + 10.0.17763.0 Application true - v140 + v141 MultiByte Application false - v140 + v141 true MultiByte diff --git a/Sandbox/Sandbox.vcxproj.filters b/Sandbox/Sandbox.vcxproj.filters deleted file mode 100644 index fd5b0d20..00000000 --- a/Sandbox/Sandbox.vcxproj.filters +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - - - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - - \ No newline at end of file diff --git a/Sandbox/src/Test3D.cpp b/Sandbox/src/Test3D.cpp index 02501bd2..e6d01460 100644 --- a/Sandbox/src/Test3D.cpp +++ b/Sandbox/src/Test3D.cpp @@ -13,16 +13,16 @@ using namespace API; #define DEBUG_MENU(name, var, min, max) debug::DebugMenu::Add("Test3D/" ## name, var, min, max) Test3D::Test3D() - : Layer3D(spnew Scene()) + : Layer3D(spnew Scene()) { - m_MayaCamera = m_Scene->GetCamera(); - m_FPSCamera = spnew FPSCamera(maths::mat4::Perspective(65.0f, 16.0f / 9.0f, 0.1f, 1000.0f)); + m_MayaCamera = m_Scene->GetCamera(); + m_FPSCamera = spnew FPSCamera(maths::mat4::Perspective(65.0f, 16.0f / 9.0f, 0.1f, 1000.0f)); - m_Rotation = 0.0f; - m_SetUniforms[0] = true; - m_SetUniforms[1] = true; + m_Rotation = 0.0f; + m_SetUniforms[0] = true; + m_SetUniforms[1] = true; - mat4 result = mat4::Identity() * mat4::Identity(); + mat4 result = mat4::Identity() * mat4::Identity(); } Test3D::~Test3D() @@ -42,298 +42,298 @@ TextureDepth* g_ShadowMap; String materialInputs[5] = { - "CastIron", - "WornWood", - "GunMetal", - "ABSRed", - "Custom" + "CastIron", + "WornWood", + "GunMetal", + "ABSRed", + "Custom" }; enum Materials : uint { - CAST_IRON = 0, - WORN_WOOD, - GUN_METAL, - ABS_RED, - CUSTOM + CAST_IRON = 0, + WORN_WOOD, + GUN_METAL, + ABS_RED, + CUSTOM }; void Test3D::OnInit(Renderer3D& renderer, Scene& scene) { - // Enable this to use FPS camera - // scene.SetCamera(m_FPSCamera); - - Timer timer; - String environmentFiles[11] = - { - "/pbr/cubemap/CubeMap0.tga", - "/pbr/cubemap/CubeMap1.tga", - "/pbr/cubemap/CubeMap2.tga", - "/pbr/cubemap/CubeMap3.tga", - "/pbr/cubemap/CubeMap4.tga", - "/pbr/cubemap/CubeMap5.tga", - "/pbr/cubemap/CubeMap6.tga", - "/pbr/cubemap/CubeMap7.tga", - "/pbr/cubemap/CubeMap8.tga", - "/pbr/cubemap/CubeMap9.tga", - "/pbr/cubemap/CubeMap10.tga" - }; - - TextureCube* environment = TextureCube::CreateFromVCross(environmentFiles, 11); - Shader* skybox = Shader::CreateFromFile("Skybox", String("/shaders/Skybox") + (API::Context::GetRenderAPI() == RenderAPI::OPENGL ? ".shader" : ".hlsl")); - Material* skyboxMaterial = spnew Material(skybox); - skyboxMaterial->SetRenderFlag(Material::RenderFlags::DISABLE_DEPTH_TEST); - skybox->Bind(); - m_SkyboxMaterial = spnew MaterialInstance(skyboxMaterial); - m_SkyboxMaterial->SetTexture("u_EnvironmentMap", environment); - Entity* skyboxEntity = spnew Entity(MeshFactory::CreateQuad(-1, -1, 2, 2, m_SkyboxMaterial)); - m_Scene->Add(skyboxEntity); - - Shader* pbrShader = Shader::CreateFromFile("AdvancedLighting", String("/shaders/AdvancedLighting") + (API::Context::GetRenderAPI() == RenderAPI::OPENGL ? ".shader" : ".hlsl")); - ShaderManager::Add(pbrShader); - PBRMaterial* material = spnew PBRMaterial(pbrShader); - - PBRMaterial* castIron = spnew PBRMaterial(pbrShader); - castIron->SetEnviromentMap(environment); - { - String path = materialInputs[CAST_IRON] + "/" + materialInputs[CAST_IRON]; - castIron->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); - castIron->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); - castIron->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); - castIron->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); - } - m_Materials.push_back(castIron); - - PBRMaterial* wornWood = spnew PBRMaterial(pbrShader); - wornWood->SetEnviromentMap(environment); - { - String path = materialInputs[WORN_WOOD] + "/" + materialInputs[WORN_WOOD]; - wornWood->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); - wornWood->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); - wornWood->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); - wornWood->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); - } - m_Materials.push_back(wornWood); - - PBRMaterial* gunMetal = spnew PBRMaterial(pbrShader); - gunMetal->SetEnviromentMap(environment); - { - String path = materialInputs[GUN_METAL] + "/" + materialInputs[GUN_METAL]; - gunMetal->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); - gunMetal->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); - gunMetal->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); - gunMetal->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); - } - m_Materials.push_back(gunMetal); - - - PBRMaterial* absRed = spnew PBRMaterial(pbrShader); - absRed->SetEnviromentMap(environment); - { - String path = materialInputs[ABS_RED] + "/" + materialInputs[ABS_RED]; - absRed->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); - absRed->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); - absRed->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); - absRed->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); - } - m_Materials.push_back(absRed); - - PBRMaterial* custom = spnew PBRMaterial(pbrShader); - custom->SetEnviromentMap(environment); - { - String path = materialInputs[CUSTOM] + "/" + materialInputs[CUSTOM]; - custom->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); - custom->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); - custom->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); - custom->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); - } - m_Materials.push_back(custom); - - // Texture::SetLoadParameters(0); - m_DaggerMaterial = spnew PBRMaterial(pbrShader); - m_DaggerMaterial->SetEnviromentMap(environment); - { - TextureLoadOptions options(false, true); - m_DaggerMaterial->SetAlbedoMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Albedo.tga", options)); - m_DaggerMaterial->SetSpecularMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Specular.tga", options)); - m_DaggerMaterial->SetGlossMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Gloss.tga", options)); - m_DaggerMaterial->SetNormalMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Normals.tga", options)); - } - - Model* daggerModel = spnew Model("/models/Dagger.spm", spnew MaterialInstance(m_DaggerMaterial)); - m_Dagger = spnew Entity(daggerModel->GetMesh(), mat4::Translate(g_DaggerTransform)); - m_Scene->Add(m_Dagger); - - PBRMaterial* cubeMaterial = spnew PBRMaterial(pbrShader); - cubeMaterial->SetEnviromentMap(environment); - Model* cubeModel = spnew Model("/models/RoundedCube.spm", spnew MaterialInstance(cubeMaterial)); - m_Cube = spnew Entity(cubeModel->GetMesh(), mat4::Rotate(90.0f, vec3(0, 0, 1)) * mat4::Translate(g_CubeTransform)); - m_Scene->Add(m_Cube); - - Model* sphereModel = spnew Model("/models/Sphere.spm"); - - // Plastics - for (uint x = 0; x < 10; x++) - { - float xx = x * 10.0f; - float zz = 3.0f; - - float roughness = x / 10.0f; - vec3 spec(0.04f); - vec4 diffuse(vec3(1.0f, 0.0f, 0.0f), 1.0f); - - PBRMaterialInstance* m = spnew PBRMaterialInstance(m_Materials[CAST_IRON]); - m->SetAlbedo(diffuse); - m->SetSpecular(spec); - m->SetGloss(1.0f - roughness); - m->UsingNormalMap(false); - - Mesh* mesh = spnew Mesh(sphereModel->GetMesh()); - mesh->SetMaterial(m); - - Entity* sphere = spnew Entity(mesh, mat4::Translate(vec3(-60 + xx, 2.5f, 90 + zz)) * mat4::Scale(vec3(2.0f))); - m_Spheres.push_back(sphere); - m_Scene->Add(sphere); - } - - // Metals - for (uint x = 0; x < 10; x++) - { - float xx = x * 10.0f; - float zz = 0; - - float roughness = x / 10.0f; - vec3 spec(1.0f); - vec4 diffuse(0.0f, 0.0f, 0.0f, 1.0f); - - PBRMaterialInstance* m = spnew PBRMaterialInstance(m_Materials[CAST_IRON]); - m->SetAlbedo(diffuse); - m->SetSpecular(spec); - m->SetGloss(1.0f - roughness); - m->UsingNormalMap(false); - - Mesh* mesh = spnew Mesh(sphereModel->GetMesh()); - mesh->SetMaterial(m); - - Entity* sphere = spnew Entity(mesh, mat4::Translate(vec3(-60 + xx, 2.5f, 80 + zz)) * mat4::Scale(vec3(2.0))); - m_Spheres.push_back(sphere); - m_Scene->Add(sphere); - } - - m_Plane = spnew Entity(MeshFactory::CreatePlane(128, 128, vec3(0, 1, 0), spnew PBRMaterialInstance(m_Materials[CUSTOM]))); - m_Scene->Add(m_Plane); - - LightSetup* lights = spnew LightSetup(); - m_Light = spnew Light(vec3(0.8f)); - lights->Add(m_Light); - m_Scene->PushLightSetup(lights); - - DEBUG_MENU("Cube", &g_CubeTransform, -100.0f, 100.0f); - DEBUG_MENU("Light Direction", &lights->GetLights()[0]->direction, -1.0f, 1.0f); - DEBUG_MENU("Light Intensity", &lights->GetLights()[0]->intensity, 0, 100); - DEBUG_MENU("Dagger", &g_DaggerTransform, -50, 50); - DEBUG_MENU("Dagger Gloss", &g_DaggerGloss, 0.0f, 1.0f); - - // shadowPassShader = Shader::CreateFromFile("Shadow", "shaders/ShadowPass.shader"); - // g_DepthBuffer = FramebufferDepth::Create(2048, 2048); - // g_ShadowMap = (TextureDepth*)g_DepthBuffer->GetTexture(); - - for (uint i = 0; i < 4; i++) - { - // m_Materials[i]->SetTexture(g_ShadowMap, 6); - // m_Materials[i]->SetUniform("u_ShadowMap", 6); - } - - SP_INFO("Init took ", timer.ElapsedMillis(), " ms"); + // Enable this to use FPS camera + // scene.SetCamera(m_FPSCamera); + + Timer timer; + String environmentFiles[11] = + { + "/pbr/cubemap/CubeMap0.tga", + "/pbr/cubemap/CubeMap1.tga", + "/pbr/cubemap/CubeMap2.tga", + "/pbr/cubemap/CubeMap3.tga", + "/pbr/cubemap/CubeMap4.tga", + "/pbr/cubemap/CubeMap5.tga", + "/pbr/cubemap/CubeMap6.tga", + "/pbr/cubemap/CubeMap7.tga", + "/pbr/cubemap/CubeMap8.tga", + "/pbr/cubemap/CubeMap9.tga", + "/pbr/cubemap/CubeMap10.tga" + }; + + TextureCube* environment = TextureCube::CreateFromVCross(environmentFiles, 11); + Shader* skybox = Shader::CreateFromFile("Skybox", String("/shaders/Skybox") + (API::Context::GetRenderAPI() == RenderAPI::OPENGL ? ".shader" : ".hlsl")); + Material* skyboxMaterial = spnew Material(skybox); + skyboxMaterial->SetRenderFlag(Material::RenderFlags::DISABLE_DEPTH_TEST); + skybox->Bind(); + m_SkyboxMaterial = spnew MaterialInstance(skyboxMaterial); + m_SkyboxMaterial->SetTexture("u_EnvironmentMap", environment); + Entity* skyboxEntity = spnew Entity(MeshFactory::CreateQuad(-1, -1, 2, 2, m_SkyboxMaterial)); + m_Scene->Add(skyboxEntity); + + Shader* pbrShader = Shader::CreateFromFile("AdvancedLighting", String("/shaders/AdvancedLighting") + (API::Context::GetRenderAPI() == RenderAPI::OPENGL ? ".shader" : ".hlsl")); + ShaderManager::Add(pbrShader); + PBRMaterial* material = spnew PBRMaterial(pbrShader); + + PBRMaterial* castIron = spnew PBRMaterial(pbrShader); + castIron->SetEnviromentMap(environment); + { + String path = materialInputs[CAST_IRON] + "/" + materialInputs[CAST_IRON]; + castIron->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); + castIron->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); + castIron->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); + castIron->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); + } + m_Materials.push_back(castIron); + + PBRMaterial* wornWood = spnew PBRMaterial(pbrShader); + wornWood->SetEnviromentMap(environment); + { + String path = materialInputs[WORN_WOOD] + "/" + materialInputs[WORN_WOOD]; + wornWood->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); + wornWood->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); + wornWood->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); + wornWood->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); + } + m_Materials.push_back(wornWood); + + PBRMaterial* gunMetal = spnew PBRMaterial(pbrShader); + gunMetal->SetEnviromentMap(environment); + { + String path = materialInputs[GUN_METAL] + "/" + materialInputs[GUN_METAL]; + gunMetal->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); + gunMetal->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); + gunMetal->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); + gunMetal->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); + } + m_Materials.push_back(gunMetal); + + + PBRMaterial* absRed = spnew PBRMaterial(pbrShader); + absRed->SetEnviromentMap(environment); + { + String path = materialInputs[ABS_RED] + "/" + materialInputs[ABS_RED]; + absRed->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); + absRed->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); + absRed->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); + absRed->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); + } + m_Materials.push_back(absRed); + + PBRMaterial* custom = spnew PBRMaterial(pbrShader); + custom->SetEnviromentMap(environment); + { + String path = materialInputs[CUSTOM] + "/" + materialInputs[CUSTOM]; + custom->SetAlbedoMap(Texture2D::CreateFromFile("/pbr/" + path + "_Albedo.tga")); + custom->SetSpecularMap(Texture2D::CreateFromFile("/pbr/" + path + "_Specular.tga")); + custom->SetGlossMap(Texture2D::CreateFromFile("/pbr/" + path + "_Gloss.tga")); + custom->SetNormalMap(Texture2D::CreateFromFile("/pbr/" + path + "_Normal.tga")); + } + m_Materials.push_back(custom); + + // Texture::SetLoadParameters(0); + m_DaggerMaterial = spnew PBRMaterial(pbrShader); + m_DaggerMaterial->SetEnviromentMap(environment); + { + TextureLoadOptions options(false, true); + m_DaggerMaterial->SetAlbedoMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Albedo.tga", options)); + m_DaggerMaterial->SetSpecularMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Specular.tga", options)); + m_DaggerMaterial->SetGlossMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Gloss.tga", options)); + m_DaggerMaterial->SetNormalMap(Texture2D::CreateFromFile("res/Dagger/Textures/Dagger_Normals.tga", options)); + } + + Model* daggerModel = spnew Model("/models/Dagger.spm", spnew MaterialInstance(m_DaggerMaterial)); + m_Dagger = spnew Entity(daggerModel->GetMesh(), mat4::Translate(g_DaggerTransform)); + m_Scene->Add(m_Dagger); + + PBRMaterial* cubeMaterial = spnew PBRMaterial(pbrShader); + cubeMaterial->SetEnviromentMap(environment); + Model* cubeModel = spnew Model("/models/RoundedCube.spm", spnew MaterialInstance(cubeMaterial)); + m_Cube = spnew Entity(cubeModel->GetMesh(), mat4::Rotate(90.0f, vec3(0, 0, 1)) * mat4::Translate(g_CubeTransform)); + m_Scene->Add(m_Cube); + + Model* sphereModel = spnew Model("/models/Sphere.spm"); + + // Plastics + for (uint x = 0; x < 10; x++) + { + float xx = x * 10.0f; + float zz = 3.0f; + + float roughness = x / 10.0f; + vec3 spec(0.04f); + vec4 diffuse(vec3(1.0f, 0.0f, 0.0f), 1.0f); + + PBRMaterialInstance* m = spnew PBRMaterialInstance(m_Materials[CAST_IRON]); + m->SetAlbedo(diffuse); + m->SetSpecular(spec); + m->SetGloss(1.0f - roughness); + m->UsingNormalMap(false); + + Mesh* mesh = spnew Mesh(sphereModel->GetMesh()); + mesh->SetMaterial(m); + + Entity* sphere = spnew Entity(mesh, mat4::Translate(vec3(-60 + xx, 2.5f, 90 + zz)) * mat4::Scale(vec3(2.0f))); + m_Spheres.push_back(sphere); + m_Scene->Add(sphere); + } + + // Metals + for (uint x = 0; x < 10; x++) + { + float xx = x * 10.0f; + float zz = 0; + + float roughness = x / 10.0f; + vec3 spec(1.0f); + vec4 diffuse(0.0f, 0.0f, 0.0f, 1.0f); + + PBRMaterialInstance* m = spnew PBRMaterialInstance(m_Materials[CAST_IRON]); + m->SetAlbedo(diffuse); + m->SetSpecular(spec); + m->SetGloss(1.0f - roughness); + m->UsingNormalMap(false); + + Mesh* mesh = spnew Mesh(sphereModel->GetMesh()); + mesh->SetMaterial(m); + + Entity* sphere = spnew Entity(mesh, mat4::Translate(vec3(-60 + xx, 2.5f, 80 + zz)) * mat4::Scale(vec3(2.0))); + m_Spheres.push_back(sphere); + m_Scene->Add(sphere); + } + + m_Plane = spnew Entity(MeshFactory::CreatePlane(128, 128, vec3(0, 1, 0), spnew PBRMaterialInstance(m_Materials[CUSTOM]))); + m_Scene->Add(m_Plane); + + LightSetup* lights = spnew LightSetup(); + m_Light = spnew Light(vec3(0.8f)); + lights->Add(m_Light); + m_Scene->PushLightSetup(lights); + + DEBUG_MENU("Cube", &g_CubeTransform, -100.0f, 100.0f); + DEBUG_MENU("Light Direction", &lights->GetLights()[0]->direction, -1.0f, 1.0f); + DEBUG_MENU("Light Intensity", &lights->GetLights()[0]->intensity, 0, 100); + DEBUG_MENU("Dagger", &g_DaggerTransform, -50, 50); + DEBUG_MENU("Dagger Gloss", &g_DaggerGloss, 0.0f, 1.0f); + + // shadowPassShader = Shader::CreateFromFile("Shadow", "shaders/ShadowPass.shader"); + // g_DepthBuffer = FramebufferDepth::Create(2048, 2048); + // g_ShadowMap = (TextureDepth*)g_DepthBuffer->GetTexture(); + + for (uint i = 0; i < 4; i++) + { + // m_Materials[i]->SetTexture(g_ShadowMap, 6); + // m_Materials[i]->SetUniform("u_ShadowMap", 6); + } + + SP_INFO("Init took ", timer.ElapsedMillis(), " ms"); } void Test3D::OnTick() { - Application& app = Application::GetApplication(); - SP_INFO(app.GetUPS(), " ups, ", app.GetFPS(), " fps"); + Application& app = Application::GetApplication(); + SP_INFO(app.GetUPS(), " ups, ", app.GetFPS(), " fps"); } void Test3D::OnUpdate(const Timestep& ts) { - TransformComponent* cubeTransform = m_Cube->GetComponent(); + TransformComponent* cubeTransform = m_Cube->GetComponent(); - mat4 transform = mat4::Translate(vec3(0, 2.5f, 0)) * mat4::Rotate(m_Rotation, vec3(1, 0, 0)) * mat4::Rotate(m_Rotation, vec3(0, 1, 0)) * mat4::Rotate(m_Rotation, vec3(0, 0, 1)); - cubeTransform->transform = mat4::Translate(g_CubeTransform) * transform * mat4::Scale(vec3(1.4f, 1.4f, 1.4f)); - - TransformComponent* dagger = m_Dagger->GetComponent(); - dagger->transform = mat4::Translate(g_DaggerTransform); - - for (Entity* sphere : m_Spheres) - { - TransformComponent* sphereTransform = sphere->GetComponent(); - // sphereTransform->transform = sphereTransform->transform * mat4::Rotate(1.0f, vec3(0, 1, 0)); - } - - // Still OpenGL maths style (column-major) - mat4 vp = m_Scene->GetCamera()->GetProjectionMatrix() * m_Scene->GetCamera()->GetViewMatrix(); - m_SkyboxMaterial->SetUniform("invViewProjMatrix", mat4::Invert(vp)); + mat4 transform = mat4::Translate(vec3(0, 2.5f, 0)) * mat4::Rotate(m_Rotation, vec3(1, 0, 0)) * mat4::Rotate(m_Rotation, vec3(0, 1, 0)) * mat4::Rotate(m_Rotation, vec3(0, 0, 1)); + cubeTransform->transform = mat4::Translate(g_CubeTransform) * transform * mat4::Scale(vec3(1.4f, 1.4f, 1.4f)); + + TransformComponent* dagger = m_Dagger->GetComponent(); + dagger->transform = mat4::Translate(g_DaggerTransform); + + for (Entity* sphere : m_Spheres) + { + TransformComponent* sphereTransform = sphere->GetComponent(); + // sphereTransform->transform = sphereTransform->transform * mat4::Rotate(1.0f, vec3(0, 1, 0)); + } + + // Still OpenGL maths style (column-major) + mat4 vp = m_Scene->GetCamera()->GetProjectionMatrix() * m_Scene->GetCamera()->GetViewMatrix(); + m_SkyboxMaterial->SetUniform("invViewProjMatrix", mat4::Invert(vp)); } void Test3D::OnRender(Renderer3D& renderer) { #if 0 - mat4 depthProjectionMatrix = mat4::Orthographic(-10, 10, -10, 10, -10, 20); - mat4 depthViewMatrix = mat4::LookAt(vec3(0.5f, 0.5f, 2.0f), vec3(), vec3::Up()); - mat4 depthMVP = depthProjectionMatrix * depthViewMatrix; - - g_DepthBuffer->Bind(); - g_DepthBuffer->Clear(); - renderer.Begin(); - for (uint i = 0; i < m_Scene->GetEntities().size(); i++) - { - Entity* e = m_Scene->GetEntities()[i]; - RenderCommand command; - command.mesh = e->GetComponent()->mesh; - command.shader = shadowPassShader; - command.uniforms.push_back({ "ml_matrix", (byte*)&e->GetComponent()->transform }); - command.uniforms.push_back({ "u_DepthMatrix", (byte*)&depthMVP }); - renderer.Submit(command); - } - renderer.End(); - renderer.Present(); - - g_DepthBuffer->Unbind(); - - float elements[4 * 4] = { - 0.5, 0.0, 0.0, 0.0, - 0.0, 0.5, 0.0, 0.0, - 0.0, 0.0, 0.5, 0.0, - 0.5, 0.5, 0.5, 1.0 - }; - mat4 biasMatrix(elements); - mat4 depthBiasMVP = biasMatrix * depthMVP; - - for (Material* material : m_Materials) - material->SetUniform("u_DepthBiasMVP", depthBiasMVP); + mat4 depthProjectionMatrix = mat4::Orthographic(-10, 10, -10, 10, -10, 20); + mat4 depthViewMatrix = mat4::LookAt(vec3(0.5f, 0.5f, 2.0f), vec3(), vec3::Up()); + mat4 depthMVP = depthProjectionMatrix * depthViewMatrix; + + g_DepthBuffer->Bind(); + g_DepthBuffer->Clear(); + renderer.Begin(); + for (uint i = 0; i < m_Scene->GetEntities().size(); i++) + { + Entity* e = m_Scene->GetEntities()[i]; + RenderCommand command; + command.mesh = e->GetComponent()->mesh; + command.shader = shadowPassShader; + command.uniforms.push_back({ "ml_matrix", (byte*)&e->GetComponent()->transform }); + command.uniforms.push_back({ "u_DepthMatrix", (byte*)&depthMVP }); + renderer.Submit(command); + } + renderer.End(); + renderer.Present(); + + g_DepthBuffer->Unbind(); + + float elements[4 * 4] = { + 0.5, 0.0, 0.0, 0.0, + 0.0, 0.5, 0.0, 0.0, + 0.0, 0.0, 0.5, 0.0, + 0.5, 0.5, 0.5, 1.0 + }; + mat4 biasMatrix(elements); + mat4 depthBiasMVP = biasMatrix * depthMVP; + + for (Material* material : m_Materials) + material->SetUniform("u_DepthBiasMVP", depthBiasMVP); #endif - //DebugLayer::DrawTexture(m_DaggerMaterial->GetGlossMap()); - Layer3D::OnRender(renderer); + //DebugLayer::DrawTexture(m_DaggerMaterial->GetGlossMap()); + Layer3D::OnRender(renderer); } void Test3D::OnEvent(Event& event) { - if (event.GetType() == Event::Type::KEY_PRESSED) - { - KeyPressedEvent* kpe = (KeyPressedEvent*)&event; - if (kpe->GetRepeat() == 0) - { - switch (kpe->GetKeyCode()) - { - case SP_KEY_R: - ShaderManager::Reload("AdvancedLighting"); - break; - case SP_KEY_C: - m_Scene->SetCamera(m_Scene->GetCamera() == m_MayaCamera ? m_FPSCamera : m_MayaCamera); - break; - } - } - } - Layer::OnEvent(event); + if (event.GetType() == Event::Type::KEY_PRESSED) + { + KeyPressedEvent* kpe = (KeyPressedEvent*)&event; + if (kpe->GetRepeat() == 0) + { + switch (kpe->GetKeyCode()) + { + case SP_KEY_R: + ShaderManager::Reload("AdvancedLighting"); + break; + case SP_KEY_C: + m_Scene->SetCamera(m_Scene->GetCamera() == m_MayaCamera ? m_FPSCamera : m_MayaCamera); + break; + } + } + } + Layer::OnEvent(event); } diff --git a/Sparky-core/Sparky-core.vcxproj b/Sparky-core/Sparky-core.vcxproj index b7130d3c..1c27241b 100644 --- a/Sparky-core/Sparky-core.vcxproj +++ b/Sparky-core/Sparky-core.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -17,26 +17,26 @@ {C737C239-3A40-4388-9C61-6CF779025785} Sparkycore - 8.1 + 10.0.17763.0 DynamicLibrary true - v140 + v141 MultiByte DynamicLibrary false - v140 + v141 true MultiByte DynamicLibrary false - v140 + v141 true MultiByte diff --git a/Sparky-core/Sparky-core.vcxproj.filters b/Sparky-core/Sparky-core.vcxproj.filters deleted file mode 100644 index 38553ff4..00000000 --- a/Sparky-core/Sparky-core.vcxproj.filters +++ /dev/null @@ -1,895 +0,0 @@ - - - - - {1fcee557-0bc2-4d05-bba6-9f2595ed765a} - - - {54ecd7b8-7e95-4776-8c0b-a1ce5dcd7bef} - - - {4f2b3065-02bc-43f2-a152-b9c32a9f9d76} - - - {879fc9f3-d8d7-4685-9ebc-d1d3fb478eb9} - - - {c9e9f25f-b4fd-4949-803a-82dd774cf9d4} - - - {78a415a0-0a37-4f92-b336-9f277f70a832} - - - {af731d24-993c-42a2-958c-3c30bf7b7477} - - - {4a166c17-e7e3-4bc9-9617-39ff33e9ece1} - - - {b0ed385a-3cff-4157-a9e0-3bed4d1f3cd4} - - - {67569db1-5f00-4f44-a9a5-1dd9fffa251d} - - - {d44bd60c-5aa4-4774-b35d-3e3451847a8c} - - - {6bbb3663-d268-4111-a476-808734cb27eb} - - - {f45dc5f4-2e26-458b-a4d0-0baa236a48a6} - - - {bbf7d1bc-4bdb-4634-9ec6-0173ba64c92f} - - - {49090165-a900-4281-ad83-5ed37e094e19} - - - {ef09e5cd-002c-4df6-9d25-72c1738a8586} - - - {58659f55-dab6-4c52-80e6-faf0d518bf07} - - - {4b83c31a-69f4-4b45-b448-c3b61f9475d0} - - - {c298d8e5-9102-4126-a91d-fb8b67f81f1f} - - - {a8a0b3a9-7305-47c4-909b-9c23da093581} - - - {46a34b0e-73b8-4c5d-9c72-c8699ec64003} - - - {f3220443-5c8f-48d1-b8a5-58849106a25f} - - - {0faffb7b-341e-4159-a833-ee2b747c0102} - - - {8ccdc53f-69fa-402f-b225-c04eb3661a47} - - - - - sp\audio - - - sp\audio - - - sp\embedded - - - sp\graphics\ShaderFactory - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\maths - - - sp\maths - - - sp\maths - - - sp\maths - - - sp - - - sp - - - sp\maths - - - sp\app - - - sp\graphics - - - sp\entity\component - - - sp\entity - - - sp\events - - - sp\graphics - - - sp\events - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\entity\component - - - sp\events - - - sp\graphics - - - sp\maths - - - sp\graphics - - - sp\entity\component - - - sp\platform\posix - - - sp\platform\win32 - - - sp\platform\win32 - - - sp\platform\win32 - - - sp\platform\win32 - - - sp\graphics - - - sp\debug - - - sp\debug - - - sp\app - - - sp\platform\win32 - - - sp\maths - - - sp\debug - - - sp\debug - - - sp\utils - - - sp\graphics - - - sp\graphics - - - sp\graphics\ui - - - sp\graphics\ui - - - sp\graphics\ui - - - sp\graphics\ui - - - sp\graphics - - - sp\debug - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\graphics - - - sp\system - - - sp\system - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\utils - - - sp\system - - - sp\system - - - sp\events - - - sp\platform\win32 - - - sp\platform\win32 - - - sp - - - sp\graphics - - - sp\entity\component - - - sp\system - - - sp\system - - - - - sp\graphics - - - - - sp\app - - - sp - - - sp - - - sp - - - sp - - - sp - - - sp\audio - - - sp\audio - - - sp\embedded - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics\ShaderFactory - - - sp\maths - - - sp\maths - - - sp\maths - - - sp\maths - - - sp\maths - - - sp\maths - - - sp\maths - - - sp\utils - - - sp\utils - - - sp\utils - - - sp\utils - - - sp\maths - - - sp\graphics - - - sp\graphics - - - sp\entity\component - - - sp\entity\component - - - sp\entity - - - sp\events - - - sp\graphics - - - sp\events - - - sp\graphics - - - sp\events - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\entity\component - - - sp\graphics - - - sp\events - - - sp\graphics - - - sp\maths - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\entity\component - - - sp\debug - - - sp\graphics - - - sp\debug - - - sp\events - - - sp\events - - - sp\app - - - sp\maths - - - sp\debug - - - sp\debug - - - sp\debug - - - sp\graphics\ui - - - sp\graphics - - - sp\graphics - - - sp\graphics\ui - - - sp\graphics\ui - - - sp\graphics\ui - - - sp\debug - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\directx - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\platform\opengl - - - sp\graphics - - - sp\system - - - sp\system - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\graphics - - - sp\system - - - sp\system - - - sp\events - - - sp - - - sp\graphics - - - sp\entity\component - - - sp\system - - - sp\system - - - - sp\graphics - - - - - - - - sp\embedded\files - - - sp\graphics\ShaderFactory\Shaders - - - sp\graphics\ShaderFactory\Shaders - - - sp\graphics\ShaderFactory\Shaders\gles - - - sp\graphics\ShaderFactory\Shaders\gles - - - sp\graphics\ShaderFactory\Shaders - - - sp\platform\opengl\shaders - - - sp\platform\opengl\shaders - - - - - sp\platform\directx\shaders - - - \ No newline at end of file diff --git a/Sparky-core/src/sp/app/Application.h b/Sparky-core/src/sp/app/Application.h index 7a0c9df6..63ba3c45 100644 --- a/Sparky-core/src/sp/app/Application.h +++ b/Sparky-core/src/sp/app/Application.h @@ -70,6 +70,7 @@ namespace sp { void PlatformInit(); void Run(); + public: void OnTick(); void OnUpdate(const Timestep& ts); void OnRender(); diff --git a/Sparky-core/src/sp/app/Window.cpp b/Sparky-core/src/sp/app/Window.cpp index fe163596..6648da96 100644 --- a/Sparky-core/src/sp/app/Window.cpp +++ b/Sparky-core/src/sp/app/Window.cpp @@ -10,93 +10,93 @@ namespace sp { - using namespace graphics; + using namespace graphics; - std::map Window::s_Handles; + std::map Window::s_Handles; - Window::Window(const String& title, const WindowProperties& properties) - : m_Title(title), m_Properties(properties), m_Handle(nullptr), m_Closed(false), m_EventCallback(nullptr) - { - if (!Init()) - { - SP_ERROR("Failed base Window initialization!"); - return; - } + Window::Window(const String& title, const WindowProperties& properties) + : m_Title(title), m_Properties(properties), m_Handle(nullptr), m_Closed(false), m_EventCallback(nullptr) + { + if (!Init()) + { + SP_ERROR("Failed base Window initialization!"); + return; + } #ifdef SPARKY_PLATFORM_WEB - FontManager::Add(new Font("SourceSansPro", "res/SourceSansPro-Light.ttf", 32)); + FontManager::Add(new Font("SourceSansPro", "res/SourceSansPro-Light.ttf", 32)); #else - FontManager::SetScale(maths::vec2(m_Properties.width / 32.0f, m_Properties.height / 18.0f)); // TODO: Seriously - FontManager::Add(new Font("SourceSansPro", internal::DEFAULT_FONT, internal::DEFAULT_FONT_SIZE, 32)); + FontManager::SetScale(maths::vec2(m_Properties.width / 32.0f, m_Properties.height / 18.0f)); // TODO: Seriously + FontManager::Add(new Font("SourceSansPro", internal::DEFAULT_FONT, internal::DEFAULT_FONT_SIZE, 32)); #endif - FreeImage_Initialise(); - - audio::SoundManager::Init(); - m_InputManager = new InputManager(); - } - - Window::~Window() - { - FontManager::Clean(); - TextureManager::Clean(); - audio::SoundManager::Clean(); - } - - bool Window::Init() - { - if (!PlatformInit()) - { - SP_FATAL("Failed to initialize platform!"); - return false; - } - - Renderer::Init(); - - SetTitle(m_Title); - return true; - } - - void Window::SetVsync(bool enabled) - { - // TODO: Not implemented - m_Vsync = enabled; - - } - - void Window::Clear() const - { - Renderer::Clear(RENDERER_BUFFER_COLOR | RENDERER_BUFFER_DEPTH); - } - - void Window::Update() - { - PlatformUpdate(); - audio::SoundManager::Update(); - } - - bool Window::Closed() const - { - return m_Closed; - } - - void Window::SetEventCallback(const WindowEventCallback& callback) - { - m_EventCallback = callback; - m_InputManager->SetEventCallback(m_EventCallback); - } - - void Window::RegisterWindowClass(void* handle, Window* window) - { - s_Handles[handle] = window; - } - - Window* Window::GetWindowClass(void* handle) - { - if (handle == nullptr) - return s_Handles.begin()->second; - - return s_Handles[handle]; - } + FreeImage_Initialise(); + + audio::SoundManager::Init(); + m_InputManager = new InputManager(); + } + + Window::~Window() + { + FontManager::Clean(); + TextureManager::Clean(); + audio::SoundManager::Clean(); + } + + bool Window::Init() + { + if (!PlatformInit()) + { + SP_FATAL("Failed to initialize platform!"); + return false; + } + + Renderer::Init(); + + SetTitle(m_Title); + return true; + } + + void Window::SetVsync(bool enabled) + { + // TODO: Not implemented + m_Vsync = enabled; + + } + + void Window::Clear() const + { + Renderer::Clear(RENDERER_BUFFER_COLOR | RENDERER_BUFFER_DEPTH); + } + + void Window::Update() + { + PlatformUpdate(); + audio::SoundManager::Update(); + } + + bool Window::Closed() const + { + return m_Closed; + } + + void Window::SetEventCallback(const WindowEventCallback& callback) + { + m_EventCallback = callback; + m_InputManager->SetEventCallback(m_EventCallback); + } + + void Window::RegisterWindowClass(void* handle, Window* window) + { + s_Handles[handle] = window; + } + + Window* Window::GetWindowClass(void* handle) + { + if (handle == nullptr) + return s_Handles.begin()->second; + + return s_Handles[handle]; + } } \ No newline at end of file diff --git a/SparkyCLI/SparkyCLI.vcxproj b/SparkyCLI/SparkyCLI.vcxproj index c6bd75ee..0d6251e4 100644 --- a/SparkyCLI/SparkyCLI.vcxproj +++ b/SparkyCLI/SparkyCLI.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -15,19 +15,20 @@ v4.5.2 ManagedCProj SparkyCLI + 10.0.17763.0 DynamicLibrary true - v140 + v141 true Unicode DynamicLibrary false - v140 + v141 true Unicode diff --git a/SparkyCLI/src/app/Application.h b/SparkyCLI/src/app/Application.h index e406b49f..3a4db28d 100644 --- a/SparkyCLI/src/app/Application.h +++ b/SparkyCLI/src/app/Application.h @@ -2,11 +2,11 @@ #include "..\SparkyCLI.h" -#include +#include namespace SparkyCLI { - public ref class Application : public ManagedClass + public ref class Application : public ManagedClass { public: Application(System::String^ name, uint width, uint height); diff --git a/SparkyCLI/src/audio/Sound.cpp b/SparkyCLI/src/audio/Sound.cpp index cfca45ed..9078c495 100644 --- a/SparkyCLI/src/audio/Sound.cpp +++ b/SparkyCLI/src/audio/Sound.cpp @@ -2,14 +2,14 @@ namespace SparkyCLI { - Sound::Sound(sparky::audio::Sound* instance) + Sound::Sound(sp::audio::Sound* instance) : ManagedClass(instance) { } Sound::Sound(System::String^ name, System::String^ filename) { - m_Instance = new sparky::audio::Sound(string_to_std_string(name), string_to_std_string(filename)); + m_Instance = new sp::audio::Sound(string_to_std_string(name), string_to_std_string(filename)); } void Sound::Play() diff --git a/SparkyCLI/src/audio/Sound.h b/SparkyCLI/src/audio/Sound.h index c563ebb1..1e2e7072 100644 --- a/SparkyCLI/src/audio/Sound.h +++ b/SparkyCLI/src/audio/Sound.h @@ -2,14 +2,14 @@ #include "..\SparkyCLI.h" -#include