Managed to fix the x axis, z axis is to be confirmed but for now it appears fine, the y axis however is not managing to enter negative space despite using the exact same function for rotating it’s points as the x axis:
void rot_pos3fv( DVEC2 rot, int max, FVEC3 pos )
{
FVEC2 xz = {0}, yz = {0};
rot_pos2fv( rot[VEC_X], max, xz );
rot_pos2fv( rot[VEC_Y], max, yz );
pos[VEC_X] = xz[VEC_R];
pos[VEC_Y] = yz[VEC_R];
pos[VEC_Z] = xz[VEC_I] * yz[VEC_I];
}
Not looking for help on that since that’s using code I plan to patent - assuming it IS faster than using sin/cos/tan (which if I remember rightly use sqrt which I expect is slower on average than a fixed number of operations). Anyways since this is the key function to test against when it comes to a speed test I thought I’d leave sin/cos/tan based one to whoever is interested enough to do it while I try to figure out why my y axis is off kilter. DVEC2 is is the array equivalent of ivec2 in glsl, likewise FVEC3 is the array equivalent of vec3 in glsl, max is just the max angle, think of it as you would 360, the angles in rot can be positive or negative, I use the below functions to clamp the angle and retrieve a relative position for the VEC_R axis (real number, max - the position should be for the imaginary axis)
uint fix_rot( int rot, int max )
{
uint pos = (uint)max + (rot % max);
return (pos == ((uint)max * 2)) ? max : pos % max;
}
uint rot_pos( int rot, int max )
{
uint dbl = (uint)max * 2;
uint qtr = max / 4;
uint pos = fix_rot( rot, max );
return (pos % qtr) * 4;
}
Edit: After commenting out the z axis line I found it wasn’t the y axis that was the problem, it’s the z axis, will need to think and experiment a bit.
Edit: Took a break and when I came back and tried again the problem had mysteriously vanished, will put that issue to one side for now and will instead work on adding another object to move, after that I will then try to load in a freely available model, then I will try to load a scene, when I can do all that I will move onto the next experimental code I want to develop that takes care of the infinity issue by splitting a scene into cells and normalising the model position to the cell, not the scene