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()
|
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 objects
|
||||||
delete stored_status_;
|
delete stored_status_;
|
||||||
if (renderbuffer_)
|
if (renderbuffer_)
|
||||||
@@ -150,10 +155,6 @@ Source::~Source()
|
|||||||
frames_.clear();
|
frames_.clear();
|
||||||
overlays_.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
|
// don't forget that the processing shader
|
||||||
// could be created but not used
|
// could be created but not used
|
||||||
if ( renderingshader_ != processingshader_ )
|
if ( renderingshader_ != processingshader_ )
|
||||||
@@ -401,6 +402,7 @@ CloneSource *Source::clone()
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CloneSource::CloneSource(Source *origin) : Source(), origin_(origin)
|
CloneSource::CloneSource(Source *origin) : Source(), origin_(origin)
|
||||||
{
|
{
|
||||||
// create surface:
|
// create surface:
|
||||||
@@ -409,6 +411,9 @@ CloneSource::CloneSource(Source *origin) : Source(), origin_(origin)
|
|||||||
|
|
||||||
CloneSource::~CloneSource()
|
CloneSource::~CloneSource()
|
||||||
{
|
{
|
||||||
|
if (origin_)
|
||||||
|
origin_->clones_.remove(this);
|
||||||
|
|
||||||
// delete surface
|
// delete surface
|
||||||
if (clonesurface_)
|
if (clonesurface_)
|
||||||
delete clonesurface_;
|
delete clonesurface_;
|
||||||
@@ -478,7 +483,7 @@ void CloneSource::render()
|
|||||||
{
|
{
|
||||||
if (!initialized_)
|
if (!initialized_)
|
||||||
init();
|
init();
|
||||||
else {
|
else if (origin_) {
|
||||||
// render the view into frame buffer
|
// render the view into frame buffer
|
||||||
static glm::mat4 projection = glm::ortho(-1.f, 1.f, 1.f, -1.f, -1.f, 1.f);
|
static glm::mat4 projection = glm::ortho(-1.f, 1.f, 1.f, -1.f, -1.f, 1.f);
|
||||||
renderbuffer_->begin();
|
renderbuffer_->begin();
|
||||||
|
|||||||
8
Source.h
8
Source.h
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <atomic>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "View.h"
|
#include "View.h"
|
||||||
@@ -24,6 +25,7 @@ typedef std::list<CloneSource *> CloneList;
|
|||||||
|
|
||||||
class Source
|
class Source
|
||||||
{
|
{
|
||||||
|
friend class CloneSource;
|
||||||
friend class View;
|
friend class View;
|
||||||
friend class MixingView;
|
friend class MixingView;
|
||||||
friend class GeometryView;
|
friend class GeometryView;
|
||||||
@@ -43,7 +45,10 @@ public:
|
|||||||
|
|
||||||
// cloning mechanism
|
// cloning mechanism
|
||||||
virtual CloneSource *clone ();
|
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
|
// Display mode
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -190,6 +195,7 @@ public:
|
|||||||
void accept (Visitor& v) override;
|
void accept (Visitor& v) override;
|
||||||
|
|
||||||
CloneSource *clone() override;
|
CloneSource *clone() override;
|
||||||
|
inline void unlink() { origin_ = nullptr; }
|
||||||
inline Source *origin() const { return origin_; }
|
inline Source *origin() const { return origin_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user