version 0.60 (#367)
- namespace refactor (example: wiGraphics:: -> wi::graphics) - provided namespace compatibility macro for old user code: WICKEDENGINE_BACKWARDS_COMPATIBILITY_0_59 - resource manager will return `Resource` instead of `shared_ptr<Resource>` objects - MAD shader optimizations - implemented alpha to coverage with alpha tested materials when MSAA is enabled - alpha testing fix with transparent shadow maps - TLAS and scene buffers will be recreated less frequently when things get added/removed from the scene
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#include "wiLoadingScreen.h"
|
||||
#include "wiApplication.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace wi
|
||||
{
|
||||
|
||||
bool LoadingScreen::isActive()
|
||||
{
|
||||
return wi::jobsystem::IsBusy(ctx);
|
||||
}
|
||||
|
||||
void LoadingScreen::addLoadingFunction(std::function<void(wi::jobsystem::JobArgs)> loadingFunction)
|
||||
{
|
||||
if (loadingFunction != nullptr)
|
||||
{
|
||||
tasks.push_back(loadingFunction);
|
||||
}
|
||||
}
|
||||
|
||||
void LoadingScreen::addLoadingComponent(RenderPath* component, Application* main, float fadeSeconds, wi::Color fadeColor)
|
||||
{
|
||||
addLoadingFunction([=](wi::jobsystem::JobArgs args) {
|
||||
component->Load();
|
||||
});
|
||||
onFinished([=] {
|
||||
main->ActivatePath(component, fadeSeconds, fadeColor);
|
||||
});
|
||||
}
|
||||
|
||||
void LoadingScreen::onFinished(std::function<void()> finishFunction)
|
||||
{
|
||||
if (finishFunction != nullptr)
|
||||
finish = finishFunction;
|
||||
}
|
||||
|
||||
void LoadingScreen::Start()
|
||||
{
|
||||
for (auto& x : tasks)
|
||||
{
|
||||
wi::jobsystem::Execute(ctx, x);
|
||||
}
|
||||
std::thread([this]() {
|
||||
wi::jobsystem::Wait(ctx);
|
||||
finish();
|
||||
}).detach();
|
||||
|
||||
RenderPath2D::Start();
|
||||
}
|
||||
|
||||
void LoadingScreen::Stop()
|
||||
{
|
||||
tasks.clear();
|
||||
finish = nullptr;
|
||||
|
||||
RenderPath2D::Stop();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user