File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 472472 // background color must be converted to linear before being set as the clear color.
473473 // On OpenGL (Windows), the background is stored directly in a non-linear framebuffer
474474 // and no conversion is needed.
475- auto srgbToLinear = [](float srgb) -> float {
476- if (srgb <= 0 .04045f )
477- return srgb / 12 .92f ;
478- else
479- return std::pow ((srgb + 0 .055f ) / 1 .055f , 2 .4f );
480- };
475+ mx::Color3 bgLinear = mx::Color3 (_viewer->m_background [0 ],
476+ _viewer->m_background [1 ],
477+ _viewer->m_background [2 ]).srgbToLinear ();
481478
482479 [renderpassDesc.colorAttachments[0 ] setClearColor: MTLClearColorMake (
483- srgbToLinear (_viewer->m_background [0 ]) ,
484- srgbToLinear (_viewer->m_background [1 ]) ,
485- srgbToLinear (_viewer->m_background [2 ]) ,
480+ bgLinear [0 ],
481+ bgLinear [1 ],
482+ bgLinear [2 ],
486483 _viewer->m_background[3 ])];
487484 [renderpassDesc.colorAttachments[0 ] setLoadAction: MTLLoadActionClear ];
488485 [renderpassDesc.colorAttachments[0 ] setStoreAction: MTLStoreActionStore ];
You can’t perform that action at this time.
0 commit comments