Parcourir la source

Reviewed some functions to avoid calling other functions

pull/1923/head
raysan5 il y a 3 ans
Parent
révision
58e9a0894f
1 fichiers modifiés avec 10 ajouts et 9 suppressions
  1. +10
    -9
      src/raymath.h

+ 10
- 9
src/raymath.h Voir le fichier

@ -1,6 +1,6 @@
/**********************************************************************************************
*
* raymath v1.2 - Math functions to work with Vector3, Matrix and Quaternions
* raymath v1.3 - Math functions to work with Vector3, Matrix and Quaternions
*
* CONFIGURATION:
*
@ -488,14 +488,14 @@ RMDEF Vector3 Vector3Normalize(Vector3 v)
{
Vector3 result = v;
float length, ilength;
length = Vector3Length(v);
float length, inverseLength;
length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z);
if (length == 0.0f) length = 1.0f;
ilength = 1.0f/length;
inverseLength = 1.0f/length;
result.x *= ilength;
result.y *= ilength;
result.z *= ilength;
result.x *= inverseLength;
result.y *= inverseLength;
result.z *= inverseLength;
return result;
}
@ -1429,8 +1429,9 @@ RMDEF Matrix QuaternionToMatrix(Quaternion q)
RMDEF Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
{
Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f };
if (Vector3Length(axis) != 0.0f)
float axisLength = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z);
if (axisLength != 0.0f)
{
angle *= 0.5f;

Chargement…
Annuler
Enregistrer