예제 #1
0
            public override float[] OnStroke(RaycastHit hit, Stroke.Stroke currentStroke, float strokeTime,
                                             float strokingValue)
            {
                if (reflectedStroke == null)
                {
                    Debug.Log("ERROR in PaintingTool:ReflectionPainting - reflectedStroke is still null!");
                }

                var keyOrigin = new Key
                {
                    time      = strokeTime,
                    position  = hit.point,
                    intensity = strokingValue * 2
                };

                var reflectedPosition = hit.point;

                reflectedPosition.x *= -1;

                var keyReflected = new Key
                {
                    time      = strokeTime,
                    position  = reflectedPosition,
                    intensity = strokingValue * 2,
                    deleted   = false
                };

                // set all intensities to 0
                for (var i = 0; i < intensities.Length; i++)
                {
                    intensities[i] = 0;
                }
                evaluator.CalculateIntensitiesForKey(keyOrigin, intensities);
                evaluator.CalculateIntensitiesForKey(keyReflected, intensities);

                if (currentStroke == null)
                {
                    return(intensities);
                }
                currentStroke.AddKey(keyOrigin);
                reflectedStroke.AddKey(keyReflected);

                return(intensities);
            }
예제 #2
0
            public override float[] OnStroke(RaycastHit hit, Stroke.Stroke currentStroke, float strokeTime,
                                             float strokingValue)
            {
                var key = new Key
                {
                    time      = strokeTime,
                    position  = hit.point,
                    intensity = strokingValue * 2,
                    deleted   = false
                };

                // set all intensities to 0
                for (var i = 0; i < intensities.Length; i++)
                {
                    intensities[i] = 0;
                }

                evaluator.CalculateIntensitiesForKey(key, intensities);

                currentStroke?.AddKey(key);

                return(intensities);
            }