I have struct:
struct mat4 {
    float m[16];
    mat4();
    ...
    float *getFloat();
}
float *mat4::getFloat() {
    return m;
}
Now I want to make m equal to m from newly created matrix r:
void mat4::rotate(vec3 v) {
    mat4 r, rx, ry, rz;
    ...
    matrix calculations
    ...
    m = *r.getFloat();
}
But this gives me error "incompatible types in assignment of ‘float’ to ‘float [16]’" I have searched Google and tried different ways but no success so far. Please tell me how could I do that?
getFloat() returns a pointer. m is an array. If you want to copy all of what is returned into m you will need to use std::copy or std::memcpy:
std::memcpy(m, r.getFloat(), sizeof(m));
If you meant to get just one float from getFloat() you could do:
m[0] = *r.getFloat();If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With