void DoAttm(MeshGroupFrame meshframe, string name, ha_ani_tool.hadata.Node.Frame frame) { if (mapPart.ContainsKey(name)) { foreach (var attm in mapPart[name]) { TextureBlock?tb = TextureBlockMgr.getTexture(attm.textureName.ToLower()); Vector2 size = new Vector2(tb.Value.uv.width * tb.Value.tex.width / 128 * 2, tb.Value.uv.height * tb.Value.tex.height / 128 * 2); Matrix4x4 src = Matrix4x4.identity; { float tx = attm.translationX / 128 * 2; float ty = attm.translationY / 128 * 2; src.SetTRS(new Vector2(tx, ty), Quaternion.AngleAxis(attm.rotation, new Vector3(0, 0, 1)), Vector3.one); } Matrix4x4 dest = Matrix4x4.identity; //目标位置 { float tx = frame.translationX / 128 * 2; float ty = frame.translationY / 128 * 2; while (frame.rotation < 0) { frame.rotation += 360; } while (frame.rotation > 360) { frame.rotation -= 360; } if (float.IsNaN(frame.rotation)) { frame.rotation = 0; } dest.SetTRS(new Vector2(tx + 0, ty + 0), Quaternion.AngleAxis(frame.rotation, new Vector3(0, 0, -1)), Vector3.one); } dest = dest * src; //dest = move * dest; //dest = dest * src; if (tb != null) { meshframe.DrawRect(tb.Value, size, dest, Color.white); } else { meshframe.DrawRect(TextureBlock.Empty, new Vector2(1, 1), dest, Color.white); } } } }
void DoAttm(string name, ha_ani_tool.hadata.Node.Frame frame, Rect rect, Vector2 pos) { GUILayout.Label("DoAttm=" + mapPart.Count, GUILayout.MaxWidth(200)); }