From a58c06c6174a6e8e5ff81ca24528217c33f1b809 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Tue, 8 Dec 2020 23:43:50 +0100 Subject: [PATCH] Fixed display cropped source in AppearanceView and code cleanup. --- Mixer.cpp | 5 +---- Primitives.cpp | 13 ------------- Primitives.h | 1 - Source.h | 9 +++------ View.cpp | 5 +++-- 5 files changed, 7 insertions(+), 26 deletions(-) diff --git a/Mixer.cpp b/Mixer.cpp index 4aaee78..d297b4c 100644 --- a/Mixer.cpp +++ b/Mixer.cpp @@ -212,11 +212,8 @@ void Mixer::update() transition_.update(dt_); // deep update was performed - if (View::need_deep_update_ > 0) { - - Log::Info("View::need_deep_update_ %d", View::need_deep_update_); + if (View::need_deep_update_ > 0) View::need_deep_update_--; - } } void Mixer::draw() diff --git a/Primitives.cpp b/Primitives.cpp index 48aa404..abf5558 100644 --- a/Primitives.cpp +++ b/Primitives.cpp @@ -171,21 +171,11 @@ void MediaSurface::accept(Visitor& v) v.visit(*this); } - FrameBufferSurface::FrameBufferSurface(FrameBuffer *fb, Shader *s) : Surface(s), frame_buffer_(fb) { } -void FrameBufferSurface::init() -{ - Surface::init(); - - // set aspect ratio -// scale_.x = frame_buffer_->aspectRatio(); - -} - void FrameBufferSurface::draw(glm::mat4 modelview, glm::mat4 projection) { if ( !initialized() ) @@ -204,7 +194,6 @@ void FrameBufferSurface::accept(Visitor& v) v.visit(*this); } - Points::Points(std::vector points, glm::vec4 color, uint pointsize) : Primitive(new Shader) { for(size_t i = 0; i < points.size(); ++i) @@ -218,8 +207,6 @@ Points::Points(std::vector points, glm::vec4 color, uint pointsize) : pointsize_ = pointsize; } - - void Points::draw(glm::mat4 modelview, glm::mat4 projection) { if ( !initialized() ) diff --git a/Primitives.h b/Primitives.h index e7f19e2..33023bc 100644 --- a/Primitives.h +++ b/Primitives.h @@ -94,7 +94,6 @@ class FrameBufferSurface : public Surface { public: FrameBufferSurface(FrameBuffer *fb, Shader *s = new ImageShader); - void init () override; void draw (glm::mat4 modelview, glm::mat4 projection) override; void accept (Visitor& v) override; diff --git a/Source.h b/Source.h index a3096e8..d2394ca 100644 --- a/Source.h +++ b/Source.h @@ -66,12 +66,6 @@ public: // tests if a given node is part of the source bool contains (Node *node) const; - // a Source has a shader used to render in fbo - inline Shader *renderingShader () const { return renderingshader_; } - - // a Source has a surface used to draw images - inline Surface *renderingSurface () const { return texturesurface_; } - // the rendering shader always have an image processing shader inline ImageProcessingShader *processingShader () const { return processingshader_; } @@ -83,6 +77,9 @@ public: // a Source has a shader to control mixing effects inline ImageShader *blendingShader () const { return blendingshader_; } + // a Source has a shader used to render in fbo + inline Shader *renderingShader () const { return renderingshader_; } + // every Source has a frame buffer from the renderbuffer virtual FrameBuffer *frame () const; diff --git a/View.cpp b/View.cpp index c88c25c..38abf44 100644 --- a/View.cpp +++ b/View.cpp @@ -840,7 +840,8 @@ void showContextMenu(View::Mode m, const char* label) if (output) scale.x = output->aspectRatio() / s->frame()->aspectRatio(); } else if ( m == View::APPEARANCE ) { - scale = s->renderingSurface()->scale_; + glm::vec2 crop = s->frame()->projectionArea(); + scale = glm::vec3( crop, 1.f); } s->group(m)->scale_ = scale; s->group(m)->rotation_.z = 0; @@ -2118,7 +2119,7 @@ void AppearanceView::adjustBackground() // update rendering frame to match edit source AR image_original_width = edit_source_->frame()->aspectRatio(); surfacepreview->setTextureIndex( edit_source_->frame()->texture() ); -// surfacepreview->scale_ = edit_source_->mixingsurface_->scale_; + surfacepreview->scale_ = edit_source_->mixingsurface_->scale_; // surfacepreview->scale_.x = image_original_width; // image_crop_area.x *= image_original_width;