HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_FileIES.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: IMG_FileIES.h ( IMG Library, C++)
7  *
8  * COMMENTS: Class to read/write IES format. Images loaded from IES
9  * format will show only the candela values, not the angles.
10  * To map from a direction vector to an image pixel
11  * coordinate, use the getEnvCoord() method. Specification
12  * for this file format are located here:
13  *
14  * http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html
15  */
16 
17 #ifndef __IMG_FileIES__
18 #define __IMG_FileIES__
19 
20 #include "IMG_API.h"
21 #include "IMG_File.h"
22 
23 class IMG_API IMG_FileIES : public IMG_File {
24 public:
25  IMG_FileIES();
26  ~IMG_FileIES();
27 
28  static void registerFormat();
29 
30  virtual int open();
31  virtual int readScanline(int y, void *buf);
32  virtual int writeScanline(int y, const void *buf);
33 
34  virtual int closeFile();
35 
36  // This operation converts a direction vector to the IES image
37  // coordinates based on the angles specified in the file.
38  void getEnvCoord(const UT_Vector3 &r, float &u, float &v) const;
39 
40 private:
41  // Helper to construct the actual pixel data for filtering. This
42  // method handles the different symmetry types at load time so that
43  // image filtering can be performed without seams.
44  void buildImageData();
45 
46 private:
47  struct Header {
48  // Line 10
49  int myNLamps;
50  float myLumensPerLamp;
51  float myCandelaMultiplier;
52  int myVerticalAngles;
53  int myHorizontalAngles;
54  int myPhotometricType;
55  int myUnitsType;
56  float myWidth;
57  float myLength;
58  float myHeight;
59 
60  // Line 11
61  float myBallastFactor;
62  float myBallastPhotometricFactor;
63  float myInputWatts;
64  };
65 
66  UT_String myFormat;
67  UT_String myTilt;
68  Header myHeader;
69  UT_FloatArray myVerticalAngles;
70  UT_FloatArray myHorizontalAngles;
71  UT_FloatArray myData;
72 
73  // IES file data processed into an angle-parameterized sphere map
74  UT_FloatArray myXAngles;
75  UT_FloatArray myYAngles;
76  UT_FloatArray myImageData;
77  int myXRes;
78  int myYRes;
79 };
80 
81 #endif
82 
const GLdouble * v
Definition: glcorearb.h:836
virtual int readScanline(int scanline, void *data)=0
virtual int closeFile()=0
GLint y
Definition: glcorearb.h:102
virtual int writeScanline(int scanline, const void *data)=0
Header(int width=64, int height=64, float pixelAspectRatio=1, const IMATH_NAMESPACE::V2f &screenWindowCenter=IMATH_NAMESPACE::V2f(0, 0), float screenWindowWidth=1, LineOrder lineOrder=INCREASING_Y, Compression=ZIP_COMPRESSION)
#define IMG_API
Definition: IMG_API.h:10
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:54
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
virtual int open()
Only called by format class.
GLboolean r
Definition: glcorearb.h:1221