예제 #1
0
    public void AddTexture()
    {
        P3D_PaintableTexture item = new P3D_PaintableTexture();

        this.Textures ??= new List <P3D_PaintableTexture>();
        this.Textures.Add(item);
    }
예제 #2
0
    private bool NameOob(P3D_Paintable paintable, P3D_PaintableTexture texture)
    {
        var renderer = paintable.GetComponent <Renderer>();

        if (renderer != null)
        {
            if (texture.MaterialIndex >= 0)
            {
                var materials = renderer.sharedMaterials;

                if (texture.MaterialIndex < materials.Length)
                {
                    var material = materials[texture.MaterialIndex];
                    var names    = P3D_Helper.GetTexEnvNames(material);

                    if (names.Contains(texture.TextureName) == true)
                    {
                        return(false);
                    }
                }
            }
        }

        return(true);
    }
예제 #3
0
    public void AddTexture()
    {
        var texture = new P3D_PaintableTexture();

        if (Textures == null)
        {
            Textures = new List <P3D_PaintableTexture>();
        }

        Textures.Add(texture);
    }
예제 #4
0
 public void Paint(P3D_Brush brush, P3D_Result result, int groupMask = -1)
 {
     if ((result != null) && (this.Textures != null))
     {
         for (int i = this.Textures.Count - 1; i >= 0; i--)
         {
             P3D_PaintableTexture texture = this.Textures[i];
             if ((texture != null) && P3D_Helper.IndexInMask((int)texture.Group, groupMask))
             {
                 texture.Paint(brush, result.GetUV(texture.Coord));
             }
         }
     }
 }
예제 #5
0
 public void Paint(P3D_Brush brush, Vector2 uv, int groupMask = -1)
 {
     if (this.Textures != null)
     {
         for (int i = this.Textures.Count - 1; i >= 0; i--)
         {
             P3D_PaintableTexture texture = this.Textures[i];
             if ((texture != null) && P3D_Helper.IndexInMask((int)texture.Group, groupMask))
             {
                 texture.Paint(brush, uv);
             }
         }
     }
 }
예제 #6
0
    private bool MaterialOob(P3D_Paintable paintable, P3D_PaintableTexture texture)
    {
        var renderer = paintable.GetComponent <Renderer>();

        if (renderer != null)
        {
            if (texture.MaterialIndex >= 0 && texture.MaterialIndex < renderer.sharedMaterials.Length)
            {
                return(false);
            }
        }

        return(true);
    }
예제 #7
0
 protected virtual void Awake()
 {
     if (this.Textures != null)
     {
         for (int i = this.Textures.Count - 1; i >= 0; i--)
         {
             P3D_PaintableTexture texture = this.Textures[i];
             if (texture != null)
             {
                 texture.Awake(base.gameObject);
             }
         }
     }
     this.UpdateTree();
 }
예제 #8
0
 protected virtual void Update()
 {
     this.applyCooldown -= Time.deltaTime;
     if ((this.applyCooldown <= 0f) && (this.Textures != null))
     {
         this.applyCooldown = this.ApplyInterval;
         for (int i = this.Textures.Count - 1; i >= 0; i--)
         {
             P3D_PaintableTexture texture = this.Textures[i];
             if ((texture != null) && (texture.Painter != null))
             {
                 texture.Painter.Apply();
             }
         }
     }
     this.updateCooldown -= Time.deltaTime;
 }