Using source mode UNINITIALIZED to replace initialized_ bool

info about source initialization was duplicated; using the mode state machine only avoids to keep a flag
This commit is contained in:
Bruno
2021-05-01 10:29:34 +02:00
parent fd3102c0d3
commit a05cd380fb
6 changed files with 33 additions and 21 deletions

View File

@@ -98,7 +98,6 @@ void MediaSource::init()
++View::need_deep_update_;
// done init
initialized_ = true;
Log::Info("Source '%s' linked to Media %s.", name().c_str(), std::to_string(mediaplayer_->id()).c_str());
}
}
@@ -127,11 +126,12 @@ void MediaSource::update(float dt)
void MediaSource::render()
{
if (!initialized_)
if ( mode_ < Source::VISIBLE )
init();
else {
// render the media player into frame buffer
renderbuffer_->begin();
// apply fading
texturesurface_->shader()->color = glm::vec4( glm::vec3(mediaplayer_->currentTimelineFading()), 1.f);
texturesurface_->draw(glm::identity<glm::mat4>(), renderbuffer_->projection());
renderbuffer_->end();