|
shun-iwasawa |
ad7711 |
#pragma once
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
#ifndef LUT_CALIBRATOR_H
|
|
shun-iwasawa |
ad7711 |
#define LUT_CALIBRATOR_H
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
#include "tcommon.h"
|
|
shun-iwasawa |
ad7711 |
#include "tpixelutils.h"
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
#include <qopenglbuffer></qopenglbuffer>
|
|
shun-iwasawa |
ad7711 |
#include <qmatrix4x4></qmatrix4x4>
|
|
shun-iwasawa |
ad7711 |
#include <qopenglfunctions></qopenglfunctions>
|
|
shun-iwasawa |
a8f111 |
#include <qset></qset>
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
#undef DVAPI
|
|
shun-iwasawa |
ad7711 |
#undef DVVAR
|
|
shun-iwasawa |
ad7711 |
#ifdef TOONZQT_EXPORTS
|
|
shun-iwasawa |
ad7711 |
#define DVAPI DV_EXPORT_API
|
|
shun-iwasawa |
ad7711 |
#define DVVAR DV_EXPORT_VAR
|
|
shun-iwasawa |
ad7711 |
#else
|
|
shun-iwasawa |
ad7711 |
#define DVAPI DV_IMPORT_API
|
|
shun-iwasawa |
ad7711 |
#define DVVAR DV_IMPORT_VAR
|
|
shun-iwasawa |
ad7711 |
#endif
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
class QOpenGLShader;
|
|
shun-iwasawa |
ad7711 |
class QOpenGLShaderProgram;
|
|
shun-iwasawa |
ad7711 |
class QOpenGLFramebufferObject;
|
|
shun-iwasawa |
ad7711 |
class QOpenGLTexture;
|
|
shun-iwasawa |
388550 |
class QOpenGLContext;
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
class QColor;
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
388550 |
class DVAPI LutCalibrator : public QOpenGLFunctions {
|
|
shun-iwasawa |
e40777 |
bool m_isValid = false;
|
|
shun-iwasawa |
e40777 |
bool m_isInitialized = false;
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
struct LutTextureShader {
|
|
shun-iwasawa |
ad7711 |
QOpenGLShader* vert = nullptr;
|
|
shun-iwasawa |
ad7711 |
QOpenGLShader* frag = nullptr;
|
|
shun-iwasawa |
ad7711 |
QOpenGLShaderProgram* program = nullptr;
|
|
shun-iwasawa |
ad7711 |
int texUniform = -1;
|
|
shun-iwasawa |
ad7711 |
int lutUniform = -1;
|
|
shun-iwasawa |
ad7711 |
int lutSizeUniform = -1;
|
|
shun-iwasawa |
ad7711 |
int vertexAttrib = -1;
|
|
shun-iwasawa |
ad7711 |
int texCoordAttrib = -1;
|
|
shun-iwasawa |
ad7711 |
} m_shader;
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
388550 |
QOpenGLTexture* m_lutTex = NULL;
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
QOpenGLBuffer m_viewerVBO;
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
bool initializeLutTextureShader();
|
|
shun-iwasawa |
ad7711 |
void createViewerVBO();
|
|
shun-iwasawa |
ad7711 |
void assignLutTexture();
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
public:
|
|
shun-iwasawa |
388550 |
// static LutCalibrator* instance();
|
|
shun-iwasawa |
a8f111 |
LutCalibrator();
|
|
shun-iwasawa |
a8f111 |
~LutCalibrator();
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
// to be computed once through the software
|
|
shun-iwasawa |
ad7711 |
void initialize();
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
ad7711 |
bool isValid() { return m_isValid; }
|
|
shun-iwasawa |
e40777 |
bool isInitialized() { return m_isInitialized; }
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
void onEndDraw(QOpenGLFramebufferObject*);
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
388550 |
void cleanup();
|
|
shun-iwasawa |
a8f111 |
void update(bool textureChanged);
|
|
shun-iwasawa |
388550 |
};
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
class DVAPI LutManager // singleton
|
|
shun-iwasawa |
388550 |
{
|
|
shun-iwasawa |
a8f111 |
bool m_isValid;
|
|
shun-iwasawa |
a8f111 |
QString m_currentLutPath;
|
|
shun-iwasawa |
a8f111 |
QSet<lutcalibrator*> m_calibrators;</lutcalibrator*>
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
LutManager();
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
struct Lut {
|
|
shun-iwasawa |
388550 |
int meshSize;
|
|
shun-iwasawa |
a8f111 |
float* data = nullptr;
|
|
shun-iwasawa |
388550 |
} m_lut;
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
public:
|
|
shun-iwasawa |
388550 |
static LutManager* instance();
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
~LutManager();
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
bool isValid() { return m_isValid; }
|
|
shun-iwasawa |
388550 |
int meshSize() const { return m_lut.meshSize; }
|
|
shun-iwasawa |
443318 |
const float* data() const { return m_lut.data; }
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
bool loadLutFile(const QString& fp);
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
void convert(float&, float&, float&);
|
|
shun-iwasawa |
ad7711 |
void convert(QColor&);
|
|
shun-iwasawa |
ad7711 |
void convert(TPixel32&);
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
QString& getMonitorName() const;
|
|
shun-iwasawa |
a8f111 |
|
|
shun-iwasawa |
a8f111 |
void registerCalibrator(LutCalibrator* calibrator);
|
|
shun-iwasawa |
a8f111 |
void removeCalibrator(LutCalibrator* calibrator);
|
|
shun-iwasawa |
a8f111 |
|
|
shun-iwasawa |
a8f111 |
void update();
|
|
shun-iwasawa |
ad7711 |
};
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
#endif
|