more better prisms

This commit is contained in:
Josh Deprez 2021-09-05 21:07:34 +10:00
parent 6fc0725d15
commit 073eff4a61

View file

@ -28,8 +28,8 @@ type PrismMap struct {
Map map[Point3]*Prism Map map[Point3]*Prism
DrawOrderBias image.Point // dot with (X,Y) = bias DrawOrderBias image.Point // dot with (X,Y) = bias
DrawOffset image.Point // offset to apply to whole map DrawOffset image.Point // offset to apply to whole map
DrawZStride image.Point // (X,Y) draw translation for each unit in Z DrawZStride image.Point // draw offset for each unit in Z
PrismSize Point3 PrismSize Point3 // cmul map key = world pos
Sheet Sheet Sheet Sheet
} }
@ -63,9 +63,9 @@ func (p *Prism) DrawOrder() (int, int) {
} }
func (p *Prism) Transform(pt Transform) (tf Transform) { func (p *Prism) Transform(pt Transform) (tf Transform) {
v := p.pos.CMul(p.pm.PrismSize)
tf.Opts.GeoM.Translate(cfloat( tf.Opts.GeoM.Translate(cfloat(
v.XY().Add(p.pm.DrawZStride.Mul(v.Z)), cmul(p.pos.XY(), p.pm.PrismSize.XY()).
Add(p.pm.DrawZStride.Mul(p.pos.Z)),
)) ))
return tf.Concat(pt) return tf.Concat(pt)
} }