예제 #1
0
        public void BakeFrame(float time)
        {
            if (cache == null)
            {
                return;
            }

            ObiParticleCache.Frame frame = new ObiParticleCache.Frame();

            frame.time = time;

            for (int i = 0; i < solver.renderablePositions.Length; ++i)
            {
                // If the particle has not been allocated or is inactive, skip it.
                if (!solver.allocatedParticles.Contains(i) || !solver.activeParticles.Contains(i))
                {
                    continue;
                }

                frame.indices.Add(i);

                if (cache.localSpace)
                {
                    frame.positions.Add(solver.transform.InverseTransformPoint(solver.renderablePositions[i]));
                }
                else
                {
                    frame.positions.Add(solver.renderablePositions[i]);
                }
            }

            cache.AddFrame(frame);
        }
예제 #2
0
        public void BakeFrame(float time)
        {
            if (cache == null)
            {
                return;
            }

            ObiParticleCache.Frame frame = new ObiParticleCache.Frame();

            frame.time = time;

            for (int i = 0; i < solver.renderablePositions.Length; ++i)
            {
                // If the particle has not been allocated or is inactive, skip it.
                ObiSolver.ParticleInActor pa = solver.particleToActor[i];
                if (pa == null || !pa.actor.active[pa.indexInActor])
                {
                    continue;
                }

                frame.indices.Add(i);

                if (cache.localSpace)
                {
                    frame.positions.Add(solver.transform.InverseTransformPoint(solver.renderablePositions[i]));
                }
                else
                {
                    frame.positions.Add(solver.renderablePositions[i]);
                }
            }

            cache.AddFrame(frame);
        }