Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/openexr/openexr_api.cpp
| Show First 20 Lines • Show All 1,751 Lines • ▼ Show 20 Lines | static bool exr_has_zbuffer(MultiPartInputFile &file) | ||||
| return !(file.header(0).channels().findChannel("Z") == NULL); | return !(file.header(0).channels().findChannel("Z") == NULL); | ||||
| } | } | ||||
| static bool exr_has_alpha(MultiPartInputFile &file) | static bool exr_has_alpha(MultiPartInputFile &file) | ||||
| { | { | ||||
| return !(file.header(0).channels().findChannel("A") == NULL); | return !(file.header(0).channels().findChannel("A") == NULL); | ||||
| } | } | ||||
| static bool exr_is_half_float(MultiPartInputFile &file) | |||||
| { | |||||
| const ChannelList &channels = file.header(0).channels(); | |||||
| for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) { | |||||
| const Channel &channel = i.channel(); | |||||
| if (channel.type != HALF) { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static bool imb_exr_is_multilayer_file(MultiPartInputFile &file) | static bool imb_exr_is_multilayer_file(MultiPartInputFile &file) | ||||
| { | { | ||||
| const ChannelList &channels = file.header(0).channels(); | const ChannelList &channels = file.header(0).channels(); | ||||
| std::set<std::string> layerNames; | std::set<std::string> layerNames; | ||||
| /* This will not include empty layer names, so files with just R/G/B/A | /* This will not include empty layer names, so files with just R/G/B/A | ||||
| * channels without a layer name will be single layer. */ | * channels without a layer name will be single layer. */ | ||||
| channels.layers(layerNames); | channels.layers(layerNames); | ||||
| ▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | try { | ||||
| /* do not make an ibuf when */ | /* do not make an ibuf when */ | ||||
| if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) { | if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) { | ||||
| printf("Error: can't process EXR multilayer file\n"); | printf("Error: can't process EXR multilayer file\n"); | ||||
| } | } | ||||
| else { | else { | ||||
| const int is_alpha = exr_has_alpha(*file); | const int is_alpha = exr_has_alpha(*file); | ||||
| ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0); | ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0); | ||||
| ibuf->flags |= exr_is_half_float(*file) ? IB_halffloat : 0; | |||||
| if (hasXDensity(file->header(0))) { | if (hasXDensity(file->header(0))) { | ||||
| ibuf->ppm[0] = xDensity(file->header(0)) * 39.3700787f; | ibuf->ppm[0] = xDensity(file->header(0)) * 39.3700787f; | ||||
| ibuf->ppm[1] = ibuf->ppm[0] * (double)file->header(0).pixelAspectRatio(); | ibuf->ppm[1] = ibuf->ppm[0] * (double)file->header(0).pixelAspectRatio(); | ||||
| } | } | ||||
| ibuf->ftype = IMB_FTYPE_OPENEXR; | ibuf->ftype = IMB_FTYPE_OPENEXR; | ||||
| ▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines | |||||