|
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 |
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 |
ad7711 |
bool m_isValid = 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 |
388550 |
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 |
ad7711 |
|
|
shun-iwasawa |
388550 |
~LutCalibrator() {}
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
void onEndDraw(QOpenGLFramebufferObject*);
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
388550 |
void cleanup();
|
|
shun-iwasawa |
388550 |
};
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
class DVAPI LutManager // singleton
|
|
shun-iwasawa |
388550 |
{
|
|
shun-iwasawa |
388550 |
bool m_isValid = false;
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
LutManager();
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
struct Lut {
|
|
shun-iwasawa |
388550 |
int meshSize;
|
|
shun-iwasawa |
388550 |
float* data = NULL;
|
|
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 |
388550 |
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 |
ad7711 |
};
|
|
shun-iwasawa |
ad7711 |
|
|
shun-iwasawa |
ad7711 |
#endif
|