Przeglądaj źródła

Fix sprite negative scale

Daniel Salvadori 4 lat temu
rodzic
commit
abef212b4d
1 zmienionych plików z 11 dodań i 2 usunięć
  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)