Exemple #1
0
        public void EndFrame(float frameDelta)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverPreInterpolation();
            }

            if (OnBeforePositionInterpolation != null)
            {
                OnBeforePositionInterpolation(this, null);
            }

            Oni.ApplyPositionInterpolation(oniSolver, frameDelta);

            Oni.GetRenderableParticlePositions(oniSolver, renderablePositions, renderablePositions.Length, 0);

            // Trigger fluid update:
            TriggerFluidUpdateEvents();

            CheckVisibility();

            if (OnBeforeActorsFrameEnd != null)
            {
                OnBeforeActorsFrameEnd(this, null);
            }

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverFrameEnd();
            }
        }
Exemple #2
0
        public void EndFrame(float stepTime)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverPreInterpolation();
            }

            if (OnBeforePositionInterpolation != null)
            {
                OnBeforePositionInterpolation(this, null);
            }

            Oni.ApplyPositionInterpolation(oniSolver, stepTime);

            // if we need to get renderable positions back from the solver:
            if (renderablePositionsClients > 0)
            {
                // get renderable particle anisotropies:
                Oni.GetParticleAnisotropies(oniSolver, anisotropies, anisotropies.Length, 0);

                // get renderable particle positions:
                Oni.GetRenderableParticlePositions(oniSolver, renderablePositions, renderablePositions.Length, 0);

                // convert positions to world space if they are expressed in solver space:
                if (simulateInLocalSpace)
                {
                    Matrix4x4 l2wTransform = transform.localToWorldMatrix;
                    for (int i = 0; i < renderablePositions.Length; ++i)
                    {
                        renderablePositions[i] = l2wTransform.MultiplyPoint3x4(renderablePositions[i]);
                    }
                }
            }

            // Trigger fluid update:
            TriggerFluidUpdateEvents();

            if (OnBeforeActorsFrameEnd != null)
            {
                OnBeforeActorsFrameEnd(this, null);
            }

            UpdateVisibility();

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverFrameEnd();
            }
        }
Exemple #3
0
        public void EndFrame(float frameDelta)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverPreInterpolation();
            }

            if (OnBeforePositionInterpolation != null)
            {
                OnBeforePositionInterpolation(this, null);
            }

            // Update skeletal animation at the end of each render frame.
            Oni.UpdateSkeletalAnimation(oniSolver);

            Oni.ApplyPositionInterpolation(oniSolver, frameDelta);

            // if we need to get renderable positions back from the solver:
            if (renderablePositionsClients > 0)
            {
                Oni.GetRenderableParticlePositions(oniSolver, renderablePositions, renderablePositions.Length, 0);
                if (simulateInLocalSpace)
                {
                    Matrix4x4 l2wTransform = transform.localToWorldMatrix;
                    for (int i = 0; i < renderablePositions.Length; ++i)
                    {
                        renderablePositions[i] = l2wTransform.MultiplyPoint3x4(renderablePositions[i]);
                    }
                }
            }

            // Trigger fluid update:
            TriggerFluidUpdateEvents();

            if (OnBeforeActorsFrameEnd != null)
            {
                OnBeforeActorsFrameEnd(this, null);
            }

            CheckVisibility();

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverFrameEnd();
            }
        }
        public void EndFrame(float stepTime)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverPreInterpolation();
            }

            if (OnBeforePositionInterpolation != null)
            {
                OnBeforePositionInterpolation(this, null);
            }

            Oni.ApplyPositionInterpolation(oniSolver, stepTime);

            // if we need to get renderable positions back from the solver:
            if (renderablePositionsClients > 0)
            {
                // get renderable particle anisotropies:
                Oni.GetParticleAnisotropies(oniSolver, anisotropies, anisotropies.Length, 0);

                // get renderable particle positions:
                Oni.GetRenderableParticlePositions(oniSolver, renderablePositions, renderablePositions.Length, 0);
            }

            // Trigger fluid update:
            TriggerFluidUpdateEvents();

            if (OnBeforeActorsFrameEnd != null)
            {
                OnBeforeActorsFrameEnd(this, null);
            }

            UpdateVisibility();

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverFrameEnd();
            }
        }
        public void EndFrame(float stepTime)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverPreInterpolation();
            }

            if (OnBeforePositionInterpolation != null)
            {
                OnBeforePositionInterpolation(this, EventArgs.Empty);
            }

            // Note: using interpolation together with animator-driven colliders will cause sinking, as particle positions go 1-frame behind.
            Oni.UpdateSkeletalAnimation(oniSolver);

            Oni.ApplyPositionInterpolation(oniSolver, substeps, stepTime / (float)substeps);

            if (OnBeforeActorsFrameEnd != null)
            {
                OnBeforeActorsFrameEnd(this, EventArgs.Empty);
            }

            UpdateVisibility();

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverFrameEnd();
            }

            if (OnFrameEnd != null)
            {
                OnFrameEnd(this, EventArgs.Empty);
            }

            // Reset frame started flag for the next frame:
            frameBegan = false;
        }
Exemple #6
0
        public void EndFrame(float frameDelta)
        {
            foreach (ObiActor actor in actors)
            {
                actor.OnSolverPreInterpolation();
            }

            Oni.ApplyPositionInterpolation(oniSolver, frameDelta);

            Oni.GetBounds(oniSolver, boundsHandle.AddrOfPinnedObject());
            bounds = (Oni.Bounds)boundsHandle.Target;     //TODO: why is this needed, if memory is shared?

            CheckVisibility();

            if (OnBeforeActorsFrameEnd != null)
            {
                OnBeforeActorsFrameEnd(this, null);
            }

            foreach (ObiActor actor in actors)
            {
                actor.OnSolverFrameEnd();
            }
        }
Exemple #7
0
 public void ApplyInterpolation(ObiNativeVector4List startPositions, ObiNativeQuaternionList startOrientations, float stepTime, float unsimulatedTime)
 {
     Oni.ApplyPositionInterpolation(oniSolver, startPositions.GetIntPtr(), startOrientations.GetIntPtr(), stepTime, unsimulatedTime);
 }