Draw the client's scene in the renderer process
The adapter records everything the client draws (state, transforms, lights, fog, textures and buffers) as a command stream, sent in chunks through the shared memory channel, while IMVU's Direct3D renderer still draws the whole view. The renderer process draws it with Diligent, with shaders reproducing IMVU's Direct3D 9 fixed-function setup, over the right half of the 3D view to compare. It skips to the newest frame when it falls behind, and logs its errors and frame times. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5c35c8b63a
commit
42fc55cb91
23 files changed
+2121
-472
No files matched your search
+18
-5
@@ -1,12 +1,15 @@
|
||||
// The renderer plugin's entry points, which SceneWindow.dll's createDLLRenderer looks up by name (exported
|
||||
// undecorated by plugin.def). For now the renderer is the pass-through: IMVU's Direct3D engine, wrapped.
|
||||
// undecorated by plugin.def). The engine is the adapter's (engine.hpp): IMVU's Direct3D engine draws, and the
|
||||
// renderer process draws over part of it.
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <exception>
|
||||
#include <string_view>
|
||||
|
||||
#include "log.hpp"
|
||||
#include "passthrough_engine.hpp"
|
||||
#include "engine.hpp"
|
||||
#include "recorder.hpp"
|
||||
#include "renderer_process.hpp"
|
||||
#include "t5de/imvu/render_engine.hpp"
|
||||
|
||||
@@ -30,6 +33,15 @@ imvu::SharedPtr<imvu::PiRenderEngine> create_imvu_engine(imvu::SharedPtr<imvu::I
|
||||
return create(std::move(window), imvu::RendererType::Direct3D);
|
||||
}
|
||||
|
||||
// What the renderer process draws: T5DE_RENDERER_VIEW=off, split (the default: the right half) or full.
|
||||
protocol::View view()
|
||||
{
|
||||
wchar_t value[16] = {};
|
||||
GetEnvironmentVariableW(L"T5DE_RENDERER_VIEW", value, 16);
|
||||
const std::wstring_view setting = value;
|
||||
return setting == L"off" ? protocol::View::Off : setting == L"full" ? protocol::View::Full : protocol::View::Split;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" int __cdecl isRenderEngineSupported() { return 1; }
|
||||
@@ -45,9 +57,10 @@ extern "C" imvu::SharedPtr<imvu::PiRenderEngine> __cdecl createRenderEngine(imvu
|
||||
if (!inner) {
|
||||
return {};
|
||||
}
|
||||
auto renderer = hwnd != nullptr ? RendererProcess::start(hwnd) : nullptr;
|
||||
return imvu::SharedPtr<imvu::PiRenderEngine>(
|
||||
std::make_unique<PassthroughEngine>(std::move(inner), std::move(renderer)));
|
||||
const protocol::View shown = view();
|
||||
auto renderer = hwnd != nullptr && shown != protocol::View::Off ? RendererProcess::start(hwnd, shown) : nullptr;
|
||||
return imvu::SharedPtr<imvu::PiRenderEngine>(std::make_unique<Engine>(
|
||||
std::move(inner), std::make_shared<Recorder>(std::move(renderer))));
|
||||
} catch (const std::exception& e) {
|
||||
// Exceptions mustn't cross into IMVU's code (a different C++ runtime).
|
||||
log::info("createRenderEngine failed: {}", e.what());
|
||||
|
||||
Reference in new issue
Block a user