瀏覽代碼

Don't call sqrtf when axis already normalized (#1672)

pull/1673/head
Dan Bechard 4 年之前
committed by GitHub
父節點
當前提交
5325d8d2ba
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 6 行新增6 行删除
  1. +6
    -6
      src/raymath.h

+ 6
- 6
src/raymath.h 查看文件

@ -856,14 +856,14 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle)
float x = axis.x, y = axis.y, z = axis.z;
float length = sqrtf(x*x + y*y + z*z);
float lengthSquared = x*x + y*y + z*z;
if ((length != 1.0f) && (length != 0.0f))
if ((lengthSquared != 1.0f) && (lengthSquared != 0.0f))
{
n">length = 1.0f/length;
x *= length;
y *= length;
z *= length;
kt">float inverseLength = 1.0f/sqrtf(lengthSquared);
x *= inverseLength;
y *= inverseLength;
z *= inverseLength;
}
float sinres = sinf(angle);

Loading…
取消
儲存