示例#1
0
        /// <summary>
        /// Create a behaviour for the <see cref="Mesh"/> <see cref="MonoBehaviour"/> component.
        /// Every Mesh has one behaviour.
        /// </summary>
        public LibiglBehaviour(LibiglMesh libiglMesh)
        {
            Mesh = libiglMesh;

            // Initialize C++ and create the State from the DataRowMajor
            State = Native.InitializeMesh(libiglMesh.DataRowMajor.GetNative(), Mesh.name);
            Input = MeshInputState.GetInstance();

            _uiDetails = UiManager.get.CreateDetailsPanel();
            _uiDetails.Initialize(this);
        }
示例#2
0
        /// <summary>
        /// Applies changes to the C++ State to this instance. Use this to copy changes from Col to RowMajor.<p/>
        /// Can and should be called from a worker thread. Behind the scenes this tranposes and copies the matrices.<p/>
        /// The DirtyState is propagated so <see cref="ApplyDirtyToMesh"/> (called on the main thread) will apply the changes.
        /// <seealso cref="Native.ApplyDirty"/>
        /// </summary>
        public unsafe void ApplyDirty(MeshState *state, MeshInputState inputState)
        {
            Assert.IsTrue(VSize == state->VSize && FSize == state->FSize);

            // Copy over and transpose data that has changed
            Native.ApplyDirty(state, _native, inputState.VisibleSelectionMask);

            DirtyState             |= state->DirtyState;
            DirtySelections        |= state->DirtySelections;
            DirtySelectionsResized |= state->DirtySelectionsResized;
        }
示例#3
0
        /// <summary>
        /// This is the destructor. Ensure all C++ owned data is deleted. Calls <see cref="Native.DisposeMesh"/>
        /// </summary>
        public void Dispose()
        {
            // Be sure to dispose of any NativeArrays that are not garbage collected
            if (_uiDetails)
            {
                Object.Destroy(_uiDetails.gameObject);
            }

            // Delete the State fully inside C++
            Native.DisposeMesh(State);
            State = null;
        }