Example #1
0
        private void OnReleased(PointerInput input, double time)
        {
            DebugInfo(input);

            DrawingLine activeLine;

            if (!activeLines.TryGetValue(input.InputId, out activeLine))
            {
                // Probably the press started on a UI element
                return;
            }

            activeLine.SubmitPoint(input, GetWorldPosFromInput(input, LineZ));

            // Remove from dictionary
            activeLines.Remove(input.InputId);

            DrawingLine finalLine = activeLine;

            if (LineDrawn != null)
            {
                finalLine = LineDrawn(activeLine);
            }
            if (finalLine != null)
            {
                existingLines.Add(finalLine);
            }
        }
Example #2
0
        private void CreateNewLine(PointerInput input)
        {
            Vector3 worldPos = GetWorldPosFromInput(input, LineZ);
            var     newLine  = new DrawingLine(activeTool, input, worldPos, activeColor);

            activeLines[input.InputId] = newLine;

            newLine.RendererInstance.transform.parent = transform;
        }
Example #3
0
        /// <summary>
        /// Flatten the given line.
        /// </summary>
        private DrawingLine OnLineDrawn(DrawingLine drawnLine)
        {
            LineRenderer lineRenderer = drawnLine.RendererInstance;

            lineRenderer.gameObject.layer = LayerMask.NameToLayer(completedLayerName);

            // Camera clears to 0, 0, 0, 0
            captureCamera.RenderWithShader(captureShader, "Premultiplied");

            Destroy(lineRenderer.gameObject);
            SwapBuffers();

            // Tell controller that we've been disabled
            return(null);
        }