Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
glm_registrations.h
Go to the documentation of this file.
1 #ifndef GLM_REGISTRATIONS_H
2 #define GLM_REGISTRATIONS_H
3 #include <glm/glm.hpp>
4 #include <chaiscript/chaiscript.hpp>
5 #include <chaiscript/chaiscript_stdlib.hpp>
6 
7 namespace Script {
13  chaiscript::ModulePtr getGlmModule() {
14  chaiscript::ModulePtr module = std::make_shared<chaiscript::Module>();
15 
16  chaiscript::utility::add_class<glm::vec3>(*module, "vec2", {
17  chaiscript::constructor<glm::vec2(const float, const float)>(),
18  chaiscript::constructor<glm::vec2(const glm::vec2)>()
19  },
20  {{chaiscript::fun(&glm::vec2::x), "x"},
21  {chaiscript::fun(&glm::vec2::y), "y"},
22  {chaiscript::fun([](glm::vec2 a, glm::vec2 b) { return a + b; }), "+"}
23  }
24  );
25 
26  chaiscript::utility::add_class<glm::vec3>(*module, "vec3", {
27  chaiscript::constructor<glm::vec3(const float, const float, const float)>(),
28  chaiscript::constructor<glm::vec3(const glm::vec3)>()
29  },
30  {{chaiscript::fun(&glm::vec3::x), "x"},
31  {chaiscript::fun(&glm::vec3::y), "y"},
32  {chaiscript::fun(&glm::vec3::z), "z"},
33  {chaiscript::fun([](glm::vec3 a, glm::vec3 b) { return a + b; }), "+"}
34  }
35  );
36 
37  chaiscript::utility::add_class<glm::vec4>(*module, "vec4", {
38  chaiscript::constructor<glm::vec4(const float, const float, const float, const float)>(),
39  chaiscript::constructor<glm::vec4(const glm::vec4)>()
40  },
41  {{chaiscript::fun(&glm::vec4::x), "x"},
42  {chaiscript::fun(&glm::vec4::y), "y"},
43  {chaiscript::fun(&glm::vec4::z), "z"},
44  {chaiscript::fun(&glm::vec4::w), "w"},
45  {chaiscript::fun([](glm::vec4 a, glm::vec4 b) { return a + b; }), "+"}
46  }
47  );
48 
49  return module;
50  }
51 }
52 #endif
chaiscript::ModulePtr getGlmModule()
Gets the glm scripting module.
Definition: glm_registrations.h:13