PBRT
|
00001 00002 // 00003 // Copyright (c) 2004, Industrial Light & Magic, a division of Lucas 00004 // Digital Ltd. LLC 00005 // 00006 // All rights reserved. 00007 // 00008 // Redistribution and use in source and binary forms, with or without 00009 // modification, are permitted provided that the following conditions are 00010 // met: 00011 // * Redistributions of source code must retain the above copyright 00012 // notice, this list of conditions and the following disclaimer. 00013 // * Redistributions in binary form must reproduce the above 00014 // copyright notice, this list of conditions and the following disclaimer 00015 // in the documentation and/or other materials provided with the 00016 // distribution. 00017 // * Neither the name of Industrial Light & Magic nor the names of 00018 // its contributors may be used to endorse or promote products derived 00019 // from this software without specific prior written permission. 00020 // 00021 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 // 00034 00035 00036 #ifndef INCLUDED_IMF_STANDARD_ATTRIBUTES_H 00037 #define INCLUDED_IMF_STANDARD_ATTRIBUTES_H 00038 00039 //----------------------------------------------------------------------------- 00040 // 00041 // Optional Standard Attributes -- these attributes are "optional" 00042 // because not every image file header has them, but they define a 00043 // "standard" way to represent commonly used data in the file header. 00044 // 00045 // For each attribute, with name "foo", and type "T", the following 00046 // functions are automatically generated via macros: 00047 // 00048 // void addFoo (Header &header, const T &value); 00049 // bool hasFoo (const Header &header); 00050 // const TypedAttribute<T> & fooAttribute (const Header &header); 00051 // TypedAttribute<T> & fooAttribute (Header &header); 00052 // const T & foo (const Header &Header); 00053 // T & foo (Header &Header); 00054 // 00055 //----------------------------------------------------------------------------- 00056 00057 #include <ImfHeader.h> 00058 #include <ImfChromaticitiesAttribute.h> 00059 #include <ImfEnvmapAttribute.h> 00060 #include <ImfFloatAttribute.h> 00061 #include <ImfKeyCodeAttribute.h> 00062 #include <ImfMatrixAttribute.h> 00063 #include <ImfRationalAttribute.h> 00064 #include <ImfStringAttribute.h> 00065 #include <ImfStringVectorAttribute.h> 00066 #include <ImfTimeCodeAttribute.h> 00067 #include <ImfVecAttribute.h> 00068 00069 #define IMF_STD_ATTRIBUTE_DEF(name,suffix,type) \ 00070 \ 00071 void add##suffix (Header &header, const type &v); \ 00072 bool has##suffix (const Header &header); \ 00073 const TypedAttribute<type> & name##Attribute (const Header &header); \ 00074 TypedAttribute<type> & name##Attribute (Header &header); \ 00075 const type & name (const Header &header); \ 00076 type & name (Header &header); 00077 00078 00079 namespace Imf { 00080 00081 // 00082 // chromaticities -- for RGB images, specifies the CIE (x,y) 00083 // chromaticities of the primaries and the white point 00084 // 00085 00086 IMF_STD_ATTRIBUTE_DEF (chromaticities, Chromaticities, Chromaticities) 00087 00088 00089 // 00090 // whiteLuminance -- for RGB images, defines the luminance, in Nits 00091 // (candelas per square meter) of the RGB value (1.0, 1.0, 1.0). 00092 // 00093 // If the chromaticities and the whiteLuminance of an RGB image are 00094 // known, then it is possible to convert the image's pixels from RGB 00095 // to CIE XYZ tristimulus values (see function RGBtoXYZ() in header 00096 // file ImfChromaticities.h). 00097 // 00098 // 00099 00100 IMF_STD_ATTRIBUTE_DEF (whiteLuminance, WhiteLuminance, float) 00101 00102 00103 // 00104 // adoptedNeutral -- specifies the CIE (x,y) coordinates that should 00105 // be considered neutral during color rendering. Pixels in the image 00106 // file whose (x,y) coordinates match the adoptedNeutral value should 00107 // be mapped to neutral values on the display. 00108 // 00109 00110 IMF_STD_ATTRIBUTE_DEF (adoptedNeutral, AdoptedNeutral, Imath::V2f) 00111 00112 00113 // 00114 // renderingTransform, lookModTransform -- specify the names of the 00115 // CTL functions that implements the intended color rendering and look 00116 // modification transforms for this image. 00117 // 00118 00119 IMF_STD_ATTRIBUTE_DEF (renderingTransform, RenderingTransform, std::string) 00120 IMF_STD_ATTRIBUTE_DEF (lookModTransform, LookModTransform, std::string) 00121 00122 00123 // 00124 // xDensity -- horizontal output density, in pixels per inch. 00125 // The image's vertical output density is xDensity * pixelAspectRatio. 00126 // 00127 00128 IMF_STD_ATTRIBUTE_DEF (xDensity, XDensity, float) 00129 00130 00131 // 00132 // owner -- name of the owner of the image 00133 // 00134 00135 IMF_STD_ATTRIBUTE_DEF (owner, Owner, std::string) 00136 00137 00138 // 00139 // comments -- additional image information in human-readable 00140 // form, for example a verbal description of the image 00141 // 00142 00143 IMF_STD_ATTRIBUTE_DEF (comments, Comments, std::string) 00144 00145 00146 // 00147 // capDate -- the date when the image was created or captured, 00148 // in local time, and formatted as 00149 // 00150 // YYYY:MM:DD hh:mm:ss 00151 // 00152 // where YYYY is the year (4 digits, e.g. 2003), MM is the month 00153 // (2 digits, 01, 02, ... 12), DD is the day of the month (2 digits, 00154 // 01, 02, ... 31), hh is the hour (2 digits, 00, 01, ... 23), mm 00155 // is the minute, and ss is the second (2 digits, 00, 01, ... 59). 00156 // 00157 // 00158 00159 IMF_STD_ATTRIBUTE_DEF (capDate, CapDate, std::string) 00160 00161 00162 // 00163 // utcOffset -- offset of local time at capDate from 00164 // Universal Coordinated Time (UTC), in seconds: 00165 // 00166 // UTC == local time + utcOffset 00167 // 00168 00169 IMF_STD_ATTRIBUTE_DEF (utcOffset, UtcOffset, float) 00170 00171 00172 // 00173 // longitude, latitude, altitude -- for images of real objects, the 00174 // location where the image was recorded. Longitude and latitude are 00175 // in degrees east of Greenwich and north of the equator. Altitude 00176 // is in meters above sea level. For example, Kathmandu, Nepal is 00177 // at longitude 85.317, latitude 27.717, altitude 1305. 00178 // 00179 00180 IMF_STD_ATTRIBUTE_DEF (longitude, Longitude, float) 00181 IMF_STD_ATTRIBUTE_DEF (latitude, Latitude, float) 00182 IMF_STD_ATTRIBUTE_DEF (altitude, Altitude, float) 00183 00184 00185 // 00186 // focus -- the camera's focus distance, in meters 00187 // 00188 00189 IMF_STD_ATTRIBUTE_DEF (focus, Focus, float) 00190 00191 00192 // 00193 // exposure -- exposure time, in seconds 00194 // 00195 00196 IMF_STD_ATTRIBUTE_DEF (expTime, ExpTime, float) 00197 00198 00199 // 00200 // aperture -- the camera's lens aperture, in f-stops (focal length 00201 // of the lens divided by the diameter of the iris opening) 00202 // 00203 00204 IMF_STD_ATTRIBUTE_DEF (aperture, Aperture, float) 00205 00206 00207 // 00208 // isoSpeed -- the ISO speed of the film or image sensor 00209 // that was used to record the image 00210 // 00211 00212 IMF_STD_ATTRIBUTE_DEF (isoSpeed, IsoSpeed, float) 00213 00214 00215 // 00216 // envmap -- if this attribute is present, the image represents 00217 // an environment map. The attribute's value defines how 3D 00218 // directions are mapped to 2D pixel locations. For details 00219 // see header file ImfEnvmap.h 00220 // 00221 00222 IMF_STD_ATTRIBUTE_DEF (envmap, Envmap, Envmap) 00223 00224 00225 // 00226 // keyCode -- for motion picture film frames. Identifies film 00227 // manufacturer, film type, film roll and frame position within 00228 // the roll. 00229 // 00230 00231 IMF_STD_ATTRIBUTE_DEF (keyCode, KeyCode, KeyCode) 00232 00233 00234 // 00235 // timeCode -- time and control code 00236 // 00237 00238 IMF_STD_ATTRIBUTE_DEF (timeCode, TimeCode, TimeCode) 00239 00240 00241 // 00242 // wrapmodes -- determines how texture map images are extrapolated. 00243 // If an OpenEXR file is used as a texture map for 3D rendering, 00244 // texture coordinates (0.0, 0.0) and (1.0, 1.0) correspond to 00245 // the upper left and lower right corners of the data window. 00246 // If the image is mapped onto a surface with texture coordinates 00247 // outside the zero-to-one range, then the image must be extrapolated. 00248 // This attribute tells the renderer how to do this extrapolation. 00249 // The attribute contains either a pair of comma-separated keywords, 00250 // to specify separate extrapolation modes for the horizontal and 00251 // vertical directions; or a single keyword, to specify extrapolation 00252 // in both directions (e.g. "clamp,periodic" or "clamp"). Extra white 00253 // space surrounding the keywords is allowed, but should be ignored 00254 // by the renderer ("clamp, black " is equivalent to "clamp,black"). 00255 // The keywords listed below are predefined; some renderers may support 00256 // additional extrapolation modes: 00257 // 00258 // black pixels outside the zero-to-one range are black 00259 // 00260 // clamp texture coordinates less than 0.0 and greater 00261 // than 1.0 are clamped to 0.0 and 1.0 respectively 00262 // 00263 // periodic the texture image repeats periodically 00264 // 00265 // mirror the texture image repeats periodically, but 00266 // every other instance is mirrored 00267 // 00268 00269 IMF_STD_ATTRIBUTE_DEF (wrapmodes, Wrapmodes, std::string) 00270 00271 00272 // 00273 // framesPerSecond -- defines the nominal playback frame rate for image 00274 // sequences, in frames per second. Every image in a sequence should 00275 // have a framesPerSecond attribute, and the attribute value should be 00276 // the same for all images in the sequence. If an image sequence has 00277 // no framesPerSecond attribute, playback software should assume that 00278 // the frame rate for the sequence is 24 frames per second. 00279 // 00280 // In order to allow exact representation of NTSC frame and field rates, 00281 // framesPerSecond is stored as a rational number. A rational number is 00282 // a pair of integers, n and d, that represents the value n/d. 00283 // 00284 // For the exact values of commonly used frame rates, please see header 00285 // file ImfFramesPerSecond.h. 00286 // 00287 00288 IMF_STD_ATTRIBUTE_DEF (framesPerSecond, FramesPerSecond, Rational) 00289 00290 00291 // 00292 // multiView -- defines the view names for multi-view image files. 00293 // A multi-view image contains two or more views of the same scene, 00294 // as seen from different viewpoints, for example a left-eye and 00295 // a right-eye view for stereo displays. The multiView attribute 00296 // lists the names of the views in an image, and a naming convention 00297 // identifies the channels that belong to each view. 00298 // 00299 // For details, please see header file ImfMultiView.h 00300 // 00301 00302 IMF_STD_ATTRIBUTE_DEF (multiView , MultiView, StringVector) 00303 00304 00305 // 00306 // worldToCamera -- for images generated by 3D computer graphics rendering, 00307 // a matrix that transforms 3D points from the world to the camera coordinate 00308 // space of the renderer. 00309 // 00310 // The camera coordinate space is left-handed. Its origin indicates the 00311 // location of the camera. The positive x and y axes correspond to the 00312 // "right" and "up" directions in the rendered image. The positive z 00313 // axis indicates the camera's viewing direction. (Objects in front of 00314 // the camera have positive z coordinates.) 00315 // 00316 // Camera coordinate space in OpenEXR is the same as in Pixar's Renderman. 00317 // 00318 00319 IMF_STD_ATTRIBUTE_DEF (worldToCamera, WorldToCamera, Imath::M44f) 00320 00321 00322 // 00323 // worldToNDC -- for images generated by 3D computer graphics rendering, a 00324 // matrix that transforms 3D points from the world to the Normalized Device 00325 // Coordinate (NDC) space of the renderer. 00326 // 00327 // NDC is a 2D coordinate space that corresponds to the image plane, with 00328 // positive x and pointing to the right and y positive pointing down. The 00329 // coordinates (0, 0) and (1, 1) correspond to the upper left and lower right 00330 // corners of the OpenEXR display window. 00331 // 00332 // To transform a 3D point in word space into a 2D point in NDC space, 00333 // multiply the 3D point by the worldToNDC matrix and discard the z 00334 // coordinate. 00335 // 00336 // NDC space in OpenEXR is the same as in Pixar's Renderman. 00337 // 00338 00339 IMF_STD_ATTRIBUTE_DEF (worldToNDC, WorldToNDC, Imath::M44f) 00340 00341 } // namespace Imf 00342 00343 #endif