[core] store clear command to display list

This commit is contained in:
ExMix 2014-10-30 15:09:16 +03:00 committed by Alex Zolotarev
parent 0b2124e883
commit d0db092dd4
4 changed files with 21 additions and 0 deletions

View file

@ -87,6 +87,12 @@ namespace graphics
m_parent->processCommand(cmd);
}
void DisplayList::clear(shared_ptr<ClearCommandCmd> const & cmd)
{
cmd->setIsDebugging(m_isDebugging);
m_commands.push_back(cmd);
}
void DisplayList::addCheckPoint()
{
static_cast<gl::Renderer*>(m_parent)->addCheckPoint();

View file

@ -23,6 +23,7 @@ namespace graphics
typedef gl::GeometryRenderer::ApplyStates ApplyStatesCmd;
typedef gl::GeometryRenderer::ApplySharpStates ApplySharpStatesCmd;
typedef gl::GeometryRenderer::UploadData UploadDataCmd;
typedef gl::GeometryRenderer::ClearCommand ClearCommandCmd;
list<shared_ptr<Command> > m_commands;
@ -52,6 +53,7 @@ namespace graphics
void freeTexture(shared_ptr<FreeTextureCmd> const & cmd);
void freeStorage(shared_ptr<FreeStorageCmd> const & cmd);
void uploadResources(shared_ptr<UploadDataCmd> const & cmd);
void clear(shared_ptr<ClearCommandCmd> const & cmd);
void addCheckPoint();
void draw(DisplayListRenderer * r,

View file

@ -85,6 +85,17 @@ namespace graphics
dl->draw(this, m, holder);
}
void DisplayListRenderer::clear(Color const & c, bool clearRT, float depth, bool clearDepth)
{
if (isCancelled())
return;
if (m_displayList)
m_displayList->clear(make_shared<ClearCommandCmd>(c, clearRT, depth, clearDepth));
else
base_t::clear(c, clearRT, depth, clearDepth);
}
void DisplayListRenderer::drawGeometry(shared_ptr<gl::BaseTexture> const & texture,
gl::Storage const & storage,
size_t indicesCount,

View file

@ -24,6 +24,7 @@ namespace graphics
typedef base_t::FreeTexture FreeTextureCmd;
typedef base_t::FreeStorage FreeStorageCmd;
typedef base_t::DiscardStorage DiscardStorageCmd;
typedef base_t::ClearCommand ClearCommandCmd;
typedef gl::BaseTexture const * TextureRef;
typedef pair<gl::BufferObject const *, gl::BufferObject const *> StorageRef;
@ -56,6 +57,7 @@ namespace graphics
/// Interceptable commands
/// @{
void clear(Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
/// draw geometry
void drawGeometry(shared_ptr<gl::BaseTexture> const & texture,