Merge pull request #70083 from clayjohn/Sprite3D-normals

Remove extra range conversion in Sprite3D normal encoding
This commit is contained in:
Rémi Verschelde 2022-12-15 09:21:26 +01:00
commit 56ddb70c08
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -191,9 +191,7 @@ void SpriteBase3D::draw_texture_rect(Ref<Texture2D> p_texture, Rect2 p_dst_rect,
uint32_t v_normal;
{
Vector3 n = normal * Vector3(0.5, 0.5, 0.5) + Vector3(0.5, 0.5, 0.5);
Vector2 res = n.octahedron_encode();
Vector2 res = normal.octahedron_encode();
uint32_t value = 0;
value |= (uint16_t)CLAMP(res.x * 65535, 0, 65535);
value |= (uint16_t)CLAMP(res.y * 65535, 0, 65535) << 16;