Exemplo n.º 1
0
    public void BeginPaint()
    {
        if (lockedMesh != null && lockedRenderer != null)
        {
            tree.SetMesh(lockedMesh, currentMaterialIndex);

            painter.SetCanvas(currentTexture, CurrentTiling, CurrentOffset);
        }
    }
Exemplo n.º 2
0
    // This allows you to change which mesh is currently used when doing painting
    // NOTE: If you're using MeshCollider raycasting then you don't need to call this, as you can pass the hit UV coordinates directly to the Paint method
    // NOTE: The material index is passed here because it alters the submesh used by the mesh
    public void SetMesh(Transform newTransform, Mesh newMesh, int newMaterialIndex = 0, bool forceUpdate = false)
    {
        if (tree == null)
        {
            tree = new P3D_Tree();
        }

        transform = newTransform;

        tree.SetMesh(newMesh, newMaterialIndex, forceUpdate);
    }
Exemplo n.º 3
0
    public void UpdateTree()
    {
        var forceUpdate = false;
        var mesh        = P3D_Helper.GetMesh(gameObject, ref bakedMesh);

        if (bakedMesh != null)
        {
            forceUpdate = true;
        }

        if (tree == null)
        {
            tree = new P3D_Tree();
        }

        tree.SetMesh(mesh, SubMeshIndex, forceUpdate);
    }