Esempio n. 1
0
        public void FinalizeRenderer()
        {
            if (OnFinalizeRenderer != null)
            {
                OnFinalizeRenderer();
            }

            // TODO: Add proper history management / other finalization logic
            GameObject meshObj = new GameObject();

            meshObj.transform.parent = _finalizedRibbonParent.transform;
            MeshRenderer renderer = meshObj.AddComponent <MeshRenderer>();

            renderer.material = _meshRenderer.material;
            MeshFilter filter = meshObj.AddComponent <MeshFilter>();

            filter.mesh = _mesh;

            if (registerWithHistoryManager)
            {
                _historyManager.NotifyStroke(meshObj, _cachedStrokeRenderered);
            }

            _cachedStrokeRenderered = new List <StrokePoint>();

            _meshFilter.mesh = _mesh = null;
        }
Esempio n. 2
0
        // TODO DELETEME FIXME
        private void DoOnMeshStrokeFinalized(Mesh mesh, List <StrokePoint> stroke)
        {
            GameObject finishedRibbonMesh = new GameObject();

            if (stroke != null && stroke.Count > 0)
            {
                finishedRibbonMesh.name = stroke[0].color.r + ", " + stroke[0].color.g + ", " + stroke[0].color.b;
            }
            MeshFilter   filter    = finishedRibbonMesh.AddComponent <MeshFilter>();
            MeshRenderer renderer  = finishedRibbonMesh.AddComponent <MeshRenderer>();
            Material     ribbonMat = new Material(Shader.Find("LeapMotion/RibbonShader"));

            ribbonMat.hideFlags = HideFlags.HideAndDontSave;
            renderer.material   = ribbonMat;
            filter.mesh         = mesh;

            _historyManager.NotifyStroke(finishedRibbonMesh, stroke);

            finishedRibbonMesh.transform.parent = _ribbonParentObject.transform;
        }