How can i convert a camera space vector to world space, given the camera direction vector, and the camera space vector?
All vecs are normalized 3D vectors, and the camera space projection is correct as it displays properly, but ignores camera orientation as its not converted to world space.
std::vector<double> calculate_ray_heading(std::vector<double> input_vector, double fov, std::vector<double> uv) {
// Calculate the heading of the ray in world space given
// -camera vector (world space)
// -uv (converted to camera normalized device coordinates)
// -fov (ignored for now)
//convert uv2 to NDC (normalized device coordinates)
// changes range from [0,-1] to [-1,1]
std::vector<double> ndc = {
(2*uv[1]) - 1,
(2*(1-uv[0])) - 1
};
//calculate ray heading in camera space
std::vector<double> cam_space = normalize_vector(
{
1, ndc[0], ndc[1]
}
);
//convert cam space to world space
//...
//return world space
return world_space;
};
Also note i'm aware of my poor datatypes i am in the process of changing everything to proper vec types