Exemple #1
0
            MeshData GetLineMeshData(Vector2[] line)
            {
                MeshData meshData = new MeshData();

                if (additional.isAdditionalMode)
                {
                    MeshData lineMesh = LineDrawer.GetMeshDataMk2(line, width, additional.materialLeft, material, additional.materialRight, zValue);
                    meshData = MeshData.Marge(meshData, lineMesh);
                }
                else
                {
                    MeshData lineMesh = LineDrawer.GetMeshData(line, width, material, zValue);
                    meshData = MeshData.Marge(meshData, lineMesh);
                }

                if (make3D.is3DMode)
                {
                    List <Vector2> linepadData = LineDrawer.GetMainLineData(line, Mathf.Max(0.001f, make3D.padding))[0];

                    for (int i = linepadData.Count - 1; i >= 0; i--)
                    {
                        if (i >= 2 && i % 2 == 1)
                        {
                            linepadData.RemoveAt(i);
                        }
                    }
                    for (int i = 0; i < linepadData.Count - 1; i++)
                    {
                        var topMesh = PolygonGetter.GetSidePolygon(linepadData[i], linepadData[i + 1], 1.0f, make3D.front, make3D.back, make3D.topMaterial);
                        meshData = MeshData.Marge(meshData, topMesh);
                    }
                }
                return(meshData);
            }
Exemple #2
0
        void MakeMesh()
        {
            MeshData meshData;

            if (additional.isAdditional)
            {
                meshData = LineDrawer.GetMeshDataMk2(edgeCollider.points, width, additional.materialLeft, materialNum, additional.materialRight, 0);
            }
            else
            {
                meshData = LineDrawer.GetMeshData(edgeCollider.points, width, materialNum, 0);
            }

            Mesh mesh = meshData.GetMesh(meshRenderer.sharedMaterials.Length);

            if (meshFilter.sharedMesh != null)
            {
                DestroyImmediate(meshFilter.sharedMesh);
            }
            meshFilter.mesh = mesh;
        }