backend color management on viewer

This commit is contained in:
itsmattkc
2019-08-30 00:19:11 +10:00
parent b8d46eeb34
commit a0484bf43e
5 changed files with 64 additions and 8 deletions
+14 -2
View File
@@ -4,13 +4,25 @@
ColorService::ColorService(const char* source_space, const char* dest_space)
{
// FIXME: Hardcoded values for testing purposes
OCIO::ConstConfigRcPtr config = OCIO::Config::CreateFromFile("/run/media/matt/Home/OpenColorIO/ocio.configs.0.7v4/nuke-default/config.ocio");
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
processor = config->getProcessor(source_space,
dest_space);
}
void ColorService::Init()
{
// FIXME: Hardcoded values for testing purposes
OCIO::ConstConfigRcPtr config = OCIO::Config::CreateFromFile("/run/media/matt/Home/OpenColorIO/ocio.configs.0.7v4/nuke-default/config.ocio");
OCIO::SetCurrentConfig(config);
}
ColorServicePtr ColorService::Create(const char *source_space, const char *dest_space)
{
return std::make_shared<ColorService>(source_space, dest_space);
}
void ColorService::ConvertFrame(FramePtr f)
{
OCIO::PackedImageDesc img(reinterpret_cast<float*>(f->data()), f->width(), f->height(), kRGBAChannels);
+7 -2
View File
@@ -8,11 +8,18 @@ namespace OCIO = OCIO_NAMESPACE::v1;
#include "decoder/frame.h"
#include "render/gl/shadergenerators.h"
class ColorService;
using ColorServicePtr = std::shared_ptr<ColorService>;
class ColorService
{
public:
ColorService(const char *source_space, const char *dest_space);
static void Init();
static ColorServicePtr Create(const char *source_space, const char *dest_space);
void ConvertFrame(FramePtr f);
OCIO::ConstProcessorRcPtr GetProcessor();
@@ -21,6 +28,4 @@ private:
OCIO::ConstProcessorRcPtr processor;
};
using ColorServicePtr = std::shared_ptr<ColorService>;
#endif // COLORSERVICE_H