Merge pull request #262 from snargleplax/rangeTargets
Use slice for range in Drawer.Dirty(), to improve performance
This commit is contained in:
commit
fd754b5263
|
@ -24,8 +24,9 @@ type Drawer struct {
|
||||||
Triangles Triangles
|
Triangles Triangles
|
||||||
Picture Picture
|
Picture Picture
|
||||||
|
|
||||||
targets map[Target]*drawerTarget
|
targets map[Target]*drawerTarget
|
||||||
inited bool
|
allTargets []*drawerTarget
|
||||||
|
inited bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type drawerTarget struct {
|
type drawerTarget struct {
|
||||||
|
@ -46,7 +47,7 @@ func (d *Drawer) lazyInit() {
|
||||||
func (d *Drawer) Dirty() {
|
func (d *Drawer) Dirty() {
|
||||||
d.lazyInit()
|
d.lazyInit()
|
||||||
|
|
||||||
for _, t := range d.targets {
|
for _, t := range d.allTargets {
|
||||||
t.clean = false
|
t.clean = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +69,7 @@ func (d *Drawer) Draw(t Target) {
|
||||||
pics: make(map[Picture]TargetPicture),
|
pics: make(map[Picture]TargetPicture),
|
||||||
}
|
}
|
||||||
d.targets[t] = dt
|
d.targets[t] = dt
|
||||||
|
d.allTargets = append(d.allTargets, dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
if dt.tris == nil {
|
if dt.tris == nil {
|
||||||
|
|
Loading…
Reference in New Issue