MOS
util.hpp
1 #pragma once
2 
3 #include <string>
4 #include <sstream>
5 #include <vector>
6 #include <json.hpp>
7 #include <glm/glm.hpp>
8 #include <glm/gtc/type_ptr.hpp>
9 #include <mos/sim/ray.hpp>
10 #include <chrono>
11 
12 namespace mos {
13 
14 // Load full string from text file
15 auto text(const std::string &path) -> std::string;
16 
17 [[deprecated]]
18 auto split(const std::string &s, char delim,
19  std::vector<std::string> &elems) -> std::vector<std::string> &;
20 [[deprecated]]
21 auto split(const std::string &s, char delim) -> std::vector<std::string>;
22 
23 auto jsonarray_to_mat4(const nlohmann::json &array) -> glm::mat4;
24 auto jsonarray_to_vec3(const nlohmann::json &array) -> glm::vec3;
25 auto jsonarray_to_quat(const nlohmann::json &array) -> glm::quat;
26 auto jsonarray_to_vec4(const nlohmann::json &array) -> glm::vec4;
27 
28 [[deprecated]]
29 auto position(const glm::mat4 &mat) -> glm::vec3;
30 
31 int now_ms();
32 
33 auto un_project(const glm::vec2 &position,
34  const glm::mat4 &view,
35  const glm::mat4 &projection,
36  const glm::uvec2 &resolution) -> mos::sim::Ray;
37 
38 auto hex_color(const int hex) -> glm::vec4;
39 
40 }
Ray for ray testing.
Definition: ray.hpp:7