Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline bool WorldToPoint(float fCircleGay, const CVector2D& vec2WindowPosition, const CVector2D& vec2WindowSize, const CVector3D& vec3Origin, const CVector3D& vec3LocalOrigin, const CVector3D& vec3LocalAngles, CVector2D& vec2Point, const float& fRadarRange)
- {
- float fdx = vec3Origin.GetX() - vec3LocalOrigin.GetX();
- float fdy = vec3Origin.GetY() - vec3LocalOrigin.GetY();
- float fya = NMath::Deg2Rad(vec3LocalAngles.GetY());
- float fzx = fdy * (-cos(fya)) + fdx * sin(fya);
- float fzy = fdx * (-cos(fya)) - fdy * sin(fya);
- if (fRadarRange > 0)
- {
- fzx /= fRadarRange;
- fzy /= fRadarRange;
- }
- if (r_radar_sqr.GetBool())
- {
- if (abs(fzx) > fCircleGay || abs(fzy) > fCircleGay)
- {
- //Implant: r_radar_clamppoint for r_radar_sqr
- if (!r_radar_clamppoint.GetBool())
- return false;
- float angle = atan2(fzy, fzx);
- float radius = cos(M_PI / 4.f) / cos(fmodf(angle + M_PI * 0.25f, M_PI * 0.5f) - M_PI_ON_4);
- float meme = fCircleGay / (radius + M_FLT_EPSILON);
- fzx *= meme;
- fzy *= meme;
- }
- }
- else
- {
- if ((fzx * fzx + fzy * fzy) > fCircleGay)
- {
- if (!r_radar_clamppoint.GetBool())
- return false;
- float ok = CVector2D(fzx, fzy).Length();
- fzx /= ok;
- fzy /= ok;
- fCircleGay = sqrt(fCircleGay);
- fzx *= fCircleGay;
- fzy *= fCircleGay;
- }
- }
- vec2Point = CVector2D((float(vec2WindowPosition.GetX()) + fzx) + float(vec2WindowSize.GetX() / 2), (float(vec2WindowPosition.GetY()) + fzy) + float(vec2WindowSize.GetY() / 2));
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement