Skip to content

Commit

Permalink
Fix sprite negative scale
Browse files Browse the repository at this point in the history
  • Loading branch information
danaugrs committed Jul 23, 2021
1 parent 18b19dd commit abef212
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions graphic/sprite.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,17 @@ func (s *Sprite) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) {

// Removes any rotation in X and Y axes and compose new model view matrix
rotation := s.Rotation()
rotation.X = 0
rotation.Y = 0
actualScale := s.Scale()
if actualScale.X >= 0 {
rotation.Y = 0
} else {
rotation.Y = math32.Pi
}
if actualScale.Y >= 0 {
rotation.X = 0
} else {
rotation.X = math32.Pi
}
quaternion.SetFromEuler(&rotation)
var mvmNew math32.Matrix4
mvmNew.Compose(&position, &quaternion, &scale)
Expand Down

0 comments on commit abef212

Please sign in to comment.