tahoma2d/toonz/sources/include/toonz/tcolumnfx.h

285 lines
8.5 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TCOLUMNFX_H
#define TCOLUMNFX_H
// TnzCore includes
#include "tthreadmessage.h"
#include "trastercm.h"
// TnzBase includes
#include "trasterfx.h"
#include "tbasefx.h"
#undef DVAPI
#undef DVVAR
#ifdef TOONZLIB_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//=========================================================================
// Forward declarations
class TXshLevelColumn;
class TXshPaletteColumn;
class TXshZeraryFxColumn;
class TXsheet;
class TXshColumn;
class TXshSimpleLevel;
class FxDag;
class TImageInfo;
class TOfflineGL;
class TVectorImageP;
class TVectorRenderData;
//=========================================================================
//*******************************************************************************************
// TColumnFx declaration
//*******************************************************************************************
2016-06-15 18:43:10 +12:00
class DVAPI TColumnFx : public TRasterFx {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TColumnFx() : TRasterFx() {}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual int getColumnIndex() const = 0;
virtual std::wstring getColumnName() const = 0;
virtual std::wstring getColumnId() const = 0;
virtual TXshColumn *getXshColumn() const = 0;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
int getReferenceColumnIndex() const override { return getColumnIndex(); }
2016-03-19 06:57:51 +13:00
};
//*******************************************************************************************
// TLevelColumnFx declaration
//*******************************************************************************************
2016-06-15 18:43:10 +12:00
class TLevelColumnFx : public TColumnFx {
TXshLevelColumn *m_levelColumn;
bool m_isCachable;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TThread::Mutex m_mutex;
TOfflineGL *m_offlineContext;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TLevelColumnFx();
~TLevelColumnFx();
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TFx *clone(bool recursive = true) const override;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TPalette *getPalette(int frame) const;
TFilePath getPalettePath(int frame) const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setColumn(TXshLevelColumn *column);
TXshLevelColumn *getColumn() const { return m_levelColumn; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
std::wstring getColumnName() const override;
std::wstring getColumnId() const override;
int getColumnIndex() const override;
TXshColumn *getXshColumn() const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool isCachable() const override { return m_isCachable; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool canHandle(const TRenderSettings &info, double frame) override;
TAffine handledAffine(const TRenderSettings &info, double frame) override;
2016-06-15 18:43:10 +12:00
TAffine getDpiAff(int frame);
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TFxTimeRegion getTimeRegion() const override;
2016-06-20 14:23:05 +12:00
bool doGetBBox(double frame, TRectD &bBox,
const TRenderSettings &info) override;
std::string getAlias(double frame,
const TRenderSettings &info) const override;
2016-06-15 18:43:10 +12:00
int getMemoryRequirement(const TRectD &rect, double frame,
2016-06-19 20:06:29 +12:00
const TRenderSettings &info) override;
2016-03-19 06:57:51 +13:00
2016-06-20 14:23:05 +12:00
void doDryCompute(TRectD &rect, double frame,
const TRenderSettings &info) override;
void doCompute(TTile &tile, double frame,
const TRenderSettings &info) override;
2016-06-19 20:06:29 +12:00
void compute(TFlash &flash, int frame) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void saveData(TOStream &os) override;
void loadData(TIStream &is) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
const TPersistDeclaration *getDeclaration() const override;
std::string getPluginId() const override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
void getImageInfo(TImageInfo &imageInfo, TXshSimpleLevel *sl,
TFrameId frameId);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TImageP applyTzpFxs(TToonzImageP &ti, double frame,
const TRenderSettings &info);
void applyTzpFxsOnVector(const TVectorImageP &vi, TTile &tile, double frame,
const TRenderSettings &info);
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
// not implemented
TLevelColumnFx(const TLevelColumnFx &);
TLevelColumnFx &operator=(const TLevelColumnFx &);
2016-03-19 06:57:51 +13:00
};
//*******************************************************************************************
// TPaletteColumnFx declaration
//*******************************************************************************************
2016-06-15 18:43:10 +12:00
class TPaletteColumnFx : public TColumnFx {
TXshPaletteColumn *m_paletteColumn;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TPaletteColumnFx();
~TPaletteColumnFx();
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TFx *clone(bool recursive = true) const override;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TPalette *getPalette(int frame) const;
TFilePath getPalettePath(int frame) const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setColumn(TXshPaletteColumn *column) { m_paletteColumn = column; }
TXshPaletteColumn *getColumn() const { return m_paletteColumn; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
std::wstring getColumnName() const override;
std::wstring getColumnId() const override;
int getColumnIndex() const override;
TXshColumn *getXshColumn() const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool isCachable() const override { return false; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool canHandle(const TRenderSettings &info, double frame) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TFxTimeRegion getTimeRegion() const override;
2016-06-20 14:23:05 +12:00
bool doGetBBox(double frame, TRectD &bBox,
const TRenderSettings &info) override;
std::string getAlias(double frame,
const TRenderSettings &info) const override;
2016-06-15 18:43:10 +12:00
TAffine getDpiAff(int frame);
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void doCompute(TTile &tile, double frame, const TRenderSettings &) override;
void compute(TFlash &flash, int frame) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
const TPersistDeclaration *getDeclaration() const override;
std::string getPluginId() const override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
// not implemented
TPaletteColumnFx(const TPaletteColumnFx &);
TPaletteColumnFx &operator=(const TPaletteColumnFx &);
2016-03-19 06:57:51 +13:00
};
//*******************************************************************************************
// TZeraryColumnFx declaration
//*******************************************************************************************
class DVAPI TZeraryColumnFx final : public TColumnFx {
2016-06-15 18:43:10 +12:00
TXshZeraryFxColumn *m_zeraryFxColumn;
TZeraryFx *m_fx;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TZeraryColumnFx();
~TZeraryColumnFx();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TZeraryFx *getZeraryFx() const { return m_fx; }
void setZeraryFx(TFx *fx);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setColumn(TXshZeraryFxColumn *column);
TXshZeraryFxColumn *getColumn() const { return m_zeraryFxColumn; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
std::wstring getColumnName() const override;
std::wstring getColumnId() const override;
int getColumnIndex() const override;
TXshColumn *getXshColumn() const override;
2016-03-19 06:57:51 +13:00
2016-06-20 14:23:05 +12:00
bool canHandle(const TRenderSettings &info, double frame) override {
return true;
}
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TFxTimeRegion getTimeRegion() const override;
2016-06-20 14:23:05 +12:00
bool doGetBBox(double frame, TRectD &bBox,
const TRenderSettings &info) override;
std::string getAlias(double frame,
const TRenderSettings &info) const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void doCompute(TTile &tile, double frame, const TRenderSettings &) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void saveData(TOStream &os) override;
void loadData(TIStream &is) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
const TPersistDeclaration *getDeclaration() const override;
std::string getPluginId() const override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
// not implemented
TZeraryColumnFx(const TZeraryColumnFx &);
TZeraryColumnFx &operator=(const TZeraryColumnFx &);
2016-03-19 06:57:51 +13:00
};
//*******************************************************************************************
// TXsheetFx declaration
//*******************************************************************************************
class TXsheetFx final : public TRasterFx {
2016-06-15 18:43:10 +12:00
FxDag *m_fxDag;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TXsheetFx();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
FxDag *getFxDag() const { return m_fxDag; }
2016-03-19 06:57:51 +13:00
2016-06-20 14:23:05 +12:00
bool canHandle(const TRenderSettings &info, double frame) override {
return false;
}
2016-03-19 06:57:51 +13:00
2016-06-20 14:23:05 +12:00
std::string getAlias(double frame,
const TRenderSettings &info) const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void doCompute(TTile &tile, double frame, const TRenderSettings &) override;
2016-06-20 14:23:05 +12:00
bool doGetBBox(double frame, TRectD &bBox,
const TRenderSettings &info) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
const TPersistDeclaration *getDeclaration() const override;
std::string getPluginId() const override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
friend class FxDag;
void setFxDag(FxDag *fxDag);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// not implemented
TXsheetFx(const TXsheetFx &);
TXsheetFx &operator=(const TXsheetFx &);
2016-03-19 06:57:51 +13:00
};
//*******************************************************************************************
// TOutputFx declaration
//*******************************************************************************************
class TOutputFx final : public TRasterFx {
2016-06-15 18:43:10 +12:00
TRasterFxPort m_input;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TOutputFx();
2016-03-19 06:57:51 +13:00
2016-06-20 14:23:05 +12:00
bool canHandle(const TRenderSettings &info, double frame) override {
return false;
}
2016-03-19 06:57:51 +13:00
2016-06-20 14:23:05 +12:00
bool doGetBBox(double frame, TRectD &bBox,
const TRenderSettings &info) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void doCompute(TTile &tile, double frame, const TRenderSettings &) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
const TPersistDeclaration *getDeclaration() const override;
std::string getPluginId() const override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
// not implemented
TOutputFx(const TOutputFx &);
TOutputFx &operator=(const TOutputFx &);
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // TCOLUMNFX_H