David Williams 
							
						 
					 
					
						
						
							
						
						af70096fcc 
					 
					
						
						
							
							Tidying and adding comments.  
						
						
						
						
					 
					
						2015-04-12 16:46:43 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						99390580dd 
					 
					
						
						
							
							Replaced number with constant.  
						
						
						
						
					 
					
						2015-04-12 10:35:12 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						c4cccf9043 
					 
					
						
						
							
							Replaced double for loop with cleaner do-while loop.  
						
						
						
						
					 
					
						2015-04-12 09:55:30 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						f35581506c 
					 
					
						
						
							
							Minor optimization - only creating vector if we are going to use it.  
						
						
						
						
					 
					
						2015-04-12 09:42:15 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						a2fe1944af 
					 
					
						
						
							
							Initial work on replacing std::unordered_map with a specialized hash table for looking up chunks based on their 3D position.  
						
						
						
						
					 
					
						2015-04-09 23:44:25 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						4c24d61408 
					 
					
						
						
							
							Added another function for backwards compatibility.  
						
						
						
						
					 
					
						2015-04-05 12:03:12 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						c887d1444f 
					 
					
						
						
							
							Added utility function for people who already have data in linear order, to convert it to Morton order.  
						
						
						
						
					 
					
						2015-04-05 10:14:25 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d521b08cf9 
					 
					
						
						
							
							Added comment.  
						
						
						
						
					 
					
						2015-04-04 09:57:31 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						dec06bcfe4 
					 
					
						
						
							
							Added caching of variable.  
						
						
						
						
					 
					
						2015-04-04 09:49:12 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						77db90ac30 
					 
					
						
						
							
							Removed unneeded variable.  
						
						
						
						
					 
					
						2015-04-04 09:42:46 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						0d36c416f2 
					 
					
						
						
							
							Tidied up macros.  
						
						
						
						
					 
					
						2015-04-04 09:18:51 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						3ca0222b19 
					 
					
						
						
							
							Applied simplified test when going in the negative direction as well.  
						
						
						
						
					 
					
						2015-04-04 00:08:20 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d1bcaec2c5 
					 
					
						
						
							
							This commit knocks about 30% off the run time of the sampler tests by using a more efficient check for whether we are near the edge of the chunk.  
						
						
						
						
					 
					
						2015-04-02 23:11:19 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						135aa96bdf 
					 
					
						
						
							
							Further fixes for move...() functions.  
						
						
						
						
					 
					
						2015-04-01 23:34:57 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						056cae39b5 
					 
					
						
						
							
							Fixed sampler move...() functions to work with Morton ordering.  
						
						
						
						
					 
					
						2015-04-01 22:57:22 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						b518978cd6 
					 
					
						
						
							
							Enlarged lookup tables to 256 elements.  
						
						
						
						
					 
					
						2015-04-01 22:34:42 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						65f39e7b57 
					 
					
						
						
							
							Made the values signed ints, as otherwise the casting was doing something strange on 64-bit systems.  
						
						
						
						
					 
					
						2015-04-01 16:29:19 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						5d220c5d57 
					 
					
						
						
							
							Added extra lookup tables to avoid the need to multiply y/z deltas by 2/4 each time.  
						
						
						
						
					 
					
						2015-03-31 23:58:01 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						60612c5583 
					 
					
						
						
							
							Implemented use of delta for the rest of the peek functions.  
						
						
						
						
					 
					
						2015-03-31 19:55:22 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						afd0650230 
					 
					
						
						
							
							Implemented peeking in positive x and negative x directions using Matt's delta lookup table.  
						
						
						
						
					 
					
						2015-03-31 16:33:56 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						120b8e84cc 
					 
					
						
						
							
							Added position in chunk and  pointer to current chunk data to sampler.  
						
						
						
						
					 
					
						2015-03-30 23:33:51 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d34c1d227c 
					 
					
						
						
							
							Merge branch 'develop' into feature/morton-encoding  
						
						
						
						
					 
					
						2015-03-30 15:38:34 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						5847219331 
					 
					
						
						
							
							Fixed bug with chunk timestamp not being updated.  
						
						
						
						
					 
					
						2015-03-30 15:36:28 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						b415e5c5f3 
					 
					
						
						
							
							calculateAmbientOcclusion() now works with both RawVolume and PagedVolume.  
						
						
						
						
					 
					
						2015-03-30 11:44:25 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d000616d3e 
					 
					
						
						
							
							Revert "Ambient occlusion test now uses RawVolume, as it need a fixed size volume to create a temporary array."  
						
						... 
						
						
						
						This reverts commit 396d1cfc59 
						
						
					 
					
						2015-03-30 11:24:48 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						413bb95b1a 
					 
					
						
						
							
							Passing parameter as const ref.  
						
						
						
						
					 
					
						2015-03-30 11:01:08 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						7f96005985 
					 
					
						
						
							
							Commented out optimized path in sampler as it doesn't work now that we are using Morton ordering for the data in chunks. However, we can probably reinstate such a fast path if we give some thought as to how it should be done.  
						
						
						
						
					 
					
						2015-03-29 09:58:28 +02:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d3b2dab1ac 
					 
					
						
						
							
							Switched to using lookup tables for Morton encoding.  
						
						
						
						
					 
					
						2015-03-29 00:17:27 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d99ed5e624 
					 
					
						
						
							
							Implemented morton encoding using standard bit-twidling approach.  
						
						
						
						
					 
					
						2015-03-28 09:46:05 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						9256f3deb5 
					 
					
						
						
							
							Fixed compile warning.  
						
						
						
						
					 
					
						2015-03-27 21:23:31 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						322bedc009 
					 
					
						
						
							
							Improved test for PagedVolume::Chunk performance.  
						
						
						
						
					 
					
						2015-03-26 23:45:01 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						3facd4df41 
					 
					
						
						
							
							Removed commented out code.  
						
						
						
						
					 
					
						2015-03-21 16:27:43 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d6c708f869 
					 
					
						
						
							
							Merge branch 'develop' into feature/optimize-paged-volume  
						
						
						
						
					 
					
						2015-03-21 16:24:46 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						b027cf1a0c 
					 
					
						
						
							
							Moved common code into function.  
						
						
						
						
					 
					
						2015-03-21 16:22:23 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						778238d11d 
					 
					
						
						
							
							Moved the test for whether we are accessing the same voxel as last time.  
						
						
						
						
					 
					
						2015-03-21 14:57:48 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						d477bec540 
					 
					
						
						
							
							Revert "Replaced Vector3D with integer as key to map."  
						
						... 
						
						
						
						This reverts commit e82d6beca1 
						
						
					 
					
						2015-03-21 14:41:15 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						672c375a7a 
					 
					
						
						
							
							Revert "Work on using a bitfield to set up chunk key."  
						
						... 
						
						
						
						This reverts commit 8bd8f8ba7a 
						
						
					 
					
						2015-03-21 14:41:10 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						5fc0317260 
					 
					
						
						
							
							Revert "Added typedef for chunk key type."  
						
						... 
						
						
						
						This reverts commit 6419c5827b 
						
						
					 
					
						2015-03-21 14:41:04 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						92eaaae765 
					 
					
						
						
							
							Revert "Decided to always use a 64-bit chunk key, rather than trying to make it configurable."  
						
						... 
						
						
						
						This reverts commit 69f6f4ac37 
						
						
					 
					
						2015-03-21 14:40:57 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						ceeb8f70ce 
					 
					
						
						
							
							Revert "Going back to building key by shifting instead of using bitfield."  
						
						... 
						
						
						
						This reverts commit 0d638f9837 
						
						
					 
					
						2015-03-21 14:40:49 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						0c619ebec7 
					 
					
						
						
							
							Revert "Added typedef for ChunkKey."  
						
						... 
						
						
						
						This reverts commit 905ec27f47 
						
						
					 
					
						2015-03-21 14:40:30 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						f574563672 
					 
					
						
						
							
							Revert "New, safer method of packing which makes careful use of casting to avoid problems with e.g. signed integer sign extension."  
						
						... 
						
						
						
						This reverts commit fd451be2dd 
						
						
					 
					
						2015-03-21 14:40:11 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						fd451be2dd 
					 
					
						
						
							
							New, safer method of packing which makes careful use of casting to avoid problems with e.g. signed integer sign extension.  
						
						
						
						
					 
					
						2015-03-21 08:48:45 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						905ec27f47 
					 
					
						
						
							
							Added typedef for ChunkKey.  
						
						
						
						
					 
					
						2015-03-21 08:12:02 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						0d638f9837 
					 
					
						
						
							
							Going back to building key by shifting instead of using bitfield.  
						
						
						
						
					 
					
						2015-03-21 08:05:58 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						69f6f4ac37 
					 
					
						
						
							
							Decided to always use a 64-bit chunk key, rather than trying to make it configurable.  
						
						
						
						
					 
					
						2015-03-20 23:09:38 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						6419c5827b 
					 
					
						
						
							
							Added typedef for chunk key type.  
						
						
						
						
					 
					
						2015-03-20 16:59:25 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						8bd8f8ba7a 
					 
					
						
						
							
							Work on using a bitfield to set up chunk key.  
						
						
						
						
					 
					
						2015-03-20 15:48:46 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						cd48c6f611 
					 
					
						
						
							
							Made method const.  
						
						
						
						
					 
					
						2015-03-19 23:08:35 +01:00 
						 
				 
			
				
					
						
							
							
								David Williams 
							
						 
					 
					
						
						
							
						
						e82d6beca1 
					 
					
						
						
							
							Replaced Vector3D with integer as key to map.  
						
						... 
						
						
						
						Chunks of voxel data are stored in a map, and it is quite common to need to search the map for a particular chunk. The key type used to be a Vector3D (i.e. the position of the chunk in 3D space) which makes conceptual sense but is relatively slow. Using a Vector3D as a key seems to have overhead, probably in terms of copying and performing comparisons. It seems to be significantly faster to use an integer as a key, so we now take the 3D position and pack it into a single integer by bitshifting.
Naturally this reduces the range of positions we can store - a 32-bit int can only encode 3 x 10-bit values, which means our volume can only be 1024 chunks in each direction (with a chunk often being 32x32x32 voxels). This should still be large enough for most uses, but an upcoming change will allow 64-bit keys to be used (at least on 64-bit builds) which then allows 21 bits of precision  per component. This is so large that it's almost infinite for any practical purposes. 
						
						
					 
					
						2015-03-15 09:32:42 +01:00