Esempio n. 1
0
 private Material findMaterial()
 {
     if (isFillShape)
     {
         if (nowStyle.isLighting)
         {
             return(UMaterials.getFillMaterial(nowStyle.blendMode));
         }
         else
         {
             return(UMaterials.getFillUnlitMaterial(nowStyle.blendMode));
         }
     }
     else
     {
         return(UMaterials.getStrokeMaterial(nowStyle.blendMode));
     }
 }
        public void draw(Matrix4x4 matrix, Color col, Texture tex, int layer, Camera camera) // for Update
        {
            Material material = findMaterial();

            materialPB.Clear();
            materialPB.SetColor("_Color", col);
            if (isFillShape && tex != null)
            {
                materialPB.SetTexture("_MainTex", tex);
            }

            UGraphics.UStyle nstyle = nowStyle;
            for (int i = 0; i < mesh.subMeshCount; i++)
            {
                if (i == wireframeSubmeshIndex)
                {
                    if (!nstyle.isStroke)
                    {
                        continue;
                    }
                    material = UMaterials.getFillUnlitMaterial(nstyle.blendMode);
                    materialPB.Clear();
                    materialPB.SetColor("_Color", nstyle.strokeColor);
                }
                else if (isFillShape && !nstyle.isFill)
                {
                    continue;
                }
                Graphics.DrawMesh(mesh, matrix, material, layer, camera, i, materialPB);
            }

            foreach (UShape shape in children)
            {
                shape.draw(matrix, col, tex, layer, camera);
            }
        }