summaryrefslogtreecommitdiffhomepage
path: root/src/raymath.h
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2018-04-30 02:47:48 +0200
committerraysan5 <[email protected]>2018-04-30 02:47:48 +0200
commit23e335d93355a948adeb8d10ee6277939aaab43e (patch)
treea4401f9880974bddc077db33dfb66551d5c91122 /src/raymath.h
parentc51203ae7e7aefac5fa95097d424aefdbe9c759c (diff)
downloadraylib-23e335d93355a948adeb8d10ee6277939aaab43e.tar.gz
raylib-23e335d93355a948adeb8d10ee6277939aaab43e.zip
Implemented MeshTangents()
- Added Vector3OrthoNormalize() to raymath.h - not sure if it is correct - Implemented MeshBinormals() - Mesh struct has not a place for them... - Updated model_material_pbr example - tested but not working on my GPU (old Intel HD), actually, it never worked on it...
Diffstat (limited to 'src/raymath.h')
-rw-r--r--src/raymath.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/raymath.h b/src/raymath.h
index d49f3622..b0046522 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -372,6 +372,17 @@ RMDEF Vector3 Vector3Normalize(Vector3 v)
return result;
}
+// Orthonormalize provided vectors
+// Makes vectors normalized and orthogonal to each other
+// Gram-Schmidt function implementation
+RMDEF void Vector3OrthoNormalize(Vector3 *v1, Vector3 *v2)
+{
+ *v1 = Vector3Normalize(*v1);
+ Vector3 vn = Vector3CrossProduct(*v1, *v2);
+ vn = Vector3Normalize(vn);
+ *v2 = Vector3CrossProduct(vn, *v1);
+}
+
// Transforms a Vector3 by a given Matrix
RMDEF Vector3 Vector3Transform(Vector3 v, Matrix mat)
{