1
\$\begingroup\$

I am attempting to expose glm vector functions/data to luabridge like so:

    .beginClass<glm::mediump_vec3>("vec3")
    .addConstructor<void(*)(const float&, const float&, const float&)>()
    .addData("x", &glm::mediump_vec3::x)
    .addData("y", &glm::mediump_vec3::y)
    .addData("z", &glm::mediump_vec3::z)
    .addData("r", &glm::mediump_vec3::r)
    .addData("g", &glm::mediump_vec3::g)
    .addData("b", &glm::mediump_vec3::b)
    .endClass();

but I am struggling with the operators, such as addition, as they do not seem to be directly attached to the class, and are in a mess of templates. I'm wondering if I should put in a layer of indirection, and have some kind of simpler, non template version of the vec3 in order to make exposure of methods simpler, or if there is a way to register the operators cleanly. Does anyone know how to do this?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.