Re: view-frustum culling implementation with jit.gen & matrices
so here is where I went.
I have that huge jit.gen (finally not that big)
It takes some parameters as input:
– position of the cam
– a point on the view direction of the cam (lookat)
– the up vector
It takes also cam parameters like:
– lens angle
– ratio of the view (w/h)
– nearClip distance
– farClip distance
it processes the whole parameters to render the 8 points of the view frustum.
As shown there: http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-extracting-the-planes/
The calculation is there:
I need to normalize a vector inside the codebox.
I did the basic calculation including sqrt()
does it exist a better way inside GenExpr / codebox ?
Now, I have my eight point defining my view.
They defines my 6 planes too.
I have to "test" all my object according to those planes in order to have a list of objects I have to inactivate and activate, according to the position & orientation of my cam.
That part is done in the second codebox and has to be done for the 6 planes.
Knowing I have a matrix with all my objects' positions, how can I test each one against those 6 planes ??
any help would be appreciate.
I don't know if this is the best implementation I could make of that concept.