Replace double with float, optimize calculation
This commit is contained in:
1 parent
d960d448fa
commit
1367df2875
38 files changed
+263
-267
No files matched your search
@@ -69,7 +69,7 @@ vector_3 vector_3::get_normal() {
|
||||
float vector_3::get_length() { return SQRT(sq(x) + sq(y) + sq(z)); }
|
||||
|
||||
void vector_3::normalize() {
|
||||
const float inv_length = 1.0 / get_length();
|
||||
const float inv_length = RSQRT(sq(x) + sq(y) + sq(z));
|
||||
x *= inv_length;
|
||||
y *= inv_length;
|
||||
z *= inv_length;
|
||||
|
||||
Reference in new issue
Block a user