/// <summary>This method paints the scene using the current component settings at the specified <b>P3dHit</b>.
        /// NOTE: The <b>rotation</b> argument is in world space, where <b>Quaternion.identity</b> means the paint faces forward on the +Z axis, and up is +Y.</summary>
        public void HandleHitCoord(bool preview, int priority, float pressure, int seed, P3dHit hit, Quaternion rotation)
        {
            var model = hit.Root.GetComponent <P3dModel>();

            if (model != null)
            {
                var paintableTextures = P3dPaintableTexture.FilterAll(model, group);

                for (var i = paintableTextures.Count - 1; i >= 0; i--)
                {
                    var paintableTexture = paintableTextures[i];
                    var coord            = paintableTexture.GetCoord(ref hit);

                    if (modifiers != null && modifiers.Count > 0)
                    {
                        var position = (Vector3)coord;

                        P3dHelper.BeginSeed(seed);
                        modifiers.ModifyPosition(ref position, preview, pressure);
                        P3dHelper.EndSeed();

                        coord = position;
                    }

                    P3dCommandSphere.Instance.SetState(preview, priority);
                    P3dCommandSphere.Instance.SetLocation(coord, false);

                    HandleHitCommon(preview, pressure, seed, rotation);

                    P3dCommandSphere.Instance.ClearMask();

                    P3dCommandSphere.Instance.ApplyAspect(paintableTexture.Current);

                    P3dPaintableManager.Submit(P3dCommandSphere.Instance, model, paintableTexture);
                }
            }
        }
Exemple #2
0
        public void HandleHitCoord(bool preview, int priority, float pressure, int seed, P3dHit hit, Quaternion rotation)
        {
            var model = hit.Root.GetComponentInParent <P3dModel>();

            if (model != null)
            {
                var paintableTextures = P3dPaintableTexture.FilterAll(model, group);

                if (paintableTextures.Count > 0)
                {
                    var finalColor   = color;
                    var finalOpacity = opacity;
                    var finalTexture = texture;

                    if (modifiers != null && modifiers.Count > 0)
                    {
                        P3dHelper.BeginSeed(seed);
                        modifiers.ModifyColor(ref finalColor, preview, pressure);
                        modifiers.ModifyOpacity(ref finalOpacity, preview, pressure);
                        modifiers.ModifyTexture(ref finalTexture, preview, pressure);
                        P3dHelper.EndSeed();
                    }

                    P3dCommandFill.Instance.SetState(preview, priority);
                    P3dCommandFill.Instance.SetMaterial(blendMode, finalTexture, finalColor, opacity, minimum);

                    for (var i = paintableTextures.Count - 1; i >= 0; i--)
                    {
                        var paintableTexture = paintableTextures[i];

                        P3dPaintableManager.Submit(P3dCommandFill.Instance, model, paintableTexture);
                    }
                }
            }
        }
        public void HandleHitCoord(bool preview, int priority, float pressure, int seed, P3dHit hit, Quaternion rotation)
        {
            var model = hit.Root.GetComponentInParent <P3dModel>();

            if (model != null)
            {
                var paintableTextures = P3dPaintableTexture.FilterAll(model, group);

                if (paintableTextures.Count > 0)
                {
                    P3dCommandReplaceChannels.Instance.SetState(preview, priority);
                    P3dCommandReplaceChannels.Instance.SetMaterial(textureR, textureG, textureB, textureA, channelR, channelG, channelB, channelA);

                    for (var i = paintableTextures.Count - 1; i >= 0; i--)
                    {
                        var paintableTexture = paintableTextures[i];

                        P3dPaintableManager.Submit(P3dCommandReplaceChannels.Instance, model, paintableTexture);
                    }
                }
            }
        }
Exemple #4
0
        public void HandleHitCoord(bool preview, int priority, float pressure, int seed, P3dHit hit, Quaternion rotation)
        {
            if (preview == true && this.preview == false)
            {
                return;
            }

            var model = hit.Root.GetComponent <P3dModel>();

            if (model != null)
            {
                var paintableTextures = P3dPaintableTexture.FilterAll(model, group);

                for (var i = paintableTextures.Count - 1; i >= 0; i--)
                {
                    var paintableTexture = paintableTextures[i];
                    var coord            = paintableTexture.GetCoord(ref hit);

                    color = P3dHelper.GetPixel(paintableTexture.Current, coord);

                    if (onColor != null)
                    {
                        onColor.Invoke(color);
                    }
                }
            }
        }
Exemple #5
0
        public void InvokeCoord(GameObject gameObject, bool preview, int priority, float pressure, P3dHit hit, Quaternion rotation)
        {
            if (cached == false)
            {
                Cache(gameObject);
            }

            var seed = Random.Range(int.MinValue, int.MaxValue);

            for (var i = 0; i < hitCoords.Count; i++)
            {
                hitCoords[i].HandleHitCoord(preview, priority, pressure, seed, hit, rotation);
            }
        }