コード例 #1
0
    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);
        }
    }
コード例 #2
0
    public MeshGroupFrame CreateMeshGroupFrame(string aniname, int frameid)
    {
        var ani = GetAnim(aniname);
            if (ani == null)
                return null;

            MeshGroupFrame f = new MeshGroupFrame();
            CreateMesh(f, new Vector2(ani.size.X,ani.size.Y),  ani.frames[frameid]);
            return f;
    }
コード例 #3
0
    void CreateMesh(MeshGroupFrame frame, Dictionary <string, ha_ani_tool.hadata.Node.Frame> frames)
    {
        Debug.Log("MeshGroupFrame.CreateMesh");
        MeshGroupFrame.InitShader();

        frame.BeginMesh();
        foreach (var n in frames)
        {
            DoAttm(frame, n.Key, n.Value);
        }
        frame.FinishMesh();
    }
コード例 #4
0
 public MeshGroupFrame CreateMeshGroupFrame(string aniname, int frameid)
 {
     Debug.Log("CreateMeshGroupFrame:" + aniname + "," + frameid);
     ha_ani_tool.hadata.AniRuntime ani = getAniRunTime(aniname);
     if (ani != null)
     {
         MeshGroupFrame f = new MeshGroupFrame();
         CreateMesh(f, ani.frames[frameid]);
         return(f);
     }
     return(null);
 }
コード例 #5
0
 public MeshGroupFrame CreateMeshGroupFrame(string aniname, int frameid)
 {
     Debug.Log("CreateMeshGroupFrame:" + aniname+","+frameid);
        ha_ani_tool.hadata.AniRuntime ani = getAniRunTime(aniname);
        if (ani != null)
        {
            MeshGroupFrame f =new MeshGroupFrame();
            CreateMesh(f, ani.frames[frameid]);
            return f;
        }
        return null;
 }
コード例 #6
0
    void CreateMesh(MeshGroupFrame frame, Vector2 size, KAnim.Frame srcframe)
    {
        //Debug.Log("MeshGroupGroupDataK.CreateMesh");
        MeshGroupFrame.InitShader();

        frame.BeginMesh();
        for (int i = srcframe.elems.Count - 1; i >= 0; i--)
        {
            DoAttm(frame, size, srcframe.elems[i]);
        }
        frame.FinishMesh();
    }
コード例 #7
0
    void CreateMesh(MeshGroupFrame frame,Vector2 size, KAnim.Frame srcframe)
    {
        //Debug.Log("MeshGroupGroupDataK.CreateMesh");
            MeshGroupFrame.InitShader();

            frame.BeginMesh();
            for(int i =srcframe.elems.Count-1;i>=0;i--)
            {
                DoAttm(frame, size, srcframe.elems[i]);
            }
            frame.FinishMesh();
    }
コード例 #8
0
    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);
                }
            }
        }
    }
コード例 #9
0
    public MeshGroupFrame CreateMeshGroupFrame(string aniname, int frameid)
    {
        var ani = GetAnim(aniname);

        if (ani == null)
        {
            return(null);
        }

        MeshGroupFrame f = new MeshGroupFrame();

        CreateMesh(f, new Vector2(ani.size.X, ani.size.Y), ani.frames[frameid]);
        return(f);
    }
コード例 #10
0
ファイル: MeshGroup.cs プロジェクト: kkndest/fightclub
 public MeshGroupFrame GetFrame(int frame)
 {
     if (frames.ContainsKey(frame))
     {
         return(frames[frame]);
     }
     else
     {
         MeshGroupFrame f = data.CreateMeshGroupFrame(aniname, frame);
         //CreateMesh Here
         //MeshGroupPuppet.CreateMesh(f,puppet, anim.frames[frame]);
         frames[frame] = f;
         return(f);
     }
 }
コード例 #11
0
    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);
                    }

                }
            }
    }
コード例 #12
0
    void CreateMesh(MeshGroupFrame frame, Dictionary<string, ha_ani_tool.hadata.Node.Frame> frames)
    {
        Debug.Log("MeshGroupFrame.CreateMesh");
            MeshGroupFrame.InitShader();

            frame.BeginMesh();
            foreach (var n in frames)
            {
                DoAttm(frame,n.Key, n.Value);
            }
            frame.FinishMesh();
    }
コード例 #13
0
    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);
            }
    }