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() override;
27 
28  static void registerFormat();
29 
30  int open() override;
31  int readScanline(int y, void *buf) override;
32  int writeScanline(int y, const void *buf) override;
33 
34  int closeFile() override;
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  // mode 1: normalize using maximum value in the table (mantra-style)
41  // mode 2: normalize to preserve light's energy output
42  float getNormalization(int mode) const { return myScaler[mode]; }
43 
44 private:
45  // Helper to construct the actual pixel data for filtering. This
46  // method handles the different symmetry types at load time so that
47  // image filtering can be performed without seams.
48  void buildImageData();
49 
50 private:
51  struct Header {
52  // Line 10
53  int myNLamps;
54  float myLumensPerLamp;
55  float myCandelaMultiplier;
56  int myVerticalAngles;
57  int myHorizontalAngles;
58  int myPhotometricType;
59  int myUnitsType;
60  float myWidth;
61  float myLength;
62  float myHeight;
63 
64  // Line 11
65  float myBallastFactor;
66  float myBallastPhotometricFactor;
67  float myInputWatts;
68  };
69 
70  UT_String myFormat;
71  UT_String myTilt;
72  Header myHeader;
73  UT_FloatArray myVerticalAngles;
74  UT_FloatArray myHorizontalAngles;
75  UT_FloatArray myData;
76 
77  // IES file data processed into an angle-parameterized sphere map
78  UT_FloatArray myXAngles;
79  UT_FloatArray myYAngles;
80  UT_FloatArray myImageData;
81  int myXRes;
82  int myYRes;
83  float myScaler[3];
84 };
85 
86 #endif
87 
virtual int readScanline(int scanline, void *data)=0
virtual int closeFile()=0
float getNormalization(int mode) const
Definition: IMG_FileIES.h:42
virtual int writeScanline(int scanline, const void *data)=0
#define IMG_API
Definition: IMG_API.h:10
const GLdouble * v
Definition: glcorearb.h:836
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:56
GLenum mode
Definition: glcorearb.h:98
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
GLint y
Definition: glcorearb.h:102