ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 8bbdfdd was
8bbdfdd,
checked in by Dmitry Kobets <dkobets@…>, 4 years ago
|
initial commit
|
-
Property mode set to
100644
|
File size:
467 bytes
|
Rev | Line | |
---|
[8bbdfdd] | 1 | #pragma once |
---|
| 2 | #include <math.h> |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | //---------------------- Vector Types ---------------------- |
---|
| 6 | // TODO: make generic, as per glm |
---|
| 7 | |
---|
| 8 | struct vec2 { |
---|
| 9 | float x, y; |
---|
| 10 | }; |
---|
| 11 | |
---|
| 12 | //---------------------- Geometric Functions ---------------------- |
---|
| 13 | // These functions implement the Geometric Functions section of GLSL |
---|
| 14 | |
---|
| 15 | static inline float dot(const vec2& v, const vec2& u) { |
---|
| 16 | return v.x * u.x + v.y * u.y; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | static inline float length(const vec2& v) { |
---|
| 20 | return sqrt(dot(v, v)); |
---|
| 21 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.