2019-08-24 15:07:28 +00:00
|
|
|
// enve - 2D animations software
|
2020-01-02 19:46:10 +00:00
|
|
|
// Copyright (C) 2016-2020 Maurycy Liebner
|
2019-08-24 15:07:28 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2019-07-15 17:06:24 +00:00
|
|
|
#ifndef DABTEST_H
|
|
|
|
#define DABTEST_H
|
|
|
|
|
|
|
|
#include "dabtest_global.h"
|
2019-09-09 07:31:43 +00:00
|
|
|
#include "enveCore/gpurendertools.h"
|
2019-07-15 17:06:24 +00:00
|
|
|
|
|
|
|
struct Dab {
|
|
|
|
Dab(const float x, const float y,
|
|
|
|
const float radius, const float aspectRatio,
|
|
|
|
const float angle, const float hardness, const float opaque,
|
|
|
|
const float red, const float green, const float blue, const float alpha) :
|
|
|
|
fX(x), fY(y),
|
|
|
|
fRadius(radius), fAspectRatio(aspectRatio),
|
|
|
|
fSinTh(sin(angle)), fCosTh(cos(angle)),
|
|
|
|
fHardness(hardness), fOpaque(opaque),
|
|
|
|
fRed(red), fGreen(green), fBlue(blue), fAlpha(alpha),
|
|
|
|
fSeg1Offset(1), fSeg1Slope(-(1.f/fHardness - 1.f)),
|
|
|
|
fSeg2Offset(fHardness/(1.f - fHardness)),
|
|
|
|
fSeg2Slope(-fHardness/(1.f - fHardness)) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Dab() {}
|
|
|
|
|
|
|
|
float fX = 0.5f; // 0
|
|
|
|
float fY = 0.5f; // 1
|
|
|
|
float fRadius = 0.5f; // 2
|
|
|
|
float fAspectRatio = 1; // 3
|
|
|
|
float fSinTh = 0; // 4
|
|
|
|
float fCosTh = 1; // 5
|
|
|
|
float fHardness = 1; // 6
|
|
|
|
float fOpaque = 1; // 7
|
|
|
|
float fRed = 1; // 8
|
|
|
|
float fGreen = 0; // 9
|
|
|
|
float fBlue = 0; // 10
|
|
|
|
float fAlpha = 1; // 11
|
|
|
|
float fSeg1Offset = 1; // 12
|
|
|
|
float fSeg1Slope = -(1.f/fHardness - 1.f); // 13
|
|
|
|
float fSeg2Offset = fHardness/(1.f - fHardness); // 14
|
|
|
|
float fSeg2Slope = -fHardness/(1.f - fHardness); // 15
|
|
|
|
};
|
|
|
|
|
2019-07-25 17:21:26 +00:00
|
|
|
class DabTestCaller000 : public RasterEffectCaller {
|
2019-07-15 17:06:24 +00:00
|
|
|
public:
|
|
|
|
DabTestCaller000(const Dab& dab) :
|
2019-08-17 15:28:30 +00:00
|
|
|
RasterEffectCaller(HardwareSupport::gpuOnly), mDab(dab) {}
|
2019-07-15 17:06:24 +00:00
|
|
|
|
2019-07-25 17:21:26 +00:00
|
|
|
void processGpu(QGL33 * const gl,
|
2020-03-02 22:43:08 +00:00
|
|
|
GpuRenderTools& renderTools);
|
2019-07-25 17:21:26 +00:00
|
|
|
void processCpu(CpuRenderTools& renderTools,
|
2019-07-26 16:47:41 +00:00
|
|
|
const CpuRenderData& data) {
|
2019-12-23 13:02:55 +00:00
|
|
|
Q_UNUSED(renderTools)
|
|
|
|
Q_UNUSED(data)
|
2019-07-25 17:21:26 +00:00
|
|
|
}
|
2019-07-15 17:06:24 +00:00
|
|
|
private:
|
|
|
|
static bool sInitialized;
|
2019-07-16 14:10:34 +00:00
|
|
|
static void sInitialize(QGL33 * const gl);
|
2019-07-15 17:06:24 +00:00
|
|
|
static GLuint sDataId;
|
|
|
|
static GLuint sProgramId;
|
|
|
|
|
|
|
|
const Dab mDab;
|
|
|
|
};
|
|
|
|
|
2019-08-01 19:52:22 +00:00
|
|
|
class DabTest000 : public CustomRasterEffect {
|
2019-07-15 17:06:24 +00:00
|
|
|
public:
|
|
|
|
DabTest000();
|
|
|
|
|
2019-08-31 18:34:37 +00:00
|
|
|
stdsptr<RasterEffectCaller> getEffectCaller(
|
2019-12-28 17:33:20 +00:00
|
|
|
const qreal relFrame, const qreal resolution,
|
2020-03-11 09:54:26 +00:00
|
|
|
const qreal influence, BoxRenderData * const data) const;
|
2019-07-15 17:06:24 +00:00
|
|
|
|
|
|
|
CustomIdentifier getIdentifier() const;
|
|
|
|
private:
|
|
|
|
qsptr<QrealAnimator> mRadius;
|
|
|
|
qsptr<QrealAnimator> mHardness;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DABTEST_H
|