\ Re: Untitled - /g/pasta 2.4
From Round Monkey, 5 Years ago, written in C++.
This paste will in 1 Second.
This paste is a reply to Untitled from Soft Camel
- view diff
Embed
  1.         Vector2 screenToWorld(const Vector2& point)
  2.         {
  3.                 Vector2 view       = Renderer::get()->getScreenSize();
  4.                 Vector2 normalized = Vector2( -1.0f + 2.0f * point.x / view.x,
  5.                                                1.0f - 2.0f * point.y / view.y);
  6.  
  7.                 glm::mat4 invMat = glm::inverse(getViewMatrix());
  8.                 Vector2 result = Vector2(invMat[0][0] * normalized.x + invMat[1][0] * normalized.y + invMat[3][0],
  9.                                                                  invMat[0][1] * normalized.x + invMat[1][1] * normalized.y + invMat[3][1]);
  10.                 return Vector2(result.x, result.y);
  11.         }

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Sexy Lizard cpp 5 Years ago.