diff --git a/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp b/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp index 198fb1f33c..de258b24ed 100644 --- a/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp +++ b/Source/Core/Editor/Menus/GUI_Menu_File/GUI_Menu_File.cpp @@ -31,21 +31,12 @@ void GUI_Menu_File::Draw() { // File Menu if (ImGui::BeginMenu("File")) { + ImGui::MenuItem("New", "", &Windows_->GUI_Window_NewProject_->Enabled_); ImGui::MenuItem("Open", "", &Windows_->GUI_Window_OpenProject_->Enabled_); ImGui::Separator(); - ImGui::MenuItem("About", "", &Windows_->GUI_Window_About_->Enabled_); - ImGui::Separator(); - - ImGui::MenuItem("Project Settings", "", &Windows_->GUI_Window_ProjectSettings_->Enabled_); - ImGui::Separator(); - if (ImGui::MenuItem("Import Model")) { - ImportAsset_->OpenFileDialog(); - } ImGui::Separator(); - - // Save All if (ImGui::MenuItem("Save")) { SystemUtils_->Logger_->Log("Saving Project Data", 4); @@ -61,6 +52,13 @@ void GUI_Menu_File::Draw() { } } + ImGui::MenuItem("Project Settings", "", &Windows_->GUI_Window_ProjectSettings_->Enabled_); + ImGui::MenuItem("About", "", &Windows_->GUI_Window_About_->Enabled_); + ImGui::Separator(); + + if (ImGui::MenuItem("Import Model")) { + ImportAsset_->OpenFileDialog(); + } ImGui::Separator(); // Exit Options diff --git a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/CMakeLists.txt b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/CMakeLists.txt index 7d3c0bce5a..02b8506cfa 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/CMakeLists.txt +++ b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/CMakeLists.txt @@ -47,6 +47,7 @@ target_link_libraries(ERS_Editor_WindowManager GUI_Window_ThemeSelector GUI_Window_FontSelector GUI_Window_OpenProject + GUI_Window_NewProject ) diff --git a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.cpp b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.cpp index d6c58fa211..ed22cfd673 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.cpp +++ b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.cpp @@ -55,7 +55,8 @@ ERS_CLASS_ThemeManager* ThemeManager, ERS_CLASS_FontManager* FontManager, Cursor Windows_->GUI_Window_TestEditor_ = std::make_unique(SystemUtils_); Windows_->GUI_Window_ThemeSelector_ = std::make_unique(ThemeManager); Windows_->GUI_Window_FontSelector_ = std::make_unique(FontManager); - Windows_->GUI_Window_OpenProject_ = std::make_unique(SystemUtils_); + Windows_->GUI_Window_OpenProject_ = std::make_unique(SystemUtils_); + Windows_->GUI_Window_NewProject_ = std::make_unique(SystemUtils_); SystemUtils_->Logger_->Log("WindowManager Subsystem Finished Setting Up Window Struct", 3); SystemUtils_->Logger_->Log("WindowManager Subsystem Setting Up Window Index", 4); @@ -81,6 +82,7 @@ ERS_CLASS_ThemeManager* ThemeManager, ERS_CLASS_FontManager* FontManager, Cursor WindowNames_.push_back("ThemeSelector"); WindowNames_.push_back("FontSelector"); WindowNames_.push_back("OpenProject"); + WindowNames_.push_back("NewProject"); SystemUtils_->Logger_->Log("WindowManager Subsystem Finished Setting Up Window Index", 3); @@ -113,6 +115,7 @@ void ERS_CLASS_WindowManager::UpdateAllWindows() { Windows_->GUI_Window_ThemeSelector_->Draw(); Windows_->GUI_Window_FontSelector_->Draw(); Windows_->GUI_Window_OpenProject_->Draw(); + Windows_->GUI_Window_NewProject_->Draw(); } @@ -183,6 +186,9 @@ bool ERS_CLASS_WindowManager::SetWindowStatus(std::string WindowName, bool Statu } else if (WindowName == "OpenProject") { Windows_->GUI_Window_OpenProject_->Enabled_ = Status; return true; + } else if (WindowName == "NewProject") { + Windows_->GUI_Window_NewProject_->Enabled_ = Status; + return true; } else { return false; } @@ -256,6 +262,9 @@ bool ERS_CLASS_WindowManager::GetWindowStatus(std::string WindowName, bool* Stat } else if (WindowName == "OpenProject") { *Status = Windows_->GUI_Window_OpenProject_->Enabled_; return true; + } else if (WindowName == "NewProject") { + *Status = Windows_->GUI_Window_NewProject_->Enabled_; + return true; } else { return false; } diff --git a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h index bf067912a8..89abf212a1 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h +++ b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h @@ -44,6 +44,7 @@ #include #include #include +#include diff --git a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h index d0cd8c8bd1..0a3f89ea5c 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h +++ b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h @@ -31,6 +31,7 @@ #include #include #include +#include /** * @brief This structure holds unique pointers to all windows that are instantiated by the GUI. @@ -61,6 +62,7 @@ struct ERS_STRUCT_Windows { std::unique_ptr GUI_Window_ThemeSelector_; std::unique_ptr GUI_Window_FontSelector_; std::unique_ptr GUI_Window_OpenProject_; + std::unique_ptr GUI_Window_NewProject_; }; \ No newline at end of file diff --git a/Source/Core/Editor/Windows/CMakeLists.txt b/Source/Core/Editor/Windows/CMakeLists.txt index 5d25840da9..25b5b101b6 100644 --- a/Source/Core/Editor/Windows/CMakeLists.txt +++ b/Source/Core/Editor/Windows/CMakeLists.txt @@ -20,6 +20,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ShaderEditor) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ScriptEditor) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_OpenProject) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_NewProject) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ThemeSelector) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_FontSelector) diff --git a/Source/Core/Editor/Windows/GUI_Window_NewProject/CMakeLists.txt b/Source/Core/Editor/Windows/GUI_Window_NewProject/CMakeLists.txt new file mode 100644 index 0000000000..894e609d91 --- /dev/null +++ b/Source/Core/Editor/Windows/GUI_Window_NewProject/CMakeLists.txt @@ -0,0 +1,31 @@ +######################################################################## +# This file is part of the BrainGenix-ERS Environment Rendering System # +######################################################################## + +# Create Library (Name Should Be Parent Dir Name) +add_library(GUI_Window_NewProject + + # Add Source Files (.cpp) + "GUI_Window_NewProject.cpp" + + # Add Header Files (.h) + "GUI_Window_NewProject.h" + + + ${BACKWARD_ENABLE} + ) + +# Link 3rd Party Libs +target_link_libraries(GUI_Window_NewProject + glad + glfw + IMGUI + ImGuiFileDialog + ) + +# Link Internal Libs +target_link_libraries(GUI_Window_NewProject + ERS_STRUCT_SystemUtils + ) + +target_include_directories(GUI_Window_NewProject PUBLIC ./) diff --git a/Source/Core/Editor/Windows/GUI_Window_NewProject/GUI_Window_NewProject.cpp b/Source/Core/Editor/Windows/GUI_Window_NewProject/GUI_Window_NewProject.cpp new file mode 100644 index 0000000000..5c777f9f36 --- /dev/null +++ b/Source/Core/Editor/Windows/GUI_Window_NewProject/GUI_Window_NewProject.cpp @@ -0,0 +1,95 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include + + +GUI_Window_NewProject::GUI_Window_NewProject(ERS_STRUCT_SystemUtils* SystemUtils) { + + SystemUtils_ = SystemUtils; + SystemUtils_->Logger_->Log("Seting Up New Project Window Dialog", 5); + +} + + +GUI_Window_NewProject::~GUI_Window_NewProject() { + + SystemUtils_->Logger_->Log("New Project Window Dialog Destructor Called", 6); + +} + + +void GUI_Window_NewProject::Draw() { + + if (Enabled_ && !LastWindowState_) { + ImGuiFileDialog::Instance()->OpenDialog("New Project", "New Project", nullptr, "~", "", 0); + + } + + if (Enabled_) { + + // Draw File Dialog + if (ImGuiFileDialog::Instance()->Display("New Project", ImGuiWindowFlags_None, ImVec2(600, 300))) { + + + if (ImGuiFileDialog::Instance()->IsOk()) + { + + std::string Path = ImGuiFileDialog::Instance()->GetCurrentPath(); + Path += "/"; + SystemUtils_->Logger_->Log(std::string("Creating New Project In Target Directory '") + Path + "'", 5); + + // TodO add system to get project dir from config file, + // then have it iterate over all files, copying them to the new selected path + // finally, have the system load that + // check for bugs and edge-cases + + std::string DefualtProjectPath = "EditorAssets/Projects/NewProject/"; + std::string CurrentExecutablePath = std::filesystem::current_path(); + + for (const auto &Entry : std::filesystem::recursive_directory_iterator(DefualtProjectPath)) { + + // Get The Current Absolute Path To File, As Well As It's Filename + std::string PathRelativeName{Entry.path().u8string()}; + std::string File = CurrentExecutablePath + "/" + PathRelativeName; + std::string FileName = PathRelativeName.substr(PathRelativeName.find_last_of("/"), sizeof(PathRelativeName)); + + SystemUtils_->Logger_->Log(std::string("Copying File '") + File + "' To New Project Directory", 4); + std::filesystem::copy_file(File, Path + FileName); + + } + + + std::string Command; +#if defined(_WIN32) + Command += ""; +#elif defined(__APPLE__) + Command += "./"; +#else + Command += "./"; +#endif + Command += "BrainGenix-ERS -ProjectDirectory "; + Command += '"' + Path + '"' + " &"; + std::system(Command.c_str()); + + // Quit System + SystemUtils_->Logger_->Log("Shutting Down This Editor Window Now, Launching Editor For That Project", 5); + *SystemUtils_->SystemShouldRun_ = false; + + + } + + ImGuiFileDialog::Instance()->Close(); + } + + + + + } + + LastWindowState_ = Enabled_; + + +} + diff --git a/Source/Core/Editor/Windows/GUI_Window_NewProject/GUI_Window_NewProject.h b/Source/Core/Editor/Windows/GUI_Window_NewProject/GUI_Window_NewProject.h new file mode 100644 index 0000000000..3b1284e65b --- /dev/null +++ b/Source/Core/Editor/Windows/GUI_Window_NewProject/GUI_Window_NewProject.h @@ -0,0 +1,57 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + + +// Standard Libraries (BG convention: use <> instead of "") +#include +#include + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +#include + +#include + +// Internal Libraries (BG convention: use <> instead of "") +#include + + +/** + * @brief This class provides the GUI to the import asset option within the file menu. + * + */ +class GUI_Window_NewProject { + +private: + + ERS_STRUCT_SystemUtils* SystemUtils_; /**OpenDialog("Open Project", "Open Project", ".ERS", ".", "", 0); + ImGuiFileDialog::Instance()->OpenDialog("Open Project", "Open Project", nullptr, "~", "", 0); } if (Enabled_) { // Draw File Dialog - if (ImGuiFileDialog::Instance()->Display("Open Project", ImGuiWindowFlags_None, ImVec2(400, 200))) { + if (ImGuiFileDialog::Instance()->Display("Open Project", ImGuiWindowFlags_None, ImVec2(600, 300))) { if (ImGuiFileDialog::Instance()->IsOk()) diff --git a/Source/Core/Manager/ERS_ProjectManager/ERS_ProjectManager.cpp b/Source/Core/Manager/ERS_ProjectManager/ERS_ProjectManager.cpp index 5543ecffb8..e2fd31452d 100644 --- a/Source/Core/Manager/ERS_ProjectManager/ERS_ProjectManager.cpp +++ b/Source/Core/Manager/ERS_ProjectManager/ERS_ProjectManager.cpp @@ -50,12 +50,29 @@ void ERS_CLASS_ProjectManager::LoadProject(long AssetID) { Project_.ControllerSettings->push_back(Settings); } - // Load Default Scene - SystemUtils_->Logger_->Log(std::string(std::string("Loading Project Default Scene With ID ") + std::to_string(Project_.SceneIDs[Project_.DefaultScene])).c_str(), 5); - for (unsigned int i = 0; i < Project_.SceneIDs.size(); i++) { - SceneManager_->AddScene(SceneLoader_->ProcessScene(Project_.SceneIDs[i])); + // Handle The Defaut Scene + if (Project_.SceneIDs.size() > 0) { + + // Load Default Scene If Applicable + SystemUtils_->Logger_->Log(std::string(std::string("Loading Project Default Scene With ID ") + std::to_string(Project_.SceneIDs[Project_.DefaultScene])).c_str(), 5); + for (unsigned int i = 0; i < Project_.SceneIDs.size(); i++) { + SceneManager_->AddScene(SceneLoader_->ProcessScene(Project_.SceneIDs[i])); + } + SceneManager_->SetActiveScene(Project_.DefaultScene); + + } else { + + // Create Blank Scene For The System + ERS_STRUCT_Scene NewScene; + NewScene.ScenePath = SystemUtils_->ERS_IOSubsystem_->AllocateAssetID(); + NewScene.SceneName = "Untitled Scene"; + NewScene.IsSceneLoaded = true; + NewScene.SceneFormatVersion = 1; + + Project_.SceneIDs.push_back(NewScene.ScenePath); + SceneManager_->AddScene(NewScene); + } - SceneManager_->SetActiveScene(Project_.DefaultScene); } diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_DepthMaps.cpp b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_DepthMaps.cpp index 276ea1f1b3..a89466e170 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_DepthMaps.cpp +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_DepthMaps.cpp @@ -136,7 +136,6 @@ bool ERS_CLASS_DepthMaps::RegenerateDepthMapTextureArray2D(int NumberOfTextures, bool ERS_CLASS_DepthMaps::RegenerateDepthMapTextureArrayCubemap(int NumberOfTextures, bool LogEnabled) { - SystemUtils_->Logger_->Log( std::string("Generating Depth Map Texture Cube Map Array Of ") + std::to_string(NumberOfTextures) + std::string(" Textures, With Width Of ") + std::to_string(DepthTextureArrayWidth_) @@ -165,10 +164,11 @@ bool ERS_CLASS_DepthMaps::RegenerateDepthMapTextureArrayCubemap(int NumberOfText SystemUtils_->Logger_->Log("Setting Up Cubemap Texture Array OpenGL Parameters", 4, LogEnabled); glGenTextures(1, &DepthTextureCubemapArrayID_); glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, DepthTextureCubemapArrayID_); + std::cout<<"===========================================R2="<Logger_->Log("Checking Cubemap Depth Map Texture Array Allocation Array", 3, LogEnabled); unsigned long SizeOfAllocationArray = DepthMapTexturesCubemapAlreadyAllocated_.size(); @@ -395,6 +397,9 @@ void ERS_CLASS_DepthMaps::UpdateDepthMap(ERS_STRUCT_PointLight* Light, ERS_STRUC // Only Update If Instructed To Do SO if (Light->DepthMap.ToBeUpdated) { + std::cout<SceneManager_->Scenes_[ProjectUtils_->SceneManager_->ActiveScene_].get(); float NearPlane, FarPlane; @@ -432,6 +439,7 @@ void ERS_CLASS_DepthMaps::UpdateDepthMap(ERS_STRUCT_PointLight* Light, ERS_STRUC DepthShader->SetFloat("FarPlane", Light->MaxDistance); DepthShader->SetInt("ShadowMapLayer", Light->DepthMap.DepthMapTextureIndex); Renderer_->RenderSceneNoTextures(TargetScene, DepthShader); + std::cout<DepthMap.ToBeUpdated = false; @@ -489,6 +497,7 @@ void ERS_CLASS_DepthMaps::UpdateDepthMaps(ERS_STRUCT_Shader* DepthShader, ERS_S // Fix Offset (Peter Panning) glCullFace(GL_FRONT); + // Get Active Scene ERS_STRUCT_Scene* ActiveScene = ProjectUtils_->SceneManager_->Scenes_[ProjectUtils_->SceneManager_->ActiveScene_].get(); @@ -505,6 +514,8 @@ void ERS_CLASS_DepthMaps::UpdateDepthMaps(ERS_STRUCT_Shader* DepthShader, ERS_S } + + // Handle Spot Lights for (unsigned int i = 0; i < ActiveScene->SpotLights.size(); i++) { @@ -518,6 +529,8 @@ void ERS_CLASS_DepthMaps::UpdateDepthMaps(ERS_STRUCT_Shader* DepthShader, ERS_S } + + // Handle Point Lights for (unsigned int i = 0; i < ActiveScene->PointLights.size(); i++) { diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ShadowMaps.cpp b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ShadowMaps.cpp index 72e6f8a866..e512e10c20 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ShadowMaps.cpp +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_ShadowMaps.cpp @@ -84,6 +84,7 @@ void ERS_CLASS_ShadowMaps::GetDepthMaps(std::vector* Depth ERS_CLASS_DepthMaps_->FreeDepthMapIndexCubemap(ActiveScene->PointLights[i]->DepthMap.DepthMapTextureIndex); ActiveScene->PointLights[i]->DepthMap.Initialized = false; } + } for (unsigned int i = 0; i < ActiveScene->SpotLights.size(); i++) { if (ActiveScene->SpotLights[i]->CastsShadows_) { @@ -206,8 +207,13 @@ void ERS_CLASS_ShadowMaps::UpdateShadowMaps(ERS_STRUCT_Shader* DepthMapShader, E // Handle Updating Depth Maps std::vector DepthMaps; std::vector LightPositions; + //std::cout<<"============================================"<UpdateDepthMaps(DepthMapShader, CubemapDepthShader); diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp index dd6bb7ec71..93fe84b621 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp @@ -63,6 +63,8 @@ void ERS_CLASS_VisualRenderer::SetOpenGLDefaults(ERS_STRUCT_OpenGLDefaults* Defa void ERS_CLASS_VisualRenderer::UpdateViewports(float DeltaTime, ERS_CLASS_SceneManager* SceneManager) { + + // Set Depth Shader For Shadow System DepthMapShader_ = Shaders_[ERS_FUNCTION_FindShaderByName(std::string("_DepthMap"), &Shaders_)].get(); CubemapDepthShader_ = Shaders_[ERS_FUNCTION_FindShaderByName(std::string("_DepthCubeMap"), &Shaders_)].get(); @@ -79,6 +81,7 @@ void ERS_CLASS_VisualRenderer::UpdateViewports(float DeltaTime, ERS_CLASS_SceneM } + // Generate Shadows //DepthMapShader_ = Shaders_[ERS_FUNCTION_FindShaderByName(std::string("Preview Shader"), &Shaders_)].get(); if (Viewports_.size() > 0) { diff --git a/Source/EditorAssets/Projects/NewProject/0.ERS b/Source/EditorAssets/Projects/NewProject/0.ERS new file mode 100644 index 0000000000..1ab0b248f2 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/0.ERS @@ -0,0 +1,216 @@ +0: + AssetType: Metadata + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +1: + AssetType: Undefined + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-04-03-02-53-58 +2: + AssetType: Placeholder + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +3: + AssetType: Undefined + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-04-03-02-53-59 +4: + AssetType: Mesh + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +5: + AssetType: Image + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +6: + AssetType: Image + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +7: + AssetType: Image + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +8: + AssetType: Image + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +9: + AssetType: Image + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +10: + AssetType: Model + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +11: + AssetType: Controller Settings + AssetCreationDate: 1970-01-01-00-00-00 + AssetModificationDate: 2022-01-01-00-00-00 +10000: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10001: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10002: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10003: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10004: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10005: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10006: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10007: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10008: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10009: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10010: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10011: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10012: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10013: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10014: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10015: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10016: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10017: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10018: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10019: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10020: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10021: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10022: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10023: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10024: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10025: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10026: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10027: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10028: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10029: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10030: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10031: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10032: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10033: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10034: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10035: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10036: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10037: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10038: + AssetType: Vertex Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10039: + AssetType: Fragment Shader + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-02-16-23-23-16 +10040: + AssetType: Undefined + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-04-28-06-24-53 +10041: + AssetType: Undefined + AssetCreationDate: 1970-01-01-00-00-01 + AssetModificationDate: 2022-04-28-06-24-53 \ No newline at end of file diff --git a/Source/EditorAssets/Projects/NewProject/1.ERS b/Source/EditorAssets/Projects/NewProject/1.ERS new file mode 100644 index 0000000000..bb23477b67 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/1.ERS @@ -0,0 +1,64 @@ +ProjectName: ERS Test Project +ProjectDescription: Test development scene for EGSC. +ProjectVersion: 1.0.0 +ProjectCreationDate: 0000-00-00 00-00-00 +ProjectModificationDate: 2022-04-03 02-53-58 +ProjectCreator: BrainGenix-ERS Development Team +ProjectLicense: AGPL-V3.0 Or Higher +IsLicenseProprietary: false +SceneIDs: +DefaultScene: 0 +EditorLayouts: + 0: 2 +DefaultLayout: 0 +DefaultShaderProgram: 11 +ShaderPrograms: + 0: + Name: _Grid + VertexID: 10000 + FragmentID: 10001 + 1: + Name: _LightIcon + VertexID: 10038 + FragmentID: 10039 + 2: + Name: _DepthMap + VertexID: 10042 + FragmentID: 10043 + 3: + Name: _DepthCubeMap + VertexID: 10044 + FragmentID: 10045 + GeometryID: 10046 + 4: + Name: Ambient Occlusion Texture Map + VertexID: 10004 + FragmentID: 10005 + 5: + Name: Diffuse Texture Map + VertexID: 10008 + FragmentID: 10009 + 6: + Name: Emissive Texture Map + VertexID: 10016 + FragmentID: 10017 + 7: + Name: Height Texture Map + VertexID: 10018 + FragmentID: 10019 + 8: + Name: Metalic Texture Map + VertexID: 10022 + FragmentID: 10023 + 9: + Name: Normals Texture Map + VertexID: 10026 + FragmentID: 10027 + 10: + Name: Shininess Texture Map + VertexID: 10032 + FragmentID: 10033 + 11: + Name: Viewport + VertexID: 10040 + FragmentID: 10041 diff --git a/Source/EditorAssets/Projects/NewProject/10000.ERS b/Source/EditorAssets/Projects/NewProject/10000.ERS new file mode 100644 index 0000000000..e4cce6ac2e --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10000.ERS @@ -0,0 +1,37 @@ +#version 400 + +layout (location = 0) in vec4 aPos; +layout (location = 2) in vec3 aTexCoords; + +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +out vec3 UV; +out vec3 OriginalPosition; + + +void main() +{ + gl_Position = projection * view * model * aPos; + + UV = aTexCoords; + OriginalPosition = vec3(aPos.xyz); +} + + + + + + + + + + + + + + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10001.ERS b/Source/EditorAssets/Projects/NewProject/10001.ERS new file mode 100644 index 0000000000..bd01fda26d --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10001.ERS @@ -0,0 +1,49 @@ +#version 400 + +// Set IO +out vec4 FragColor; +in vec3 UV; +in vec3 OriginalPosition; + +// Get Configuration Params +uniform vec3 CameraPosition; +uniform vec3 GRID_COLOR_BASE; +uniform vec3 GRID_COLOR_X; +uniform vec3 GRID_COLOR_Z; +uniform float GRID_SIZE; +uniform float GRID_LINE_THICKNESS; +uniform float GRID_SCALE; + + + +void main(void) +{ + + if(fract(UV.x / GRID_SIZE) < GRID_LINE_THICKNESS || fract(UV.y / GRID_SIZE) < GRID_LINE_THICKNESS) { + + // Check If X Or Y Axis Line, Set Color + vec3 LineColor; + float ScaledThickness = GRID_LINE_THICKNESS * GRID_SIZE; + if (abs(OriginalPosition[0] + ScaledThickness) < ScaledThickness) { + LineColor = GRID_COLOR_Z; + } else if (abs(OriginalPosition[1] + ScaledThickness) < ScaledThickness) { + LineColor = GRID_COLOR_X; + } else { + LineColor = GRID_COLOR_BASE; + } + + // Calculate Opacity Based On Distance From Camera + vec3 CameraLocation2D = vec3(CameraPosition[0], CameraPosition[2], CameraPosition[1]/4.0f); + float Distance = distance(CameraLocation2D, GRID_SCALE*OriginalPosition); + float Alpha = 75.0f/pow(Distance, 3); + + // Draw Pixel + if (Alpha > 0.0001f) { + FragColor = vec4(LineColor, Alpha); + } + + } else { + FragColor = vec4(0.0f); + } +} + diff --git a/Source/EditorAssets/Projects/NewProject/10002.ERS b/Source/EditorAssets/Projects/NewProject/10002.ERS new file mode 100644 index 0000000000..21680739e5 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10002.ERS @@ -0,0 +1,26 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} diff --git a/Source/EditorAssets/Projects/NewProject/10003.ERS b/Source/EditorAssets/Projects/NewProject/10003.ERS new file mode 100644 index 0000000000..4a4c006533 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10003.ERS @@ -0,0 +1,36 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_ambient1, TexCoords); +} diff --git a/Source/EditorAssets/Projects/NewProject/10004.ERS b/Source/EditorAssets/Projects/NewProject/10004.ERS new file mode 100644 index 0000000000..21680739e5 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10004.ERS @@ -0,0 +1,26 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} diff --git a/Source/EditorAssets/Projects/NewProject/10005.ERS b/Source/EditorAssets/Projects/NewProject/10005.ERS new file mode 100644 index 0000000000..190d4c2e2d --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10005.ERS @@ -0,0 +1,36 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_ambient_occlusion1, TexCoords); +} diff --git a/Source/EditorAssets/Projects/NewProject/10006.ERS b/Source/EditorAssets/Projects/NewProject/10006.ERS new file mode 100644 index 0000000000..21680739e5 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10006.ERS @@ -0,0 +1,26 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} diff --git a/Source/EditorAssets/Projects/NewProject/10007.ERS b/Source/EditorAssets/Projects/NewProject/10007.ERS new file mode 100644 index 0000000000..12e51422ba --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10007.ERS @@ -0,0 +1,36 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_base_color1, TexCoords); +} diff --git a/Source/EditorAssets/Projects/NewProject/10008.ERS b/Source/EditorAssets/Projects/NewProject/10008.ERS new file mode 100644 index 0000000000..21680739e5 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10008.ERS @@ -0,0 +1,26 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} diff --git a/Source/EditorAssets/Projects/NewProject/10009.ERS b/Source/EditorAssets/Projects/NewProject/10009.ERS new file mode 100644 index 0000000000..1ba6fb99be --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10009.ERS @@ -0,0 +1,35 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_diffuse1, TexCoords); +} diff --git a/Source/EditorAssets/Projects/NewProject/10010.ERS b/Source/EditorAssets/Projects/NewProject/10010.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10010.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10011.ERS b/Source/EditorAssets/Projects/NewProject/10011.ERS new file mode 100644 index 0000000000..88c573de27 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10011.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_diffuse_roughness1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10012.ERS b/Source/EditorAssets/Projects/NewProject/10012.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10012.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10013.ERS b/Source/EditorAssets/Projects/NewProject/10013.ERS new file mode 100644 index 0000000000..df7a189cdc --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10013.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_displacement1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10014.ERS b/Source/EditorAssets/Projects/NewProject/10014.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10014.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10015.ERS b/Source/EditorAssets/Projects/NewProject/10015.ERS new file mode 100644 index 0000000000..14a708d442 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10015.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_emission_color1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10016.ERS b/Source/EditorAssets/Projects/NewProject/10016.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10016.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10017.ERS b/Source/EditorAssets/Projects/NewProject/10017.ERS new file mode 100644 index 0000000000..e531bfbd11 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10017.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_emissive1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10018.ERS b/Source/EditorAssets/Projects/NewProject/10018.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10018.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10019.ERS b/Source/EditorAssets/Projects/NewProject/10019.ERS new file mode 100644 index 0000000000..7e0674f47f --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10019.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_height1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10020.ERS b/Source/EditorAssets/Projects/NewProject/10020.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10020.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10021.ERS b/Source/EditorAssets/Projects/NewProject/10021.ERS new file mode 100644 index 0000000000..150353560c --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10021.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_lightmap1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10022.ERS b/Source/EditorAssets/Projects/NewProject/10022.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10022.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10023.ERS b/Source/EditorAssets/Projects/NewProject/10023.ERS new file mode 100644 index 0000000000..4e06d4a571 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10023.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_metalness1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10024.ERS b/Source/EditorAssets/Projects/NewProject/10024.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10024.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10025.ERS b/Source/EditorAssets/Projects/NewProject/10025.ERS new file mode 100644 index 0000000000..8d5eb1e5a1 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10025.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_normal_camera1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10026.ERS b/Source/EditorAssets/Projects/NewProject/10026.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10026.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10027.ERS b/Source/EditorAssets/Projects/NewProject/10027.ERS new file mode 100644 index 0000000000..740ffc6dbd --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10027.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_normals1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10028.ERS b/Source/EditorAssets/Projects/NewProject/10028.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10028.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10029.ERS b/Source/EditorAssets/Projects/NewProject/10029.ERS new file mode 100644 index 0000000000..7626b94cde --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10029.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_opacity1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10030.ERS b/Source/EditorAssets/Projects/NewProject/10030.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10030.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10031.ERS b/Source/EditorAssets/Projects/NewProject/10031.ERS new file mode 100644 index 0000000000..490f46962c --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10031.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_reflection1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10032.ERS b/Source/EditorAssets/Projects/NewProject/10032.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10032.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10033.ERS b/Source/EditorAssets/Projects/NewProject/10033.ERS new file mode 100644 index 0000000000..310c8a0dc8 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10033.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_shininess1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10034.ERS b/Source/EditorAssets/Projects/NewProject/10034.ERS new file mode 100644 index 0000000000..8b1244da41 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10034.ERS @@ -0,0 +1,27 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; + +out vec2 TexCoords; + + +// Set Model Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + + +void main() +{ + TexCoords = aTexCoords; + gl_Position = projection * view * model * vec4(aPos, 1.0); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10035.ERS b/Source/EditorAssets/Projects/NewProject/10035.ERS new file mode 100644 index 0000000000..4747929d75 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10035.ERS @@ -0,0 +1,38 @@ +#version 330 core +out vec4 FragColor; + +in vec2 TexCoords; + +// Get Texture Sampler And Lighting Info +uniform sampler2D texture_ambient1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2D texture_base_color1; +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_diffuse_roughness1; +uniform sampler2D texture_displacement1; +uniform sampler2D texture_emission_color1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_height1; +uniform sampler2D texture_lightmap1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_normal_camera1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_opacity1; +uniform sampler2D texture_reflection1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_specular1; + + + +// Get Input Vars +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + + +void main() +{ + FragColor = texture(texture_specular1, TexCoords); +} + diff --git a/Source/EditorAssets/Projects/NewProject/10036.ERS b/Source/EditorAssets/Projects/NewProject/10036.ERS new file mode 100644 index 0000000000..00a043f3cb --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10036.ERS @@ -0,0 +1,74 @@ +#version 330 core + +// Set Inputs +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; +layout (location = 3) in vec3 aTangent; +layout (location = 4) in vec3 aBitangent; + +// Set Outputs +out VS_OUT { + vec3 FragPos; + vec2 TexCoords; + mat3 TBN; + vec3 TangentViewPos; + vec3 TangentFragPos; + vec3 Normal; // Used when no normal map is available; +} Object; + + + +// Get Metadata Params +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + +// Get Mesh Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +// Get Camera Info +uniform vec3 CameraPosition; + +// Get Normal Info +uniform bool HasNormals; + +void main() +{ + Object.FragPos = vec3(model * vec4(aPos, 1.0)); + Object.TexCoords = aTexCoords; + + mat3 NormalMatrix = transpose(inverse(mat3(model))); + vec3 T = normalize(NormalMatrix * aTangent); + vec3 N = normalize(NormalMatrix * aNormal); + T = normalize(T - dot(T, N) * N); + vec3 B = cross(N, T); + + mat3 TBN = transpose(mat3(T, B, N)); + Object.TBN = TBN; + Object.TangentViewPos = TBN * CameraPosition; + Object.TangentFragPos = TBN * Object.FragPos; + Object.Normal = mat3(transpose(inverse(model))) * aNormal; + + gl_Position = projection * view * model * vec4(aPos, 1.0f); + +} + + + + + + + + + + + + + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10037.ERS b/Source/EditorAssets/Projects/NewProject/10037.ERS new file mode 100644 index 0000000000..77659be4d1 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10037.ERS @@ -0,0 +1,345 @@ +#version 330 core + +// Set Outputs +out vec4 FragColor; + +// Set Inputs +in VS_OUT { + vec3 FragPos; + vec2 TexCoords; + mat3 TBN; + vec3 TangentViewPos; + vec3 TangentFragPos; + vec3 Normal; // Used when normal texture not present +} Object; + + + + +// Define Structs +struct STRUCT_DirectionalLight { + + vec3 Direction; + + // Light Color Parameters + vec3 Ambient; + vec3 Diffuse; + vec3 Specular; + +}; + +struct STRUCT_PointLight { + + // Physical Parameters + vec3 Position; + + // Light Color Parameters + vec3 Ambient; + vec3 Diffuse; + vec3 Specular; + + // Light Rolloff Parameters + float ConstantRolloff; + float LinearRolloff; + float QuadraticRolloff; + +}; + +struct STRUCT_SpotLight { + + // Physical Parameters + vec3 Position; + vec3 Direction; + + // Light Color Parameters + vec3 Ambient; + vec3 Diffuse; + vec3 Specular; + + // Light Rolloff Parameters + float ConstantRolloff; + float LinearRolloff; + float QuadraticRolloff; + + // Spotlight Parameters + float CutOff; + float OuterCutOff; + +}; + +struct STRUCT_SampledData { + + vec4 DiffuseTextureColor; + vec4 SpecularTextureColor; + vec4 NormalTextureColor; + vec4 HeightTextureColor; + vec4 EmissiveTextureColor; + +}; + + + + + +// Get Metadata Params +uniform int FrameNumber; // Number of the frame, counts up from zero + +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame + +uniform vec2 ViewportRes; // XY Resolution of the viewport +uniform vec3 CameraPosition; // Get Camera XYZ Position + + + +// Get Texture Info +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_specular1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_height1; +uniform sampler2D texture_emissive1; +uniform float Shinyness; + + +uniform bool HasAmbient; +uniform bool HasAmbientOcclusion; +uniform bool HasBaseColor; +uniform bool HasDiffuse; +uniform bool HasDiffuseRoughness; +uniform bool HasDisplacement; +uniform bool HasEmissionColor; +uniform bool HasEmissive; +uniform bool HasHeight; +uniform bool HasLightmap; +uniform bool HasMetalness; +uniform bool HasNormalCamera; +uniform bool HasNormals; +uniform bool HasOpacity; +uniform bool HasReflection; +uniform bool HasShininess; +uniform bool HasSpecular; + + +// Get Lighting Info +uniform int NumberDirectionalLights; +uniform int NumberPointLights; +uniform int NumberSpotLights; +uniform STRUCT_DirectionalLight DirectionalLights[4]; +uniform STRUCT_PointLight PointLights[32]; +uniform STRUCT_SpotLight SpotLights[16]; + + +// Gamma Correction Info +uniform bool GammaCorrectionEnabled_; +float Gamma = 2.2f; + + +// Declare Functions +vec4 CalculateDirectionalLight(STRUCT_DirectionalLight Light, STRUCT_SampledData SampledData, vec3 Normal, vec3 ViewDirection); +vec4 CalculatePointLight(STRUCT_PointLight Light, STRUCT_SampledData SampledData, vec3 Normal, vec3 FragPos, vec3 ViewDirection); +vec4 CalculateSpotLight(STRUCT_SpotLight Light, STRUCT_SampledData SampledData, vec3 Normal, vec3 FragPos, vec3 ViewDirection); + +vec4 GammaCorrectResult(vec4 Input, bool GammaEnabled); +vec4 GammaCorrectTexture(sampler2D Texture, bool GammaEnabled); + +STRUCT_SampledData SetSampledData(); + +void main() +{ + + // Lighting Sanity Check + if ((NumberDirectionalLights == 0) && (NumberPointLights == 0) && (NumberSpotLights == 0)) { + FragColor = vec4(0.8f); + return; + } + + // ---- Extract Texture Vectors, Create SampledData Struct ---- // + STRUCT_SampledData SampledData = SetSampledData(); + + vec3 Norm; + vec3 ViewDirection; + if (HasNormals) { + Norm = texture(texture_normals1, Object.TexCoords).rgb; + Norm = normalize(Norm * 2.0f - 1.0f); + ViewDirection = normalize(Object.TangentViewPos - Object.TangentFragPos); + } else { + Norm = normalize(Object.Normal); + ViewDirection = normalize(CameraPosition - Object.FragPos); + } + + + // ---- Calculate Lighting Contributions ---- // + vec4 Result = vec4(0.0f); + + // Calculate Directional Lights + for (int i = 0; i < NumberDirectionalLights; i++) { + Result += CalculateDirectionalLight(DirectionalLights[i], SampledData, Norm, ViewDirection); + } + + // Calculate Point Lights + for (int i = 0; i < NumberPointLights; i++) { + Result += CalculatePointLight(PointLights[i], SampledData, Norm, Object.FragPos, ViewDirection); + } + + // Calculate Spot Lights + for (int i = 0; i < NumberSpotLights; i++) { + Result += CalculateSpotLight(SpotLights[i], SampledData, Norm, Object.FragPos, ViewDirection); + } + + // Add Emissive Texture + if (HasEmissive) { + Result += SampledData.EmissiveTextureColor; + } + + // Apply Gamma Correction + FragColor = GammaCorrectResult(Result, GammaCorrectionEnabled_); + + +} + + + +STRUCT_SampledData SetSampledData() { + STRUCT_SampledData SampledData; + + SampledData.DiffuseTextureColor = GammaCorrectTexture(texture_diffuse1, GammaCorrectionEnabled_); + + // Handle Specular Textures + if (HasSpecular) { + SampledData.SpecularTextureColor = GammaCorrectTexture(texture_specular1, GammaCorrectionEnabled_); + } else { + SampledData.SpecularTextureColor = SampledData.DiffuseTextureColor; + } + + // Handle Normal Textures + if (HasNormals) { + SampledData.NormalTextureColor = texture(texture_normals1, Object.TexCoords); + } else { + SampledData.NormalTextureColor = vec4(0.0f); + } + + + SampledData.HeightTextureColor = texture(texture_height1, Object.TexCoords); + + // Handle Emissive Textures + if (HasEmissive) { + SampledData.EmissiveTextureColor = GammaCorrectTexture(texture_emissive1, GammaCorrectionEnabled_); + } else { + SampledData.EmissiveTextureColor = vec4(0.0f); + } + + return SampledData; + +} + + +// Used To Enable Gamma Correction On The Output +vec4 GammaCorrectResult(vec4 Input, bool GammaEnabled) { + if (GammaEnabled) { + Input.rgb = pow(Input.rgb, vec3(1.0/Gamma)); + } + return Input; +} + + +// Used To Make Sure Textures Aren't Too Bright +vec4 GammaCorrectTexture(sampler2D Texture, bool GammaEnabled) { + vec4 Color = texture(Texture, Object.TexCoords); + if (GammaEnabled) { + Color.rgb = pow(Color.rgb, vec3(Gamma)); + } + return Color; +} + + +vec4 CalculateDirectionalLight(STRUCT_DirectionalLight Light, STRUCT_SampledData SampledData, vec3 Normal, vec3 ViewDirection) { + + vec3 LightDirectionVector = normalize(-Light.Direction); + vec3 ReflectionDirectionVector = reflect(-LightDirectionVector, Normal); + + // Diffuse/Specular Components + float Diffuse = max(dot(Normal, LightDirectionVector), 0.0f); + float Specular = pow(max(dot(ViewDirection, ReflectionDirectionVector), 0.0f), Shinyness); + + // Calculate Total Contribution From Components + vec4 AmbientComponent = vec4(Light.Ambient, 1.0f) * SampledData.DiffuseTextureColor; + vec4 DiffuseComponent = vec4(Light.Diffuse, 1.0f) * Diffuse * SampledData.DiffuseTextureColor; + vec4 SpecularComponent = vec4(Light.Specular, 1.0f) * Specular * SampledData.SpecularTextureColor; + + return (AmbientComponent + DiffuseComponent + SpecularComponent); + +} + +vec4 CalculatePointLight(STRUCT_PointLight Light, STRUCT_SampledData SampledData, vec3 Normal, vec3 FragPos, vec3 ViewDirection) { + + vec3 LightDirectionVector ; + if (HasNormals) { + LightDirectionVector = normalize(Object.TBN * Light.Position - Object.TangentFragPos); + } else { + LightDirectionVector = normalize(Light.Position - FragPos); + } + + vec3 ReflectionDirectionVector = reflect(-LightDirectionVector, Normal); + + // Diffuse/Specular Components + float Diffuse = max(dot(Normal, LightDirectionVector), 0.0f); + float Specular = pow(max(dot(ViewDirection, ReflectionDirectionVector), 0.0f), Shinyness); + + // Attenuate + float Distance = length(Light.Position - FragPos); + float Attenuation = 1.0f / (Light.ConstantRolloff + Light.LinearRolloff * Distance + Light.QuadraticRolloff * (Distance * Diffuse)); + + // Calculate Total Contribution From Components + vec4 AmbientComponent = vec4(Light.Ambient * Attenuation, 1.0f) * SampledData.DiffuseTextureColor; + vec4 DiffuseComponent = vec4(Light.Diffuse * Attenuation, 1.0f) * Diffuse * SampledData.DiffuseTextureColor; + vec4 SpecularComponent = vec4(Light.Specular * Attenuation, 1.0f) * Specular * SampledData.SpecularTextureColor; + + return (AmbientComponent + DiffuseComponent + SpecularComponent); + +} + +vec4 CalculateSpotLight(STRUCT_SpotLight Light, STRUCT_SampledData SampledData, vec3 Normal, vec3 FragPos, vec3 ViewDirection) { + + vec3 LightDirectionVector ; + if (HasNormals) { + LightDirectionVector = normalize(Object.TBN * Light.Position - Object.TangentFragPos); + } else { + LightDirectionVector = normalize(Light.Position - FragPos); + } + vec3 ReflectionDirectionVector = reflect(-LightDirectionVector, Normal); + + // Diffuse/Specular Components + float Diffuse = max(dot(Normal, LightDirectionVector), 0.0f); + float Specular = pow(max(dot(ViewDirection, ReflectionDirectionVector), 0.0f), Shinyness); + + // Calculate Attenuation + float Distance = length(Light.Position - FragPos); + float Attenuation = 1.0f / (Light.ConstantRolloff + Light.LinearRolloff * Distance + Light.QuadraticRolloff * (Distance * Diffuse)); + + // Calculate Spot Intensity + float Theta = dot(normalize(Light.Position - FragPos), normalize(-Light.Direction)); + float Epsilon = Light.CutOff - Light.OuterCutOff; + float Intensity = clamp((Theta - Light.OuterCutOff) / Epsilon, 0.0f, 1.0f); + + // Calculate Total Contribution From Components + vec4 AmbientComponent = vec4(Light.Ambient * Attenuation * Intensity, 1.0f) * SampledData.DiffuseTextureColor; + vec4 DiffuseComponent = vec4(Light.Diffuse * Attenuation * Intensity, 1.0f) * Diffuse * SampledData.DiffuseTextureColor; + vec4 SpecularComponent = vec4(Light.Specular * Attenuation * Intensity, 1.0f) * Specular * SampledData.SpecularTextureColor; + + return (AmbientComponent + DiffuseComponent + SpecularComponent); + +} + + + + + + + + + + + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10038.ERS b/Source/EditorAssets/Projects/NewProject/10038.ERS new file mode 100644 index 0000000000..48860e51a5 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10038.ERS @@ -0,0 +1,50 @@ +#version 400 + +layout (location = 0) in vec4 aPos; +layout (location = 2) in vec3 aTexCoords; + +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; +uniform vec3 BillboardPosition; +uniform float BillboardSize; + +out vec3 UV; +out vec3 OriginalPosition; + + +void main() +{ + + vec3 CameraRight = vec3(view[0][0], view[1][0], view[2][0]); + vec3 CameraUp = vec3(view[0][1], view[1][1], view[2][1]); + + vec3 VP = BillboardPosition + + CameraRight * aPos.x * BillboardSize + + CameraUp * aPos.y * BillboardSize; + + gl_Position = projection * view * vec4(VP, 1.0f); + + UV = aTexCoords; + OriginalPosition = vec3(aPos.xyz); +} + + + + + + + + + + + + + + + + + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10039.ERS b/Source/EditorAssets/Projects/NewProject/10039.ERS new file mode 100644 index 0000000000..8b040acba1 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10039.ERS @@ -0,0 +1,25 @@ +#version 400 + +// Set IO +out vec4 FragColor; +in vec3 UV; +in vec3 OriginalPosition; + +// Get Configuration Params +uniform sampler2D IconTexture; +uniform vec3 CameraPosition; + + + + +void main(void) +{ + + + FragColor = texture(IconTexture, vec2(UV)); + +} + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10040.ERS b/Source/EditorAssets/Projects/NewProject/10040.ERS new file mode 100644 index 0000000000..a7604b2c1f --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10040.ERS @@ -0,0 +1,77 @@ +#version 330 core + +// Set Inputs +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aNormal; +layout (location = 2) in vec2 aTexCoords; +layout (location = 3) in vec3 aTangent; +layout (location = 4) in vec3 aBitangent; + +// Set Outputs +out VS_OUT { + vec3 FragPos; + vec2 TexCoords; + mat3 TBN; + vec3 WorldPos; + vec3 TangentViewPos; + vec3 TangentFragPos; + vec3 Normal; // Used when no normal map is available; + + //vec4 FragPosLightSpace; +} Object; + + + +// Get Metadata Params +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame +uniform int FrameNumber; // Number of the frame, counts up from zero +uniform vec2 ViewportRes; // XY Resolution of the viewport + +// Get Mesh Info +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +uniform mat4 LightSpaceMatrix; + +// Get Camera Info +uniform vec3 CameraPosition; + +// Get Normal Info +uniform bool HasNormals; + +void main() +{ + Object.FragPos = vec3(model * vec4(aPos, 1.0)); + Object.TexCoords = aTexCoords; + + mat3 NormalMatrix = transpose(inverse(mat3(model))); + vec3 T = normalize(NormalMatrix * aTangent); + vec3 N = normalize(NormalMatrix * aNormal); + T = normalize(T - dot(T, N) * N); + vec3 B = cross(N, T); + + mat3 TBN = transpose(mat3(T, B, N)); + Object.TBN = TBN; + Object.TangentViewPos = TBN * CameraPosition; + Object.TangentFragPos = TBN * Object.FragPos; + Object.Normal = mat3(model) * aNormal; // mat3(transpose(inverse(model))) * aNormal; + Object.WorldPos = vec3(model*vec4(aPos, 1.0f)); + //Object.FragPosLightSpace = LightSpaceMatrix * vec4(Object.FragPos, 1.0f); + gl_Position = projection * view * vec4(Object.WorldPos, 1.0f); + +} + + + + + + + + + + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10041.ERS b/Source/EditorAssets/Projects/NewProject/10041.ERS new file mode 100644 index 0000000000..cbf6a209ef --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10041.ERS @@ -0,0 +1,873 @@ +#version 420 core + +// Set Outputs +out vec4 FragColor; + +// Set Inputs +in VS_OUT { + vec3 FragPos; + vec2 TexCoords; + mat3 TBN; + vec3 WorldPos; + vec3 TangentViewPos; + vec3 TangentFragPos; + vec3 Normal; // Used when normal texture not present + + //vec4 FragPosLightSpace; +} Object; + +// Define Structs +struct STRUCT_DirectionalLight { + + vec3 Direction; + + // Light Color Parameters + vec3 Color; + float Intensity; + float MaxDistance; + int DepthMapIndex; + mat4 LightSpaceMatrix; + + bool CastsShadows; + +}; + +struct STRUCT_PointLight { + + // Physical Parameters + vec3 Position; + + // Light Color Parameters + vec3 Color; + + // Light Rolloff Parameters + float Intensity; + float MaxDistance; + + int DepthCubemapIndex; + + bool CastsShadows; + +}; + +struct STRUCT_SpotLight { + + // Physical Parameters + vec3 Position; + vec3 Direction; + + // Light Color Parameters + vec3 Color; + + // Light Rolloff Parameters + float Intensity; + float MaxDistance; + + // Spotlight Parameters + float CutOff; + float RollOff; + + int DepthMapIndex; + mat4 LightSpaceMatrix; + + bool CastsShadows; + +}; + +struct STRUCT_SampledData { + + vec4 Albedo; + vec3 Normal; + vec3 Emissive; + float Metallic; + float Roughness; + float AO; + +}; + + + + + +// Get Metadata Params +uniform int FrameNumber; // Number of the frame, counts up from zero + +uniform float Time; // Time since program started in seconds +uniform float FrameTime; // Render Time Of The Frame + +uniform vec2 ViewportRes; // XY Resolution of the viewport +uniform vec3 CameraPosition; // Get Camera XYZ Position + + + +// Get Texture Info +uniform sampler2D texture_diffuse1; +uniform sampler2D texture_normals1; +uniform sampler2D texture_shininess1; +uniform sampler2D texture_emissive1; +uniform sampler2D texture_metalness1; +uniform sampler2D texture_ambient_occlusion1; +uniform sampler2DArray DepthMapArray; +uniform samplerCubeArray DepthMapCubeArray; + +uniform bool HasAmbientOcclusion; +uniform bool HasDiffuse; +uniform bool HasDisplacement; +uniform bool HasEmissive; +uniform bool HasMetalness; +uniform bool HasNormals; +uniform bool HasShininess; + + +// Get Shadow Configuration Information +uniform bool ReceiveShadows_; +uniform int ShadowFilterType_; +uniform int ShadowFilterKernelSize_; + +// Get Lighting Info +uniform int NumberDirectionalLights; +uniform int NumberPointLights; +uniform int NumberSpotLights; +uniform STRUCT_DirectionalLight DirectionalLights[2]; +uniform STRUCT_PointLight PointLights[42]; +uniform STRUCT_SpotLight SpotLights[56]; + +// Gamma Correction Info +uniform bool GammaCorrectionEnabled_; +uniform bool HDREnabled_; +uniform float Exposure_; +uniform float Gamma_; + +const float PI = 3.14159265358979; + +vec2 PoissonDisk[16] = vec2[]( +vec2( -0.94201624, -0.39906216 ), +vec2( 0.94558609, -0.76890725 ), +vec2( -0.094184101, -0.92938870 ), +vec2( 0.34495938, 0.29387760 ), +vec2( -0.91588581, 0.45771432 ), +vec2( -0.81544232, -0.87912464 ), +vec2( -0.38277543, 0.27676845 ), +vec2( 0.97484398, 0.75648379 ), +vec2( 0.44323325, -0.97511554 ), +vec2( 0.53742981, -0.47373420 ), +vec2( -0.26496911, -0.41893023 ), +vec2( 0.79197514, 0.19090188 ), +vec2( -0.24188840, 0.99706507 ), +vec2( -0.81409955, 0.91437590 ), +vec2( 0.19984126, 0.78641367 ), +vec2( 0.14383161, -0.14100790 ) +); + +vec3 Poisson3D[16] = vec3[] ( +vec3(0.7439873218536399, -0.541186283808202, 0.17664264608175007), +vec3(-0.275775456801057, -0.32272001542150996, 0.68133261147887), +vec3(0.44897621078416994, -0.467917730100453, -0.659653108566999), +vec3(-0.847784673329443, 0.028283810708670032, -0.400656977668405), +vec3(-0.727825771085918, -0.283869738690555, 0.08675202075392008), +vec3(-0.452855029609054, 0.66060589626431, 0.7711005629971599), +vec3(0.61847387859598, -0.33074145298451196, 0.51381932664663), +vec3(0.35371939232573, 0.3825031747110199, -0.18291005725040999), +vec3(0.08679201826453009, 0.61422011069953, -0.5682788607664411), +vec3(-0.733357671182603, 0.78749090107158, 0.42277105059474995), +vec3(0.58986698603258, -0.422245749272406, 0.42315440950914995), +vec3(-0.081056734547019, -0.26176304789259996, 0.33600588003173004), +vec3(-0.158656360581517, -0.436631633434445, 0.09938938915729989), +vec3(-0.534419173840433, 0.81530744861811, 0.26251380564645), +vec3(0.7347787003964199, -0.17376213055103995, -0.05371918901801098), +vec3(0.59472335595638, 0.43984056729822996, -0.564682560041547) +); + +vec3 SampleOffsetDirections[20] = vec3[] +( + vec3( 1, 1, 1), vec3( 1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), + vec3( 1, 1, -1), vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), + vec3( 1, 1, 0), vec3( 1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0), + vec3( 1, 0, 1), vec3(-1, 0, 1), vec3( 1, 0, -1), vec3(-1, 0, -1), + vec3( 0, 1, 1), vec3( 0, -1, 1), vec3( 0, -1, -1), vec3( 0, 1, -1) +); + +float random(vec3 seed, int i){ + vec4 seed4 = vec4(seed,i); + float dot_product = dot(seed4, vec4(1.9898,7.233,4.164,9.673)); + return fract(sin(dot_product) * 43758.5453); +} + + +float PCFSampler(float Bias, vec3 ProjCoords, int Index, float CurrentDepth, int SampleSize) { + + float shadow = 0.0; + vec2 texelSize = 1.0 / textureSize(DepthMapArray, 0).xy; + for(int x = -SampleSize; x <= SampleSize; ++x) + { + for(int y = -SampleSize; y <= SampleSize; ++y) + { + vec2 TexCoords2D = ProjCoords.xy + (vec2(x, y) * texelSize); + float pcfDepth = texture(DepthMapArray, vec3(TexCoords2D, Index)).r; + shadow += CurrentDepth - Bias > pcfDepth ? 1.0 : 0.0; + } + } + shadow /= (SampleSize*2)*(SampleSize*2); + + return shadow; + +} + +float PCFSamplerCubemap(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, float ViewDistance, int SampleSize) { + + float shadow = 0.0; + + int samples = SampleSize*SampleSize; + float diskRadius = 0.01f;//(1.0 + (viewDistance / far_plane)) / 25.0; + for(int i = 0; i < samples; ++i) + { + float closestDepth = texture(DepthMapCubeArray, vec4(TexCoords3D + SampleOffsetDirections[i] * diskRadius, Index)).r; + closestDepth *= ViewDistance; // undo mapping [0;1] + if(BiasedCurrentDepth > closestDepth) + shadow += 1.0; + } + shadow /= float(samples); + + return shadow; +} + + +float PoissonSampler(float Bias, vec3 ProjCoords, int Index, float CurrentDepth, int SampleSize) { + + float shadow = 0.0f; + vec2 texelSize = 1.0f / textureSize(DepthMapArray, 0).xy; + + for(int x = -SampleSize; x <= SampleSize; ++x) + { + for(int y = -SampleSize; y <= SampleSize; ++y) + { + vec2 TexCoords2D = ProjCoords.xy + (vec2(x, y) * texelSize); + int index = int(x*y)%16; + float pcfDepth = texture(DepthMapArray, vec3(TexCoords2D + PoissonDisk[index]/700.0f, Index)).r; + shadow += CurrentDepth - Bias > pcfDepth ? 1.0f : 0.0f; + } + } + shadow /= (SampleSize*2)*(SampleSize*2); + return shadow; + +} + +float PoissonSamplerCube(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, float ViewDistance, int SampleSize) { + + float shadow = 0.0; + + int samples = SampleSize*SampleSize; + + + for(int i = 0; i < samples; ++i) + { + + vec3 PoissonOffset = vec3(Poisson3D[i%16]/150.0f); + float closestDepth = texture(DepthMapCubeArray, vec4(TexCoords3D + PoissonOffset, Index)).r; + closestDepth *= ViewDistance; // undo mapping [0;1] + if(BiasedCurrentDepth > closestDepth) + shadow += 1.0; + } + shadow /= float(samples); + + + return shadow; + +} + + +float StratifiedPoissonSampler(float Bias, vec3 ProjCoords, int Index, float CurrentDepth, int SampleSize) { + float shadow = 0.0f; + vec2 texelSize = 1.0f / textureSize(DepthMapArray, 0).xy; + + for(int x = -SampleSize; x <= SampleSize; ++x) + { + for(int y = -SampleSize; y <= SampleSize; ++y) + { + + vec2 TexCoords2D = ProjCoords.xy + (vec2(x, y) * texelSize); + + int index = int(6.0f*random(floor(gl_FragCoord.yxz*1000.0f), int(ProjCoords.x*ProjCoords.y))); + float pcfDepth = texture(DepthMapArray, vec3(TexCoords2D + PoissonDisk[index]/1000.0f, Index)).r; + //pcfDepth = texture(DepthMapArray, vec3(TexCoords2D, Index)).r; + shadow += CurrentDepth - Bias > pcfDepth ? 1.0f : 0.0f; + } + } + shadow /= (SampleSize*2)*(SampleSize*2); + return shadow; +} + + +float StratifiedPoissonSamplerCube(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, float ViewDistance, int SampleSize) { + + float shadow = 0.0; + + int samples = SampleSize*SampleSize; + for(int i = 0; i < samples; ++i) + { + int PoissonIndex = int(6.0f*random(floor(gl_FragCoord.yxz*1000.0f), int(i)))%16; + vec3 PoissonOffset = vec3(Poisson3D[PoissonIndex]/250.0f); + float closestDepth = texture(DepthMapCubeArray, vec4(TexCoords3D + PoissonOffset, Index)).r; + closestDepth *= ViewDistance; // undo mapping [0;1] + if(BiasedCurrentDepth > closestDepth) + shadow += 1.0; + } + shadow /= float(samples); + + + return shadow; + + +} + + +float ShadowCalculation(STRUCT_PointLight Light) +{ + + // If Shadows Are Not Enabled, Exit Early + if (!ReceiveShadows_ || !Light.CastsShadows) { + return 1.0f; + } + + // get vector between fragment position and light position + vec3 fragToLight = Object.FragPos - Light.Position; + + // ise the fragment to light vector to sample from the depth map + float closestDepth = texture(DepthMapCubeArray, vec4(fragToLight, Light.DepthCubemapIndex)).r; + // it is currently in linear range between [0,1], let's re-transform it back to original depth value + closestDepth *= Light.MaxDistance; + // now get current linear depth as the length between the fragment and light position + float currentDepth = length(fragToLight); + // test for shadows + + // Generate Shadow Map Bias + int TextureSize = textureSize(DepthMapCubeArray, 0).x; + float BiasMax = 0.005f; + if (TextureSize <= 512) { + BiasMax = 0.075; + } else if (TextureSize <= 1024) { + BiasMax = 0.05; + } else if (TextureSize <= 2048) { + BiasMax = 0.03; + } else if (TextureSize <= 4096) { + BiasMax = 0.02; + } else if (TextureSize <= 8192) { + BiasMax = 0.015; + } else if (TextureSize <= 16384) { + BiasMax = 0.01; + } + + float Bias = max(0.00 * (1.0 - dot(Object.Normal, normalize(fragToLight))), BiasMax); + + + // Select Correct Filter Based On Selection Uniform + float Shadow; + if (ShadowFilterType_ == 0) { // No Filtering + Shadow = currentDepth - Bias > closestDepth ? 1.0 : 0.0; + } else if (ShadowFilterType_ == 1) { // PCF Filtering + Shadow = PCFSamplerCubemap(currentDepth-Bias, fragToLight, Light.DepthCubemapIndex, Light.MaxDistance, ShadowFilterKernelSize_); + } else if (ShadowFilterType_ == 2) { // Poisson Filtering + Shadow = PoissonSamplerCube(currentDepth-Bias, fragToLight, Light.DepthCubemapIndex, Light.MaxDistance, ShadowFilterKernelSize_); + } else if (ShadowFilterType_ == 3) { + Shadow = StratifiedPoissonSamplerCube(currentDepth-Bias, fragToLight, Light.DepthCubemapIndex, Light.MaxDistance, ShadowFilterKernelSize_); + } else { + return 0.0f; // Return Failure, All Black) + } + + // display closestDepth as debug (to visualize depth cubemap) + // FragColor = vec4(vec3(closestDepth / Light.MaxDistance), 1.0); + + return 1.0f - Shadow; +} + +float ShadowCalculation(STRUCT_DirectionalLight Light) +{ + + // ., Light.Direction, Light.DepthMapIndex + + // If Shadows Are Not Enabled, Exit Early + if (!ReceiveShadows_ || !Light.CastsShadows) { + return 1.0f; + } + + + vec4 fragPosLightSpace = Light.LightSpaceMatrix * vec4(Object.FragPos, 1.0f); + + // perform perspective divide + vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w; + // transform to [0,1] range + projCoords = projCoords * 0.5f + 0.5; + + // get closest depth value from light's perspective (using [0,1] range fragPosLight as coords) + float closestDepth = texture(DepthMapArray, vec3(projCoords.xy, Light.DepthMapIndex)).r; + // get depth of current fragment from light's perspective + float currentDepth = projCoords.z; + // check whether current frag pos is in shadow + //vec3 LightDir = normalize(L - Object.FragPos); + + float Bias = max(0.00 * (1.0 - dot(Object.Normal, Light.Direction)), 0.0025); + + //float Shadow = currentDepth - Bias > closestDepth ? 1.0 : 0.0; + float Shadow = PCFSampler(Bias, projCoords, Light.DepthMapIndex, currentDepth, 2); + //float Shadow = ShadowPCFRandom(Bias, projCoords, Index, currentDepth, 1); + + if (projCoords.z > 1.0) { + Shadow = 0.0f; + } + + if (Shadow > 1.0f) { + Shadow = 1.0f; + } else if (Shadow < 0.0f) { + Shadow = 0.0f; + } + + + return 1.0f - Shadow; +} + + +float ShadowCalculation(STRUCT_SpotLight Light) +{ + + // If Shadows Are Not Enabled, Exit Early + if (!ReceiveShadows_ || !Light.CastsShadows) { + return 1.0f; + } + + + vec4 fragPosLightSpace = Light.LightSpaceMatrix * vec4(Object.FragPos, 1.0f); + + // perform perspective divide + vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w; + // transform to [0,1] range + projCoords = projCoords * 0.5f + 0.5; + + // get closest depth value from light's perspective (using [0,1] range fragPosLight as coords) + float closestDepth = texture(DepthMapArray, vec3(projCoords.xy, Light.DepthMapIndex)).r; + // get depth of current fragment from light's perspective + float currentDepth = projCoords.z; + // check whether current frag pos is in shadow + vec3 LightDir = normalize(Light.Position - Object.FragPos); + + + // Generate Shadow Map Bias + int TextureSize = textureSize(DepthMapArray, 0).x; + float BiasMax = 0.0005f; + if (TextureSize <= 512) { + BiasMax = 0.003; + } else if (TextureSize <= 1024) { + BiasMax = 0.0015; + } else if (TextureSize <= 2048) { + BiasMax = 0.001; + } else if (TextureSize <= 4096) { + BiasMax = 0.00075; + } else if (TextureSize <= 8192) { + BiasMax = 0.00045; + } else if (TextureSize <= 16384) { + BiasMax = 0.00025; + } + + float Bias = max(0.00 * (1.0 - dot(Object.Normal, LightDir)), BiasMax);//0.00225); + + + // Select Correct Filter Based On Selection Uniform + float Shadow; + if (ShadowFilterType_ == 0) { // No Filtering + Shadow = currentDepth - Bias > closestDepth ? 1.0 : 0.0; + } else if (ShadowFilterType_ == 1) { // PCF Filtering + Shadow = PCFSampler(Bias, projCoords, Light.DepthMapIndex, currentDepth, ShadowFilterKernelSize_); + } else if (ShadowFilterType_ == 2) { // Poisson Filtering + Shadow = PoissonSampler(Bias, projCoords, Light.DepthMapIndex, currentDepth, ShadowFilterKernelSize_); + } else if (ShadowFilterType_ == 3) { + Shadow = StratifiedPoissonSampler(Bias, projCoords, Light.DepthMapIndex, currentDepth, ShadowFilterKernelSize_); + } else { + return 0.0f; // Return Failure, All Black) + } + + if (projCoords.z > 1.0) { + Shadow = 0.0f; + } + + if (Shadow > 1.0f) { + Shadow = 1.0f; + } else if (Shadow < 0.0f) { + Shadow = 0.0f; + } + + + return 1.0f - Shadow; +} + + + + + + +vec3 GetNormalFromMap(sampler2D Normal) { + + // Ensure That Textures Are Present/Valid, If Not, Provide Fallback + vec3 SampledColor = texture(Normal, Object.TexCoords).xyz; + if (!HasNormals || (SampledColor == vec3(0.0f))) { + SampledColor = vec3(0.5f, 0.5f, 1.0f); + } + + // Use Texture Data To Calculate Normal Data + vec3 TangentNormal = SampledColor * 2.0f - 1.0f; + + vec3 Q1 = dFdx(Object.WorldPos); + vec3 Q2 = dFdy(Object.WorldPos); + vec2 st1 = dFdx(Object.TexCoords); + vec2 st2 = dFdy(Object.TexCoords); + + vec3 N = normalize(Object.Normal); + vec3 T = normalize(Q1*st2.t - Q2*st1.t); + vec3 B = -normalize(cross(N, T)); + mat3 TBN = mat3(T,B,N); + + return normalize(TBN * TangentNormal); +} + + +float DistributionGGX(vec3 N, vec3 H, float Roughness) { + + float a = Roughness*Roughness; + float a2 = a*a; + float NdotH = max(dot(N,H), 0.0f); + float NdotH2 = NdotH*NdotH; + + float nom = a2; + float denom = (NdotH2 * (a2 - 1.0f) + 1.0f); + + return nom / denom; + +} +// ---------------------------------------------------------------------------- +float GeometrySchlickGGX(float NdotV, float roughness) +{ + float r = (roughness + 1.0); + float k = (r*r) / 8.0; + + float nom = NdotV; + float denom = NdotV * (1.0 - k) + k; + + return nom / denom; +} +// ---------------------------------------------------------------------------- +float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness) +{ + float NdotV = max(dot(N, V), 0.0); + float NdotL = max(dot(N, L), 0.0); + float ggx2 = GeometrySchlickGGX(NdotV, roughness); + float ggx1 = GeometrySchlickGGX(NdotL, roughness); + + return ggx1 * ggx2; +} +// ---------------------------------------------------------------------------- +vec3 FresnelSchlick(float cosTheta, vec3 F0) +{ + return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0); +} +// ---------------------------------------------------------------------------- + + + + + + +// Used To Enable Gamma Correction On The Output +vec4 GammaCorrectResult(vec4 Input, bool GammaEnabled) { + if (GammaEnabled) { + Input.rgb = pow(Input.rgb, vec3(1.0/Gamma_)); + } + return Input; +} + + +// Used To Make Sure Textures Aren't Too Bright +vec4 GammaCorrectTexture(sampler2D Texture, bool GammaEnabled) { + vec4 Color = texture(Texture, Object.TexCoords); + if (GammaEnabled) { + Color.rgb = pow(Color.rgb, vec3(Gamma_)); + } + return Color; +} + + + + +STRUCT_SampledData SetSampledData() { + STRUCT_SampledData SampledData; + + // Handle Albedo/Diffuse Textures + SampledData.Albedo = GammaCorrectTexture(texture_diffuse1, GammaCorrectionEnabled_); + + // Handle Metalness Textures + if (HasMetalness) { + SampledData.Metallic = texture(texture_metalness1, Object.TexCoords).r; + } else { + SampledData.Metallic = 0.0f; + } + + // Handle Normal Textures + if (HasNormals) { + SampledData.Normal = GetNormalFromMap(texture_normals1); + } else { + SampledData.Normal = vec3(0.5f, 0.5f, 1.0f); + } + + // Handle Shininess (Inverse Of Roughness) + if (HasShininess) { + SampledData.Roughness = texture(texture_shininess1, Object.TexCoords).r; + + } else { + SampledData.Roughness = 0.5f; + } + + // Handle Emissive Textures + if (HasEmissive) { + SampledData.Emissive = GammaCorrectTexture(texture_emissive1, GammaCorrectionEnabled_).rgb; + } else { + SampledData.Emissive = vec3(0.0f); + } + + + return SampledData; + +} + + + + + + +vec3 PBRPointLight(STRUCT_PointLight Light, vec3 ViewDir, vec3 Reflectance, STRUCT_SampledData Model) { + + // calculate per-light radiance + vec3 L = normalize(Light.Position - Object.WorldPos); + vec3 H = normalize(ViewDir + L); + float distance = length(Light.Position - Object.WorldPos); + float attenuation = 1.0 / (distance * distance); + vec3 radiance = Light.Color * Light.Intensity * attenuation; + + // Cook-Torrance BRDF + float NDF = DistributionGGX(Model.Normal, H, Model.Roughness); + float G = GeometrySmith(Model.Normal, ViewDir, L, Model.Roughness); + vec3 F = FresnelSchlick(max(dot(H, ViewDir), 0.0), Reflectance); + + vec3 numerator = NDF * G * F; + float denominator = 4.0 * max(dot(Model.Normal, ViewDir), 0.0) * max(dot(Model.Normal, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero + vec3 specular = numerator / denominator; + + // kS is equal to Fresnel + vec3 kS = F; + // for energy conservation, the diffuse and specular light can't + // be above 1.0 (unless the surface emits light); to preserve this + // relationship the diffuse component (kD) should equal 1.0 - kS. + vec3 kD = vec3(1.0) - kS; + // multiply kD by the inverse metalness such that only non-metals + // have diffuse lighting, or a linear blend if partly metal (pure metals + // have no diffuse light). + kD *= 1.0 - Model.Metallic; + + // scale light by NdotL + float NdotL = max(dot(Model.Normal, L), 0.0); + + // add to outgoing radiance Lo + return ((kD * Model.Albedo.rgb / PI + specular) * radiance * NdotL) * ShadowCalculation(Light); // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again + + +} + + +vec3 PBRSpotLight(STRUCT_SpotLight Light, vec3 ViewDir, vec3 Reflectance, STRUCT_SampledData Model) { + + vec3 LightDirectionVector ; + if (HasNormals) { + LightDirectionVector = normalize(Object.TBN * Light.Position - Object.TangentFragPos); + } else { + LightDirectionVector = normalize(Light.Position - Object.FragPos); + } + vec3 ReflectionDirectionVector = reflect(-LightDirectionVector, Object.Normal); + + // Calculate Spot Intensity + float Theta = dot(normalize(Light.Position - Object.FragPos), normalize(-Light.Direction)); + float Epsilon = (Light.RollOff); + float Intensity = clamp((Theta - Light.CutOff) / Epsilon, 0.0f, 1.0f); + + if (GammaCorrectionEnabled_) { + Intensity = pow(Intensity, Gamma_*Gamma_); + } + + // calculate per-light radiance + vec3 L = normalize(Light.Position - Object.WorldPos); + vec3 H = normalize(ViewDir + L); + float LightDistance = length(Light.Position - Object.WorldPos); + float attenuation = 1.0 / (LightDistance * LightDistance); + vec3 radiance = Light.Color * Light.Intensity * attenuation; + + // Cook-Torrance BRDF + float NDF = DistributionGGX(Model.Normal, H, Model.Roughness); + float G = GeometrySmith(Model.Normal, ViewDir, L, Model.Roughness); + vec3 F = FresnelSchlick(max(dot(H, ViewDir), 0.0), Reflectance); + + vec3 numerator = NDF * G * F; + float denominator = 4.0 * max(dot(Model.Normal, ViewDir), 0.0) * max(dot(Model.Normal, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero + vec3 specular = numerator / denominator; + + // kS is equal to Fresnel + vec3 kS = F; + // for energy conservation, the diffuse and specular light can't + // be above 1.0 (unless the surface emits light); to preserve this + // relationship the diffuse component (kD) should equal 1.0 - kS. + vec3 kD = vec3(1.0) - kS; + // multiply kD by the inverse metalness such that only non-metals + // have diffuse lighting, or a linear blend if partly metal (pure metals + // have no diffuse light). + kD *= 1.0 - Model.Metallic; + + // scale light by NdotL + float NdotL = max(dot(Model.Normal, L), 0.0); + + // Check Distance, And Roll Off According To Max Distance + float DistanceToEnd = Light.MaxDistance - LightDistance; + if (DistanceToEnd < 1.0f) { + Intensity = clamp(Intensity * (DistanceToEnd), 0.0f, 1.0f); + } + + // add to outgoing radiance Lo + return ((kD * Model.Albedo.rgb / PI + specular) * radiance * NdotL * Intensity) * ShadowCalculation(Light); // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again + +} + + +vec3 PBRDirectionalLight(STRUCT_DirectionalLight Light, vec3 ViewDir, vec3 Reflectance, STRUCT_SampledData Model) { + + vec3 LightDirectionVector = normalize(-Light.Direction); + vec3 ReflectionDirectionVector = reflect(-LightDirectionVector, Model.Normal); + + // Diffuse/Specular Components + float Diffuse = max(dot(Model.Normal, LightDirectionVector), 0.0f); + float Specular = pow(max(dot(ViewDir, ReflectionDirectionVector), 0.0f), Model.Roughness); + + // calculate per-light radiance + vec3 L = normalize(Light.Direction); + vec3 H = normalize(ViewDir + L); + vec3 radiance = Light.Color * Light.Intensity; + + // Cook-Torrance BRDF + float NDF = DistributionGGX(Model.Normal, H, Model.Roughness); + float G = GeometrySmith(Model.Normal, ViewDir, L, Model.Roughness); + vec3 F = FresnelSchlick(max(dot(H, ViewDir), 0.0), Reflectance); + + vec3 numerator = NDF * G * F; + float denominator = 4.0 * max(dot(Model.Normal, ViewDir), 0.0) * max(dot(Model.Normal, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero + vec3 specular = numerator / denominator; + + // kS is equal to Fresnel + vec3 kS = F; + // for energy conservation, the diffuse and specular light can't + // be above 1.0 (unless the surface emits light); to preserve this + // relationship the diffuse component (kD) should equal 1.0 - kS. + vec3 kD = vec3(1.0) - kS; + // multiply kD by the inverse metalness such that only non-metals + // have diffuse lighting, or a linear blend if partly metal (pure metals + // have no diffuse light). + kD *= 1.0 - Model.Metallic; + + // scale light by NdotL + float NdotL = max(dot(Model.Normal, L), 0.0); + + // add to outgoing radiance Lo + return ((kD * Model.Albedo.rgb / PI + specular) * radiance * NdotL) * ShadowCalculation(Light); // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again + + +} + + +void main() { + + // Get Model Parameters + STRUCT_SampledData Model = SetSampledData(); + vec3 ViewDir = normalize(CameraPosition - Object.WorldPos); + + // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 + // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) + vec3 Reflectance = vec3(0.04); + Reflectance = mix(Reflectance, Model.Albedo.rgb, Model.Metallic); + + + // ---- Calculate Lighting Contributions ---- // + vec3 Lo = vec3(0.0f); + + // Calculate Directional Lights + for (int i = 0; i < NumberDirectionalLights; i++) { + Lo += PBRDirectionalLight(DirectionalLights[i], ViewDir, Reflectance, Model); + } + + // Calculate Point Lights + for (int i = 0; i < NumberPointLights; i++) { + Lo += PBRPointLight(PointLights[i], ViewDir, Reflectance, Model);// * ShadowCalculation(PointLights[i].LightSpaceMatrix, PointLights[i].Position, PointLights[i].DepthMapIndex); + } + + // Calculate Spot Lights + for(int i = 0; i < NumberSpotLights; ++i) { + Lo += PBRSpotLight(SpotLights[i], ViewDir, Reflectance, Model); + } + + // ambient lighting (note that the next IBL tutorial will replace + // this ambient lighting with environment lighting). + vec4 Ambient = vec4(0.03) * Model.Albedo * Model.AO; + vec4 Color = Ambient + vec4(Lo, Model.Albedo.a); + + + // Add Emissive Texture + if (HasEmissive) { + Color.rgb += Model.Emissive; + } + + // Apply Gamma Correction + if (HDREnabled_) { + vec3 Mapped = vec3(1.0f) - exp(-Color.xyz * Exposure_); + FragColor = GammaCorrectResult(vec4(Mapped, 1.0f), GammaCorrectionEnabled_); + } else { + FragColor = GammaCorrectResult(Color, GammaCorrectionEnabled_); + } + + + + //FragColor = vec4(vec3(1.0f - ShadowCalculation(Object.FragPosLightSpace, DirectionalLights[0].Direction)), 1.0f); +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/EditorAssets/Projects/NewProject/10042.ERS b/Source/EditorAssets/Projects/NewProject/10042.ERS new file mode 100644 index 0000000000..5bd2733cc9 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10042.ERS @@ -0,0 +1,10 @@ +#version 330 core +layout (location = 0) in vec3 aPos; + +uniform mat4 LightSpaceMatrix; +uniform mat4 model; + +void main() +{ + gl_Position = LightSpaceMatrix * model * vec4(aPos, 1.0); +} diff --git a/Source/EditorAssets/Projects/NewProject/10043.ERS b/Source/EditorAssets/Projects/NewProject/10043.ERS new file mode 100644 index 0000000000..0ba553608d --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10043.ERS @@ -0,0 +1,6 @@ +#version 330 core + +void main() +{ + // gl_FragDepth = gl_FragCoord.z; +} diff --git a/Source/EditorAssets/Projects/NewProject/10044.ERS b/Source/EditorAssets/Projects/NewProject/10044.ERS new file mode 100644 index 0000000000..75faf93587 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10044.ERS @@ -0,0 +1,36 @@ +#version 330 core +layout (location = 0) in vec3 aPos; + +uniform mat4 model; + +void main() +{ + gl_Position = model * vec4(aPos, 1.0); +} + + + +/** + +Fix For Transparency (Andrei Despinoiu) + + + +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 2) in vec2 aTexCoords; + + +out vec2 TexCoordsInitial; + + +uniform mat4 model; + + +void main() +{ + TexCoordsInitial = aTexCoords; + gl_Position = model * vec4(aPos, 1.0); +} +**/ + diff --git a/Source/EditorAssets/Projects/NewProject/10045.ERS b/Source/EditorAssets/Projects/NewProject/10045.ERS new file mode 100644 index 0000000000..26961a2d68 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10045.ERS @@ -0,0 +1,55 @@ +#version 330 core +in vec4 FragPos; + +uniform vec3 LightPos; +uniform float FarPlane; + +void main() +{ + float lightDistance = length(FragPos.xyz - LightPos); + + // map to [0;1] range by dividing by far_plane + lightDistance = lightDistance / FarPlane; + + // write this as modified depth + gl_FragDepth = lightDistance; + +} + + + +/** + +Fix For Transparency (Andrei Despinoiu) + +#version 330 core + + +in vec4 FragPos; +in vec2 TexCoords; + + +uniform vec3 lightPos; +uniform float farPlane; +uniform sampler2D texture1; + + +void main() +{ + // Opacity check + vec4 textureColour = texture(texture1, TexCoords); + if (textureColour.a < 0.5) { + discard; + } + + + // get distance between fragment and light source + float lightDistance = length(FragPos.xyz - lightPos); + // map to [0-1] range by dividing by farPlane + lightDistance = lightDistance / farPlane; + // write this as modified depth + gl_FragDepth = lightDistance; +} + +**/ + diff --git a/Source/EditorAssets/Projects/NewProject/10046.ERS b/Source/EditorAssets/Projects/NewProject/10046.ERS new file mode 100644 index 0000000000..c91e28fb92 --- /dev/null +++ b/Source/EditorAssets/Projects/NewProject/10046.ERS @@ -0,0 +1,62 @@ +#version 330 core +layout (triangles) in; +layout (triangle_strip, max_vertices=18) out; + +uniform mat4 ShadowMatrices[6]; +uniform int ShadowMapLayer; + +out vec4 FragPos; // FragPos from GS (output per emitvertex) + +void main() +{ + for(int face = 0; face < 6; ++face) + { + gl_Layer = (ShadowMapLayer*6) + face; // built-in variable that specifies to which face we render. + for(int i = 0; i < 3; ++i) // for each triangle's vertices + { + FragPos = gl_in[i].gl_Position; + gl_Position = ShadowMatrices[face] * FragPos; + EmitVertex(); + } + EndPrimitive(); + } +} + + + + +/** + +Fix For Transparency (Andrei Despinoiu) + + +#version 330 core +layout (triangles) in; +layout (triangle_strip, max_vertices=18) out; + + +in vec2 TexCoordsInitial[]; // Needs to be declared as an array +out vec2 TexCoords; +out vec4 FragPos; // FragPos from GS (output per emitvertex) + + +uniform mat4 shadowMatrices[6]; + + +void main() +{ + for(int face = 0; face < 6; ++face) + { + gl_Layer = face; // built-in variable that specifies to which face we render + for(int i = 0; i < 3; ++i) // for each triangle's vertices + { + TexCoords = TexCoordsInitial[i]; + FragPos = gl_in[i].gl_Position; + gl_Position = shadowMatrices[face] * FragPos; + EmitVertex(); + } + EndPrimitive(); + } +} + +**/