1 #ifndef GLM_REGISTRATIONS_H
2 #define GLM_REGISTRATIONS_H
4 #include <chaiscript/chaiscript.hpp>
5 #include <chaiscript/chaiscript_stdlib.hpp>
14 chaiscript::ModulePtr module = std::make_shared<chaiscript::Module>();
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)>()
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; }),
"+"}
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)>()
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; }),
"+"}
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)>()
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; }),
"+"}
chaiscript::ModulePtr getGlmModule()
Gets the glm scripting module.
Definition: glm_registrations.h:13