From efa452e0c433712cdcaa7583611c04eb94f63f85 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 2 Jul 2014 15:19:11 +0800 Subject: [PATCH] support for fast tmx hex --- cocos/2d/CCFastTMXLayer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cocos/2d/CCFastTMXLayer.cpp b/cocos/2d/CCFastTMXLayer.cpp index 1b456fc69b..28e09577a9 100644 --- a/cocos/2d/CCFastTMXLayer.cpp +++ b/cocos/2d/CCFastTMXLayer.cpp @@ -237,7 +237,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect) else { //do nothing, do not support - CCASSERT(0, "TMX invalid value"); + //CCASSERT(0, "TMX invalid value"); } _indicesVertexZNumber.clear(); @@ -387,7 +387,13 @@ Mat4 FastTMXLayer::tileToNodeTransform() } case FAST_TMX_ORIENTATION_HEX: { - _tileToNodeTransform = Mat4::IDENTITY; + _tileToNodeTransform = Mat4 + ( + h * sqrtf(0.75), 0, 0, 0, + -h/2, -h, 0, offY, + 0, 0, 1, 0, + 0, 0, 0, 1 + ); return _tileToNodeTransform; } default: @@ -617,7 +623,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos) ret = static_cast(-(_layerSize.height-pos.y)); break; case FAST_TMX_ORIENTATION_HEX: - CCASSERT(0, "TMX Hexa zOrder not supported"); + CCASSERT(0, "TMX Hexa vertexZ not supported"); break; default: CCASSERT(0, "TMX invalid value");