MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / LookAt

Function LookAt

engine/Poseidon/Graphics/Shadow/ShadowMath.cpp:147–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147Mat4 LookAt(const Vec3& eye, const Vec3& center, const Vec3& up)
148{
149 Vec3 f = Normalize(center - eye);
150 Vec3 s = Normalize(Cross(f, up));
151 Vec3 u = Cross(s, f);
152
153 Mat4 r = Identity();
154 r.at(0, 0) = s.x;
155 r.at(0, 1) = s.y;
156 r.at(0, 2) = s.z;
157 r.at(1, 0) = u.x;
158 r.at(1, 1) = u.y;
159 r.at(1, 2) = u.z;
160 r.at(2, 0) = -f.x;
161 r.at(2, 1) = -f.y;
162 r.at(2, 2) = -f.z;
163 r.at(0, 3) = -Dot(s, eye);
164 r.at(1, 3) = -Dot(u, eye);
165 r.at(2, 3) = Dot(f, eye);
166 return r;
167}
168
169Mat4 Ortho(float l, float r, float b, float t, float n, float f)
170{

Callers 4

LightViewFunction · 0.85
BuildRoofSceneFunction · 0.85
CameraInvVPFunction · 0.85

Calls 5

NormalizeFunction · 0.85
CrossFunction · 0.85
IdentityFunction · 0.85
DotFunction · 0.85
atMethod · 0.80

Tested by 2

BuildRoofSceneFunction · 0.68
CameraInvVPFunction · 0.68