Browse Source

Fix sprite negative scale

Daniel Salvadori 4 years ago
parent
commit
abef212b4d
1 changed files with 11 additions and 2 deletions
  1. 11 2
      graphic/sprite.go

+ 11 - 2
graphic/sprite.go

@@ -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)