Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #3
0
        /// <summary>
        /// Called just before a new thread is started in which <see cref="Execute"/> is called.
        /// Use this to update the input state, set flags and access any Unity API from the main thread.<p/>
        /// Called on the main thread.
        /// </summary>
        public void PreExecute()
        {
            // Add logic here that uses the Unity API (e.g. Input)
            PreExecuteInput();
            PreExecuteTransform();

            // Apply changes in UI to the state
            _uiDetails.UpdatePreExecute();

            // Copy the Input to ExecuteInput so the thread has its own copy
            _executeInput = Input;
            // Immediately consume the input on the main thread copy so we can detect new changes whilst we are in Execute
            Input.Consume();
        }