2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
|
|
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
|
2017-10-31 21:27:10 +03:00
|
|
|
|
|
|
|
#include "core.h"
|
2022-09-06 08:25:18 +02:00
|
|
|
#include "plain.h"
|
2021-06-06 18:51:21 +02:00
|
|
|
#include "client/shadows/dynamicshadowsrender.h"
|
2022-09-06 08:25:18 +02:00
|
|
|
#include "settings.h"
|
2017-10-31 21:27:10 +03:00
|
|
|
|
2023-05-18 14:34:18 -04:00
|
|
|
RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud,
|
2022-09-06 08:25:18 +02:00
|
|
|
ShadowRenderer *_shadow_renderer, RenderPipeline *_pipeline, v2f _virtual_size_scale)
|
2023-05-18 14:34:18 -04:00
|
|
|
: device(_device), client(_client), hud(_hud), shadow_renderer(_shadow_renderer),
|
2022-09-06 08:25:18 +02:00
|
|
|
pipeline(_pipeline), virtual_size_scale(_virtual_size_scale)
|
2017-10-31 21:27:10 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderingCore::~RenderingCore()
|
|
|
|
{
|
2022-09-06 08:25:18 +02:00
|
|
|
delete pipeline;
|
2021-06-06 18:51:21 +02:00
|
|
|
delete shadow_renderer;
|
2017-10-31 21:27:10 +03:00
|
|
|
}
|
|
|
|
|
2024-02-07 20:13:23 +01:00
|
|
|
void RenderingCore::draw(video::SColor _skycolor, bool _show_hud,
|
2017-10-31 21:27:10 +03:00
|
|
|
bool _draw_wield_tool, bool _draw_crosshair)
|
|
|
|
{
|
2022-09-06 08:25:18 +02:00
|
|
|
v2u32 screensize = device->getVideoDriver()->getScreenSize();
|
|
|
|
virtual_size = v2u32(screensize.X * virtual_size_scale.X, screensize.Y * virtual_size_scale.Y);
|
2021-06-06 18:51:21 +02:00
|
|
|
|
2022-09-06 08:25:18 +02:00
|
|
|
PipelineContext context(device, client, hud, shadow_renderer, _skycolor, screensize);
|
|
|
|
context.draw_crosshair = _draw_crosshair;
|
|
|
|
context.draw_wield_tool = _draw_wield_tool;
|
|
|
|
context.show_hud = _show_hud;
|
2017-10-31 21:27:10 +03:00
|
|
|
|
2022-09-06 08:25:18 +02:00
|
|
|
pipeline->reset(context);
|
|
|
|
pipeline->run(context);
|
2017-10-31 21:27:10 +03:00
|
|
|
}
|
|
|
|
|
2022-09-06 08:25:18 +02:00
|
|
|
v2u32 RenderingCore::getVirtualSize() const
|
2017-10-31 21:27:10 +03:00
|
|
|
{
|
2022-09-06 08:25:18 +02:00
|
|
|
return virtual_size;
|
2024-02-07 20:13:23 +01:00
|
|
|
}
|