New function to get thumbnail of render view

This commit is contained in:
Bruno
2021-04-22 23:38:00 +02:00
parent 97e7e5f4a1
commit eb54b67caa
3 changed files with 25 additions and 0 deletions

View File

@@ -82,3 +82,25 @@ void RenderView::draw()
frame_buffer_->end(); frame_buffer_->end();
} }
} }
FrameBufferImage *RenderView::thumbnail () const
{
FrameBufferImage *thumbnail = nullptr;
if (frame_buffer_) {
FrameBufferSurface *thumb = new FrameBufferSurface(frame_buffer_);
FrameBuffer *frame_thumbnail = new FrameBuffer( glm::vec3(SESSION_THUMBNAIL_HEIGHT * frame_buffer_->aspectRatio(), SESSION_THUMBNAIL_HEIGHT, 1.f) );
frame_thumbnail->begin();
thumb->draw(glm::identity<glm::mat4>(), frame_thumbnail->projection());
frame_thumbnail->end();
thumbnail = frame_thumbnail->image();
delete thumb;
delete frame_thumbnail;
}
return thumbnail;
}

View File

@@ -22,6 +22,8 @@ public:
float fading() const; float fading() const;
inline FrameBuffer *frame () const { return frame_buffer_; } inline FrameBuffer *frame () const { return frame_buffer_; }
FrameBufferImage *thumbnail () const;
}; };
#endif // RENDERVIEW_H #endif // RENDERVIEW_H

View File

@@ -59,6 +59,7 @@
#define TRANSITION_MIN_DURATION 0.2f #define TRANSITION_MIN_DURATION 0.2f
#define TRANSITION_MAX_DURATION 10.f #define TRANSITION_MAX_DURATION 10.f
#define ARROWS_MOVEMENT_FACTOR 4.f #define ARROWS_MOVEMENT_FACTOR 4.f
#define SESSION_THUMBNAIL_HEIGHT 120.f
#define IMGUI_TITLE_MAINWINDOW ICON_FA_CIRCLE_NOTCH " vimix" #define IMGUI_TITLE_MAINWINDOW ICON_FA_CIRCLE_NOTCH " vimix"
#define IMGUI_TITLE_MEDIAPLAYER ICON_FA_FILM " Player" #define IMGUI_TITLE_MEDIAPLAYER ICON_FA_FILM " Player"