Fixed display cropped source in AppearanceView and code cleanup.

This commit is contained in:
brunoherbelin
2020-12-08 23:43:50 +01:00
parent b7a54d0512
commit a58c06c617
5 changed files with 7 additions and 26 deletions

View File

@@ -212,12 +212,9 @@ 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()
{

View File

@@ -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<glm::vec3> 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<glm::vec3> points, glm::vec4 color, uint pointsize) :
pointsize_ = pointsize;
}
void Points::draw(glm::mat4 modelview, glm::mat4 projection)
{
if ( !initialized() )

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;