mirror of
				https://bitbucket.org/s_l_teichmann/mtsatellite
				synced 2025-11-04 09:55:34 +01:00 
			
		
		
		
	Render blocks through a ring buffer which is a binary heap ordered by descending y coords. This establisches a stream of partial y ordered blocks to reduce the the over all overdraw. Speeds up rendering about 25%.
This commit is contained in:
		@@ -145,6 +145,10 @@ func CoordToInterleaved(c Coord) (result int64) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func invert16(x int16) int16 {
 | 
			
		||||
	return -x - 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func InterleavedToCoord(pos int64) Coord {
 | 
			
		||||
	const end = 1 << (numBitsPerComponent + 1)
 | 
			
		||||
	var x, y, z int16
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@
 | 
			
		||||
package common
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"math"
 | 
			
		||||
	"math/rand"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
@@ -180,6 +181,15 @@ func outsiders(zmin, zmax int64, fn func(int64)) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestInvert16(t *testing.T) {
 | 
			
		||||
	if invert16(math.MaxInt16) != math.MinInt16 {
 | 
			
		||||
		t.Errorf("invert16(max) != min\n")
 | 
			
		||||
	}
 | 
			
		||||
	if invert16(math.MinInt16) != math.MaxInt16 {
 | 
			
		||||
		t.Errorf("invert16(max) != min\n")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestBigMin(t *testing.T) {
 | 
			
		||||
	const tries = 20
 | 
			
		||||
	for i := 0; i < tries; i++ {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user