本文整理汇总了C++中KisConfig::ocioLutEdgeSize方法的典型用法代码示例。如果您正苦于以下问题:C++ KisConfig::ocioLutEdgeSize方法的具体用法?C++ KisConfig::ocioLutEdgeSize怎么用?C++ KisConfig::ocioLutEdgeSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisConfig
的用法示例。
在下文中一共展示了KisConfig::ocioLutEdgeSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateProcessor
//.........这里部分代码省略.........
swizzle->setValue(m44, offset);
transform->setChannelView(swizzle);
}
// Post-display transform gamma
{
float exponent = 1.0f/std::max(1e-6f, static_cast<float>(gamma));
const float exponent4f[] = { exponent, exponent, exponent, exponent };
OCIO::ExponentTransformRcPtr expTransform = OCIO::ExponentTransform::Create();
expTransform->setValue(exponent4f);
transform->setDisplayCC(expTransform);
// approximation (no color correction);
approximateTransform->push_back(expTransform);
}
m_processor = config->getProcessor(transform);
m_forwardApproximationProcessor = config->getProcessor(approximateTransform, OCIO::TRANSFORM_DIR_FORWARD);
try {
m_revereseApproximationProcessor = config->getProcessor(approximateTransform, OCIO::TRANSFORM_DIR_INVERSE);
} catch (...) {
warnKrita << "OCIO inverted matrix does not exist!";
//m_revereseApproximationProcessor;
}
#ifdef HAVE_OPENGL
// check whether we are allowed to use shaders -- though that should
// work for everyone these days
KisConfig cfg;
if (!cfg.useOpenGL()) return;
QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
QOpenGLFunctions_3_2_Core *glFuncs3 = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
const int lut3DEdgeSize = cfg.ocioLutEdgeSize();
if (m_lut3d.size() == 0) {
//dbgKrita << "generating lut";
glFuncs.glGenTextures(1, &m_lut3dTexID);
int num3Dentries = 3 * lut3DEdgeSize * lut3DEdgeSize * lut3DEdgeSize;
m_lut3d.fill(0.0, num3Dentries);
glFuncs.glActiveTexture(GL_TEXTURE1);
glFuncs.glBindTexture(GL_TEXTURE_3D, m_lut3dTexID);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFuncs.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glFuncs3->glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16F_ARB,
lut3DEdgeSize, lut3DEdgeSize, lut3DEdgeSize,
0, GL_RGB, GL_FLOAT, &m_lut3d.constData()[0]);
}
// Step 1: Create a GPU Shader Description
OCIO::GpuShaderDesc shaderDesc;
shaderDesc.setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_3);
shaderDesc.setFunctionName("OCIODisplay");
shaderDesc.setLut3DEdgeLen(lut3DEdgeSize);
// Step 2: Compute the 3D LUT
QString lut3dCacheID = QString::fromLatin1(m_processor->getGpuLut3DCacheID(shaderDesc));
if(lut3dCacheID != m_lut3dcacheid)
{
//dbgKrita << "Computing 3DLut " << m_lut3dcacheid;
m_lut3dcacheid = lut3dCacheID;
m_processor->getGpuLut3D(&m_lut3d[0], shaderDesc);
glFuncs.glBindTexture(GL_TEXTURE_3D, m_lut3dTexID);
glFuncs3->glTexSubImage3D(GL_TEXTURE_3D, 0,
0, 0, 0,
lut3DEdgeSize, lut3DEdgeSize, lut3DEdgeSize,
GL_RGB, GL_FLOAT, &m_lut3d[0]);
}
// Step 3: Generate the shader text
QString shaderCacheID = QString::fromLatin1(m_processor->getGpuShaderTextCacheID(shaderDesc));
if (m_program.isEmpty() || shaderCacheID != m_shadercacheid) {
//dbgKrita << "Computing Shader " << m_shadercacheid;
m_shadercacheid = shaderCacheID;
std::ostringstream os;
os << m_processor->getGpuShaderText(shaderDesc) << "\n";
m_program = QString::fromLatin1(os.str().c_str());
}
#endif
}