示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (startedPrinting)
        {
            isPrinting = true;
            UpdatePrinter();
        }

        if (isPrinting && counter >= printTime)
        {
            isPrinting      = false;
            startedPrinting = false;
            counter         = 0;
            slicingPlane.meshToSlice.GetComponent <Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
            slicingPlane.GetComponent <Renderer>().enabled = false;
            slicingPlane.transform.Translate(0, 1, 0);
            slicingPlane.UpdateEquation();
        }
    }
示例#2
0
    public void UpdateMaterial()
    {
        if (slicingPlane)
        {
            if (!renderer)
            {
                renderer = GetComponent <Renderer>();
            }

            if (renderer)
            {
                if (materials.Length == 0)
                {
                    materials = renderer.sharedMaterials;
                }
            }

            if (materials.Length > 0)
            {
                if (activeShader)
                {
                    for (int i = 0; i < materials.Length; i++)
                    {
                        materials[i].shader = activeShader;
                    }
                }

                for (int i = 0; i < materials.Length; i++)
                {
                    //if (activeShader != outlineHologram)
                    {
                        materials[i].SetVector("_SlicingPlane", slicingPlane.GetEquation());
                    }
                }

                slicingPlane.UpdateEquation();
            }
        }
    }