Exemplo n.º 1
0
        /// <summary>This allows you to paint all pixels within a sphere at the specified point.</summary>
        public void HandleHitPoint(List <P3dCommand> commands, List <P3dTransform> repeaters, bool preview, Collider collider, Vector3 worldPosition, Quaternion worldRotation, float pressure)
        {
            var finalOpacity  = opacity + (1.0f - opacity) * opacityPressure * pressure;
            var finalRadius   = radius + radiusPressure * pressure;
            var finalHardness = hardness + hardnessPressure * pressure;
            var finalColor    = color;
            var finalTexture  = texture;

            P3dPaintableManager.BuildModifiers(gameObject);
            P3dPaintableManager.ModifyColor(ref finalColor);
            P3dPaintableManager.ModifyOpacity(ref finalOpacity);
            P3dPaintableManager.ModifyRadius(ref finalRadius);
            P3dPaintableManager.ModifyHardness(ref finalHardness);

            if (scale == Vector3.one)             // Sphere?
            {
                Command.Instance.SetLocation(worldPosition, finalRadius);
            }
            else             // Elipse?
            {
                Command.Instance.SetLocation(worldPosition, scale * finalRadius, rotateTo == RotationType.World ? worldRotation : Quaternion.identity);
            }

            Command.Instance.SetMaterial(blendMode, finalHardness, finalColor, finalOpacity, finalTexture, strength, tiling);

            P3dPaintableManager.SubmitAll(Command.Instance, preview, layers, groups, targetModel, targetTexture, repeaters, commands);
        }
Exemplo n.º 2
0
        public void HandleHitPoint(List <P3dCommand> commands, List <P3dTransform> repeaters, bool preview, Collider collider, Vector3 worldPosition, Quaternion worldRotation, float pressure)
        {
            var finalOpacity  = opacity + (1.0f - opacity) * opacityPressure * pressure;
            var finalRadius   = radius + radiusPressure * pressure;
            var finalDepth    = depth + depthPressure * pressure;
            var finalHardness = hardness + hardnessPressure * pressure;
            var finalColor    = color;
            var finalAngle    = angle;
            var finalTexture  = texture;

            P3dPaintableManager.BuildModifiers(gameObject);
            P3dPaintableManager.ModifyColor(ref finalColor);
            P3dPaintableManager.ModifyAngle(ref finalAngle);
            P3dPaintableManager.ModifyOpacity(ref finalOpacity);
            P3dPaintableManager.ModifyHardness(ref finalHardness);
            P3dPaintableManager.ModifyRadius(ref finalRadius);
            P3dPaintableManager.ModifyTexture(ref finalTexture);

            worldRotation = worldRotation * Quaternion.Euler(0.0f, 0.0f, finalAngle);

            Command.Instance.SetLocation(worldPosition, worldRotation, scale, finalRadius, finalTexture, finalDepth);

            Command.Instance.SetMaterial(blendMode, texture, finalHardness, normalBack, normalFront, normalFade, finalColor, finalOpacity, shape);

            P3dPaintableManager.SubmitAll(Command.Instance, preview, layers, groups, targetModel, targetTexture, repeaters, commands);
        }
Exemplo n.º 3
0
        /// <summary>This method paints all pixels at the specified point using the shape of a sphere.</summary>
        public void HandleHitPoint(bool preview, int priority, float pressure, int seed, Vector3 position, Quaternion rotation)
        {
            if (paint != PaintType.In3D)
            {
                return;
            }

            if (modifiers != null && modifiers.Count > 0)
            {
                P3dHelper.BeginSeed(seed);
                modifiers.ModifyPosition(ref position, preview, pressure);
                P3dHelper.EndSeed();
            }

            P3dCommandDecal.Instance.SetState(preview, priority);
            P3dCommandDecal.Instance.SetLocation(position);

            var worldSize     = HandleHitCommon(preview, pressure, seed, rotation);
            var worldRadius   = P3dHelper.GetRadius(worldSize);
            var worldPosition = position;

            HandleMaskCommon(worldPosition);

            P3dPaintableManager.SubmitAll(P3dCommandDecal.Instance, worldPosition, worldRadius, layers, group, targetModel, targetTexture);
        }
