MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / rgbe2vec3f

Function rgbe2vec3f

openpgl/include/openpgl/compression.h:53–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51/* in the range [0,1] to map back into the range [0,1]. */
52
53inline pgl_vec3f rgbe2vec3f(const uint32_t rgbe)
54{
55 pgl_vec3f rgb;
56 const unsigned char *rgbe_ptr = (const unsigned char *)&rgbe;
57
58 if (rgbe_ptr[3])
59 { // nonzero pixel
60 const float f = std::ldexp(1.0f, rgbe_ptr[3] - (int)(128 + 8));
61 rgb.x = rgbe_ptr[0] * f;
62 rgb.y = rgbe_ptr[1] * f;
63 rgb.z = rgbe_ptr[2] * f;
64 }
65 else
66 {
67 rgb.x = rgb.y = rgb.z = 0.f;
68 }
69 return rgb;
70}
71
72////////////////////////////////////////////////////////////////////////
73// Directional 32-Bit compression based on octahdral maps

Callers 1

pgl_spectrumClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected