Ejemplo n.º 1
0
            protected override void Do(DynamicMesh mesh, int startMeshIndex, int vertexCount, PolyShape poly)
            {
                var s = new Vector2(texturesPerUnit * aspectRatio, texturesPerUnit);

                for (int i = 0; i < vertexCount; i++)
                {
                    int meshIndex = startMeshIndex + i;
                    mesh.SetUV(meshIndex, Vector2.Scale(s, useMeshVertex ? (Vector2)mesh.vertexes[meshIndex] : poly.positions[i]));
                }
            }
Ejemplo n.º 2
0
            public void SetColor(int index, Color color, DynamicMesh mesh)
            {
                switch (mode)
                {
                case PaintMode.Replace:
                    mesh.SetColor(index, color);
                    break;

                case PaintMode.AlphaBlending:

                    //https://en.wikipedia.org/wiki/Alpha_compositing
                    Color src      = color;
                    Color dst      = mesh.GetColor(index);
                    var   out_a    = src.a + dst.a * (1f - src.a);
                    var   out_grba = (src * src.a + dst * dst.a * (1f - src.a)) / out_a;
                    out_grba.a = out_a;
                    mesh.SetColor(index, out_grba);
                    break;

                default:
                    break;
                }
            }
Ejemplo n.º 3
0
 protected abstract void Do(DynamicMesh mesh, int startMeshIndex, int vertexCount, PolyShape poly);