After having more or less successfully implemented a 6dof camera movement (mouse only at the moment), I'm moving on to a second big feature on my Lutfrauser adaptation process : A "looping" environnment.
What I want is a basic square map, of a given size. When you approach a size, you can continuously see the "other side" of the map drawing in front of you. when you or any entity hits the side, it gests teleported on the other without any effect, at the corresponding position with the same speed. The repetition should appear seamless.
For the moment, I'm focusing on the graphical part.
We all know that idTech3 is capable of drawing portals (and mirrors, that are portals with an inverted matrix applied). By default, you can't see a portal through another portal, but it seems that it's not a big problem to solve.
But on my situation things get tricky : with a FOV of 90°, you can see up to 3 times the original map throuth "portal views" :

The red sign is the real player, the green signs are the "virtual" cameras required to see beyond the edge of the square map seamlessly.
So, how to do that ?
I think I'll need a way to position my "virtual" / complementary cameras at the right place. For that, I'll need to store somewhere the size of my square map, from which can compute the position of the camera outside the map to get the missing parts. The camera angles remain the same.
Then, I should start drawing the A part, then B or C, and finally the "real" part.
Hey, this sounds simple. Now let's look at the code. Ah, ok, for the moment I don't understand much of all this.
Concretely, I found a generic functions that draws the scene through some parameters :
Code: Select all
void R_RenderView (viewParms_t *parms)
But for the moment I a lost in some earlier planning questions :
- I will still load a BSP with the square floor (that will be ocean in the end), with some "portal" surface walls all around it, and maybe a new WorldSpawn proprety like for example "MapSize", that with a value of 1024 would mean a square of 2048 units of side length (the north east corner would be at 1024:1024, with that parameter it is possible to always have a square shape and easely have the X;Y coordinates of the corners). Ok, now how do I add a proprety to a worldspawn ? How can I make this variable readable by bith client and server and renderer ?
- Should I add a new "portal" surface type ? For the moment, idTech 3 has some "tags" that defines some surfaces as Portals and Mirrors. I'm afraid the "Portal" surface is "locked" with the system of a Portal Surface and Portal Camera. If I want to add some new "type", how should I proceed ?
Always, if anyone here has already worked on that subject, or knows someone, or knows a place with some documentation about the rendrering of portals in that engine, this would be really great ! For the moment, I'm juste reading some code, things get a bit more clear everyday, but any help will make me learn faster

Thanks for reading !