Compare commits
No commits in common. "bef8baba5f42da6d33d4a25ba9ac2c4588edd0b4" and "a7aa2fa59826bf154ea977d331014afaaafdc8cd" have entirely different histories.
bef8baba5f
...
a7aa2fa598
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -51,7 +51,6 @@ void Obs::_bind_methods()
|
||||||
{
|
{
|
||||||
ClassDB::bind_method(D_METHOD("get_screen_frame"), &Obs::getEncodedScreenFrame);
|
ClassDB::bind_method(D_METHOD("get_screen_frame"), &Obs::getEncodedScreenFrame);
|
||||||
ClassDB::bind_method(D_METHOD("render_frame"), &Obs::renderFrameToMesh);
|
ClassDB::bind_method(D_METHOD("render_frame"), &Obs::renderFrameToMesh);
|
||||||
ClassDB::bind_method(D_METHOD("get_screen_count"), &Obs::getScreenCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,9 +176,4 @@ void Obs::renderFrameToMesh(PackedByteArray frame, Ref<StandardMaterial3D> mat)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Obs::getScreenCount() const
|
|
||||||
{
|
|
||||||
return microtaur::ScreenEnumerator().count();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@ public:
|
||||||
PackedByteArray getEncodedScreenFrame(size_t id);
|
PackedByteArray getEncodedScreenFrame(size_t id);
|
||||||
void renderFrameToMesh(PackedByteArray frame, Ref<StandardMaterial3D> mat);
|
void renderFrameToMesh(PackedByteArray frame, Ref<StandardMaterial3D> mat);
|
||||||
|
|
||||||
size_t getScreenCount() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_initialized{false};
|
bool m_initialized{false};
|
||||||
bool m_decInitialized{false};
|
bool m_decInitialized{false};
|
||||||
|
|
|
@ -18,18 +18,8 @@
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
namespace microtaur {
|
namespace microtaur
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
|
||||||
{
|
{
|
||||||
auto* count = reinterpret_cast<size_t*>(dwData);
|
|
||||||
(*count)++;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class AcceleratedWindowCapturer
|
class AcceleratedWindowCapturer
|
||||||
{
|
{
|
||||||
|
@ -74,7 +64,7 @@ public:
|
||||||
dxgiDevice->Release();
|
dxgiDevice->Release();
|
||||||
|
|
||||||
IDXGIOutput* dxgiOutput = nullptr;
|
IDXGIOutput* dxgiOutput = nullptr;
|
||||||
hr = dxgiAdapter->EnumOutputs(m_currentScreen, &dxgiOutput);
|
hr = dxgiAdapter->EnumOutputs(1, &dxgiOutput); // TODO: screen choose
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
reset();
|
reset();
|
||||||
return;
|
return;
|
||||||
|
@ -387,17 +377,6 @@ public:
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCurrentScreen(size_t target)
|
|
||||||
{
|
|
||||||
m_currentScreen = target;
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t getCurrentScreen() const
|
|
||||||
{
|
|
||||||
return m_currentScreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Microsoft::WRL::ComPtr<ID3D11Device> m_device;
|
Microsoft::WRL::ComPtr<ID3D11Device> m_device;
|
||||||
Microsoft::WRL::ComPtr<ID3D11DeviceContext> m_context;
|
Microsoft::WRL::ComPtr<ID3D11DeviceContext> m_context;
|
||||||
|
@ -411,8 +390,6 @@ private:
|
||||||
|
|
||||||
size_t m_width{};
|
size_t m_width{};
|
||||||
size_t m_height{};
|
size_t m_height{};
|
||||||
|
|
||||||
size_t m_currentScreen{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -427,21 +404,7 @@ WindowCapturer::~WindowCapturer()
|
||||||
|
|
||||||
Frame WindowCapturer::capture(size_t id, size_t width, size_t height)
|
Frame WindowCapturer::capture(size_t id, size_t width, size_t height)
|
||||||
{
|
{
|
||||||
if (id != m_impl->getCurrentScreen()) {
|
|
||||||
m_impl->setCurrentScreen(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_impl->nextFrame(width, height);
|
return m_impl->nextFrame(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ScreenEnumerator::count()
|
|
||||||
{
|
|
||||||
size_t c = 0;
|
|
||||||
if (EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&c)) {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,4 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScreenEnumerator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static size_t count();
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue