util_ies.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2011-2018 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __UTIL_IES_H__
  17. #define __UTIL_IES_H__
  18. #include "util/util_param.h"
  19. #include "util/util_vector.h"
  20. CCL_NAMESPACE_BEGIN
  21. class IESFile {
  22. public:
  23. IESFile()
  24. {
  25. }
  26. ~IESFile();
  27. int packed_size();
  28. void pack(float *data);
  29. bool load(ustring ies);
  30. void clear();
  31. protected:
  32. bool parse(ustring ies);
  33. bool process();
  34. bool process_type_b();
  35. bool process_type_c();
  36. /* The brightness distribution is stored in spherical coordinates.
  37. * The horizontal angles correspond to theta in the regular notation
  38. * and always span the full range from 0° to 360°.
  39. * The vertical angles correspond to phi and always start at 0°. */
  40. vector<float> v_angles, h_angles;
  41. /* The actual values are stored here, with every entry storing the values
  42. * of one horizontal segment. */
  43. vector<vector<float>> intensity;
  44. /* Types of angle representation in IES files. Currently, only B and C are supported. */
  45. enum IESType { TYPE_A = 3, TYPE_B = 2, TYPE_C = 1 } type;
  46. };
  47. CCL_NAMESPACE_END
  48. #endif /* __UTIL_IES_H__ */