Browse Source

Fixed a serious bug with flipping X and Y (tested), reverted some occasional changes to sample data.

pmatsula 7 years ago
parent
commit
edd3bd9b67

+ 4 - 4
Source/Urho3D/Urho2D/StaticSprite2D.cpp

@@ -330,10 +330,10 @@ void StaticSprite2D::UpdateSourceBatches()
     vertex2.position_ = worldTransform * Vector3(drawRect_.max_.x_, drawRect_.max_.y_, 0.0f);
     vertex2.position_ = worldTransform * Vector3(drawRect_.max_.x_, drawRect_.max_.y_, 0.0f);
     vertex3.position_ = worldTransform * Vector3(drawRect_.max_.x_, drawRect_.min_.y_, 0.0f);
     vertex3.position_ = worldTransform * Vector3(drawRect_.max_.x_, drawRect_.min_.y_, 0.0f);
 
 
-    vertex0.uv_ = swapXY_ ? textureRect_.max_ : textureRect_.min_;
-    vertex1.uv_ = Vector2(textureRect_.min_.x_, textureRect_.max_.y_);
-    vertex2.uv_ = swapXY_ ? textureRect_.min_ : textureRect_.max_;
-    vertex3.uv_ = Vector2(textureRect_.max_.x_, textureRect_.min_.y_);
+    vertex0.uv_ = textureRect_.min_;
+    (swapXY_ ? vertex3.uv_ : vertex1.uv_) = Vector2(textureRect_.min_.x_, textureRect_.max_.y_);
+    vertex2.uv_ = textureRect_.max_;
+    (swapXY_ ? vertex1.uv_ : vertex3.uv_) = Vector2(textureRect_.max_.x_, textureRect_.min_.y_);
 
 
     vertex0.color_ = vertex1.color_ = vertex2.color_ = vertex3.color_ = color_.ToUInt();
     vertex0.color_ = vertex1.color_ = vertex2.color_ = vertex3.color_ = color_.ToUInt();
 
 

+ 4 - 4
Source/Urho3D/Urho2D/TileMapDefs2D.h

@@ -135,9 +135,9 @@ public:
     /// Return gid.
     /// Return gid.
     int GetGid() const { return gid_ & ~FLIP_ALL; }
     int GetGid() const { return gid_ & ~FLIP_ALL; }
     /// Return flip X.
     /// Return flip X.
-    bool GetFlipX() const { return gid_ & FLIP_VERTICAL; }
+    bool GetFlipX() const { return gid_ & FLIP_HORIZONTAL; }
     /// Return flip Y.
     /// Return flip Y.
-    bool GetFlipY() const { return gid_ & FLIP_HORIZONTAL; }
+    bool GetFlipY() const { return gid_ & FLIP_VERTICAL; }
     /// Return swap X and Y.
     /// Return swap X and Y.
     bool GetSwapXY() const { return gid_ & FLIP_DIAGONAL; }
     bool GetSwapXY() const { return gid_ & FLIP_DIAGONAL; }
 
 
@@ -188,9 +188,9 @@ public:
     /// Return tile Gid.
     /// Return tile Gid.
     int GetTileGid() const { return gid_ & ~FLIP_ALL; }
     int GetTileGid() const { return gid_ & ~FLIP_ALL; }
     /// Return tile flip X.
     /// Return tile flip X.
-    bool GetTileFlipX() const { return gid_ & FLIP_VERTICAL; }
+    bool GetTileFlipX() const { return gid_ & FLIP_HORIZONTAL; }
     /// Return tile flip Y.
     /// Return tile flip Y.
-    bool GetTileFlipY() const { return gid_ & FLIP_HORIZONTAL; }
+    bool GetTileFlipY() const { return gid_ & FLIP_VERTICAL; }
     /// Return tile swap X and Y.
     /// Return tile swap X and Y.
     bool GetTileSwapXY() const { return gid_ & FLIP_DIAGONAL; }
     bool GetTileSwapXY() const { return gid_ & FLIP_DIAGONAL; }
 
 

File diff suppressed because it is too large
+ 0 - 0
bin/Data/Urho2D/Tilesets/Ortho.tmx


+ 2 - 2
bin/Data/Urho2D/isometric_grass_and_water.tmx

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<map version="1.0" tiledversion="1.0.3" orientation="isometric" renderorder="right-down" width="25" height="25" tilewidth="64" tileheight="32" nextobjectid="1">
- <tileset firstgid="1" name="isometric_grass_and_water" tilewidth="64" tileheight="64" tilecount="32" columns="4">
+<map version="1.0" orientation="isometric" width="25" height="25" tilewidth="64" tileheight="32">
+ <tileset firstgid="1" name="isometric_grass_and_water" tilewidth="64" tileheight="64">
   <tileoffset x="0" y="16"/>
   <tileoffset x="0" y="16"/>
   <image source="isometric_grass_and_water.png" width="256" height="512"/>
   <image source="isometric_grass_and_water.png" width="256" height="512"/>
   <terraintypes>
   <terraintypes>

Some files were not shown because too many files changed in this diff