PBRT
|
00001 00002 // 00003 // Copyright (c) 2007, Weta Digital Ltd 00004 // 00005 // All rights reserved. 00006 // 00007 // Redistribution and use in source and binary forms, with or without 00008 // modification, are permitted provided that the following conditions are 00009 // met: 00010 // * Redistributions of source code must retain the above copyright 00011 // notice, this list of conditions and the following disclaimer. 00012 // * Redistributions in binary form must reproduce the above 00013 // copyright notice, this list of conditions and the following disclaimer 00014 // in the documentation and/or other materials provided with the 00015 // distribution. 00016 // * Neither the name of Weta Digital nor the names of 00017 // its contributors may be used to endorse or promote products derived 00018 // from this software without specific prior written permission. 00019 // 00020 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00023 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00024 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 // 00033 00034 00035 #ifndef INCLUDED_IMF_MULTIVIEW_H 00036 #define INCLUDED_IMF_MULTIVIEW_H 00037 00038 #include <ImfChannelList.h> 00039 #include <ImfStringVectorAttribute.h> 00040 00041 //----------------------------------------------------------------------------- 00042 // 00043 // Functions related to accessing channels and views in multi-view 00044 // OpenEXR files. 00045 // 00046 // A multi-view image file contains two or more views of the same 00047 // scene, as seen from different viewpoints, for example, a left-eye 00048 // and a right-eye view for stereo displays. Each view has its own 00049 // set of image channels. A naming convention identifies the channels 00050 // that belong to a given view. 00051 // 00052 // A "multiView" attribute in the file header lists the names of the 00053 // views in an image (see ImfStandardAttributes.h), and channel names 00054 // of the form 00055 // 00056 // layer.view.channel 00057 // 00058 // allow channels to be matched with views. 00059 // 00060 // For compatibility with singe-view images, the first view listed in 00061 // the multiView attribute is the "default view", and channels that 00062 // have no periods in their names are considered part of the default 00063 // view. 00064 // 00065 // For example, if a file's multiView attribute lists the views 00066 // "left" and "right", in that order, then "left" is the default 00067 // view. Channels 00068 // 00069 // "R", "left.Z", "diffuse.left.R" 00070 // 00071 // are part of the "left" view; channels 00072 // 00073 // "right.R", "right.Z", "diffuse.right.R" 00074 // 00075 // are part of the "right" view; and channels 00076 // 00077 // "tmp.R", "right.diffuse.R", "diffuse.tmp.R" 00078 // 00079 // belong to no view at all. 00080 // 00081 //----------------------------------------------------------------------------- 00082 00083 namespace Imf { 00084 00085 // 00086 // Return the name of the default view given a multi-view string vector, 00087 // that is, return the first element of the string vector. If the string 00088 // vector is empty, return "". 00089 // 00090 00091 std::string defaultViewName (const StringVector &multiView); 00092 00093 00094 // 00095 // Given the name of a channel, return the name of the view to 00096 // which it belongs. Returns the empty string ("") if the channel 00097 // is not a member of any named view. 00098 // 00099 00100 std::string viewFromChannelName (const std::string &channel, 00101 const StringVector &multiView); 00102 00103 00104 // 00105 // Return whether channel1 and channel2 are the same channel but 00106 // viewed in different views. (Return false if either channel 00107 // belongs to no view or if both channels belong to the same view.) 00108 // 00109 00110 bool areCounterparts (const std::string &channel1, 00111 const std::string &channel2, 00112 const StringVector &multiView); 00113 00114 // 00115 // Return a list of all channels belonging to view viewName. 00116 // 00117 00118 ChannelList channelsInView (const std::string &viewName, 00119 const ChannelList &channelList, 00120 const StringVector &multiView); 00121 00122 // 00123 // Return a list of channels not associated with any view. 00124 // 00125 00126 ChannelList channelsInNoView (const ChannelList &channelList, 00127 const StringVector &multiView); 00128 00129 // 00130 // Given the name of a channel, return a list of the same channel 00131 // in all views (for example, given X.left.Y return X.left.Y, 00132 // X.right.Y, X.centre.Y, etc.). 00133 // 00134 00135 ChannelList channelInAllViews (const std::string &channame, 00136 const ChannelList &channelList, 00137 const StringVector &multiView); 00138 00139 // 00140 // Given the name of a channel in one view, return the corresponding 00141 // channel name for view otherViewName. Return "" if no corresponding 00142 // channel exists in view otherViewName, or if view otherViewName doesn't 00143 // exist. 00144 // 00145 00146 std::string channelInOtherView (const std::string &channel, 00147 const ChannelList &channelList, 00148 const StringVector &multiView, 00149 const std::string &otherViewName); 00150 00151 // 00152 // Given a channel name that does not include a view name, insert 00153 // multiView[i] into the channel name at the appropriate location. 00154 // If i is zero and the channel name contains no periods, then do 00155 // not insert the view name. 00156 // 00157 00158 std::string insertViewName (const std::string &channel, 00159 const StringVector &multiView, 00160 int i); 00161 00162 } // namespace Imf 00163 00164 #endif