File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,14 @@ namespace omath::projection
195
195
[[nodiscard]]
196
196
std::expected<Vector3<float >, Error> screen_to_world (const Vector3<float >& screen_pos) const noexcept
197
197
{
198
- return view_port_to_screen (screen_to_dnc (screen_pos));
198
+ return view_port_to_screen (screen_to_ndc (screen_pos));
199
+ }
200
+
201
+ [[nodiscard]]
202
+ std::expected<Vector3<float >, Error> screen_to_world (const Vector2<float >& screen_pos) const noexcept
203
+ {
204
+ const auto & [x, y] = screen_pos;
205
+ return screen_to_world ({x, y, 1 .f });
199
206
}
200
207
201
208
protected:
@@ -234,7 +241,7 @@ namespace omath::projection
234
241
return {(ndc.x + 1 .f ) / 2 .f * m_view_port.m_width , (1 .f - ndc.y ) / 2 .f * m_view_port.m_height , ndc.z };
235
242
}
236
243
237
- [[nodiscard]] Vector3<float > screen_to_dnc (const Vector3<float >& screen_pos) const noexcept
244
+ [[nodiscard]] Vector3<float > screen_to_ndc (const Vector3<float >& screen_pos) const noexcept
238
245
{
239
246
return {screen_pos.x / m_view_port.m_width * 2 .f - 1 .f , 1 .f - screen_pos.y / m_view_port.m_height * 2 .f ,
240
247
screen_pos.z };
You can’t perform that action at this time.
0 commit comments