The system works currently with another program which is run before trying to use the simulator and creates a couple of extra tables in the database. The roadlink and roadnode data is loaded into memory. For the roadnodes, the coordinates are converted to a figure relative to the centre of the data (the map area in the database) and then converted to a grid reference on a grid of size 50 (that is, grid lines are 50 metres apart). This is then put back into the database in a table rn_grid. Similarly, the roadlinks are loaded only this time the conversion and associated data entry is performed on all of the coordinate pairs in the list, and data is entered into a table rl_grid.
When the simulator loads, this information is put into a quadtree, each node representing a list of id's of roadnodes and roadlinks that pass through it. When the simulator is running, the Update function calculates the direction the camera is facing and, using data in the quadtree, pushes items onto the stack of topographic areas to be loaded. The extra threads initiated for loading topographic data pop items off the stack and load them while the simulator is running.
When I get the chance, I'll upload a video.
EDIT: I should point out that the other program only needs to be run once. This in itself takes about four minutes, so would be pointless if it were run every time.
Nice work :-) I'm looking forward to the video
ReplyDelete