コード例 #1
0
        public Vector4 Compute()
        {
            Vector4 colorBase = MainTexture.Compute();

            if (DissolveTexture.Compute() <= DissolveStrength.Compute())
            {
                colorBase.W = 0;
            }

            return(colorBase);
        }
コード例 #2
0
        public void ApplySprite(string referenceId, I76Sprite sprite, bool uploadToGpu, bool alphaBlend = false)
        {
            if (sprite == null)
            {
                return;
            }

            Vector2Int referencePos = Vector2Int.zero;

            if (referenceId != null)
            {
                if (!_referencePositions.TryGetValue(referenceId, out referencePos))
                {
                    Debug.LogErrorFormat("Reference ID '{0}' does not exist for reference image '{1}'.", referenceId, Name);
                    return;
                }
            }

            int xOffset = referencePos.x;
            int yOffset = Mathf.Max(0, MainTexture.height - referencePos.y - sprite.Height - 1);

            Color32[] pixels = sprite.Pixels;
            if (alphaBlend)
            {
                Color[] existingPixels = MainTexture.GetPixels(xOffset, yOffset, sprite.Width, sprite.Height);
                int     pixelCount     = existingPixels.Length;
                for (int i = 0; i < pixelCount; ++i)
                {
                    pixels[i] = Color32.Lerp(existingPixels[i], pixels[i], pixels[i].a);
                }
            }

            MainTexture.SetPixels32(xOffset, yOffset, sprite.Width, sprite.Height, pixels, 0);

            if (uploadToGpu)
            {
                MainTexture.Apply();
            }
        }
コード例 #3
0
 public void Visit(MaterialGeneratorContext context)
 {
     MainTexture.Visit(context);
     DissolveTexture.Visit(context);
     DissolveStrength.Visit(context);
 }
コード例 #4
0
 public void UploadToGpu()
 {
     MainTexture.Apply();
 }
コード例 #5
0
 public void Accept(ShaderGeneratorContext context)
 {
     MainTexture.Accept(context);
     DissolveTexture.Accept(context);
     DissolveStrength.Accept(context);
 }
コード例 #6
0
    /// <summary>
    /// iOS only, captures a cached view for use as a texture mapped to a 3D model
    /// </summary>
    public void captureTexture()
    {
        Command cmd = Command.NewCommand("CAPT", Name, MainTexture.GetNativeTextureID(), MainTexture.width, MainTexture.height);

        cmd.Post();
    }