mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 10:49:59 +01:00
Fixed deletion of clone: remove from origin!!!
This commit is contained in:
15
Source.cpp
15
Source.cpp
@@ -133,6 +133,11 @@ Source::Source() : initialized_(false), active_(true), need_update_(true)
|
||||
|
||||
Source::~Source()
|
||||
{
|
||||
// inform clones that they lost their origin
|
||||
for (auto it = clones_.begin(); it != clones_.end(); it++)
|
||||
(*it)->unlink();
|
||||
clones_.clear();
|
||||
|
||||
// delete objects
|
||||
delete stored_status_;
|
||||
if (renderbuffer_)
|
||||
@@ -150,10 +155,6 @@ Source::~Source()
|
||||
frames_.clear();
|
||||
overlays_.clear();
|
||||
|
||||
// inform clones that they lost their origin
|
||||
for (auto it = clones_.begin(); it != clones_.end(); it++)
|
||||
(*it)->origin_ = nullptr;
|
||||
|
||||
// don't forget that the processing shader
|
||||
// could be created but not used
|
||||
if ( renderingshader_ != processingshader_ )
|
||||
@@ -401,6 +402,7 @@ CloneSource *Source::clone()
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
CloneSource::CloneSource(Source *origin) : Source(), origin_(origin)
|
||||
{
|
||||
// create surface:
|
||||
@@ -409,6 +411,9 @@ CloneSource::CloneSource(Source *origin) : Source(), origin_(origin)
|
||||
|
||||
CloneSource::~CloneSource()
|
||||
{
|
||||
if (origin_)
|
||||
origin_->clones_.remove(this);
|
||||
|
||||
// delete surface
|
||||
if (clonesurface_)
|
||||
delete clonesurface_;
|
||||
@@ -478,7 +483,7 @@ void CloneSource::render()
|
||||
{
|
||||
if (!initialized_)
|
||||
init();
|
||||
else {
|
||||
else if (origin_) {
|
||||
// render the view into frame buffer
|
||||
static glm::mat4 projection = glm::ortho(-1.f, 1.f, 1.f, -1.f, -1.f, 1.f);
|
||||
renderbuffer_->begin();
|
||||
|
||||
8
Source.h
8
Source.h
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
|
||||
#include "View.h"
|
||||
@@ -24,6 +25,7 @@ typedef std::list<CloneSource *> CloneList;
|
||||
|
||||
class Source
|
||||
{
|
||||
friend class CloneSource;
|
||||
friend class View;
|
||||
friend class MixingView;
|
||||
friend class GeometryView;
|
||||
@@ -43,7 +45,10 @@ public:
|
||||
|
||||
// cloning mechanism
|
||||
virtual CloneSource *clone ();
|
||||
inline size_t numClones() const { return clones_.size(); }
|
||||
// void unClone(CloneSource *clone);
|
||||
// inline size_t numClones() const { return clones_.size(); }
|
||||
// inline CloneList::iterator beginClones () { return clones_.begin(); }
|
||||
// inline CloneList::iterator endClones () { return clones_.end(); }
|
||||
|
||||
// Display mode
|
||||
typedef enum {
|
||||
@@ -190,6 +195,7 @@ public:
|
||||
void accept (Visitor& v) override;
|
||||
|
||||
CloneSource *clone() override;
|
||||
inline void unlink() { origin_ = nullptr; }
|
||||
inline Source *origin() const { return origin_; }
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user