mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
EXR: more standard RGBA channel name detection
Various EXR images especially from movie assets do not simply have "R" etc as channel names; the convention seems to be to have "layer name", ".", "color channel name". For example, channels in EXR might be "rgb.R", "rgb.G", "rgb.B", which RenderDoc was not detecting previously and displaying an all-black image.
This commit is contained in:
committed by
Baldur Karlsson
parent
2357c26651
commit
0baf7b5f49
@@ -758,10 +758,14 @@ void ImageViewer::RefreshFile()
|
||||
return;
|
||||
}
|
||||
|
||||
// Expect R/G/B/A channel names as first char of the string, or
|
||||
// after the last '.' char.
|
||||
int channels[4] = {-1, -1, -1, -1};
|
||||
for(int i = 0; i < exrImage.num_channels; i++)
|
||||
{
|
||||
switch(exrHeader.channels[i].name[0])
|
||||
const char *dotPos = strrchr(exrHeader.channels[i].name, '.');
|
||||
const char *name = dotPos ? dotPos + 1 : exrHeader.channels[i].name;
|
||||
switch(name[0])
|
||||
{
|
||||
case 'R': channels[0] = i; break;
|
||||
case 'G': channels[1] = i; break;
|
||||
|
||||
Reference in New Issue
Block a user