MaterialX 1.38.2
Harmonics.h
Go to the documentation of this file.
1//
2// TM & (c) 2019 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
3// All rights reserved. See LICENSE.txt for license.
4//
5
6#ifndef MATERIALX_HARMONICS_H
7#define MATERIALX_HARMONICS_H
8
11
15
16namespace MaterialX
17{
18
23template <class C, size_t B> class ShCoeffs
24{
25 public:
26 static const size_t NUM_BANDS = B;
27 static const size_t NUM_COEFFS = B * B;
28
29 public:
30 ShCoeffs() { }
31 explicit ShCoeffs(const std::array<C, NUM_COEFFS>& arr) : _arr(arr) { }
32 ~ShCoeffs() { }
33
36
38 bool operator==(const ShCoeffs& rhs) const { return _arr == rhs._arr; }
39
41 bool operator!=(const ShCoeffs& rhs) const { return _arr != rhs._arr; }
42
46
48 C& operator[](size_t i) { return _arr.at(i); }
49
51 const C& operator[](size_t i) const { return _arr.at(i); }
52
54
55 protected:
56 std::array<C, NUM_COEFFS> _arr;
57};
58
61
64
71MX_RENDER_API Sh3ColorCoeffs projectEnvironment(ConstImagePtr env, bool irradiance = false);
72
78MX_RENDER_API ImagePtr normalizeEnvironment(ConstImagePtr env, float envRadiance, float maxTexelRadiance);
79
84MX_RENDER_API void computeDominantLight(ConstImagePtr env, Vector3& lightDir, Color3& lightColor);
85
91MX_RENDER_API ImagePtr renderEnvironment(const Sh3ColorCoeffs& shEnv, unsigned int width, unsigned int height);
92
99MX_RENDER_API ImagePtr renderReferenceIrradiance(ConstImagePtr env, unsigned int width, unsigned int height);
100
101} // namespace MaterialX
102
103#endif
Image class.
shared_ptr< const Image > ConstImagePtr
A shared pointer to a const image.
Definition: Image.h:27
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:24
Macros for declaring imported and exported symbols.
Data types for rendering functionality.
A three-component color value.
Definition: Types.h:376
Class template for a vector of spherical harmonic coefficients.
Definition: Harmonics.h:24
const C & operator[](size_t i) const
Return the const coefficient at the given index.
Definition: Harmonics.h:51
C & operator[](size_t i)
Return the coefficient at the given index.
Definition: Harmonics.h:48
bool operator!=(const ShCoeffs &rhs) const
Return true if the given vector differs from this one.
Definition: Harmonics.h:41
bool operator==(const ShCoeffs &rhs) const
Return true if the given vector is identical to this one.
Definition: Harmonics.h:38
A vector of three floating-point values.
Definition: Types.h:303