precomputed shade algo, viewport basic render

This commit is contained in:
anton.gurov
2019-10-30 17:56:30 +03:00
parent 4a77323aab
commit 3958951cd5
15 changed files with 924 additions and 26 deletions

View File

@ -10,7 +10,7 @@ func (c *Coords) Get() (int, int) {
return c.X, c.Y
}
func (c *Coords) DistanceTo(o *Coords) float64 {
func (c *Coords) DistanceTo(o Coords) float64 {
dx := c.X - o.X
dy := c.X - o.Y
return math.Sqrt(math.Pow(float64(dx), 2) + math.Pow(float64(dy), 2))

View File

@ -56,6 +56,6 @@ func (self *Rect) Intersects(other *Rect) bool {
return false
}
func (r *Rect) InBounds (x,y int) bool {
return x >= r.X && x <= (r.X + r.W) && y >= r.Y && y <= (r.Y + r.H)
func (r *Rect) InBounds (c Coords) bool {
return c.X >= r.X && c.X <= (r.X + r.W -1) && c.Y >= r.Y && c.Y <= (r.Y + r.H -1)
}