stealth977
24-02-2010 07:33:20
From my OGITOR POST
[attachment=0]GrassLoader.rar[/attachment]
NOTE: There are RANDOM_TABLE_SIZE and RANDOM_TABLE_MASK defines at the beginning of the source file, the optimum size is:
PAGESIZE * PAGESIZE * OVERALL_DENSITY_VALUE * 4 rounded up to the next 2^N and the mask value is RANDOM_TABLE_SIZE - 1
for example a page of 100 units x 100 units with overall density of 6 = 100*100*6*4 = 240000, TABLE_SIZE should be 262144 (2^18)(0x40000) and mask should be 262143 (0x3FFFF), the total size of your random_table would be 1MB and its nothing important nowadays, compared to persistence and speed it supplies.
I modified GrassLoader of PagedGeometry and committed changes to our repository, the changes are:
1 - Creation of Pages are much much faster now since we use a pre-calculated random_table instead of rand()
2 - The grass locations are persistent now, this means, if you add more grass, old grass positions/rotations are kept, but new ones are added, if you remove grass, some of the current grass is removed, the remaining grass keeps its old position/rotation
3 - GrassLoader had a strange page creation, it was creating an entity out of the mesh, then clones this entity and adds to its internal list, then deletes the original entity. Now, we removed the clone and delete process and we directly add the created entity to internal list, THIS ALSO FIXED THE MEMORY (GPU) LEAK CRASH BUG i mentioned in my last post.
Overall, I expect at least 2x speedup at creation/modification of grass pages....
[attachment=0]GrassLoader.rar[/attachment]
NOTE: There are RANDOM_TABLE_SIZE and RANDOM_TABLE_MASK defines at the beginning of the source file, the optimum size is:
PAGESIZE * PAGESIZE * OVERALL_DENSITY_VALUE * 4 rounded up to the next 2^N and the mask value is RANDOM_TABLE_SIZE - 1
for example a page of 100 units x 100 units with overall density of 6 = 100*100*6*4 = 240000, TABLE_SIZE should be 262144 (2^18)(0x40000) and mask should be 262143 (0x3FFFF), the total size of your random_table would be 1MB and its nothing important nowadays, compared to persistence and speed it supplies.