Skip to content

Commit

Permalink
Added BeginDirectXFrame and EndDirectXFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Sep 4, 2024
1 parent 6904ce7 commit fd11c6b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/RenderLibrary/CreateDirectXDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ void DirectXRenderObject::CleanupDirectX()
InlineResourcesRelease(&_directXRenderProperties._g_pd3dDevice);
}

bool DirectXRenderObject::RenderDirectXFrame()
bool DirectXRenderObject::BeginDirectXFrame()
{
FLOAT clearColor[4] = { 0.1f, 0.1f, 0.1f, 1.0f };

_directXRenderProperties._g_pImmediateContext->ClearRenderTargetView(_directXRenderProperties._g_pRenderTargetView, clearColor);
_directXRenderProperties._g_pSwapChain->Present(0, 0);

return true;
}

bool DirectXRenderObject::EndDirectXFrame()
{
_directXRenderProperties._g_pSwapChain->Present(1, 0);

return true;
}
3 changes: 2 additions & 1 deletion src/RenderLibrary/CreateDirectXDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace RenderLibary

void CreateDirectXScene(HWND hwnd);
void CleanupDirectX();
bool RenderDirectXFrame();
bool BeginDirectXFrame();
bool EndDirectXFrame();

protected:
struct
Expand Down
5 changes: 4 additions & 1 deletion src/RenderLibrary/FabricCustomWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ API bool FrameCustom()
if (_renderCustomObject._b_ShouldExit)
return false;

if (!_directXRenderObject->RenderDirectXFrame())
if (!_directXRenderObject->BeginDirectXFrame())
return false;

if (!_directXRenderObject->EndDirectXFrame())
return false;

return true;
Expand Down
5 changes: 4 additions & 1 deletion src/RenderLibrary/FabricNativeWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ API bool FrameNative(bool show)
if (_renderNativeObject._b_ShouldExit)
return false;

if (!_directXRenderObject->RenderDirectXFrame())
if (!_directXRenderObject->BeginDirectXFrame())
return false;

if (!_directXRenderObject->EndDirectXFrame())
return false;
}

Expand Down

0 comments on commit fd11c6b

Please sign in to comment.