Beispiel #1
0
        //-----------------------------------------------------------------------------------
        // Deform()
        //-----------------------------------------------------------------------------------

        /// <summary>
        /// 切り口付近で2つのsmeshが重なるように変形する
        /// patch2がdst方向
        /// </summary>
        private static void Deform(PatchSkeletalMesh patch1, PatchSkeletalMesh patch2, PatchSkeleton refSkeleton, PatchSection section1, PatchSection section2, PatchSkeletonBone crossingBone)
        {
            if (patch1 == null || patch2 == null)
            {
                return;
            }

            // 各メッシュを大雑把にスケルトンに合わせる
            PatchSkeletonFitting.Fitting(patch1, refSkeleton);
            PatchSkeletonFitting.Fitting(patch2, refSkeleton);

            // TODO: サイズの修正

            // 回転はFitting()でやってるから必要ない

            // 位置の調整

            float overlap = OverlapWidth(patch1, patch2, refSkeleton, section1, section2, crossingBone, 100, 45);

            AdjustHeight(patch1, patch2, refSkeleton, section1, section2, crossingBone);
            OverlayPatches(patch1, patch2, refSkeleton, section1, section2, crossingBone, overlap);

#if _DEBUG
            PatchSkeletalMeshRenderer.ToBitmap(patch1).Save("output_Connector2/4_patch1.png");
            PatchSkeletalMeshRenderer.ToBitmap(patch2).Save("output_Connector2/4_patch2.png");
#endif
            // メッシュを伸ばして繋げる
            Expand(patch1, patch2, refSkeleton, section1, section2, crossingBone, overlap, overlap);
        }
Beispiel #2
0
        //-----------------------------------------------------------------------------------
        // Deform()
        //-----------------------------------------------------------------------------------

        /// <summary>
        /// 切り口付近で2つのsmeshが重なるように変形する
        /// </summary>
        private static void Deform(PatchSkeletalMesh smesh1, PatchSkeletalMesh smesh2, PatchSkeleton skl, PatchSection section1, PatchSection section2, PatchSkeletonBone crossingBone)
        {
            if (smesh1 == null || smesh2 == null)
            {
                return;
            }

            // 各メッシュを大雑把にスケルトンに合わせる
            PatchSkeletonFitting.Fitting(smesh1, skl);
            PatchSkeletonFitting.Fitting(smesh2, skl);
#if _DEBUG
            PatchSkeletalMeshRenderer.ToBitmap(smesh1, new List <PatchSection>()
            {
                section1
            }).Save("output/5_1_mesh1_fitting.png");
            PatchSkeletalMeshRenderer.ToBitmap(smesh2, new List <PatchSection>()
            {
                section2
            }).Save("output/5_2_mesh2_fitting.png");
#endif

            // サイズの修正は手動でやる
            // 回転はFitting()でやってるから必要ない

            // 位置の調整
            AdjustPosition(smesh1, smesh2, skl, section1, section2, crossingBone);
#if _DEBUG
            PatchSkeletalMeshRenderer.ToBitmap(smesh1, new List <PatchSection>()
            {
                section1
            }).Save("output/5_3_mesh1_AdjustPosition.png");
            PatchSkeletalMeshRenderer.ToBitmap(smesh2, new List <PatchSection>()
            {
                section2
            }).Save("output/5_4_mesh2_AdjustPosition.png");
#endif

            // メッシュを伸ばして繋げる
            Expand(smesh1, smesh2, skl, section1, section2, crossingBone);
#if _DEBUG
            PatchSkeletalMeshRenderer.ToBitmap(smesh1, new List <PatchSection>()
            {
                section1
            }).Save("output/5_5_mesh1_ExpandPatches.png");
            PatchSkeletalMeshRenderer.ToBitmap(smesh2, new List <PatchSection>()
            {
                section2
            }).Save("output/5_6_mesh2_ExpandPatches.png");
#endif
        }