mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50:18 +01:00
Improved performance of Renderer.Reset by factor of 2.
This commit is contained in:
parent
f11a9b0593
commit
b0a42867d8
@ -152,20 +152,31 @@ func (r *Renderer) SetPos(xOfs, zOfs int16) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Renderer) Reset() {
|
func (r *Renderer) Reset() {
|
||||||
for i, n := 0, len(r.yBuffer); i < n; i++ {
|
yb := r.yBuffer
|
||||||
r.yBuffer[i] = math.MinInt32
|
yb = yb[:len(yb)]
|
||||||
r.cBuffer[i] = -1
|
for i := range yb {
|
||||||
|
yb[i] = math.MinInt32
|
||||||
}
|
}
|
||||||
for i, n := 0, len(r.yMin); i < n; i++ {
|
|
||||||
r.yMin[i] = math.MinInt32
|
cb := r.cBuffer
|
||||||
|
cb = cb[:len(cb)]
|
||||||
|
for i := range cb {
|
||||||
|
cb[i] = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
ym := r.yMin
|
||||||
|
ym = ym[:len(ym)]
|
||||||
|
for i := range ym {
|
||||||
|
ym[i] = math.MinInt32
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.TransparentBlocks > 0 {
|
if r.TransparentBlocks > 0 {
|
||||||
r.TransparentBlocks = 0
|
r.TransparentBlocks = 0
|
||||||
for i, t := range r.tBuffer {
|
tb := r.tBuffer
|
||||||
|
for i, t := range tb {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
r.spans.FreeAll(t)
|
r.spans.FreeAll(t)
|
||||||
r.tBuffer[i] = nil
|
tb[i] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user