Does the algorithm only draw what the camera sees?

I make 3D FPS with OpenGL, and here are the basic principles of its operation. The game is a 3D array of cubes. I know the location of the player’s current cube, as well as the camera x, y, z, and I know that x, y, z rotates the camera too. Right now, I'm just making a square around the player and doing it, and then adding distant fog. The problem, however, is that I'm still doing everything the player has behind. How can I selectively display only what the player sees, and not display everything in radius X, as I do now.

thank

+5
source share
3 answers

, . . .

+2

, .

+2

Are the cubes of the room the labyrinth through which the player moves? If so, and if the rooms are static during the game, you can use the BSP tree to cross the scene in depth, stopping when you transfer the player.

0
source

All Articles