Use rendertarget

This commit is contained in:
Phillip Stephens 2016-02-20 02:26:43 -08:00
parent cf6c5bf55a
commit a37f536ae9
1 changed files with 28 additions and 2 deletions

View File

@ -109,6 +109,8 @@ class CGameArchitectureSupport : public boo::IWindowCallback
CMainFlow m_mainFlow;
CConsoleOutputWindow m_consoleWindow;
CAudioStateWin m_audioStateWin;
boo::SWindowRect m_windowRect;
bool m_rectIsDirty;
void mouseDown(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
{ m_inputGenerator.mouseDown(coord, button, mods); }
@ -133,6 +135,12 @@ class CGameArchitectureSupport : public boo::IWindowCallback
void destroyed() { m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport))); }
void resized(const boo::SWindowRect &rect)
{
m_windowRect = rect;
m_rectIsDirty = true;
}
public:
CGameArchitectureSupport()
: m_audioSys(0,0,0,0,0),
@ -164,6 +172,13 @@ public:
}
return finished;
}
bool isRectDirty() { return m_rectIsDirty; }
const boo::SWindowRect& getWindowRect()
{
m_rectIsDirty = false;
return m_windowRect;
}
};
CMain::CMain()
@ -222,6 +237,8 @@ int CMain::appMain(boo::IApplication* app)
mainWindow->setCallback(archSupport.GetAllocSpace());
boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
boo::SWindowRect windowRect = mainWindow->getWindowFrame();
boo::ITextureR* renderTex = mainWindow->getMainContextDataFactory()->newRenderTexture(windowRect.size[0], windowRect.size[1], 1);
float rgba[4] = { 0.2f, 0.2f, 0.2f, 1.0f};
gfxQ->setClearColor(rgba);
@ -229,9 +246,18 @@ int CMain::appMain(boo::IApplication* app)
{
mainWindow->waitForRetrace();
xe8_b24_finished = archSupport->Update();
gfxQ->clearTarget();
gfxQ->resolveDisplay(nullptr);
if (archSupport->isRectDirty())
{
const boo::SWindowRect& windowRect = archSupport->getWindowRect();
gfxQ->resizeRenderTexture(renderTex,
windowRect.size[0],
windowRect.size[1]);
}
gfxQ->setRenderTarget(renderTex);
gfxQ->clearTarget();
gfxQ->resolveDisplay(renderTex);
gfxQ->execute();
}
return 0;