Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SphericalMapper.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <Common/assertion.h>
6
7namespace ph
8{
9
11{
12public:
13 void posToUvw(const math::Vector3R& pos, math::Vector3R* out_uvw) const override;
14 void dirToUvw(const math::Vector3R& dir, math::Vector3R* out_uvw) const override;
15 bool uvwToPos(const math::Vector3R& uvw, math::Vector3R* out_pos) const override;
16 bool uvwToDir(const math::Vector3R& uvw, math::Vector3R* out_dir) const override;
17};
18
19// In-header Implementations:
20
21inline void SphericalMapper::posToUvw(const math::Vector3R& pos, math::Vector3R* const out_uvw) const
22{
23 PH_ASSERT(out_uvw);
24
25 // HACK: magic number
26 if(pos.lengthSquared() < 1e-8)
27 {
28 out_uvw->set({0, 0, 0});
29 return;
30 }
31
32 dirToUvw(pos, out_uvw);
33}
34
35inline bool SphericalMapper::uvwToPos(const math::Vector3R& uvw, math::Vector3R* const out_pos) const
36{
37 return false;
38}
39
40}// end namespace ph
Definition SphericalMapper.h:11
void dirToUvw(const math::Vector3R &dir, math::Vector3R *out_uvw) const override
Definition SphericalMapper.cpp:11
bool uvwToPos(const math::Vector3R &uvw, math::Vector3R *out_pos) const override
Definition SphericalMapper.h:35
bool uvwToDir(const math::Vector3R &uvw, math::Vector3R *out_dir) const override
Definition SphericalMapper.cpp:30
void posToUvw(const math::Vector3R &pos, math::Vector3R *out_uvw) const override
Definition SphericalMapper.h:21
Definition UvwMapper.h:10
Derived & set(T value)
Definition TArithmeticArrayBase.ipp:604
T lengthSquared() const
Definition TVectorNBase.ipp:44
The root for all renderer implementations.
Definition EEngineProject.h:6