source: tests/vector_math/glm_equivalents/vec2_float.cc @ aa88cb9a

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since aa88cb9a was 9b026f1, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Fixed name clash in test folder

  • Property mode set to 100644
File size: 767 bytes
Line 
1#include <glm/glm.hpp>
2#include <iostream>
3
4using namespace glm;
5
6std::ostream& operator<<(std::ostream& os, glm::tvec2<float>& v) {
7    os << "<" << v.x << "," << v.y << ">";
8    return os;
9}
10std::ostream& operator<<(std::ostream& os, glm::tvec2<float>&& v) {
11    os << "<" << v.x << "," << v.y << ">";
12    return os;
13}
14
15float length_squared(glm::tvec2<float> v) {
16    return glm::length(v) * glm::length(v);
17}
18
19tvec2<float> project(glm::tvec2<float> u, glm::tvec2<float> v) {
20    return normalize(v) * dot(u, normalize(v));
21}
22
23int main() {
24    tvec2<float> v1 = {5.f,6.f};
25    tvec2<float> v2 = {0.f,-1.f};
26    std::cout << "refract:" << refract(v1,normalize(v2),1.f) << std::endl;
27    std::cout << "refract:" << refract(v1,normalize(v2),1.f/1.33f) << std::endl;
28}
Note: See TracBrowser for help on using the repository browser.