void DoAttm(MeshGroupFrame meshframe, Vector2 anisize, KAnim.Element elem) { //跳过dummy的绘制 if (elem.tag.IndexOf("dummy:") == 0) { return; } var seed = dataK.seeds[elem.seed]; TextureBlock?tb = TextureBlockMgr.getTexture(seed.texname.ToLower()); //Vector2 size = new Vector2(tb.Value.uv.width * tb.Value.tex.width *scaleWorld, // tb.Value.uv.height * tb.Value.tex.height *scaleWorld); Vector2 size = seed.size; Vector2 orient = seed.orient; Matrix4x4 dest = Matrix4x4.identity; //目标位置 { Vector2 t = new Vector2(elem.pos.x - anisize.x / 2, anisize.y - elem.pos.y); float rotate = (float)(elem.rotate / Math.PI * 180.0); while (rotate < 0) { rotate += 360; } while (rotate > 360) { rotate -= 360; } if (float.IsNaN(rotate)) { rotate = 0; } Matrix4x4 move = Matrix4x4.TRS(t, Quaternion.identity, Vector3.one); Matrix4x4 rs = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(rotate, new Vector3(0, 0, -1)), elem.scale); Matrix4x4 scaleworld = Matrix4x4.Scale(new Vector3(scaleWorld, scaleWorld, scaleWorld)); dest = scaleworld * move * rs; // scaleworld* rs *move; } Color c = Color.white; c.a = (float)elem.color.a / 255.0f; c.r = (float)elem.color.r / 255.0f; c.g = (float)elem.color.g / 255.0f; c.b = (float)elem.color.b / 255.0f; if (tb != null) { meshframe.DrawRect(tb.Value, size, orient, dest, c); } else { meshframe.DrawRect(TextureBlock.Empty, new Vector2(1, 1), dest, c); } }
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(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(MeshGroupFrame meshframe,Vector2 anisize, KAnim.Element elem) { //跳过dummy的绘制 if (elem.tag.IndexOf("dummy:") == 0) return; var seed = dataK.seeds[elem.seed]; TextureBlock? tb = TextureBlockMgr.getTexture(seed.texname.ToLower()); //Vector2 size = new Vector2(tb.Value.uv.width * tb.Value.tex.width *scaleWorld, // tb.Value.uv.height * tb.Value.tex.height *scaleWorld); Vector2 size = seed.size; Vector2 orient = seed.orient; Matrix4x4 dest = Matrix4x4.identity; //目标位置 { Vector2 t = new Vector2( elem.pos.x - anisize.x/2 ,anisize.y -elem.pos.y); float rotate = (float)(elem.rotate / Math.PI * 180.0); while (rotate < 0) rotate += 360; while (rotate > 360) rotate -= 360; if (float.IsNaN(rotate)) rotate = 0; Matrix4x4 move = Matrix4x4.TRS(t, Quaternion.identity, Vector3.one); Matrix4x4 rs = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(rotate, new Vector3(0, 0, -1)), elem.scale); Matrix4x4 scaleworld = Matrix4x4.Scale(new Vector3(scaleWorld, scaleWorld, scaleWorld)); dest = scaleworld * move * rs;// scaleworld* rs *move; } Color c = Color.white; c.a = (float)elem.color.a / 255.0f; c.r = (float)elem.color.r / 255.0f; c.g = (float)elem.color.g / 255.0f; c.b = (float)elem.color.b / 255.0f; if (tb != null) { meshframe.DrawRect(tb.Value, size, orient, dest, c); } else { meshframe.DrawRect(TextureBlock.Empty, new Vector2(1, 1), dest, c); } }