-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added possibility to spawn multiple spotlights
- LightSystem to enable flashlight - "flashmode" and "debug render" flags for spotlights - demo scene polishing
- Loading branch information
1 parent
2f836fd
commit 0b6db57
Showing
27 changed files
with
160 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "LightSystem.h" | ||
|
||
#include "Scene/Components/LightComponent.h" | ||
#include "Scene/Components/TransformComponent.h" | ||
#include "Scene/Scene.h" | ||
|
||
#include "Core/Application.h" | ||
#include "Renderer/CameraController.h" | ||
|
||
namespace elv { | ||
void LightSystem::OnUpdate(float dt) | ||
{ | ||
auto spotLightsPool = m_pScene->GetComponentPool<SpotLightComponent>(); | ||
auto& spotLightComponents = spotLightsPool->GetComponents(); | ||
for (std::uint32_t i = 0; i < spotLightsPool->Size(); ++i) { | ||
auto& spotlight = spotLightComponents[i]; | ||
if (!spotlight.enabled) | ||
continue; | ||
|
||
if (spotlight.flashlightMode) { | ||
const auto entity = spotLightsPool->GetEntity(i); | ||
if (m_pScene->HasComponent<TransformComponent>(entity)) { | ||
auto& transform = m_pScene->GetComponent<TransformComponent>(entity); | ||
|
||
const auto cameraController = Application::Get().GetCameraController(); | ||
|
||
transform.pos = cameraController->GetCamera().GetPosition(); | ||
transform.rotation = cameraController->GetFront(); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} // namespace elv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include "Scene/ComponentSystem.h" | ||
|
||
namespace elv { | ||
|
||
class LightSystem : public ecs::IComponentSystem { | ||
public: | ||
void OnUpdate(float dt) override; | ||
}; | ||
|
||
} // namespace elv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Model Information: | ||
* title: Dark Knight | ||
* source: https://sketchfab.com/3d-models/dark-knight-e2208bdc46304f6faa18728778986f35 | ||
* author: Nick Scott (https://sketchfab.com/Nickjjscott) | ||
|
||
Model License: | ||
* license type: CC-BY-NC-4.0 (http://creativecommons.org/licenses/by-nc/4.0/) | ||
* requirements: Author must be credited. No commercial use. | ||
|
||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it: | ||
This work is based on "Dark Knight" (https://sketchfab.com/3d-models/dark-knight-e2208bdc46304f6faa18728778986f35) by Nick Scott (https://sketchfab.com/Nickjjscott) licensed under CC-BY-NC-4.0 (http://creativecommons.org/licenses/by-nc/4.0/) |
Git LFS file not shown
Git LFS file not shown
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.6 MB
Sandbox3D/assets/models/dark_knight/textures/MAT_CLOTH_metallicRoughness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.5 MB
Sandbox3D/assets/models/dark_knight/textures/MAT_METAL_metallicRoughness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.8 MB
Sandbox3D/assets/models/dark_knight/textures/MAT_SWORD_metallicRoughness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.