Exemplo n.º 4
0
        /// <summary>This method paints all pixels between two pairs of points using the shape of a sphere.</summary>
        public void HandleHitQuad(bool preview, int priority, Vector3 position, Vector3 endPosition, Vector3 position2, Vector3 endPosition2, Quaternion rotation, float pressure)
        {
            Command.Instance.SetState(preview, priority);
            Command.Instance.SetLocation(position, endPosition, position2, endPosition2);

            var worldSize     = HandleHitCommon(rotation, pressure);
            var worldRadius   = P3dHelper.GetRadius(worldSize, position, endPosition, position2, endPosition2);
            var worldPosition = P3dHelper.GetPosition(position, endPosition, position2, endPosition2);

            P3dPaintableManager.SubmitAll(Command.Instance, worldPosition, worldRadius, layers, group, targetModel, targetTexture);
        }
        /// <summary>This method paints all pixels between three points using the shape of a sphere.</summary>
        public void HandleHitTriangle(bool preview, int priority, float pressure, int seed, Vector3 positionA, Vector3 positionB, Vector3 positionC, Quaternion rotation)
        {
            P3dCommandSphere.Instance.SetState(preview, priority);
            P3dCommandSphere.Instance.SetLocation(positionA, positionB, positionC);

            var worldSize     = HandleHitCommon(preview, pressure, seed, rotation);
            var worldRadius   = P3dHelper.GetRadius(worldSize, positionA, positionB, positionC);
            var worldPosition = P3dHelper.GetPosition(positionA, positionB, positionC);

            HandleMaskCommon(worldPosition);

            P3dPaintableManager.SubmitAll(P3dCommandSphere.Instance, worldPosition, worldRadius, layers, group, targetModel, targetTexture);
        }
Exemplo n.º 6
0
        /// <summary>This allows you to paint all pixels within a capsule between the specified points.</summary>
        public void HandleHitLine(List <P3dCommand> commands, List <P3dTransform> repeaters, bool preview, Vector3 worldPositionA, Vector3 worldPositionB, float pressureA, float pressureB)
        {
            var finalOpacityA  = opacity + (1.0f - opacity) * opacityPressure * pressureA;
            var finalRadiusA   = radius + radiusPressure * pressureA;
            var finalHardnessA = hardness + hardnessPressure * pressureA;

            //var finalOpacityB  = opacity + (1.0f - opacity) * opacityPressure * pressureB;
            //var finalRadiusB   = radius + radiusPressure * pressureB;
            //var finalHardnessB = hardness + hardnessPressure * pressureB;

            Command.Instance.SetLocation(worldPositionA, worldPositionB, finalRadiusA);

            Command.Instance.SetMaterial(blendMode, finalHardnessA, color, finalOpacityA, texture, strength, tiling);

            P3dPaintableManager.SubmitAll(Command.Instance, preview, layers, groups, targetModel, targetTexture, repeaters, commands);
        }
Exemplo n.º 7
0
        /// <summary>This method paints all pixels between two pairs of points using the shape of a sphere.</summary>
        public void HandleHitQuad(bool preview, int priority, float pressure, int seed, Vector3 position, Vector3 endPosition, Vector3 position2, Vector3 endPosition2, Quaternion rotation)
        {
            if (paint != PaintType.In3D)
            {
                return;
            }

            P3dCommandDecal.Instance.SetState(preview, priority);
            P3dCommandDecal.Instance.SetLocation(position, endPosition, position2, endPosition2);

            var worldSize     = HandleHitCommon(preview, pressure, seed, rotation);
            var worldRadius   = P3dHelper.GetRadius(worldSize, position, endPosition, position2, endPosition2);
            var worldPosition = P3dHelper.GetPosition(position, endPosition, position2, endPosition2);

            HandleMaskCommon(worldPosition);

            P3dPaintableManager.SubmitAll(P3dCommandDecal.Instance, worldPosition, worldRadius, layers, group, targetModel, targetTexture);
        }