예제 #1
0
    void OnGUI()
    {
        // Manipulator values
        GUI.Box(new Rect(0, 0, 220, 125), "Manipulator");
        GUI.Label(new Rect(10, 30, 200, 30), "Strength: " + manipulatorStrength.ToString("f1"));
        manipulatorStrength = GUI.HorizontalSlider(new Rect(10, 55, 200, 30), manipulatorStrength, 0f, 30f);
        if (GUI.Button(new Rect(10, 85, 200, 30), "Transition: " + manipulator.property.transition.ToString()))
        {
            if (manipulator.property.transition == MANIPULATORPROPERTYTRANSITIONC.Linear)
            {
                manipulator.property.transition = MANIPULATORPROPERTYTRANSITIONC.Lerp;
            }
            else
            {
                manipulator.property.transition = MANIPULATORPROPERTYTRANSITIONC.Linear;
            }
        }

        // Turbulence values
        GUI.Box(new Rect(240, 0, 220, 125), "Turbulence");
        GUI.Label(new Rect(250, 30, 200, 30), "Strength: " + particles.turbulenceStrength.ToString("f1"));
        particles.turbulenceStrength = GUI.HorizontalSlider(new Rect(250, 55, 200, 30), particles.turbulenceStrength, 0f, 50f);
        if (GUI.Button(new Rect(250, 85, 200, 30), "Type: " + particles.turbulenceType.ToString()))
        {
            if (particles.turbulenceType == TURBULENCETYPE.Perlin)
            {
                particles.turbulenceType = TURBULENCETYPE.Simplex;
            }
            else
            {
                particles.turbulenceType = TURBULENCETYPE.Perlin;
            }
        }

        // Mesh values
        GUI.Box(new Rect(Screen.width - 220, 0, 220, 125), "Mesh");
        GUI.Label(new Rect(Screen.width - 210, 30, 200, 30), "Rotation Speed: " + rotationSpeed.ToString("f1"));
        rotationSpeed = GUI.HorizontalSlider(new Rect(Screen.width - 210, 55, 200, 30), rotationSpeed, -100f, 100f);
        if (GUI.Button(new Rect(Screen.width - 210, 85, 200, 30), "Subdivide x" + subdivisionFactor.ToString()))
        {
            subdivisionFactor++; subdivisionFactor = subdivisionFactor % 4;

            // Subdivide or recreate the original mesh depending on subdivision factor
            if (subdivisionFactor == 0)
            {
                IsoSphere.CreateMesh(gameObject, 1, proceduralMeshSize, false);
            }
            else
            {
                SubdivideMesh.Subdivide(gameObject.GetComponent <MeshFilter>().mesh);
            }

            UpdateTargetManipulator();
        }
    }
예제 #2
0
    static void _SubdivideMesh()
    {
        SubdivideMesh subdivideMesh = SubdivideMesh.Instance;

        for (int i = 0; i < Selection.transforms.Length; i++)
        {
            Transform  trs        = Selection.transforms[i];
            MeshFilter meshFilter = trs.GetComponent <MeshFilter>();
            if (meshFilter != null)
            {
                if (subdivideMesh == null)
                {
                    Do(meshFilter);
                }
                else
                {
                    Do(meshFilter, 1, subdivideMesh.makeAsset, subdivideMesh.autoNameAssetPath, subdivideMesh.saveAssetAtPath);
                }
                break;
            }
        }
    }